http://stackoverflow.com/q/27530156
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/43495920
tagged with: jndi
tagged with: java
has comment: http://stackoverflow.com/comment/43908548
has title: How to read JNDI Key value using Java Config from weblogic server
score: 0
has comment: http://stackoverflow.com/comment/43498922
has body: We are moving from xml configuration to use java configuration. I was able to read JNDI datasource using Java config, but not able to find a way to read JNDI Key values using Java config. Any help is highly appreciated. Thankyou, Kranthi.
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43629594
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27603425
score: 1
has text: @Ascalonian, only if you involve variables. Compile time constants are evaluated by the compiler. See my answer.

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

http://stackoverflow.com/q/27629147
score: -1
answer count: 3
possible better answer: http://stackoverflow.com/a/27629186
downvote count: 1
tagged with: button
has answer: http://stackoverflow.com/a/27629188
accepted answer: http://stackoverflow.com/a/27629188
favorite count: 0
has comment: http://stackoverflow.com/comment/43680699
tagged with: colors
has title: How do I set a JButton's fill color?
has comment: http://stackoverflow.com/comment/43678942
has body: How do I? Can I? public class Jbutton { public static void main (String[] args){ JButton button = new JButton("I'm colorful!"); button. What do I do here ^ to set the button color? } }
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27629203
upvote count: 0
linked to: http://stackoverflow.com/q/20959053
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43678960
has answer: http://stackoverflow.com/a/27629186

http://stackoverflow.com/q/27484022
type: Question
has body: The stackoverflow question: Is List<Dog> a subclass of List<Animal>? Why aren't Java's generics implicitly polymorphic? has many correct answers that point out that you can add a Cat to List<Animal> but not to List<Dog>. This leads to the use of constructs like List<? extends Animal>. I have found that there are cases where this is just not convenient and therefore I have defined classes to "down cast" the collection. (See below for an example of DownCastCollection). My question is whether you can present some cases where the best approach is to downcast? If you think it is never the best approach then can you explain why? I realize this is a bit open ended but I think the answers may be very helpful since this situation is common. I do agree that in most cases we should use the `Collection, but I am pointing out that sometimes that is just not the best approach. Have you encountered examples where this is not the best approach and if so can you present them here? Based on the answer in https://stackoverflow.com/a/27491199/4350148 i have changed DownCastCollection to be modifiable and so now it does not return an error. The question still is valid. Here is the downcast collection class: import java.util.AbstractCollection; import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; public class DownCastCollection<E> extends AbstractCollection<E> implements Collection<E> { @SuppressWarnings("rawtypes") private Collection delegate; public DownCastCollection(Collection<? extends E> delegate) { if(delegate == null) throw new IllegalArgumentException(); this.delegate = delegate; } @Override public int size() { return delegate.size(); } @Override public boolean isEmpty() { return delegate.isEmpty(); } @Override public boolean contains(Object o) { return delegate.contains(o); } private class MyIterator implements Iterator<E>{ @SuppressWarnings("rawtypes") Iterator delegateIterator; protected MyIterator() { super(); this.delegateIterator…
possible better answer: http://stackoverflow.com/a/27484147
score: 4
has answer: http://stackoverflow.com/a/27484147
upvote count: 4
accepted answer: http://stackoverflow.com/a/27491199
downvote count: 0
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/2745265
has answer: http://stackoverflow.com/a/27487926
has answer: http://stackoverflow.com/a/27484153
answer count: 4
has title: Are there scenarios in which "Down casting" Collection<? extends T> to Collection<T> makes sense
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27491199

http://stackoverflow.com/comment/47602490
comment on: http://stackoverflow.com/q/27637811
type: Comment
type: QuestionComment
has text: Added an answer which may cover your needs :) let me know if you need additional support.
score: 0

http://stackoverflow.com/q/27541211
has answer: http://stackoverflow.com/a/27541367
has answer: http://stackoverflow.com/a/27541302
has answer: http://stackoverflow.com/a/27541343
score: 0
has answer: http://stackoverflow.com/a/27541294
answer count: 7
has answer: http://stackoverflow.com/a/42529045
favorite count: 0
has answer: http://stackoverflow.com/a/27541504
has comment: http://stackoverflow.com/comment/43517288
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/27541280
upvote count: 2
tagged with: java
downvote count: 2
type: Question
has body: I get a string in this format: 00123456 The string has always 8 digits, starts always with 2 zeros, and the other 6 digits can be anything from 1-9. I have to compare this string to another string, which has the same structure, but without the 2 zeros. So, 00123456 should be equal to 123456. The problem is, that I don't have the possibility to change the strings (e.g. delete the zeros). The only thing I could do, is to add regex before or after the first string. So in Java code, I need something like this, whithout changing the first string itself. I can only add something before and/or after the string: String givenStringWithRegex = "(ignore zeros)00123456"; String userInput = "123456"; if (userInput.matches(givenStringWithRegex)) { // Everything is fine :) } Thank you in advance :) Edit: Thank you for your answers so far, but the problem is, that I cannot change the code of the client application. The client app does userInputString.matches(givenStringWithRegex) and I cannot change this. Thats why I need another solution, for example adding regex to the given string without changing the string itself. Edit2: This is the code in the client application and I can nothing change here. The "regex" variable is the given string and "scannedValue" is the user input (123456). The given string is in my concrete example 00123456. Like I wrote before, I cannot manipulate 00123456. I can only add regex before or after it, for example ???00123456???. And 00???123456 is not possible. I can add this regex in a configuration file of the superior system, so no code change would be needed. Thats why I asked for a regex solution, because I don't want to change code in superior system and client application. public final class RegexValidator implements StringScanValidator { private final String regex; public RegexValidator(final String regex) { this.regex = regex; } @Override public StringScanValidatorResult validate(final String scannedValue) { return scannedValue.matches(regex) ? ne…
has title: To match a bar code: Add regex to a given string, whithout changing the string itself

http://stackoverflow.com/a/27628716
upvote count: 15
accepted answer of: http://stackoverflow.com/q/27628273
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27628273
type: Answer
score: 15
has body: The first method is definitely unsafe. Each call to get is independent. There is nothing preventing the GC from clearing the weakly reachable object after the first get and before the second. The javadoc states Suppose that the garbage collector determines at a certain point in time that an object is weakly reachable. At that time it will atomically clear all weak references to that object and all weak references to any other weakly-reachable objects from which that object is reachable through a chain of strong and soft references. That can be at any point in time. Calling get(), which (potentially) pushes a reference to the object on the stack temporarily makes the object strongly reachable (it's on a thread's stack), but that reach-ability disappears the moment the comparison with null finishes. After that moment, the GC can determine that the object is weakly reachable and clear its reference. You'd then get a NullPointerException. Use your second method. But note that by assigning it to a variable, you are making the referenced object strongly reachable.

http://stackoverflow.com/q/27571656
type: AnsweredQuestion
has title: Cannot initialize SpringServlet for Jersey : JacksonJaxbJsonProvider must be a singleton
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
tagged with: jersey
answer count: 1
has answer: http://stackoverflow.com/a/27624268
accepted answer: http://stackoverflow.com/a/27624268
tagged with: rest
has body: I am a REST/Jersey newbie and I have a simple RESTful Java web service implemented with the Spring version of Jersey... @Service @Path("/getAccountBalance") public class GetAccountBalanceService { @Autowired private ILicenseService licenseService; @GET @Path("/{param}") public Response provideService(@PathParam("param") String licenseUUID) { License license = this.licenseService.getByUUID(licenseUUID); String output = "Balance on the account : " + license.getBalanceValue(); return Response.status(200).entity(output).build(); } and have configured jersey servlet with Spring support in web.xml.. <servlet> jersey-servlet com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages com.freedomoss.crowdcontrol.api 1 jersey-servlet /service/* But when I try to call the service I get the following exception.... Dec 19, 2014 11:34:04 AM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans INFO: Registering Spring bean, jsonProvider, of type com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider as a provider class SEVERE: Exception occurred when intialization java.lang.RuntimeException: The scope of the component class com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider must be a singleton at com.sun.jersey.core.spi.component.ioc.IoCProviderFactory.wrap(IoCProviderFactory.java:102) So I am using JacksonJaxbJsonProvider in another part of my application, so why is Jersey spring touching this class and then complaining about it? Thanks.
tagged with: spring

http://stackoverflow.com/q/27630222
tagged with: android
accepted answer: http://stackoverflow.com/a/27630981
type: AnsweredQuestion
tagged with: java
tagged with: android-camera-intent
has title: How to show a captured image in an ImageView?
type: Question
has body: I'm trying to display a captured image from a camera intent, but when I call a showPhoto method the image isn't shown in the ImageView. There is no error output to the stack trace so I'm not sure how the issue can be debugged. Does anyone know what is wrong with the method that its not showing the captured image? The showPhoto method is as follows: private void showPhoto(Uri photoUri) { String filePath = photoUri.getEncodedPath(); File imageFile = new File(filePath); //File imageFile = new File(photoUri.getPath()); if (imageFile.exists()){ Drawable oldDrawable = photoImage.getDrawable(); if (oldDrawable != null) { ((BitmapDrawable)oldDrawable).getBitmap().recycle(); } Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath()); BitmapDrawable drawable = new BitmapDrawable(this.getResources(), bitmap); photoImage.setScaleType(ImageView.ScaleType.FIT_CENTER); photoImage.setImageDrawable(drawable); } } This is the tutorial that I've followed: http://www.linux.com/learn/tutorials/722038-android-calling-the-camera The device I'm testing on is JellyBean 4.1 and this is the link to the complete class: http://hastebin.com/oqokupulol.java
has comment: http://stackoverflow.com/comment/43682070
tagged with: imageview
score: 0
has answer: http://stackoverflow.com/a/27630981
answer count: 1
linked to: http://stackoverflow.com/q/15799307

http://stackoverflow.com/comment/43554143
comment on: http://stackoverflow.com/q/27531634
type: Comment
type: QuestionComment
has text: When you include Spring HATEOAS you get HAL support out of the box. And it doesn't depend on the media type. I don't understand what you are trying to achieve. Which functionality do you need that's not supported by Spring HATEOAS?
score: 0

http://stackoverflow.com/comment/43650617
type: Comment
type: QuestionComment
has text: pass Context to static method
comment on: http://stackoverflow.com/q/27614274
score: 0

http://stackoverflow.com/q/27593553
tagged with: tiles
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/43610770
has title: Java chances (Less chance if further from something)
tagged with: java
has comment: http://stackoverflow.com/comment/43611661
has body: I'm creating an island for my game and i have a map middle point where its land and all other is water. How to make a chance calculator for the tile to be land (if close to center 100% chance and lowering the further it's from it)? so far what I only can do for one side of map: float centerx=r.mapsize/2*r.tilesize, centery=centerx; if(position.x&lt;centerx&amp;&amp;position.y&lt;centery){ float distancex = centerx-position.x, distancey = centerx-position.y; boolean chancex = rr.nextInt((int)distancex)/5==0; boolean chancey=rr.nextInt((int)distancey)/5==0; if(chancex&amp;&amp;chancey){sprite=AssetLoader.grass;} } But it doent look like an island side. Its like tiles exploded from the center.
type: Question
upvote count: 0
tagged with: libgdx
score: -2
has answer: http://stackoverflow.com/a/27594653
has comment: http://stackoverflow.com/comment/43610907

http://stackoverflow.com/q/27487996
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: drools
answer count: 2
tagged with: kie-workbench
upvote count: 1
possible better answer: http://stackoverflow.com/a/29510560
tagged with: web
has answer: http://stackoverflow.com/a/29510560
favorite count: 0
linked to: http://stackoverflow.com/q/27632881
has answer: http://stackoverflow.com/a/28597618
accepted answer: http://stackoverflow.com/a/28597618
has body: I'm trying to integrate my KIE Workbench 6.1.FINAL deployment with a simple application using Drools 6.1.FINAL. I use the following code: String url = "http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar"; KieServices ks = KieServices.Factory.get(); UrlResource urlResource = (UrlResource) ks.getResources().newUrlResource(url); urlResource.setBasicAuthentication("enabled"); urlResource.setUsername("admin"); urlResource.setPassword("admin"); try { InputStream is = urlResource.getInputStream(); KieModule kModule = ks.getRepository().addKieModule(ks.getResources().newInputStreamResource(is)); kieContainer = ks.newKieContainer(kModule.getReleaseId()); kieContainer.newStatelessKieSession(); scanner = ks.newKieScanner(kieContainer); } catch(Exception e) { System.out.println("Exception thrown while constructing InputStream"); System.out.println(e.getMessage()); } Every time I run this code, I see the following output: Exception thrown while building InputStream Server returned HTTP response code: 401 for URL: http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar I verified that the error is coming from the line getting the InputStream. I am able to log in to my workbench at http://localhost:8088/workbench with the username and password "admin" and I am able to download the .jar file by following http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar in my web browser. I can also retrieve the .jar using the following curl command: curl --user admin:admin http://localhost:8088/workbench/maven2/com/sep/test/myProject/1.0/myProject-1.0.jar However, I haven't been able to fetch the .jar using wget. How can I get past the authentication? This is only a prototype; is there a way to turn off authentication for downloading this .jar file?
has title: KIE Workbench Integration Responds with 401
tagged with: curl

http://stackoverflow.com/q/27476043
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27476254
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43386863
tagged with: java
has title: Deleting elements from a binary search tree
has comment: http://stackoverflow.com/comment/43386511
type: Question
has body: I am currently writing a method that removes a given value from a binary search tree. However when I call it, it deletes the said value but then duplicates every other value. I have no idea why. Please tell me what is wrong. There are two methods, one that find the elements, and the other that deletes it. Here is the one that finds that element... public static TreeNode delete(TreeNode t, Comparable x, TreeDisplay display) { if( x.compareTo(t.getValue()) &gt; 0) { display.visit(t); t.setRight(delete( t.getRight(), x, display)); } else if ( x.compareTo(t.getValue()) &lt; 0) { display.visit(t); t.setLeft(delete(t.getLeft(), x, display)); } else { t = deleteNode(t, display); } return t; This is the method that deletes the value private static TreeNode deleteNode(TreeNode t, TreeDisplay display) { if (t.getRight()!=null) { TreeNode right = t.getRight(); TreeNode max = (TreeNode)TreeUtil.leftmost(right); TreeNode previous = null; while ( right.getLeft()!=null&amp;&amp;right.getLeft().getLeft()!=null) { right = right.getLeft(); } t.setValue(max.getValue()); if ( max.getRight()==null) { right.setLeft(null); } else { right.setLeft(max.getRight()); } } else if (t.getLeft() !=null) { TreeNode left = t.getLeft(); TreeNode max = (TreeNode)TreeUtil.rightmost(left); while(left.getRight()!=null &amp;&amp;left.getRight().getRight()!=null) { left = left.getRight(); } t.setValue(max.getValue()); if ( max.getLeft()==null) { left.setRight(null); } else { left.setRight(max.getLeft()); } } else { t = null; } return t; } Thanks in advance!

http://stackoverflow.com/a/27499563
score: 1
has comment: http://stackoverflow.com/comment/43468759
has comment: http://stackoverflow.com/comment/43452630
downvote count: 0
answers question: http://stackoverflow.com/q/27499307
has comment: http://stackoverflow.com/comment/43439173
has comment: http://stackoverflow.com/comment/43439184
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43439013
has body: To get rid of the LISTENING port you have to call serverSocket.close().

http://stackoverflow.com/comment/43479662
type: QuestionComment
type: Comment
has text: You might want to edit your question to clarify that: rowid has a specific meaning (both in SQL and JDBC).
comment on: http://stackoverflow.com/q/27525270
score: 0

http://stackoverflow.com/q/27545740
has body: In the following program the display method is not part of Student4 constructor. So, when the method display is called using the Student4 constructor object does a default constructor invokes the display method? class Student4 { int id; String name; Student4(int i,String n){ id = i; name = n; } void display() { System.out.println(id+" "+name); } public static void main(String args[]) { Student4 s1 = new Student4(111,"Karan"); Student4 s2 = new Student4(222,"Aryan"); s1.display(); s2.display(); } }
tagged with: java
has answer: http://stackoverflow.com/a/27545770
type: Question
score: 0
answer count: 5
has comment: http://stackoverflow.com/comment/43518183
has comment: http://stackoverflow.com/comment/43520467
has answer: http://stackoverflow.com/a/27545818
has answer: http://stackoverflow.com/a/27545850
has answer: http://stackoverflow.com/a/27546244
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27545859
has title: Is default constructor generated?

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/27504161
tags question: http://stackoverflow.com/q/27586415
tags question: http://stackoverflow.com/q/27567217
tags question: http://stackoverflow.com/q/27553623
tag name: jfreechart

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

http://stackoverflow.com/q/27566889
type: Question
has body: I saw in eclipse, while renaming a file, JSP index manager waiting for resources. So, I want to know that, what is JSP index manager? Is it a part of eclipse or JVM?
tagged with: eclipse
upvote count: 2
answer count: 1
tagged with: jvm
favorite count: 0
has title: JSP index manager - eclipse
score: 2
has answer: http://stackoverflow.com/a/27566939
downvote count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/27590899
has body: Try this : int []list = new int[num]; for (int i = 0; i &lt; list.length; i++) { list[i] = i + 1; }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27590875
upvote count: 2
has comment: http://stackoverflow.com/comment/43605665
has comment: http://stackoverflow.com/comment/43605711
has comment: http://stackoverflow.com/comment/43605715
has comment: http://stackoverflow.com/comment/43605658
type: Answer
has comment: http://stackoverflow.com/comment/43605754

http://stackoverflow.com/a/27617720
upvote count: 5
has comment: http://stackoverflow.com/comment/43658222
has body: You can do // a condensed way of doing FSTS = { "Daws", "Rom", ... }; static final String[] FSTS = "Daws,Rom,Trout,Bally,Kuu,Invery,Dragon,Bam,Laen,Glen".split(","); // later fst = FSTS[f-1];
answers question: http://stackoverflow.com/q/27617688
downvote count: 0
type: Answer
score: 5

http://stackoverflow.com/a/27545388
upvote count: 2
has comment: http://stackoverflow.com/comment/43517858
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27545308
type: Answer
answers question: http://stackoverflow.com/q/27545308
has comment: http://stackoverflow.com/comment/43517940
score: 2
has comment: http://stackoverflow.com/comment/43517997
has body: You can alternate ";" with the end of the input to reach your goal: String[] inputs = { "Coord=(1,1)",// -- Expected output: True "Coord=(1,1);",// -- Expected output: True "Coord=(1,1):",// -- Expected output: False "Coord=(1,1)abc",// -- Expected output: False "Coord=(1,1);abc"// -- Expected output: True }; // | this is the important bit Pattern p = Pattern.compile("Coord=\\(\\d,\\d\\)(;|$)"); for (String input: inputs) { Matcher m = p.matcher(input); System.out.printf("%s found? %b%n", input, m.find()); } Output Coord=(1,1) found? true Coord=(1,1); found? true Coord=(1,1): found? false Coord=(1,1)abc found? false Coord=(1,1);abc found? true
downvote count: 0

http://stackoverflow.com/a/27628263
has body: In your second example using ScheduledExecutorService executor.scheduleWithFixedDelay(clearstage(), 0, 5, TimeUnit.SECONDS); The second argument is initialDelay. Here is the Javadoc ScheduledFuture&lt;?&gt; scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) ... initialDelay - the time to delay first execution You are passing in 0 so the first scheduled Runnable will not delay. ExecutorService.shutdown() runs all tasks that were scheduled and then shuts down. Since you are also calling shutdown() immediately after, the task will not be scheduled and will not execute. Another option if using ScheduledExecutorService is to schedule a task with a delay using the public ScheduledFuture&lt;?&gt; schedule(Runnable command, long delay, TimeUnit unit); method. Since it is scheduled before calling shutdown(), it will always finish. ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); scheduledFuture = executor.schedule(clearstage(), 5, TimeUnit.SECONDS); executor.shutdown(); You can also wait for your scheduled future to be complete. It is unclear from the question exeactly what you are looking for. ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); ScheduledFuture&lt;?&gt; scheduledFuture = executor.schedule(clearstage(), 5, TimeUnit.SECONDS); scheduledFuture.get(); // Wait for completion executor.shutdown()
has comment: http://stackoverflow.com/comment/43678404
has comment: http://stackoverflow.com/comment/43677497
type: Answer
answers question: http://stackoverflow.com/q/27628106
score: 0

http://stackoverflow.com/comment/43507314
type: Comment
type: QuestionComment
has text: Regarding your most recent update: If your `Tete` class has an `equals` that makes `("nome2",4)` equal to `("nome3",4)`, then you still can't add them both the the set, because a `Set` requires that no two elements be equal according to the `equals` method.
comment on: http://stackoverflow.com/q/27537734
score: 0

http://stackoverflow.com/comment/43524022
has text: Let's see... using obsolete DB library, vulnerable to [SQL injection attacks](http://bobby-tables.com), no error checking. So.. yeah...
comment on: http://stackoverflow.com/q/27548809
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43440956
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27484982
has text: See [here](https://jersey.java.net/documentation/latest/wadl.html)
type: Comment

http://stackoverflow.com/q/27532206
favorite count: 0
tagged with: parsing
has body: I have JSON string which contains a list of objects: [ {title: title1,id: 1,children: [ {title: title1_1,id: 1_1,children: [ {title: title1_1_1,id: 1_1_1,children: []}, {title: title1_1_2,id: 1_1_2,children: []} ]} ]}, {title: title2,id: 2,children: [ {title: title2_1,id: 2_2,children: []} ]} ] I would like to create list of Objects in java from this json string from above. Can I do this with jsonMapper read method from Jackson package? Can You give me some examples? -- Edit -- here is my class. @Entity @Table(name="procedure__SkeletonElement") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="type") public abstract class SkeletonElement extends GenericHierarchicalModel&lt;SkeletonElement&gt; { @Transient public String getDecriminatorValue() { return this.getClass().getSimpleName(); } @Override public String toJson() { return "{\"title\":\"" + this.getName() + "\", \"id\":\"" + this.getId() + "\", \"type\":\"" + this.getDecriminatorValue() + "\", \"children\": [" + listToJson(this.getChildren()) + "]}"; } public SkeletonElement toObject(String jsonObject) { System.out.println("dedicated method"); ObjectMapper jsonMapper = new ObjectMapper(); try { //GenericModel&lt;T&gt; t = jsonMapper.readValue(jsonObject, GenericModel.class); SkeletonElement skeletonElement = jsonMapper.readValue(jsonObject, SkeletonElement.class); //return t; return skeletonElement; } catch (JsonGenerationException e) { e.printStackTrace(); return null; } catch (JsonMappingException e) { e.printStackTrace(); return null; } catch (IOException e) { e.printStackTrace(); return null; } } } and the class that is extended: @MappedSuperclass public abstract class GenericHierarchicalModel&lt;T extends GenericHierarchicalModel&lt;T&gt;&gt; extends GenericModel&lt;T&gt; { private String name; @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) private T parent; @OneToMany(mappedBy = "parent") private List&lt;T&gt; children; public String getName() {return name;} public void…
type: UnansweredQuestion
upvote count: 1
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
has comment: http://stackoverflow.com/comment/43492904
has comment: http://stackoverflow.com/comment/43493509
type: Question
has comment: http://stackoverflow.com/comment/43493441
has comment: http://stackoverflow.com/comment/43492965
tagged with: jackson
score: 0
has comment: http://stackoverflow.com/comment/43494196
has title: java create list of objects from json string with jackson. Error: abstract types can only be instantiated with additional type information

http://stackoverflow.com/comment/43573971
has text: You've got to create a helper class that implements Runnable and that handles the data stream interaction for one user. then in your main class, generate these helper classes with each socket accept, and run them in their own thread. Best if you use a ThreadPool to do this. Note that there are tutorials for this very thing, including one by Oracle, and I'm quite surprised that you haven't found any yet. Quite surprised.
type: QuestionComment
comment on: http://stackoverflow.com/q/27574220
score: 1
type: Comment

http://stackoverflow.com/a/27838136
type: Answer
answers question: http://stackoverflow.com/q/27539419
score: 0
has body: This is the function that can help you. public void ArrayList&lt;ArrayList&lt;Integer&gt;&gt; convert2DStringTo2DIntegerArray(String[][] original) { ArrayList&lt;ArrayList&lt;Integer&gt;&gt; list = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); for (int i = 0; i &lt; original.length; i++) { ArrayList&lt;Integer&gt; tempArray = new ArrayList&lt;Integer&gt;(); for (int j = 0; j &lt; original[i].length; j++) { tempArray.add(Integer.valueOf(original[i][j])); } list.add(tempArray); } return list; }

http://stackoverflow.com/comment/43670721
has text: Yes, you are right. I thought since `Executors.newWorkStealingPool` created a `ForkJoinPool` that it might be a good match
comment on: http://stackoverflow.com/a/27624871
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27562938
type: Question
tagged with: hyperlink
has body: I searched for some answers on stackoverflow and atlassian but so far didnt find anything useful for me. Maybe I'm just asking the wrong questions, but here my situation: Currently I am writing a Jira TabPanel Plugin, where data of an issue is displayed in the tabpanel. So far everything works fine. I now want to link from the HTML (or JavaScript) of my TabPanel back to my plugin to call an export function, that can save the data in specific formats. I have no idea how i can do this. My first guesses were that there is a Button you can create from the Java Jira code with a linked ActionListener or some JavaScript that calls the functions for you. But I have not found anything useful for me so far. Can anyone give me some Information if and how you can do this and maybe some example? I am very thankful in advance. Regards Chris
score: 0
accepted answer: http://stackoverflow.com/a/27863036
answer count: 1
has comment: http://stackoverflow.com/comment/43553805
has title: Jira Plugin link HTML to plugin functions
has comment: http://stackoverflow.com/comment/43556145
tagged with: http://stackoverflow.com/tag/html
tagged with: plugins
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43557427
tagged with: java
has answer: http://stackoverflow.com/a/27863036
tagged with: jira

http://stackoverflow.com/q/27552455
has body: I have been stuck with a very strange problem with layouts &amp; fragments. I have been assigned with fixing an app that has really poor logic &amp; design. It has single activity &amp; all layout changes are done by simply removing content on wrapper (LinearLayout) and adding views to it. I have been trying to inflate layout with &lt; fragment > inside. And it works just fine. But when I change wrapper content (removeAllViews()) with different content and then try to reinflate layout with fragment again I get exception with: 12-18 18:28:36.711: E/AndroidRuntime(11192): Caused by: java.lang.IllegalArgumentException: Binary XML file line #7: Duplicate id 0x7f07014d, tag null, or parent id 0x0 with another fragment for com.test.fragments.SearchTabhostFragment While I remove parent layout (wrapper) - Fragment is not executing any of the lifecycle functions (onPause, onStop, onDestroyView etc). Inflating &amp; reinflating later on: LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.search, wrapper); Destroying: if (wrapper.getChildCount() &gt; 0) { wrapper.startAnimation(out); wrapper.removeAllViews(); } Search XML: &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:orientation="vertical" &gt; &lt;fragment android:id="@+id/fragment1" android:name="com.test.fragments.SearchTabhostFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" /&gt; &lt;/RelativeLayout&gt; Any idea what I might do to clear it from FragmentManager? Is there an event I might use on layout to find out it is being removed?
type: Question
tagged with: android-layout
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43534511
has comment: http://stackoverflow.com/comment/43531470
score: 0
has comment: http://stackoverflow.com/comment/43531915
has comment: http://stackoverflow.com/comment/43531820
has comment: http://stackoverflow.com/comment/43531789
has title: Fragment not calling onDestroyView while parent layout removed
has comment: http://stackoverflow.com/comment/43531643
has comment: http://stackoverflow.com/comment/43546259
tagged with: android
has comment: http://stackoverflow.com/comment/43532640
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43630043
comment on: http://stackoverflow.com/q/27603853
score: 0
type: QuestionComment
type: Comment
has text: Which applicationserver are you using? It looks like you're using tomcat, which is a web container, not a full blown application server. It has no support for CDI out of the box.

http://stackoverflow.com/comment/43384607
has text: You could check what is the value of your coordinates variables when you do the last turn `(-270, 0, 1, 0)` to see if they are meeting the cryteria in another `if` block.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27475010

http://stackoverflow.com/comment/43489018
comment on: http://stackoverflow.com/q/27530062
score: 1
has text: Override `prepareRenderer()`, as shown in these [examples](http://stackoverflow.com/search?tab=votes&q=%5bjtable%5d%20prepareRenderer).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27529468
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/27530103
favorite count: 0
answer count: 3
has title: Need help getting my Java Rock-Paper-Scissors game to compile
has answer: http://stackoverflow.com/a/27529634
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27529627
score: -4
has comment: http://stackoverflow.com/comment/43487486
tagged with: debugging
tagged with: java
has body: I've been trying to get this code to work for the past week now, and every time I make one change I end up with more bugs. Can anyone help figure out where I've gone wrong? The code is split up into two files: a runner class, and a class with all the methods. import java.util.Scanner; import static java.lang.System.*; public class RPSRunner { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); String response = ""; String player = ""; RockPaperScissors game = new RockPaperScissors(); System.out.print("What is your name? : "); player = keyboard.next(); out.print("type in your prompt [R,P,S] :: "); response = keyboard.next(); game.setPlayers(); game.convertUserInput(response); game.setPlayerChoice(response); game.computerThink(); game.determineWinner(); } } The method class: import java.util.Scanner; import static java.lang.System.*; import java.util.Random; public class RockPaperScissors { private String playerName; //used to set player's name private int playChoice; //player's choice as a number private int compChoice; //computer's choice as a number private int playerNumber; Random rand = new Random(); //allows useage of random methods public RockPaperScissors() { //sets everything to null, prepare for incoming calculations playerName = ""; } public RockPaperScissors(String player) { playerName = player; } public void setPlayers(String player) { //good ol mutator method playerName = player; } public String convertUserInput(String response) { //Convert R, P, S to integer using switch case //If invalid input, set to -1 switch(response) { case "R": playChoice = 0; break; case "P": playChoice = 1; break; case "S": playChoice = 2; break; default: playChoice = -1; } } public boolean setPlayerChoice(String response) { //TODO set playChoice to convertUserInput //return (playChoice != -1) playChoice = convertUserInput(response); return(playChoice != -1); } public int computerThink() { //Use Math.random from 0-2 inclusive //return it all in on…
type: Question

http://stackoverflow.com/q/27560039
has answer: http://stackoverflow.com/a/79539472
linked to: http://stackoverflow.com/q/9927126
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/43061637
answer count: 3
has comment: http://stackoverflow.com/comment/43547386
score: 3
favorite count: 0
has body: I have a HTML table that I want to parse and convert to JSON. Network Technology GSM 2G bands GSM 900 / 1800 - SIM 1 & SIM 2 GPRS Class 12 EDGE Yes In the above table Network JSON array name should be "Network". Technology Technology is a subheading of Network, so it must be a JSON element inside the JSON array. The values coming inside Technology array should be the values from GSM I hope my question is clear. How can i do that?
type: UnansweredQuestion
has title: Extract data from a HTML table and convert to JSON
has answer: http://stackoverflow.com/a/27561164
upvote count: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/43546441
has comment: http://stackoverflow.com/comment/43546274

http://stackoverflow.com/a/27550132
type: AcceptedAnswer
upvote count: 2
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27549562
has body: It should be on the service layer. If you have some sort of user service in your application (for instance an implementation of UserDetailsService), put the method for creating a new user there and set the default role in that method. DAO layer should be concerned with CRUD access to your database and as such it shouldn't deal with business logic such as assigning default roles when creating users. Controller is also not a suitable place for this kind of logic, because it is a presentation layer component and user creation/role assignment is a core logic completely independent of the presentation layer. I'm not sure about using a database trigger for this purpose, but personally I like to keep my logic in my application not scattered between database and the application.
score: 2
answers question: http://stackoverflow.com/q/27549562

http://stackoverflow.com/comment/43603413
score: 0
type: Comment
has text: Can you please explain me why declaring a field inside a method is not allowed?
type: AnswerComment
comment on: http://stackoverflow.com/a/27589556

http://stackoverflow.com/comment/43625561
score: 0
has text: Check for any missing/empty exception handlers.
type: Comment
comment on: http://stackoverflow.com/q/27600035
type: QuestionComment

http://stackoverflow.com/a/27497157
upvote count: 2
type: Answer
has body: Because the allowed range of a Java int is between -2,147,483,648 and 2,147,483,647. Trying to read in a 10 digit value higher than 2,147,483,647 will yield an exception. To solve, instead of using nextInt(), use nextLong() and read the input into a variable of type long. Alternatively, don't use a numeric type to store phone numbers, but store it as a string.
answers question: http://stackoverflow.com/q/27497144
score: 2
downvote count: 0

http://stackoverflow.com/comment/43680319
score: 2
has text: You create an instance of `MultipleObjects` using the `(int, int)` constructor, then pass it to the copy constructor.
comment on: http://stackoverflow.com/q/27629883
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43609060
score: 0
type: AnswerComment
has text: @Elltz because his original question was far shorter than it is now. Have a look at the revisions.
type: Comment
comment on: http://stackoverflow.com/a/27591364

http://stackoverflow.com/comment/43619547
type: Comment
has text: James, Thank you. The new random line code block you added looks like just what I needed. The explanation helped too. The random line each time seems to work fine with my test files on Windows straight away. I will tinker with it on Android (using /storage/emulated/0/temp/mantra.txt as the path) via JavaFXPorts as it hung on my first attempt. In any case, I really appreciate it.
comment on: http://stackoverflow.com/a/27593059
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43639308
score: 0
type: AnswerComment
type: Comment
has text: I remember Arun Gupta saying that it should ease the learning curve for beginners. At least you are now able to start an application that uses JPA without having to worry about installing and configuring a database before.
comment on: http://stackoverflow.com/a/27600495

http://stackoverflow.com/q/27527578
has comment: http://stackoverflow.com/comment/43484221
has comment: http://stackoverflow.com/comment/43484155
has comment: http://stackoverflow.com/comment/43484174
has comment: http://stackoverflow.com/comment/43484215
possible better answer: http://stackoverflow.com/a/27531766
has comment: http://stackoverflow.com/comment/43483811
has comment: http://stackoverflow.com/comment/43483745
has comment: http://stackoverflow.com/comment/43483812
has comment: http://stackoverflow.com/comment/43483795
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43483818
has comment: http://stackoverflow.com/comment/43483841
tagged with: java
has comment: http://stackoverflow.com/comment/43484231
has comment: http://stackoverflow.com/comment/43484646
has answer: http://stackoverflow.com/a/29104904
has comment: http://stackoverflow.com/comment/43497772
type: Question
tagged with: jodatime
has comment: http://stackoverflow.com/comment/43484038
accepted answer: http://stackoverflow.com/a/29104904
has title: Weird Date issue
has comment: http://stackoverflow.com/comment/43483759
answer count: 2
has comment: http://stackoverflow.com/comment/43484043
has comment: http://stackoverflow.com/comment/43483837
score: 2
downvote count: 0
has body: Running the following method as a test on its own class DateTime dt = new DateTime(1942, 11, 16, 1, 0, 0); System.out.println(dt.getChronology().getZone().getID()); System.out.println(dt); System.out.println(dt.withZone(DateTimeZone.forID("Europe/London"))); System.out.println(dt.toDate()); gives the output: Europe/London 1942-11-16T01:00:00.000+01:00 1942-11-16T01:00:00.000+01:00 Mon Nov 16 01:00:00 BST 1942 However, running all tests, which includes the above method, results in: Europe/London 1942-11-16T01:00:00.000+01:00 1942-11-16T01:00:00.000+01:00 Mon Nov 16 00:00:00 BDT 1942 I'm at a bit of a loss how to explain this behaviour... My system timezone is definitely not changing between the two kinds of test execution..... (This is an issue as this also sometimes but not reproducibly occurs when manipulating java.util.Date)
favorite count: 0
has answer: http://stackoverflow.com/a/27531766
has comment: http://stackoverflow.com/comment/43483769
upvote count: 2

jwebunit
tags question: http://stackoverflow.com/q/27625644
tag name: jwebunit
type: Tag
tags question: http://stackoverflow.com/q/27549295

http://stackoverflow.com/comment/43529723
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27551692
has text: This `someContext` needs to be in my signup.xml file? will it be visible even when no error is there?

http://stackoverflow.com/comment/43640244
score: 0
type: Comment
type: QuestionComment
has text: it's text. even a simple "string.indexOf('username')" would be kinda-sorta-notreally functional.
comment on: http://stackoverflow.com/q/27608988

http://stackoverflow.com/q/27580655
has comment: http://stackoverflow.com/comment/84261833
score: 8
has body: Is there any direct way to set a date to a variable but as an input? I mean that i don't know the date at design time, the user should give it. I tried the following code but it doesn't work: Calendar myDate=new GregorianCalendar(int year, int month , int day);
linked to: http://stackoverflow.com/q/38922754
has comment: http://stackoverflow.com/comment/43585747
has answer: http://stackoverflow.com/a/69744295
tagged with: date
has answer: http://stackoverflow.com/a/42088900
linked to: http://stackoverflow.com/q/5585779
has answer: http://stackoverflow.com/a/66074727
has comment: http://stackoverflow.com/comment/43585687
has answer: http://stackoverflow.com/a/27583797
has comment: http://stackoverflow.com/comment/43586239
downvote count: 0
has answer: http://stackoverflow.com/a/56600968
favorite count: 0
has answer: http://stackoverflow.com/a/66069088
answer count: 9
upvote count: 8
type: UnansweredQuestion
has title: How to set a date as input in java?
has answer: http://stackoverflow.com/a/40872825
has answer: http://stackoverflow.com/a/27580870
tagged with: java
tagged with: gregorian-calendar
tagged with: calendar
has answer: http://stackoverflow.com/a/69618404
type: Question

http://stackoverflow.com/q/27607949
has comment: http://stackoverflow.com/comment/43641068
has comment: http://stackoverflow.com/comment/43638375
tagged with: spring
type: Question
tagged with: java
tagged with: hibernate
downvote count: 4
has comment: http://stackoverflow.com/comment/43640022
upvote count: 0
has body: I don't understand why this throw me an error, both objects are equals, what can be happening? I think, there is something wrong with the Pet collection, because if i delete it, all works fine. java.lang.AssertionError: expected: org.company.petshop.domains.Person&lt;Person [id=10, dni=3547249, email=jdoe@mail.com, firstName=John, lastName=Doe, username=johndoe, password=johndoe, role=USER_ROLE, status=Active, pets=[]]&gt; but was: org.company.petshop.domains.Person&lt;Person [id=10, dni=3547249, email=jdoe@mail.com, firstName=John, lastName=Doe, username=johndoe, password=johndoe, role=USER_ROLE, status=Active, pets=[]]&gt; at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:834) at org.junit.Assert.assertEquals(Assert.java:118) at org.junit.Assert.assertEquals(Assert.java:144) at org.company.petshop.services.PersonServicesTests.testPersonShouldBeSaved(PersonServicesTests.java:24) the unit test is: public class PersonServicesTests { @Autowired private IGenericService&lt;Person&gt; personService; @Test public void testPersonShouldBeSaved() { Person p = new Person(3547249, "jdoe@mail.com", "John", "Doe", "johndoe", "johndoe", "USER_ROLE"); personService.create(p); assertEquals(p, personService.findById(10)); } } the equals method: @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Person other = (Person) obj; if (dni == null) { if (other.dni != null) return false; } else if (!dni.equals(other.dni)) return false; if (email == null) { if (other.email != null) return false; } else if (!email.equals(other.email)) return false; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstName)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (lastName == null) { if (other.lastName != null) return false; } else if (!lastN…
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/43638674
has answer: http://stackoverflow.com/a/27650714
favorite count: 0
has comment: http://stackoverflow.com/comment/43638512
has comment: http://stackoverflow.com/comment/43638679
accepted answer: http://stackoverflow.com/a/27650714
has title: Java equals does not working correctly
type: AnsweredQuestion
score: -4

swing
tags question: http://stackoverflow.com/q/27579627
tags question: http://stackoverflow.com/q/27488432
tags question: http://stackoverflow.com/q/27605282
tags question: http://stackoverflow.com/q/27622536
tags question: http://stackoverflow.com/q/27567356
tags question: http://stackoverflow.com/q/27581052
tags question: http://stackoverflow.com/q/27629147
tags question: http://stackoverflow.com/q/27537764
tags question: http://stackoverflow.com/q/27584229
tags question: http://stackoverflow.com/q/27526245
tags question: http://stackoverflow.com/q/27606307
tags question: http://stackoverflow.com/q/27630305
tags question: http://stackoverflow.com/q/27617043
tags question: http://stackoverflow.com/q/27632103
tags question: http://stackoverflow.com/q/27534460
tags question: http://stackoverflow.com/q/27558409
tags question: http://stackoverflow.com/q/27582207
tags question: http://stackoverflow.com/q/27573978
tags question: http://stackoverflow.com/q/27608643
tags question: http://stackoverflow.com/q/27602622
tags question: http://stackoverflow.com/q/27480108
tags question: http://stackoverflow.com/q/27565458
tags question: http://stackoverflow.com/q/27587013
tags question: http://stackoverflow.com/q/27611884
tags question: http://stackoverflow.com/q/27515747
tags question: http://stackoverflow.com/q/27583419
tags question: http://stackoverflow.com/q/27480274
tags question: http://stackoverflow.com/q/27582539
tags question: http://stackoverflow.com/q/27582212
tags question: http://stackoverflow.com/q/27519439
tags question: http://stackoverflow.com/q/27498104
tags question: http://stackoverflow.com/q/27622790
tags question: http://stackoverflow.com/q/27599173
tags question: http://stackoverflow.com/q/27634161
tags question: http://stackoverflow.com/q/27511216
tags question: http://stackoverflow.com/q/27516581
tags question: http://stackoverflow.com/q/27588490
tags question: http://stackoverflow.com/q/27629027
tags question: http://stackoverflow.com/q/27556412
tags question: http://stackoverflow.com/q/27525019
tags question: http://stackoverflow.com/q/27591662
tags question: http://stackoverflow.com/q/27570571
tags question: http://stackoverflow.com/q/27590763
tags question: http://stackoverflow.com/q/27563913
tags question: http://stackoverflow.com/q/27632462
tags question: http://stackoverflow.com/q/27636030
tags question: http://stackoverflow.com/q/27624466
tags question: http://stackoverflow.com/q/27547555
tags question: http://stackoverflow.com/q/27518555
tags question: http://stackoverflow.com/q/27517814
tags question: http://stackoverflow.com/q/27536818
tags question: http://stackoverflow.com/q/27529120
tags question: http://stackoverflow.com/q/27538317
tags question: http://stackoverflow.com/q/27548451
tags question: http://stackoverflow.com/q/27496488
tags question: http://stackoverflow.com/q/27496287
tags question: http://stackoverflow.com/q/27536907
tags question: http://stackoverflow.com/q/27616405
tags question: http://stackoverflow.com/q/27606506
tags question: http://stackoverflow.com/q/27611958
tags question: http://stackoverflow.com/q/27582923
tags question: http://stackoverflow.com/q/27593719
tags question: http://stackoverflow.com/q/27604470
tags question: http://stackoverflow.com/q/27587012
tags question: http://stackoverflow.com/q/27631648
tags question: http://stackoverflow.com/q/27491476
tags question: http://stackoverflow.com/q/27578065
type: Tag
tags question: http://stackoverflow.com/q/27610396
tags question: http://stackoverflow.com/q/27584832
tags question: http://stackoverflow.com/q/27479404
tags question: http://stackoverflow.com/q/27589848
tags question: http://stackoverflow.com/q/27537307
tags question: http://stackoverflow.com/q/27542648
tags question: http://stackoverflow.com/q/27494308
tags question: http://stackoverflow.com/q/27579592
tags question: http://stackoverflow.com/q/27522264
tags question: http://stackoverflow.com/q/27633292
tags question: http://stackoverflow.com/q/27616123
tags question: http://stackoverflow.com/q/27476848

http://stackoverflow.com/comment/43576676
comment on: http://stackoverflow.com/q/27575474
type: Comment
type: QuestionComment
score: 0
has text: Actually you don't need 24 if statements. Create a variable that stores the number of the last button clicked, when you got a new click, you compare the new with the last one, if it's ok(right order) then you update the value of last clicked otherwise you tell the user.

http://stackoverflow.com/comment/43496992
score: 1
has text: Tried changing `-Dosgi.requiredJavaVersion=1.7` to 1.8 or removing it entirely?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27534250

http://stackoverflow.com/comment/43497148
type: Comment
type: QuestionComment
score: 1
has text: Sure @Fruloops. My guess is that flipping your logic from `!= 0` to `== 1` also changed your output from minimum (0) to maximum (20). I thought that was strange, and perhaps indicative of something wrong with the code that compared the data, or maybe the data itself. Just a thought.
comment on: http://stackoverflow.com/q/27533551

http://stackoverflow.com/a/27523367
has comment: http://stackoverflow.com/comment/43475766
answers question: http://stackoverflow.com/q/27523339
upvote count: 6
type: AcceptedAnswer
has body: arrayList.add(a[0].split("\\.")[0]);
has comment: http://stackoverflow.com/comment/43475674
type: Answer
score: 6
downvote count: 0
has comment: http://stackoverflow.com/comment/43475638
accepted answer of: http://stackoverflow.com/q/27523339

http://stackoverflow.com/a/27591677
accepted answer of: http://stackoverflow.com/q/27591043
type: AcceptedAnswer
has body: You can not run two thread in synchronized block with same object. When one method is running another method can not run until another thread call wait method. To solve this problem you should just put add and remove in synchronized block. For more information see this.
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27591043

http://stackoverflow.com/q/27478099
has answer: http://stackoverflow.com/a/27478180
has answer: http://stackoverflow.com/a/27478127
type: Question
possible better answer: http://stackoverflow.com/a/27478115
upvote count: 15
linked to: http://stackoverflow.com/q/878577
answer count: 6
accepted answer: http://stackoverflow.com/a/27478119
favorite count: 0
has answer: http://stackoverflow.com/a/27478202
has title: static method with static default code?
has answer: http://stackoverflow.com/a/27564522
downvote count: 1
has body: Sorry for the bad title, but I found the code listed below on mkyoung.com and was wondering what this code does. Is this a way in Java to set some default value into a variable? public class LanguageBean implements Serializable{ private static Map&lt;String,Object&gt; countries; static{ countries = new LinkedHashMap&lt;String,Object&gt;(); countries.put("English", Locale.ENGLISH); //label, value countries.put("Chinese", Locale.SIMPLIFIED_CHINESE); } }
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27478119
has answer: http://stackoverflow.com/a/27478115
tagged with: java

http://stackoverflow.com/a/27639809
has comment: http://stackoverflow.com/comment/43698912
has comment: http://stackoverflow.com/comment/43698442
type: Answer
has comment: http://stackoverflow.com/comment/43698910
upvote count: 1
has comment: http://stackoverflow.com/comment/43698900
has comment: http://stackoverflow.com/comment/43698801
accepted answer of: http://stackoverflow.com/q/27639727
has comment: http://stackoverflow.com/comment/43699100
answers question: http://stackoverflow.com/q/27639727
has comment: http://stackoverflow.com/comment/43698372
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43698640
has body: Define a variable on top level and use that to access the selected item. int index = -1; public void ShowRadioDialog() { final CharSequence[] items={"Rosso","Verde","Blu"}; AlertDialog.Builder builder=new AlertDialog.Builder(this); builder.setTitle("Seleziona un colore"); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(DialogInterface dialog, int which) { if (index == 1) { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.red)); toolbar.setBackgroundColor(MainActivity.this.getResources().getColor(R.color.red)); Toast.makeText(MainActivity.this, "Rosso OK", Toast.LENGTH_SHORT).show(); Log.i("Colors", "Rosso Ok"); } } else if (index ==2) { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.green_welcome)); } } else if (index == 3){ if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.primary_dark_blue)); } } } }); builder.setSingleChoiceItems(items,-1, new DialogInterface.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub if ("Rosso".equals(items[which])) { index = 1; } else if ("Verde".equals(items[which])) { index = 2; } else if ("Blu".equals(items[which])) { index = 3; } } }); builder.show(); } If you want to save the value of index in shared preference on click of ok button do like this Store in SharedPreferences SharedPreferences preferences = getSharedPreferences("myPref",…
has comment: http://stackoverflow.com/comment/43698392

http://stackoverflow.com/comment/43449970
score: 0
type: QuestionComment
type: Comment
has text: @Christopher: A Spaniel is an instance of Dog. Dog is most certainly abstract. There is no such thing as a (true/pure/only) Dog that isn't an instance of a concrete breed of Dog (possibly Mongrel...). So all Spaniels are instances of the abstract class Dog. Our whole taxonomy of the world relies on this trick of things being many things at various levels of abstraction and perspective. The 'idea' in OO is that it can be extended to programming. It has some benefits and some pitfalls. With care it can and does work.
comment on: http://stackoverflow.com/q/27509720

http://stackoverflow.com/q/27546965
type: UnansweredQuestion
tagged with: servlets
answer count: 1
type: Question
has title: How to call a servlet class file which displays a jasper report on the browser using Quartz Scheduler
score: 0
tagged with: java
has body: Quartz Scheduler for a simple Java application for storing a jasper report in a directory is working, as i used public void execute instead of public static void main and executed in a job class as shown below, i am not looking to pass the URL of the servlet id there a right way, when i run the scheduler servlet which will trigger the job class file, which will invoke the servlet class . Help me out import java.util.Date; import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class Starter_jasper implements Job { public Starter_jasper() { JobExecutionContext jec = null; try { execute(jec); } catch (JobExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void execute(JobExecutionContext jec) throws JobExecutionException{ //include(Jasper_database.class); System.out.println("" + new Date()); Jasper_database jb = new Jasper_database(); jb.execute(); //fill your jobs here }} this code works for a simple java It work for a simple java application but My Question is how do i do it for a servlet class, I run my servlet class directly and i am not using any JSP, and My scheduler and trigger is in an another servlet as shown below import java.io.IOException; import javax.servlet.GenericServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import job.quartz.gateway.GatewayPlugin; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.ScheduleBuilder; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SimpleScheduleBuilder; import org.quartz.Trigger; import org.quartz.TriggerBuilder; import org.quartz.impl.StdSchedulerFactory; import com.jasper.servlet.JasperSReport; /** * Servlet implementation cl…
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/27549714
has comment: http://stackoverflow.com/comment/43521050
has comment: http://stackoverflow.com/comment/43520417

http://stackoverflow.com/q/27531452
type: Question
score: 0
answer count: 1
has body: There is a Spring based web application and servlet is only single. All requests are go through that servlet and I get beans in servlet before processing them later: Application Context ctx = get contex... and ctx.getBean("...") So do I need to close Application Context in servlet? It is not a Spring-MVC progect, it's just servets webapp.
type: UnansweredQuestion
has title: spring based servlet web application
has answer: http://stackoverflow.com/a/27531505
tagged with: spring
tagged with: java
tagged with: web-applications

http://stackoverflow.com/q/27527090
has answer: http://stackoverflow.com/a/27592342
favorite count: 0
tagged with: artificial-intelligence
has title: Finding the best move using MinMax with Alpha-Beta pruning
tagged with: minmax
downvote count: 0
tagged with: alpha-beta-pruning
score: 6
possible better answer: http://stackoverflow.com/a/27527852
type: Question
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/27592342
has body: I'm working on an AI for a game and I want to use the MinMax algorithm with the Alpha-Beta pruning. I have a rough idea on how it works but I'm still not able to write the code from scratch, so I've spend the last two days looking for some kind of pseudocode online. My problem is that every pseudocode I've found online seems to be based on finding the value for the best move while I need to return the best move itself and not a number. My current code is based on this pseudocode (source) minimax(level, player, alpha, beta){ // player may be "computer" or "opponent" if (gameover || level == 0) return score children = all valid moves for this "player" if (player is computer, i.e., max's turn){ // Find max and store in alpha for each child { score = minimax(level - 1, opponent, alpha, beta) if (score &gt; alpha) alpha = score if (alpha &gt;= beta) break; // beta cut-off } return alpha } else (player is opponent, i.e., min's turn) // Find min and store in beta for each child { score = minimax(level - 1, computer, alpha, beta) if (score &lt; beta) beta = score if (alpha &gt;= beta) break; // alpha cut-off } return beta } } // Initial call with alpha=-inf and beta=inf minimax(2, computer, -inf, +inf) As you can see, this code returns a number and I guess that this is needed to make everything work (since the returned number is used during the recursion). So I thought that I may use an external variable to store the best move, and this is how I've changed the previous code: minimax(level, player, alpha, beta){ // player may be "computer" or "opponent" if (gameover || level == 0) return score children = all valid moves for this "player" if (player is computer, i.e., max's turn){ // Find max and store in alpha for each child { score = minimax(level - 1, opponent, alpha, beta) if (score &gt; alpha) { alpha = score bestMove = current child // ROW THAT I ADDED TO UPDATE THE BEST MOVE } if (alpha &gt;= beta) break; // beta cut-off } return alpha } else (player is opponent, i.e.,…
answer count: 2
has answer: http://stackoverflow.com/a/27527852
upvote count: 6

http://stackoverflow.com/comment/43716966
type: Comment
has text: thanks all of you but i think , i'm having another problem with "IDocument", seems like my Eclipse is not importing it, or even know what it is waiting for your answers :) thanks again
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27626959

http://stackoverflow.com/q/27560774
score: 1
tagged with: java
type: Question
has title: Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define
tagged with: google-analytics
has comment: http://stackoverflow.com/comment/43547549
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43547792
has comment: http://stackoverflow.com/comment/43554971
has comment: http://stackoverflow.com/comment/43547700
type: UnansweredQuestion
tagged with: android
has body: I am getting following error after adding "libGoogleAnalyticsServices.jar" jar. Unable to execute dex: Multiple dex files define Lcom/google/analytics/containertag/common/FunctionType; Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/analytics/containertag/common/FunctionType; I know "Multiple dex files" problem have been answered several times but solutions are not working for me. Any help greatly appreciated.
has comment: http://stackoverflow.com/comment/43547503
answer count: 0
downvote count: 0

http://stackoverflow.com/q/27589348
type: Question
answer count: 1
has title: Unable to create more than one package in src folder
score: 0
type: UnansweredQuestion
has body: I'm following this tutorial https://danielniko.wordpress.com/2012/04/17/simple-crud-using-jsp-servlet-and-mysql/ and I'm slightly stuck. I would like to create the 4 packages in the src folder, but Eclipse will only allow me to create one. I create the first one, It adds it to the src folder: I create the next package, It adds it outside of the src folder: I move it into the src folder, It creates a copy and put it in libraries: Any idea what I can do to stop this happening? I want to put 4 packages in the src folder as per the tutorial but I don't know what is happening. I've been using Eclipse for a while and this has never happened.
has answer: http://stackoverflow.com/a/27589445
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/43565880
has text: Looking at your last example: I wouldn't have a problem with `knockOneDown()` doing `bottles--`, but I **would** probably have a problem with `round++`. If I were reading the code of the caller, and it said `b.knockOneDown()`, I'd expect it to knock down a bottle, would it be obvious to me that this would also go to the next round? That's the kind of thing that makes life harder for readers of your code.
score: 0
comment on: http://stackoverflow.com/q/27569874
type: Comment
type: QuestionComment

java
tags question: http://stackoverflow.com/q/27560022
tags question: http://stackoverflow.com/q/27512925
tags question: http://stackoverflow.com/q/27503691
tags question: http://stackoverflow.com/q/27524240
tags question: http://stackoverflow.com/q/27522141
tags question: http://stackoverflow.com/q/27607283
tags question: http://stackoverflow.com/q/27621935
tags question: http://stackoverflow.com/q/27538600
tags question: http://stackoverflow.com/q/27541894
tags question: http://stackoverflow.com/q/27611272
tags question: http://stackoverflow.com/q/27618123
tags question: http://stackoverflow.com/q/27547519
tags question: http://stackoverflow.com/q/27475714
tags question: http://stackoverflow.com/q/27503189
tags question: http://stackoverflow.com/q/27548862
tags question: http://stackoverflow.com/q/27500455
tags question: http://stackoverflow.com/q/27635770
tags question: http://stackoverflow.com/q/27507004
tags question: http://stackoverflow.com/q/27541334
tags question: http://stackoverflow.com/q/27521776
tags question: http://stackoverflow.com/q/27603813
tags question: http://stackoverflow.com/q/27543738
tags question: http://stackoverflow.com/q/27595206
tags question: http://stackoverflow.com/q/27483207
tags question: http://stackoverflow.com/q/27532492
tags question: http://stackoverflow.com/q/27515368
tags question: http://stackoverflow.com/q/27553538
tags question: http://stackoverflow.com/q/27571020
tags question: http://stackoverflow.com/q/27614034
tags question: http://stackoverflow.com/q/27535651
tags question: http://stackoverflow.com/q/27584355
tags question: http://stackoverflow.com/q/27492384
tags question: http://stackoverflow.com/q/27527211
tags question: http://stackoverflow.com/q/27525746
tags question: http://stackoverflow.com/q/27598619
tags question: http://stackoverflow.com/q/27543837
tags question: http://stackoverflow.com/q/27506335
tags question: http://stackoverflow.com/q/27575311
tags question: http://stackoverflow.com/q/27634383
tags question: http://stackoverflow.com/q/27577267
tags question: http://stackoverflow.com/q/27527796
tags question: http://stackoverflow.com/q/27614710
tags question: http://stackoverflow.com/q/27586041
tags question: http://stackoverflow.com/q/27486104
tags question: http://stackoverflow.com/q/27595402
tags question: http://stackoverflow.com/q/27488432
tags question: http://stackoverflow.com/q/27524318
tags question: http://stackoverflow.com/q/27630379
tags question: http://stackoverflow.com/q/27520229
tags question: http://stackoverflow.com/q/27484982
tags question: http://stackoverflow.com/q/27541712
tags question: http://stackoverflow.com/q/27570641
tags question: http://stackoverflow.com/q/27501913
tags question: http://stackoverflow.com/q/27546046
tags question: http://stackoverflow.com/q/27576812
tags question: http://stackoverflow.com/q/27549773
tags question: http://stackoverflow.com/q/27617158
tags question: http://stackoverflow.com/q/27545308
tags question: http://stackoverflow.com/q/27596820
tags question: http://stackoverflow.com/q/27498993
tags question: http://stackoverflow.com/q/27614543
tags question: http://stackoverflow.com/q/27479210
tags question: http://stackoverflow.com/q/27608429
tags question: http://stackoverflow.com/q/27567571
tags question: http://stackoverflow.com/q/27593302
tags question: http://stackoverflow.com/q/27485351
tags question: http://stackoverflow.com/q/27506544
tags question: http://stackoverflow.com/q/27588075
tags question: http://stackoverflow.com/q/27530332
tags question: http://stackoverflow.com/q/27581641
tags question: http://stackoverflow.com/q/27501271
tags question: http://stackoverflow.com/q/27605282
tags question: http://stackoverflow.com/q/27629821
tags question: http://stackoverflow.com/q/27481622
tags question: http://stackoverflow.com/q/27606862
tags question: http://stackoverflow.com/q/27622536
tags question: http://stackoverflow.com/q/27620080
tags question: http://stackoverflow.com/q/27582852
tags question: http://stackoverflow.com/q/27583855
tags question: http://stackoverflow.com/q/27535909

http://stackoverflow.com/comment/43798279
score: 1
type: AnswerComment
type: Comment
has text: Thanks, glad to see that this was a bug and not something I was misunderstanding, and very glad to see that it has been resolved.
comment on: http://stackoverflow.com/a/27577283

http://stackoverflow.com/comment/43524406
type: AnswerComment
type: Comment
has text: http://stackoverflow.com/questions/2154622/why-does-jpa-have-a-transient-annotation
comment on: http://stackoverflow.com/a/27548608
score: 0

http://stackoverflow.com/comment/43577268
comment on: http://stackoverflow.com/q/27575878
has text: Hi @AndonM.Coleman, I am rendering within an OpenGL context where alpha quantities can be properly represented, for example I can fade a triangle or an image. Do you think these artifacts may come from those other buffers?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27590678
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43608168
downvote count: 0
type: Answer
has body: First of all, change this private javax.swing.JRadioButton jRadioButton1; to public javax.swing.JRadioButton jRadioButton1; Then. You may write this class public class Updater extends Thread { private Example e ; public Updater(Example e) { this.e = e; } public void run(){ try { Thread.sleep(3000); e.jRadioButton1.setText("2"); } catch (InterruptedException ex){ } } } Now here in this method. private void jRadioButton1ItemStateChanged(java.awt.event.ItemEvent evt) { jRadioButton1.setText("1"); new Updater(this).start(); }
answers question: http://stackoverflow.com/q/27583419

http://stackoverflow.com/q/27550595
tagged with: xpath
has answer: http://stackoverflow.com/a/27550813
type: Question
tagged with: java
has title: Search for a particular node using child node in xml java using DOM parser
score: 0
answer count: 1
type: UnansweredQuestion
has body: I have the following XML structure &lt;CodeSnippet&gt; &lt;Code&gt; &lt;Tag&gt;&lt;/Tag&gt; &lt;Title&gt;&lt;/Title&gt; &lt;Snippet&gt;&lt;/Snippet&gt; &lt;/Code&gt; I would like to search for specific node based on "Title" and update the "Snippet" value of that node. The XPath i have used is "/Code[Title/text()='" + getTitle + "']". But, i am unable to get the Title node. Someone, please correct my xpath i am using.
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/27527288
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27529295
accepted answer: http://stackoverflow.com/a/27529295
upvote count: 1
answer count: 1
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/43483240
downvote count: 0
has comment: http://stackoverflow.com/comment/43483667
has title: Eclipse custom builder: Identifying and cleaning generated files
type: Question
tagged with: build
type: AnsweredQuestion
has body: I am creating a plugin for Eclipse, which contains tools for creating a custom type of project. These projects have a custom nature and builder. My builder (implements IncrementalProjectBuilder) takes a single input file, and generates a few (usually between 3 and 5) output files. When I run Clean Project, I need to remove the files the builder has previously generated. Problem 1: The names of the generated files are not known exactly, but I do know the sort of files I expect to find (e.g. I know the extensions, and partial file names). Problem 2: The user may add their own files to the project, which should not be affected by my build / clean steps. My initial attempt was naive: remove every file except from the input file. This works, but has obvious problems. My second attempt was better: I came up with a list of possible file names that may be generated, see if any of them exist and remove them. By only knowing partial file names and matching them, I may inadvertently delete a user's file. E.g. I know I will generate a file called *_file.py. If the file I generate is called abc_file.py and the user has added their own xyz_file.py, I want to clean (remove) abc_file.py but leave xyz_file.py untouched. The program which generates the output files from the input is constantly changing, and I don't want to rely on a concrete list of files that would need constant maintenance. So, my question comes down to this. What methods exist for identifying the files generated by my custom builder, so I can remove them during a clean? I've spent a couple of days Googling this one with not much to show for it. I am vaguely aware of a file system watcher in Java (Java7 WatchService?), but I don't know if that's the best solution to this problem. Any information, advice or ideas appreciated.

http://stackoverflow.com/q/27506826
linked to: http://stackoverflow.com/q/27359816
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43443988
duplicate of: http://stackoverflow.com/q/27359816
tagged with: console
favorite count: 0
tagged with: groovy
has comment: http://stackoverflow.com/comment/43476580
has answer: http://stackoverflow.com/a/27507323
tagged with: system.out
has comment: http://stackoverflow.com/comment/43444266
has comment: http://stackoverflow.com/comment/43443950
has comment: http://stackoverflow.com/comment/43444409
type: UnansweredQuestion
has body: My grails app has an external java library which I developed. I want my grails app to be able to display my java library system.out statements (console output). How do I go about doing that? I would rather not have to write it out to a file then read it in grails. There must be a better way of doing this. **I want grails to display these to a text box as the happen(In a browser while its running(so the user can see)) Afer trying several of my own ways I have to settle for this way which I will post here. Thanks @Shaunak for your help and understanding. **How I solved it. In my java library I created a global class which all the System.outs will be wrote to writeSouts(String sout){ //store here in a global string and keep appending to it as needs be } Then in grails constantly call the java library method. and using Ajax write it out to the browser window. Hope this helps anyone in the future who encounters the same problem. Also it is not for testing but an integral part of my web app so that the user of the web app can was the java library is doing in the background.
score: -3
downvote count: 3
has comment: http://stackoverflow.com/comment/43444217
has title: How to read console output from Grails
tagged with: java
has comment: http://stackoverflow.com/comment/43444015
has comment: http://stackoverflow.com/comment/43446846
tagged with: grails
has comment: http://stackoverflow.com/comment/43443912
type: Question
has comment: http://stackoverflow.com/comment/43492867

http://stackoverflow.com/q/27480225
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27480247
upvote count: 1
has body: In the below code I am trying to append some text to a file using FileOutputStream and BufferedWriter as shown below.At ru time, despite the file has some data, when i use FileOutputStream and BufferedWriter i found the file is empty and even the data i want to append bw.write("new information"); is not existing the file is completely empty. Kindly please let me know how to fix it. Code: File f = new File(SystemConfig.getSystConfigInstance("E")); System.out.println(f.getAbsolutePath() + " name: " + f.getName()); OutputStream os = new FileOutputStream(f); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os)); bw.write("new information");
tagged with: bufferedwriter
score: 1
tagged with: java
tagged with: inputstream
type: Question
downvote count: 0
duplicate of: http://stackoverflow.com/q/8544771
has comment: http://stackoverflow.com/comment/43393581
has answer: http://stackoverflow.com/a/27480283
tagged with: file-io
answer count: 3
linked to: http://stackoverflow.com/q/8544771
has answer: http://stackoverflow.com/a/27480356
tagged with: outputstream
has title: How to appened data to a file using BufferedWriter and FileOutPutStream
favorite count: 0
has comment: http://stackoverflow.com/comment/43393626
has comment: http://stackoverflow.com/comment/43393551

http://stackoverflow.com/q/27587614
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/43599352
has comment: http://stackoverflow.com/comment/43599475
type: Question
has answer: http://stackoverflow.com/a/27587954
upvote count: 0
has title: error starting simple application from spring in practice book
downvote count: 4
has comment: http://stackoverflow.com/comment/43599375
answer count: 1
has body: Caused by: org.eclipse.jetty.servlet.ServletHolder$1: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'rosterController' bean method public void com.springinpractice.ch03.web.RosterController.list(org.springframework.ui.Model) to {[],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'rosterController' bean method public void com.springinpractice.ch03.web.RosterController.member(java.lang.Integer,org.springframework.ui.Model) mapped. main-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.springinpractice.ch03.web"/> <context:annotation-config /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/roster/" p:suffix=".jsp"/> </beans> RosterController.java roasterController /* * Copyright (c) 2013 Manning Publications Co. * * Book: http://manning.com/wheeler/ * Blog: http://springinpract…
favorite count: 0
has comment: http://stackoverflow.com/comment/43599434
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/27537283
score: 1
has comment: http://stackoverflow.com/comment/43502966
has body: It's your manifest, replace the "last" activity in your manifest by this : <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.theocratichelper.MainActivity" /> Your class name is Assistant and not PreachAssistant i presume.
has comment: http://stackoverflow.com/comment/43503153
answers question: http://stackoverflow.com/q/27537166
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43691763
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27635085
has text: @auntyellow-no i have not yet tried it will try and get back to you
score: 0

http://stackoverflow.com/q/27582923
tagged with: actionlistener
tagged with: java
linked to: http://stackoverflow.com/q/20112159
accepted answer: http://stackoverflow.com/a/27585725
score: 0
tagged with: keypress
has comment: http://stackoverflow.com/comment/43591230
has comment: http://stackoverflow.com/comment/43590735
answer count: 1
favorite count: 0
has title: How to Pause Swing in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27585725
has body: I have a main java program named MainProgram.java MainProgram.java has its member as a JFrame MyFrame The frame MyFrame has a JPanel in it called MyPanel I have overriden the PaintComponent of MyPanel to draw an image. MainProgram.java constantly gets a feed from a video file and calls the paintComponent of MyPanel. What I want to do is for the program to wait until I press Enter key. Only when I press the Enter key, should the next frame be taken from the video and displayed. Thread.sleep I saw in so many places cannot be used since, then it cannot listen for key press. A Timer cannot be used since I am not timing anything. The dirty workaround I used was boolean x = false; . . . while(x==false); . . . onKeyPressed() { x=true; //get frame from video //call paintComponent x=false; } Anyone can give a good solution please?
upvote count: 1
tagged with: swing
downvote count: 1
type: Question

http://stackoverflow.com/q/27601063
upvote count: 1
type: Question
has body: I'm trying to get a full date with milliseconds. I tried following Date callTime = new Date(); String formattedDate = callTime.format('MM/dd/yyyy HH:mm:ss.SSS'); println "formattedDate : " + formattedDate; def saveThisDate = new Date().parse("MM/dd/yyyy HH:mm:ss.SSS", formattedDate); println "saveThisDate : " + saveThisDate; And it gave output as following formattedDate : 12/22/2014 15:51:47.427 saveThisDate : Mon Dec 22 15:51:47 IST 2014 where the formattedDate gives correct output but I've to save it in a date so i tried doing saveThisDate . But it doesn't save milliseconds. Where I'm doing wrong?
tagged with: simpledateformat
tagged with: date
answer count: 3
tagged with: groovy
downvote count: 0
has answer: http://stackoverflow.com/a/27601120
favorite count: 0
has answer: http://stackoverflow.com/a/27601196
type: UnansweredQuestion
has title: format date in groovy and save in desired format with milliseconds
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27601129

http://stackoverflow.com/comment/43650099
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27599506
type: Comment
has text: i was under the misconception that the session bean storage was managed by the ejb container. Maybe i could store the reference in an http session ?

http://stackoverflow.com/q/27498021
has comment: http://stackoverflow.com/comment/43427211
has body: My name is Fermin. I'm new in this forum and I'm also studying Java to be a Java developer. I'm stuck on an assignment and I would like some help from anyone. Here is the description and the code Using an if statement in the for block, determine whether randNum and guessNum are equal. public class GuessGame { /** * @param args the command line arguments */ public static void main(String[] args) { int randNum , guessNum ; //Generates a random number from 1 to 10 randNum = new java.util.Random().nextInt(10) + 1; System.out.println("Im thinking of a number from 1 to 10"); for (guessNum = 0; guessNum &lt;= 10; guessNum ++){ java.util.Scanner scan = new java.util.Scanner(System.in); guessNum = scan.nextInt(); if (guessNum == randNum) { System.out.println("you guess" + guessNum ); } } } } Updated code import java.util.Random; import java.util.Scanner; public class NumberGuess { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Random rand = new Random(); System.out.println("Im thinking of a number from 1 to 10"); int number = scan.nextInt(10); //Generates a random number from 1 to 10 int number2 = rand.nextInt(10)+1; System.out.println("you enter the number" + " " + number); for (int counter = -1; counter &lt; 3; counter ++ ){ if(number!= number2) System.out.println("and your random number is:" + " " + number2 + " " + "please try again"); else System.out.println("your guess number is equal to the random number Good job guessing"); break; } } }
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43427272
has comment: http://stackoverflow.com/comment/43427254
has answer: http://stackoverflow.com/a/27517884
has comment: http://stackoverflow.com/comment/43460911
has comment: http://stackoverflow.com/comment/43456568
has answer: http://stackoverflow.com/a/27524937
has comment: http://stackoverflow.com/comment/43460220
tagged with: java
score: -4
tagged with: loops
upvote count: 1
type: Question
tagged with: if-statement
has title: Random number guessing game with if statement and a for loop Java
has comment: http://stackoverflow.com/comment/43427988
downvote count: 5
has comment: http://stackoverflow.com/comment/43427304
has comment: http://stackoverflow.com/comment/43427248
answer count: 2
tagged with: random
tagged with: for-loop
has comment: http://stackoverflow.com/comment/43461350

http://stackoverflow.com/q/27626335
answer count: 1
has answer: http://stackoverflow.com/a/27628109
type: UnansweredQuestion
tagged with: android
has body: I'm trying to use j2obc for gradle to port my android application to iOS, but I'm getting this error and can't seem to figure out how to fix it. The full thing: 13:43:50.477 [ERROR] [org.gradle.BuildExceptionReporter] 13:43:50.482 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 13:43:50.489 [ERROR] [org.gradle.BuildExceptionReporter] 13:43:50.492 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 13:43:50.496 [ERROR] [org.gradle.BuildExceptionReporter] Could not determine the dependencies of task ':app:j2objcTranslate'. 13:43:50.499 [ERROR] [org.gradle.BuildExceptionReporter] &gt; Task with path 'test' not found in project ':app'. 13:43:50.503 [ERROR] [org.gradle.BuildExceptionReporter] 13:43:50.506 [ERROR] [org.gradle.BuildExceptionReporter] * Try: 13:43:50.510 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 13:43:50.517 [LIFECYCLE] [org.gradle.BuildResultLogger] 13:43:50.523 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED 13:43:50.529 [LIFECYCLE] [org.gradle.BuildResultLogger]
tagged with: java
tagged with: gradle
tagged with: j2objc
type: Question
tagged with: ios
has title: j2objc gradle plugin - Task with path 'test' not found in project app
score: 0

http://stackoverflow.com/comment/44312652
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27575569
has text: Hi, I'm a Google Cloud Support Representative. Were you able to solve this issue? If so, could you share the solution for the whole community benefit? If not, I'd like to help you.

http://stackoverflow.com/comment/43625577
has text: Hello Andy, the code to save is this entityManager.clear(); entityManager.persist(e);
comment on: http://stackoverflow.com/q/27596345
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/27625139
type: Question
tagged with: fileoutputstream
has body: I am trying to write a byte array to a file with a FileOutputStreamlike this: public static void writeFileContents(String path, byte[] contents) { try(FileOutputStream stream = new FileOutputStream(path)) { stream.write(contents); } catch (IOException e) { e.printStackTrace(); } } Where contents is populated like this: byte[] bytes = new byte[32 * 32]; Arrays.fill(bytes, (byte) 2); But I am receiving weird characters in the file, it is the letters 'STX' in a white box. What have I done wrong?
answer count: 2
has answer: http://stackoverflow.com/a/27625177
has title: FileOutputStream writing strange characters
favorite count: 0
tagged with: byte
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27625244
score: 2
downvote count: 0
tagged with: java
upvote count: 2

http://stackoverflow.com/a/27554113
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27553258
answers question: http://stackoverflow.com/q/27553258
type: Answer
has body: Since a raw type is the erasure of that type (4.8), a raw MetaDataBean returns a raw List from getListBait. The solution is either to remove the generic type parameter from MetaDataBean or to not use a raw type, depending on whether the parameter is actually necessary.
score: 1

http://stackoverflow.com/q/27625784
has title: Android 5: No more Garbage Collection message?
favorite count: 0
has answer: http://stackoverflow.com/a/27625861
tagged with: dalvik
tagged with: android
tagged with: garbage-collection
upvote count: 1
accepted answer: http://stackoverflow.com/a/27625861
type: AnsweredQuestion
score: 1
tagged with: java
has body: I know Dalvik is dead for Android 5 lollipop, which was replaced with ART, but where are the GC messages? I need to see the heap size changes in the logcat! I know that there is a tool in DDMS, where I can see the heap stats, but it's not developer friendly! Once the process is started, the whole application starts lagging, sometimes it's freezing. Is there a way to see heap's update changes?
type: Question
downvote count: 0
answer count: 1

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

http://stackoverflow.com/comment/43748347
type: Comment
comment on: http://stackoverflow.com/a/27645191
score: 2
type: AnswerComment
has text: By adapting this code to my solution I was able to save the file in the internal memory, just as I wanted. Additionally, I was able to retrieve the original filename from the session.getParams() hashmap by using the same key.

http://stackoverflow.com/q/27564011
has comment: http://stackoverflow.com/comment/43553564
has comment: http://stackoverflow.com/comment/43553433
has comment: http://stackoverflow.com/comment/43556945
favorite count: 0
type: UnansweredQuestion
tagged with: solr
has comment: http://stackoverflow.com/comment/46517882
has title: HTTP Status 404 error when accessing http://localhost:8080/solr
answer count: 0
has comment: http://stackoverflow.com/comment/43553424
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43556972
has comment: http://stackoverflow.com/comment/43609961
type: Question
has comment: http://stackoverflow.com/comment/43554270
downvote count: 0
has body: I have been trying to setup Solr with Apache Tomcat, and I can see the localhost:8080 Tomcat page, but when i try to reach the localhost:8080/solr page i get the following message: "HTTP Status 404 - /solr type Status report message /solr description The requested resource is not available. Apache Tomcat/8.0.15" Im using the Solr 4.10.2 and has been using the following guide to install: http://www.chrisumbel.com/article/lucene_solr_sql_server I have set up apache-tomcat-8.0.15 and solr-4.10.2 both in C:\sw, copied solr-4.10.2\example\solr to C:\sw\apache-tomcat-8.0.15 solr-4.10.2\dist\Solr 4.10.2.war to C:\sw\apache-tomcat-8.0.15\webapps\Solr 4.10.2.war also tried changing the web.xml to the following: solr/home C:\sw\apache-tomcat-8.0.15\solr java.lang.String read the stackoverflow questions regarding this, and didnt managed to resolve the issue Thanks
tagged with: tomcat
tagged with: lucene

http://stackoverflow.com/comment/43611505
type: QuestionComment
comment on: http://stackoverflow.com/q/27593719
score: 0
has text: @MadProgrammer even in c i saw only libraries and couldn't see a way without one. I don't mind settle and use another language, as long as i will understand what inside it and not use the class/library without knowing what i am doing
type: Comment

http://stackoverflow.com/a/27552450
downvote count: 0
has comment: http://stackoverflow.com/comment/43531219
has body: Considering that getSomeEasyToGetBoolean() and getSomeHardToGetBoolean() might have side-effects, all three snippets of code have different functionality and it would be an error if the compiler mixed them
has comment: http://stackoverflow.com/comment/43531408
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43531314
has comment: http://stackoverflow.com/comment/43531454
answers question: http://stackoverflow.com/q/27551904
has comment: http://stackoverflow.com/comment/43531168
has comment: http://stackoverflow.com/comment/43531502

http://stackoverflow.com/comment/43412068
score: 1
has text: 5.0 public updates ended in 2009 - five years ago. 4.0 was earlier than that. Anyone who is still using a JDK that old is making a mistake.
type: Comment
comment on: http://stackoverflow.com/q/27488149
type: QuestionComment

http://stackoverflow.com/q/27524357
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/27524761
type: Question
score: 3
has answer: http://stackoverflow.com/a/27524625
accepted answer: http://stackoverflow.com/a/27524625
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/43477494
has comment: http://stackoverflow.com/comment/43477502
has title: Junit test that will fail if singleton getInstance() method is not synchronized
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/43477907
tagged with: junit
has answer: http://stackoverflow.com/a/27524761
has body: I have this singelton Database that I've build, and this Junit test I've created: singleton package SingeltonDBVersion1; import GlobalSetting.User; /**************************************************************************** * This is the SingeltonDB. it warps the object DBconn according to the * Singleton pattern. it receive name and password (i.e. DBConn parameters) and * if it is the first time that a UserContorll try to get an instance it connect * to the database. After that, the DBConn instance will be return to the user. *****************************************************************************/ public class SingeltonDB { private static DBconnImpl db = null; private static SingeltonDB singalDb = null; boolean first = true; private SingeltonDB(String username, String password) { if (first) { try { System.out.println("first"); Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } first = false; } db = new DBconnImpl(); } public static SingeltonDB getInstance(String username, String password) throws Exception { if (db != null) { return singalDb; } singalDb = new SingeltonDB(username, password); System.out.println("The database is now open"); db.connect(username, password); System.out.println("The database was connected"); return singalDb; } public void create(String tableName) throws Exception { db.create(tableName); } public User query(String tableName, int userID) throws Exception { if (db == null) { System.out.println("Error: the database is not open"); return null; } return (db.query(tableName, userID)); } public void update(String tableName, User user) throws Exception { if (db == null) { System.out.println("Error: the database is not open"); return; } db.update(tableName, user); } public void disconnect() throws Exception { db.disconnect(); } public static void reset() throws Exception { db = null; } } Junit package Tests; import java.util.concurrent.CountDownLatch; import org.junit.Test; import SingeltonDBVersion1.SingeltonDB; …
tagged with: synchronization
favorite count: 0
has comment: http://stackoverflow.com/comment/43477813
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43477330
has comment: http://stackoverflow.com/comment/43477556

http://stackoverflow.com/comment/43574298
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27568522
has text: I would say that rather than adding an external folder to the docbase, you should have just made a servlet that reads the file from there and writes it out byte by byte only for authorized users.
score: 1

http://stackoverflow.com/q/27638993
type: Question
tagged with: waffle
answer count: 2
downvote count: 0
favorite count: 0
tagged with: single-sign-on
upvote count: 2
has title: Waffle Authorization Without Any Kind Of Login
has answer: http://stackoverflow.com/a/33803371
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27640234
score: 2
tagged with: java
has body: I have a web application in the intranet and the client which is already in the intranet and has been successfully login on his/her windows computer does not want to enter any login credentials again. I have met with Waffle. As I tried its samples, it provides SSO with windows credentials, this is a plus for me. But the thing is, I don't want my clients to enter their windows credentials again, they already have successfully login to their computer, so they want to access intranet web applications without entering any kind of credentials. Could Waffle do that? Or is it a must that user have to enter windows credential again?

http://stackoverflow.com/q/27577077
has comment: http://stackoverflow.com/comment/43579645
has comment: http://stackoverflow.com/comment/43579972
tagged with: java
tagged with: mouse-listeners
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27612063
has comment: http://stackoverflow.com/comment/43579414
has comment: http://stackoverflow.com/comment/43580328
has body: So this is a snippet of a larger program. Not shown in the below code is a JFrame "framer" which I have properly set up and which also contains a JPanel with various JLabels. What I am aim for in the below code is a way for me to access the object "face" which is of type "facer" which extends JPanel, where "facer" is properly added to the JFrame "framer" with all of this displaying properly. The below code shows some things that I have tried. Regardless of where I use .getName() I always get null. "line4" gets me access to scrollPane rather than the object, which I also have added to the JFrame. I also find it odd that getParent().getParent() gives a JLayeredPane (which I am not using) rather than a JFrame. All of this is basically a watered down version of the real area of code I'm stuck on but solving this would essentially show me what to do in the other scenario. Basically, all I'm asking is how I can get getParent().getName() or getParent().getParent().getName() to print out the object's name (which in this case is "facer" or "framer") rather than null or its type information as shown in my outputs below. face.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { Component source = (Component) e.getSource(); //line1 System.out.println("source gives me " + source); //line2 System.out.println("getName() gives me " + source.getName()); //line3 System.out.println("getParent().getComponent(1) gives me " + source.getParent().getComponent(0)); //line4 System.out.println("getParent().getName() gives me " + source.getParent().getName()); //line5 System.out.println("getParent().getParent() gives me " + source.getParent().getParent()); //line6 System.out.println("getParent().getParent() gives me " + source.getParent().getParent().getName()); //line7 } }); The output gives me source gives me facer[,0,0,200x288,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] getName() gives me null getParent().getComponent(1) …
score: 2
tagged with: user-interface
downvote count: 0
favorite count: 0
type: Question
has title: How to get the parent object of a clicked component using getParent()?
has comment: http://stackoverflow.com/comment/43579818
has comment: http://stackoverflow.com/comment/43579991
upvote count: 2
tagged with: jcomponent
tagged with: swing
answer count: 1

http://stackoverflow.com/q/27528676
has title: How to replace a line in a text file using Java?
tagged with: text
has comment: http://stackoverflow.com/comment/43485997
linked to: http://stackoverflow.com/q/1525444
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43486049
possible better answer: http://stackoverflow.com/a/27528885
score: -4
has answer: http://stackoverflow.com/a/27528885
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27528896
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/43485916
tagged with: replace
has comment: http://stackoverflow.com/comment/43486390
answer count: 2
has comment: http://stackoverflow.com/comment/43485911
favorite count: 0
has comment: http://stackoverflow.com/comment/43486267
has answer: http://stackoverflow.com/a/27528896
has body: I have a text file with various key value pairs separated with a '--'. Below is the code I have so far File file = new File("C:\\StateTestFile.txt"); BufferedWriter out = new BufferedWriter(file.getAbsolutePath()); BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { if(line.contains("content_style")) { //Write to the line currently reading and save back to the file } } br.close(); out.close(); What I would like to do is read this text file and replace the value of a specific line with something I specify. So id want to find the 'content_style' line and replace 'posh' with 'dirty'. How can I do this?

http://stackoverflow.com/a/27514872
has comment: http://stackoverflow.com/comment/43460877
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27514850
has body: Java array indexes start at 0. So an array of length 10 has valid indexes from 0-9 inclusive (or 0-10 exclusive). This is why the for loop is usually styled, for (int i = 0; i &lt; arr.length; i++) { // &lt;-- less than (not less than =). // ... }
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43460948

http://stackoverflow.com/q/27540974
tagged with: eclipse-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/27542177
type: UnansweredQuestion
has title: Installing Hibernate plugins in Eclipse Luna error
score: -4
has body: An error occurred while collecting items to be installed session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.aspectj.runtime,1.8.5.20141117171500 No repository found containing: osgi.bundle,org.apache.ws.commons.schema,1.4.2.v201003051240 No repository found containing: osgi.bundle,org.aspectj.ajde,1.8.5.20141117171500 No repository found containing: osgi.bundle,org.aspectj.weaver,1.8.5.20141117171500 No repository found containing: osgi.bundle,org.eclipse.ajdt.core,2.2.4.e44x-20141118-0700 at 13% of installing this error occurred.and installation interrupted.
tagged with: java
tagged with: hibernate
type: Question
downvote count: 4
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/43540241
has text: Ah, dang. Sorry we couldn't get it working on your end. Best of luck on your next approach. ^^
comment on: http://stackoverflow.com/a/27555221
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43560800
score: 0
has text: "but the deserialization is not able to manage the various types" - could you elaborate on what this means? Could you paste your deserialisation code?
type: QuestionComment
comment on: http://stackoverflow.com/q/27567835
type: Comment

http://stackoverflow.com/a/27564614
type: Answer
score: 1
has body: If all subclasses are in the same package you could make MainClass package private to avoid it being extended by any class in other packages. package mainPackage; class MainClass { // note the missing public modifier } Subclass in the same package: package mainPackage; public class SubClass extends MainClass { // this extension works } Extension in other package: package externalPackage; import mainPackage.MainClass; public class SomeClass { public void foo() { MainClass foo = new MainClass() { // doesn't work because `MainClass` is not visible }; } } The problem with this is, that MainClass is not visible at all in other packages. In above example, the import statement and the variable declaration fail too. It still might be a solution for your special case.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27564238
answers question: http://stackoverflow.com/q/27564238
has comment: http://stackoverflow.com/comment/43555147

http://stackoverflow.com/q/27603472
answer count: 1
tagged with: unit-testing
type: UnansweredQuestion
tagged with: junit
downvote count: 0
score: 1
has body: I am new to Android testing. All I am trying now is new Espresso with Junit4. the thing I go till now is Espresso is for ui testing and with junit we can do logical testing. So I am trying Junit to test my retrofit code: protected String signIn(String emailNumber, String password) { RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(Constants.API_URL).build(); RetroInterface retroInterface = restAdapter.create(RetroInterface.class); retroInterface.signIn(emailNumber, password, new Callback&lt;SignInPojo&gt;() { @Override public void success(SignInPojo signInPojo, Response response) { if (signInPojo.getError()) { Snackbar.with(getApplicationContext()).text(signInPojo.getMessage()) .textColor(getResources().getColor(R.color.red_400)).show(SignInActivity.this); result = "successerror"; } else { Log.d("Json", signInPojo.getName()); result = "Successfully Signed In"; editor = sharedPreferences.edit(); editor.putBoolean(Constants.IS_LOGGED_IN, true); editor.apply(); startActivity(new Intent(getApplicationContext(), LenderActivity.class)); finish(); } } @Override public void failure(RetrofitError error) { Log.d("RetroError", error.toString()); Log.d("RetroUrl", error.getUrl()); result = "failed"; } }); return result; } with these test Class: SignInActivityJunit.java import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @RunWith(AndroidJUnit4.class) @SmallTest public class SignInActivityJunit extends ActivityInstrumentationTestCase2&lt;SignInActivity&gt;{ private SignInActivity signInActivity; public SignInActivityJunit() { super(SignInActivity.class); } @Before public void setUp() throws Exce…
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27603890
has title: Android: Test retrofit success,failure
tagged with: java
upvote count: 1

http://stackoverflow.com/q/27515020
has comment: http://stackoverflow.com/comment/43460849
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43460908
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/43460816
tagged with: java
has title: Ignored JUnit Assert method calls executed outside of main thread
tagged with: concurrency
has comment: http://stackoverflow.com/comment/43461069
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43461411
tagged with: junit
downvote count: 0
has body: Constant scheduling of small tasks is the core concept of my application. Most methods are static and come in two forms: public method executeSomeAction(Some param), which schedules execution of its private counterpart: ThreadPool.execute(() -&gt; someAction()). The things is - most methods are cut into small tasks that can be executed concurrently, and while they do pass separate function calls to the ThreadPool, I'd rather keep these "smaller" methods static and private. Needless to say, it's not as easy to write a test that checks if a static method was executed, as it would be with an object. I'm satisfied with the performance and the overall application structure (focusing on immutable data and multithreaded execution), but I have no idea how to write unit tests for some of this stuff. For example - I recently realized that even the core methods tests... always pass due to being executed on child threads rather than the main test's one: @Test public void shouldExecutePassedRunnables() { final int expectedCounterValue = 1; final AtomicInteger counter = new AtomicInteger(); ThreadPool.execute(() -&gt; { counter.getAndIncrement(); ThreadPool.execute(() -&gt; Assert.assertEquals(Tests.shouldSucceed("Counter incrementation"), counter.get(), expectedCounterValue)); }); ThreadPool.awaitTermination(Tests.DEFAULT_DELAY); } Hell, I even put Assert.fail() and debug logs all over the executed functions just to make sure I'm right. It just ignores Assert calls in other threads. Mockito doesn't help either. When I want to check if a method has been called on an object with a spy, it ignores the calls made in other threads. Which will be the ONLY calls, mostly. Since I'd rather test the public API than being forced to make 100% of my methods public (or even package-private, for that matter), I need a way to make sure that all of the tasks scheduled to the ThreadPool were executed and PROPERLY handled. Is there a way to do that? Or is there another library (or some pretty stab…
score: 4
has comment: http://stackoverflow.com/comment/47755030
favorite count: 0
has comment: http://stackoverflow.com/comment/43460665
has comment: http://stackoverflow.com/comment/43460713
has comment: http://stackoverflow.com/comment/43461278

http://stackoverflow.com/comment/43537801
type: QuestionComment
score: 1
has text: Please link to _but I've read that it is preferable to define the injections manually_ or add some context.
comment on: http://stackoverflow.com/q/27555752
type: Comment

http://stackoverflow.com/comment/43600096
score: 0
type: AnswerComment
has text: Thanks for your help, but I don't have a QAssetobjectParents class. This is only a many to many join-table. I think that's the problem.
comment on: http://stackoverflow.com/a/27583603
type: Comment

http://stackoverflow.com/a/41013165
answers question: http://stackoverflow.com/q/27538695
downvote count: 0
type: Answer
has body: double Math.acos(double v) should return NaN if v is NaN or if Math.abs(v) is greater than 1. If you are trying to calculate an angle between two vectors, you should use formulae like these: double angleBetweenVectors(Vect v1, Vect v2) { double cos = scalarProduct(v1, v2) / (length(v1) * length(v2)); double acos = Math.acos(cos); return Math.toDegrees(acos); } double scalarProduct(Vect v1, Vect v2) { double x1 = v1.xdest - v1.xi; double x2 = v2.xdest - v2.xi; double y1 = v1.ydest - v1.yi; double y2 = v2.ydest - v2.yi; return x1*x2 + y1*y2; } double length(Vect v) { double x = v.xdest - v.xi; double y = v.ydest - v.yi; return Math.sqrt(x*x + y*y); }
upvote count: 3
score: 3

http://stackoverflow.com/comment/43613002
has text: Hiimjames you can download the project. https://github.com/tsw1985/LightAdminHibernate the problem is in : PersonListener.java, I have a comment. Update the Hibernate.cnf.xml to you configuration.Database name is 'prueba' . To access to lightadmin , write http://localhost:8080/main/admin in my case. I want only know the way how Can I inject a dependency OUT SIDE a controller class. Run the project and you will have the exception.
comment on: http://stackoverflow.com/a/27584357
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43657364
has text: @Hrvoje85 - try to rename "main" then use updated xpath.
comment on: http://stackoverflow.com/q/27617510
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88285374
type: QuestionComment
comment on: http://stackoverflow.com/q/27634991
type: Comment
has text: when lucifer asks a question, do you need to answer right away?
score: 0

http://stackoverflow.com/q/27536675
has comment: http://stackoverflow.com/comment/43502216
tagged with: fonts
tagged with: java
tagged with: swing
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43501979
has comment: http://stackoverflow.com/comment/43502232
has comment: http://stackoverflow.com/comment/43502072
has comment: http://stackoverflow.com/comment/43501882
linked to: http://stackoverflow.com/q/5652344
has comment: http://stackoverflow.com/comment/43502579
type: UnansweredQuestion
has title: Font replaced by default font?
has comment: http://stackoverflow.com/comment/43502005
tagged with: windows
has body: I've written an application in Swing. For a JLabel I'm using a certain font (Tekton Pro Ext) which shows up properly on my computer. However, if someone else launches the program, the font may not be the same and then is replaced by a default one which I believe is Arial. Also, I'm forcing the system's default look and feel by running the following code: try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } Is there a way I can fix this font issue in my application's code so that it shows for others as well? If not, how can clients assure that all fonts I can choose in Window Builder Pro will also work for them? JLabel myLabel = new JLabel("Hello world!"); myLabel.setFont(new Font("Tekton Pro Ext", Font.BOLD, 22)); I haven't installed a special fonts pack but it's working on my Windows 8.1 machine "by default" though. What could be the cause?
has comment: http://stackoverflow.com/comment/43502056
duplicate of: http://stackoverflow.com/q/5652344
answer count: 0

http://stackoverflow.com/q/27585433
has answer: http://stackoverflow.com/a/27586835
has comment: http://stackoverflow.com/comment/43595428
has comment: http://stackoverflow.com/comment/43595464
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43602444
has comment: http://stackoverflow.com/comment/43595814
has body: Im writing a program with simple steganography implementation. I have a problem becouse if I use setRGB and then getRGB for one pixel i got different values. I read that setRGB and getRGB are not the best idea for byte and bits operation but maybe there is a way? i would like to work with LSB of alpha red green and blue of every pixel and I have no idea how to do it with rasters and to be honest i spend a lot of time with writing some code to generate proper TYPE_INT_ARGB value... I would like to use every 2 LSB from ARGB so I have 8 bits for pixel - that gives one char for pixel. System.out.println("ARGB in int befor edit: " + obraz.getRGB(0, 0)); int RGB = obraz.getRGB(0, 0); int alpha = (RGB &gt;&gt; 24) &amp; 0xFF; int red = (RGB &gt;&gt; 16) &amp; 0xFF; int green = (RGB &gt;&gt; 8) &amp; 0xFF; int blue = (RGB) &amp; 0xFF; System.out.println("RGB: " + RGB); System.out.println("alpha: " + alpha); System.out.println("red: " + red); System.out.println("green: " + green); System.out.println("blue: " + blue); System.out.println("After:"); int newARGB = addLetter(RGB, 'b'); //this change every two bits of ARGB int alpha2 = (newARGB &gt;&gt; 24) &amp; 0xFF; int red2 = (newARGB &gt;&gt; 16) &amp; 0xFF; int green2 = (newARGB &gt;&gt; 8) &amp; 0xFF; int blue2 = (newARGB) &amp; 0xFF; obraz.setRGB(0,0,newRGB); System.out.println("ARGB in int after edition: " + obraz.getRGB(0, 0)); int RGB3 = obraz.getRGB(0, 0); int alpha3 = (RGB3 &gt;&gt; 24) &amp; 0xFF; int red3 = (RGB3 &gt;&gt; 16) &amp; 0xFF; int green3 = (RGB3 &gt;&gt; 8) &amp; 0xFF; int blue3 = (RGB3) &amp; 0xFF; System.out.println("RGB: " + RGB3); System.out.println("alpha: " + alpha3); System.out.println("red: " + red3); System.out.println("green: " + green3); System.out.println("blue: " + blue3); and the results are different so stegenography does not work... this is the addLetter function public static int addLetter(int i, char letter) { byte tym, tc; tc = (byte) letter; int ARGB; byte byte3 = (byte) ((i &amp; 0xFF…
tagged with: steganography
has comment: http://stackoverflow.com/comment/43595513
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27585742
has title: Is there any way to use getRGB and setRGB with steganography?
upvote count: 1
tagged with: bufferedimage
type: Question
has comment: http://stackoverflow.com/comment/43595532
has comment: http://stackoverflow.com/comment/43595423

http://stackoverflow.com/q/27638754
linked to: http://stackoverflow.com/q/26340990
has title: How do I get an ImageIcon to show up when I export as Runnable JAR File?
tagged with: java
type: Question
tagged with: jar
tagged with: url
has answer: http://stackoverflow.com/a/27639618
score: 0
tagged with: imageicon
has comment: http://stackoverflow.com/comment/43698472
tagged with: runnable
has comment: http://stackoverflow.com/comment/43698457
answer count: 1
has comment: http://stackoverflow.com/comment/43698545
has body: Okay. I'm a beginner. I have looked at multiple questions on the interwebs, but I cannot fix this. I tried using URLs to show the image path, but nothing worked. Although, when I used ImageIcons to show the path, the picture just didn't show up; but when I used URLs, the JAR didn't open at at all. Then when I ran it in the command prompt, I got this-- Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source) at Package.ListenerClass.&lt;init&gt;(ListenerClass.java:47) at Package.Class.main(Class.java:17) What I'm getting out of this is that the file "doesn't exist". But when I compile it in eclipse, it works fine. Here's my driver class: package Package; import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; public class Class { @SuppressWarnings("unused") public static void main(String args[]) { JFrame frame = new JFrame("Click If You Dare"); ImageIcon background = new ImageIcon(); JLabel label = new JLabel(background); ListenerClass panel = new ListenerClass(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); frame.pack(); frame.setSize(425, 425); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setContentPane(panel); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } And my listener class: package Package; import java.awt.Font; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.net.URL; import javax.swing.Box; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @SuppressWarnings("serial") public class ListenerClass extends JPanel implements MouseListener { ImageIcon buttonOriginal; ImageIcon buttonClick; ImageIcon button100; ImageIcon button100Click; ImageIcon button200; ImageIcon button200Click; JButton button; JButton credits; JButton reset; JButton cheats; JLabel secondL…
type: UnansweredQuestion

http://stackoverflow.com/q/27582689
has answer: http://stackoverflow.com/a/27583198
has comment: http://stackoverflow.com/comment/43590410
tagged with: jdbc
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43590488
type: Question
accepted answer: http://stackoverflow.com/a/27583198
has body: I get the following error when i try to connect to my MYSQL database from a servlet. However, this doesn't happen when I access the database from a stand alone application. Dec 20, 2014 1:31:00 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:NbaFantasyApp' did not find a matching property. Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server version: Apache Tomcat/7.0.57 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server built: Nov 3 2014 08:39:16 UTC Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Server number: 7.0.57.0 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Name: Windows 7 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: OS Version: 6.1 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Architecture: amd64 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JAVA_HOME: C:\Program Files\Java\jre1.8.0_25 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Version: 1.8.0_25-b18 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: JVM Vendor: Oracle Corporation Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_BASE: C:\Users\PC\workspace_EE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: CATALINA_HOME: C:\Users\PC\Documents\eclipse-jee-luna-SR1-win32-x86_64\apache-tomcat-7.0.57\apache-tomcat-7.0.57 Dec 20, 2014 1:31:00 PM org.apache.catalina.startup.VersionLoggerListener log INFO: Command line argument: -Dcatalina.base=C:\Users\PC\workspace_EE\.metadata\.plugins\org.eclipse.wst.server.c…
has comment: http://stackoverflow.com/comment/43590343
tagged with: servlets
has title: cannot access my database from a servlet
answer count: 1
has comment: http://stackoverflow.com/comment/43590722
has comment: http://stackoverflow.com/comment/43590710

http://stackoverflow.com/q/27563561
tagged with: spring-transactions
type: Question
has body: Spring has transaction synchronizer that eats Runtime Exception here are spring code that does this - public static void invokeAfterCompletion(List&lt;TransactionSynchronization&gt; synchronizations, int completionStatus) { if (synchronizations != null) { for (TransactionSynchronization synchronization : synchronizations) { try { synchronization.afterCompletion(completionStatus); } catch (Throwable tsex) { logger.error("TransactionSynchronization.afterCompletion threw exception", tsex); } } } } is there a way through which I know about exception thrown while afterComplete? I have considered solutions like thread locals but does spring provides a clean way of handling this? any one? EDIT The postCompletion method checks if rollback triggered and does some clean up. If clean up fails with an exception like Connection Reset or Network issue, I wanted to add retry mechanism in my code. Since postCompletion is called by third party code It throws an exception RollbackFailed. I want to catch that exception and add retry few more times as release resource is important for me. reference to spring jira issue - https://jira.spring.io/browse/SPR-12560
tagged with: jpa
score: 0
has comment: http://stackoverflow.com/comment/43552729
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43558721
has comment: http://stackoverflow.com/comment/43560710
tagged with: spring
has comment: http://stackoverflow.com/comment/43559676
has title: TransactionSynchronization sallow RuntimeException that is thrown while afterComplete process
has comment: http://stackoverflow.com/comment/43582160
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43558783

http://stackoverflow.com/comment/43613298
type: AnswerComment
comment on: http://stackoverflow.com/a/27594825
type: Comment
has text: Netbeans also has a decompiler I dont know what version you have .But you can find ont on http://plugins.netbeans.org/plugin/1177/nbjad
score: 0

scrollview
tags question: http://stackoverflow.com/q/27518889
tags question: http://stackoverflow.com/q/27595913
tag name: scrollview
type: Tag

http://stackoverflow.com/comment/43570812
has text: `EntityManagerFactory` hasn't `unwrap` method. Update your answer to `((HibernateEntityManagerFactory) entityManagerFactory).getSessionFactory()` please
comment on: http://stackoverflow.com/a/27571252
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27601856
has comment: http://stackoverflow.com/comment/43629870
answers question: http://stackoverflow.com/q/27601526
upvote count: 1
type: Answer
downvote count: 0
has body: Wouldn't FreeMarker be a good option here? If you use FreeMarker you can provide your template in a separate template file and build the output by merging the template with the data model (a bean or a Map). // Setup config Configuration cfg = new Configuration(Configuration.VERSION_2_3_21); cfg.setDirectoryForTemplateLoading(new File("/where/you/store/templates")); cfg.setDefaultEncoding("UTF-8"); // Create the data model - e.g. a bean or a map final Map&lt;String, String&gt; root = new HashMap&lt;&gt;(); root.put("PERSON_NAME", "Joe"); root.put("CEO_NAME", "Anne"); // Get the template Template temp = cfg.getTemplate("myTemplate.ftl"); // Merge the template with the data model Writer out = new OutputStreamWriter(System.out); temp.process(root, out);
score: 1

http://stackoverflow.com/comment/43484228
score: 0
type: Comment
type: QuestionComment
has text: BTW: the code you pasted and the exception you pasted are from different sources. In your code most probably there is no `return` in the exception handling block. Also this has nothing to do to JDBC, those are just diagnostic messages.
comment on: http://stackoverflow.com/q/27527610

http://stackoverflow.com/q/27572128
has comment: http://stackoverflow.com/comment/43569616
possible better answer: http://stackoverflow.com/a/27572271
has body: I created a java program that will search for a value in array but my problem is when I input the same value in a different index, the first index is the only one that will be on output. Example index 0 = 2, index 1 = 3, index 2 = 2 Output : array 2 is found at index 0 only I break it on the loop to stop but if I did not do that, it will loop the Output Here's what I want for Output: array 2 is found at index 0,2 Code: import java.awt.*; import javax.swing.*; import java.io.*; public class Buff { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter how many index :"); int v = Integer.parseInt( in .readLine()); int x; int[] c = new int[v]; int vv; for (x = 0; x &lt; v; x++) { System.out.print("Enter your value :"); c[x] = Integer.parseInt( in .readLine()); } System.out.print("Enter your search number :"); int xx = Integer.parseInt( in .readLine()); for (x = 0; x &lt; v; x++) { if (c[x] == xx) { System.out.print("array " + xx + " found at index :" + x); break; } else { System.out.print("array not found"); } } } }
has comment: http://stackoverflow.com/comment/43569766
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27572293
type: Question
has comment: http://stackoverflow.com/comment/43570330
has comment: http://stackoverflow.com/comment/43569748
tagged with: bufferedreader
score: 0
has answer: http://stackoverflow.com/a/27572271
answer count: 3
accepted answer: http://stackoverflow.com/a/27572293
has title: Finding the same value at multiple indexes
has answer: http://stackoverflow.com/a/27572447

http://stackoverflow.com/a/27604314
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: You should take a look on how a for needs to be constructed for (init; stop_condition; actions) init can be a list of java initialisation, separated with comma (,) stop_condition needs to be a single java expression that evaluates to a boolean, in your case it should be : j &lt; list.length &amp;&amp; i &lt; list.length action can be a list of java expressions, separated with comma (,) way more simple you could write (as i and j are always the same): for(int i = 0;i &lt; list.length; i++) { result[j] = list[i]; }
answers question: http://stackoverflow.com/q/27604211

http://stackoverflow.com/q/27554918
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43538810
type: Question
has body: I am trying to create an object which has two parts, a string and a method. For my handling of this I want the user to be able to do add(Instance) or add(string, lambda). The way I understand it, I can't use an interface because they don't have public only properties (Not static), I can't use a class because then I couldn't pass it as an argument and I can't pass an interface then call the method directly because that would be bad practice. So how / what is the best way to do this? EG: interface IFoo { void DoBar(); } class Foo implmenets IFoo { public string Bar; } EG add: void addFoo(Foo foo) { this.foos.add(foo); } void addFoo(String bar, IFoo foo) { foo.Bar = bar; this.foos.add(foo); } EG usage: addFoo("yes", () -&gt; { //some code }); EDIT: My current solution, feels like it would be bad practice, but it's the best I can come up with until someone else has a better idea. Interface (For the Lambda to use) @FunctionalInterface public interface ICommand { void processCommand(CommandArgument[] args); } Class (For instancing) public abstract class Command implements ICommand { public String command = ""; public abstract void processCommand(CommandArgument[] args); } Add method public void addCommand(String commandName, ICommand action) { Command command = new Command() { @Override public void processCommand(CommandArgument[] args) { action.processCommand(args); } }; command.command = commandName; this.addCommand(command); } Usage: CommandHandler handler = new CommandHandler(); handler.addCommand("quit", (CommandArgument[] args) -&gt; System.exit(0));
has comment: http://stackoverflow.com/comment/43536342
has comment: http://stackoverflow.com/comment/43536628
has comment: http://stackoverflow.com/comment/43539446
has comment: http://stackoverflow.com/comment/43537818
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: interface
has comment: http://stackoverflow.com/comment/43536798
tagged with: lambda
has comment: http://stackoverflow.com/comment/43536257
has title: Java passing lambda as argument with properties

http://stackoverflow.com/comment/43550273
type: AnswerComment
score: 0
has text: Can you update your code snippet which will make easy for me to understand ? Ideally , this should work. May be a problem with JAXB Marshelling/UnMarshelling
type: Comment
comment on: http://stackoverflow.com/a/27529030

http://stackoverflow.com/a/41777625
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27631692
has body: // The Regex not validate mobile number, which is in internation format. // The Following code work for me. // I have use libphonenumber library to validate Number from below link. // http://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.0.1/ // https://github.com/googlei18n/libphonenumber // Here, is my source code. public boolean isMobileNumberValid(String phoneNumber) { boolean isValid = false; // Use the libphonenumber library to validate Number PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); Phonenumber.PhoneNumber swissNumberProto =null ; try { swissNumberProto = phoneUtil.parse(phoneNumber, "CH"); } catch (NumberParseException e) { System.err.println("NumberParseException was thrown: " + e.toString()); } if(phoneUtil.isValidNumber(swissNumberProto)) { isValid = true; } // The Library failed to validate number if it contains - sign // thus use regex to validate Mobile Number. String regex = "[0-9*#+() -]*"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(phoneNumber); if (matcher.matches()) { isValid = true; } return isValid; }
has comment: http://stackoverflow.com/comment/125095028
score: 4

jaws-wordnet
tags question: http://stackoverflow.com/q/27518386
tag name: jaws-wordnet
type: Tag

http://stackoverflow.com/comment/43646550
type: Comment
comment on: http://stackoverflow.com/a/27612055
has text: @ajb, I had been thinking the OP's error was runtime (since he didn't clarify). But you're right, it would have been a compiler error and as such would fail for the reasons you outlined.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27548841
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27548068
downvote count: 0
has body: First, a couple of helpful tips: resultset =statement.executeQuery("select * from department") ; Never select *. Always specify the fields you want in the order you want them to appear. This is likely to be at the root of your issue Related to that, you're using the numerically-indexed version of getString &lt;option&gt;&lt;%= resultset.getString(2)%&gt;&lt;/option&gt; Don't do that either. Specify the name of the field you want, like this: &lt;option&gt;&lt;%= resultset.getString("department_name") %&gt;&lt;/option&gt; It's also generally considered bad practice to put SQL directly into your JSPs like this. It's better to do that sort of thing in the servlet and then use request attributes to send objects to the JSP, or better yet use a framework. However, that's just a style critique, and doesn't really impact your result here. Now, on to your actual problem. Hopefully, those two tips have already given you a clue why your code isn't working, but let's take a look at the error message. java.lang.NumberFormatException: For input string: "Math Department" Your program (a part that I think you haven't posted) is trying to decode the value of that dropdown menu as an integer, but the value is "Math Department". Obviously, that's not a number, so it throws an error. What you need to do is display the department name as the menu label, but have the id as the value. So, looking at your option tag, you need to do something like this: &lt;option value="&lt;%= resultset.getInt("department_id") %&gt;"&gt; &lt;%= resultset.getString("department_name") %&gt; &lt;/option&gt; This will show the user the name of the department, but send the id back to the servlet for processing.
answers question: http://stackoverflow.com/q/27548068
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43562472
has comment: http://stackoverflow.com/comment/43562583

http://stackoverflow.com/comment/72005959
type: AnswerComment
comment on: http://stackoverflow.com/a/37461258
type: Comment
score: 2
has text: SLF4J-240 was fixed today and will be in the 1.7.24 release.

http://stackoverflow.com/a/27612330
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27612302
answers question: http://stackoverflow.com/q/27612302
downvote count: 0
score: 1
has body: You can do: System.out.print((i + j) % 10); To turn 10 into 0, 11 into 1, etc.
upvote count: 1

http://stackoverflow.com/a/27475276
has comment: http://stackoverflow.com/comment/43385046
has comment: http://stackoverflow.com/comment/43384865
downvote count: 1
has comment: http://stackoverflow.com/comment/43385233
has comment: http://stackoverflow.com/comment/43384966
score: -1
has comment: http://stackoverflow.com/comment/43384929
upvote count: 0
has body: Your while loop inside FindItem() never reassigns current, seems like it would loop forever. Are you maybe running this inside a try-catch block?
has comment: http://stackoverflow.com/comment/43385028
type: Answer
answers question: http://stackoverflow.com/q/27475205
has comment: http://stackoverflow.com/comment/43385343

http://stackoverflow.com/q/27512052
has comment: http://stackoverflow.com/comment/43455085
type: UnansweredQuestion
score: -3
downvote count: 3
tagged with: java
type: Question
upvote count: 0
tagged with: arrays
has title: How to convert Array to ArrayList?i don't know whether this work or not..can anyone help me
has comment: http://stackoverflow.com/comment/43454467
favorite count: 0
has body: I'm new to Java world. Here is my code: OrderElementRequest is a class which holding the detail of order elements. OrderElementRequest[] orderElementRequest; //Array type defined in class OrderElementRequests which have setter and getter for the same. OrderElementRequests orderElementRequests; //OrderElementRequests type defined in the class PlaceOrderRequest which have setter and getter for the same. List listElement = new ArrayList(Arrays.asList(placeOrderRequest.getOrderElementRequests())); order.setLstOrderElement(listElement); //order is an object of Order class which contains an Arraylist LstOrderElement of type OrderElement. Now I wanted to convert array of OrderElementRequests to List&lt;OrderElement&gt; LstOrderElement. Nnow there is a warning: Type safety: The constructor ArrayList(Collection) belongs to the raw type ArrayList. References to generic type ArrayList should be parameterized. And here is few more information public class OrderProcessorImpl implements IOrderProcessor{ public void placeOrder(PlaceOrderRequest placeOrderRequest) throws Exception{ String URL="jdbc:oracle:thin:@localhost:1521:xe"; String Uname="hr"; String Pass="hr"; Connection con=null; PreparedStatement prepairedSt=null; Order order=new Order(); order.setOrderDescription(placeOrderRequest.getOrderDescription()); order.setCreatedDate(placeOrderRequest.getOrderDate()); List&lt;OrderElementRequests&gt; listElement = new ArrayList(Arrays.asList(placeOrderRequest.getOrderElementRequests())); order.setLstOrderElement(listElement); . . . public class PlaceOrderRequest { String orderDescription; Date orderDate; OrderElementRequests orderElementRequests; public String getOrderDescription() { return orderDescription; } public void setOrderDescription(String orderDescription) { this.orderDescription = orderDescription; }....... public class OrderElementRequests { OrderElementRequest[] orderElementRequest; public OrderElementRequest[] getOrderElementRequest() { return orderElementRequest; } …
tagged with: arraylist
has answer: http://stackoverflow.com/a/27512142
has answer: http://stackoverflow.com/a/27512183
has answer: http://stackoverflow.com/a/27512114
answer count: 3
has comment: http://stackoverflow.com/comment/43454459

http://stackoverflow.com/q/27477831
answer count: 1
has body: I want to read bytes from the serial port and write to it sequentially.Is there any way i can read and write from/to the serial port by creating two separate functions for read and write in java?.I wrote a program but here,serialPort.getInputStream() is giving a null pointer exception even after opening the desired COM port. This is my code package PhyCom; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Enumeration; import java.util.TooManyListenersException; import javax.comm.CommPortIdentifier; import javax.comm.PortInUseException; import javax.comm.SerialPort; import javax.comm.SerialPortEvent; import javax.comm.SerialPortEventListener; import javax.comm.UnsupportedCommOperationException; import javax.xml.bind.DatatypeConverter; public class COMConnect_DLMS { public static InputStream inputStream; public static OutputStream outputStream; SerialPort serialPort; public long baudRate=19200; public int dataBits=SerialPort.DATABITS_8; public int stopBits=SerialPort.STOPBITS_1; public int parity=SerialPort.PARITY_NONE; boolean portFound = false; String defaultPort="COM1"; static Enumeration portList ; public static CommPortIdentifier portId; public COMConnect_DLMS() { initialize(); } private void initialize() { System.out.println("Establishing connection to UART"); portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals(defaultPort)) { System.out.println("Found port: "+defaultPort); portFound = true; } } } try { serialPort = (SerialPort) portId.open("SimpleReadApp", 2000); } catch (PortInUseException e) {} System.out.println(portId.getName()); try { inputStream=serialPort.getInputStream(); } catch (IOException e) {e.printStackTrace();} /*try { serialPort.addEventListener((SerialPortEventListener) this); } catch(TooManyListenersException e){} …
has comment: http://stackoverflow.com/comment/43389624
tagged with: java
downvote count: 5
tagged with: inputstream
has title: Read and Write from serial port in java without listener event
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/43389549
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/43389661
has comment: http://stackoverflow.com/comment/43389508
has answer: http://stackoverflow.com/a/27478012
has comment: http://stackoverflow.com/comment/43389530

http://stackoverflow.com/comment/43496528
comment on: http://stackoverflow.com/q/27534062
type: QuestionComment
has text: you need to do `staticMethods.findMaxPos`
type: Comment
score: 2

http://stackoverflow.com/a/27556533
has comment: http://stackoverflow.com/comment/43539498
score: 0
type: Answer
has body: String greeting = "Hello world!"; In this case, "Hello world!" is a string literal—a series of characters in your code that is enclosed in double quotes. Whenever it encounters a string literal in your code, the compiler creates a String object with its value—in this case, Hello world!. String a = "Hello"; // 1 object String b = new String("Hello World"); // 1 object with new String(), // 1 object with "Hello World" in total you created 3 objecs.
answers question: http://stackoverflow.com/q/27556506

http://stackoverflow.com/comment/43521355
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27546910
has text: Yes I gave version manually.
score: 0

methods
tags question: http://stackoverflow.com/q/27581061
tags question: http://stackoverflow.com/q/27477145
tags question: http://stackoverflow.com/q/27630178
tags question: http://stackoverflow.com/q/27551784
tags question: http://stackoverflow.com/q/27534062
tags question: http://stackoverflow.com/q/27608536
tags question: http://stackoverflow.com/q/27496598
tags question: http://stackoverflow.com/q/27475205
tag name: methods
tags question: http://stackoverflow.com/q/27533551
tags question: http://stackoverflow.com/q/27569076
tags question: http://stackoverflow.com/q/27512387
tags question: http://stackoverflow.com/q/27526481
tags question: http://stackoverflow.com/q/27612585
type: Tag
tags question: http://stackoverflow.com/q/27494305
tags question: http://stackoverflow.com/q/27601781
tags question: http://stackoverflow.com/q/27538857
tags question: http://stackoverflow.com/q/27593743
tags question: http://stackoverflow.com/q/27533508
tags question: http://stackoverflow.com/q/27494132
tags question: http://stackoverflow.com/q/27561320
tags question: http://stackoverflow.com/q/27584543
tags question: http://stackoverflow.com/q/27536250
tags question: http://stackoverflow.com/q/27534949
tags question: http://stackoverflow.com/q/27560703
tags question: http://stackoverflow.com/q/27495670
tags question: http://stackoverflow.com/q/27487371
tags question: http://stackoverflow.com/q/27569140
tags question: http://stackoverflow.com/q/27493983
tags question: http://stackoverflow.com/q/27557922
tags question: http://stackoverflow.com/q/27492636
tags question: http://stackoverflow.com/q/27622233
tags question: http://stackoverflow.com/q/27496229
tags question: http://stackoverflow.com/q/27567697
tags question: http://stackoverflow.com/q/27521246
tags question: http://stackoverflow.com/q/27493903
tags question: http://stackoverflow.com/q/27620050
tags question: http://stackoverflow.com/q/27494298
tags question: http://stackoverflow.com/q/27518539

http://stackoverflow.com/comment/43631888
comment on: http://stackoverflow.com/q/27603521
score: 0
type: QuestionComment
has text: @fge operations on `double` (or `float`) and `int` will result in the floating point type used. Change `n` to `(int) n`.
type: Comment

http://stackoverflow.com/q/27592365
tagged with: java
type: Question
has body: I am new to jsp and jstl technology. I am trying to print out a some text in &lt;c:out value&gt;, please see point 1 in code. I am trying to display a text like this - Account Manager-5 Here ${aStageRole.displayName} = 'Account Manager' and (pro.stageRoles) is an array which length is 5. &lt;select id="selectRole&lt;%=i %&gt;" onchange="javascript:selectRole('selectRole&lt;%=i %&gt;')"&gt; &lt;c:forEach items="${pro.stageRoles}" var="aStageRole" varStatus="status"&gt; &lt;option value="${aStageRole.role.id}"&gt; &lt;c:out value="${aStageRole.displayName}-{fn:length(pro.stageRoles)}"/&gt;&lt;/option&gt; //1 &lt;/c:forEach&gt; &lt;/select&gt; But the code outputs the following value in the dropdown - Account Manager-{fn:length(pro.stageRoles)} Can anyone help me how can I solve this problem?
tagged with: jstl
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43614164
tagged with: jsp
has title: Printing the Array Length with 'fn' in JSTL
duplicate of: http://stackoverflow.com/q/851880
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27592616
linked to: http://stackoverflow.com/q/851880
score: 1

jpa
tags question: http://stackoverflow.com/q/27617359
tags question: http://stackoverflow.com/q/27531800
tags question: http://stackoverflow.com/q/27500274
tags question: http://stackoverflow.com/q/27537403
tags question: http://stackoverflow.com/q/27484985
tags question: http://stackoverflow.com/q/27635290
tags question: http://stackoverflow.com/q/27510353
tags question: http://stackoverflow.com/q/27579685
tags question: http://stackoverflow.com/q/27545276
tags question: http://stackoverflow.com/q/27560469
tags question: http://stackoverflow.com/q/27540248
tags question: http://stackoverflow.com/q/27507392
tags question: http://stackoverflow.com/q/27603050
tags question: http://stackoverflow.com/q/27526201
tags question: http://stackoverflow.com/q/27497669
tags question: http://stackoverflow.com/q/27556918
tags question: http://stackoverflow.com/q/27566339
tags question: http://stackoverflow.com/q/27523259
tags question: http://stackoverflow.com/q/27594455
tags question: http://stackoverflow.com/q/27595252
tags question: http://stackoverflow.com/q/27636754
tags question: http://stackoverflow.com/q/27528455
tags question: http://stackoverflow.com/q/27602318
tags question: http://stackoverflow.com/q/27567634
tags question: http://stackoverflow.com/q/27591734
tags question: http://stackoverflow.com/q/27636242
tags question: http://stackoverflow.com/q/27511768
tags question: http://stackoverflow.com/q/27575071
type: Tag
tags question: http://stackoverflow.com/q/27608224
tags question: http://stackoverflow.com/q/27596345
tags question: http://stackoverflow.com/q/27594552
tags question: http://stackoverflow.com/q/27529208
tags question: http://stackoverflow.com/q/27561658
tags question: http://stackoverflow.com/q/27523351
tags question: http://stackoverflow.com/q/27519399
tags question: http://stackoverflow.com/q/27562708
tags question: http://stackoverflow.com/q/27482032
tags question: http://stackoverflow.com/q/27563561
tags question: http://stackoverflow.com/q/27541543
tags question: http://stackoverflow.com/q/27593980
tags question: http://stackoverflow.com/q/27541894
tags question: http://stackoverflow.com/q/27486104
tags question: http://stackoverflow.com/q/27619030
tags question: http://stackoverflow.com/q/27582757
tags question: http://stackoverflow.com/q/27489595
tags question: http://stackoverflow.com/q/27525317
tags question: http://stackoverflow.com/q/27582083
tags question: http://stackoverflow.com/q/27587610
tags question: http://stackoverflow.com/q/27637215
tags question: http://stackoverflow.com/q/27625686
tags question: http://stackoverflow.com/q/27515201
tags question: http://stackoverflow.com/q/27574855
tags question: http://stackoverflow.com/q/27590138
tags question: http://stackoverflow.com/q/27620400
tags question: http://stackoverflow.com/q/27508577
tags question: http://stackoverflow.com/q/27610229
tags question: http://stackoverflow.com/q/27539626
tags question: http://stackoverflow.com/q/27553161
tag name: jpa
tags question: http://stackoverflow.com/q/27533275
tags question: http://stackoverflow.com/q/27624410
tags question: http://stackoverflow.com/q/27583632
tags question: http://stackoverflow.com/q/27560541
tags question: http://stackoverflow.com/q/27607806
tags question: http://stackoverflow.com/q/27600820
tags question: http://stackoverflow.com/q/27563957
tags question: http://stackoverflow.com/q/27528976
tags question: http://stackoverflow.com/q/27565706
tags question: http://stackoverflow.com/q/27605490
tags question: http://stackoverflow.com/q/27636779
tags question: http://stackoverflow.com/q/27516036
tags question: http://stackoverflow.com/q/27504356
tags question: http://stackoverflow.com/q/27483935
tags question: http://stackoverflow.com/q/27485288
tags question: http://stackoverflow.com/q/27579251
tags question: http://stackoverflow.com/q/27482835
tags question: http://stackoverflow.com/q/27552445
tags question: http://stackoverflow.com/q/27488767
tags question: http://stackoverflow.com/q/27595649

http://stackoverflow.com/q/27601302
possible better answer: http://stackoverflow.com/a/27601593
has comment: http://stackoverflow.com/comment/43627170
tagged with: jsp
has answer: http://stackoverflow.com/a/27603635
answer count: 2
score: 2
has title: Display exception message handled by Spring using JSP
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: spring
accepted answer: http://stackoverflow.com/a/27603635
has body: I'm new in Spring and also in JSP. I'm working in the project and I needed to create a page where application will be redirected in case of specific exceptions. I have service's method which throws one of exceptions. This method is called in one of our page controller with @RequestMapping annotation. So to redirect to specific error page, I created two methods with @ExceptionHanlder which handle this exceptions in this controller. How it looks: @ExceptionHandler(IllegalStateException.class) public ModelAndView handleIllegalStateException (IllegalStateException ex) { ModelAndView modelAndView = new ModelAndView("redirect:/error"); modelAndView.addObject("exceptionMsg", ex.getMessage()); return modelAndView; } But there wasn't enough. I also need to create ErrorPageController: @Controller @RequestMapping("/error") public class ErrorPageController { @RequestMapping(method = RequestMethod.GET) public ModelAndView displayErrorPage() { return new ModelAndView("error"); } } And now works displaying error page. But my problem is, that I can't display error message in JSP... I have: Error page: "${exceptionMsg}" But I don't see a message ;/ Instead of it, I see message in URL: localhost/error?exceptionMsg=Cannot+change+participation+status+if+the+event+is+cancelled+or+it+has+ended. And it's wrong because in URL I want to have only an "localhost/error" and nothing more. This message I want to display in JSP.
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43627099
has comment: http://stackoverflow.com/comment/43625252
has answer: http://stackoverflow.com/a/27601593
tagged with: java
type: Question

http://stackoverflow.com/q/27565718
tagged with: oracle-database
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43556620
has comment: http://stackoverflow.com/comment/43556745
answer count: 0
tagged with: prepared-statement
type: Question
has title: Query with WHERE clause on timestamp does not return results on one table but fine on the other
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/43556404
has comment: http://stackoverflow.com/comment/43820864
has comment: http://stackoverflow.com/comment/43556610
has body: I have 2 tables A and B with reporting_date_time as timestamp(6). When I query table A executes fine but not on table B This is my query: select * from A where reporting_date_time = ? I use JDBC PreparedStatements and pass the argument through: prepStmt.setTimestamp(1, myTimestampVar);. private java.sql.Timestamp myTimestampVar; myTimestampVar.toString shows the value as '2014-11-26 00:00:00.0' Strange thing is that same application gets data from both tables in user testing, while it fails to do so in production even though it is the same JDBC driver on both environments. I got oracle trace enabled and found that in table A timestamp is passed to the query as 26-NOV-14 12.00.00 AM, while that in table B it is passed as 26-NOV-14 00.00.00. Why would it is sending it in two different formats?
type: UnansweredQuestion

http://stackoverflow.com/comment/43535069
comment on: http://stackoverflow.com/q/27554340
type: Comment
type: QuestionComment
has text: It seems unlikely/impossible that Tomcat would have any effect on the runtime of the specific lines that you posted. Can you give a high level overview of LongRunningProcess? It seems more likely to me that something they are doing is slowing down rather than something you posted. Or do you have some reason for knowing it is the control logic you posted and not the task logic?
score: 1

http://stackoverflow.com/a/27525594
downvote count: 1
has body: GL_ARRAY_BUFFER is not one of the allowed values to glEnable. If you want to attach a vertex buffer object to the vertex pointer, you have to enable it using the glEnableClientState method: glEnableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle); glVertexPointer(3, GL_FLOAT, 0, 0L); //This is line 2074 of the TerrainDemo class. Side note: This functionality is deprecated since OpenGL 3 Core Profile. If there is no restriction on sticking to this old OpenGL version, it would be a good idea to start with modern OpenGL (especially since you're already using vbos).
type: Answer
answers question: http://stackoverflow.com/q/27525323
upvote count: 2
score: 1

http://stackoverflow.com/q/27500723
has comment: http://stackoverflow.com/comment/43431988
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-server
tagged with: jsp
has comment: http://stackoverflow.com/comment/43431942
has answer: http://stackoverflow.com/a/27500745
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27500745
has body: im noob to Programming Please look into the following code.while running the code it gave me some nullpointer exception
has title: JSP Page error While inserting data

web
tags question: http://stackoverflow.com/q/27630902
tags question: http://stackoverflow.com/q/27500511
tags question: http://stackoverflow.com/q/27487996
type: Tag
tags question: http://stackoverflow.com/q/27585339
tag name: web
tags question: http://stackoverflow.com/q/27567511

http://stackoverflow.com/a/27558334
type: Answer
has body: From their documentation page (emphasis is mine) JWPL is for you: If you need structured access to Wikipedia in Java. JWPL is not for you: If you need to query live data. JWPL works on an optimized database, i.e. you are querying a static Wikipedia dump. This gives much better performance and lightens the load on the Wikipedia servers. So the DB settings are to be provided by you. This means you have to install your own Database server, insert all the dumped data given by Wikipedia and query your own database. You would have to update your Database regularly if you need 'fresh' results. If you need up-to-date (i.e. live) results, you would have to use a different tool.
upvote count: 3
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27558206
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27558206

http://stackoverflow.com/q/27492990
has body: I wrote a class for Sobel operator for edge detection, but when I use an example image, my edges are off. Greatly appreciate it if someone can help me with this. import java.awt.image.BufferedImage; import java.awt.image.ConvolveOp; import java.awt.image.Kernel; import java.awt.image.Raster; import java.util.Arrays; class SobelFilter { private static final float[] sobel1 = { 1.0f, 0.0f, -1.0f}; private static final float[] sobel2 = { 1.0f, 2.0f, 1.0f}; private static final boolean[] sobelBoolean = {true, false}; private SobelFilter() {} private static ConvolveOp getSobelX(boolean fs) { Kernel kernel = null; if (fs) { kernel = new Kernel(1, 3, sobel1); } else { kernel = new Kernel(3, 1, sobel2); } return new ConvolveOp(kernel, ConvolveOp.EDGE_ZERO_FILL, null); } private static ConvolveOp getSobelY(boolean fs) { Kernel kernel = null; if (fs) { kernel = new Kernel(1, 3, sobel2); } else { kernel = new Kernel(3, 1, sobel1); } return new ConvolveOp(kernel, ConvolveOp.EDGE_ZERO_FILL, null); } public static BufferedImage getSobelFilter(BufferedImage img) { int width = img.getWidth(); int height = img.getHeight(); int size = width * height; int[] x = new int[size]; int[] y = new int[size]; int[] pixelM = new int[size]; //double[] pixelD = new double[size]; BufferedImage sobelX = null; BufferedImage sobelY = null; for(boolean i : sobelBoolean) { sobelX = getSobelX(i).filter(img, null); sobelY = getSobelY(i).filter(img, null); } sobelX.getRaster().getPixels(0, 0, width, height, x); sobelY.getRaster().getPixels(0, 0, width, height, y); for(int i = 0; i &lt; size; i++) { pixelM[i] = (int) Math.hypot(x[i], y[i]); //pixelD[i] = Math.atan2((double) y[i], (double) x[i]); } BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); result.getRaster().setPixels(0, 0, width, height, pixelM); return result; } } I used the valve picture from Wikipedia as an example. Original test image Expected result Actual result
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43417713
has title: Sobel Filter not functioning correctly
upvote count: 5
has comment: http://stackoverflow.com/comment/43417855
type: Question
score: 5
has comment: http://stackoverflow.com/comment/43417725
has answer: http://stackoverflow.com/a/27493331
has comment: http://stackoverflow.com/comment/43418349
has comment: http://stackoverflow.com/comment/43418029
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/27531747
favorite count: 0
accepted answer: http://stackoverflow.com/a/27493331
tagged with: sobel
tagged with: java
has comment: http://stackoverflow.com/comment/43417817
has comment: http://stackoverflow.com/comment/43417629

http://stackoverflow.com/comment/43434491
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27485302
has text: @Mr Covex the objects are not in the context, they are just injected. Please refer to my edited post.
score: 0

random
tags question: http://stackoverflow.com/q/27501221
tags question: http://stackoverflow.com/q/27484254
tags question: http://stackoverflow.com/q/27531759
tags question: http://stackoverflow.com/q/27627570
tags question: http://stackoverflow.com/q/27582254
tags question: http://stackoverflow.com/q/27498021
tags question: http://stackoverflow.com/q/27629297
tags question: http://stackoverflow.com/q/27505355
tags question: http://stackoverflow.com/q/27625611
tag name: random
tags question: http://stackoverflow.com/q/27622625
tags question: http://stackoverflow.com/q/27604251
type: Tag
tags question: http://stackoverflow.com/q/27614569
tags question: http://stackoverflow.com/q/27583017

http://stackoverflow.com/q/27610644
tagged with: multi-module
has answer: http://stackoverflow.com/a/27646659
score: 0
accepted answer: http://stackoverflow.com/a/27646659
answer count: 1
has body: I have a multi-module web-application maven project. Iterating over list of dependencies of each module (depndencies:list) - it's easy to see dependencies conflicts - but is there a plugin that produces conflicts report so I can run it in my CI server as build validation? Examples for conflicts: Circular dependencies. Same dependency with different version on different sub-modules
has comment: http://stackoverflow.com/comment/43696899
has title: Continuous validation of maven dependencies on multi-module project
tagged with: maven
tagged with: build
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: continuous-integration
has comment: http://stackoverflow.com/comment/43709870

http://stackoverflow.com/q/27513487
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/27566503
tagged with: java
tagged with: webview
type: Question
has answer: http://stackoverflow.com/a/27566503
has body: Hello I have tryed a lot of tutorials and checked on stackoverflow but I have a problem. The custom html webview don't views automatically you must click on the back button of your android phone and then he views him. Can anybody help? webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); webView.setBackgroundColor(Color.parseColor("#9e1b32")); String customHtml = " Hello, WebView "; webView.loadData(customHtml, "text/html", "UTF-8"); and the listview page changer: public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: Intent newActivity0 = new Intent(getBaseContext(), 1.class); startActivity(newActivity0); case 1: Intent newActivity1 = new Intent(getBaseContext(), 2.class); startActivity(newActivity1); }
has title: My webview customhtml background onitemclicklistener
upvote count: 2
answer count: 1

http://stackoverflow.com/a/27519045
answers question: http://stackoverflow.com/q/27518889
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/43468313
has body: Add the linear layout contents to your relative layout inside scrollview will work I think. Or make the scrollview as root parent also will work. <TextView android:id="@+id/welcomeToStudy" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="Welcome to xxxxxxxxxxxxxxx!" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#54575A" android:textSize="28sp" /> <TextView android:id="@+id/pleaseEnter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/welcomeToStudy" android:layout_centerHorizontal="true" android:layout_marginTop="5dp" android:text="Please enter your details xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." android:textSize="20sp" />

http://stackoverflow.com/q/27505954
tagged with: websphere
has comment: http://stackoverflow.com/comment/82231416
score: 5
answer count: 3
has answer: http://stackoverflow.com/a/27508180
has body: Long story short; is there any reason why an application working on a Tomcat isn't able to communicate with Paypal servers? Some background: we are developing a series of portlets on Liferay, which at some point communicate with paypal servers to start and validate a purchasing process. This works like charm on local tomcat without any special configuration, but after installing Liferay and the portlet it fails to start the process. The stack looks like this: [16/12/14 13:51:01:728 GMT+01:00] 0000015d SystemOut O 13:51:01,727 ERROR [WebContainer : 2][render_portlet_jsp:132] null javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.ibm.jsse2.o.a(o.java:33) at com.ibm.jsse2.o.a(o.java:30) at com.ibm.jsse2.SSLSocketImpl.b(SSLSocketImpl.java:168) at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:318) at com.ibm.jsse2.SSLSocketImpl.h(SSLSocketImpl.java:403) at com.ibm.jsse2.SSLSocketImpl.a(SSLSocketImpl.java:431) at com.ibm.jsse2.SSLSocketImpl.startHandshake(SSLSocketImpl.java:315) at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:103) at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:42) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1184) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:390) at com.ibm.net.ssl.www2.protocol.https.b.getResponseCode(b.java:82) at com.paypal.core.HttpConnection.execute(HttpConnection.java:93) at com.paypal.core.APIService.makeRequestUsing(APIService.java:176) at com.paypal.core.BaseService.call(BaseService.java:265) at urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService.setExpressCheckout(PayPalAPIInterfaceServiceService.java:2196) at urn.ebay.api.PayPalAPI.PayPalAPIInterfaceServiceService.setExpressCheckout(PayPalAPIInterfaceServiceService.java:2148) I've been "googleing" a bit around and can't figure out where the error can be. We have tried to register signer the Verisign certificate retrieved from paypal site, but nothing ch…
downvote count: 0
has comment: http://stackoverflow.com/comment/43484728
favorite count: 0
has comment: http://stackoverflow.com/comment/43446556
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27512096
has comment: http://stackoverflow.com/comment/43448432
has comment: http://stackoverflow.com/comment/43512981
has title: SSL handshake_failure on Websphere 8.5 (working on Tomcat)
tagged with: java
has answer: http://stackoverflow.com/a/27541843
type: Question
has comment: http://stackoverflow.com/comment/43442717
has comment: http://stackoverflow.com/comment/43448992
has comment: http://stackoverflow.com/comment/82149966
upvote count: 5
tagged with: ssl
has comment: http://stackoverflow.com/comment/82221521

http://stackoverflow.com/q/27565208
has answer: http://stackoverflow.com/a/27655595
has body: I have a widget that have only one button.. I read that the Listener should be set like this : RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); views.setOnClickPendingIntent(R.id.button1, pendingIntent); But I have this code : try { sr = SpeechRecognizer .createSpeechRecognizer(context); sr.setRecognitionListener(new MainActivity().new listener()); Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, "voice.recognition.test"); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 5); sr.startListening(intent); } catch (Exception e) { Toast.makeText(context, "Exc: " + e, Toast.LENGTH_LONG).show(); } that should be the onClick event.. I can't make that a pending intent.. Any Idea ? :)
tagged with: onclick
tagged with: widget
tagged with: java
has title: Set onClickListener to a button in widget
type: Question
linked to: http://stackoverflow.com/q/2748590
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/2748590

http://stackoverflow.com/q/27549671
has comment: http://stackoverflow.com/comment/43525764
upvote count: 12
tagged with: java
has comment: http://stackoverflow.com/comment/43525772
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43526195
tagged with: deadlock
has title: How to diagnose or detect deadlocks in Java static initializers
has body: (Whether using static initializers in Java is a good idea is out of scope for this question.) I am encountering deadlocks in my Scala application, which I think are caused by interlocking static initializers in the compiled classes. My question is how to detect and diagnose these deadlocks -- I have found that the normal JVM tools for deadlocks do not seem to work when static initializer blocks are involved. Here is a simple example Java app which deadlocks in a static initializer: public class StaticDeadlockExample implements Runnable { static { Thread thread = new Thread( new StaticDeadlockExample(), "StaticDeadlockExample child thread"); thread.start(); try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { System.out.println("in main"); } public static void sayHello() { System.out.println("hello from thread " + Thread.currentThread().getName()); } @Override public void run() { StaticDeadlockExample.sayHello(); } } If you launch this app, it deadlocks. The stack trace at time of deadlock (from jstack) contains the following two deadlocked threads: "StaticDeadlockExample child thread" prio=6 tid=0x000000006c86a000 nid=0x4f54 in Object.wait() [0x000000006d38f000] java.lang.Thread.State: RUNNABLE at StaticDeadlockExample.run(StaticDeadlockExample.java:37) at java.lang.Thread.run(Thread.java:619) Locked ownable synchronizers: - None "main" prio=6 tid=0x00000000005db000 nid=0x2fbc in Object.wait() [0x000000000254e000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x000000004a6a7870&gt; (a java.lang.Thread) at java.lang.Thread.join(Thread.java:1143) - locked &lt;0x000000004a6a7870&gt; (a java.lang.Thread) at java.lang.Thread.join(Thread.java:1196) at StaticDeadlockExample.&lt;clinit&gt;(StaticDeadlockExample.java:17) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.intellij.rt.execution.application…
downvote count: 0
has comment: http://stackoverflow.com/comment/43526234
favorite count: 0
linked to: http://stackoverflow.com/q/15176199
type: Question
has comment: http://stackoverflow.com/comment/43527176
score: 12
tagged with: scala
answer count: 2
has answer: http://stackoverflow.com/a/27555761
has answer: http://stackoverflow.com/a/40587594
has comment: http://stackoverflow.com/comment/43526151

http://stackoverflow.com/a/27490345
score: 1
has body: There is no way it can show a check mark beside each row, as there is no check mark in your row layout :-) If you want check marks you have to use a basic layout like android.R.layout.simple_list_item_multiple_choice and sacrifice images, or if you want a custom layout with check marks YOU have to put a check mark in row layout and implement Checkable for items. Take a look here: how to set choice mode single for listview with images Hope it helps.
answers question: http://stackoverflow.com/q/27489452
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27489452

http://stackoverflow.com/q/27620772
tagged with: java
has comment: http://stackoverflow.com/comment/43690023
has comment: http://stackoverflow.com/comment/43692289
type: Question
downvote count: 0
answer count: 1
has body: I am trying to perform batch operation on couchbase using the java client. The version I use is 1.4.6 (latest I hope). The problem is that both client.getBulk() and async get produce timeout exception - even setting the timeout doesnt seem to help. see code below. for (int i = 0; i &lt; keys.length; i++) { gets.add(client.asyncGet(keys[i])); } for (GetFuture future : gets) { results.add(future.get(1, TimeUnit.SECONDS).toString()); } Any idea why do I get this exception and how can I fix it? Exception : java.util.concurrent.ExecutionException: net.spy.memcached.internal.CheckedOperationTimeoutException: Operation timed out. - failing node: ip-172-31-44-108.ec2.internal/172.31.44.108:11210 at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:180) at net.spy.memcached.internal.GetFuture.get(GetFuture.java:69)
favorite count: 0
has answer: http://stackoverflow.com/a/55751232
type: UnansweredQuestion
tagged with: couchbase
has title: Couchbase async get or multi get
score: 3
upvote count: 3

http://stackoverflow.com/q/27558427
type: Question
accepted answer: http://stackoverflow.com/a/27558444
has comment: http://stackoverflow.com/comment/43543077
has answer: http://stackoverflow.com/a/27558448
answer count: 3
upvote count: 0
has title: Proper way to extend multiple classes
possible better answer: http://stackoverflow.com/a/27558440
favorite count: 0
has answer: http://stackoverflow.com/a/27558440
score: -3
has body: So I am making a java program that reads in a bunch of information from a JSON. By the end of it I will have like 80+ methods. I want know how to go about making a single class that can call all 80+ methods, without having to put all the methods in a single place. The ideal solution for me would be public class Item extends ItemStats, ItemPrice, ItemEffects, ItemImage, ItemTree { ... } I know that this is not possible, so I was wondering the proper way to go about this problem?
has answer: http://stackoverflow.com/a/27558444
type: AnsweredQuestion
tagged with: java
downvote count: 3

http://stackoverflow.com/q/27621931
has title: set value in java attribbute
type: Question
has comment: http://stackoverflow.com/comment/43664939
has comment: http://stackoverflow.com/comment/43664517
tagged with: setattribute
score: 0
has comment: http://stackoverflow.com/comment/43664481
has body: I am displaying certain application in the button , and each application on section show certain other option , but on choosing the final option .the previous one is being made null For Example AppName = Test and then when it open , another variable DBName = test1, the value of AppName is null. &lt;/head&gt; &lt;form method="get"&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;% String s_userName = "admin"; String s_password = "password"; String S_olapSvrName =""; String s_provider = "http://xxxx.xxxx.xxxx"; final int FAILURE_CODE = 1; int statusCode = 0; IEssbase ess = null; IEssOlapServer olapSvr = null; IEssIterator ListCubeVar = null; String VarAppDBName = null; String VarAppName = request.getParameter("AppName"); //String VarAppDBName = request.getParameter("DBName"); //int NumDb1 = 0; //int NumDb1 = olapSvr.getApplication(VarAppName).getCountCubes(); if((VarAppName == null)&amp;&amp;(VarAppDBName == null)) { VarAppName ="Sample"; VarAppDBName = "Basic"; } else if (VarAppName!=null) { session.setAttribute(VarAppName,request.getParameter("AppName")); //session.setAttribute(VarAppDBName,request.getParameter("DBName")); } S_olapSvrName ="xxx.xxx.xxx"; ess = IEssbase.Home.create(IEssbase.JAPI_VERSION); IEssDomain dom = ess.signOn(s_userName, s_password, false, null, s_provider); olapSvr = (IEssOlapServer)dom.getOlapServer(S_olapSvrName); olapSvr.connect(); ListCubeVar = olapSvr.getApplications(); IEssCube ListDBVar; %&gt; &lt;% int NumDb = olapSvr.getApplication(VarAppName).getCountCubes(); session.setAttribute(VarAppName,request.getAttribute("AppName")); for(int k =0; k&lt;NumDb;k++) {%&gt; &lt;input type ="submit" name ="DBName" value =" &lt; &lt;%=olapSvr.getApplication(VarAppName).getCubes().getAt(k)%&gt;" size ="10"/&gt; &lt;%} // session.getValue("AppName"); //session.getValue("DBName"); session.setAttribute("DBName",request.getParameter("DBName")); %&gt; &lt;% int NumApp = ListCubeVar.getCount(); for(int i = 0; i&lt;NumApp;i++) {%&gt; &lt;input type="submit" n…
has comment: http://stackoverflow.com/comment/43664623
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43664323
tagged with: java

http://stackoverflow.com/q/27569955
score: 0
linked to: http://stackoverflow.com/q/27410048
has body: Following the answer on my previous question (Add a new data type to Pentaho Kettle), I added a plugin with a custom datatype. Now I have a step where I need to access this custom data type from ValueMeta as in ValueMeta.TYPE_CUSTOMTYPE for the getFields() method. I can't get that to work. Your ideas would be appreciated. PS: I cannot have the code for the custom DT in the step code as the same DT would be used by several steps. Thanks.
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27571016
tagged with: pentaho
has title: Access added Kettle data type from the source of a step
accepted answer: http://stackoverflow.com/a/27571016
answer count: 1
tagged with: kettle

http://stackoverflow.com/comment/43680544
comment on: http://stackoverflow.com/q/27629976
type: Comment
score: 0
has text: Doesn't look like Java to me. Did you mean to tag this under C/C++?
type: QuestionComment

http://stackoverflow.com/comment/43503896
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27494779
type: Comment
has text: Alternatively it could solely be a URI and not point to anything when dereferenced. Much like (dare I say) an XML namespace.

http://stackoverflow.com/a/27533410
score: 1
has comment: http://stackoverflow.com/comment/43495360
downvote count: 0
has body: Change the calls from Scanner.nextInt() to Scanner.nextDouble() like double x1 = keyboard.nextDouble(); an int is not a floating point number.
has comment: http://stackoverflow.com/comment/43495426
has comment: http://stackoverflow.com/comment/43496049
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27533382
answers question: http://stackoverflow.com/q/27533382
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43629526
type: QuestionComment
score: 1
has text: have you tried `@DateTimeFormat(pattern = "MM/yy") `
comment on: http://stackoverflow.com/q/27603625
type: Comment

http://stackoverflow.com/q/27549019
has comment: http://stackoverflow.com/comment/43524659
type: Question
has comment: http://stackoverflow.com/comment/43525038
downvote count: 0
tagged with: watermark
tagged with: android
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I need to apply a watermark to a picture after it's been cropped, but something has gone wrong. My app takes a picture from the camera, launches a try to crop it and then applies a watermark. This is how I save the picture after having taken it from the camera (not cropped.) Uri uriSavedImage = null; if (front) { DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date date = new Date(); directory_path = date.toString(); directory = new File(Environment.getExternalStorageDirectory(), directory_path); if (!directory.exists()) { directory.mkdirs(); } uriSavedImage = Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/"+ directory_path + "/front.jpg")); OutputStream imageFileOS; try { imageFileOS = getContentResolver().openOutputStream( uriSavedImage); imageFileOS.write(current_pics); imageFileOS.flush(); imageFileOS.close(); runCropImage(uriSavedImage); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } This is the attempt to crop the image: private void runCropImage(Uri pic_uri) { Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.setDataAndType(pic_uri, "image/*"); cropIntent.putExtra("crop", "true"); cropIntent.putExtra("aspectX", 1); cropIntent.putExtra("aspectY", 1); cropIntent.putExtra("outputX", 4800); cropIntent.putExtra("outputY", 4800); cropIntent.putExtra("return-data", true); startActivityForResult(cropIntent, 2); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 2) { if (data != null) { String cropImagePath = null; Bundle extras = data.getExtras(); Bitmap bitmap = (Bitmap) extras.get("data"); cropImagePath = Environment.getExternalStorageDirectory() + "/" + directory_path + "/front.jpg"; FileOutputStream out = null; try { out = new FileOutputStream(cropImagePath); bitmap.c…
answer count: 0
has title: Crop image and watermark it
score: 1
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/43524447

http://stackoverflow.com/q/27536907
tagged with: image
score: 0
has title: hiding and showing images with setVisible method
answer count: 1
has answer: http://stackoverflow.com/a/27536963
accepted answer: http://stackoverflow.com/a/27536963
tagged with: jlabel
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: I wrote a class that uses buttons to play radio stations broadcast to the internet. When the buttons are pressed, I also wanted to have a series of images in the Frame selectively hidden and shown. I am trying to do this by adding Images, setting "setVisible(false);" and then overriding the setVisible method when the button is clicked. It isn't viable in it's current state. Is there a way to do this? I'm pretty new to writing code. public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); String text = button.getText(); JLabel img = new JLabel(new ImageIcon("resources/1920.png")); img.setBounds(642, 230, 100, 100); // x, y, width, height add(img); img.setVisible(false); if (text.equals("1920a")) { try { getMediaPlayer().setURI(mediaPaths[0]); img.setVisible(true); } catch (URISyntaxException e1) { e1.printStackTrace(); }
type: Question
has comment: http://stackoverflow.com/comment/43502207

http://stackoverflow.com/comment/43666560
type: Comment
comment on: http://stackoverflow.com/q/27620471
type: QuestionComment
score: 0
has text: @OllieJones this has absolutely nothing to do with the error message.

hadoop
tags question: http://stackoverflow.com/q/27579686
tags question: http://stackoverflow.com/q/27528394
tags question: http://stackoverflow.com/q/27514421
tags question: http://stackoverflow.com/q/27631277
tag name: hadoop
tags question: http://stackoverflow.com/q/27549070
tags question: http://stackoverflow.com/q/27550581
tags question: http://stackoverflow.com/q/27510455
tags question: http://stackoverflow.com/q/27509253
tags question: http://stackoverflow.com/q/27606807
type: Tag
tags question: http://stackoverflow.com/q/27528275
tags question: http://stackoverflow.com/q/27483004
tags question: http://stackoverflow.com/q/27524788
tags question: http://stackoverflow.com/q/27539923
tags question: http://stackoverflow.com/q/27602013
tags question: http://stackoverflow.com/q/27509247
tags question: http://stackoverflow.com/q/27554480
tags question: http://stackoverflow.com/q/27481362
tags question: http://stackoverflow.com/q/27535909
tags question: http://stackoverflow.com/q/27614723
tags question: http://stackoverflow.com/q/27545605
tags question: http://stackoverflow.com/q/27482037
tags question: http://stackoverflow.com/q/27613704
tags question: http://stackoverflow.com/q/27522775
tags question: http://stackoverflow.com/q/27634094
tags question: http://stackoverflow.com/q/27536553
tags question: http://stackoverflow.com/q/27610037
tags question: http://stackoverflow.com/q/27632543
tags question: http://stackoverflow.com/q/27570689
tags question: http://stackoverflow.com/q/27604267

http://stackoverflow.com/a/79237250
has body: // private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); private static final ThreadLocal<SimpleDateFormat> dateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd")); ... System.out.println(dateFormat.get().format(new Date()));
answers question: http://stackoverflow.com/q/27529616
score: 0
type: Answer

http://stackoverflow.com/comment/43529307
comment on: http://stackoverflow.com/q/27548781
score: 0
has text: that won't part of your requirement ...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27510881
tagged with: android-manifest
accepted answer: http://stackoverflow.com/a/27513321
type: AnsweredQuestion
has body: I want to use a custom Theme and I want to use the Holo.Light Theme. But I always get the error: Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features Currently I'm trying this: styles.xml AndroidManifest.xml: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> It has problems with the: parent="android:style/Theme.Holo.Light" in the styles.xml, because if I change it to: parent="android:style/Theme" then it works... Any advice?
upvote count: 3
tagged with: java
type: Question
downvote count: 0
has title: How to use two Themes?
has answer: http://stackoverflow.com/a/27513321
tagged with: themes
score: 3
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: android

http://stackoverflow.com/a/60510129
answers question: http://stackoverflow.com/q/27547171
type: Answer
downvote count: 0
score: 20
has body: @RequiredArgsConstructor and @NonNull are two important keys to solve the problem above. Because @RequiredArgsConstructor creates a constructor with fields which are annotated by @NonNull annotation. @RequiredArgsConstructor class MyClass { @NonNull private String param; private Integer count; } This is equivalent to: class MyClass { private String param; private Integer count; public MyClass(String param) { this.param = param; } }
upvote count: 20

http://stackoverflow.com/comment/43434410
type: QuestionComment
comment on: http://stackoverflow.com/q/27502059
has text: What is your errors ?
score: 0
type: Comment

http://stackoverflow.com/q/27474984
tagged with: email
score: 1
has comment: http://stackoverflow.com/comment/43393912
favorite count: 0
upvote count: 1
tagged with: java
has title: CommonDataKinds.Email.ADDRESS giving PhoneNumber?
has body: Just wondering why I get phone numbers instead of emails when I execute this code? Is there a way around this? Cursor infoEmail = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, null, null, null); while (infoEmail.moveToNext()) { String email = infoEmail.getString(infoEmail.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS)); contacts.AddEmail(email); }
answer count: 0
downvote count: 0
type: UnansweredQuestion
type: Question
tagged with: android

http://stackoverflow.com/comment/43610092
score: 0
comment on: http://stackoverflow.com/a/27593140
type: Comment
has text: @SanPonko Don't know. What does the documentation say?
type: AnswerComment

http://stackoverflow.com/a/28045443
has body: The solution: It is settable in context file: The "jmsConfig bean ""diasbleReplayTo" property solve the problem.
downvote count: 0
score: 2
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27582010
accepted answer of: http://stackoverflow.com/q/27582010
type: Answer

http://stackoverflow.com/q/27533115
tagged with: batch-file
has answer: http://stackoverflow.com/a/27533442
has title: Run 30 jar from batch and save the output result for each jar
has body: Hi i have a question about running several jar files in the same folder by batch file. I need to create a loop and read all the jar files name, and run them all, and create output for all jars. like this code: cls cd\ cd C:\java\ set PATH=%PATH%;C:\Program Files\Java\jdk1.8.0_20\bin; cls javac -jar "here come the name from the folder" jarname &lt; input1+"the name of the jar".txt &gt; output1+"the name of the jar".txt
answer count: 1
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/43495184
has comment: http://stackoverflow.com/comment/43513311
accepted answer: http://stackoverflow.com/a/27533442
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43494991
score: 0

http://stackoverflow.com/q/27639106
type: UnansweredQuestion
tagged with: path
upvote count: 1
score: 1
tagged with: java
tagged with: file
type: Question
tagged with: filesystems
has body: I am going through java doc for Files class and copyOption enumeration. I did trail error by writing small java code on windows and understood the copy method usage in partial. What I don't understand is the copyOption attribute "COPY_ATTRIBUTES" : it says "The exact file attributes that are copied is platform and file system dependent and therefore unspecified." what is it mean? Just for your reference see below. Taken from oracle java ; copy(Path source, Path target, CopyOption... options) I have used copyOption "COPY_ATTRIBUTES" COPY_ATTRIBUTES: Attempts to copy the file attributes associated with this file to the target file. The exact file attributes that are copied is platform and file system dependent and therefore unspecified. Minimally, the last-modified-time is copied to the target file if supported by both the source and target file store. Copying of file timestamps may result in precision loss.
downvote count: 0
has comment: http://stackoverflow.com/comment/43697458
tagged with: copy
favorite count: 0
has title: what is meant by " exact file attributes that are copied is platform and file system dependent " in Files.Copy() method?
has comment: http://stackoverflow.com/comment/43697103
answer count: 0

http://stackoverflow.com/q/27508190
has title: CloudFront distribution id
has body: I want to invalidate files on Amazon after I've put them. But I' confused with the DistributionID: private AmazonS3 s3; private AmazonCloudFront cloudFront; ... AWSCredentials cred = new PropertiesCredentials( AmazonWorker.class.getResourceAsStream("AwsCredentials.properties")); s3 = new AmazonS3Client(cred); cloudFront = new AmazonCloudFrontClient(cred); ... PutObjectResult por = s3.putObject(new PutObjectRequest(bucketName, path, is, metadata)); List&lt;String&gt; list = new ArrayList&lt;String&gt;() {}; list.add(bucketName + "/" + path); CreateInvalidationResult res = cloudFront.createInvalidation ( new CreateInvalidationRequest ( "DistributionId", new InvalidationBatch ( list, UUID.randomUUID().toString() ) ) ); So, where could I get "DistributionId"?
score: 4
tagged with: amazon-s3
tagged with: java
type: Question
upvote count: 4
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27517862
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27631280
answer count: 1
downvote count: 0
tagged with: hashset
favorite count: 0
tagged with: arraylist
tagged with: android
has comment: http://stackoverflow.com/comment/43683122
has comment: http://stackoverflow.com/comment/43683408
has comment: http://stackoverflow.com/comment/43683325
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/27631364
type: AnsweredQuestion
has body: I need to store an ArrayList of type "Comment" in my SharedPreferences. This is my model class: public class Comment { public String getPID() { return PID; } public void setPID(String pID) { PID = pID; } public String PID; public String Comment; public String Commenter; public String Date; public String getComment() { return Comment; } public void setComment(String comment) { Comment = comment; } public String getCommenter() { return Commenter; } public void setCommenter(String commenter) { Commenter = commenter; } public String getDate() { return Date; } public void setDate(String date) { Date = date; } } So my ArrayList contains 2 Comments that need to be stored in SharedPreferences. I tried HashSet but it requires String values: ArrayList&lt;Comment_FB&gt; fb = getFeedback(); //my Comments List SharedPreferences pref = getApplicationContext().getSharedPreferences("CurrentProduct", 0); Editor editor = pref.edit(); Set&lt;String&gt; set = new HashSet&lt;String&gt;(); set.addAll(fb); editor.putStringSet("key", set); editor.commit(); How do I get this done folks? :)
tagged with: java
has title: Android: Storing ArrayList<T> in SharedPreferences?
tagged with: sharedpreferences
type: Question
accepted answer: http://stackoverflow.com/a/27631364

http://stackoverflow.com/a/27518196
has body: Some applicationContext can refresh times, but not AnnotationConfigApplicationContext. when you construct AnnotationConfigApplicationContext, which had run the refresh method, so it will be reported exception, you can destroy it first, and then refresh
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27499942

http://stackoverflow.com/q/27530102
tagged with: bouncycastle
type: UnansweredQuestion
has title: Unable to decrypt AES algorithm encrypted key in Spring MVC - error - bad arguments exception
tagged with: spring-mvc
tagged with: aes
has body: I am passing one encrypted key as URL argument and after receiving the key, I am trying to decrypt the key but getting bad arguments exception at a particular portion of the code. I am not understanding where is the issue and how to resolve it. Hereby requesting you to help me on this. I have mentioned the code line where i am getting the error in the console part below. Source(A legacy java application where generating the encrypted key): StrongAES strong_AES = new StrongAES(); id = strong_AES.encrypt_Data(user_string_2bEncrypted); c = strong_AES.count_Cipher(); &lt;a href="url/id=&lt;%=id%&gt;&amp;c=&lt;%=c%&gt;"&gt; StrongAES Class public class StrongAES { byte[] input; byte[] cipher_Text; SecretKeySpec Key; int ctLength; public byte[] encrypt_Data(String data){ Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] input = data.getBytes(); this.input = input; byte[] keyBytes = new byte[] {'T', 'h', 'i', 's', 'I', 's', 'A', 'S', 'e', 'c', 'r', 'e', 't', 'K', 'e', 'y'}; SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); this.Key = key; byte[] cipherText = null; Cipher cipher; try { cipher = Cipher.getInstance("AES/ECB/PKCS7Padding", "BC"); cipher.init(Cipher.ENCRYPT_MODE, key); cipherText = new byte[cipher.getOutputSize(input.length)]; int ctLength = cipher.update(input, 0, input.length, cipherText, 0); ctLength += cipher.doFinal(cipherText, ctLength); this.cipher_Text = cipherText; this.ctLength = ctLength; .... .... return cipherText; } public int count_Cipher(){ return this.ctLength; } Destination(An application written in Spring MVC): HomeController.java @RequestMapping(value = "/id={id}", method = RequestMethod.GET) public String getMethod(@PathVariable(value = "id") String id ,@RequestParam int c ,ModelMap model, HttpServletRequest request){ System.out.println("key value is : "+id); System.out.println("lenth is :"+c); StrongAES strong_AES = new StrongAES(); String login = null; try { login = strong_AES.decrypt_Data(id.get…
tagged with: java
has comment: http://stackoverflow.com/comment/43570917
type: Question
linked to: http://stackoverflow.com/q/6360207
tagged with: security
score: 0
has answer: http://stackoverflow.com/a/27572759
linked to: http://stackoverflow.com/q/27549051
answer count: 1

http://stackoverflow.com/comment/121599862
score: 2
has text: Reinstalling windows is too inappropriate an answer, let alone the right answer.
comment on: http://stackoverflow.com/a/27666759
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43567568
type: AnswerComment
has text: I guess you could just use `HttpURLConnection urlConnection = (HttpURLConnection) (new URL("http://www.rgbpallete.in/led/api/signup").openConnection());`
type: Comment
comment on: http://stackoverflow.com/a/27570408
score: 0

http://stackoverflow.com/q/27570885
has body: I've written a utility in Java that filters JSON input, from a file or from stdin, to XML. Though I've made it a stand-alone, runnable JAR, I'm lost as to how to redirect input to it via stdin. For example: cat sample.json | java -jar ./target/json-to-xml-1.0.0.jar This command line doesn't work; I wonder if this can even be done. private static String readContentFromStdIn() throws IOException { char ch; StringBuilder sb = new StringBuilder(); PipedInputStream input = new PipedInputStream(); while( ( ch = ( char ) input.read() ) != -1 ) sb.append( ch ); input.close(); return sb.toString(); }
has title: Reaching Java application through stdin from command line
answer count: 1
downvote count: 0
favorite count: 0
tagged with: command-line
has comment: http://stackoverflow.com/comment/43567521
has comment: http://stackoverflow.com/comment/43567403
has answer: http://stackoverflow.com/a/27571454
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27571454

http://stackoverflow.com/q/27592253
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/27592307
type: Question
score: 3
has title: How to create a web-project with gradle?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27592307
favorite count: 0
tagged with: maven
has body: We can create an empty web-project with maven just generate it from the archetype like mvn archetype:generate -DgroupId=com.mkyong -DartifactId=CounterWebApp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false Is there something similat in gradle? I know we can create gradle build script and apply plugin: 'war' but that's not exactly what I'm looking for.
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/q/27529563
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: annotations
type: Question
linked to: http://stackoverflow.com/q/9403917
tagged with: auto-value
has answer: http://stackoverflow.com/a/27789699
answer count: 1
downvote count: 0
has body: I am getting "cannot find symbol class Generated" while using the @AutoValue annotation. public abstract class Office{ public static Office create(String cityName, String companyName, String regionName) { return new AutoValue_Office(cityName, companyName, regionName); } public abstract String getCompanyName(); public abstract String getCityName(); public abstract String getRegionName(); } Gradle dependency compile 'com.google.auto.value:auto-value:1.0-rc1' Also, how can add only selected properties to equals and hashcode function.
has title: @AutoValue - "cannot find symbol class Generated" Error
favorite count: 0
upvote count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/27789699

http://stackoverflow.com/q/27534697
favorite count: 0
has comment: http://stackoverflow.com/comment/43498525
has comment: http://stackoverflow.com/comment/43499191
has comment: http://stackoverflow.com/comment/43499574
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43498457
type: Question
has comment: http://stackoverflow.com/comment/43499373
tagged with: guava
tagged with: java
has body: I'm using the Guava LoadingCache to store results from database queries. However, despite not setting an eviction policy, doing a get on the cache through getFromCache() results in my debug point in the CacheLoader load() method being hit every time, therefore also resulting a debug point in the database query method getKeyFromDatabase() being hit every time. Here is my code: private final LoadingCache&lt;String, QueryResult&gt; cache; public MyDao() { cache = CacheBuilder.newBuilder() .maximumSize(40) .build(new CacheLoader&lt;String, QueryResult&gt;() { @Override public QueryResult load(String key) throws DatabaseException { return getKeyFromDatabase(key); } }); } public QueryResult getFromCache(String key) throws DatabaseException { try { return cache.get(key); } catch (ExecutionException e) { throw new DatabaseException(e); } } private QueryResult getKeyFromDatabase(String key) throws DatabaseException { try { ... return new QueryResult(); } catch (SQLException e) { throw new DatabaseException(e); } } Am I missing something obvious here?
score: 4
has title: Guava LoadingCache loads new value everytime for same key
tagged with: caching
upvote count: 4
has comment: http://stackoverflow.com/comment/43498494
has answer: http://stackoverflow.com/a/27536407
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43500132

http://stackoverflow.com/q/27499800
score: 11
tagged with: jsr356
downvote count: 0
tagged with: java
type: Question
has title: Tomcat8 WebSockets (JSR-356) with Guice 3.0
tagged with: guice
tagged with: websocket
upvote count: 11
answer count: 3
has answer: http://stackoverflow.com/a/32053412
has answer: http://stackoverflow.com/a/76939537
has body: I am trying to @Inject a Guice service into a @ServerEndpoint. I am using Tomcat 8.0.15 as the JSR-356 implementation. However, the dependency injection isn't working. Is there any additional configuration that needs to be done in order to enable Guice injection? Note that I am using all standard javax annotations only.
tagged with: tomcat8
favorite count: 0
has comment: http://stackoverflow.com/comment/43458798
has answer: http://stackoverflow.com/a/28031697
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43455368

http://stackoverflow.com/comment/43438617
type: Comment
type: QuestionComment
score: 2
has text: There are 2 ways to initialize the `imm` in an immutable `imm2` class. 1. In the variable declaration (i.e. `private final imm value = new imm(42);`), or 2. In the `imm2` constructor you can write `value = new imm(42);`. However it's not the fact that `imm2` isn't immutable that's bothering me (or I imagine the other people reading this) - it's the fact that it begins with a lower case letter!
comment on: http://stackoverflow.com/q/27503990

recursion
type: Tag
tags question: http://stackoverflow.com/q/27485351
tags question: http://stackoverflow.com/q/27581641
tags question: http://stackoverflow.com/q/27583855
tags question: http://stackoverflow.com/q/27534092
tag name: recursion
tags question: http://stackoverflow.com/q/27580408
tags question: http://stackoverflow.com/q/27549969
tags question: http://stackoverflow.com/q/27551338
tags question: http://stackoverflow.com/q/27587394
tags question: http://stackoverflow.com/q/27595894
tags question: http://stackoverflow.com/q/27533727
tags question: http://stackoverflow.com/q/27591450
tags question: http://stackoverflow.com/q/27533774
tags question: http://stackoverflow.com/q/27486750
tags question: http://stackoverflow.com/q/27594872
tags question: http://stackoverflow.com/q/27503155
tags question: http://stackoverflow.com/q/27510891
tags question: http://stackoverflow.com/q/27517303
tags question: http://stackoverflow.com/q/27478557

http://stackoverflow.com/comment/43455650
type: Comment
comment on: http://stackoverflow.com/a/27492621
has text: Hello Jarrod, thank you for the in-depth suggestions -- updated pom posted above. Unfortunately, I still get the same issue when using the Shade plugin, the ojdbc6 driver appears in the uber jar, but is not recognized when attempting to run the program.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27559498
tagged with: logging
type: Question
has answer: http://stackoverflow.com/a/27559619
tagged with: java
has body: In C++, the file of the source code and current line number is decided by FILE and INLINE, which is decided at compiling time, is there any method in Java that could do the similar thing? The file and line number is decided at compiling time instead of runtime? this will be convenient for log. I kind of doubt that use runtime method to detect these information will decrease the performance.
linked to: http://stackoverflow.com/q/7483421
answer count: 1
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/43545219
favorite count: 0
has title: Is there any way that Java could get current file name and current line number?
has comment: http://stackoverflow.com/comment/43545537
upvote count: 6
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/43545195

http://stackoverflow.com/a/27484351
has comment: http://stackoverflow.com/comment/43400943
type: Answer
has body: You have to avoid to set String in preparedstatement. In preparedStatement , you need to set actual type. ps.setString(1, tool_code); ps.setInt(2, tool_number); ps.setInt(3, unit); ps.setString(4, part_id); like that you have to do
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27484308

http://stackoverflow.com/q/27547091
possible better answer: http://stackoverflow.com/a/61594325
answer count: 4
has answer: http://stackoverflow.com/a/28025994
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/61594325
has body: I am running an elastic search version 4.1 on windows 8. I tried to index a document through java. When running a JUNIT test the error appears as below. org.elasticsearch.action.UnavailableShardsException: [wms][3] Primary shard is not active or isn't assigned is a known node. Timeout: [1m], request: index {[wms][video][AUpdb-bMQ3rfSDgdctGY], source[{ "fleetNumber": "45", "timestamp": "1245657888", "geoTag": "73.0012312,-123.00909", "videoName": "timestamp.mjpeg", "content": "ASD123124NMMM" }]} at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.retryBecauseUnavailable(TransportShardReplicationOperationAction.java:784) at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.doStart(TransportShardReplicationOperationAction.java:402) at org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$3.onTimeout(TransportShardReplicationOperationAction.java:500) at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:239) at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:497) 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) I can not figure out, why causes this error to happen. When a delete data or index it works fine. What might be the possible cause of it.
has title: Primary shard is not active or isn't assigned is a known node ?
tagged with: java
has comment: http://stackoverflow.com/comment/43551884
downvote count: 1
upvote count: 23
type: Question
tagged with: indexing
accepted answer: http://stackoverflow.com/a/28025994
score: 22
has answer: http://stackoverflow.com/a/54031692
has answer: http://stackoverflow.com/a/41243268
has comment: http://stackoverflow.com/comment/43528556
favorite count: 0
tagged with: sharding
tagged with: elasticsearch

http://stackoverflow.com/q/27577452
possible better answer: http://stackoverflow.com/a/27582481
has answer: http://stackoverflow.com/a/27582481
has answer: http://stackoverflow.com/a/27609668
accepted answer: http://stackoverflow.com/a/27609668
has title: How can I implement ImageJ API in my Java code?
type: AnsweredQuestion
tagged with: imagej
tagged with: java
has comment: http://stackoverflow.com/comment/43641657
has comment: http://stackoverflow.com/comment/43589269
tagged with: image-processing
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43585205
score: 0
has body: I need to use ImageJ API for java, but I don't know where to look for the proper .jar . I looked here but non of those appear to be the right one to implement (they don't have the classes shown in the documentation)

http://stackoverflow.com/comment/43400120
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27483852
has text: Only Mike? No "Mike_Brown"? Oh, dear. I thought it would be more complete with the surname.

http://stackoverflow.com/a/27497123
has comment: http://stackoverflow.com/comment/43425745
has comment: http://stackoverflow.com/comment/43425680
upvote count: 0
type: AcceptedAnswer
downvote count: 2
answers question: http://stackoverflow.com/q/27497043
type: Answer
has body: Try this: String[] board = {"+-+-+-+"}; String[] board2 = {"| | | |"}; for(int x=0;x&lt;4;x++) { System.out.println(board[0]); if(x==3) break; System.out.println(board2[0]); } Try to figure out what this code is doing, and if you have any questions feel free to comment and ask me.
has comment: http://stackoverflow.com/comment/43425787
has comment: http://stackoverflow.com/comment/43425809
accepted answer of: http://stackoverflow.com/q/27497043
has comment: http://stackoverflow.com/comment/43426890
score: -2

http://stackoverflow.com/comment/43536261
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27554937
has text: What is your question? *"I'm struggling"* is very hard for anyone to answer.

http://stackoverflow.com/a/27482071
has body: Try using this Camera.Parameters parameters = camera.getParameters(); parameters.set("orientation", "portrait"); camera.setParameters(parameters);
has comment: http://stackoverflow.com/comment/43400329
has comment: http://stackoverflow.com/comment/43423999
type: Answer
answers question: http://stackoverflow.com/q/27481154
score: 0

http://stackoverflow.com/q/27616733
has comment: http://stackoverflow.com/comment/43655574
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43655178
has comment: http://stackoverflow.com/comment/43655312
score: 3
has comment: http://stackoverflow.com/comment/43655079
tagged with: java
type: Question
has body: My file unzips one folder and one file but does not unzip the rest for some reason. How can I make it so it unzips all of the zip files contents? public void unzip(String filepath, String filename, String unzip_path) throws IOException { InputStream is = new FileInputStream(filepath + filename); Log.d("1st", filepath + filename); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is)); try { ZipEntry ze; while ((ze = zis.getNextEntry()) != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; String filename_temp = ze.getName(); File fmd = new File(unzip_path + filename_temp); Log.d("2nd", unzip_path + filename_temp); if (!fmd.getParentFile().exists()) { fmd.getParentFile().mkdirs(); } FileOutputStream fout = new FileOutputStream(unzip_path + filename_temp); while ((count = zis.read(buffer)) != -1) { baos.write(buffer, 0, count); byte[] bytes = baos.toByteArray(); fout.write(bytes); baos.reset(); } fout.close(); //} } } finally { zis.close(); } }
has title: Unzip to internal storage not working completely
favorite count: 0
upvote count: 3
tagged with: android

http://stackoverflow.com/q/27510472
has comment: http://stackoverflow.com/comment/43451178
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43451172
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27510634
score: -5
has body: Is it possible to synchronize final fields in java? if so what is the use of that? Moreover how does synchronizing fields affect the program?
tagged with: java
downvote count: 5
type: Question
has title: Is it possible to synchronize final fields in java?

http://stackoverflow.com/q/27583006
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43590635
type: Question
has comment: http://stackoverflow.com/comment/43590497
accepted answer: http://stackoverflow.com/a/27583249
has body: I have a game that needs to be able to play sound. When I click on a button the sound plays, but when I click on the button again the sound doesn't play. Below is my sound class: public class Sound { public static final Sound select = new Sound("/selectBTN.wav"); public static final Sound scroll = new Sound("/btn.wav"); //Phone calls public static final Sound call1 = new Sound("/calls/call1.wav"); public static final Sound call2 = new Sound("/calls/call2.wav"); public static final Sound call3 = new Sound("/calls/call3.wav"); private Clip c; public Sound(final String filename) { try { c = AudioSystem.getClip(); final AudioInputStream inputStream AudioSystem.getAudioInputStream(Sound.class.getResourceAsStream(filename)); c.open(inputStream); c.addLineListener(new LineListener() { @Override public void update(final LineEvent event) { if (event.getType().equals(Type.STOP)) { System.out.println("Do something"); } } }); } catch (final Exception e) { e.printStackTrace(); } } public void play() { try { new Thread() { public void run() { if (!title.mute) { c.start(); } } }.start(); } catch (Exception e) { e.printStackTrace(); } } } I use this line Sound.call1.play() to play the sound. Can any one help me to fix this problem?
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43590530
favorite count: 0
has comment: http://stackoverflow.com/comment/43590715
has title: Java Sound plays once and then doesn't play again
has answer: http://stackoverflow.com/a/27583249
tagged with: audio
type: AnsweredQuestion

http://stackoverflow.com/comment/43783855
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27562858
has text: @SanBez fill color is working only when out file format is XLS. It's not working when file format is CSV. any clue about his issue?
score: 0

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

http://stackoverflow.com/q/27587226
score: 0
has answer: http://stackoverflow.com/a/27612236
accepted answer: http://stackoverflow.com/a/27612236
answer count: 2
tagged with: mq
tagged with: jms
tagged with: ibm-mq
has title: How to improve MQ client create conncetion time?
has body: I have an app on Tomcat 7.05 that connects to a remote MQ manager, everything work fine, it just that creating a connection takes an insane amount of time ~ 13 seconds (if I put both java code and MQ server on one machine, it takes less then a second). How do I improve create connection time? My java code: import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; import com.ibm.mq.constants.MQConstants; private MQldpResponse requestReply() { String messageReceive = null; MQldpResponse status = new MQldpResponse(); status.setErrorCode(0); status.setErrorDesc("Success"); if (message == null) { LDPLogger.warning("Message is null for request service " + service); } setMQVars();// Setting mq vars QueueConnection queueConnection = null; QueueSender queueSender = null; QueueReceiver queueReceiver = null; try { Context context = (Context) new InitialContext().lookup("java:comp/env"); QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) context.lookup(qcf); queueConnection = queueConnectionFactory.createQueueConnection();//This takes 13~ seconds!! queueConnection.start(); QueueSession session = queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); Queue requestQueue = session.createQueue(requestQueueName); queueSender = session.createSender(requestQueue); TextMessage requestTextMessage = session.createTextMessage(message); Queue replyQueue = session.createQueue(replyQueueName); requestTextMessage.setJMSReplyTo(replyQueue); requestTextMessage.setIntProperty("JMS_IBM_MsgType", MQConstants.MQMT_REQUEST); queueSender.send(requestTextMessage, deliveryMode, Message.DEFAULT_PRIORITY, expiration); String me…
possible better answer: http://stackoverflow.com/a/27595765
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27595765

http://stackoverflow.com/comment/44519685
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27600182
score: 0
has text: Oracle issued a patch to fix the issue.

http://stackoverflow.com/a/27588873
has body: You could write a custom detector in FindBug and integrate it with your build. I found a link to write custom detector in FindBug
type: Answer
answers question: http://stackoverflow.com/q/27588764
score: 0

http://stackoverflow.com/q/27618082
accepted answer: http://stackoverflow.com/a/27618124
upvote count: 2
answer count: 5
has body: Given the following classes, I'm deciding on creating child classes based on an if/else statement, is this the right approach? Also, is it correct to declare a method that returns Parent and then return a child? (see someMethod). It doesn't seem right, is there a better way to do this? public class Parent { int someInt; } public class Child1 extends Parent { int id1; String field1; } public class Child2 extends Parent { int id2; String field2; } The classes are used in the following way: public class SomeClass { public Parent someMethod(int option) { Parent object = null; if (option == 1) { object = new Child1(); // set Child1 fields return object; } else { object = new Child2(); // set Child2 fields return object; } } }
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27618189
tagged with: java
possible better answer: http://stackoverflow.com/a/27618162
has answer: http://stackoverflow.com/a/27618162
type: Question
has answer: http://stackoverflow.com/a/27618151
has answer: http://stackoverflow.com/a/27618124
has answer: http://stackoverflow.com/a/27618400
downvote count: 0
has title: Returning Java child in a method
favorite count: 0

http://stackoverflow.com/comment/43636388
comment on: http://stackoverflow.com/q/27602318
score: 0
has text: Your config shows `MyManagerFactoryBean` but the class name is `MyEntityManagerFactoryBean`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27620883
has title: Spring Form (with file field) validation
has comment: http://stackoverflow.com/comment/43666917
has comment: http://stackoverflow.com/comment/43668348
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43667335
tagged with: spring
tagged with: java
has body: I try to validate form that looks like: My controller: @RequestMapping(value = { "/new", "/{id}/update" }, method = RequestMethod.POST) public String processForm(Model model, @Valid @ModelAttribute EventFormDto eventForm, BindingResult validationResult) { ... And data class: //@ImageOrImageFileName(image = "image", imageFileName = "imageFileName") public class EventFormDto { @NotEmpty(message="{valid.notempty}") private String title; @NotEmpty(message="{valid.notempty}") private String detail; @ImageFile private MultipartFile image; //private String imageFileName; @NotNull(message="{valid.notempty}") @DateTimeFormat(pattern="dd/MM/YYYY HH:mm") private DateTime startDate; ... } And my problem in case when image field pass validation but any other field has validation error. On the server side is already possible to save the image so as not to send it again. Ant at data class probably I ned new field called imageFileName. So image validation should see at both image and image-name fields. Can someone show me how to write validation for this case.
tagged with: forms
tagged with: image
has comment: http://stackoverflow.com/comment/43668254
type: Question
has comment: http://stackoverflow.com/comment/43662705
tagged with: validation
score: 0

http://stackoverflow.com/a/27542882
answers question: http://stackoverflow.com/q/27542808
accepted answer of: http://stackoverflow.com/q/27542808
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Could it get stuck forever in the while that checks for a new line from socket? Yes, if there's no more data. But I suspect that's not the problem. I suspect the problem is this: Looper.loop(); As far as I can see, you don't need to use Looper at all here. Assuming you're really on a dedicated thread, what messages do you expect to process? With nothing calling Looper.quit(), the Looper.loop() call will block forever, I suspect. Just get rid of the two Looper calls and I suspect you'll be able to see all the messages. EDIT: However, you'll need to show the toast on the UI thread - see this SO question for details of that, using Activity.runOnUiThread. I'm not sure that showing a toast on every message is an ideal UI, mind you... You'll also want to get rid of the while (true) - you're already looping on the inner loop, so that's fine.
has comment: http://stackoverflow.com/comment/43512878
score: 1
has comment: http://stackoverflow.com/comment/43513079
upvote count: 1

http://stackoverflow.com/a/27540530
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/27540442
downvote count: 1
has body: You can just call: Runtime.getRuntime().exec(command);
has comment: http://stackoverflow.com/comment/43508780
has comment: http://stackoverflow.com/comment/43508615
has comment: http://stackoverflow.com/comment/43508855
type: Answer
has comment: http://stackoverflow.com/comment/43508676
has comment: http://stackoverflow.com/comment/43508913

http://stackoverflow.com/comment/43624959
type: Comment
comment on: http://stackoverflow.com/q/27600915
score: 0
type: QuestionComment
has text: Have you checked my answer?

http://stackoverflow.com/a/27477177
downvote count: 0
has comment: http://stackoverflow.com/comment/43426163
has body: Move initialization of list outside the loop. Currently, you are creating list object everytime in loop. Hence losing the reference to existing one. public ArrayList&lt;Game&gt; ajoutadd() { int i=0; boolean boucle=true; ArrayList&lt;Game&gt; thegame = new ArrayList&lt;Game&gt;(); while(i!=2){ Scanner thegame = new Scanner(System.in); System.out.print("name: \n"); String jname = lejeu.nextLine(); System.out.print(jname); Scanner qty = new Scanner(System.in); System.out.print("qty \n"); int jqty = qty.nextInt(); Scanner cat = new Scanner(System.in); System.out.print("cat: \n"); String categ = cat.nextLine(); Scanner price = new Scanner(System.in); System.out.print("price: \n"); int jprice = price.nextInt(); Game agame = new Game(jname,jqty,categ,jprice); System.out.print(unjeu.Nom); //creating the array to contain the game(s) thegame.add(new Game(jname,jqty,categ,jprice)); each time after the loop i++; } System.out.println(thegame); return thegame; }
has comment: http://stackoverflow.com/comment/43391022
type: Answer
has comment: http://stackoverflow.com/comment/43389171
has comment: http://stackoverflow.com/comment/43449230
has comment: http://stackoverflow.com/comment/43426024
upvote count: 1
answers question: http://stackoverflow.com/q/27477145
has comment: http://stackoverflow.com/comment/43416148
score: 1

http://stackoverflow.com/a/27571071
has body: I see two issues with the snippet you posted. The first one you are using the outer iterator also int inner loop while (teamIterator.hasNext()) { WhizzyTeam team = teamIterator.next(); // EXCEPTION HERE Iterator&lt;Route&gt; routeIterator = team.routes.iterator(); while (teamIterator.hasNext()) { I do think you should use routeIterator, in place of teamIterator in the second loop. Second you are not using the remove method from the Iterator interface to remove the item from your collection. From the doc The iterators returned by this class's iterator and listIterator methods are fail-fast: if the list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27570583
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27570583

http://stackoverflow.com/comment/47711551
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28696628
has text: Then it looks like a classpath problem, you could examine the jar contents and see if sample.fxml is in it?

http://stackoverflow.com/comment/47406449
score: 0
has text: I found out something different. It may have something to do with the system.properties that Java checks when loading a Clip. See this thread for further information:[link](http://stackoverflow.com/questions/26435282/issue-playing-audio-with-stackoverflows-javasound-tag-example/29631885#29631885).
type: Comment
comment on: http://stackoverflow.com/a/29625833
type: AnswerComment

http://stackoverflow.com/a/27628123
score: 1
answers question: http://stackoverflow.com/q/27628045
has body: You cannot restart a thread once you have stopped it. But what you can do is instantiate a new TimerThread and start it again! Like TimerThread newThread = new TimerThread(); newThread.start();
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43450184
comment on: http://stackoverflow.com/q/27509855
type: Comment
type: QuestionComment
has text: 2^0 == 1 so all numbers are a sum of 2^x, otherwise binary numbers wouldn't work.
score: 0

http://stackoverflow.com/q/27522141
tagged with: apache-poi
tagged with: java
type: Question
has title: How to hide different columns in different sheets of Excel using jXLS library to generate excel reports
score: 0
has answer: http://stackoverflow.com/a/27570201
answer count: 1
tagged with: jxls
has body: I am using jXLS library to generate excel reports. I am using a generic template for all the reports and the column headers are populated from query result set metadata. My generic template would contain 50 columns and if the result set has only 20 columns all other would be hidden. I can achieve this easily if its single worksheet in an excel by using xlsTransformer.setColumnsToHide() method. The problem I am facing is my report can have multiple sheets and each sheet might have a different set of columns and I would need to hide different columns in different sheets but I can only hide columns for all the sheets combined as transformer.setColumnsToHide is set at document level.
tagged with: jexcelapi
type: UnansweredQuestion
tagged with: excel

http://stackoverflow.com/a/27571925
has comment: http://stackoverflow.com/comment/43626258
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27570430
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27570430
type: Answer
has body: The problem is you're using a PostFilter - Aggregation works on the results returned by the query, the PostFilter is occurring too late. To get your filter to work, use a filtered query (this is probably the one you want) or include a filter as part of the aggregation. This page on filtering queries and aggregations has everything in it you need.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43625507

http://stackoverflow.com/a/27624647
has comment: http://stackoverflow.com/comment/43682346
has comment: http://stackoverflow.com/comment/43678970
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43673978
has comment: http://stackoverflow.com/comment/43677709
accepted answer of: http://stackoverflow.com/q/27624408
upvote count: 3
answers question: http://stackoverflow.com/q/27624408
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43678307
has comment: http://stackoverflow.com/comment/43688140
has comment: http://stackoverflow.com/comment/43699202
has comment: http://stackoverflow.com/comment/43679366
has body: You should not use the setSize() method on any component you add to a JFrame. Swing uses layout managers. The pack() method will invoke the layout manager and the layout manager will generally use the preferred size of the component to determine the size/location of the components. I guess your Canvas class is doing custom painting, and therefore has a preferred size of zero by default, so there is nothing to display. The solution is to override the getPreferredSize() method in your Canvas class to return an appropriate size. Also, don't call you class Canvas, because there is an AWT class by that name, so it gets confusing. If you are using the AWT Canvas class, you should be using the JPanel class instead, for custom painting.
type: Answer

http://stackoverflow.com/comment/43898596
has text: @ankur-singhal see previous comment
comment on: http://stackoverflow.com/q/27584219
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27565492
linked to: http://stackoverflow.com/q/18485854
tagged with: android
tagged with: opengl-es
score: 0
has comment: http://stackoverflow.com/comment/43559431
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27586998
has title: how to move a 3d model according to its direction
tagged with: libgdx
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27586998
has body: I am a newbie to libgdx and android programming in general......so am trying to make a game with libgdx where the user uses accelerometer to move a model....but i can't seem to figure out how to properly move the model where its facing....i used both codes from a similar queation at this link......Android. How to move object in the direction it is facing (using Vector3 and Quaternion)..... but it doesnt work properly....i guess it has something to do with an update cos that answer is old......thanks for any help This is the code i tried public Vector3 baseDirection; public Vector3 position; public Quaternion rotation; public Vector3 translation; ... public void show { baseDirection=new Vector3(0,0,1).nor(); ..... } public void render { direction.mul(rotation); translation.set(direction); translation.scl(speed*delta); instance.transform.translate(translation.x/100f,tranlation.y/100f,translation.z/100f); } Then i tried this public void render { direction.rot(instance.transform).nor().scl(speed*delta); position.add(direction); } Whit the first code it moves in its direction but when i turn it around to the initial point its as if all the code goes upside down ......then with the second code it moves forward perfectly but if i turn it sideways slightly it move sideways fully

http://stackoverflow.com/comment/43450886
comment on: http://stackoverflow.com/q/27488538
has text: You could add that as an answer, maybe someone will find it useful later. :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43619994
comment on: http://stackoverflow.com/q/27523184
has text: How are you constructing the javadoc?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43577429
type: Comment
has text: next time please take some time to choose an adequate title and proper code formatting.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27575968

http://stackoverflow.com/a/27839747
answers question: http://stackoverflow.com/q/27633022
has comment: http://stackoverflow.com/comment/44097020
has body: Move to JavaFX8 and try this: http://java.dzone.com/articles/introduction-example-javafx-8
has comment: http://stackoverflow.com/comment/82519890
type: Answer
score: 0

http://stackoverflow.com/comment/43527159
has text: Sorry, but i don't really understand what do you want to do with this array. Just iterate, find sum of elements, or smth else.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27550364
type: Comment

http://stackoverflow.com/q/27489109
has comment: http://stackoverflow.com/comment/43410331
tagged with: python
tagged with: java
has comment: http://stackoverflow.com/comment/43409991
downvote count: 1
type: Question
has body: I am trying to call java class from a jar file in python. I've see people talking about programs like Jython, Py4j, Jpype, etc, but I am hoping for an easier way other than spend lots of time to study a new program. I am new to programming. Thanks. Briefly, here is what I want to accompolish. Say a jar file called 'Converter.jar'. It has a function 'parse' in a class 'Handler'. How can I call the jar file to realize something like Converter.Handler.parse('my file')?
has title: Call java class from a jar file in python easily without another complicated program like Py4j
score: -1
has answer: http://stackoverflow.com/a/27489377
linked to: http://stackoverflow.com/q/476968
upvote count: 0
answer count: 1
tagged with: jar
duplicate of: http://stackoverflow.com/q/476968
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27562452
has body: I am trying to draw jFreeChart in a word doc using apache POI ,but i am not able to do that .Here i what i have done by i dont know which api i have to use properly somebody please help.here i what i have done as of now, JFreeChart TotalActivityChart = ChartFactory.createBarChart("Total Activities", "Activities", "#Candidate", bar_chart_servlet, PlotOrientation.VERTICAL, false, true, false); /**---------------------------------- Appearance of chart for Total Activity------------------------------------ */ // Adjust appearance (optional) TotalActivityChart.getTitle().setPaint(Color.BLACK); TotalActivityChart.setAntiAlias(true); CategoryPlot plot = (CategoryPlot) TotalActivityChart.getPlot(); plot.setBackgroundPaint(new GradientPaint(0, 0, Color.DARK_GRAY, 0, 100, Color.GRAY)); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); final CategoryItemRenderer renderer = new CustomRenderer(new Paint[] { new Color(0x3D59AB), new Color(0x009ACD), new Color(0x104E8B), new Color(0x50A6C2) }); plot.setRenderer(renderer); /**--------------------------------------- End of Appearance of Chart--------------------------------------- */ int width = 800; int height = 240; ByteArrayOutputStream chart_out = new ByteArrayOutputStream(); ChartUtilities.writeChartAsPNG(chart_out, TotalActivityChart, width, height); String pictureIdx = document.addPictureData(chart_out.toByteArray(), Workbook.PICTURE_TYPE_PNG); chart_out.close(); int width = 800; int height = 240; ByteArrayOutputStream chart_out = new ByteArrayOutputStream(); ChartUtilities.writeChartAsPNG(chart_out, TotalActivityChart, width, height); String pictureIdx = document.addPictureData(chart_out.toByteArray(), document.PICTURE_TYPE_PNG); //document.createParagraph().createRun().addPicture(chart_out, Document.PICTURE_TYPE_PNG,"my pic", Units.toEMU(200), Units.toEMU(200) ); chart_out.close(); run.addPictu…
answer count: 2
tagged with: apache
has comment: http://stackoverflow.com/comment/43551648
has answer: http://stackoverflow.com/a/54237436
has title: parameter is incorrect while generating word with POI
has answer: http://stackoverflow.com/a/27565446
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43550984
has comment: http://stackoverflow.com/comment/43555369
tagged with: apache-poi
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/27503924
has answer: http://stackoverflow.com/a/27503999
score: 0
answer count: 2
has body: In the below code, how does the size() method gets the value? where is the definition or control flow? As List is the interface, it should not contain the definition of size() method. But in the below code I am able to use the size() method from interface without actually implementing it. List&lt;WebElement&gt; linkElements = driver.findElements(By.tagName("a")); String[] linkTexts = new String[linkElements.size()];
has comment: http://stackoverflow.com/comment/43437937
type: UnansweredQuestion
tagged with: interface
tagged with: size
has answer: http://stackoverflow.com/a/27503954
has comment: http://stackoverflow.com/comment/43438093
has comment: http://stackoverflow.com/comment/43437998
has title: Java - How to see the definition of size() method in List interface?
tagged with: java
tagged with: collections
type: Question

http://stackoverflow.com/q/27637890
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43694611
has answer: http://stackoverflow.com/a/27638463
has title: How to select unique data from two databases
has answer: http://stackoverflow.com/a/27637954
favorite count: 0
has body: I have two databases; Database A and Database B. Database A is in my computer and Database B is hosted in a online server. These both databases contains same tables with same data types but Database A will contains more data than the Database B. I want to select all the unique data from Database A. Database A Table A Id | FName | LName ----------------------------- 1 | Jhone | A 2 | Alice | B 3 | Bob | C Database B Table A Id | FName | LName ----------------------------- 1 | Jhone | A I want to select: 2 | Alice | B 3 | Bob | C How can I do this?
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2686254
has comment: http://stackoverflow.com/comment/43710677
score: 2
tagged with: java
tagged with: database
type: Question

http://stackoverflow.com/comment/43591804
comment on: http://stackoverflow.com/q/27583587
type: Comment
type: QuestionComment
has text: Yole: hey man now please see the problem, hope now you will understand better that what i want to do?
score: 0

http://stackoverflow.com/comment/43674127
comment on: http://stackoverflow.com/a/27626293
score: 0
type: AnswerComment
type: Comment
has text: ok thanks! I think I was getting confused with adding multiple values to the playlist table! SO its possible to add multiple songs to the playlist table, i.e playlists_songs (1) and playlists_songs (2), as long as you specifiy they're both being added into playlist number 1 (for example)?

http://stackoverflow.com/a/27547858
answers question: http://stackoverflow.com/q/27547746
score: 0
type: Answer
has body: the method split returns a String Array so store the result into an String array and call the hashmap.put(key,value) method like this String[] a = split.("="); hasmap.put(a[0],a[1]); note if you have several = in the string you will loose some of it in the value of the hashmap!

http://stackoverflow.com/comment/43429496
has text: Why this downgrade of -1? This is an absolutely legitimate question! There is no way to ask better, when there is no previous knowledge! Anyway, what I mean with difference is the visual difference between the to images (Screenshots). If I have one screenshot with 5 icons in a folder and then do another screenshot with 1 icon more, then I want imgC to only show this new icon.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27499236

http://stackoverflow.com/comment/43616726
has text: How big/long is a "tick"? I am Intel i8 on Windows. Are there docs for this per OS / hardware?
comment on: http://stackoverflow.com/q/27596427
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43502658
type: QuestionComment
comment on: http://stackoverflow.com/q/27537134
score: 1
has text: Good god, don't put HTML in servlet that way.
type: Comment

http://stackoverflow.com/a/27606429
downvote count: 0
type: Answer
has body: I managed to make it work by keeping my exportServlet-config.xml. I needed to add &lt;mvc:annotation-driven/&gt; to it.
upvote count: 1
answers question: http://stackoverflow.com/q/27605293
score: 1
accepted answer of: http://stackoverflow.com/q/27605293
type: AcceptedAnswer

http://stackoverflow.com/q/27558594
has answer: http://stackoverflow.com/a/27558622
has comment: http://stackoverflow.com/comment/43575621
has comment: http://stackoverflow.com/comment/43578537
has comment: http://stackoverflow.com/comment/43543365
score: 0
has comment: http://stackoverflow.com/comment/43544546
has comment: http://stackoverflow.com/comment/43543454
has title: Instantiate a class outside of jar file in java?
accepted answer: http://stackoverflow.com/a/27558622
type: AnsweredQuestion
has body: Is it possible to load a class outside the jar file. Janibot // Main Directory lib // sub directory Robot.java Robot.class Janibot.jar // sub directory above is the structure of directory. I want to do is to instantiate a Robot class when I run the Janibot.jar using Class.forName but it always return a classnotfoundexception. my plan is to edit the Robot.java in a JtextArea and compile it at runtime and then instantiate a Robot.class
tagged with: java
has comment: http://stackoverflow.com/comment/43543423
type: Question
answer count: 1

http://stackoverflow.com/q/27613180
favorite count: 0
tagged with: roman-numerals
accepted answer: http://stackoverflow.com/a/27613402
has body: The roman numeral calculator wont work when the result form the calculator is negative, i honestly don't know how to fix it. When the calculator gives out a positive value everything works fine for example the result will look like this please enter the two two integer values that you want to vomplete the operation with &gt; 33 &gt; 44 please enter the operation you want preformed &gt; + Here is the answer 77 negative roman numeral value Here is the answer in roman numerals LXXVII Code here: public static void main(String[] args) { System.out.println("please enter the two two integer values that you want" + " to vomplete the operation with "); Scanner scan = new Scanner(System.in); int first = scan.nextInt(); int sec = scan.nextInt(); System.out.println(" please enter the operation you want preformed"); String opera = scan.next(); System.out.println(" Here is the answer"); int value = Acalc(opera, first, sec); String roman = Roman(value); System.out.println(" Here is the answer in roman numerals "); System.out.println(roman); } public static int Acalc(String opera, int n1, int n2){ int result = 0; //Write the calulator if (opera.equals("+")) {result=n1+n2;} if (opera.equals("-")) {result=n1-n2;} if (opera.equals("*")) {result=n1*n2;} if (opera.equals("/")) {result=n1/n2;} System.out.println(result); return result; } public static String Roman(double input){ String s = ""; if (input &lt;1 || input &lt; 999) System.out.println("negative roman numeral value "); while (input &gt;= 100) { s += "C"; input -= 100; } while (input &gt;= 90) { s += "XC"; input -= 90; } while (input &gt;= 50) { s += "L"; input -= 50; } while (input &gt;= 40) { s += "XL"; input -= 40; } while (input &gt;= 10) { s += "X"; input -= 10; } while (input &gt;= 9) { s += "IX"; input -= 9; } while (input &gt;= 5) { s += "V"; input -= 5; } while (input &gt;= 4) { s += "IV"; input -= 4; } while (input &gt;= 1) { s += "I"; input -= 1; } return s; }
has answer: http://stackoverflow.com/a/27613320
has comment: http://stackoverflow.com/comment/43648755
has comment: http://stackoverflow.com/comment/43648764
possible better answer: http://stackoverflow.com/a/27613320
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43648784
has comment: http://stackoverflow.com/comment/43648659
type: AnsweredQuestion
has title: how to get a roman numeral calculator to work with negative numbers
has answer: http://stackoverflow.com/a/27613402
tagged with: java
has comment: http://stackoverflow.com/comment/43648601
has comment: http://stackoverflow.com/comment/43648620
has comment: http://stackoverflow.com/comment/43648649
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43648616
tagged with: calculator

http://stackoverflow.com/q/27539928
has title: Using PKCS11 with NSS for Java encryption: java.security.ProviderException: Initialization failed
type: UnansweredQuestion
has body: I am trying to set up Java to use NSS for doing some various encryption routines. I understand the JCE necessary to offload these routines to NSS is PKCS11. I have compiled all the NSS binaries, and moved each of the resulting shared objects to /usr/lib/nss: $ ls /usr/lib/nss/ libfreebl3.so libnss3.so libnssdbm3.so libnssutil3.so libplds4.so libsoftokn3.so libnspr4.so libnssckbi.so libnsssysinit.so libplc4.so libsmime3.so libsqlite3.so the nss.cfg file I am using is as follows: name=NSS nssLibraryDirectory=/usr/lib/nss nssDbMode=noDb attributes=compatibility However, when running the application, this is the output: java.security.ProviderException: Initialization failed at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:376) at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:103) ... Caused by: java.io.IOException: libsqlite3.so: cannot open shared object file: No such file or directory/usr/lib/nss/libsoftokn3.so at sun.security.pkcs11.wrapper.PKCS11.connect(Native Method) at sun.security.pkcs11.wrapper.PKCS11.&lt;init&gt;(PKCS11.java:138) at sun.security.pkcs11.wrapper.PKCS11.getInstance(PKCS11.java:151) at sun.security.pkcs11.SunPKCS11.&lt;init&gt;(SunPKCS11.java:313) ... 5 more Any ideas???
tagged with: ioexception
has comment: http://stackoverflow.com/comment/43532619
answer count: 0
tagged with: java
tagged with: pkcs#11
has comment: http://stackoverflow.com/comment/43508336
type: Question
tagged with: nss
score: 0

http://stackoverflow.com/q/27631626
tagged with: java
tagged with: bukkit
score: -1
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27631857
favorite count: 0
accepted answer: http://stackoverflow.com/a/27631857
has comment: http://stackoverflow.com/comment/43683600
type: AnsweredQuestion
tagged with: mysql
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Knight' in 'field list'
downvote count: 1
type: Question
has body: I have no clue why this doesn't want to cooperate when the rest of the code using MySQL works perfectly, It's just when I try to set a string. The MySQLManager class: http://pastebin.com/RWavasPh I do alter a table to add another column in: try { McInfected.getMySQLManager().execute("ALTER TABLE McInfected ADD Rank VARCHAR(20);"); } catch (SQLException e) { } Then my RanksManager class(The one that gets an sets the ranks) http://pastebin.com/T0nRKkv7 Any help would be greatly appreciated as I am almost ready to throw my computer... I have tried to look at the other questions for an answer but I'm not really able to understand how to fix it in my instance, As far as I could tell it had to do with the access type, but I'm not to sure what to do to fix it... This is the error 11:29:49 PM [WARNING] com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Knight' in 'field list' 11:29:49 PM [WARNING] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 11:29:49 PM [WARNING] at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) 11:29:49 PM [WARNING] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) 11:29:49 PM [WARNING] at java.lang.reflect.Constructor.newInstance(Unknown Source) 11:29:49 PM [WARNING] at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) 11:29:49 PM [WARNING] at com.mysql.jdbc.Util.getInstance(Util.java:382) 11:29:50 PM [WARNING] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) 11:29:50 PM [WARNING] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593) 11:29:50 PM [WARNING] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525) 11:29:50 PM [WARNING] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986) 11:29:50 PM [WARNING] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140) 11:29:50 PM [WARNING] at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2620) 11:29:50 PM [WARNING] at com.mysql.jdbc.ConnectionImpl.execSQL(Conn…

http://stackoverflow.com/a/27679997
answers question: http://stackoverflow.com/q/27614301
type: Answer
upvote count: 57
has body: I think you can find it usefull http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-two-datasources It shows how to define multiple datasources &amp; assign one of them as primary. Here is a rather full example, also contains distributes transactions - if you need it. http://fabiomaffioletti.me/blog/2014/04/15/distributed-transactions-multiple-databases-spring-boot-spring-data-jpa-atomikos/ What you need is to create 2 configuration classes, separate the model/repository packages etc to make the config easy. Also, in above example, it creates the data sources manually. You can avoid this using the method on spring doc, with @ConfigurationProperties annotation. Here is an example of this: http://xantorohara.blogspot.com.tr/2013/11/spring-boot-jdbc-with-multiple.html Hope these helps.
has comment: http://stackoverflow.com/comment/74476793
has comment: http://stackoverflow.com/comment/69524853
has comment: http://stackoverflow.com/comment/59132306
downvote count: 2
score: 55

http://stackoverflow.com/a/27490569
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43569617
accepted answer of: http://stackoverflow.com/q/27490371
type: Answer
has comment: http://stackoverflow.com/comment/43568896
has body: You need to have two seperate JTextField objects if you want two seperate fields: try adding JTextField field2 = new JTextField("Your second field"); and change the first add() call on your frame to frame.add(BorderLayout.NORTH, field2); This will produce which I assume is what you want.
has comment: http://stackoverflow.com/comment/43568327
has comment: http://stackoverflow.com/comment/43413766
answers question: http://stackoverflow.com/q/27490371
score: 3
has comment: http://stackoverflow.com/comment/43413850
upvote count: 3
has comment: http://stackoverflow.com/comment/43571040

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/27496507
type: Tag
tags question: http://stackoverflow.com/q/27574490
tags question: http://stackoverflow.com/q/27622072
tags question: http://stackoverflow.com/q/27492429
tags question: http://stackoverflow.com/q/27582539
tags question: http://stackoverflow.com/q/27559118
tags question: http://stackoverflow.com/q/27637493

http://stackoverflow.com/comment/43572543
type: Comment
has text: Where in the OP's question is it mentioned that he wants to have 15 bytes? He wanted a 15-character string.
comment on: http://stackoverflow.com/a/27573322
score: 0
type: AnswerComment

http://stackoverflow.com/a/40479691
has body: Add the following code to your.project file in the appropriate location. org.eclipse.wst.jsdt.core.javascriptValidator
answers question: http://stackoverflow.com/q/27603853
score: 0
type: Answer

http://stackoverflow.com/q/27637811
type: Question
has answer: http://stackoverflow.com/a/38833253
answer count: 3
has comment: http://stackoverflow.com/comment/47602490
downvote count: 0
favorite count: 0
has body: I'm using Gson to parse my REST API calls to Java objects. I want to filter out null objects in an array, e.g. { list: [ {"key":"value1"}, null, {"key":"value2"} ] } should result in a List&lt;SomeObject&gt; with 2 items. How can you do this with Gson?
accepted answer: http://stackoverflow.com/a/29733208
tagged with: serialization
has answer: http://stackoverflow.com/a/58816338
linked to: http://stackoverflow.com/q/40632125
has answer: http://stackoverflow.com/a/29733208
has comment: http://stackoverflow.com/comment/68536417
score: 2
possible better answer: http://stackoverflow.com/a/38833253
upvote count: 2
tagged with: gson
has title: Exclude null objects from JSON array with Gson
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27486648
type: Question
tagged with: tomcat
has answer: http://stackoverflow.com/a/27487533
answer count: 1
favorite count: 0
upvote count: 0
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43405265
tagged with: jakarta-ee
has body: when I clean TOMCAT or I clean thé tomcat work directory I lose all file saved in Tomcat folder, Can I disable this option ?
score: -5
has title: TOMCAT 7, Clean, Clean workdirectory
tagged with: java

http://stackoverflow.com/q/27475706
downvote count: 0
favorite count: 0
type: Question
has body: I'm trying to learn how to use OpenGL with LWJGL3, however, I've fallen short at an early hurdle. I've set up the scene so it renders half an octohedron, with each face having a different colour to be distinguished between. I have this code to create the shape: private void drawOctohedron() { glPushMatrix(); glRotatef((float)glfwGetTime() * 60,0f,1f,0f); System.out.println(glfwGetTime()); glBegin(GL_TRIANGLES); { glColor4f(1.0F, 0.0F, 0.0F, 1.0F); glVertex3i(0, 1, 0); glVertex3i(-1, 0, 0); glVertex3i(0, 0, 1); glNormal3i(-1, 1, 1); glColor4f(0.0F, 1.0F, 0.0F, 1.0F); glVertex3i(0, 1, 0); glVertex3i(0, 0, 1); glVertex3i(1, 0, 0); glNormal3i(1, 1, 1); glColor4f(0.0F, 0.0F, 1.0F, 1.0F); glVertex3i(0, 1, 0); glVertex3i(1, 0, 0); glVertex3i(0, 0, -1); glNormal3i(1, 1, -1); glColor4f(1.0F, 0.0F, 1.0F, 1.0F); glVertex3i(0, 1, 0); glVertex3i(0, 0, -1); glVertex3i(-1, 0, 0); glNormal3i(-1, 1, -1); } glPopMatrix(); } and this is the loop: private void loop() { // This line is critical for LWJGL's interoperation with GLFW's // OpenGL context, or any context that is managed externally. // LWJGL detects the context that is current in the current thread, // creates the ContextCapabilities instance and makes the OpenGL // bindings available for use. GLContext.createFromCurrent(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); while ( glfwWindowShouldClose(window) == GL_FALSE ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glfwPollEvents(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); camera.lookThrough(); drawOctohedron(); glFlush(); System.out.println("UPS: " + 1/(glfwGetTime() - lastTime)); lastTime = glfwGetTime(); glfwSwapBuffers(window); } System.out.println("Closing"); } The shape renders fine to the display but the rotation only occurs once. The method is called every tick and the System.out line is printing a different value every tick. My question being, why is the rotation only happening once and not updating the next time the method is called? I'm probably just being ver…
upvote count: 3
tagged with: opengl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/43386324
has comment: http://stackoverflow.com/comment/43386320
has comment: http://stackoverflow.com/comment/43386164
has comment: http://stackoverflow.com/comment/43386508
type: UnansweredQuestion
has title: OpenGL LWJGL3 object in scene will not rotate
score: 3
answer count: 0

multithreading
tags question: http://stackoverflow.com/q/27525989
tags question: http://stackoverflow.com/q/27482337
tags question: http://stackoverflow.com/q/27532330
tags question: http://stackoverflow.com/q/27513887
tags question: http://stackoverflow.com/q/27580565
tags question: http://stackoverflow.com/q/27554499
tags question: http://stackoverflow.com/q/27631237
tags question: http://stackoverflow.com/q/27478340
tags question: http://stackoverflow.com/q/27626148
type: Tag
tags question: http://stackoverflow.com/q/27594042
tags question: http://stackoverflow.com/q/27490381
tags question: http://stackoverflow.com/q/27588390
tags question: http://stackoverflow.com/q/27513833
tags question: http://stackoverflow.com/q/27591043
tags question: http://stackoverflow.com/q/27638310
tags question: http://stackoverflow.com/q/27624809
tags question: http://stackoverflow.com/q/27511348
tags question: http://stackoverflow.com/q/27493451
tags question: http://stackoverflow.com/q/27620533
tags question: http://stackoverflow.com/q/27605329
tags question: http://stackoverflow.com/q/27515020
tags question: http://stackoverflow.com/q/27475034
tags question: http://stackoverflow.com/q/27564963
tags question: http://stackoverflow.com/q/27552868
tags question: http://stackoverflow.com/q/27622536
tags question: http://stackoverflow.com/q/27576640
tags question: http://stackoverflow.com/q/27628538
tags question: http://stackoverflow.com/q/27606709
tags question: http://stackoverflow.com/q/27555325
tags question: http://stackoverflow.com/q/27580503
tags question: http://stackoverflow.com/q/27606541
tags question: http://stackoverflow.com/q/27486442
tags question: http://stackoverflow.com/q/27634125
tags question: http://stackoverflow.com/q/27519966
tags question: http://stackoverflow.com/q/27566606
tags question: http://stackoverflow.com/q/27504715
tags question: http://stackoverflow.com/q/27564844
tags question: http://stackoverflow.com/q/27573978
tags question: http://stackoverflow.com/q/27515137
tags question: http://stackoverflow.com/q/27502911
tags question: http://stackoverflow.com/q/27545312
tags question: http://stackoverflow.com/q/27501365
tags question: http://stackoverflow.com/q/27586088
tags question: http://stackoverflow.com/q/27541989
tags question: http://stackoverflow.com/q/27603683
tags question: http://stackoverflow.com/q/27600800
tags question: http://stackoverflow.com/q/27486242
tags question: http://stackoverflow.com/q/27479385
tags question: http://stackoverflow.com/q/27624597
tags question: http://stackoverflow.com/q/27582486
tags question: http://stackoverflow.com/q/27495927
tags question: http://stackoverflow.com/q/27544196
tags question: http://stackoverflow.com/q/27614799
tags question: http://stackoverflow.com/q/27557330
tags question: http://stackoverflow.com/q/27629027
tags question: http://stackoverflow.com/q/27576805
tags question: http://stackoverflow.com/q/27587129
tags question: http://stackoverflow.com/q/27574220
tags question: http://stackoverflow.com/q/27541201
tags question: http://stackoverflow.com/q/27635372
tags question: http://stackoverflow.com/q/27607011
tags question: http://stackoverflow.com/q/27550936
tags question: http://stackoverflow.com/q/27622582
tags question: http://stackoverflow.com/q/27550977
tags question: http://stackoverflow.com/q/27522451
tags question: http://stackoverflow.com/q/27611958
tags question: http://stackoverflow.com/q/27602264
tags question: http://stackoverflow.com/q/27589191
tags question: http://stackoverflow.com/q/27627490
tags question: http://stackoverflow.com/q/27620417
tags question: http://stackoverflow.com/q/27606560
tags question: http://stackoverflow.com/q/27557471
tags question: http://stackoverflow.com/q/27499317
tags question: http://stackoverflow.com/q/27492656
tags question: http://stackoverflow.com/q/27592429
tags question: http://stackoverflow.com/q/27504836
tags question: http://stackoverflow.com/q/27512671
tags question: http://stackoverflow.com/q/27613383
tags question: http://stackoverflow.com/q/27554340

http://stackoverflow.com/comment/43639778
type: Comment
type: QuestionComment
has text: There's not enough information here, post or link the widget class, the non java request that succeeds and any message body readers you have registered
comment on: http://stackoverflow.com/q/27608694
score: 0

http://stackoverflow.com/q/27635757
has answer: http://stackoverflow.com/a/27636259
has answer: http://stackoverflow.com/a/27635884
accepted answer: http://stackoverflow.com/a/27636617
type: AnsweredQuestion
has body: i'm trying to remove duplicate objects from my array. I have my custom which is made of two double : x and y. What i want to do is to remove duplicate ( (x &amp;&amp; y) == (x1 &amp;&amp; y1)) and if x == x1 i want to keep the object which has the higher y. ArrayList&lt;MyObject&gt; list = [x(0),y(0)], [x(0),y(0)], [x(0.5),y(0.5], [x(0.5),y(0.6)], [x(1),y(1)]; ArrayList&lt;MyObject&gt; results = [x(0),y(0)], [x(0.5),y(0.6)], [x(1),y(1)]; I tried to implement the equals method but i do not how to use it : public boolean equals(Object obj) { if (obj == null || !(obj instanceof MyObject)) { return false; } return (this.x == ((MyObject)obj).x); } list is always ordered using Collections.sort by x. Thanks for all.
tagged with: java
type: Question
has title: Remove duplicate in ArrayList of Custom objects
has comment: http://stackoverflow.com/comment/43691809
tagged with: algorithm
has answer: http://stackoverflow.com/a/27637746
answer count: 6
tagged with: sorting
score: 4
has answer: http://stackoverflow.com/a/27635769
upvote count: 4
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43690825
downvote count: 0
possible better answer: http://stackoverflow.com/a/27635769
favorite count: 0
has answer: http://stackoverflow.com/a/27636617
has answer: http://stackoverflow.com/a/34146539
has comment: http://stackoverflow.com/comment/43690918
tagged with: android

http://stackoverflow.com/comment/43657344
comment on: http://stackoverflow.com/a/27617779
score: 0
type: Comment
has text: @agavish I suspect only aerospike has exactly the interface.
type: AnswerComment

http://stackoverflow.com/a/27521972
has body: I solved this issue myself to run Libreplan on windows. There were many problem with configuration. First thing the error message was misleading, it has nothing to do with ListableBeanFactory. I made following changes: Rename libreplan.xml to libreplan-webapp.xml inside tomcat\conf\Catalina\localhost folder as filename should math application war name. Then I remove hibernate-annotations dependency as annotation comes with hibernate-core jar from 3.5 onward. I added below entry in catalina.policy file grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" { ... // begin:libreplan permission java.io.FilePermission "${catalina.base}${file.separator}webapps${file.separator}libreplan-webapp${file.separator}WEB-INF${file.separator}classes${file.separator}logging.properties", "read"; // end:libreplan ... };
answers question: http://stackoverflow.com/q/27506823
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27506823
type: AcceptedAnswer

http://stackoverflow.com/q/27590169
answer count: 2
has body: I have a dialog box to be shown but it is giving compilation errors. The compilation errors are given in the last part. import javax.swing.*; class SwingDemo { SwingDemo() { JFrame jfrm = new JFrame("A Simple Swing Application"); jfrm.setSize(275, 100); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel jlab = new JLabel(" Swing means powerful GUIs."); jfrm.add(jlab); jfrm.setVisible(true); } public static void main(String args[]) { public void run() { new SwingDemo(); } } } The errors are: Multiple markers at this line - Syntax error on token "void", @ expected - Syntax error, insert "enum Identifier" to complete EnumHeaderName - Syntax error, insert "EnumBody" to complete BlockStatements
favorite count: 0
has title: java swing error dialog box
has answer: http://stackoverflow.com/a/27590205
accepted answer: http://stackoverflow.com/a/27590205
possible better answer: http://stackoverflow.com/a/27590229
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: swing
type: Question
score: 3
has comment: http://stackoverflow.com/comment/43604353
has answer: http://stackoverflow.com/a/27590229
upvote count: 3

http://stackoverflow.com/q/27613339
tagged with: jax-rs
favorite count: 0
tagged with: rest
has body: I am new to JAX-RS, and I created a simple webservice. That is as follows public class WebService { public WebService(@Context UriInfo uriInfo){ } @GET @Path("/testGet") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response get() throws IOException{ return Response.ok().build(); } } Everything is working fine. Only thing I want to know is I want to execute a function only once in my entire webservice lifecycle. So that I can read properties file. Otherwise I'll endup reading it every request. Any Suggesitions ?
possible better answer: http://stackoverflow.com/a/27616856
has answer: http://stackoverflow.com/a/27616856
has comment: http://stackoverflow.com/comment/43653102
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43656759
has answer: http://stackoverflow.com/a/27628472
has title: JAX-RS run a function only once
accepted answer: http://stackoverflow.com/a/27628472
upvote count: 3
has comment: http://stackoverflow.com/comment/43648854
answer count: 2
downvote count: 1

http://stackoverflow.com/q/27481775
type: Question
has comment: http://stackoverflow.com/comment/43396206
linked to: http://stackoverflow.com/q/17973970
has answer: http://stackoverflow.com/a/66723649
tagged with: apache
has comment: http://stackoverflow.com/comment/43396205
has body: I am trying to create a word document using apache POI but I am getting noclassdeffound error I have done so far this: import java.io.File; import java.io.FileOutputStream; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; public class DocFile { public void newWordDoc(String filename, String fileContent) throws Exception { XWPFDocument document = new XWPFDocument(); XWPFParagraph tmpParagraph = document.createParagraph(); XWPFRun tmpRun = tmpParagraph.createRun(); tmpRun.setText(fileContent); tmpRun.setFontSize(18); FileOutputStream fos = new FileOutputStream(new File("C:\\"+filename + ".doc")); document.write(fos); fos.close(); } public static void main(String[] args) throws Exception { DocFile app = new DocFile(); app.newWordDoc("testfile", "Hi hw r u?"); } }
answer count: 1
downvote count: 0
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
has title: How to create word doc using apache POI
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43396316

http://stackoverflow.com/q/27567150
tagged with: spring
has answer: http://stackoverflow.com/a/27619211
type: UnansweredQuestion
has body: I am using Spring + Hibernate. Below is the Code snippet from my java method. After issuing query it is waiting for long time. Table size is very small. And it is occurring intermittently(not always). I do not face any exception. could you please let me know how to debug this issue. Code Snippet: BigDecimal id = null; id = (BigDecimal) getHibernateTemplate().execute(new HibernateCallback&lt;Object&gt;() { public Object doInHibernate(Session session)throws HibernateException, SQLException { Query roleDetails = session.createSQLQuery("select role_id from employee where emp_id = '"+eid+"'"); return roleDetails.uniqueResult(); } });
has comment: http://stackoverflow.com/comment/43671386
tagged with: java
tagged with: hibernate
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27625503
has title: DB not returning response
has comment: http://stackoverflow.com/comment/43559904
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/43653566

http://stackoverflow.com/a/27575546
type: Answer
has comment: http://stackoverflow.com/comment/43576678
answers question: http://stackoverflow.com/q/27575537
has comment: http://stackoverflow.com/comment/43576720
has body: The problem is that getBytes() returns a byte[], and arrays are Objects in Java. However, these array objects don't override Object's toString() method, which is responsible for the output you see. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode()) The output includes the hash code, which is different for every object, even if the contents are the same. Use Arrays.toString to obtain a String with the contents of the array, e.g. System.out.println(Arrays.toString(aString.getBytes())); 3 times. New output: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100] [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100] [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/43607580
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27591852
has text: You are too used to C/C++; you have no need for an argc. Just use a foreach loop on `argv` (which is customarily called `args` in Java anyway)
score: 0

android-studio
tags question: http://stackoverflow.com/q/27591053
tags question: http://stackoverflow.com/q/27546752
tags question: http://stackoverflow.com/q/27478559
tags question: http://stackoverflow.com/q/27532357
tags question: http://stackoverflow.com/q/27483594
tags question: http://stackoverflow.com/q/27537380
tags question: http://stackoverflow.com/q/27557825
tags question: http://stackoverflow.com/q/27584029
tags question: http://stackoverflow.com/q/27570356
tags question: http://stackoverflow.com/q/27624798
tags question: http://stackoverflow.com/q/27536491
tags question: http://stackoverflow.com/q/27625734
tags question: http://stackoverflow.com/q/27581839
tags question: http://stackoverflow.com/q/27610124
tags question: http://stackoverflow.com/q/27500084
tags question: http://stackoverflow.com/q/27591607
tags question: http://stackoverflow.com/q/27585690
tags question: http://stackoverflow.com/q/27502727
tags question: http://stackoverflow.com/q/27537269
tags question: http://stackoverflow.com/q/27516738
tags question: http://stackoverflow.com/q/27489905
tags question: http://stackoverflow.com/q/27622493
tags question: http://stackoverflow.com/q/27494179
tags question: http://stackoverflow.com/q/27514734
tags question: http://stackoverflow.com/q/27482354
tags question: http://stackoverflow.com/q/27515414
tags question: http://stackoverflow.com/q/27528652
tags question: http://stackoverflow.com/q/27585460
tags question: http://stackoverflow.com/q/27610134
tags question: http://stackoverflow.com/q/27502712
tags question: http://stackoverflow.com/q/27550213
tags question: http://stackoverflow.com/q/27585248
tags question: http://stackoverflow.com/q/27588787
tags question: http://stackoverflow.com/q/27604737
type: Tag
tags question: http://stackoverflow.com/q/27493955
tags question: http://stackoverflow.com/q/27628560
tags question: http://stackoverflow.com/q/27532158
tags question: http://stackoverflow.com/q/27559780
tags question: http://stackoverflow.com/q/27579093
tags question: http://stackoverflow.com/q/27609071
tags question: http://stackoverflow.com/q/27553431
tags question: http://stackoverflow.com/q/27539702
tags question: http://stackoverflow.com/q/27556719
tag name: android-studio

http://stackoverflow.com/comment/73456365
type: AnswerComment
has text: I read follow in a post: _"Typically you need an application server’s JTA capability only if your application needs to handle transactions across multiple resources, which is not a requirement for many applications."_
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27615246

http://stackoverflow.com/comment/43660585
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27619708
has text: But what should I do with that? I am confused that he didnt do anything with the bitmap :(

http://stackoverflow.com/comment/43618842
type: AnswerComment
comment on: http://stackoverflow.com/a/27597550
type: Comment
score: 1
has text: This is one of the few occasions where C has an advantage over Java, because `wchar_t` could be redefined, so often, `wchar_t` is `uint32_t` already, not `uint16_t`. Whereas `char` in Java couldn't be changed.

http://stackoverflow.com/q/27483681
answer count: 2
upvote count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9051955
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27484905
has title: GWT - Inject external JavaScript file into GWT application without ScriptInjector
type: Question
tagged with: gwt
has body: I'm working on maintenance project which was developed with GWT version 1.x. Now I have to add some extra features in the same project and for that I have to inject external JavaScript file into GWT application. So I have done a bit of research to achieve the same and I can understand that I can inject the external JavaScript with the help of ScriptInjector class [Source]. but this class is available in GWT version GWT 2.7.0 and I'm using the older version of GWT. So I would like to know that Can I inject the external JavaScript file without ScriptInjectorclass?
tagged with: javascript
has answer: http://stackoverflow.com/a/27484808
tagged with: javascript-injection

http://stackoverflow.com/comment/43570648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27571468
score: 0
has text: well i know it existed but didnt know how to invoke it. I need it to make a customer String.

http://stackoverflow.com/q/27604852
tagged with: eclipse
answer count: 1
has comment: http://stackoverflow.com/comment/43631858
favorite count: 0
has title: method parseInt(String) in the type Integer is not applicable for the arguments (void)
type: UnansweredQuestion
has body: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JOptionPane; public class Main { public static void main (String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/convocation","root",""); *String id_convo= Integer.parseInt(JOptionPane.showMessageDialog(null,"Input ConvoID"));* JOptionPane.showInputDialog(null,"Please Insert Student ConvoID"); PreparedStatement statement = con.prepareStatement("select * from stud_details where id='"+id_convo+"' "); ResultSet result = statement.executeQuery(); while(result.next()) { JOptionPane.showMessageDialog(null,result.getString(1) + " "+ result.getString(2)); } } } Basically this is my code. I would like user to enter convo id(eg:01, 02) and it come out with the details from the database id 01 or 02. However, I dont know why there is an error where Integer is not applicable for the arguments (void). and i dont know why. I tried to remove the String[]args but nothing works. what should i do? thanks
has answer: http://stackoverflow.com/a/27604934
has comment: http://stackoverflow.com/comment/43631808
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/43631853
tagged with: mysql
upvote count: 1
type: Question
score: -2

http://stackoverflow.com/comment/43656849
type: Comment
score: 0
has text: my jsp part is working fine, because in my html, i embedded jsp to it, it works fine SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); <%=formatter.format(new java.util.Date())%> Not sure why when do this var d = new Date("<%=formatter.format(new java.util.Date())%>"); will give me NaN
type: AnswerComment
comment on: http://stackoverflow.com/a/27617458

http://stackoverflow.com/comment/43479468
type: QuestionComment
score: 0
has text: @chrylis I'm running OS X Yosemite, actually.
comment on: http://stackoverflow.com/q/27524442
type: Comment

http://stackoverflow.com/comment/43384406
has text: You should use `if else` not just `if`. One of the `if` is in conflict with another `if`. Let me see if I can find which. But it seems better approach to have a coherent conditional structure.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27475010
type: Comment

http://stackoverflow.com/a/27542149
has body: The problem with @ZsoltBoldizsár's answer is that you are using ActionBarActivity. Change getActionBar() to getSupportActionBar() Add the following code in onCreate(Bundle) after you call super.onCreate(Bundle): getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setIcon(R.drawable.ic_launcher); Appcompat-v7 automatically disables setDisplayShowHomeEnabled so you must set it to true to show an icon.
answers question: http://stackoverflow.com/q/27541802
type: Answer
upvote count: 7
score: 7
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27541802

http://stackoverflow.com/q/27604172
tagged with: java
has comment: http://stackoverflow.com/comment/43642605
has title: How to call or write an Oracle function
type: Question
has body: Hi I am coding a Library Management System using JSF 2.2 and Oracle XE. I have Books and and Authors tables. In JSF I have books and authos pages. In Books page user can enter book and book's editor's name and it write it to Editor attribute in database. I want to write an Oracle function which takes Editor's name and insert it to Author table. In Author table there is Name and Surname attributes. So function should take a row from editor seperates it to Name and Surname and insert them to Author table. For this I coded below code. I took and seperated Editor names and surname. And passed them to a String array. The problem is Oracle Function. I do not know how to write it. How will we control Author table if this author is already in this table. Sure I do not want to add same people to table. I looked to internet for this but have nothing. If this question is so easy I am so sorry. Please help me. I will appretiate for this. Thanks. public void AuthorNames() throws SQLException{ String authorNames = ""; try { Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","Alparslan-PC","123456"); ps = con.prepareStatement("SELECT DISTINCT EDITOR FROM BOOK"); ResultSet rs = ps.executeQuery(); for(int count = 0; rs.next(); count++){ authorNames += " " + rs.getString("EDITOR"); } for(int count = 0; count&lt;authorNames.length(); count += 2){ NameSurname = authorNames.split(" "); } sqlFunction(NameSurname); } catch (ClassNotFoundException ex) { Logger.getLogger(BorrowerBean.class.getName()).log(Level.SEVERE, null, ex); } } public void sqlFunction(String[] NameSurname) throws SQLException { try { Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","Alparslan-PC","123456"); for(int count = 0; count &lt; NameSurname.length; count++){ ps = con.prepareStatement("CREATE [OR REPLACE] FUNCTION author_names( " + NameSurname[count] + " , " + NameSurname[co…
has comment: http://stackoverflow.com/comment/43633378
score: 0
tagged with: plsql
tagged with: oracle-database
tagged with: sql
tagged with: jdbc
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43634619
has comment: http://stackoverflow.com/comment/43633042

http://stackoverflow.com/comment/43660118
comment on: http://stackoverflow.com/a/27617940
has text: Thanks meskobalazs, I just changed it but still get the same error log.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43511968
type: Comment
comment on: http://stackoverflow.com/a/27540773
type: AnswerComment
has text: I can't move my configuration files each time, I need to place those file itself in project
score: 0

http://stackoverflow.com/q/27593730
has title: Does DropWizard natively support scheduled tasks?
downvote count: 0
has answer: http://stackoverflow.com/a/44765034
favorite count: 0
tagged with: dropwizard
tagged with: admin
tagged with: quartz-scheduler
score: 11
possible better answer: http://stackoverflow.com/a/44765034
type: AnsweredQuestion
tagged with: java
upvote count: 11
has body: DropWizard allows you to define administrative tasks and execute them remotely by hitting a URL. DropWizard apps also have a few built-in admin tasks, such as the Garbage Collector, which can be hit by sending a GET to http(s)://yourapp.example.com:8081/tasks/gc. I'm wondering if DropWizard has any built-in support for scheduling tasks. For instance, using the GC task as an example, it might be nice to schedule garbage collection every 3 hours, or at midnight, etc. Obviously, I could incorporate something like Quartz to achieve this, but why reinvent the wheel if I DropWizard already natively supports this out of the box? So does it?
type: Question
has answer: http://stackoverflow.com/a/27593910
accepted answer: http://stackoverflow.com/a/27593910
answer count: 2
tagged with: scheduling

http://stackoverflow.com/q/27565269
downvote count: 1
tagged with: dos
tagged with: java
has title: how to run selenium html suite parallely on same pc in 3 different browsers?
type: Question
score: 5
tagged with: firefox
has body: I am running CHROME, FF, IE parallely by changing port number the command is: java -jar D:\selenium\selenium-server-standalone-2.40.0.jar -htmlSuite "*googlechrome C:\chrome.exe" http://localhost/test/ D:\selenium\TS6.html C:\RES\Result_TS6.html -port 4448 and -port 4452 for FF and -port 4456 for IE CHROME runs perfectly fine and close after completion BUT when FF completes its automation it is closing IE rather than FF and FF remains running forever.... Can anybody suggest why this is happening?
answer count: 1
tagged with: javascript
favorite count: 0
upvote count: 6
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27642870
tagged with: selenium

http://stackoverflow.com/a/27503245
has comment: http://stackoverflow.com/comment/43436943
answers question: http://stackoverflow.com/q/27503134
has comment: http://stackoverflow.com/comment/43436725
has comment: http://stackoverflow.com/comment/43436508
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43436662
has comment: http://stackoverflow.com/comment/43436567
has body: register your service in OnResume() then you can access easily within your class, @Override public void onResume() { super.onResume(); this.registerReceiver(this.yourservice, new IntentFilter("your service type")); } and unregister the service in your onpause() @Override public void onPause() { super.onPause(); try { this.unregisterReceiver(this.your service); } catch(Exception e) { e.printStackTrace(); } } add the your broadcast receiver in your activity , private WakefulBroadcastReceiver IncomingSms = new WakefulBroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //use your receiver content }
upvote count: 1

http://stackoverflow.com/comment/43450054
type: QuestionComment
comment on: http://stackoverflow.com/q/27508521
score: 0
has text: Do you use maven for the build?
type: Comment

http://stackoverflow.com/q/27483569
has title: How to use FragmentManager in non-Fragment class
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/43400137
has comment: http://stackoverflow.com/comment/43401206
has answer: http://stackoverflow.com/a/27483929
tagged with: android-fragments
linked to: http://stackoverflow.com/q/1709166
tagged with: java
has comment: http://stackoverflow.com/comment/43400265
type: Question
has body: I have craeted a CustomAdapter class that extends BaseAdapter (so I cannot extend the class to Fragment). In CustomAdapter class I create my custom ListView with items. Uppon button clicked I would like to go another Fragment. CustomAdapter class is being initialized in MyLocationFragment.java. In this Fragment I offer the user to select an Item from ListView, and when the user clicks the Button (which is next to the TextView / Item) I want to go to HomeScreenFragment and do something with the stored value from the TextView that the Button belonged to (same position). MyLocationFragment (parts that matter in this case, otherwise too big): if(adminMode) { ArrayList&lt;String&gt; data = new ArrayList&lt;&gt;(Arrays.asList(locationsArray)); CustomAdapter adapter = new CustomAdapter(data, getActivity()); // Assign adapter to ListView listView.setAdapter(adapter); } CustomAdapter.java (partially,where the Listeners comes in): holder.localData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { fMyLocation = new MyLocationFragment(); // Store selected values into Strings and pass them to setter method String selectedLocation = (String) holder.items.getText().toString(); String [] locationsArrayValues = v.getResources().getStringArray(R.array.locations_array_value); String selectedLocationUrl = locationsArrayValues[position]; fMyLocation.setInputLocation(selectedLocation); fMyLocation.setInputLocationUrl(selectedLocationUrl); FragmentActivity myContext; // On Item Click, go to the HomeScreen Fragment fragment = new HomeScreenFragment(); FragmentManager fManager = myContext.getSupportFragmentManager(); FragmentTransaction fTransaction = fManager.beginTransaction(); fTransaction.replace(R.id.fragment_holder, fragment); fTransaction.commit(); } }); The above code results into Cannot Resolve getFragmentManager(); Any idea how could I get to the HomeScreenFragment from non-Fragment class ? Any help will be appreciated.

http://stackoverflow.com/a/27505266
has body: In netbeans goto: Window -&gt; Options -&gt; Miscellaneous -&gt; Output Here, you can change color for user input by changing value of Input Color option.
score: 1
answers question: http://stackoverflow.com/q/27505052
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27505052
type: Answer

http://stackoverflow.com/q/27571590
favorite count: 0
has comment: http://stackoverflow.com/comment/43568669
tagged with: android
has body: Hello I am new to android and ran into a strange error. I had this error handling script that I would need to be using through out the project. The code is currently working fine from the signup.java file. The code looks like this public void error(boolean flag, String etext, String page) { if(flag==true) { Toast.makeText(getBaseContext(), etext, Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getBaseContext(), etext, Toast.LENGTH_SHORT).show(); //Redirect to somepage } } I thought since I will be making frequent use of this block I should put it inside a seperate java class and then call it in all other classes I need this functionality so I created a error.java file and when I copy pasted this code and imported the android.widget.Toast I still get the error that Cannot resolve method getBaseContext() Why this error, when the same code works fine in the other .java class?
has comment: http://stackoverflow.com/comment/43571050
answer count: 0
upvote count: 2
has title: cannot resolve getBaseContext() in android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43568744
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43568550
has comment: http://stackoverflow.com/comment/43568657
type: Question
score: 1

apache
tags question: http://stackoverflow.com/q/27499471
tags question: http://stackoverflow.com/q/27585622
tag name: apache
tags question: http://stackoverflow.com/q/27509247
tags question: http://stackoverflow.com/q/27481775
tags question: http://stackoverflow.com/q/27548408
tags question: http://stackoverflow.com/q/27481362
tags question: http://stackoverflow.com/q/27630507
tags question: http://stackoverflow.com/q/27606571
tags question: http://stackoverflow.com/q/27541560
tags question: http://stackoverflow.com/q/27483102
tags question: http://stackoverflow.com/q/27523175
tags question: http://stackoverflow.com/q/27631704
tags question: http://stackoverflow.com/q/27547284
tags question: http://stackoverflow.com/q/27523039
tags question: http://stackoverflow.com/q/27583478
tags question: http://stackoverflow.com/q/27499650
tags question: http://stackoverflow.com/q/27523777
tags question: http://stackoverflow.com/q/27517692
tags question: http://stackoverflow.com/q/27540986
tags question: http://stackoverflow.com/q/27483546
tags question: http://stackoverflow.com/q/27502456
tags question: http://stackoverflow.com/q/27502882
type: Tag
tags question: http://stackoverflow.com/q/27562452
tags question: http://stackoverflow.com/q/27550590
tags question: http://stackoverflow.com/q/27592293
tags question: http://stackoverflow.com/q/27482766

http://stackoverflow.com/q/27556224
has comment: http://stackoverflow.com/comment/43538844
tagged with: weblogic-10.x
answer count: 0
has title: Weblogic OutOfMemoryError when query return big results MS SQL Server
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1318354
has comment: http://stackoverflow.com/comment/43594005
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43539248
linked to: http://stackoverflow.com/q/7382486
tagged with: java
has body: I'm trying to render a list of records in a jsf page with a query that returns many records, I'm using weblogic 10.3.0.0 and sql server driver 4 from Microsoft to connect a sql server database, when I run this jsf page, this consumes a lot of memory because the query returns many record and therefore a OutOfMemoryError is occurring. I've seen that with setFetchSize you can limit the results, but here: What does Statement.setFetchSize(nSize) method really do in SQL Server JDBC driver? the microsoft's sql server driver not limit this, I used jDTS driver as the above post has suggested, but the same problem ocurre, I've also tried to use this: http://msdn.microsoft.com/en-us/library/bb879937.aspx for use adaptive buffering with the driver, but my driver version is 4 so this by default has adaptive buffering, but apparently no, I've tried this: statement = connectionDB.createStatement(); SQLServerStatement SQLstmt = (SQLServerStatement) statement; SQLstmt.setResponseBuffering("adaptive"); but this no returns results, I've put this in the connection properties also, but the problem still occure, I understand that the problem is the query have big results and the driver no execute it with chunks, and therefore the memory is decreasing, and I believe that this is the problem. I don't know who workaround use, if do the manual pagination with the query, if use another driver, etc., please help me to find a workaround, whatever info is well received, sorry for my poor english
type: Question
has comment: http://stackoverflow.com/comment/43539039
tagged with: sql-server
score: 0

http://stackoverflow.com/q/27549259
has answer: http://stackoverflow.com/a/27549822
answer count: 2
upvote count: 1
has body: my j2ee app works was developed in eclipse elios with tomcat 7 as application server. My workstation has windows 7. In a jsp i have an input text for sending mail to several user. In windows, the character like è works fine, i receive the mail and i see the è; when i deploy the war on tomcat on linux centOS, i don't see the è, but a strange character. this is the function that send email: public boolean inviaMail() throws Exception{ boolean invio=true; try { Properties props = System.getProperties(); // Setup mail server props.put("mail.smtp.host", HOST); // Get session Session session = Session.getDefaultInstance(props, null); // Define message MimeMessage message = new MimeMessage(session); message.setHeader("Content-Type", "text/html; charset=UTF-8"); message.setFrom(new InternetAddress(MITTENTE)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(userTo)); message.setSubject(OGGETTO, "UTF-8"); message.setText(testoMsg, "UTF-8"); Transport.send(message); } catch (Exception e) { invio=false; System.out.println("errore.invio.mail:" + e.getMessage()); } return invio; } i think the problem is the tomcat configuration on linux, do you have some tips for me?
tagged with: tomcat
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/27550473
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43525633
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/153527
tagged with: java
has title: trouble with character like è,à,ì in a web app that send mail with java mail
type: Question

http://stackoverflow.com/a/27613968
type: Answer
has body: Please refer to this, and start some pen work. things will be more clear. Let say array is int[] nums as below.
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/27613854
downvote count: 1

http://stackoverflow.com/comment/43490331
type: Comment
score: 3
has text: This is more appropriate as a comment than an answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/27530897

http://stackoverflow.com/comment/43394131
comment on: http://stackoverflow.com/q/27480274
has text: ok, as I said this was just a silly example to solve my real problem...how can I specify the columns too?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43658206
has text: i did not said that my database is updated. i have the same problen.
type: Comment
comment on: http://stackoverflow.com/q/27616438
score: 0
type: QuestionComment

http://stackoverflow.com/q/27506544
has comment: http://stackoverflow.com/comment/43679530
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43736720
has comment: http://stackoverflow.com/comment/43468930
tagged with: selenium-webdriver
answer count: 0
tagged with: java
has title: What should be the system configuration (for server) when my web appn need to run atleast 25 parallel selenium remotewebdriver executions?
tagged with: tomcat6
type: Question
has comment: http://stackoverflow.com/comment/43723575
tagged with: selenium-grid
score: 0
has comment: http://stackoverflow.com/comment/43816326
has body: What should be the system configuration (for server) when my web appn need to run atleast 25 parallel selenium remotewebdriver executions? Current Configuration: Windows7, 4GB RAM, 1.7 GHZ Processor, Tomcat 6, Java 7. I am facing out of memory issue if no of executions exceeds 10. Following are the commands to start HUB and NODE: java -jar selenium-server-standalone-2.32.0.jar -role hub java -jar selenium-server-standalone-2.32.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=iexplore,version=10,platform=WINDOWS,maxInstances=10,-maxSession=10, -browser browserName=chrome,platform=WINDOWS,maxInstances=10,-maxSession=10, -browser browserName=firefox,platform=WINDOWS,maxInstances=10,-maxSession=10, -Dwebdriver.ie.driver="./IEDriverServer32.exe" -Dwebdriver.chrome.driver="./chromedriver.exe" -port 5559 I starts HUB and NODE at client machine. So there are 25 client machines and a server. Following is the code to launch browser at client machine: URL hubUrl = new URL("http://10.253.**.***:4444/wd/hub"); WebDriver webDriver = new RemoteWebDriver(hubUrl, capabilities); webDriver.get(sURLToLaunch); I suspect there is need of server class machine. I will be grateful if you will give your opinion.

http://stackoverflow.com/comment/43656026
comment on: http://stackoverflow.com/q/27617344
has text: The location (and size) of the button will be determined by the layout manager when the container is validated (and laid out). What is it that you are trying to achieve?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27499650
downvote count: 0
favorite count: 0
answer count: 1
has body: I have the following as a json output, how do I convert it to a HashMap using Gson: { "result": { "haystack": [ "SvqFd", "ucR3Y", "AzVB0", "DrDQL", "gc8LQ", "JqKdK", "9ZE4g", "820gw", "ekWkr", "qgDrR", "ENpyZ", "lf4b8", "SZsUt", "YO0cQ", "CD1O0", "Rvw8t", "euSC0", "3oemT", "6bUgC", "m8pFK" ], "needle": "lf4b8" } } I tried: Type stringArrayMap = new TypeToken&lt;Map&lt;String, String[]&gt;&gt;(){}.getType(); Map&lt;String,String[]&gt; theCollection = gson.fromJson(output, stringArrayMap); Edit: Each time I get this json output,its content is unique but same structure. ANSWER Answers and suggestions below worked but I played around with those and figured something else that worked as well; Type stringStringObjectMap = new TypeToken&lt;Map&lt;String, Map&lt;String, Object&gt;&gt;&gt;(){}.getType(); Map&lt;String, Map&lt;String, Object&gt;&gt; theDictionary = gson.fromJson(output, stringStringObjectMap);
upvote count: 2
has title: Json to HashMap
linked to: http://stackoverflow.com/q/2779251
has comment: http://stackoverflow.com/comment/43430014
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/27499726
tagged with: gson
tagged with: http
type: Question
tagged with: apache
has answer: http://stackoverflow.com/a/27499726

http://stackoverflow.com/a/27498728
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: i got answer from this stack over flow post Filtering Facebook users Profile feeds by updated_time It's possible using FQL. For example, modifying an example on the Facebook Developers site, you can retrieve the current user's posts to the her wall/feed updated before December 30, 2009 at 12am EST like so: SELECT post_id, actor_id, target_id, message FROM stream WHERE source_id = me() AND updated_time &lt; 1262196000 LIMIT 50 To my knowledge you can't filter by updated_time using the Graph API.
answers question: http://stackoverflow.com/q/27498576
accepted answer of: http://stackoverflow.com/q/27498576

http://stackoverflow.com/a/27639210
has body: newsHeadlines is nothing else than a List of Element as Elements implements List. So you can iterate over the newsHeadlines the same way than you iterate over a list. for(Element element : newsHeadlines) { System.out.println(element.toString()); } If that is not what you need (I did not test the code), you can try Element.children. This gives you again Elements you can iterate over.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27638996
accepted answer of: http://stackoverflow.com/q/27638996
score: 1
upvote count: 1

http://stackoverflow.com/comment/43391306
comment on: http://stackoverflow.com/q/27478924
type: Comment
type: QuestionComment
has text: what is the name of your config xml file?
score: 0

http://stackoverflow.com/q/27619363
has body: I want to place an imageview on top of mapview/mapfragment. I have successfully placed the imageview, but there is a gap on the left and right of the screen. I want the imageview to completely cover the mapview. The resolution of the image used is 720x1280. The layout: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;fragment android:id="@+id/map" android:name="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:src="@drawable/sphere_background" /&gt; &lt;/RelativeLayout&gt; The output: Please tell me a way by which the imageview will completely cover the map from left to right.
has title: Placing imageview on top of mapfragment/ mapview
tagged with: android
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43659604
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: google-maps
tagged with: imageview
downvote count: 0
has answer: http://stackoverflow.com/a/27619771

memory-model
tag name: memory-model
type: Tag
tags question: http://stackoverflow.com/q/27566938

http://stackoverflow.com/a/27588426
answers question: http://stackoverflow.com/q/27584069
type: Answer
has body: use BorderLayout in fram.add() like this public MatrixFrame(String framname, int width, int height) { width =7; height = 6; JFrame fram = new JFrame(framname); fram.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); fram.setSize(500,500); JTextArea text = new JTextArea("Here come Text"); valMatrixPanel = new ValMatrixPanel(height,width,Color.GRAY, Color.black); JPanel pan = valMatrixPanel.getPan(); // pan is 6*7 panels lock the picture fram.add(pan,BorderLayout.WEST); fram.add(text,BorderLayout.NORTH); fram.setVisible(true); }
score: 0

http://stackoverflow.com/comment/43487958
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27529384
has text: I didnt notice that, but that doesnt matter becuase in the end it will check all the pixels so it will give the same result.
score: 0

http://stackoverflow.com/a/27625544
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27625511
has body: Either the entire string is accepted or the entire string is rejected. If you want a null group if the type of pizza does not match salami|mushrooms|cheese you could do "I want a (?:(salami|mushrooms|cheese)|(?:.*)) pizza" (?: ...) is a non-capturing group. And the |(?:.*) would be a "match anything escape hatch" to allow the entire string to be accepted (but still making group(1) null). Demo: Pattern p = Pattern.compile("I want a (?:(salami|mushrooms|cheese)|(?:.*)) pizza"); String[] tests = { "I want a salami pizza", "I want a shrimp pizza" }; for (String s : tests) { Matcher m = p.matcher(s); if (m.matches()) { System.out.println(s + ": " + m.group(1)); } } Output: I want a salami pizza: salami I want a shrimp pizza: null
answers question: http://stackoverflow.com/q/27625511
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43399343
score: 0
has text: And some comment on the Apache Commons libraries: they are more about utility, than performance.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27483350

http://stackoverflow.com/comment/43487783
score: 0
has text: it's difficult to explain, plus more my bad english... :( I'll try: I have 2 array List 1. Array List of Monster 2. Array List of ImageIcon ImageIcon save the icon that the image's name retrieve from Monster And i will save both Array ImageIcon and Monster into new 2 Dimensional array this 2 dimensional array , will be the data to Jtable *how about this, still confuse about my question.. :(
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27529190

http://stackoverflow.com/comment/43657545
comment on: http://stackoverflow.com/q/27618252
type: Comment
score: 1
has text: Do you mean that you can't create more than one object of a class in C++? Like: `Box Box; Box box;`?
type: QuestionComment

http://stackoverflow.com/q/27629976
accepted answer: http://stackoverflow.com/a/27630134
has comment: http://stackoverflow.com/comment/43680658
has body: I am in the holiday spirit, and I was thinking about writing a little countdown timer for Christmas, but ran into some difficulty that I cannot resolve. I have 2 PImage variables, one that was directly loaded from an image on the hard drive called "origbkg", while the other is the actual image that is being displayed as the background for my program. I made it this way so that if the user changes the size of the window, the image will resize correspondingly. However, when I make the window very small, and then try to maximize it again it loses resolution, although it should be getting reset to the original full resolution image that was loaded off the drive. When I have tried to display the "origbkg" on the screen, it also is getting modified for some reason when all I am doing is setting bkgimg=origbkg. Here is my code: //Christmas Countdown Clock //by: Ben Templin //============================================================ //-------------------------Variables------------------------- boolean bkgsized; String background; PImage origbkg; PImage bkgimg; int count; int psize; int size; //-------------------------Setup------------------------- void setup() { frameRate(30); smooth(); size(displayWidth-250, displayHeight-250); frame.setResizable(true); background="default"; textSize(20); fill(255, 0, 0); text("Loading Images...", width/2-100, height/2); origbkg=loadImage("Christmas-Tree.png"); bkgsized=false; bkgimg=origbkg; } //-------------------------Draw------------------------- void draw() { size=width+height; if(psize!=size){ bkgsized=false; } if(bkgsized==false){ sizebkg(); } psize=width+height; } //-------------------------Size the Background------------------------- void sizebkg() { bkgimg=origbkg; bkgimg.resize(width, height); image(bkgimg, 0, 0); bkgsized=true; } Can someone please tell me why "origbkg" is getting changed? Thanks in advance, and Merry Christmas!
has comment: http://stackoverflow.com/comment/43680568
type: Question
has comment: http://stackoverflow.com/comment/43680544
tagged with: processing
has comment: http://stackoverflow.com/comment/43680707
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43680641
has answer: http://stackoverflow.com/a/27630134
type: AnsweredQuestion
has title: Trying to resize image in Processing (PDE) language
tagged with: java

http://stackoverflow.com/comment/43452452
score: 0
type: Comment
type: QuestionComment
has text: also...why not use a switch statement instead of all the if statements?
comment on: http://stackoverflow.com/q/27511116

http://stackoverflow.com/comment/43463347
type: Comment
type: QuestionComment
has text: Hmmm I was actually trying to improve the previous code @GabeSechan
comment on: http://stackoverflow.com/q/27516470
score: 0

http://stackoverflow.com/a/27533128
type: Answer
answers question: http://stackoverflow.com/q/27532597
upvote count: 1
score: 1
downvote count: 0
has body: The parameters you are passing to stu don't match the parameters you've declared in the class. void stu(String name, String age, String school, double gpa, char letter) In you're main you've declared the variables as String. String countAge = " "; String countGPA = " "; String countName = " ", countSchool = " "; String countLetter = " "; But you then try to retrieve input for countGPA as a double. countGPA = scan.nextDouble(); You should probably declare countGPA as a double and either cast countLetter to a char or change the class method to accept it as a String.

http://stackoverflow.com/q/27599914
type: Question
has answer: http://stackoverflow.com/a/27618263
has title: getSelectedItem JComboBox with GlazedLists AutocompleteSupport Returns Null
tagged with: autocomplete
score: 0
tagged with: nullpointerexception
answer count: 1
accepted answer: http://stackoverflow.com/a/27618263
tagged with: glazedlists
tagged with: jcombobox
type: AnsweredQuestion
has body: I'm a bit new to programming so sorry if there is a few things that could have been done better My combobox is successfully filled with my string array and the auto-complete works fine. I just cant get the text in the combobox. returns java.lang.NullPointerException private ArrayList&lt;String&gt; arrRekening; private ArrayList&lt;String&gt; arrEienaar; private String[] sarrRekening; private String[] sarrEienaar; public NewConnectionPoint() { arrAccount = new ArrayList&lt;String&gt;(); arrOwner = new ArrayList&lt;String&gt;(); FillCombo(arrAccount , "Owners", "OwnerName"); FillCombo(arrOwner , "Accounts", "AccountName"); sarrOwner= arrOwner.toArray(new String[arrOwner .size()]); sarrAccount= arrAccount.toArray(new String[arrAccount.size()]); JComboBox&lt;String&gt; comboAccount = new JComboBox&lt;String&gt;(); AutoCompleteSupport&lt;String&gt; supAccount = AutoCompleteSupport.install(comboRekening, GlazedLists.eventList(Arrays.asList(sarrAccount))); supAccount.setStrict(true); JComboBox&lt;String&gt; comboOwner = new JComboBox&lt;String&gt;(); AutoCompleteSupport&lt;String&gt; supOwner = AutoCompleteSupport.install(comboOwner,GlazedLists.eventList(Arrays.asList(sarrOwner))); supOwner.setStrict(true); JButton btnShow = new JButton("ShowSelectedr"); btnShow.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { //Error occurs at this line JOptionPane.showMessageDialog(null, comboOwner.getSelectedItem().toString()); });} } //Data loaded into arraylists from a Database with sql private void FillCombo(ArrayList&lt;String&gt; ComboElements, String sTable, String sColumn){ try{ Data.changeQuery(sTable);// database connection fine returns and fills combobox while(MyData.rs.next()){ String sReturn= MyData.rs.getString(sColumn); ComboElements.add(sReturn); } }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } }
tagged with: java

http://stackoverflow.com/a/28184819
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27559963
has body: I think have solved it. Earlier I was only modifying the workspace properties only but using maven project with SVN. Maven was internally setting property of each project to use "Project Specific 1.5 java compliance" at each update. I changed each project to use workspace JDK compliance and removed project specific settings in SVN projects to prevent from future errors after code update. Thanks.
accepted answer of: http://stackoverflow.com/q/27559963

http://stackoverflow.com/a/27589453
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43603056
has body: Using your input/output pairs as the spec: String input; // the starting string String output = input.replaceAll("\\[%.*", "");
upvote count: 1
answers question: http://stackoverflow.com/q/27589417
score: 1
has comment: http://stackoverflow.com/comment/43603099

http://stackoverflow.com/comment/43616202
type: Comment
type: QuestionComment
has text: Use a [`ListSelectionListener`](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html).
comment on: http://stackoverflow.com/q/27595621
score: 0

http://stackoverflow.com/a/27632567
score: 5
type: Answer
has body: It is always redundant to use the constructor of String that accepts another String as an argument, since String is immutable, and therefore there is no point in creating a new String instance that is equal to the original instance.
upvote count: 6
answers question: http://stackoverflow.com/q/27632533
downvote count: 1
has comment: http://stackoverflow.com/comment/43687212

http://stackoverflow.com/comment/43641538
has text: @utybo, Could you elaborate on this question a bit. 1) In what sense don't you have control on the main method? 2) What are you trying to achieve by calling start?
comment on: http://stackoverflow.com/q/27606506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27521605
has comment: http://stackoverflow.com/comment/43483564
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/60146511
has comment: http://stackoverflow.com/comment/60144162
upvote count: 2
has comment: http://stackoverflow.com/comment/43483995
has body: You can use threads, in order to avoid it. Like One slave thread which will be responsible for reading. This will not halt your progress of program.
has comment: http://stackoverflow.com/comment/60105073
type: Answer
answers question: http://stackoverflow.com/q/27507004

http://stackoverflow.com/q/27483228
has comment: http://stackoverflow.com/comment/43559744
answer count: 1
has comment: http://stackoverflow.com/comment/43399164
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43404902
has comment: http://stackoverflow.com/comment/43561446
tagged with: opengl
has body: In my Opengl "Engine" i have the following method to compute all the time values, i could need in a frame: public static void computeTime(){ thisFrame = System.nanoTime(); delta = thisFrame - lastFrame; lastFrame = thisFrame; deltams = (float) (delta / 1e6); deltas = (float) (delta / 1e9); fps = (float) 1e9 / delta; ticksInSeconds += deltas; } Im calling this method at the beginning of every frame. then i use the delta values to compute movement and over things. Is this a proper way to do this? Or am I missing something in the order of the computations? Because I'm feeling like running applications are kind of lagging a bit... so it cannot be completely right, can it?
score: 0
tagged with: java
tagged with: lwjgl
type: Question
tagged with: game-loop
has title: Game Loop - Time Computation
tagged with: game-engine
has answer: http://stackoverflow.com/a/27483402
has comment: http://stackoverflow.com/comment/43399361
has comment: http://stackoverflow.com/comment/43559719
has comment: http://stackoverflow.com/comment/43563063
has comment: http://stackoverflow.com/comment/43451181

http://stackoverflow.com/comment/43432911
comment on: http://stackoverflow.com/q/27501221
score: 1
has text: sure you can append 7 digit random number to some letter to make it 8 digit random string.And `System.currentTimeMillis` does not generate random number. it just gives you current time in millis from January 1, 1970 UTC
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43452989
comment on: http://stackoverflow.com/a/27511080
type: AnswerComment
has text: I ran you command and now it has given me the following error. I am confused now because we do not create main method in the Junit test Error: Main method not found in class grand.big.small.MainTest, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
score: 0
type: Comment

http://stackoverflow.com/q/27622658
has title: @Controller not working when packaged in external jar
type: Question
has comment: http://stackoverflow.com/comment/93723167
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/77577376
has answer: http://stackoverflow.com/a/27622735
favorite count: 0
score: 2
linked to: http://stackoverflow.com/q/1242656
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has body: I have a spring web application which takes in an external jar which contains some annotated controllers in packakge com.x.y.controller. I have included com.x.y.controller package in my component scan path in spring-servlet.xml &lt;context:component-scan base-package="com.x.y.controller" /&gt;. But When I deploy the application to my local tomcat server, those controller bean in my external jar does not get created. However, when I extract the jar into my class path when I build the application(meaning having my package fully expanded into my web application class path) everything seems working fine. It seems weird to me because we also have some service classes with @component annotation in external jar. And these class seems working fine. Does anyone know if it is expected behavior of spring? Or am I missing some configuration for spring to find those controllers? Currently during development, if I change a class, changes are reflected to tomcat without rebuilding even if the class is in an external jar. If I need to extract the jar for those controllers to work, tomcat does not seem to take in changes in those controllers even if I restart the server. A rebuild is required to extract the jar again for any change to take effect. This would be very painful for development. I am relative new to spring. Does anybody see a solution for this if I have to go that way?
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/q/27537899
accepted answer: http://stackoverflow.com/a/27538195
score: 0
has title: Using a for loop to set values in jTextFields
has comment: http://stackoverflow.com/comment/43504047
has comment: http://stackoverflow.com/comment/43504348
has body: String[] words = str.split("\\+"); jTextField43.setText(words[0]); jTextField44.setText(words[1]); jTextField45.setText(words[2]); jTextField46.setText(words[3]); jTextField47.setText(words[4]); jTextField48.setText(words[5]); jTextField49.setText(words[6]); jTextField50.setText(words[7]); jTextField51.setText(words[8]); jTextField52.setText(words[9]); jTextField53.setText(words[10]); jTextField54.setText(words[11]); jTextField55.setText(words[12]); jTextField56.setText(words[13]); jTextField57.setText(words[14]); jTextField58.setText(words[15]); i want, for(int i=0;i&lt;15;i++) { jTextField[i+43].setText(words[i])); } How can I do?
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/43504560
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27538195
tagged with: java
type: Question
tagged with: for-loop
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/43574376

http://stackoverflow.com/comment/43495155
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27533335
has text: Then `max_num` needs to be changed to 10 and don't use index 0. Not the best practice, but it will work. Also, why wouldn't you use index 0?
score: 0

http://stackoverflow.com/q/27475849
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/43386571
has body: My last questions/problems are solved thank you for the advice. In which, I have another problem encountered says: java.lang.ArrayIndexOutOfBoundsException:-1 My code in updating is when click from a jtable it will be shown in a textfield, my code: &gt; try{ &gt; DefaultTableModel model= (DefaultTableModel)tbl_stud.getModel(); &gt; model.fireTableDataChanged(); &gt; int row=tbl_stud.getSelectedRow(); &gt; String tbl_click=(tbl_stud.getModel().getValueAt(row, row).toString()); &gt; String sql="Select * from students where id_num='"+tbl_click+"';"; &gt; pst=conn.prepareStatement(sql); &gt; rs=pst.executeQuery(sql); &gt; if(rs.next()){ &gt; String add1=rs.getString("id_num"); &gt; up_idnum.setText(add1); &gt; String add2=rs.getString("fname"); &gt; up_fname.setText(add2); &gt; String add3=rs.getString("mname"); &gt; up_mname.setText(add3); &gt; String add4=rs.getString("lname"); &gt; up_lname.setText(add4); &gt; &gt; String add8=rs.getString("username"); &gt; up_username.setText(add8); &gt; String add9=rs.getString("password"); &gt; up_pass.setText(add9); &gt; update_table(); &gt; } &gt; &gt; &gt; } &gt; catch(Exception o){ &gt; JOptionPane.showMessageDialog(null, o); &gt; &gt; } &gt; } but i always get that error, how can i prevent it? thank you.
type: Question
type: AnsweredQuestion
has title: Updating data in sql from jtable
score: 0
tagged with: sql-update
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/27480120
accepted answer: http://stackoverflow.com/a/27480120

http://stackoverflow.com/comment/43662565
has text: What should i do to make the image small if clicked on corner of layout instead of breaking the image?
type: AnswerComment
comment on: http://stackoverflow.com/a/27608320
score: 0
type: Comment

http://stackoverflow.com/comment/43526288
comment on: http://stackoverflow.com/q/27549969
has text: I don't see any errors. What are `X` and `O` defined as (what data type) in the `checkWin` calls and such? I'm guessing they're constants that you didn't post the declarations of?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43496186
comment on: http://stackoverflow.com/a/27507248
type: AnswerComment
score: 0
type: Comment
has text: @mangusta: I am not sure what you mean by "scale views". Do you mean `setScaleX()` and such? I have never tried that in a `Presentation`, but I would be somewhat surprised if it didn't work.

http://stackoverflow.com/q/27580647
has answer: http://stackoverflow.com/a/27582416
accepted answer: http://stackoverflow.com/a/27582416
score: 0
answer count: 2
tagged with: jstl
tagged with: jsp
possible better answer: http://stackoverflow.com/a/27580670
has title: Compare arraySize with integer
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27580670
has body: I am trying to comparer ArrayList size with integer value but it returns false. &lt;c:if test="${langages.size()&gt;2}"&gt; //code &lt;/c:if&gt; When I ${langages.size} it gives me value 4. What I am missing?
type: Question

http://stackoverflow.com/a/27608516
downvote count: 0
has comment: http://stackoverflow.com/comment/43640480
type: Answer
has comment: http://stackoverflow.com/comment/43640430
score: 2
accepted answer of: http://stackoverflow.com/q/27608337
answers question: http://stackoverflow.com/q/27608337
has comment: http://stackoverflow.com/comment/43640811
has comment: http://stackoverflow.com/comment/43640649
upvote count: 2
has body: I think the confusion lies in the fact that you can do the following: Averager avg = new Averager(); BiConsumer&lt;Averager, Integer&gt; consumer = Averager::accept; consumer.accept(avg, 17); That is although Averager::accept has a signature that says that it accepts one parameter (int i) it can be regarded as a BiConsumer&lt;Averager, Integer&gt; that accepts two arguments: A callee (a "this") and an argument (int i). Further reading: The Java™ Tutorials: Method References
type: AcceptedAnswer

http://stackoverflow.com/a/27542530
downvote count: 0
answers question: http://stackoverflow.com/q/27541560
has comment: http://stackoverflow.com/comment/43689761
has comment: http://stackoverflow.com/comment/43514988
has body: First you need to make sure that you've declared the library's imports : import org.apache.poi.xwpf.usermodel.XWPFTableCell; import org.apache.poi.xwpf.usermodel.XWPFTableRow; Then it's just like , assuming you want to format cell-0 on row-0: table.getRow(0).getCell(0).getCTTc().addNewTcPr().addNewTcW().setW(BigInteger.valueOf(2000)); Or put this snippet after creating your last row to format all cells: for(int x = 0;x &lt; table.getNumberOfRows(); x++){ XWPFTableRow row = table.getRow(x); int numberOfCell = row.getTableCells().size(); for(int y = 0; y &lt; numberOfCell ; y++){ XWPFTableCell cell = row.getCell(y); cell.getCTTc().addNewTcPr().addNewTcW().setW(BigInteger.valueOf(2000)); } } *But remember that the width of the cell will always increase to follow the length of the string.
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/43514632
score: 6
has comment: http://stackoverflow.com/comment/43515859
has comment: http://stackoverflow.com/comment/43516237
has comment: http://stackoverflow.com/comment/43523461
has comment: http://stackoverflow.com/comment/43517466
has comment: http://stackoverflow.com/comment/43516291
has comment: http://stackoverflow.com/comment/43523429
accepted answer of: http://stackoverflow.com/q/27541560
type: AcceptedAnswer

http://stackoverflow.com/comment/43502119
comment on: http://stackoverflow.com/a/27503778
score: 2
type: AnswerComment
has text: In Eclipse under "Window > Preferences > Run/Debug > Launching > VisualVM Configuration", there's another option "JDK Home". This was actually pointing to my JRE directory. Changing this to C:\Program Files\Java\jdk1.6.0_32 got it running. Now the error message makes sense. Your advice helped me figure it out. Problem solved! Thanks again!
type: Comment

http://stackoverflow.com/a/27542401
has comment: http://stackoverflow.com/comment/43512535
has body: executeUpdate() returns the number of rows altered or returns 0 in case no rows are affected, so in your case you can do something like: int alteredRows=psII.executeUpdate(); if(alteredRows==0) { System.out.println("No rows deleted"); } else { System.out.println(alteredRows +"rows deleted"); }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43513624
answers question: http://stackoverflow.com/q/27542224
has comment: http://stackoverflow.com/comment/43512798
has comment: http://stackoverflow.com/comment/43513588

http://stackoverflow.com/a/70664292
score: 3
downvote count: 0
has body: I also, faced same problem in which I have to substring first three char and fetch all accounts starting from 107 which is number. for that I have used CriteriaBuilder and substring method like below. Predicate accountNumber = criteriaBuilder.equal(criteriaBuilder.substring(from.get("accountNumber").as(String.class), 0, 3), cwipAcc); but unfortunately it is not working for CriteriaBuilder and substring. so I have used like query to resolve this issue by given code below. Predicate accountNumber = criteriaBuilder.like(from.get("accountNumber").as(String.class), String.valueOf(cwipAcc) + "%"); here, I have just fetched all the records which is starting from 107 and so on. Example: public List<GLCharts> findAccountForCWIP(Long cwipAcc, Long glInfo) { Map<String, Object> data = new HashMap(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<GLCharts> criteriaQuery = criteriaBuilder.createQuery(GLCharts.class); Root<GLCharts> from = criteriaQuery.from(GLCharts.class); Predicate accountNumber = criteriaBuilder.like(from.get("accountNumber").as(String.class), String.valueOf(cwipAcc) + "%"); Predicate glCompanyInfo = criteriaBuilder.equal(from.join("gLCompanyInfo").get("id"), glInfo); Predicate finalPredicate = criteriaBuilder.and(accountNumber, glCompanyInfo); criteriaQuery.select(from).where(finalPredicate).orderBy(Stream.of(criteriaBuilder.asc(from.get("accountNumber"))).collect(Collectors.toList())); List<GLCharts> glChartsList = entityManager.createQuery(criteriaQuery).getResultList(); return glChartsList; }
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/27620400

http://stackoverflow.com/comment/43682202
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27630501
type: AnswerComment
has text: In java, the only operator that will call a function is +, which calls toString() when used as a concatenation operator. There is no other operator overloading in java.

http://stackoverflow.com/comment/43476540
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27523683
has text: Not the downvoter, but are you sure the OP wants `tab` to be a diagonal matrix?
type: Comment

http://stackoverflow.com/a/27611891
type: AcceptedAnswer
has body: The file that was missing to be copied over from the archetype to the new project was stories/my.story. Even though the error is about something else, I was able to get this error to go away when I copied over the my.story file: [INFO] --- jbehave-maven-plugin:3.9.5:run-stories-as-embeddables (embeddable-stories) @ followerdownloader-frontend --- [INFO] Running stories as embeddables using embedder Embedder[storyMapper=StoryMapper,storyRunner=StoryRunner,embedderMonitor=MavenEmbedderMonitor,classLoader=EmbedderClassLoader[urls=[/Users/mosofsky/Developer/FollowerDownloader/followerdownloader-frontend/target/classes/, appengine-api-1.0-sdk-1.9.17.jar, servlet-api-2.5.jar, jstl-1.2.jar, jbehave-core-3.9.5.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.1.jar, commons-io-2.4.jar, commons-lang-2.6.jar, plexus-utils-3.0.10.jar, freemarker-2.3.19.jar, paranamer-2.4.jar, xstream-1.4.5.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar],parent=ClassRealm[plugin&gt;org.jbehave:jbehave-maven-plugin:3.9.5, parent: sun.misc.Launcher$AppClassLoader@6da21389]],embedderControls=UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]],embedderFailureStrategy=&lt;null&gt;,configuration=org.jbehave.core.configuration.MostUsefulConfiguration@2b37d486,candidateSteps=&lt;null&gt;,stepsFactory=&lt;null&gt;,metaFilters=[],systemProperties=&lt;null&gt;,executorService=&lt;null&gt;,executorServiceCreated=false,storyManager=&lt;null&gt;] [INFO] Found class names: [com.netbase.jbehaveexample.MyStories] [INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeoutInSecs=300,failOnStoryTimeout=false,threads=1]] [INFO] Runnin…
type: Answer
has comment: http://stackoverflow.com/comment/45175719
accepted answer of: http://stackoverflow.com/q/27611890
answers question: http://stackoverflow.com/q/27611890
score: 0

http://stackoverflow.com/q/27503823
accepted answer: http://stackoverflow.com/a/27503902
has comment: http://stackoverflow.com/comment/43438186
has comment: http://stackoverflow.com/comment/43437723
upvote count: 3
has answer: http://stackoverflow.com/a/27503902
answer count: 3
has body: How to store webelement in webelement list? I have created list for webelement and passing webelement obj in add method, but system display null exception. Java Code: List&lt;WebElement&gt; element=null; and in for loop i am passing webelement obj in add method like: WebElement we = driver...("test"); element.add(0,we); Why I am getting null pointer exception (java.lang.NullPointerException)? I would appreciate your inputs. public void test(){ List&lt;WebElement&gt; element = null; int rows=1; for(int i=1; i&lt;=rows;i++){ text=driver.findElement(By.xpath("//*[@id='testid']/table/tbody/tr["+i+"]/td/p")).getText(); if(!text.equals("")){ for(int j=1;j&lt;=rows;j++){ if(isElementPresent(driver, By.xpath("//*[@id='testid']/table/tbody/tr["+(j+1)+"]/td[6]/a"))){ WebElement we =driver.findElement(By.xpath("//*[@id='testid']/table/tbody/tr["+(j+1)+"]/td[6]/a")); element.add(we); rows++; } } }else{ break; } } for(WebElement we:element){ we.click(); } } Thanks,
has comment: http://stackoverflow.com/comment/43438821
downvote count: 1
has comment: http://stackoverflow.com/comment/43438726
has answer: http://stackoverflow.com/a/66144487
favorite count: 0
has title: Selenium webdriver store webelement in webelement list
tagged with: selenium-webdriver
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27504151
tagged with: java
has comment: http://stackoverflow.com/comment/43439069
has comment: http://stackoverflow.com/comment/43438508
possible better answer: http://stackoverflow.com/a/27504151
type: Question

nullpointerexception
tags question: http://stackoverflow.com/q/27508188
tags question: http://stackoverflow.com/q/27581876
tags question: http://stackoverflow.com/q/27481908
tags question: http://stackoverflow.com/q/27567356
tags question: http://stackoverflow.com/q/27505137
tags question: http://stackoverflow.com/q/27583785
tags question: http://stackoverflow.com/q/27599914
tags question: http://stackoverflow.com/q/27476901
tags question: http://stackoverflow.com/q/27529120
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/27494222
tags question: http://stackoverflow.com/q/27517420
tags question: http://stackoverflow.com/q/27600309
tags question: http://stackoverflow.com/q/27577371
tags question: http://stackoverflow.com/q/27592861
tags question: http://stackoverflow.com/q/27557998
tags question: http://stackoverflow.com/q/27595378
tags question: http://stackoverflow.com/q/27572597
tags question: http://stackoverflow.com/q/27560449
tags question: http://stackoverflow.com/q/27502393
tags question: http://stackoverflow.com/q/27497570
tags question: http://stackoverflow.com/q/27477831
tags question: http://stackoverflow.com/q/27639732
tags question: http://stackoverflow.com/q/27570819
tags question: http://stackoverflow.com/q/27541032
tags question: http://stackoverflow.com/q/27497177
tags question: http://stackoverflow.com/q/27614648
tags question: http://stackoverflow.com/q/27484495
tags question: http://stackoverflow.com/q/27626652
tags question: http://stackoverflow.com/q/27630131
tags question: http://stackoverflow.com/q/27498954
tags question: http://stackoverflow.com/q/27537481
tags question: http://stackoverflow.com/q/27520586
tags question: http://stackoverflow.com/q/27581429
tags question: http://stackoverflow.com/q/27628613

http://stackoverflow.com/a/27564818
has body: final on parameter will prevent code inside method to rewrite it. Rewriting parameter values is bad practice since it's very difficult to maintain such code.
has comment: http://stackoverflow.com/comment/43610183
has comment: http://stackoverflow.com/comment/43600513
answers question: http://stackoverflow.com/q/27564760
has comment: http://stackoverflow.com/comment/43600451
score: 0
type: Answer

http://stackoverflow.com/comment/43489817
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27530383
has text: Thanks for the replies. I am actually writing this to be added to an existing application, which is why I am outputting a `String` instead of a `StringBuilder`. I didn't think this would make a whole lot of difference. I was just curious to see if the 2 `if` statements would logically take longer than the `if-else`.

http://stackoverflow.com/comment/43602389
score: 0
type: Comment
has text: then I click ctrl+o I see only Object methods
type: AnswerComment
comment on: http://stackoverflow.com/a/27588790

jtable
tags question: http://stackoverflow.com/q/27537923
tags question: http://stackoverflow.com/q/27517401
tags question: http://stackoverflow.com/q/27595621
tags question: http://stackoverflow.com/q/27616206
tags question: http://stackoverflow.com/q/27546977
tags question: http://stackoverflow.com/q/27509933
tags question: http://stackoverflow.com/q/27530062
tags question: http://stackoverflow.com/q/27495624
tags question: http://stackoverflow.com/q/27511528
tags question: http://stackoverflow.com/q/27500712
type: Tag
tags question: http://stackoverflow.com/q/27545702
tags question: http://stackoverflow.com/q/27542256
tags question: http://stackoverflow.com/q/27587569
tag name: jtable
tags question: http://stackoverflow.com/q/27555582
tags question: http://stackoverflow.com/q/27514393
tags question: http://stackoverflow.com/q/27496287
tags question: http://stackoverflow.com/q/27498475
tags question: http://stackoverflow.com/q/27632103
tags question: http://stackoverflow.com/q/27582207
tags question: http://stackoverflow.com/q/27602622
tags question: http://stackoverflow.com/q/27607304
tags question: http://stackoverflow.com/q/27634161
tags question: http://stackoverflow.com/q/27525019
tags question: http://stackoverflow.com/q/27580113
tags question: http://stackoverflow.com/q/27616123

http://stackoverflow.com/comment/43564371
has text: in that case, you are out of luck. If it is not synchronized, you won't see the changes made in another thread, until the cpu caches are flushed, which may never happen. I'll say it again: perhaps, it is declared as private for a reason. You are not supposed to be accessing that field.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27568058
score: 1

http://stackoverflow.com/a/27587351
downvote count: 0
has comment: http://stackoverflow.com/comment/43608888
has comment: http://stackoverflow.com/comment/43608626
has comment: http://stackoverflow.com/comment/43600024
upvote count: 2
type: AcceptedAnswer
has body: The key is to notice repetitive patterns in your code and factor it out. You could use a helper method to print a series of N characters: public static void printNTimes(char value, int n) { for (int i = 0; i &lt; n; i++) { System.out.print(value); } } You can generalize the approach by using constants for the characters involved and the size of the diamond. private static final char OuterChar = '*'; private static final char InnerChar = ' '; private static final int Size = 10; And add another helper method to print a row with N instances of one character on the outside, and 2 * (Size - N) characters on the inside: private static void printRow(int n) { printNTimes(OuterChar, n); printNTimes(InnerChar, (Size - n) * 2); printNTimes(OuterChar, n); System.out.println(); } Your code then becomes: public class diamond { private static final char OuterChar = '*'; private static final char InnerChar = ' '; private static final int Size = 10; public static void printNTimes(char value, int n) { for (int i = 0; i &lt; n; i++) { System.out.print(value); } } private static void printRow(int n) { printNTimes(OuterChar, n); printNTimes(InnerChar, (Size - n) * 2); printNTimes(OuterChar, n); System.out.println(); } public static void main(String[] args) { for (int c = Size; c &gt;= 1; c--) { printRow(c); } for (int c = 2; c &lt;= Size; c++) { printRow(c); } } }
accepted answer of: http://stackoverflow.com/q/27587309
has comment: http://stackoverflow.com/comment/43602919
answers question: http://stackoverflow.com/q/27587309
type: Answer
score: 2

http://stackoverflow.com/comment/43490876
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27531092
has text: I edited question, add FrmServer class

http://stackoverflow.com/comment/43434024
type: Comment
comment on: http://stackoverflow.com/a/27501830
has text: Pleasem can you show me a simple code snippet for my previos example?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27545324
linked to: http://stackoverflow.com/q/3615721
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27545389
has body: I got an example to override the toString() method. import java.util.Scanner; public class Demo{ String name = ""; String age = ""; Demo(String name, String age){ this.name = name; this.age = age; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the name:"); String name = scanner.next(); System.out.print("Enter the age:"); String age = scanner.next(); Demo test = new Demo(name, age); System.out.println(test); } public String toString() { return ("Name=&gt;" + name + " and " + "Age=&gt;" + age); } } My doubt is, how is it printing test as Name=>abc and Age=>12 even when toString() method is not being called neither from constructor nor from main?
has answer: http://stackoverflow.com/a/27545389
accepted answer: http://stackoverflow.com/a/27545367
has comment: http://stackoverflow.com/comment/43517267
duplicate of: http://stackoverflow.com/q/3615721
answer count: 4
favorite count: 0
tagged with: java.util.scanner
tagged with: constructor
has answer: http://stackoverflow.com/a/27545457
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/27545367
has answer: http://stackoverflow.com/a/27545427
tagged with: tostring
has title: When is toString() method called
type: AnsweredQuestion

http://stackoverflow.com/q/27595621
upvote count: 0
has answer: http://stackoverflow.com/a/27596583
accepted answer: http://stackoverflow.com/a/27596583
tagged with: mouselistener
tagged with: java
has body: i am making a point of sale system and i have two tables here, tableOne and tableTwo. what i want to do is click a row in tableOne and it will appear in tableTwo but i have an error on my console "java.lang.ArrayIndexOutOfBoundsException: 4 &gt;= 4" my code works fine, when that error shows on my console i just continue clicking the rows and it works. How can i remove the error? // row,col is the row and column in tableOne ( Where we will get the data ) // trow,trow is the row and column in tableTwo ( Where we will put the data ) public void tebel(){ table.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e){ if(e.getClickCount() == 2) { target = (JTable)e.getSource(); int row = target.getSelectedRow(); int col= 0; int trow = 0; int tcol = 0; if(row&gt;=0){ while(tcol&lt;=tableOne.getColumnCount()){ tableTwo.setValueAt(tableOne.getValueAt(row,col),trow,tcol); col++; tcol++; if(tcol==tableOne.getColumnCount()){ trow++; } } } } } }); }
tagged with: swing
type: Question
tagged with: jtable
has comment: http://stackoverflow.com/comment/43616202
answer count: 1
favorite count: 0
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/43615112
has title: JTable Mouse Listener Mouse Adapter
type: AnsweredQuestion

http://stackoverflow.com/q/27618325
has body: I am using a backslash as an escape character for a serialization format I am working on. I have it as a constant but IntelliJ is underlining it and highlighting it red. On hover it gives no error messages or any information as to why it does not like it. What is the reason for this and how do I fix it?
tagged with: intellij-idea
downvote count: 0
tagged with: backslash
score: 6
has comment: http://stackoverflow.com/comment/43657873
favorite count: 0
has comment: http://stackoverflow.com/comment/43657783
possible better answer: http://stackoverflow.com/a/41862822
upvote count: 6
has answer: http://stackoverflow.com/a/41862822
has comment: http://stackoverflow.com/comment/43657851
has comment: http://stackoverflow.com/comment/43657897
has answer: http://stackoverflow.com/a/27618471
has title: Underlined backslash IntelliJ
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43657858
accepted answer: http://stackoverflow.com/a/27618471
tagged with: java
has comment: http://stackoverflow.com/comment/43657782
type: Question
answer count: 2

http://stackoverflow.com/comment/43509610
type: Comment
type: QuestionComment
has text: In general yes and more. A few concepts have been superseded by others. You can find a migration guide here: http://uima.apache.org/d/uimaj-2.6.0/overview_and_setup.html#ugr.project_overview_changes_from_previous
comment on: http://stackoverflow.com/q/27507742
score: 0

http://stackoverflow.com/comment/44272886
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/68795/discussion-between-subh-and-njf).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27505018

http://stackoverflow.com/q/27602572
has answer: http://stackoverflow.com/a/27612747
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/43676550
tagged with: java
tagged with: sliding-window
type: Question
has title: Implementation sliding time window in Java
has body: I have a csv file in the following structure: time (milliseconds), "x", "y", "z" 1389776970139,"-0.042138","0.0531513","8.28537" ........ 1389776970833,"-0.0124942","-0.00338816","0.704891" I have used an ArrayList to save each data set (time,x,y,z) of the csv file as an object. Now I want to compute the average of x, y, z seperately within a sliding time window of two seconds with one second overlapping. I hope my question straightforward, if not please let me know, in order to rephrase my question. Im absolutely new to Java and I dont have any idea how the realize such a idea. I would be very grateful for any ideas. Thanks in advance!!! best regards, michael
has comment: http://stackoverflow.com/comment/43628730
has comment: http://stackoverflow.com/comment/43630877
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43628173

http://stackoverflow.com/comment/43656699
comment on: http://stackoverflow.com/a/27617081
score: 0
type: AnswerComment
type: Comment
has text: `readlink -f /home/ubuntu/Desktop/bin` gives `/home/ubuntu/Desktop/bin`

http://stackoverflow.com/a/27568671
has comment: http://stackoverflow.com/comment/43562653
accepted answer of: http://stackoverflow.com/q/27568633
has comment: http://stackoverflow.com/comment/43564160
has comment: http://stackoverflow.com/comment/43563303
has comment: http://stackoverflow.com/comment/43562792
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27568633
upvote count: 8
has comment: http://stackoverflow.com/comment/43563056
type: Answer
has body: Change javaType="boolean" to java.lang.Boolean and specify property="available" &lt;result property="available" column="is_available" property="available" javaType="java.lang.Boolean" jdbcType="VARCHAR" typeHandler="BooleanHandler"/&gt; In your class change private boolean available; to private Boolean isAvailable; and add getter/setter public void setIsAvailable(Boolean available) { this.available = available; } public Boolean getIsAvailable() { return available; }
score: 8
has comment: http://stackoverflow.com/comment/43565289
has comment: http://stackoverflow.com/comment/43564022

http://stackoverflow.com/comment/43559253
score: 0
has text: Yes, but i want to increase this time without affecting the performance
comment on: http://stackoverflow.com/q/27565818
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43438190
comment on: http://stackoverflow.com/q/27503990
score: 0
type: QuestionComment
type: Comment
has text: if i remove the setValue it will be immutable but still having errors and im trying to find a way to create objects in the second class is there any way for it?

http://stackoverflow.com/q/27490860
type: Question
has comment: http://stackoverflow.com/comment/43413471
tagged with: java
accepted answer: http://stackoverflow.com/a/27491075
has comment: http://stackoverflow.com/comment/43413385
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43413517
tagged with: tomcat
favorite count: 0
has title: Tomcat is creating but not logging to file
has body: I'm trying to log to a file using doc - http://tomcat.apache.org/tomcat-7.0-doc/logging.html Here is my logging.properties at tomcat_home/conf # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler ############################################################ # Handler specific properties. # Describes specific configuration info for Handlers. ############################################################ 1catalina.org.apache.juli.FileHandler.level = FINE 1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 1catalina.org.apache.juli.FileHandler.prefix = catalina. 2localhost.org.apache.juli.FileHandler.level = FINE 2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 2localhost.org.apache.juli.FileHandler.prefix = localhost. 3manager.org.apache.juli.FileHandler.level = FINE 3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 3manager.org.apache.juli.FileHandler.prefix = manager. 4host-manager.org.apache.juli.FileHandler.level…
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43413477
has answer: http://stackoverflow.com/a/27491075
upvote count: 2
has comment: http://stackoverflow.com/comment/43413437
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/43413321

http://stackoverflow.com/comment/43556840
type: QuestionComment
comment on: http://stackoverflow.com/q/27565266
has text: use `lib` mentioned in this post (http://stackoverflow.com/a/10600116/2749470)
score: 0
type: Comment

http://stackoverflow.com/q/27576926
type: Question
tagged with: encoding
score: 0
accepted answer: http://stackoverflow.com/a/27577007
answer count: 1
has title: Decoding and Encoding using BASE64 in java
has body: I am encountering erroneous results while trying to encode and decode a string read from a file on disk. I am using the following code to decode and then encode : byte[] word_bytes = new BASE64Decoder().decodeBuffer(word); //word is string variable String tempStr = new BASE64Encoder().encode(word_bytes); On the basis of this code, I was expecting that if I print "word" and "tempStr", I should see the same result. However, the values are different. For example, if word = "hi!", then tempStr = "hi//" and all single letter words get converted to null values. For example, if word = "a", then tempStr = "". The file on disk is in UTF-8 encoding. It would be very helpful if someone can explain the cause of this error. sorry if this is very basic question, I don't have much prior experience with encoding formats. Thanks
has answer: http://stackoverflow.com/a/27577007
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27518510
upvote count: 1
tagged with: web-services
type: Question
score: 1
tagged with: java
tagged with: jersey
downvote count: 0
has title: Jersey consumes json, throw No content to map to Object due to end of input
has body: when I use Jersey consumes json, I got the following exception: java.io.EOFException: No content to map to Object due to end of input at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2173) at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2106) at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1004) at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:410) Here is my web.xml com.sun.jersey.api.json.POJOMappingFeature true Here is my jersey version com.sun.jersey:jersey-server:1.8 com.sun.jersey:jersey-client:1.8 com.sun.jersey:jersey-json:1.8 Here is my java code @POST @Path("/save-coming-call-info") @Consumes(value = MediaType.APPLICATION_JSON) @Produces(value = MediaType.APPLICATION_JSON) public ComingCallInfo saveComingCallInfo(ComingCallInfo comingCallInfo) { comingCallInfo.setComingPhoneNo("234"); return comingCallInfo; } POJO public class ComingCallInfo { private String phoneRecordFileId; private String comingPhoneNo; private String suiluData; //...get and set } Here is jquery post var url=""; var comingCallInfo = new Object(); comingCallInfo.comingPhoneNo = comingPhoneNo; comingCallInfo.suiluData = suiluData comingCallInfo.phoneRecordFileId = phoneRecordFileId; $.ajax({ url : url, type : 'POST', data : JSON.stringify(comingCallInfo), dataType : 'json', contentType : "application/json; charset=utf-8", success : function(data, status, xhr) { }, error : function(data, status, xhr){ } }); could anyone can tell me why the exception throw, and what should I change.
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43527588
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27550447
has text: It looks to me like its part of the magic to call private functions while serialization/deserialization. Any official documentation?
type: AnswerComment

http://stackoverflow.com/comment/43630213
type: QuestionComment
type: Comment
has text: Maybe, there is an inject.Error in your stacktrace. What happens if you build this on TomEE?
comment on: http://stackoverflow.com/q/27603853
score: 0

http://stackoverflow.com/comment/43413491
type: Comment
type: QuestionComment
has text: @AbhishekGarg Still too broad as your code doesn't demonstrate an actual issue as it isn't code. And you're still requesting code.
score: 0
comment on: http://stackoverflow.com/q/27490533

http://stackoverflow.com/comment/43586276
comment on: http://stackoverflow.com/q/27580703
score: 0
type: Comment
type: QuestionComment
has text: I just want to make sure my intention of sealing this package is not jeopardized by someone else. I am thinking about things like signing, and Naruto mentioned that, too. Pardon me if this is a dumb question because I just move to Java platform.

http://stackoverflow.com/q/27504360
tagged with: jpasswordfield
has comment: http://stackoverflow.com/comment/43438770
downvote count: 2
has body: I want to make a simple Java program that reveals a password copied from a browser or another application that is hidden in the form of asterisks. I wrote some code but it doesn't work! When I copy the password from Facebook password field for example, and paste it to the JPasswordField on my program. And then transform it to normal text, it shows me wrong output (in fact, it gives me my class name which is weird) However, when I copy any normal text and paste it into the JPasswordField and then get the text, it gives the correct normal text back! So why isn't it working? I'm sorry if my question seems stupid a little. I'm new to programming and especially with practical programs. How can I make it work? :D Thanks in advance, Here's the code: class PasswordViewer extends JFrame { JPasswordField field = new JPasswordField(20); JButton btn = new JButton("OK"); JPanel panel = new JPanel(); char[] s; PasswordViewer() { setSize(300, 300); panel.add(field); panel.add(btn); setDefaultCloseOperation(EXIT_ON_CLOSE); add(panel); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { s = field.getPassword(); findPass(); } }); } void findPass() { String str = ""; for (int i = 0; i &lt; s.length; i++) { str += s[i]; } JOptionPane.showMessageDialog(null, str, "PasswordViewer", JOptionPane.INFORMATION_MESSAGE); } public static void main(String[] args) { PasswordViewer passview = new PasswordViewer(); passview.setVisible(true); } }
has comment: http://stackoverflow.com/comment/43438871
has comment: http://stackoverflow.com/comment/43438738
has comment: http://stackoverflow.com/comment/43438908
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27514807
tagged with: java
has comment: http://stackoverflow.com/comment/43438740
has comment: http://stackoverflow.com/comment/43438892
has comment: http://stackoverflow.com/comment/43439512
type: Question
upvote count: 4
answer count: 1
has title: Java Program That Reveals Hidden Password
favorite count: 0
has answer: http://stackoverflow.com/a/27514807
has comment: http://stackoverflow.com/comment/43438861
has comment: http://stackoverflow.com/comment/43442444
has comment: http://stackoverflow.com/comment/43467768
score: 2

http://stackoverflow.com/comment/43453067
comment on: http://stackoverflow.com/a/27511066
score: 0
type: AnswerComment
type: Comment
has text: it works.. but everytime i re-run the program add a new entry.. only the entries that i add are in the file.. and the previous entries are gone.. is there a way to retain the old entries?

http://stackoverflow.com/comment/134931396
type: Comment
has text: An empty ` ` made it work for me.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27553395

http://stackoverflow.com/q/27604724
has comment: http://stackoverflow.com/comment/53597896
has answer: http://stackoverflow.com/a/27604749
has answer: http://stackoverflow.com/a/27604773
has answer: http://stackoverflow.com/a/30871321
possible better answer: http://stackoverflow.com/a/27604749
has comment: http://stackoverflow.com/comment/43631526
downvote count: 1
accepted answer: http://stackoverflow.com/a/27604759
has title: Short java if else if else statement
type: AnsweredQuestion
score: 3
tagged with: if-statement
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27605272
has body: I have a if else short statement as follows: (one == two) ? "do this" : "do this" Is there anyway to add an if else into this statement? I can't seem to find anything with an if else... I'm being specific to the short statement, as opposed to do if if else else longhand. Thanks.
has answer: http://stackoverflow.com/a/32881537
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/27604759

http://stackoverflow.com/a/27625177
answers question: http://stackoverflow.com/q/27625139
has body: You are getting the ASCII equivalent of (byte) 2 (or "Start of Text"). Like, System.out.println((char) ((byte) 2)); and that is an unprintable character.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/27495495
has comment: http://stackoverflow.com/comment/43450010
answers question: http://stackoverflow.com/q/27495153
score: 0
has body: you have a location for your camera (cameraX,cameraY) but nothing for the player? just create a location for player (playerX,playerY) change the paint like: public void paint(Graphics g) { super.paint(g); // drawing the game-level and player g.translate((int)cameraX, (int)cameraY); world.paint(g); g.translate((int)playerX, (int)playerY); player.paint(g); g.translate(-(int)(playerX+cameraX), -(int)(playerY+cameraY)); } and when player come near borders don't move camera and only player.
type: Answer
has comment: http://stackoverflow.com/comment/43422934

http://stackoverflow.com/comment/43628488
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27598529
has text: Thank you for your comment @ Jprogrammer
type: AnswerComment

http://stackoverflow.com/comment/43579906
has text: Are you familiar with generics ? Of course you will get a compile error and need to rewrite the `compareTo` method, but after that it will be much cleaner
comment on: http://stackoverflow.com/a/27577319
type: AnswerComment
type: Comment
score: 1

private
tags question: http://stackoverflow.com/q/27487901
tags question: http://stackoverflow.com/q/27482579
type: Tag
tags question: http://stackoverflow.com/q/27581595
tag name: private

http://stackoverflow.com/comment/43511431
has text: Which phone are you using? How many cores does it have?
comment on: http://stackoverflow.com/q/27541989
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27486163
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27487132
tagged with: concurrency
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43404374
tagged with: executorservice
has answer: http://stackoverflow.com/a/27487132
has body: We can provide a BlockingQueue implementations while defining ThreadPoolExecutors. However, if I use the factory (Executors) to create a single thread pool as shown below, I would like to know which blocking queue is used. I am guessing it is a LinkedBlockingQueue. The documentation talks about unbounded queue, but it does not reveal the implementation. ExectorService service = Executors.newSingleThreadExecutor();
tagged with: executors
upvote count: 1
has title: Data structure inside Executors

http://stackoverflow.com/comment/43442202
type: QuestionComment
score: 2
has text: Are you interested in "which bit of the JLS prohibits this" or "why was the language designed this way"?
comment on: http://stackoverflow.com/q/27506053
type: Comment

http://stackoverflow.com/a/27524691
accepted answer of: http://stackoverflow.com/q/27524048
answers question: http://stackoverflow.com/q/27524048
has body: Given that your data is actually quite small I think that an XML/JSON solution will be appropriate. As to including static data files in your apk Android provides easy solutions. Arbitrary assets can be included in the same way as graphics etc. You can use the raw directory for resources of this type. This link should help you with that. As for tools if you are unfamiliar with both it seems the Android Studio is the way of the future so use that - it is reliable and pretty solid on Windows.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43593769
score: 1
upvote count: 1

http://stackoverflow.com/q/27590669
type: Question
tagged with: comparator
has comment: http://stackoverflow.com/comment/43605144
answer count: 2
has title: How to sort all fields in an object using only one Comparator?
favorite count: 0
has body: How to sort all fields in an object using a single comparator? Ex: If I have an Employee object with three fields such as Name, Eid and Salary. Instead of writing three comparators i.e. Namecomparator, Eidcomparator and Salarycomparator for sorting, I need only only one comparator that can sort based on the filed I provide dynamically.
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27590705
has comment: http://stackoverflow.com/comment/43605174
downvote count: 1
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27590711

http://stackoverflow.com/q/27603527
has answer: http://stackoverflow.com/a/27603689
tagged with: instance
has body: I have my main class CalculatorGUI.java and my second class KeyHandler.java. If I create instance of my main class in external class (e.g. CalculatorGUI one = new CalculatorGUI();), I get: Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError Why is that? I have to make this instance to use variables from y main GUI class. Here is my CalculatorGUI class: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package gui; /** * * @author Michał */ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.*; public class CalculatorGUI extends javax.swing.JFrame { public CalculatorGUI() { initComponents(); } private String value = ""; public void symbolControl(String s) { //String str = String.valueOf(s); boolean result; result = value.endsWith(s); if (result == true) { int length = value.length(); value = value.substring(0, length - 1); } } public void setValue(String s) { value = s; } public String getValue() { return value; } public void print(JButton b) { value = value + b.getText(); jTextField1.setText(value); } KeyHandler keyboard = new KeyHandler(); /** * 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() { jTextField1 = new javax.swing.JTextField(); one = new javax.swing.JButton(); two = new javax.swing.JButton(); three = new javax.swing.JButton(); four = new javax.swing.JButton(); five = new javax.swing.JButton(); six = new javax.swing.JButton(); seven = new javax.swing.JButton(); eight = new javax.swing.JButton(); nine = new javax.swing.JButton(); zero = new javax…
score: 1
linked to: http://stackoverflow.com/q/8498147
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27603689
tagged with: class
answer count: 1
downvote count: 0
tagged with: stack-overflow
favorite count: 0
has title: I get StackOverflow error when I create new instance in external class

http://stackoverflow.com/q/27629929
score: 0
tagged with: annotations
answer count: 1
tagged with: java
tagged with: javascript
tagged with: vaadin
has body: I try to add js file to output html code in vaadin7.4.13+maven project. I know that it is possible to use vaadin://... protocol which is translated to /VAADIN/ directory. Now I know that this isn't the only one trick it can be used there because I've seen some other protocols being used in @JavaScript annotation but I cannot recall them. Please help me with this. vaadin:// ???:// ???:// ...
has answer: http://stackoverflow.com/a/27630095
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/27630095
has title: list of vaadin's special path variables @JavaScript(value = { "vaadin://...", "???://..." }

http://stackoverflow.com/comment/43635779
type: AnswerComment
comment on: http://stackoverflow.com/a/27606692
type: Comment
has text: Well, either way you have to read the user's choice as a String and then go from there. You can make it as complex as you want. Also be sure to have a catch all action that if you don't understand what the user wants, allow the user to re-enter a command
score: 0

http://stackoverflow.com/a/27586197
answers question: http://stackoverflow.com/q/27576005
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43597786
type: Answer
upvote count: 1
score: 1
has body: It reloads the entity after storing it, and by default it only loads a shallow copy of related information. you can use template.fetch(role.users) or template.fetch(role.tasks) or add @Fetch to the tasks list for instance.
accepted answer of: http://stackoverflow.com/q/27576005
downvote count: 0

http://stackoverflow.com/q/27529130
type: Question
tagged with: dependency-injection
tagged with: guice
score: 0
tagged with: inversion-of-control
has comment: http://stackoverflow.com/comment/43486869
has comment: http://stackoverflow.com/comment/43487041
has body: This is my main class: static Logger logger; static StringUtils stringUtils; //java -cp ... &lt;VM argument&gt; main.class.Name &lt;program arguments&gt; public static void main(String... args) throws ClassNotFoundException, IOException { logger = InjectorSingleton.getInstance().guiceInjector.getInstance(Logger.class); stringUtils = InjectorSingleton.getInstance().guiceInjector.getInstance(StringUtils.class); } This is my Module class: public class AppInjector extends AbstractModule { @Override protected void configure() { bind(Logger.class); } } My Logger class is: public class Logger { private StringUtils stringUtils; public boolean isDebug; @Singleton @Inject public Logger(StringUtils stringUtils) { this.stringUtils = stringUtils; setIsVerbose(); } public class StringUtils { Logger logger; @Singleton @Inject public StringUtils(Logger logger) { this.logger = logger; } I run the main class and get this exception: 1) Tried proxying com.w.monitoring.headlessclient.utils.Logger to support a circular dependency, but it is not an interface. while locating com.w.monitoring.headlessclient.utils.Logger for parameter 0 at com.w.monitoring.headlessclient.utils.StringUtils.&lt;init&gt;(StringUtils.java:21) while locating com.w.monitoring.headlessclient.utils.StringUtils for parameter 0 at com.w.monitoring.headlessclient.utils.Logger.&lt;init&gt;(Logger.java:14) while locating com.w.monitoring.headlessclient.utils.Logger 1 error at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1014) at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1040) I changed the config to: @Override protected void configure() { bind(Logger.class).toInstance(new Logger()); } but how should I init the specific instance (missing args to the ctor) What should I fix in the guice config method?
type: UnansweredQuestion
tagged with: logging
has title: Tried proxying com.w.monitoring.headlessclient.utils.Logger to support a circular dependency, but it is not an interface
answer count: 0
tagged with: java

http://stackoverflow.com/q/27532309
tagged with: jvm
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: maven
has title: Test against multiple JVM or library versions during Maven build?
score: 2
tagged with: java
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/43562236
downvote count: 0
has body: Context Basically, I have a library that is used in several applications running on java 6, java 7 and now java 8. The library also has a dependency on a creepy (yet very useful) third party library (which I won't name) - a library that doesn't care a lot about forward-compatibility. The aforementioned applications also make heavy use of this third party library but are not always able to update to the latest version. I'm used to it, so I have a lot of "if" in my code dealing with silly things. Problem Today I stumbled upon an annoying problem: some method in the third party library has a different behavior when running in java 7 and earlier than when running in java 8 and later. My unit tests were designed to cover this part of my code and would have spotted the bug if they were run with the correct java / library combination. Question 1 How can I integrate nicely in the maven build lifecycle and run my tests sequentially with java 6, java 7 and java 8? (which implies failing if any test fails with any jvm) Question 2 Same as above but adding another sequential run with each "supported" version of the third party library ? (which means, to be clear, that, if I "support" version 6.11, 6.12, 6.13 and 6.14 of this lib with all 3 java versions, I will run 4*3=12 times my unit tests)
has answer: http://stackoverflow.com/a/27537582
answer count: 1
has comment: http://stackoverflow.com/comment/43493929

http://stackoverflow.com/comment/43498051
score: 0
type: AnswerComment
has text: restarted the eclipse after doing this?
comment on: http://stackoverflow.com/a/27534600
type: Comment

http://stackoverflow.com/comment/43555745
has text: You should understand difference between reference, reference name and object. Once again reference names do not mean equality of objects.
comment on: http://stackoverflow.com/a/27565283
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43607934
comment on: http://stackoverflow.com/q/27591822
score: 0
type: Comment
has text: I've added that to my code.
type: QuestionComment

http://stackoverflow.com/a/27633286
has comment: http://stackoverflow.com/comment/43686565
has body: I guess your writing a console application, not a GUI one. In this case use something like the following: import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; public class FileChooser { public static void main(String[] args) throws IOException { FileWriter writer = new FileWriter(chooseFile()); // Use your FileWriter } public static File chooseFile() { String fname = null; File file = null; System.out.println("Please choose file name:"); while (true) { try (Scanner in = new Scanner(System.in)) { // Reads a single line from the console fname = in.nextLine(); file = new File(fname); if (!file.createNewFile()) { throw new RuntimeException("File already exist"); } break; } catch (Exception ex) { System.out.println(ex.getMessage() + ", please try again:"); } } return file; } } EDIT If you are writing a Swing GUI, you can use JFileChooser: //Create a file chooser final JFileChooser fc = new JFileChooser(); int returnVal = fc.showSaveDialog(parentComponent); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); } else { // User canceled the file chooser. }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27632993
score: 1
has comment: http://stackoverflow.com/comment/43711522
answers question: http://stackoverflow.com/q/27632993
has comment: http://stackoverflow.com/comment/43687022
type: Answer
has comment: http://stackoverflow.com/comment/43686785
has comment: http://stackoverflow.com/comment/43687048
has comment: http://stackoverflow.com/comment/43708762
upvote count: 1
has comment: http://stackoverflow.com/comment/43687132
has comment: http://stackoverflow.com/comment/43686505

http://stackoverflow.com/comment/43557446
has text: I don't know the URL, and I don't know where to obtain it :P
comment on: http://stackoverflow.com/q/27566222
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27482200
favorite count: 0
has answer: http://stackoverflow.com/a/27482478
has comment: http://stackoverflow.com/comment/43396977
type: UnansweredQuestion
tagged with: file
downvote count: 1
linked to: http://stackoverflow.com/q/1888189
has comment: http://stackoverflow.com/comment/43397450
has body: I've a file to read save, do something with its informations and then rewrite them back to another file. the problem is that the original file contains some characters from asian languages like 坂本龍一, 東京事変 and メリー (I guess they're chinese, japanese and korean). I can see them using Notepad++. the problem is when I read them and write those things via java they get corrupted and I see weird stuff in my output file like ???????? or Ð–Ð°Ð½Ð½Ð° Ð‘Ð¸Ñ‡ÐµÐ²Ñ?ÐºÐ°Ñ? I think I got something wrong with the encoding but I've no idea of which to use and how to use it. can someone help me? here's my code: String fileToRead= SONG_2M; Scanner scanner = new Scanner(new File(fileToRead), "UTF-8"); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String[] songData = line.split("\t"); if (/*something*/) { save the string in the map } } scanner.close(); saveFile("coded_artist_small2.txt"); } public void saveFile(String fileToSave) throws FileNotFoundException, UnsupportedEncodingException { PrintWriter writer = new PrintWriter(fileToSave, "UTF-8"); for (Entry&lt;String, Integer&gt; entry : artistsMap.entrySet()) { writer.println(entry.getKey() + DELIMITER + entry.getValue()); } writer.close(); }
tagged with: java
has title: file reading encoding trouble
score: -1
has comment: http://stackoverflow.com/comment/43397108
type: Question
tagged with: encoding
upvote count: 0
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/43396967

http://stackoverflow.com/q/27475712
has comment: http://stackoverflow.com/comment/43385924
has comment: http://stackoverflow.com/comment/43385815
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43385998
favorite count: 0
has body: I need to remove the duplicate characters from an string. I achieved it using BitSet like this private static String removeDup(String s1, String s2) { BitSet bitSet = new BitSet(26); char[] s1Chars = s1.toCharArray(); for (char s1Char : s1Chars) { bitSet.set(s1Char); } char[] s2Chars = s2.toCharArray(); StringBuilder sb = new StringBuilder(); for (char s2Char : s2Chars) { if (bitSet.get(s2Char)) { //System.out.println("Duplicate " + s2Char); } else { sb.append(s2Char); } } return sb.toString(); } Although this method works is there some more better and optimal way to do in terms of time and space complexity? Thanks E.g. Input: "hello", "world" Output: wrd
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27476143
type: Question
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/43385866
has comment: http://stackoverflow.com/comment/43386008
score: 4
upvote count: 4
has title: Remove duplicate characters from 2 strings

http://stackoverflow.com/q/27539594
tagged with: completable-future
upvote count: 6
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26571250
score: 6
tagged with: java-8
type: Question
has body: I have written up a contrived code example, and it might not be code that someone ought to use, but I believe it should work. However it instead deadlocks. I've read the answers described here, but found them insufficient. Here is the code example: import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.Executors; public class Test { public static void main(String argv[]) throws Exception { int nThreads = 1; Executor executor = Executors.newFixedThreadPool( nThreads ); CompletableFuture.completedFuture(true) .thenComposeAsync((unused)->{ System.err.println("About to enqueue task"); CompletableFuture<Boolean> innerFuture = new CompletableFuture<>(); executor.execute(() -> { // pretend this is some really expensive computation done asynchronously System.err.println("Inner task"); innerFuture.complete(true); }); System.err.println("Task enqueued"); return innerFuture; }, executor).get(); System.err.println("All done"); System.exit(0); } } This prints: About to enqueue task Task enqueued And then it hangs. It's deadlocked because the executor only has a single thread, and it's waiting for the innerFuture to become redeemable. Why does "thenComposeAsync" block for its return value to become redeemable, instead of returning the still-incomplete future and freeing up its thread in the executor? This feels completely unintuitive, and the javadocs don't really help. Am I fundamentally misunderstanding how CompletionStages work? Or is this a bug in the implementation?
accepted answer: http://stackoverflow.com/a/27586847
tagged with: java
possible better answer: http://stackoverflow.com/a/27561065
has answer: http://stackoverflow.com/a/27561065
answer count: 2
has title: Why does thenComposeAsync await the return to be redeemable
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27586847

http://stackoverflow.com/comment/43484795
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27527274
has text: @Saifur Tried the edited code and now it does not even click the signup button to display the error message. Everything was working up to point where it was not picking up the correct error message. Not sure if a wait statement would work, but don't know how to insert that or where. Sorry to bother you.

http://stackoverflow.com/comment/43454507
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27512039
type: QuestionComment
has text: @MarcB Wow 2.7MB!? Is it really that bad :S Is there any way to do it more seamless into a stream or is caching the way to go?

http://stackoverflow.com/a/27527722
accepted answer of: http://stackoverflow.com/q/27527621
type: Answer
answers question: http://stackoverflow.com/q/27527621
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/43484219
upvote count: 8
has comment: http://stackoverflow.com/comment/43484005
has comment: http://stackoverflow.com/comment/43484026
has body: Is your system locale something else than English? Try to explicitly specify the locale: DateFormat dateFormat = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss ZZZZZ", Locale.US);
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43484064

http://stackoverflow.com/q/27601227
accepted answer: http://stackoverflow.com/a/27601615
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43625355
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27602058
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43626551
has title: Unable to switch between two browser windows using Selenium WebDriver
upvote count: 1
has body: I am new to WebDriver, i am facing an issue on browser window switching. I googled for my query resolution and the answer i found best is still not working for me. Here is my code : import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.BeforeSuite; public class FrameWorkBase { public static WebDriver driver; public static WebDriverWait wait; public static String firstWindow,secondWindow; @BeforeSuite public void startDriver() throws Exception{ driver= new FirefoxDriver(); // this firefox window is to open survey driver.manage().window().maximize(); wait=new WebDriverWait(driver, 40); driver.get("http://www.cricinfo.com"); firstWindow=driver.getWindowHandle(); driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.get("https://translate.google.co.in/"); secondWindow=driver.getWindowHandle(); System.out.println("First window handle :" + firstWindow); System.out.println("\n Second window handle :" + secondWindow); driver.switchTo().window(firstWindow); System.out.println("hello"); } } I am getting an error on execution as Unable to find window 'xyz' where 'xyz' is the name of first window. Even i am printing the window name and it is displaying the same window for which it is displaying error. Please suggest me what i am doing wrong here. Thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/43625428
linked to: http://stackoverflow.com/q/27187171
has answer: http://stackoverflow.com/a/27602058
linked to: http://stackoverflow.com/q/19117747
has answer: http://stackoverflow.com/a/27601615

http://stackoverflow.com/a/27546575
score: 1
has body: Use this to convert JSON array to string private String convertStreamToString(InputStream is) { /* * To convert the InputStream to String we use the * BufferedReader.readLine() method. We iterate until the * BufferedReader return null which means there's no more data to * read. Each line will appended to a StringBuilder and returned as * String. */ BufferedReader reader = new BufferedReader( new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); }
upvote count: 1
answers question: http://stackoverflow.com/q/27542498
type: Answer
downvote count: 0

http://stackoverflow.com/a/27589291
has comment: http://stackoverflow.com/comment/43604315
answers question: http://stackoverflow.com/q/27589191
has comment: http://stackoverflow.com/comment/43603901
has comment: http://stackoverflow.com/comment/43604566
score: 0
type: Answer
has body: Your problem is here for(int i=0; i&lt;10; i++){ TH created = new TH(this); //this=receiver created.start(); } You created 10 different threads and pass the same applet object in constructor. You need something liske this: for(int i=0; i&lt;10; i++){ TH created = new TH(new Responder()); created.start(); }
has comment: http://stackoverflow.com/comment/43604375
has comment: http://stackoverflow.com/comment/43604726

http://stackoverflow.com/a/27640284
score: 5
type: Answer
upvote count: 6
has body: Remove "()" from method name &lt;ImageView android:id="@+id/exit_img" android:src = "@drawable/exit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:layout_alignParentEnd="true" android:onClick="exitsys" android:resizeMode="horizontal|vertical" /&gt; Also to exit an activity use finish(); using System.exit(0) is a bad idea. So use this public void exitsys(View v){ finish(); }
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27640233
answers question: http://stackoverflow.com/q/27640233
type: AcceptedAnswer

http://stackoverflow.com/comment/43640630
type: QuestionComment
has text: Oh thanks! A general question to those professional programmers:is the difference between computer engineer and computer science the reason I am asked to write programs that make me build built-in functions? In UC Berkeley, we have computer science (and it is common to ask us how to build built-in functions), not computer engineer and I am just wondering if this is a small example of the difference between the majors.
score: 0
comment on: http://stackoverflow.com/q/27608890
type: Comment

http://stackoverflow.com/comment/44435930
type: QuestionComment
has text: Please see http://stackoverflow.com/questions/28018861/struts-2-refactoring-code-to-avoid-ognl-static-method-access for a work around
score: 0
comment on: http://stackoverflow.com/q/27504136
type: Comment

http://stackoverflow.com/comment/43411549
score: 1
comment on: http://stackoverflow.com/q/27489976
type: Comment
has text: Yes, if there is a `break` statement inside your `\\do something` block.
type: QuestionComment

http://stackoverflow.com/a/27542028
type: Answer
answers question: http://stackoverflow.com/q/27541669
has body: you should check first if the file doesn't exist ,create it if(!new File("title.txt").exists()) { File myfile = new File("title.txt"); myfile.createNewFile(); } then you can use FileWriter or FileOutputStream to write to the file i prefer FileWriter FileWriter writer = new FileWriter("title.txt"); writer.write("No God But Allah"); writer.close(); simply simple
score: 0

option-type
tags question: http://stackoverflow.com/q/27522710
tag name: option-type
tags question: http://stackoverflow.com/q/27509350
type: Tag

http://stackoverflow.com/q/27516306
has answer: http://stackoverflow.com/a/49222859
tagged with: glassfish
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/27539581
favorite count: 0
has answer: http://stackoverflow.com/a/43570095
tagged with: soap
type: AnsweredQuestion
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/49222859
possible better answer: http://stackoverflow.com/a/27539581
tagged with: java
has body: I have written a soap client application running on glassfish server. For soap security reason I had to update a class (SecurityHeather.java) part of Metro project which is provided through webservices-osgi.jar glassfish's module. Is there anyway to override the class inside the glassfish\modules\webservices-osgi.jar ? The easiest way is to update the class inside the jar file and save it. but im not sure its the best way or not.
tagged with: web-services
has title: Is it possible to override a class inside glassfish\modules\webservices-osgi.jar?
type: Question

http://stackoverflow.com/comment/43548596
comment on: http://stackoverflow.com/a/27559884
type: Comment
has text: I'm not talking about Java 8's `Stream`'s `collect` method. I'm talking about Scala's `collect` method and asking for an equivalent in Java 8.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27587823
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27587309
has body: This is an fun question as you get to see how everybody takes a different approach to solving it. This way just gives you a string that is "padded" with another character on the other side. public static void main(String[] args) { for (int c = 1; c &lt;= 10; c++) { System.out.println(printPadded(11 - c, '*', (c - 1) * 2, ' ')); } for (int f = 10; f &gt;= 2; f--) { System.out.println(printPadded(11 - f, '*', (f - 1) * 2, ' ')); } } public static String printPadded(int padCount, char padCharacter, int middleCount, char middleCharacter) { StringBuilder s = new StringBuilder(padCount * 2 + middleCount); for (int i = 0; i &lt; padCount; i++) { s.append(padCharacter); } for (int i = 0; i &lt; middleCount; i++) { s.append(middleCharacter); } for (int i = 0; i &lt; padCount; i++) { s.append(padCharacter); } return s.toString(); }

http://stackoverflow.com/q/27608249
has body: I have tree of ol and li elements. I am adding this element dynamically. After this I would like to deserialize them into java object. Unfortunatelly I am getting an error: SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/derp] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.derp.generic.model.GenericModel.getId(GenericModel.java:28) I know this is happening cause my new elements dosnt have an id. But this meant to be that way, cause Id is generated on database server. Normally id I will do such A think (create object assign parameters throught setters, but without id) there will be no error. And after persist this new object will got an id. The same I am trying to achieve here. After correct deserialisation I would like to make persist this object and that will create an Id for him. But I have to tell my Gson builder to allow null, or to not try set parameter which isnt declared (is null). Here is my code: public List&lt;SkeletonElement&gt; toObject(String jsonObject) { Gson gson = new GsonBuilder() .serializeNulls() .registerTypeAdapter(Long.class, new LongTypeAdapter()) .create(); List&lt;SkeletonElement&gt; list = gson.fromJson(jsonObject, new TypeToken&lt;List&lt;SkeletonElement&gt;&gt;(){}.getType()); return list; } Custom adapter which should to the trick: package com.derp.generic.helpers; import java.io.IOException; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; public class LongTypeAdapter extends TypeAdapter&lt;Long&gt;{ @Override public Long read(JsonReader reader) throws IOException { if(reader.peek() == JsonToken.NULL){ reader.nextNull(); return null; } String stringValue = reader.nextString(); try{ Long value = Long.valueOf(stringValue); return value; }catch(NumberFormatException e){ return null; } } @Override publi…
type: Question
accepted answer: http://stackoverflow.com/a/27608443
answer count: 2
downvote count: 0
tagged with: deserialization
has title: Gson. Deserialize to java object list of new elements with null id
favorite count: 0
has comment: http://stackoverflow.com/comment/43638997
has answer: http://stackoverflow.com/a/27608484
upvote count: 1
has comment: http://stackoverflow.com/comment/43638853
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27608484
has answer: http://stackoverflow.com/a/27608443
score: 1
tagged with: primary-key
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson

http://stackoverflow.com/q/27522710
downvote count: 1
has answer: http://stackoverflow.com/a/27522948
favorite count: 0
has body: Let's consider the following class class A{ void met(int i){ //do somthing } } and let's consider that we have an optional object of this class like: Optional&lt;A&gt; a; is it possible to call the method met on the object a without the need to check whether a refers to a full object or just empty (null). Something like: a.map(A::met(5)); Unfortunately this code doesn't compile. How can this be done?
tagged with: java-8
type: AnsweredQuestion
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/43474543
upvote count: 8
tagged with: option-type
has comment: http://stackoverflow.com/comment/43474472
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/27522948
has title: How to call a method with parameters from an optional object in java
has comment: http://stackoverflow.com/comment/43474623

http://stackoverflow.com/q/27589405
has title: Mule uses old Joda Time version
tagged with: mule
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27591274
has body: Jira ticket: https://www.mulesoft.org/jira/browse/MULE-7707 How do I override the version in my connector? This is what I did in my pom.xml org.mule.transports mule-transport-http 3.5.0 joda-time joda-time and dependency tree: [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ dynamodb-connector --- [INFO] org.mule.modules:dynamodb-connector:mule-module:1.0.0-SNAPSHOT [INFO] +- joda-time:joda-time:jar:2.2:compile [INFO] +- com.amazonaws:aws-java-sdk-dynamodb:jar:1.9.11:compile [INFO] | \- com.amazonaws:aws-java-sdk-s3:jar:1.9.11:compile [INFO] | \- com.amazonaws:aws-java-sdk-kms:jar:1.9.11:compile [INFO] | \- com.amazonaws:aws-java-sdk-core:jar:1.9.11:compile [INFO] | \- (joda-time:joda-time:jar:2.2:compile - omitted for duplicate) [INFO] +- org.mule.modules:mule-module-json:jar:3.5.0:compile [INFO] | +- org.mule.modules:mule-module-xml:jar:3.5.0:compile [INFO] | | \- (joda-time:joda-time:jar:2.2:compile - omitted for duplicate) [INFO] | \- org.kitchen-eel:json-schema-validator:jar:1.2.2:compile [INFO] | \- (joda-time:joda-time:jar:2.2:compile - omitted for duplicate) [INFO] \- org.mule.modules:mule-module-cxf:jar:3.5.0:provided (scope not updated to compile) [INFO] +- org.apache.cxf:cxf-rt-databinding-jibx:jar:2.5.9:provided [INFO] | \- org.jibx:jibx-run:jar:1.2.4.5:provided [INFO] | \- (joda-time:joda-time:jar:2.2:provided - omitted for duplicate) [INFO] \- org.apache.cxf:cxf-rt-ws-security:jar:2.5.9:provided [INFO] \- org.apache.ws.security:wss4j:jar:1.6.9:provided [INFO] \- org.opensaml:opensaml:jar:2.5.1-1:provided [INFO] \- org.opensaml:openws:jar:1.4.2-1:provided [INFO] \- org.opensaml:xmltooling:jar:1.3.2-1:provided [INFO] \- (joda-time:joda-time:jar:2.2:provided - omitted for duplicate) I'm not sure why it keeps complaining java.lang.NoSuchMethodError: org.joda.time.format.DateTimeFormatter.withZoneUTC()
type: Question
tagged with: maven
answer count: 1
accepted answer: http://stackoverflow.com/a/27591274
tagged with: java
score: 0

http://stackoverflow.com/comment/43697654
score: 0
comment on: http://stackoverflow.com/a/27638970
type: Comment
has text: Great. I have one question though. Will this router be conditional? Conditional in the sense, if the value is not `OK`, will it route to `default-output-channel`?
type: AnswerComment

http://stackoverflow.com/comment/43485119
has text: i only add the follwing. but still not working
comment on: http://stackoverflow.com/a/27528072
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43469843
comment on: http://stackoverflow.com/a/27520148
has text: No, it still doesn't work because the `nextDouble()` will leave current position on _that_ line, thus the second account will always automatically be read as having a blank name (because it's reading the rest of the balance's line--which is empty).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27626594
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27626694
possible better answer: http://stackoverflow.com/a/27626687
has answer: http://stackoverflow.com/a/27626682
tagged with: oop
tagged with: java
type: Question
has title: Unable to create new object
has comment: http://stackoverflow.com/comment/43673764
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43673749
accepted answer: http://stackoverflow.com/a/27626682
has answer: http://stackoverflow.com/a/27626687
has body: I created these two files in java and they don't compile. This error comes up: cannot find symbol C02FootprintV1". Why doesn't the program recognize the object? I am new to this. How could I fix this problem? public class CO2FootprintV1 { private double myGallonsUsed; private double myTonsCO2; private double myPoundsCO2; CO2FootprintV1(double gals) { myGallonsUsed = gals; } public void calcTonsCO2() { myTonsCO2 = myGallonsUsed * 0.878; } public double getTonsCO2() { return myTonsCO2; } public void convertTonsToPoundsCO2() { myPoundsCO2 = myTonsCO2 * 220462262; } public double getPoundsCO2() { return myPoundsCO2; } } public class CO2FootprintV1Tester { public static void main(String[] args) { double gals; double tonsCO2, poundsCO2; gals = 1300; CO2FootprintV1 object = new C02FootprintV1(gals); object.calcTonsCO2(); tonsCO2 = object.getTonsCO2(); object.convertTonsToPoundsCO2(); poundsCO2 = object.getPoundsCO2(); } }

http://stackoverflow.com/a/49842059
answers question: http://stackoverflow.com/q/27495942
score: 0
type: Answer
has body: You can check this link: https://github.com/youtube/api-samples You can download api-samples in this you will find a search sample then change that code as mentioned below this will help you to get the channel .Hope this will help you. import com.google.api.client.googleapis.json.GoogleJsonResponseException; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; 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.jackson2.JacksonFactory; import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.model.ResourceId; import com.google.api.services.youtube.model.SearchListResponse; import com.google.api.services.youtube.model.SearchResult; import com.google.api.services.youtube.model.Thumbnail; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Properties; public class Search { private static String PROPERTIES_FILENAME = "youtube.properties"; private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport(); private static final JsonFactory JSON_FACTORY = new JacksonFactory(); private static final long NUMBER_OF_VIDEOS_RETURNED = 50; private static YouTube youtube; public static void main(String[] args) { // Read the developer key from youtube.properties Properties properties = new Properties(); try { InputStream in = Search.class.getResourceAsStream("/" + PROPERTIES_FILENAME); properties.load(in); } catch (IOException e) { System.err.println("There was an error reading " + PROPERTIES_FILENAME + ": " + e.getCause() + " : " + e.getMessage()); System.exit(1); } try { youtube = new YouTube.Builder(HTTP_TRANSPORT, JSON_FACTORY, new HttpRequestInitializer() { @Override public void initialize(H…

http://stackoverflow.com/comment/43487872
score: 0
has text: Yeah, read the duplicate. Notice how you use `nextLine` after getting `startingMinutes` and notice how you use it after `endingMinutes`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27529387

http://stackoverflow.com/a/27550447
has comment: http://stackoverflow.com/comment/43527663
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/43527588
upvote count: 3
has comment: http://stackoverflow.com/comment/43527777
answers question: http://stackoverflow.com/q/27550357
has body: readObject() is only called during the construction of a new object from a serialized stream. There is no scope for two threads to execute this method at the same time on the same object. Conversely, two threads may try to serialize the same object at the same time, hence writeObject is synchronized.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27550357
downvote count: 0

http://stackoverflow.com/a/29211752
type: AcceptedAnswer
type: Answer
has body: I figured out how do it. A sample configuration is posted here, I hope it would be useful for someone in the future.
answers question: http://stackoverflow.com/q/27576624
accepted answer of: http://stackoverflow.com/q/27576624
score: 0

http://stackoverflow.com/comment/43672472
comment on: http://stackoverflow.com/q/27622499
type: Comment
has text: @Jon Skeet: What do you mean by "But if the whole file represents a single JSON object [...]"? The whole file isn't just a single JSON-Object. I've got a file with about 30.000 lines. Every line is single json-object. I think this is clearer now.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/59940004
comment on: http://stackoverflow.com/a/27549831
type: AnswerComment
score: 0
type: Comment
has text: I am also facing the same problem but unable to find the source of the problem. I am using chromeDriver 2.21. My system is Windows 10

http://stackoverflow.com/comment/43390658
comment on: http://stackoverflow.com/q/27478545
has text: You can use `Java Native Invocation`, but shell script would be much easier.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27631704
score: 4
accepted answer: http://stackoverflow.com/a/27694950
tagged with: android
has body: I am trying to install and work on cordova for the the first time. I got through all the installation steps on the cordova apache page. However, I get to the point where I need to build an android app and it never works. I get the following error (which seems to be a frequent error to cordova first-timers but no helpful review on the matter) The identifying error lines are: Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,C:\wamp\www\hello\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen Error: C:\wamp\www\hello\platforms\android\cordova\build.bat: Command failed with exit code 8 at ChildProcess.whenDone (C:\Users\Mina\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:766:16) at Process.ChildProcess._handle.onexit (child_process.js:833:5) Here is the full cordova dump Running command: C:\wamp\www\hello\platforms\android\cordova\build.bat Buildfile: C:\wamp\www\hello\platforms\android\build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 24.0.2 [checkenv] Installed at C:\Program Files (x86)\Android\android-sdk -setup: [echo] Project Name: CordovaApp [gettype] Project Type: Application -set-debug-mode: -debug-obfuscation-check: -pre-build: -build-setup: [getbuildtools] Using latest Build Tools: 21.1.2 [echo] Resolving Build Target for CordovaApp... [gettarget] Project Target: Android 4.4.2 [gettarget] API level: 19 [echo] ---------- [echo] Creating output directories if needed... [mkdir] Created dir: C:\wamp\www\hello\platforms\android\ant-build\rsObj [mkdir] Created dir: C:\wamp\www\hello\platforms\android\ant-build\rsLibs [echo] ---------- [echo] Resolving Dependencies for CordovaApp... [dependency] Library dependencies: [dependency] [dependency] ------------------ [dependency] Ordered libraries: [dependency] [dependency] ------------------ [echo] ---------- [echo] Build…
has title: Cordova 4.1.2 CLI Android Build Fail Windows
favorite count: 0
tagged with: cordova
possible better answer: http://stackoverflow.com/a/27633163
has answer: http://stackoverflow.com/a/27633163
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27694950
type: Question
upvote count: 4
answer count: 2
tagged with: apache
downvote count: 0

http://stackoverflow.com/comment/43527999
type: QuestionComment
type: Comment
score: 3
has text: Do a WRKLNK '/myfolder/*' and then a 8-Display Attributes and look at the attributes (CCSID) of the stream file. I'd expect it to be 819. What CCSID is your system and job using?
comment on: http://stackoverflow.com/q/27548448

http://stackoverflow.com/comment/43672895
score: 1
has text: This maybe: `^hotel-.+-.+` or equivalently `^hotel(-.+){2,}
comment on: http://stackoverflow.com/q/27626107
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27477419
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27477281
type: Answer
has comment: http://stackoverflow.com/comment/43388685
has body: You are doing it wrong, find the sample code below: class Foo { private int bar; public void setBar(int bar) { if(0 &gt; bar)//raise exception here throw new IllegalArgumentException("Invalid bar value: " + bar); this.bar = bar;//set the bar value } public int getBar() { return bar; } } class Demo { public static void main(String[] args) { Foo foo = new Foo(); try { foo.setBar(34); System.out.println("bar is: " + foo.getBar()); foo.setBar(-23); System.out.println("next bar is: " + foo.getBar()); } catch (IllegalArgumentException ex) {//handle the exception here ex.printStackTrace(System.err); } } }
score: 1

aviary
tags question: http://stackoverflow.com/q/27538806
tag name: aviary
type: Tag

http://stackoverflow.com/q/27489595
has comment: http://stackoverflow.com/comment/43411481
has body: How do I get the generated ID for an object before hibernate saves it. Here's the code: @Id @SequenceGenerator(name="MY_SEQ", sequenceName="MY_SEQ", allocationSize=1 ) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MY_SEQ") private long id; Is there any way that I can do this without using a select on currval('MY_SEQ') ? Thanks
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5862680
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43411422
accepted answer: http://stackoverflow.com/a/27494021
tagged with: jpa
answer count: 1
downvote count: 0
score: 4
tagged with: postgresql
favorite count: 0
has title: Get generated id from a sequence before hibernate saves the object
has answer: http://stackoverflow.com/a/27494021

http://stackoverflow.com/comment/43432843
type: QuestionComment
comment on: http://stackoverflow.com/q/27500480
type: Comment
score: 0
has text: If the column Row_Number actually exists in your table, is its name Row_Number or "Row_Number" ?

http://stackoverflow.com/comment/43534848
type: Comment
type: QuestionComment
has text: Is this `{@resourceId}` meant to be a uri variable or is it meant to appear literally in the uri? (I've marked as favorite, I'll check back later.)
comment on: http://stackoverflow.com/q/27537766
score: 0

http://stackoverflow.com/a/30455120
answers question: http://stackoverflow.com/q/27541755
score: 19
upvote count: 19
has comment: http://stackoverflow.com/comment/59885349
accepted answer of: http://stackoverflow.com/q/27541755
has comment: http://stackoverflow.com/comment/83292791
type: AcceptedAnswer
downvote count: 0
has body: You can add it using a filter. Add the following snippet to web.xml: HSTSFilter security.HSTSFilter And then create a filter in your webapp: package security; 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.ServletResponse; import javax.servlet.http.HttpServletResponse; public class HSTSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse resp = (HttpServletResponse) res; if (req.isSecure()) resp.setHeader("Strict-Transport-Security", "max-age=31622400; includeSubDomains"); chain.doFilter(req, resp); } } Its also possible to add the filter using the global web.xml (conf/web.xml).
type: Answer
has comment: http://stackoverflow.com/comment/69861492

http://stackoverflow.com/q/27573849
has title: Create a class based on a variable
has comment: http://stackoverflow.com/comment/43573222
has comment: http://stackoverflow.com/comment/43573187
has answer: http://stackoverflow.com/a/27573933
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43573159
score: 0
tagged with: java
tagged with: design-patterns
type: Question
has body: I have a base class Accounts, that handles all of the information and methods of basic account functions. Then I have subclasses of Checkings and Savings to handle specific functions for the different classes. I have an action listener that will add the account, addBtn.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // add the account //this is where I am stuck! Account account = new Savings(amount); } }); and based on a variable in a JComboBox I want to be able to differentiate what kind of class is created. //get the types of accounts ArrayList&lt;String&gt; accountTypes = Account.getAccountTypes(); JComboBox box = new JComboBox(accountTypes.toArray()); contentPanel.add(box); What can I do to better handle this?
accepted answer: http://stackoverflow.com/a/27573933
tagged with: class
has comment: http://stackoverflow.com/comment/43573406
answer count: 1

speech-recognition
tags question: http://stackoverflow.com/q/27633431
tag name: speech-recognition
type: Tag

http://stackoverflow.com/q/27544456
has answer: http://stackoverflow.com/a/27551002
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43524875
accepted answer: http://stackoverflow.com/a/27551002
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/43526317
has comment: http://stackoverflow.com/comment/43524735
has comment: http://stackoverflow.com/comment/43550477
tagged with: spring
has body: I seem to be stuck in a rut and cannot figure out what is going on. I am currently trying to migrate users from using Sha-256 encryption to Bcyrpt using Spring security. I have looked at this answer and have that class in place however I am getting the following error on Tomcat startup: ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:307) - Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.security.authentication.dao.DaoAuthenticationProvider&lt;200c&gt;&lt;200b&gt;] for bean with name 'customAuthenticationProvider' defined in file [/var/lib/tomcat7/webapps/UKExtranet/WEB-INF/classes/META-INF/spring/applicationContext-security.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.security.authentication.dao.DaoAuthenticationProvider&lt;200c&gt;&lt;200b&gt; Although this seems straightforward enough(ClassNotFoundException) the class is definitely there, I have checked and even gotten a co worker to check in case I was going mad, he also said it was there. Below is the relevant part of my applicationContext-security.xml file: &lt;bean id='bCryptPasswordEncoder' class='co.uk.thehartford.life.security.passwordencoder.MigrateUsersPasswordEncoder' /&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider user-service-ref="userDetailsService"&gt; &lt;security:password-encoder ref="bCryptPasswordEncoder" /&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt; &lt;bean id="userDetailsService" class="co.uk.thehartford.life.security.dao.ExtranetJdbcDaoImpl"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; &lt;bean id="customAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider‌​"&gt; &lt;property name="userDetailsService" ref="userDetailsService" /&gt; &lt;property name="passwordEncoder" ref=…
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/43551694
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17240744
has title: Spring security - Cannot find class DaoAuthenticationProvider
tagged with: java

string
tags question: http://stackoverflow.com/q/27500732
tags question: http://stackoverflow.com/q/27631830
tags question: http://stackoverflow.com/q/27612496
tags question: http://stackoverflow.com/q/27495600
tags question: http://stackoverflow.com/q/27580237
tags question: http://stackoverflow.com/q/27515269
tags question: http://stackoverflow.com/q/27481139
tags question: http://stackoverflow.com/q/27533727
tags question: http://stackoverflow.com/q/27615715
tags question: http://stackoverflow.com/q/27575159
tags question: http://stackoverflow.com/q/27550765
tags question: http://stackoverflow.com/q/27571737
tags question: http://stackoverflow.com/q/27547635
tags question: http://stackoverflow.com/q/27639109
tags question: http://stackoverflow.com/q/27482200
tags question: http://stackoverflow.com/q/27528778
tags question: http://stackoverflow.com/q/27523339
tags question: http://stackoverflow.com/q/27615358
tags question: http://stackoverflow.com/q/27603425
tags question: http://stackoverflow.com/q/27556855
tags question: http://stackoverflow.com/q/27589191
tags question: http://stackoverflow.com/q/27510538
tags question: http://stackoverflow.com/q/27557857
tags question: http://stackoverflow.com/q/27563999
tags question: http://stackoverflow.com/q/27476662
tags question: http://stackoverflow.com/q/27539419
tags question: http://stackoverflow.com/q/27631691
tags question: http://stackoverflow.com/q/27594872
tags question: http://stackoverflow.com/q/27484474
tags question: http://stackoverflow.com/q/27603130
tags question: http://stackoverflow.com/q/27479181
tags question: http://stackoverflow.com/q/27601535
tags question: http://stackoverflow.com/q/27597293
tags question: http://stackoverflow.com/q/27509010
tags question: http://stackoverflow.com/q/27620780
tags question: http://stackoverflow.com/q/27494421
tags question: http://stackoverflow.com/q/27618371
tags question: http://stackoverflow.com/q/27523604
tags question: http://stackoverflow.com/q/27482955
tags question: http://stackoverflow.com/q/27504581
tags question: http://stackoverflow.com/q/27592682
tag name: string
tags question: http://stackoverflow.com/q/27595797
tags question: http://stackoverflow.com/q/27582765
tags question: http://stackoverflow.com/q/27608196
tags question: http://stackoverflow.com/q/27515626
tags question: http://stackoverflow.com/q/27509421
tags question: http://stackoverflow.com/q/27587522
tags question: http://stackoverflow.com/q/27636055
tags question: http://stackoverflow.com/q/27484495
tags question: http://stackoverflow.com/q/27595868
tags question: http://stackoverflow.com/q/27530067
tags question: http://stackoverflow.com/q/27477576
tags question: http://stackoverflow.com/q/27601526
type: Tag
tags question: http://stackoverflow.com/q/27479387
tags question: http://stackoverflow.com/q/27632533
tags question: http://stackoverflow.com/q/27579578
tags question: http://stackoverflow.com/q/27607170
tags question: http://stackoverflow.com/q/27572324
tags question: http://stackoverflow.com/q/27475594
tags question: http://stackoverflow.com/q/27626221
tags question: http://stackoverflow.com/q/27569793
tags question: http://stackoverflow.com/q/27619852
tags question: http://stackoverflow.com/q/27599605
tags question: http://stackoverflow.com/q/27535402
tags question: http://stackoverflow.com/q/27475308
tags question: http://stackoverflow.com/q/27564936
tags question: http://stackoverflow.com/q/27522563
tags question: http://stackoverflow.com/q/27567919
tags question: http://stackoverflow.com/q/27538600
tags question: http://stackoverflow.com/q/27548354
tags question: http://stackoverflow.com/q/27626864
tags question: http://stackoverflow.com/q/27639439
tags question: http://stackoverflow.com/q/27510494
tags question: http://stackoverflow.com/q/27513679
tags question: http://stackoverflow.com/q/27582207
tags question: http://stackoverflow.com/q/27501221
tags question: http://stackoverflow.com/q/27579237
tags question: http://stackoverflow.com/q/27495670

http://stackoverflow.com/comment/43422936
comment on: http://stackoverflow.com/q/27495618
has text: What is the compile error you get?
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27602710
answer count: 2
tagged with: getter-setter
tagged with: field
type: AnsweredQuestion
tagged with: reflection
has body: I have a config file like this: Provider Search,ConfigURL,http://myUrl I want to fill this object using reflection public class MyPrefrences { public ProviderSearch ProviderSearch; } public class ProviderSearch { public String ConfigURL; } here is my code, but I fail to set the composite object: MyPrefrences myPrefrences = new MyPrefrences(); try { Field field = myPrefrences.getClass().getDeclaredField(normalizedCategory); Field field2 = field.getClass().getDeclaredField(normalizedKey); field2.set(field, val); } catch (Exception ex) { throw new RuntimeException(ex); } how would you do it a) if all leaves members are String? b) if I the leaves can be primitives and non-primitives?
has title: how to fill a composite object using java reflection?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27603241
has answer: http://stackoverflow.com/a/27603286
possible better answer: http://stackoverflow.com/a/27603241
tagged with: class
score: 0
accepted answer: http://stackoverflow.com/a/27603286

http://stackoverflow.com/a/27600572
type: Answer
has body: I think below piece of code could be helpful for you. import java.util.Scanner; public class Solution { public static void main(String[] args) throws java.io.IOException { String numbersArray = "1, 2, 3, 5, 7, 9,"; System.out.println(numbersArray); Scanner sc = new Scanner(numbersArray); sc.useDelimiter("(, *)*"); try{ while(true){ System.out.println(sc.nextInt()); } } catch (Exception e) { System.out.println("reading is completed"); } } } Instead of using System.out.println add it to the Integer list. Here we are not traversing through the complete list multiple times, instead we traverse only once and storing them in array.
answers question: http://stackoverflow.com/q/27599847
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/27477286
accepted answer: http://stackoverflow.com/a/27477311
tagged with: java
has body: I'm a basic coder and very new to regular expression. I need to filter the below input to the output specified as below which I need it to feed as an input for my assignment task. Can any one help me out in writing the regular expression alone or at least a guidance? Also is there any other method to do this? Input: A Gathering of Eagles (1963) (uncredited) [Mrs. Josten] The Creed of Violence (????) (rumored) A Life of Her Own (1950) (uncredited) [Model] Pourvu qu'elles soient douces (Libertine II) (1989) [William] &lt;6&gt; A Virgin in Hollywood (1953) [Darla Sloan] &lt;1&gt; Gordon-Levitt, Joseph (500) Days of Summer (2009) Aaron Slick from Punkin Crick (1952) (uncredited) [Showgirl] Cruisin (On a Saturday Night) (2009) {{SUSPENDED}} [Officer Hernandez] Angels in Disguise (1949) (uncredited) [Reception Nurse] The Candid Camera Story (Very Candid) of the Metro-Goldwyn-Mayer Pictures 1937 Convention (1937) (uncredited) [Himself] Annie Get Your Gun (1950) (uncredited) [Carriage Woman] From the Ashes (2011/I) (voice) [Himself - Narrator] Bachelor in Paradise (1961) (uncredited) [Minor Role] The Deep Blue Goodbye (????) (rumored) [Travis McGee] Southpaw (????) (uncredited) [Spectator/High Roller] Output A Gathering of Eagles (1963) A Life of Her Own (1950) Pourvu qu'elles soient douces (Libertine II) (1989) A Virgin in Hollywood (1953) Gordon-Levitt, Joseph (500) Days of Summer (2009) Aaron Slick from Punkin Crick (1952) Cruisin (On a Saturday Night) (2009) Angels in Disguise (1949) The Candid Camera Story (Very Candid) of the Metro-Goldwyn-Mayer Pictures 1937 Convention (1937) Annie Get Your Gun (1950) From the Ashes (2011/I) Bachelor in Paradise (1961)
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27477311
answer count: 1
tagged with: regex
score: 1
favorite count: 0
upvote count: 1
has title: Regular Expression for IMDB Database
type: AnsweredQuestion

http://stackoverflow.com/comment/136593022
comment on: http://stackoverflow.com/q/27578891
type: Comment
type: QuestionComment
has text: Rollback because OP's edit made question incomprehensible
score: 0

http://stackoverflow.com/q/27568767
favorite count: 0
has comment: http://stackoverflow.com/comment/43562873
upvote count: 6
has answer: http://stackoverflow.com/a/27568810
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/76044389
type: Question
tagged with: debugging
type: AnsweredQuestion
has body: Is there a way, using the eclipse debugger, to break any time a particular variable is written to? The only thing I can think of is to manually set a breakpoint at every reference but my codebase is several million lines and I really don't want to do that.
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27568810
has comment: http://stackoverflow.com/comment/43562756
has title: How can I set a breakpoint for when variable changes in Eclipse?
linked to: http://stackoverflow.com/q/1709929
answer count: 1
downvote count: 0

http://stackoverflow.com/a/27515817
score: 0
type: AcceptedAnswer
has body: Just create the Image using a constructor which does not include dimensions (e.g. new Image(url)): Image image = new Image(url);
type: Answer
answers question: http://stackoverflow.com/q/27515754
accepted answer of: http://stackoverflow.com/q/27515754

http://stackoverflow.com/comment/43395198
type: Comment
type: AnswerComment
has text: Rather, just install chrome, it provides this functionality built-in at the developer tools! And i advise, always use chrome for development purpose. It's more better!
comment on: http://stackoverflow.com/a/27480989
score: 0

http://stackoverflow.com/q/27517265
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27517678
tagged with: java
has comment: http://stackoverflow.com/comment/43465309
has body: I have been searching for this but none seems to answer my question. I have been trying to graph/plot a wav file by this: int result = 0; try { result = audioInputStream.read(bytes); } catch (Exception e) { e.printStackTrace(); } and then using the result to be a variable for a graph. I've been thinking if it is correct to change first the result to decibels. Also, am I right to use the result as a variable to be use in the graph? Or is there any way that has to be use in graphing the wav file?
answer count: 1
has comment: http://stackoverflow.com/comment/43465136
has comment: http://stackoverflow.com/comment/43464655
score: 0
has title: Graphing wav file in java
has comment: http://stackoverflow.com/comment/43464796
has answer: http://stackoverflow.com/a/27517678
has comment: http://stackoverflow.com/comment/43465173
has comment: http://stackoverflow.com/comment/43464598
has comment: http://stackoverflow.com/comment/43465270
type: Question
linked to: http://stackoverflow.com/q/8754111
tagged with: audio

http://stackoverflow.com/comment/43609167
has text: There is no way to open the app directly with a user id
score: 0
comment on: http://stackoverflow.com/q/27591767
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43506368
type: QuestionComment
has text: need to post some code, controller/jsp
type: Comment
comment on: http://stackoverflow.com/q/27539273
score: 0

http://stackoverflow.com/comment/43449929
comment on: http://stackoverflow.com/q/27509720
has text: I'm studying for finals and this question was asked ''Define Abstract Object'' in a previous exam paper so I'm trying to be prepared. Looks like it may not exist so I just hope it's not asked this year!!
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27489588
favorite count: 0
has comment: http://stackoverflow.com/comment/43411602
linked to: http://stackoverflow.com/q/8011020
answer count: 0
type: UnansweredQuestion
has body: I would like to know whether order of values in Switch matters according to its type e.g. if I have big switch case with boolean, short, long, float, etc. - (if BOOLEAN is faster than NULL , will it be faster to put case which can return NULL or is it faster to put case, which will return BOOLEAN? So I have two questions: Is order in Switch case held? (from up to down?) Due to performance/speed - does the order of values in case matter? code snippet: switch (user){ case Test.CHAR: return readChar(); case Test.SHORT: return readShort(); case Test.BOOLEAN: return readBoolean(); case Test.BYTE: return readByte(); case Test.INT: return readInt(); case Test.LONG: return readLong(); case Test.STRING: return readString(); }
downvote count: 1
has comment: http://stackoverflow.com/comment/43411985
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43410856
has comment: http://stackoverflow.com/comment/43411840
duplicate of: http://stackoverflow.com/q/23204580
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/23204580
has comment: http://stackoverflow.com/comment/43411114
has comment: http://stackoverflow.com/comment/43410725
has comment: http://stackoverflow.com/comment/43412355
has title: Does the sorted order of values in SWITCH matter?

http://stackoverflow.com/q/27524061
tagged with: postgresql
type: UnansweredQuestion
score: 6
tagged with: jdbc
has body: Is there right way to get range types? Or parse as String, and wait for native support... For example tsrange: ["2010-01-01 14:00:00","2010-01-01 15:00:00"] PG Range tupes - http://www.postgresql.org/docs/devel/static/rangetypes.html
tagged with: java
type: Question
has title: How to get PostgreSQL range types via jdbc
has answer: http://stackoverflow.com/a/41556906
upvote count: 7
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/27634200
score: 0
has comment: http://stackoverflow.com/comment/43704623
has body: Try putting mira.jar into a lib directory at the same level as solr.xml Please see Shawn's response : http://find.searchhub.org/document/a280909a7286e1c8#73b177718d3e9959
type: Answer
answers question: http://stackoverflow.com/q/27612839

http://stackoverflow.com/q/27566852
tagged with: android
upvote count: 1
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/27398120
tagged with: eclipse
type: Question
downvote count: 0
has body: I've a problem with Eclipse as you can see here too org.eclipse.core.commands.ExecutionException: Incorrect type for activeWorkbenchWindow found while executing org.eclipse.ui.file.export, expected org.eclipse.ui.IWorkbenchWindow found org.eclipse.ui.internal.WorkbenchWindow at org.eclipse.ui.handlers.HandlerUtil.incorrectTypeFound(HandlerUtil.java:46) at org.eclipse.ui.handlers.HandlerUtil.getActiveWorkbenchWindowChecked(HandlerUtil.java:213) at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:269) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90) 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.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:247) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:229) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:149) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210) at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343) at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:159) at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:174) at org.eclipse.ui.actions.ExportResourcesAction.run(ExportResourcesActi…
favorite count: 0
has title: Can't open export or import dialog in eclipse
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43648180
has text: What is a redraw method?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27612882

gradle
tags question: http://stackoverflow.com/q/27587670
tags question: http://stackoverflow.com/q/27598491
tags question: http://stackoverflow.com/q/27507413
tags question: http://stackoverflow.com/q/27594867
tags question: http://stackoverflow.com/q/27598036
tags question: http://stackoverflow.com/q/27634842
tags question: http://stackoverflow.com/q/27633008
tags question: http://stackoverflow.com/q/27623237
tags question: http://stackoverflow.com/q/27500084
tags question: http://stackoverflow.com/q/27602732
tags question: http://stackoverflow.com/q/27550098
tags question: http://stackoverflow.com/q/27615842
tags question: http://stackoverflow.com/q/27509209
tags question: http://stackoverflow.com/q/27592253
type: Tag
tags question: http://stackoverflow.com/q/27493955
tags question: http://stackoverflow.com/q/27626335
tags question: http://stackoverflow.com/q/27511689
tags question: http://stackoverflow.com/q/27585248
tags question: http://stackoverflow.com/q/27543558
tags question: http://stackoverflow.com/q/27476581
tag name: gradle
tags question: http://stackoverflow.com/q/27604283
tags question: http://stackoverflow.com/q/27514304
tags question: http://stackoverflow.com/q/27505141
tags question: http://stackoverflow.com/q/27636480
tags question: http://stackoverflow.com/q/27532492
tags question: http://stackoverflow.com/q/27541712
tags question: http://stackoverflow.com/q/27566949
tags question: http://stackoverflow.com/q/27536491
tags question: http://stackoverflow.com/q/27553341
tags question: http://stackoverflow.com/q/27508264
tags question: http://stackoverflow.com/q/27537380
tags question: http://stackoverflow.com/q/27526941

http://stackoverflow.com/q/27631692
possible better answer: http://stackoverflow.com/a/41777625
has answer: http://stackoverflow.com/a/39134965
has answer: http://stackoverflow.com/a/40602648
has comment: http://stackoverflow.com/comment/43683751
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/41777625
has answer: http://stackoverflow.com/a/63430113
has answer: http://stackoverflow.com/a/27632477
has answer: http://stackoverflow.com/a/44674209
type: Question
tagged with: validation
has comment: http://stackoverflow.com/comment/43683674
favorite count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/43683716
tagged with: regex
has title: phone Number validation in java
answer count: 9
has answer: http://stackoverflow.com/a/27631809
downvote count: 0
accepted answer: http://stackoverflow.com/a/27631809
has answer: http://stackoverflow.com/a/27631904
has answer: http://stackoverflow.com/a/46320888
has body: I want to validate a phone number in such Way :- The field should allow the user to enter characters and should auto-correct. So an entry of "+1-908-528-5656" would not create an error for the user, it would just change to "19085285656". I also want to number range between 9 to 11. I also tried with the below code but not concluded to the final solution: final String PHONE_REGEX = "^\\+([0-9\\-]?){9,11}[0-9]$"; final Pattern pattern = Pattern.compile(PHONE_REGEX); String phone = "+1-908-528-5656"; phone=phone.replaceAll("[\\-\\+]", ""); System.out.println(phone); final Matcher matcher = pattern.matcher(phone); System.out.println(matcher.matches());
type: AnsweredQuestion

http://stackoverflow.com/comment/43688693
comment on: http://stackoverflow.com/a/27634015
has text: ohh.which spring version did you use?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43454918
comment on: http://stackoverflow.com/q/27512307
score: 0
has text: you probably need to register a custom TypeAdapter for Date, that will try various formats.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27550552
has answer: http://stackoverflow.com/a/27550594
type: UnansweredQuestion
tagged with: java
has title: JST function attribute
type: Question
tagged with: jstl
answer count: 1
tagged with: jsp
score: 0
has body: I write own taglib and i want use this in my jsp page. But I have problem with transfer string declared like this <%! String test= "lot of print test"; %> to page. My .tld Upper my.ChangeCase java.lang.String Upper(java.lang.String) my .java public static String Upper(String text) { String up; up = text.toUpperCase(); return up; } my .jsp <%@ taglib prefix="my" uri="/WEB-INF/tlds/newTag" %> upper${my: Upper("how send string here?")} Question is how send string to function Upper ?

http://stackoverflow.com/q/27584107
has comment: http://stackoverflow.com/comment/43593159
accepted answer: http://stackoverflow.com/a/27607101
has comment: http://stackoverflow.com/comment/43593033
tagged with: jetty
type: Question
has comment: http://stackoverflow.com/comment/43592715
type: AnsweredQuestion
has title: jetty 9 shutdown without exceptions at random time
has body: I use jetty 9 and two DigitalOcean droplets with 1GB and 512mb memory. I set JAVA_OPTIONS -Xms128m -Xmx450m for both jetty instance, but my simple application use only 200mb heap and 50mb PermGen. On droplets with 512mb I observe what jetty shutdown without any exceptions per 1-2 hour! What a problem? UPDATE hs_err_pid file There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 26652672 bytes for committing reserved memory. Possible reasons: The system is out of physical RAM or swap space In 32 bit mode, the process size limit was hit Possible solutions: Reduce memory load on the system Increase physical memory or swap space Check if swap backing store is full Use 64 bit Java on a 64 bit OS Decrease Java heap size (-Xmx/-Xms) Decrease number of Java threads Decrease Java thread stack sizes (-Xss) Set larger code cache with -XX:ReservedCodeCacheSize= This output file may be truncated or incomplete. # Out of Memory Error (os_linux.cpp:2745), pid=1725, tid=140114409527040 # # JRE version: Java(TM) SE Runtime Environment (7.0_71-b14) (build 1.7.0_71-b14) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.71-b01 mixed mode linux-amd64 compressed oops) # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # --------------- S Y S T E M --------------- OS:jessie/sid uname:Linux 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 libc:glibc 2.19 NPTL 2.19 rlimit: STACK 8192k, CORE 0k, NPROC 3750, NOFILE 4096, AS infinity load average:1.35 0.41 0.23 /proc/meminfo: MemTotal: 501808 kB MemFree: 4744 kB Buffers: 352 kB Cached: 10752 kB SwapCached: 0 kB Active: 457108 kB Inactive: 6000 kB Active(anon): 452136 kB Inactive(anon): 268 kB Active(file): 4972 kB Inactive(file): 5732 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 72 kB Writeback: 0 kB AnonPages: 452036 kB Mapped: 6436 kB Shmem…
has comment: http://stackoverflow.com/comment/43593160
has comment: http://stackoverflow.com/comment/43593069
tagged with: java
tagged with: jetty-9
tagged with: digital-ocean
has comment: http://stackoverflow.com/comment/43592792
has answer: http://stackoverflow.com/a/27607101
answer count: 1
score: 0
tagged with: vps
has comment: http://stackoverflow.com/comment/43592873
has comment: http://stackoverflow.com/comment/43592673
has comment: http://stackoverflow.com/comment/43592655

http://stackoverflow.com/q/27599605
tagged with: error-handling
type: Question
tagged with: java
has title: how to delete specified character in array and copy the elements to another array
score: 0
has comment: http://stackoverflow.com/comment/43622222
answer count: 2
accepted answer: http://stackoverflow.com/a/27599622
tagged with: arrays
tagged with: string
possible better answer: http://stackoverflow.com/a/27601308
has answer: http://stackoverflow.com/a/27601308
has comment: http://stackoverflow.com/comment/43622745
has comment: http://stackoverflow.com/comment/43622387
type: AnsweredQuestion
has body: how to delete specified character in array and copy the elements of the first array to the second array ? i tried to convert the array to a list to be able to check if the array contain this specified character, then i tried to remove this character and create another array by copying the element of the first array but without the specified character. the system display this error: Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:161) at java.util.AbstractList$Itr.remove(AbstractList.java:375) at java.util.AbstractCollection.remove(AbstractCollection.java:269) at test4.test4.main(Question4.java:21) this is my code: package test4; import java.util.Arrays; public class test4 { public static void main(String[] args) { String[] a = new String[]{ "A", "b", "C", "$", "$", "$", "d", "s", "w", "t", "Z", "r", "I", "o", "A", "b", "C", "$", "$", "$", "d", "s", "w", "t" }; String[] b = new String[a.length]; int num = 0; for(int i =0; i&lt;a.length; i++){ if(Character.isUpperCase(i)){ num++; } if(Arrays.asList(a).contains("$")){ Arrays.asList(a).remove("$"); b[i] =a[i]; } } System.out.println("number os uperCase is: " + num); System.out.println(); System.out.println("this is the new Array: " + Arrays.toString(b)); } } can anyone help me to fix this problem??
has answer: http://stackoverflow.com/a/27599622

http://stackoverflow.com/comment/43419824
score: 2
has text: Rijndael with 256-bit blocks is non-standard.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27492292

http://stackoverflow.com/comment/43631398
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27604514
score: 0
has text: Show your filter mapping in web.xml, correctly modified with /a or /p as for the rest of the code

http://stackoverflow.com/a/27623952
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: You can use a global variable : public class PayActivity extends ActionBarActivity { String value; @Override protected void onCreate(Bundle savedInstanceState) { value = getIntent().getStringExtra("transaction_amount"); } public void yourFunction() { // You can acces value here } // your activity here.... }
accepted answer of: http://stackoverflow.com/q/27623882
type: Answer
answers question: http://stackoverflow.com/q/27623882

http://stackoverflow.com/comment/43484731
has text: I think youre missing closing brackets for the while statements
comment on: http://stackoverflow.com/q/27527955
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33093414
downvote count: 1
has body: These are called "Intentions" in Android Studio. You can either disable them one at a time or groups of them. The settings can be found in: File > Settings > Editor > Intentions I personally don't like any helpers of any kind when developing. I simply unchecked everything and clicked OK.
has comment: http://stackoverflow.com/comment/54077922
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27588787
score: 1

http://stackoverflow.com/comment/43658580
type: QuestionComment
comment on: http://stackoverflow.com/q/27605506
has text: so you can use what i have told you in my answer. Simple call your service from executeInternal method. That executeInternam method will be called automatically based on your cron entry.
score: 0
type: Comment

http://stackoverflow.com/comment/43468774
score: 0
has text: why you don't try with my answer? it's really work.
comment on: http://stackoverflow.com/q/27517692
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43556770
score: 0
comment on: http://stackoverflow.com/q/27565458
type: Comment
type: QuestionComment
has text: thanks for replies not really sure what you guys are telling me though

http://stackoverflow.com/q/27560963
possible better answer: http://stackoverflow.com/a/30266935
upvote count: 2
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/30266935
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27606742
accepted answer: http://stackoverflow.com/a/27606742
has title: Android Studio error org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2:8080 refused
score: 2
has body: I have Android Studio with wamp server. I am trying to use a php file to access MySql database on phpmyadmin. I have tried the emulator and Android Device. I am always getting this error : org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2:8080 refused This is my MainActivity.jav file public class MainActivity extends ActionBarActivity { private TextView responseTView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.responseTView = (TextView) findViewById(R.id.response); new getDetails().execute(new SqlConnector()); } private void setTextToTextView(JSONArray jsonArray) { String s = ""; for(int i=0; i&lt;jsonArray.length();i++) { JSONObject obj = null; try { obj = jsonArray.getJSONObject(i); s = s + "ID: " + obj.getString("id") + "Customer Name:" + obj.getString("Customer"); } catch(JSONException e) { e.printStackTrace(); } } this.responseTView.setText(s); } private class getDetails extends AsyncTask&lt;SqlConnector,Long,JSONArray&gt; { @Override protected JSONArray doInBackground(SqlConnector... params) { return params[0].getDetailsinJson(); } @Override protected void onPostExecute(JSONArray jsonArray) { setTextToTextView(jsonArray); } } } And this is my SqlConnector.java file public class SqlConnector { public JSONArray getDetailsinJson() { String url = "http://10.0.2.2:8080/D:/Database/main1.php"; HttpEntity httpEntity = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); Log.d("This is inside HTTP try block.","No error.."); HttpResponse httpResponse = httpClient.execute(httpGet); //Using Logs, it's this line that brings on the error. That's my understanding. httpEntity=httpResponse.getEntity(); } catch(ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Log.d("Inside SqlConnector Class", "ajsdhlk"); JSONArray jsonArray = null; if(httpEntity != nu…
tagged with: php
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43659529
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27618582
has text: And is socket providing the input? which i am assuming no and hence it gets blocked in your call `currentLine = br.readLine();`.
score: 0

http://stackoverflow.com/comment/43757555
has text: Thx Trimble, that should be the issue. I don't know where to look at and how to extend/allocate more memory or socket read option for bigger files to IO.
comment on: http://stackoverflow.com/q/27614824
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27541712
tagged with: jar
favorite count: 0
type: UnansweredQuestion
tagged with: macos
answer count: 0
upvote count: 1
tagged with: gradle
type: Question
tagged with: build
score: 1
tagged with: java
has title: how to pack and export dependent jars in intellij project?
has body: I have a gradle project in intellij 14. I want to copy the jar files which my project depend on. How can I gather them for delivery not as one unified jar? There are so many, and are spread in ~/gradle/caches ?
downvote count: 0

http://stackoverflow.com/comment/43649711
has text: i think the question is how to sort with a custom predicate
comment on: http://stackoverflow.com/q/27613841
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/27502652
has answer: http://stackoverflow.com/a/74653184
favorite count: 0
has answer: http://stackoverflow.com/a/27504175
has comment: http://stackoverflow.com/comment/43455354
has answer: http://stackoverflow.com/a/27503169
has comment: http://stackoverflow.com/comment/43438301
has answer: http://stackoverflow.com/a/27515777
tagged with: inversion-of-control
answer count: 4
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/43436069
has title: how to implement a global state with guice?
has body: I want to create a global state (data object, not a service object). I have created class MyDataObject. I want to avoid regular global state, but prefer using Guice dependency injection. However all the tutorials show how to set a DI for service object with registration to interface. How can I use Guice injection for my need? Edit I have tried: public class AppInjector extends AbstractModule { @Override protected void configure() { bind(E2eResult.class).toInstance(new E2eResult()); } } with: @Test public void sendSearchRequest() throws Exception { ... e2eResult = injector.getInstance(E2eResult.class); timerUtils.setTimeOut(criticalBlockTimeOutMilli); timerUtils.startStopWatch(); ... long timeElapsed = timerUtils.stopStopWatch(); e2eResult.runTime = timeElapsed; ... } and: public static void main(String... args) throws ClassNotFoundException, IOException { Injector injector = Guice.createInjector(new AppInjector()); Result result = runTest(classAndMethod); E2eResult e2eResult = injector.getInstance(E2eResult.class); } and yet I saw the in the main was without the new long value.
has comment: http://stackoverflow.com/comment/43457362
upvote count: 1
has comment: http://stackoverflow.com/comment/43435968
tagged with: guice

http://stackoverflow.com/comment/43572132
score: 0
comment on: http://stackoverflow.com/q/27572966
type: Comment
type: QuestionComment
has text: @Pshemo but some exceptions are impossible - they may be declared on a super type for an implementation that will never throw it, eg IOException on methods of ByteArrayInputStream

http://stackoverflow.com/q/27624424
upvote count: 6
type: UnansweredQuestion
score: 6
tagged with: securityexception
has title: Are applets dead?
has answer: http://stackoverflow.com/a/27624562
tagged with: java
has answer: http://stackoverflow.com/a/71973662
type: Question
answer count: 2
downvote count: 0
tagged with: applet
favorite count: 0
tagged with: security
has body: A long time ago I made an applet, when I tried to a open it few days ago in website and it says that there is a security problem and it can not open it. I Googled it and saw that I need to register it. I tried to register it but nothing helped. Can you explain what could make this problem? The applet is fine and working when I run it from eclipse.

http://stackoverflow.com/comment/43435349
score: 0
has text: @assylias - You mean when the ClassLoader of the *current class* with the String constant is GCed, the String constant is also GCed?
type: Comment
comment on: http://stackoverflow.com/a/27502146
type: AnswerComment

http://stackoverflow.com/q/27546473
tagged with: eclipse
has body: mvn install:install-file -Dfile=tiles-api-2.2.1.jar -DgroupId=org.apache.tiles -DartifactId=tiles-api -Dversion=2.2.1 -Dpackaging=jar I am writing this on console but getting build failed error.
has answer: http://stackoverflow.com/a/27548047
upvote count: 0
answer count: 1
tagged with: jar
favorite count: 0
type: UnansweredQuestion
has title: Getting error on jar installation
tagged with: maven
has comment: http://stackoverflow.com/comment/43545637
has comment: http://stackoverflow.com/comment/43550958
has comment: http://stackoverflow.com/comment/43519766
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43519936
has comment: http://stackoverflow.com/comment/43520281
has comment: http://stackoverflow.com/comment/43519379
type: Question
has comment: http://stackoverflow.com/comment/43519669
has comment: http://stackoverflow.com/comment/43551740
score: -2
has comment: http://stackoverflow.com/comment/43520494

http://stackoverflow.com/a/27535202
score: 2
answers question: http://stackoverflow.com/q/27535132
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Since you are starting the computation at the least significant bit end and progress toward the most significant bit end as you go, you need an operation to place a bit in n-th position, as opposed to shifting in a bit*. Placing n-th bit in an initially zeroed value is simple - you shift 1 left by n, and then OR the shifted value with the result, like this: int value = 0; int n = 3; int valueWithNthBitSet = value | (1 &lt;&lt; n); At this point, valueWithNthBitSet is equal to b00000100. You can apply this trick repeatedly to place the results that you get from your full adders into the bits of the result: int res = 0; int a = 10; int b = 11; int carry = 0; for (int bit = 0 ; i != 8 ; i++) { int aBit = getBit(a, i); int bBit = getBit(a, i); int resBit = fullAdderGetResultBit(aBit, bBit, carry); carry = fullAdderGetCarryBit(aBit, bBit, carry); if (resBit == 1) { res |= 1 &lt;&lt; i; } } When the loop is over, the result would be equal to the two values added together. * Shifting in would apply if you started at the MSB and progressed toward LSB as you go.
type: Answer
accepted answer of: http://stackoverflow.com/q/27535132

http://stackoverflow.com/comment/43502844
type: AnswerComment
type: Comment
has text: @Kerooker, Run the code, then `System.out.println(String.format("key: %s, val: %d", highestString, highest);`
comment on: http://stackoverflow.com/a/27535836
score: 0

http://stackoverflow.com/q/27482426
answer count: 2
has title: Selecting rows and updating them as one command in mysql using java API
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43397568
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43397965
tagged with: java
tagged with: mysql
has body: I have this scenario that I need to select a batch of data from mysql and then update them accordingly. this is what I do in terms of pseudo code : //select results --&gt; select row1 from mytable where x=0; //update update --&gt; update mytable set x=1 where row1 in (results of previous query) here is the piece of code relating to it: Set&lt;String&gt; output= select_row1(nextPatch); // select_row1 returns a list of string where x=0 String blockQuery= "update mytable set x=1 where row1 in (" + ouput.toString + ");" //output toString method is triggered to work accordingly. update(blockQuery); //this method will set column x=1 so it won't be used by other threads. As part of my program I need to use the returned output. So there has to be 2 queries. well this mechanism works great if I only use one machine, but it fails miserably in concurrent system. What I wanted to do is to make sure the selected rows won't be selected again (by setting x=1) but when there are so many threads running. they can still select same results. any ideas how to fix it?
type: Question
has comment: http://stackoverflow.com/comment/43397433
has comment: http://stackoverflow.com/comment/43397720
has comment: http://stackoverflow.com/comment/43397803
has answer: http://stackoverflow.com/a/27484285
linked to: http://stackoverflow.com/q/4682871
possible better answer: http://stackoverflow.com/a/27482466
has answer: http://stackoverflow.com/a/27482466
accepted answer: http://stackoverflow.com/a/27484285

http://stackoverflow.com/comment/43561996
type: QuestionComment
score: 0
has text: Try looking at http://stackoverflow.com/questions/10801104/how-to-make-a-jframe-scrollable
comment on: http://stackoverflow.com/q/27568269
type: Comment

http://stackoverflow.com/a/27601670
downvote count: 1
score: -1
has body: What about this? Use a HashMap with key as the variable (i.e. "{PERSON_NAME}") and the value as the corresponding getter of such key (i.e. getPersonName()). Obviously, this getter has to be an Interface. IMHO this would be a very good way. What the more experienced people think?
answers question: http://stackoverflow.com/q/27601526
upvote count: 0
has comment: http://stackoverflow.com/comment/43628506
type: Answer

http://stackoverflow.com/a/27585612
score: 5
has comment: http://stackoverflow.com/comment/43595685
has comment: http://stackoverflow.com/comment/43595710
answers question: http://stackoverflow.com/q/27585597
has body: You can't. Java's switch statement requires that case labels be constant expressions. If your code does not work with that restriction, you'll need to use if...elseif...else constructions instead. See §14.11 of the JLS: SwitchLabel: &nbsp;&nbsp;&nbsp;caseConstantExpression: &nbsp;&nbsp;&nbsp;caseEnumConstantName: &nbsp;&nbsp;&nbsp;default :
has comment: http://stackoverflow.com/comment/43595723
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/a/27617040
has comment: http://stackoverflow.com/comment/43657974
accepted answer of: http://stackoverflow.com/q/27608928
has comment: http://stackoverflow.com/comment/43656568
has body: For the values passed in Properties setter methods exist. Therefore XML-based bean definition goes like: <property name="url" value="jdbc:mysql://localhost:3306/mysql"/> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> .... <property name="dataSource" ref="dataSource"/>
has comment: http://stackoverflow.com/comment/43656718
answers question: http://stackoverflow.com/q/27608928
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43655514
has comment: http://stackoverflow.com/comment/43656661
type: Answer
has comment: http://stackoverflow.com/comment/43656910
upvote count: 2
has comment: http://stackoverflow.com/comment/43658199
score: 2

http://stackoverflow.com/q/27552499
has answer: http://stackoverflow.com/a/27552765
has comment: http://stackoverflow.com/comment/43531425
tagged with: java
has title: How to use Mockito when we cannot pass a mock object to an instance of a class
has comment: http://stackoverflow.com/comment/43531331
has body: Suppose I have a class like that: public class MyClass { Dao dao; public String myMethod(Dao d) { dao = d; String result = dao.query(); return result; } } I want to test it with mockito. So I create a mock object and I call the method to test in that way: Dao mock = Mockito.mock(Dao.class); Mockito.when(mock.myMethod()).thenReturn("ok"); new MyClass().myMethod(mock); But, suppose instead I have a class like that: public class MyClass { Dao dao = new Dao(); public String myMethod() { String result = dao.query(); return result; } } Now I cannot pass my mock as an argument, so how I gonna test my method? Can someone show an example?
score: 9
type: Question
answer count: 2
upvote count: 9
tagged with: mockito
linked to: http://stackoverflow.com/q/25160761
has comment: http://stackoverflow.com/comment/43531507
has answer: http://stackoverflow.com/a/27552734
has comment: http://stackoverflow.com/comment/43531276
linked to: http://stackoverflow.com/q/130794
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43531264
type: UnansweredQuestion

http://stackoverflow.com/q/27581310
has comment: http://stackoverflow.com/comment/43588768
accepted answer: http://stackoverflow.com/a/27581397
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/43586981
tagged with: arrays
has body: I have just declared a two-dimensional array in my program: String[][] choices = new String[4][]; choices[0] = new String[10]; choices[1] = new String[20]; choices[2] = new String[20]; choices[3] = new String[20]; However, IntelliJ Idea, the IDE I am currently using, threw out a bunch of errors starting from the second line. What is wrong with my code? I have checked other questions regarding two-dimensional arrays and found the exact same syntax being used. EDIT: Based on my code above, I want the arrays to be of different length. Is that possible to make?
has comment: http://stackoverflow.com/comment/43587020
has answer: http://stackoverflow.com/a/27581397
answer count: 1
has comment: http://stackoverflow.com/comment/43586935
favorite count: 0
score: -4
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: Java - Two-dimensional array declaration issue
type: Question

http://stackoverflow.com/a/27615246
accepted answer of: http://stackoverflow.com/q/27486104
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/73457801
downvote count: 0
upvote count: 84
has comment: http://stackoverflow.com/comment/90741423
has comment: http://stackoverflow.com/comment/43698328
has comment: http://stackoverflow.com/comment/73455334
has comment: http://stackoverflow.com/comment/73447353
score: 84
type: Answer
has comment: http://stackoverflow.com/comment/43668554
has comment: http://stackoverflow.com/comment/101511363
has comment: http://stackoverflow.com/comment/43667975
has comment: http://stackoverflow.com/comment/123621229
has comment: http://stackoverflow.com/comment/101511128
has comment: http://stackoverflow.com/comment/73446922
has comment: http://stackoverflow.com/comment/43699187
answers question: http://stackoverflow.com/q/27486104
has body: It's not complicated at all. First, you need to understand that the Spring transaction manager is only a transaction management abstraction. In your case, the actual transactions happen at the JDBC Connection level. All @Transactional service method calls are intercepted by the TransactionInterceptor Aspect. The TransactionIntreceptor delegates transaction management to the current configured AbstractPlatformTransactionManager implementation (JpaTransactionManager in your case). JpaTransactionManager will bind the current running Spring transaction to an EntityManager, so all DAOs participating in the current transaction share the same Persistence Context. JpaTransactionManager simply uses the EntityManager Transaction API for controlling transactions: EntityTransaction tx = txObject.getEntityManagerHolder().getEntityManager().getTransaction(); tx.commit(); The JPA Transaction API simply delegates the call to the underlying JDBC Connection commit/rollback methods. When the transaction is done (commit/rollback), the org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction calls: transactionCoordinator().getTransactionContext().managedClose(); which triggers a Hibernate Session (Entity Manager) close. The underlying JDBC connection is therefore triggered to be closed as well: jdbcCoordinator.close(); Hibernate has a logical JDBC connection handle: @Override public Connection close() { LOG.tracev( "Closing JDBC container [{0}]", this ); if ( currentBatch != null ) { LOG.closingUnreleasedBatch(); currentBatch.release(); } cleanup(); return logicalConnection.close(); } The logical connection delegates the close call to the currently configured connection provider (DataSourceConnectionProvider in your case), which simply calls the close method on the JDBC connection: @Override public void closeConnection(Connection connection) throws SQLException { connection.close(); } Like any other connection pooling DataSource, the JDBC connection close simply returns the connec…
has comment: http://stackoverflow.com/comment/137692995
has comment: http://stackoverflow.com/comment/137696576
has comment: http://stackoverflow.com/comment/123622087
has comment: http://stackoverflow.com/comment/73456365

http://stackoverflow.com/q/27513887
has answer: http://stackoverflow.com/a/27514510
has answer: http://stackoverflow.com/a/27514931
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43461974
tagged with: sockets
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43703692
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43459048
tagged with: java
has body: I am getting errors in my server when the client's message type is "connect", it is very strange. Server Receiver Code: package threads; public class ReceiveFromClientThread extends Thread { ObjectInputStream inFromClient = null; ServerSocket servs = new ServerSocket(); Socket link = null; Message m = null; public void run() { try { this.servs.servs.accept(); this.inFromClient = new ObjectInputStream(link.getInputStream()); } catch (SocketException e3) { System.err.println(" Connection reset by peer."); } catch (IOException e1) { e1.printStackTrace(); } while(true) { try { if (link.isConnected()) { this.m = (Message) inFromClient.readObject(); //SHOULDN'T THIS THREAD PAUSE HERE? if (m.getType().equalsIgnoreCase("normal")) { System.out.println("[" + m.getTimestamp() + "] " + m.getOwner() + " -&gt; " + m.getText()); ServerMain.mc.pushMessageToList(this.m); //Added to message list. } else if (m.getType().equalsIgnoreCase("connect")) { System.out.println(m.getOwner() + " connected from " + this.link.getInetAddress()+":"+this.link.getPort()); } else if (m.getType() == "disconnect") { System.err.println("[" + m.getTimestamp() + "] " + "[Origin: " + m.getIp() + "] " + m.getOwner() + " Disconnected." ); } } } catch (IOException | ClassNotFoundException e) { } } } public ReceiveFromClientThread(Socket link) { this.link = link; } } Client Connection Code: ClientMain.sock = new Socket("127.0.0.1",21215); ClientMain.oos = new ObjectOutputStream(sock.getOutputStream()); Message m = new Message(); m = m.setType("connect"); m.setOwner("Raphael"); m.setIp(sock.getInetAddress().getHostAddress()); m.setPcname(sock.getInetAddress().getCanonicalHostName()); clientmain.ClientMain.oos.writeObject(m); It should be working, but it gives an infinite loop or sometimes a NullPointerException. Is there any error in my code? Shouldn't the server thread suspend on the readObject() line?
score: -1
has title: Is my Socket Server Loop Class correct?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43459973

http://stackoverflow.com/q/27523184
type: UnansweredQuestion
tagged with: build-error
answer count: 0
has body: I am using NetBeans ID 8.0.1 to generate a javadoc, but whenever i try to create javadoc following error occurs: Constructing Javadoc information... 1 error D:\EFConnect\libs\activemq-all-5.9.1.jar(org/apache/activemq/ActiveMQConnection.java):107: error: cannot access Logger import org.slf4j.Logger; ^ bad source file: D:\EFConnect\libs\activemq-all-5.9.1.jar(org/slf4j/Logger.java) file does not contain class org.slf4j.Logger Please remove or make sure it appears in the correct subdirectory of the sourcepath. D:\EFConnect\nbproject\build-impl.xml:1208: Javadoc returned 1 BUILD FAILED (total time: 1 second) My project otherwise is working fine, also the classes mentioned in the error also exist where they are supposed to exist.
has comment: http://stackoverflow.com/comment/43475847
type: Question
has comment: http://stackoverflow.com/comment/43476430
has comment: http://stackoverflow.com/comment/43620382
tagged with: java
tagged with: javadoc
score: 0
has title: Error in creating Javadoc
has comment: http://stackoverflow.com/comment/43619994

http://stackoverflow.com/comment/43443850
has text: check which host it is mapped with, and then check port for that host
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27486122

http://stackoverflow.com/q/27605736
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/43634215
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27639237
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27639237
has title: Find absolute path of *.properties file in Spring context
type: Question
answer count: 2
downvote count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43642772
has answer: http://stackoverflow.com/a/27606117
favorite count: 0
accepted answer: http://stackoverflow.com/a/27606117
tagged with: apache-commons-config
has body: I have some legacy jars I'm trying to get to work inside a spring context. Inside my applicationContext.xml, I load the property file(s) using: &lt;context:property-placeholder location="classpath*:META-INF/spring/*.properties" /&gt; ... and it works perfect while inside the spring context. In the legacy code, I need to get the absolute path of that config file(s) and it should work when I run mvn tomcat:run and when it's packaged into a war file and deployed to a Tomcat container (in case you're wondering, yes, spring and the legacy code shares the same application.properties config file). @Service public class Startup { Logger log = LoggerFactory.getLogger(Startup.class); @PostConstruct public void startup() throws Exception { if (!LegacyCode.isInit()){ // this works using a hardcoded path LegacyCode.init("/home/user/absolute/path/to/application.properties"); // this doesn't work, but would the preferred solution if it did // LegacyCode.init("classpath*:META-INF/spring/*.properties"); } } } I've considered using: String config[] = { "classpath*:META-INF/spring/applicationContext.xml" }; ApplicationContext ctx = new ClassPathXmlApplicationContext(config); and then hijack the path using ctx.getResource, but besides the point that it's very inefficient to load the applicationContext a second time just to get the application.properties' absolute path, it'll also cause an infinite loop of @PostConstruct being executed. The legacy code uses Commons Configuration (as far as I can see and based on dependency errors) to setup its config, what I'm looking for is a way for Commons Configuration to load the correct application.properties file whether it's running on Linux, Windows, from a WAR file or from an embedded Tomcat, etc.
tagged with: maven

http://stackoverflow.com/q/27603403
answer count: 1
has body: I have a Spring 4 web application with a standard authentication - username and password. For the validation I use a form-baked bean, javax.validation and Hibernate validator: import org.hibernate.validator.constraints.NotEmpty; import javax.validation.constraints.Size; public class SignupForm { @Size(min = 6, message = "must be at least 6 characters") private String password; @NotEmpty private String email; // get / set methods } Then in Spring Security I had a standard configuration that worked for me. Here is how I use it in the controller and it worked: @RequestMapping(value = "/signup", method = RequestMethod.POST) public String createRecruiter(@ModelAttribute("signUpForm") @Valid SignupForm signupForm, BindingResult formBinding, HttpServletRequest request) { if (formBinding.hasErrors()) { UiUtil.addError(request, EntryError.SINGUP_VALIDATION_ERROR); return DEFAULT_REDIRECT; } // rest of the method is not important } Now I want to open my API for public use using HMAC authentication. For this purpose I followed a step by step guide. In it simplified so there isn't example on how to cope with multiple authentication providers and such. You can see that you need to add custom filter for REST authentication to the Spring configuration in it's filter chain. In Spring context configuration class: @Override protected void configure(HttpSecurity http) throws Exception { http // standard configuration .and() .addFilterBefore(new RestSecurityFilter(authenticationManager()), UsernamePasswordAuthenticationFilter.class); I also have added the authentication provider to the authentication manager like this: @Autowired private RestAuthenticationProvider restAuthProvider; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder()); auth.authenticationProvider(restAuthProvider); } The problem is that now in the controller the SignupForm object has only null values set …
has answer: http://stackoverflow.com/a/27628711
score: 0
has title: Empty web form for validation after adding custom filter to Spring Security
type: UnansweredQuestion
tagged with: authentication
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question
tagged with: validation

http://stackoverflow.com/comment/43545076
type: Comment
has text: I don't (or ever really) use Genson as the provider. Can you post the Maven dependency. Also if need to configure Genson in any way, can you post those configurations, so I can test. Seems to be a problem with Genson, as I never have any problems with this with the normal JSON provider
comment on: http://stackoverflow.com/a/27559400
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43559949
type: QuestionComment
comment on: http://stackoverflow.com/q/27566924
has text: Add a vy variable, init it to 1. Instead of 'rond.y++' use 'rond.y += vy'. After collision, set the vy to -1. Same for x.
score: 1
type: Comment

http://stackoverflow.com/comment/43543329
comment on: http://stackoverflow.com/a/27558278
has text: @user2725919 I agree that currentTm is working fine. What I'm saying is that you do not need to parse tmNumber to an Expression<String>, CriteriaBuilder can do it as an Object/String. My sample code has just changed the order to satisfy the method contract.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27546857
score: 0
has comment: http://stackoverflow.com/comment/43521068
has body: Try this simple code in your android, it works for me, String url = "";// URL where image has to be uploaded String fileName = ""; //path of file to be uploaded HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); FileBody fileContent = new FiSystem.out.println("hello"); StringBody comment = new StringBody("Filename: " + fileName); MultipartEntity reqEntity = new MultipartEntity(); reqEntity.addPart("file", fileContent); httppost.setEntity(reqEntity); HttpResponse response = httpclient.execute(httppost); HttpEntity resEntity = response.getEntity(); Hope this helps you with your problem...!!!!!
type: Answer
has comment: http://stackoverflow.com/comment/43521155
answers question: http://stackoverflow.com/q/27545996
has comment: http://stackoverflow.com/comment/43520798

http://stackoverflow.com/comment/43581949
comment on: http://stackoverflow.com/q/27578517
type: Comment
type: QuestionComment
has text: Read: http://examples.javacodegeeks.com/core-java/xml/parsers/documentbuilderfactory/modify-xml-file-in-java-using-dom-parser-example/ and http://www.mkyong.com/java/how-to-modify-xml-file-in-java-dom-parser/ and there are plenty of other tutorials with examples.
score: 0

http://stackoverflow.com/comment/43566059
has text: I'd do it by reading in all the content. [A] Now find a 1, change it to 2. Look for other 1s next to a 2, and change those to 2. Repeat until there are no changes. That's one block. Change all the 2s to 0s ('cos we know about that block). Repeat from [A]
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27570061

http://stackoverflow.com/a/27616701
accepted answer of: http://stackoverflow.com/q/27616647
answers question: http://stackoverflow.com/q/27616647
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 7
has body: Assuming you fix the blatant syntax errors, then: String dateStr = "16 Dec 2014" // &lt;== This date is in dd MMM yyyy formatter = new SimpleDateFormat(dd/MM/yyyy); // &lt;== This SDF is in dd/MM/yyyy Date thedate = formatter.parse(dateStr); // &lt;== So how can it be expected to parse? What you do is create a parser for the format you need to parse, and a formatter for the format you want: String dateStr = "16 Dec 2014"; SimpleDateFormat parser = new SimpleDateFormat("dd MMM yyyy"); Date thedate = parser.parse(dateStr); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); String dateStrReformatted = formatter.format(thedate);
score: 7

http://stackoverflow.com/q/27495998
score: 5
has body: I am working with existing test cases that use EasyMock to mock a class. I overloaded a no-parameter method so that now a method exists to take a string. For example: public class HelloClass { // This method always existed. public String methodHello() { ... } // This method is new; it overloads the methodHello() method. public String methodHello(String msg) { ... } } In the test class, the HelloClass is mocked. As a result, I added the overloaded method so that we have the declaration: public static HelloClass mockHelloClass = createMockBuilder(HelloClass.class) .addMockedMethod("methodHello") .addMockedMethod("methodHello", String.class) .createMock(); However, the test cases fail when I run them. When I make the methodHello(String) method private then the test cases pass again. Is EasyMock able to handle several overloaded methods being added to the createMockBuilder?
upvote count: 5
tagged with: java
tagged with: easymock
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43543838
type: UnansweredQuestion
has title: Can EasyMock support multiple overloaded methods being added to createMockBuilder
has answer: http://stackoverflow.com/a/27638241
type: Question

http://stackoverflow.com/comment/112614054
score: 0
type: Comment
type: QuestionComment
has text: Do you have git?
comment on: http://stackoverflow.com/q/27518840

camera
tags question: http://stackoverflow.com/q/27552251
tags question: http://stackoverflow.com/q/27545123
tags question: http://stackoverflow.com/q/27501831
tags question: http://stackoverflow.com/q/27547942
tags question: http://stackoverflow.com/q/27495153
tags question: http://stackoverflow.com/q/27540230
tags question: http://stackoverflow.com/q/27610506
tags question: http://stackoverflow.com/q/27617899
tags question: http://stackoverflow.com/q/27522481
type: Tag
tag name: camera

http://stackoverflow.com/q/27550821
downvote count: 0
accepted answer: http://stackoverflow.com/a/27551339
tagged with: boolean
has comment: http://stackoverflow.com/comment/43528972
linked to: http://stackoverflow.com/q/18272059
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I am new in JAXB and I would like to do something i don't know if it's doable. I have a java class to marshall like this : @XmlAccessorType(XMLAccessType.NONE) public class MyClass { @XmlElement private String a = "x"; @XmlElement private String b = "xx"; @XmlElement private boolean c = true; ... } and want XML output like this : <?xml ...?> x xx <c value="true"/> One solution i have in mind is to use a boolean wrapper class to make it work, but i would like to avoid this as it takes me away the ability to use boolean primitive true, false. Can we do that in JAXB?
has answer: http://stackoverflow.com/a/27551339
possible better answer: http://stackoverflow.com/a/27551227
type: AnsweredQuestion
score: 3
has title: JAXB marshalling boolean into a complex type
has answer: http://stackoverflow.com/a/27551227
upvote count: 3
tagged with: java
tagged with: jaxb
tagged with: marshalling
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43528698

http://stackoverflow.com/comment/55381896
type: AnswerComment
has text: Hey - would it be possible for you to also include the `import`s to your example? Thanks.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/33085996

http://stackoverflow.com/q/27511116
has comment: http://stackoverflow.com/comment/43452452
tagged with: calculator
has comment: http://stackoverflow.com/comment/43452859
favorite count: 0
has body: I am new to Java and programming in general. I've encountered not exactly a problem, but more like a wall of my ignorance. On my QA Automation courses I was asked to write a simple calculator program in Java, I kept it very basic - you needed to launch the program over again every time you preformed a calculation. I learned about while loops and it seemed the while loop was a good solution to keep the program running. But now I am at another extreme - the loop is infinite. My question is: is there any simple way to exit the program without re-writing the code and the way I've structured my calculator? I don't know how to do it but it would be nice if program would end when user presses [Esc] or prints "Exit". Is there a simple way that I (beginner) would understand and could implement? import java.io.IOException; import java.util.Scanner; public class Calculator { public static void main(String[] args) { int first, second, answer; String operator; Scanner s = new Scanner(System.in); try { while (true) { log("Please enter a math equation using +, -, * or /"); first = s.nextInt(); //User enters first number operator = s.next(); //User enters operator second = s.nextInt(); //User enters second number if (operator.contains("+")) { answer = first + second; log("" + answer); } if (operator.contains("-")) { answer = first - second; log("" + answer); } if (operator.contains("*")) { answer = first * second; log("" + answer); } if (operator.contains("/")) { if (second == 0) { log("You can't divide by 0"); } else { answer = first / second; log("" + answer); } } } } catch (java.util.InputMismatchException error) { log("Incorrect input"); } } public static void log(String s) { System.out.println(s); } } Thank you, if you can help me! P.S. I don't know if it is a correct way to handle exceptions or a very ugly one. I'd appreciate if you could comment on that too.
has answer: http://stackoverflow.com/a/27524280
tagged with: while-loop
answer count: 3
has comment: http://stackoverflow.com/comment/43452582
linked to: http://stackoverflow.com/q/7951690
has title: Is there an easy way to exit Java while loop without re-writing much of the code?
duplicate of: http://stackoverflow.com/q/7951690
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27511146
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43453099
type: Question
linked to: http://stackoverflow.com/q/10736226
has answer: http://stackoverflow.com/a/27511838
downvote count: 0

http://stackoverflow.com/a/27595830
has comment: http://stackoverflow.com/comment/43615540
upvote count: 1
downvote count: 1
has body: "^\\/pep\\/v1\\/clients\\/(.+)\\/tester$" will do what you need. Note that you have to escape the / with \ and since \ is the escape character in Java you have to escape that as well, thus the \\/ matches / literally. Here is a link to how you can experiment with it. ^ assert position at start of a line \/ matches the character / literally pep matches the characters pep literally (case sensitive) \/ matches the character / literally v1 matches the characters v1 literally (case sensitive) \/ matches the character / literally clients matches the characters clients literally (case sensitive) \/ matches the character / literally 1st Capturing group (.+) .+ matches any character (except newline) Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy] \/ matches the character / literally tester matches the characters tester literally (case sensitive) replace the (.+) with ([^\\/]+) if you want to reject ids that have a / literal in them.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/27595797
type: Answer
answers question: http://stackoverflow.com/q/27595797
has comment: http://stackoverflow.com/comment/43615566

http://stackoverflow.com/comment/43595662
comment on: http://stackoverflow.com/q/27585460
type: QuestionComment
has text: @rupps Well the fragment I'm replacing inflates an XML layout that presents the buttons,textviews, and so forth. Does that answer your question?
score: 0
type: Comment

http://stackoverflow.com/comment/43515862
type: QuestionComment
has text: According to your example, you don't want to remove all `hig@123.net` substrings, but all `hig@123.net` entries from a comma separated list. Not the same thing. What to do with `xxhig@123.netxx` for instance ?
comment on: http://stackoverflow.com/q/27544542
score: 0
type: Comment

http://stackoverflow.com/q/27501843
has title: Csv file is empty when I writing content
answer count: 4
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43434816
has answer: http://stackoverflow.com/a/27502563
tagged with: spring
downvote count: 0
score: 1
tagged with: java
has body: I am trying write to a csv file. After the execution of the code bellow the csv file is still empty. File is in folder .../webapp/resources/. This is my dao class: public class UserDaoImpl implements UserDao { private Resource cvsFile; public void setCvsFile(Resource cvsFile) { this.cvsFile = cvsFile; } @Override public void createUser(User user) { String userPropertiesAsString = user.getId() + "," + user.getName() + "," + user.getSurname() +"\n";; System.out.println(cvsFile.getFilename()); FileWriter outputStream = null; try { outputStream = new FileWriter(cvsFile.getFile()); outputStream.append(userPropertiesAsString); } catch (IOException e) { e.printStackTrace(); } finally { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } @Override public List&lt;User&gt; getAll() { return null; } } This is a part of beans.xml. &lt;bean id="userDao" class="pl.project.dao.UserDaoImpl" p:cvsFile="/resources/users.cvs"/&gt; Program compiles and doesn't throw any exceptions but CSV file is empty.
has answer: http://stackoverflow.com/a/27502235
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/27501904
has answer: http://stackoverflow.com/a/27502008

http://stackoverflow.com/q/27613169
has comment: http://stackoverflow.com/comment/43648984
has body: I'm just new to Maven. I'm following the "Maven in 5 Minutes" on this website. When I run mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false I find that is generated. However, where did I got this source code? From website or from downloaded apache-maven-3.2.5-bin.zip. Which command indicates the location to get source?
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/27618512
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/10533828
type: Question
has comment: http://stackoverflow.com/comment/43648555
has title: Where did I get the example code in Maven?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27618512

http://stackoverflow.com/q/27519806
has answer: http://stackoverflow.com/a/27542432
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: setMediaTime not setting specified time on realized player
has body: I've a situation where I'm creating an instance of javax.Media.player (to play audio in wav foramt) using javax.Media.Manager and I've code which looks like:- Player player = null; MediaLocator locator = new MediaLocator("file path to wav file"); Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true)); try { player = Manager.createRealizedPlayer(locator); } catch (CannotRealizeException e) { e.printStackTrace(); } player.addControllerListener(this); player.start(); player.setMediaTime(); And after having an instance of player I'm invoking setMediaTime on it, the problem is that sometimes the player is updated with the time provided and sometime not. Can anyone please suggest me that what mistake I'm making.
type: Question
tagged with: jmf

http://stackoverflow.com/comment/43549414
has text: I suppose a work-around would be to maintain multiple `MulticastSocket` objects, one for each group you wish to join. It would then be easy enough to keep track of the association between sockets and groups.
score: 0
comment on: http://stackoverflow.com/q/27561706
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27607759
has body: I`d like to format inputed strings over such rule: replace all non-digit symbols except first position in the string: it should be only digit or symbol '+'. I use regexp functionality private static final String REGEXP_NOT_DIGITS = &quot;[^\\+0-9]&quot;; String result = sample.replaceAll(REGEXP_NOT_DIGITS, &quot;&quot;); But the result of this replacement is string with digits and '+' symbols at any position. Please, help me to clarify my condition that I would replace all '+' symbol except only 1 position in the line. Edit. Right now output is: sample[0] sample = 0123456789; result = 0123456789 expected:0123456789 sample[1] sample = +380+380+380+; result = +380+380+380+ expected:+380380380 sample[2] sample = dd0 11 22 33 44 55; result = 01122334455 expected:01122334455 sample[3] sample = +380-456(789); result = +380456789 expected:+380456789 sample[4] sample = d3+580 456 789; result = 3+580456789 expected:3580456789 sample[5] sample = +380456789; result = +380456789 expected:+380456789 Everything is Ok except having symbol '+' inside string
possible better answer: http://stackoverflow.com/a/27608501
tagged with: regex
has answer: http://stackoverflow.com/a/27608501
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27608010
has answer: http://stackoverflow.com/a/27608490
has comment: http://stackoverflow.com/comment/43637644
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27608490
has comment: http://stackoverflow.com/comment/43638448
answer count: 3
has title: Java: Replace all non-digit symbols except symbol "+" on the first position
tagged with: replaceall
has comment: http://stackoverflow.com/comment/43638236
favorite count: 0

http://stackoverflow.com/comment/43604371
type: QuestionComment
has text: This cannot be answered unless you show some related things such the code which might be associated with cause of the exception. `java.lang.NoSuchFieldError: TRACE` - what is `TRACE`? It appears that you have an incorrect/invalid/missing log4j dependency.
comment on: http://stackoverflow.com/q/27589543
score: 0
type: Comment

http://stackoverflow.com/a/27541079
type: Answer
answers question: http://stackoverflow.com/q/27498550
score: 0
has body: You should use the exclude feature from the source tab in your project's Java build path. Basically, you can set a pattern to exclude one or more files from your source path, hence they will not be included in your jar. More information here : https://stackoverflow.com/a/1489225/2003986

http://stackoverflow.com/comment/43504788
type: QuestionComment
comment on: http://stackoverflow.com/q/27537776
score: 0
has text: So don't create another `HBox` as a field in `IPView`
type: Comment

http://stackoverflow.com/comment/43510796
type: AnswerComment
comment on: http://stackoverflow.com/a/27541688
has text: Service accounts are very tricky to understand. I will probably expand my C# drive service account tutorials to include this idea. If you cant get it to work let me know and I will give it a try later today from C#
score: 0
type: Comment

http://stackoverflow.com/a/27505062
has body: try this, Select * from ( SELECT * from tblTimesheet WHERE DATEPART(wk,spentDate) = 32 AND (timesheetstatus = 'Pending' or timesheetstatus = 'Approved') )tbl where (timesheetstatus &lt;&gt; 'Saved' or timesheetstatus &lt;&gt; 'Denied'
answers question: http://stackoverflow.com/q/27504172
score: 0
type: Answer

http://stackoverflow.com/q/27604159
tagged with: java
has comment: http://stackoverflow.com/comment/43631270
has answer: http://stackoverflow.com/a/27604265
has answer: http://stackoverflow.com/a/27644699
has body: I have to do an exercise where is required to put a black JPanel on the left where I have to draw a star-shaped GeneralPath and some buttons on the right that will have to move that general path, plus a reset button that will set the position of the general path in the middle of the panel. This is the code: import java.awt.*; import java.awt.geom.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.border.*; public class SunGUI extends JFrame { private Space space; private Control control; private final int DELTA = 50; private int posX, posY; public SunGUI() { Container cnt = getContentPane(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); space = new Space(); control = new Control(); cnt.add(space, BorderLayout.CENTER); cnt.add(control, BorderLayout.EAST); pack(); setVisible(true); } public class Space extends JPanel { private GeneralPath sun; public Space() { setPreferredSize(new Dimension(800, 600)); sun = createSun(); } public GeneralPath createSun() { GeneralPath sun = new GeneralPath(); sun.moveTo(-30, -30); sun.lineTo(50, 50); sun.moveTo(50, -30); sun.lineTo(-30, 50); sun.moveTo(10, -35); sun.lineTo(10, 55); sun.moveTo(-35, 10); sun.lineTo(55, 10); sun.moveTo(-5, -25); sun.lineTo(25, 45); sun.moveTo(25, -25); sun.lineTo(-5, 45); sun.moveTo(-25, -5); sun.lineTo(45, 25); sun.moveTo(45, -5); sun.lineTo(-25, 25); sun.closePath(); return sun; } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; setBorder(BorderFactory.createLineBorder(Color.red)); setBackground(Color.black); g2.setPaint(Color.white); g2.draw(sun); } } public class Control extends JPanel { private JButton up, down, left, right, reset; private JPanel arrows, panel, resetPanel, container; public Control() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); panel = new JPanel(); arrows = new JPanel(); resetPanel = new JPanel(); container = new JPanel(); arrows.setLayout(new GridLayout(1, 4)); res…
answer count: 2
linked to: http://stackoverflow.com/q/10872311
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: java-2d
score: 1
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/113846094
has title: How do I set the position of a GeneralPath in a JPanel?

http://stackoverflow.com/comment/43537715
type: Comment
type: QuestionComment
has text: How about Java's PriorityQueue?
comment on: http://stackoverflow.com/q/27555663
score: 0

http://stackoverflow.com/a/27570638
score: 0
type: AcceptedAnswer
type: Answer
has body: thanks one more time in advance. I found an answer and one way to do this !!! In the following link: How to change the DPI from 96 to 300 of an image in java after resizing? the "user3603284"posted an solution that helped me doing this. I changed from png to jpeg (it does not matter for the project specifications) and then, worked like a charm !!! The code: File imageFile = new File("C:/ScannerOutput/scannerImage" + System.currentTimeMillis() +".jpeg"); FileOutputStream fos = new FileOutputStream(imageFile); JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(fos); JPEGEncodeParam jpegEncodeParam = jpegEncoder.getDefaultJPEGEncodeParam(image); jpegEncodeParam.setDensityUnit(JPEGEncodeParam.DENSITY_UNIT_DOTS_INCH); jpegEncoder.setJPEGEncodeParam(jpegEncodeParam); jpegEncodeParam.setQuality(0.75f, false); jpegEncodeParam.setXDensity(resolutionState); //DPI rate 100, 200 or 300 jpegEncodeParam.setYDensity(resolutionState); //DPI rate 100, 200 or 300 jpegEncoder.encode(image, jpegEncodeParam); image.flush(); fos.close(); Thanks very much SO, always helping me =)
accepted answer of: http://stackoverflow.com/q/27533810
answers question: http://stackoverflow.com/q/27533810

http://stackoverflow.com/q/27506586
has answer: http://stackoverflow.com/a/27506646
tagged with: java
type: Question
has body: I have created a context menu bar with submenus.i have generated the submenus by using for loop from the list.so when i press any one the submenu item generated i should get the text of the submenu item pressed.so how can we do it.I have only one run method inside the submenu but each submenu items perform different functionality.so how different functionality can be handled by one run method. for ex main menu-&gt;submenu1 -&gt;submenu2 -&gt;submenu3 so if i press submenu 2 i should get the string of the submenu item pressed and respective method should be called as it has only one run method the code for generating context menu is as follows MenuManager contextMenu = new MenuManager("#ViewerMenu"); //$NON-NLS-1$ contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); // IMenuManager submenu = new MenuManager("Sub menu title"); // submenu.add(someaction); } }); protected void fillContextMenu(final IMenuManager contextMenu) { IMenuManager submenu = new MenuManager("Add Case"); List&lt;String&gt; testCases = new ArrayList&lt;&gt;(); testCases.addAll(TestCases.testCaseNames); for (String item : testCases) { System.out.println("item is"+item); submenu.add(new Action(item) { @Override public void run() { // implement this } }); } contextMenu.add(submenu); } So how can this be done
has title: How can we get the text of the submenu context created when it is pressed
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27506646
tagged with: e4
type: AnsweredQuestion
tagged with: contextmenu

http://stackoverflow.com/comment/43458208
has text: @hzjw Asked by whom? If your professor is encouraging you to write code that looks like this, then he/she should not be teaching Java programming.
score: 2
comment on: http://stackoverflow.com/q/27512082
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43484915
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27527892
has text: So, what exactly is the problem? You know how to use the `Scanner`, right? Read the first 15 lines, throw them out, then keep reading, putting the numbers you read into an array. Have you tried it?

http://stackoverflow.com/comment/43507270
comment on: http://stackoverflow.com/a/27539671
has text: @DownVoter Can you pls leave a comment ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27611136
has title: How to override the properties file value through command line arguments?
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a property file which is like this - hostName=machineA.domain.host.com emailFrom=tester@host.com emailTo=world@host.com emailCc=hello@host.com And now I am reading the above property file from my Java program as - public class FileReaderTask { private static String hostName; private static String emailFrom; private static String emailTo; private static String emailCc; private static final String configFileName = "config.properties"; private static final Properties prop = new Properties(); public static void main(String[] args) { readConfig(arguments); } private static void readConfig(String[] args) throws FileNotFoundException, IOException { if (!TestUtils.isEmpty(args) &amp;&amp; args.length != 0) { prop.load(new FileInputStream(args[0])); } else { prop.load(FileReaderTask.class.getClassLoader().getResourceAsStream(configFileName)); } hostName = prop.getProperty("hostName").trim(); emailFrom = prop.getProperty("emailFrom").trim(); emailTo = prop.getProperty("emailTo").trim(); emailCc = prop.getProperty("emailCc").trim(); } } Most of the time, I will be running my above program through command line as a runnable jar like this - java -jar abc.jar config.properties My questions are - Is there any way we can override the above attributes in the property file through command line without touching the file if needed? Since I don't want to modify my config.properties file always whenever I need to change any attributes value? Is this possible to do? Something like this should override the hostName value in the file? java -jar abc.jar config.properties hostName=machineB.domain.host.com And also, is there any way to add --help while running the abc.jar that can tell us more about how to run the jar file and what does each property means and how to use them? I have seen --help while running most of the C++ executable or Unix stuff so not sure how we can do the same thing in Java? Do I need to use CommandLine parser for this in Java to achieve both of the things?
has answer: http://stackoverflow.com/a/27612876
has comment: http://stackoverflow.com/comment/43644625
tagged with: properties
upvote count: 6
tagged with: parsing
tagged with: command-line
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27612876
score: 6
type: Question
tagged with: java
tagged with: command-line-arguments
has comment: http://stackoverflow.com/comment/43645939
has comment: http://stackoverflow.com/comment/43646246

http://stackoverflow.com/q/27509937
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I've been using Jackson for a while to parse json files and load the attribute and value into a Map. This is essentially what my code looks like: Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); ObjectMapper mapper = new ObjectMapper(); File file = new File(pathToSource); map = mapper.readValue(file, new TypeReference&lt;HashMap&lt;String, String&gt;&gt;() {}); This has worked well for flat json files where the keys are flat, just containing attribute/value pairs. { "attr":"value" "attr":"value" ... } Now one of my sources has begun putting a key inside another key and th readValue method pukes when it hits the inner key. { "key1":{ "attr":"value" "attr":"value" "key2":{ "attr":"value" "attr":"value" } } } One caveat of my need is I want to capture the attribute name and the value both. If I parse the json more granularly, taking attributes one by one, I can't access the attribute name. I've been looking at this for a bit now and can't find the right combination to parse the keys, while capturing the attribute name and value. Any suggestions welcome.
tagged with: jackson
score: 0
has title: Reading attribute and values into map when key contains another key
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27537404
tagged with: java

http://stackoverflow.com/q/27508869
answer count: 1
downvote count: 0
favorite count: 0
has title: Java8 lambda predicate exception
tagged with: lambda
has comment: http://stackoverflow.com/comment/43495809
tagged with: java-8
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14039995
score: 1
tagged with: predicate
tagged with: java
upvote count: 1
type: Question
has body: I have the follow lambda expression: public mylambdafunction(){ Optional&lt;MyClass&gt; optional = Arrays.stream(myClassesValues).filter(x -&gt; new String(x.bytesArray,"UTF-16LE").equalsIgnoreCase(comparationString)).findFirst(); } Well, the method new String(x.bytesArray,” UTF-16LE”) raise the Exception UnsupportedEncodingException. I’d like to raise the exception to the main function mylambdafunction(), somethings like: public mylambdafunction() throws UnsupportedEncodingException{ .... } Is that possible?
has answer: http://stackoverflow.com/a/27508918
accepted answer: http://stackoverflow.com/a/27508918

http://stackoverflow.com/comment/43535760
type: QuestionComment
comment on: http://stackoverflow.com/q/27551766
has text: the generic class for Map keys. just like the K in HashMap<K, V>. It can be any type.
score: 0
type: Comment

android
tags question: http://stackoverflow.com/q/27580718
tags question: http://stackoverflow.com/q/27479181
tags question: http://stackoverflow.com/q/27601174
tags question: http://stackoverflow.com/q/27492795
tags question: http://stackoverflow.com/q/27549019
tags question: http://stackoverflow.com/q/27559680
tags question: http://stackoverflow.com/q/27570345
tags question: http://stackoverflow.com/q/27490255
tags question: http://stackoverflow.com/q/27579468
tags question: http://stackoverflow.com/q/27523455
tags question: http://stackoverflow.com/q/27625361
tags question: http://stackoverflow.com/q/27532998
tags question: http://stackoverflow.com/q/27605084
tags question: http://stackoverflow.com/q/27533692
tags question: http://stackoverflow.com/q/27625734
tags question: http://stackoverflow.com/q/27538996
tags question: http://stackoverflow.com/q/27639732
tags question: http://stackoverflow.com/q/27527819
tags question: http://stackoverflow.com/q/27512571
tags question: http://stackoverflow.com/q/27578353
tags question: http://stackoverflow.com/q/27573315
tags question: http://stackoverflow.com/q/27600141
tags question: http://stackoverflow.com/q/27562445
tags question: http://stackoverflow.com/q/27612496
tags question: http://stackoverflow.com/q/27502727
tags question: http://stackoverflow.com/q/27599096
tags question: http://stackoverflow.com/q/27559985
tags question: http://stackoverflow.com/q/27537269
tags question: http://stackoverflow.com/q/27477967
tags question: http://stackoverflow.com/q/27615597
tags question: http://stackoverflow.com/q/27630714
tags question: http://stackoverflow.com/q/27629121
tags question: http://stackoverflow.com/q/27479249
tags question: http://stackoverflow.com/q/27562142
tags question: http://stackoverflow.com/q/27597380
tags question: http://stackoverflow.com/q/27602234
tags question: http://stackoverflow.com/q/27513487
tags question: http://stackoverflow.com/q/27513909
tags question: http://stackoverflow.com/q/27595425
tags question: http://stackoverflow.com/q/27617676
tags question: http://stackoverflow.com/q/27633388
tags question: http://stackoverflow.com/q/27540727
tags question: http://stackoverflow.com/q/27589439
tags question: http://stackoverflow.com/q/27479487
tags question: http://stackoverflow.com/q/27640200
tags question: http://stackoverflow.com/q/27591756
tags question: http://stackoverflow.com/q/27633431
tags question: http://stackoverflow.com/q/27632001
tags question: http://stackoverflow.com/q/27629498
tags question: http://stackoverflow.com/q/27552956
tags question: http://stackoverflow.com/q/27616438
tags question: http://stackoverflow.com/q/27516738
tags question: http://stackoverflow.com/q/27505055
tags question: http://stackoverflow.com/q/27539561
tags question: http://stackoverflow.com/q/27592943
tags question: http://stackoverflow.com/q/27568112
tags question: http://stackoverflow.com/q/27562326
tags question: http://stackoverflow.com/q/27585374
tags question: http://stackoverflow.com/q/27628985
tags question: http://stackoverflow.com/q/27592060
tags question: http://stackoverflow.com/q/27613887
tags question: http://stackoverflow.com/q/27478329
tags question: http://stackoverflow.com/q/27588317
tags question: http://stackoverflow.com/q/27599380
tags question: http://stackoverflow.com/q/27555378
tags question: http://stackoverflow.com/q/27617713
tags question: http://stackoverflow.com/q/27608536
tags question: http://stackoverflow.com/q/27624936
tags question: http://stackoverflow.com/q/27596522
tags question: http://stackoverflow.com/q/27606794
tags question: http://stackoverflow.com/q/27600915
tags question: http://stackoverflow.com/q/27570819
tags question: http://stackoverflow.com/q/27496050
tags question: http://stackoverflow.com/q/27544841
tags question: http://stackoverflow.com/q/27567796
tags question: http://stackoverflow.com/q/27581005
tags question: http://stackoverflow.com/q/27576392
tags question: http://stackoverflow.com/q/27535501
tags question: http://stackoverflow.com/q/27514243
tags question: http://stackoverflow.com/q/27515424

http://stackoverflow.com/a/27612592
has body: I guess this is the problem: MOVIE_ID varchar(255) not null auto_increment Based on this I guess that movieId has a String datatype. Change it to Integer for instance. You can't use auto_increment which is used by the Hibernate generator with varchar datatype.
accepted answer of: http://stackoverflow.com/q/27612537
answers question: http://stackoverflow.com/q/27612537
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27491950
has body: I have a Struts 1.3 application with forms where the input fields should support special characters. In the JSP, UTF-8 is defined as the encoding charset. This is also in the rendered HTML. &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; I fill out the form and enter this string for one of the fields, ëḮ Then I submit the form and page gets re-displayed with the saved value. I see the following on redisplay: ë&amp;#7726; The Struts ActionForm holds the URL version when I reach the Action class, but maybe I should decode it after the form is submitted?
has comment: http://stackoverflow.com/comment/43419805
tagged with: encoding
answer count: 0
downvote count: 0
tagged with: jsp
type: UnansweredQuestion
tagged with: utf-8
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43418283
has title: After JSP Form Submit, UTF-8 Encoding Characters Shown with Ampersand (&#7726;)
tagged with: java
tagged with: character-encoding
upvote count: 1

http://stackoverflow.com/q/27560541
score: 0
has comment: http://stackoverflow.com/comment/43551110
has comment: http://stackoverflow.com/comment/43547746
has comment: http://stackoverflow.com/comment/43547414
answer count: 0
has title: Hibernate duplicated (each row twice) inserts to MySQL Database
type: UnansweredQuestion
tagged with: spring
has body: I read a CSV file with university courses (11000 rows) and want to insert this using hibernate into a MySQL database. The problem is that hibernate inserts each row twice. There is a bug regarding this issue. Solution should be to flush each child after persisting. See here: Hibernate inserts duplicates into a @OneToMany collection and https://hibernate.atlassian.net/browse/HHH-6776 Here is the code from my Spring applications controller: @RequestMapping(value = "/readcsv") public String readCSVFile() { entityManager.setFlushMode(FlushModeType.COMMIT); //Load all courses and universities and add to hashmap for fast lookup. ArrayList&lt;Course&gt; allCourses = (ArrayList) entityManager.createQuery("FROM Course").getResultList(); MultiValueMap courseMap = MultiValueMap.decorate(new HashMap&lt;String, Course&gt;()); for (Course c : allCourses) { courseMap.put(c.getName(), c); } ArrayList&lt;University&gt; allUniversities = (ArrayList) entityManager.createQuery("FROM University").getResultList(); HashMap&lt;String, University&gt; universityMap = new HashMap&lt;String, University&gt;(); for (University u : allUniversities) { universityMap.put(u.getName(), u); } Country sweden = (Country) entityManager.createQuery("SELECT c FROM Country c WHERE c.name = 'Sweden'").getSingleResult(); ArrayList&lt;Course&gt; coursesToAdd = new ArrayList&lt;Course&gt;(); //Set fixed parameters for this specific dataset. String filename = "/Volumes/320gb/macbookpro/Documents/AntagningsstatistikVT2015.csv"; String semester = "Spring2015"; String type = "Classroom"; int pace = 100; University u; try { //Read file File fileDir = new File(filename); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF-8")); String line; //Loop lines in file while ((line = in.readLine()) != null) { // use comma as separator String[] courseLine = line.split(","); String name = courseLine[1]; String university = courseLine[2]; //See if the course is already in the database …
type: Question
has comment: http://stackoverflow.com/comment/43548617
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/7903800
tagged with: mysql
has comment: http://stackoverflow.com/comment/43550917
tagged with: jpa

http://stackoverflow.com/q/27585460
has comment: http://stackoverflow.com/comment/43595687
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43595601
has title: Replace Activity's fragment with another fragment
upvote count: 1
has comment: http://stackoverflow.com/comment/43595636
has comment: http://stackoverflow.com/comment/43595615
has comment: http://stackoverflow.com/comment/43595738
tagged with: android-fragments
has body: My application has a Fragment inside its Activity. I would like to programmatically replace the fragment by another one from the current fragment itself. For example, if I click on a button inside the fragment, the fragment should be replaced with another one, but the activity should remain the same. I tried this code but it says that fragment_container "cannot be resolved to a symbol" What is fragment_container?: // Create new fragment and transaction Fragment newFragment = new GPAFragment2Test(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack transaction.replace(R.id.fragment_container, newFragment); transaction.addToBackStack(null); // Commit the transaction transaction.commit(); EDIT: Here's the code that sets up the tabs: public class TabPagerAdapter extends FragmentStatePagerAdapter { public TabPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { switch (i) { case 0: //Fragment for 1 return new Fragment1(); case 1: //Fragment for 2 return new Fragment2(); case 2: //Fragment for 3 return new Fragment3(); } return null; } @Override public int getCount() { return 3; //No of Tabs }
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43595470
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43595662
has comment: http://stackoverflow.com/comment/43595694
tagged with: android
has comment: http://stackoverflow.com/comment/43595725
tagged with: android-studio

http://stackoverflow.com/comment/43635992
type: QuestionComment
comment on: http://stackoverflow.com/q/27606769
has text: Where do you see the `?????` ? Are you seeing it in the browser? Are you receiving it in an ajax response handler?
score: 0
type: Comment

http://stackoverflow.com/q/27621403
has title: Get the content which can be any type and the attributs of a tag XML with JAXB
tagged with: jaxb
has body: I have a problem using jaxb with mapping the content of a tag with the type "object" I have a tag called "attribute" and in this tag, I have an attribute "type". the content of this tag can be any type, I wanted to get the "type" attribute of this tag and the content that's why I created the Value class except that when I put XmlValue annotation on the field "content", I have a NullPointerException My XML: 9137755520013147917 Routeur 9139898058113224747 pe-cdg1200e-2sn311-01 9138560130813318972 Routeur PE 3061830882013808530 Elément de Réseau My tag attribute which can have the content with any type Attribute.java @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "id", "name", "ismultiple", "type", "value" }) public static class Attribute { @XmlElement(required = true) protected BigInteger id; protected String name; protected String ismultiple; protected String type; @XmlElement(required = true) protected Value value; Value.java @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") public class Value { public Value() { } @XmlAttribute(namespace="http://www.w3.org/2001/XMLSchema-instance") private String type; @XmlValue private Object value ; //getter setter I have this error: Exception in thread "main" java.lang.NullPointerException at com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:154) at com.sun.xml.internal.bind.v2.runtime.property.ValueProperty.<init>(ValueProperty.java:66) at com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:95) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:145) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:479) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:498) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.<init>(SingleElementNodeProperty.java:90) at sun.reflect.NativeConstructorA…
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43664561
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43664774
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27628183
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43663967
has comment: http://stackoverflow.com/comment/43664965
has comment: http://stackoverflow.com/comment/43664192
tagged with: java

http://stackoverflow.com/q/27534141
has body: I'm trying to embed the android terminal emulator project in my project, but I always got an error of NoClassDefFoundError. I already add the jackpal_androidterm_emulator.jar but the error stays the same. BTW, I don't know what code will I add in the Manifest, I just add &lt;activity name=".Term"&gt;&lt;/activity&gt; What else will I do? Please help me. Thanks! 12-18 04:14:52.490: E/AndroidRuntime(2044): FATAL EXCEPTION: main 12-18 04:14:52.490: E/AndroidRuntime(2044): java.lang.NoClassDefFoundError: jackpal.androidterm.Term 12-18 04:14:52.490: E/AndroidRuntime(2044): at com.example.ttg.fragment.LinuxCommands.onListItemClick(LinuxCommands.java:91) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.app.ListFragment$2.onItemClick(ListFragment.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.widget.AdapterView.performItemClick(AdapterView.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.widget.AbsListView.performItemClick(AbsListView.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.widget.AbsListView$PerformClick.run(AbsListView.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.widget.AbsListView$1.run(AbsListView.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.os.Handler.handleCallback(Handler.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.os.Handler.dispatchMessage(Handler.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.os.Looper.loop(Looper.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at android.app.ActivityThread.main(ActivityThread.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at java.lang.reflect.Method.invokeNative(Native Method) 12-18 04:14:52.490: E/AndroidRuntime(2044): at java.lang.reflect.Method.invoke(Method.java:511) 12-18 04:14:52.490: E/AndroidRuntime(2044): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java) 12-18 04:14:52.490: E/AndroidRuntime(2044): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java) 12-18 04:14:52.49…
type: Question
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43496832
score: 0
answer count: 1
tagged with: terminal
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43496981
has title: How to fix NoClassDefFoundError - Android Eclipse
has answer: http://stackoverflow.com/a/27534600
has comment: http://stackoverflow.com/comment/43497047
tagged with: java

http://stackoverflow.com/q/27527233
type: Question
tagged with: java
upvote count: 1
answer count: 1
tagged with: logging
type: UnansweredQuestion
tagged with: logback
tagged with: slf4j
downvote count: 0
has answer: http://stackoverflow.com/a/27527475
has body: I using SLF4J and Logback for logging infrastructure at my application. I using Logger.isDebugEnable() method before any log, for sample: if(logger.isDebugEnable()) logger.debug('process transaction....') goal of above code is : don't construct string process transaction.... in heap when log level is not Debug. My question is: Is there benefit between my code style or direct logger.debug('process transaction....') without check enable log level?
score: 1
favorite count: 0
has title: check enable of logger level vs don't check in SLF4J\Logback

http://stackoverflow.com/comment/43441014
type: QuestionComment
has text: Is `xsi:schemaLocation="http://www.hibernate.org/xsd/ hibernate-configuration hibernate-configuration- 4.0.xsd"` really like this in your xml or do the extra spaces have been added when pasting here?
score: 0
comment on: http://stackoverflow.com/q/27504186
type: Comment

http://stackoverflow.com/comment/89460235
type: QuestionComment
type: Comment
has text: For JPA and Hibernate check Vlad Mihalcea: https://vladmihalcea.com/entitymanager-find-getreference-jpa/
comment on: http://stackoverflow.com/q/27579251
score: 0

http://stackoverflow.com/a/27539729
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/43507216
accepted answer of: http://stackoverflow.com/q/27539608
score: -1
answers question: http://stackoverflow.com/q/27539608
has body: Something like below &lt;% String message = (String)request.getAttribute("message"); %&gt; or &lt;% String message = ${message}; %&gt;
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/43507241

http://stackoverflow.com/comment/43678194
comment on: http://stackoverflow.com/q/27626148
type: QuestionComment
type: Comment
has text: @BrianGoetz I had considered this but discounted it. For arrays, yes, partitioning is O(1); But for lists this is still O(n), much less than O(n log n). And just as `Arrays.parallelSort()` single-threads below a size threshold, so could a `List` version.
score: 0

http://stackoverflow.com/comment/43549743
score: 0
comment on: http://stackoverflow.com/q/27561957
type: Comment
type: QuestionComment
has text: It would really help if you could provide a short but complete program demonstrating the problem.

http://stackoverflow.com/q/27589941
score: 2
has body: I use Skobbler Maps. When I set my own icons as annotations, onAnnotationSelected isn't called. And when I set default icons (annotation.setAnnotationType(SKAnnotation.SK_ANNOTATION_TYPE_PURPLE);), It worked properly. What I'm doing wrong? cursor = dataBaseHelper.getWritableDatabase().rawQuery(stringBuilder.toString(), null); int count = cursor.getCount(); for (int i = 0; i &lt; count; i++) { if (cursor.moveToPosition(i)) { SKAnnotation annotation = new SKAnnotation(); annotation.setUniqueID(cursor.getInt(cursor.getColumnIndex(1))); annotation.setLocation(new SKCoordinate(cursor.getDouble(cursor.getColumnIndex(2)), cursor.getDouble(cursor.getColumnIndex(3)))); annotation.setMininumZoomLevel(5); annotation.setImageSize(32); annotation.setImagePath(imagePath+cursor.getString(cursor.getColumnIndex(4))); mapView.addAnnotation(annotation, SKAnimationSettings.ANIMATION_NONE);
tagged with: java
tagged with: skmaps
type: Question
downvote count: 0
favorite count: 0
tagged with: android
answer count: 1
has title: Skobbler. onAnnotationSelected not called, when I set my own annotations
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27779902

http://stackoverflow.com/comment/43449021
has text: i mean changes the font size
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27504581

http://stackoverflow.com/q/27567485
tagged with: hazelcast
score: 7
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/51590745
has answer: http://stackoverflow.com/a/27615568
upvote count: 7
type: Question
possible better answer: http://stackoverflow.com/a/35623997
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35623997
has title: How can I check if a hazelcast cluster is alive from a java client?
tagged with: java
tagged with: client-server
has answer: http://stackoverflow.com/a/48463837
has body: We use hazelcast in client-server mode. The hazelcast cluster contains 2 hazelcast nodes and we have about 25 clients connected to the cluster. What I am lookin for now is a simple check that tries to figure out if the cluster is still alive. It should be a rather cheap operation because this check will occure on every client quite frequently (once every second I could imagine). What is the best way to do so?
accepted answer: http://stackoverflow.com/a/27615568
downvote count: 0

http://stackoverflow.com/comment/43507718
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27526498
has text: Try to use some CI tool like jenkins where you can achieve this.
score: 0

http://stackoverflow.com/comment/43678241
score: 0
comment on: http://stackoverflow.com/q/27627873
has text: [JAVA Swing GUI Components howto RTL view?](http://stackoverflow.com/questions/354745/java-swing-gui-components-howto-rtl-view)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43478932
has text: You can't create an alias to a type in Java.
type: AnswerComment
comment on: http://stackoverflow.com/a/27525168
type: Comment
score: 1

http://stackoverflow.com/comment/43416776
comment on: http://stackoverflow.com/a/27492436
score: 0
type: AnswerComment
type: Comment
has text: I know that there is controversy with the exception usage, but for me they fit with the problem, if we base on java documentation... "An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions." and this, in my opinion, can be considered that case.

http://stackoverflow.com/q/27589439
has answer: http://stackoverflow.com/a/27589704
has comment: http://stackoverflow.com/comment/43603049
has body: hello i am learning android from book hello,android and i am stuck in chapter 3 . I am trying to show a new activity containing information about Sudoku game when user click the about button but dwe to a some reason when i ran the app it shows me unfortunately,Sudoku has stopped.I tried to solve by myself but unable to figure out the problem .I need your hellllllllllp here the files are listed below AndroidManifest.xml <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> about.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/about_content" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/about_text"/> activity_sudoku.xml(my main activity) <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="25dip" android:text="@string/main_title" android:textSize="24.5sp" /> Sudoku.java package com.android.sudoku; //import android.support.v7.app.ActionBarActivity; //import android.support.v7.app.ActionBar; //import android.support.v4.app.Fragment; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.os.Bundle; //import android.view.LayoutInflater; //import android.view.Menu; //import android.view.MenuItem; import android.app.Activity; //import android.view.View; //import android.view.ViewGroup; //import android.os.Build; public class Sudoku extends Activity implements OnClickListener{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sudoku); // setup click listeners for all the button View continueButton = findViewById(R.id.continue_button); continueButton.setOnClickListener(this); View newButton = findViewById(R.id.new_button); newButton.setOnClickListener(this); System.out.print("here ")…
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/27589722
score: -2
tagged with: java
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/43603040
favorite count: 0
has comment: http://stackoverflow.com/comment/43603373
has title: android app showing error (unfortunately,Sudoku has stopped)
tagged with: android

http://stackoverflow.com/comment/43629135
has text: Sorry @Eran. Had confused the variable name... It all worked, thanks again.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27601116

http://stackoverflow.com/a/27511133
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27510919
has body: No. At least one request has to be made before you cache response data. That first request could either be by application user or by code itself in Post Construct as mentioned by @Pumpkin

http://stackoverflow.com/q/27552868
answer count: 2
downvote count: 0
favorite count: 0
tagged with: executorservice
has answer: http://stackoverflow.com/a/27553769
type: AnsweredQuestion
has title: java - How can I get a future's stack trace on TimeoutException
tagged with: java
tagged with: multithreading
has body: In java, I would like to determine the current stack of the thread which populates the result of the future when a TimeoutException occurs. It seems that the top entry in the stack trace provided by a TimeoutException only indicates where future.get() was invoked, not the state of the background thread. For example: ExecutorService executor = Executors.newSingleThreadExecutor(); Future&lt;String&gt; future = executor.submit(new Callable&lt;String&gt;() { @Override public String call() throws Exception { Thread.sleep(10000); return ""; } }); try { future.get(1, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { e.printStackTrace(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } In this example I've found that the top entry is the future.get(1, TimeUnit.MILLISECONDS) entry, not the Thread.sleep(10000). I would like the stack trace to indicate Thread.sleep(10000) since this is what is currently being executed. Is there an elegant way of doing this? I've found that if there is an actual execution problem, then the ExecutionException.printStackTrace() will indicate where the problem occurred in the background thread.
has answer: http://stackoverflow.com/a/27552961
score: 9
type: Question
upvote count: 9
accepted answer: http://stackoverflow.com/a/27553769
possible better answer: http://stackoverflow.com/a/27552961

http://stackoverflow.com/q/27590185
linked to: http://stackoverflow.com/q/7229226
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/25965176
favorite count: 0
tagged with: jframe
has title: JFrame not correct size
score: 1
tagged with: java
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/27590219
accepted answer: http://stackoverflow.com/a/27590219
type: Question
type: AnsweredQuestion
has body: I am creating a pong game in Java. I originally had an undecorated JFrame with a width of 700 and a height of 400. I later changed my mind and switched to a decorated frame. The error is that the ball travels off of the screen for the top 30px or so in the decorated frame. I measured the screen, and indeed it is 700 x 400 when decorated; however, I need the area where the ball will be painted to be 700 x 400, not the entire JFrame. What can I do? How I set the size of my frame: this.setSize(new Dimension(WIDTH, HEIGHT)); I am happy to post all of the code needed to solve this problem upon request. EDIT import java.awt.Dimension; import javax.swing.JComponent; import javax.swing.JFrame; public class Tester extends JFrame { public Tester() { this.add(new Window()); pack(); addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { formMouseClicked(evt); } }); } private void formMouseClicked(java.awt.event.MouseEvent evt) { System.out.println("X: " + evt.getX() + ", Y: " + evt.getY()); } public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Tester().setVisible(true); } }); } public class Window extends JComponent { @Override public Dimension getPreferredSize() { return new Dimension(300, 300); } } }
has comment: http://stackoverflow.com/comment/43606395

http://stackoverflow.com/comment/43484486
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27527955
has text: Whats your problem exactly?

http://stackoverflow.com/q/27584608
has answer: http://stackoverflow.com/a/27584767
favorite count: 0
possible better answer: http://stackoverflow.com/a/27584633
tagged with: arraylist
has answer: http://stackoverflow.com/a/27584640
has answer: http://stackoverflow.com/a/27584633
answer count: 5
has comment: http://stackoverflow.com/comment/43593819
has answer: http://stackoverflow.com/a/27585429
score: 2
has comment: http://stackoverflow.com/comment/43593800
type: AnsweredQuestion
has title: Add something to arraylist while checking it
upvote count: 2
has answer: http://stackoverflow.com/a/27584647
accepted answer: http://stackoverflow.com/a/27584640
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43597139
linked to: http://stackoverflow.com/q/18553556
has body: I need to check through an arraylist of "tiles" and if it finds a tile that its not used yet add 4 tiles around that tile but when i add something new while checking the list it crashes. How to add objects to arraylist without crashing it while checking it? I add one tile and then check it: private static List&lt;Tile&gt; tiles = new ArrayList&lt;Tile&gt;(); tiles.add(new Tile(mapsize/2*tilesize, mapsize/2*tilesize)); for(Tile tile: tiles){ if(!tile.spread){ tile.spread=true; tiles.add(new Tile(tile.position.x-tilesize, tile.position.y)); //this line crashes it } }
has comment: http://stackoverflow.com/comment/43594239
downvote count: 0

http://stackoverflow.com/comment/43641136
comment on: http://stackoverflow.com/q/27609389
score: 0
has text: Can you add the sections where `render` and `tick` are used?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27561391
has title: Intellij test run history
downvote count: 0
has body: What I miss the most in IntelliJ compared to Eclipse is the test run history window. Does anything like this exist in IntelliJ? I didn't find it anywhere so far and have looked a few times at least. In our project we have ~500 integration test cases which take like 5 minutes to run from IDE. Often I have a situation where for e.g. 5 tests fail in 2-3 different classes. I fix something, that should remove failures from first test suite, rerun it to see if it helped and I must rerun all 500 tests to see which classes contained failures earlier. That is really painful. In eclipse I would just lookup those in test history, repair them also and finally run all 500 to check if nothing new camed up. Is there a plugin out there or do I miss something obvious? I use IntelliJ 13.
tagged with: java
has answer: http://stackoverflow.com/a/27566183
type: Question
tagged with: testing
possible better answer: http://stackoverflow.com/a/37211769
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/65352486
answer count: 6
tagged with: eclipse
score: 20
has answer: http://stackoverflow.com/a/79187808
tagged with: junit
favorite count: 0
has answer: http://stackoverflow.com/a/27562463
has answer: http://stackoverflow.com/a/37211769
has answer: http://stackoverflow.com/a/69316196
accepted answer: http://stackoverflow.com/a/27566183
type: AnsweredQuestion
upvote count: 20

http://stackoverflow.com/comment/43656389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27617532
has text: http://stackoverflow.com/questions/6409510/how-to-run-a-java-class-with-a-jar-in-the-classpath
score: 0

http://stackoverflow.com/comment/43683597
type: QuestionComment
type: Comment
has text: can you please add the actual error message
comment on: http://stackoverflow.com/q/27631648
score: 0

http://stackoverflow.com/comment/43585841
score: 1
has text: https://stackoverflow.com/questions/13771299/buttons-spacing/13772037
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27580718

http://stackoverflow.com/q/27602129
tagged with: java
tagged with: nio
type: Question
has title: BitTorrent protocol with Java - Bitfield after successful handshake
linked to: http://stackoverflow.com/q/944530
has answer: http://stackoverflow.com/a/27602482
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27602482
favorite count: 0
upvote count: 6
tagged with: bittorrent
score: 6
has body: Having successfully sent and received handshakes from multiple peers, the next step in the BitTorrent message chain is the bitfield message. The bitfield message looks like below, where the top line explainins the byte-size of the protocol segments: &lt;4-bytes&gt;&lt;1-byte&gt;&lt;x-bytes&gt; &lt;nrOfBits&gt;&lt;identifier&gt;&lt;bits&gt; The problem I have is that nearly all peers seem to be sending bitfield messages that differ from the above representation! The messages tend to look like this: size: 332, [0, 0, 0, 112, 5, 127, -1, -1, -1, -1, -5, -1, -1, -1, -1, -1, -17...] The first problem is that the majority of the messages I receive have length bytes: [0, 0, 0, 112] even though the received message in this case contains 332 bytes in total, while at some other instances the message may only be 80 bytes or so. The second problem is that the bits usually are repeating -1 or some other strange negative value.. I don't think this can be attributed to low-level encoding problems on my side however, since other messages works fine..
type: AnsweredQuestion
tagged with: network-protocols
tagged with: network-programming

android-asynctask
tags question: http://stackoverflow.com/q/27518681
tags question: http://stackoverflow.com/q/27482350
type: Tag
tags question: http://stackoverflow.com/q/27524942
tag name: android-asynctask
tags question: http://stackoverflow.com/q/27493584
tags question: http://stackoverflow.com/q/27631654
tags question: http://stackoverflow.com/q/27622205
tags question: http://stackoverflow.com/q/27586436
tags question: http://stackoverflow.com/q/27628613
tags question: http://stackoverflow.com/q/27492083
tags question: http://stackoverflow.com/q/27481999
tags question: http://stackoverflow.com/q/27508193
tags question: http://stackoverflow.com/q/27556540
tags question: http://stackoverflow.com/q/27613631
tags question: http://stackoverflow.com/q/27606560
tags question: http://stackoverflow.com/q/27557471
tags question: http://stackoverflow.com/q/27520033
tags question: http://stackoverflow.com/q/27608648
tags question: http://stackoverflow.com/q/27583414
tags question: http://stackoverflow.com/q/27495239

http://stackoverflow.com/a/27604274
accepted answer of: http://stackoverflow.com/q/27604251
upvote count: 3
has comment: http://stackoverflow.com/comment/43630784
has comment: http://stackoverflow.com/comment/43630814
type: Answer
score: 3
has body: In that case you should use nextDouble(). The Gaussian distribution is a distribution that ranges over the entire collection of double values (mathematically speaking, from minus infinity to positive infinity) with a peak around zero. The Gaussian distribution is thus not uniform. The nextDouble() method draws numbers uniformly between 0 and 1 (0 included, 1 excluded). You can thus draw a number randomly between 0 and 255 (both inclusive) using the following code: Random rand = new Random(); int value = (int) math.floor(256.0*rand.nextDouble()); A faster algorithm is however masking a random integer (Random.nextInt): Random rand = new Random(); int value = rand.nextInt()&amp;0xff; This algorithm isn't faster in big-oh analysis, but it saves one the more expensive nextDouble method call as well as a floating point multiplication and a float-to-int conversion.
answers question: http://stackoverflow.com/q/27604251
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27542239
has body: It is not just Tomcat implementation, this API is defined as part of JSR 356 - Java API for WebSocket. To answer your question - annotated and programmatic API should be equivalent. There are some (very very subtle) differences, which you most likely won't notice In general, programmatic API is more verbose and it might reflect more runtime changes (reading configuration from property file etc) and annotated API is more static and less verbose (so you can do more with less code).
accepted answer of: http://stackoverflow.com/q/27509905
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27509905

http://stackoverflow.com/comment/43428789
has text: keep `nextScreenBtn` code outside of scroll layout. so button will always be at bottom of screen.
comment on: http://stackoverflow.com/q/27498900
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/45598858
type: Comment
type: QuestionComment
has text: small side note, you have OpenJPA2.2.x but persistence.xml sets JPA version=1.0 profile. I guess you have copypasted an old jpa tutorial file. Having version=2.0 is probably you wanted to use. See this https://github.com/Murmur/ScopedEntityManager/blob/master/example_webapp/webapp/WEB-INF/classes/META-INF/persistence.xml
comment on: http://stackoverflow.com/q/27625604
score: 0

http://stackoverflow.com/comment/43402352
type: Comment
comment on: http://stackoverflow.com/a/27480136
has text: For File transfer we ll need SFTP, to execude commands we ll have to use EXEC.. If I have to do both and what of I have multiple commands to execute ??
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43766047
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27622596
has text: But wouldn't the `2*a` optimization be equivalent of always choosing a scheduling without intervening write? I mean regardless if the threads are executed in parallel?
score: 0

http://stackoverflow.com/comment/43422914
type: AnswerComment
has text: Feel free to correct me. I'm a 3rd semester CS student and I'm trying to improve aswell, thats part of why I'm here answering stuff!
score: 0
comment on: http://stackoverflow.com/a/27495568
type: Comment

http://stackoverflow.com/a/27500126
downvote count: 0
score: 6
upvote count: 6
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27499607
has body: I want to thank @almas-shaikh for this answer. His comment made me check over C:\Program Files\Java\jdk1.7.0_71\jre\bin and see that there was no java.dll library file inside that directory. What I did next was just deleting the jdk and reinstalling it via jdk-7u71-windows-x64.exe executable. Now when I execute java -home, I get Now the part I don't get is how the java.dll library file was deleted in the first place......
has comment: http://stackoverflow.com/comment/73626522
accepted answer of: http://stackoverflow.com/q/27499607
type: Answer
has comment: http://stackoverflow.com/comment/105239116

http://stackoverflow.com/comment/43410074
type: Comment
comment on: http://stackoverflow.com/a/27488808
type: AnswerComment
has text: One way i could think of is to set parameter in configuration in driver code and use Context.getConfiguration to get the value.
score: 0

http://stackoverflow.com/a/27561700
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43549089
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27561494
has body: It is very unwise to develop your own encryption algorithms. It might be useful only as a school exercise. Otherwise it could be dangerous! However, if you really have to do it on your own, have a look at some existing source code as inspiration: https://www.bouncycastle.org/ or read the technical specification of the cipher you want to implement, AES for example: http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27561494
score: 1

http://stackoverflow.com/comment/43545642
type: QuestionComment
comment on: http://stackoverflow.com/q/27559704
has text: VisualVM doesn't really tell me anything about the location of memory though..
score: 0
type: Comment

http://stackoverflow.com/q/27499802
downvote count: 0
has answer: http://stackoverflow.com/a/27499885
accepted answer: http://stackoverflow.com/a/27499885
has comment: http://stackoverflow.com/comment/43430385
type: Question
has comment: http://stackoverflow.com/comment/43430341
has comment: http://stackoverflow.com/comment/43430362
tagged with: java
score: 4
has body: Why does this fail? String n = "h107"; if (n.matches("\\D+")) { System.out.println("non digit in it"); } I had a night sleep over it, and I still not get it. I got a solution now: if (n.matches(".*\\D+.*")) { But in my (maybe lack of knowledge) the first one should also match. Cause if it has to match a complete String, then what's the point of a '^' character for a line beginning.
answer count: 2
possible better answer: http://stackoverflow.com/a/27500073
favorite count: 0
has answer: http://stackoverflow.com/a/27500073
tagged with: regex
upvote count: 4
has title: Regex check to see if a String contains non digit fails
type: AnsweredQuestion

http://stackoverflow.com/q/27563595
tagged with: maven
type: Question
tagged with: java
has title: How does Selenium Test class run in Maven project
has body: I have a question regarding Selenium web Driver. I want to test my web application using selenium. I write the test class in test folder of my maven project. once I give maven build command, The test classes are run,and after successful run of test classes,the build will be successful and I can deploy my app in web-apps folder of my apache-tomcat. But to run the test in Selenium I need to have my app already running in my localhost. How will this happen ?? Or is there something wrong with my approach??
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43552941
has answer: http://stackoverflow.com/a/27565775
type: UnansweredQuestion
tagged with: selenium

http://stackoverflow.com/a/27578877
type: Answer
has comment: http://stackoverflow.com/comment/43583753
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/27577680
has comment: http://stackoverflow.com/comment/43583468
downvote count: 1
has comment: http://stackoverflow.com/comment/43586971
has body: The most commonly used encryption/decryption technique is AES. You can find more information Visit http://en.wikipedia.org/wiki/Advanced_Encryption_Standard? You simply need to define a KEY(anything like for example: 25346483936) which will be common both at mobile as well as server end along with an IV_Vector which is required for Cryptography it will be more clear from the code below. Note: The length of the key must be equal to IV_Vector array size, it is 16 in the below example. Now using the encrypt method you can encrypt any information before sending it to server over a non-secure network. Similarly you can decrypt information received from server using DecryptData class. public class Constants { // encryption/decryption public static String AES_KEY = "0366D8637F9C6B21"; public static byte[] IV_VECTOR = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; } /** * This class is used to decrypt an encrypted string value. * * @author kthakur * */ public class EncryptDecrytData { /** * This method is used to encrypt a string value. * * @param text * - string value to be encrypted. * * @return result(encrypted string) as String * * @throws Exception * */ @TargetApi(8) public static String encrytData(String text) throws Exception { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); byte[] static_key = Constants.AES_KEY.getBytes(); SecretKeySpec keySpec = new SecretKeySpec(static_key, "AES"); IvParameterSpec ivSpec = new IvParameterSpec(Constants.IV_VECTOR); cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); byte[] results = cipher.doFinal(text.getBytes()); String result = Base64.encodeToString(results, Base64.NO_WRAP|Base64.DEFAULT); return result; } /** * This method is used to decrypt a string value. * * @param text * - string value to be decrypted. * @return result(decrypted string) as String * * @throws Exception */ @SuppressLint("NewApi") public static String decryptData(String text)throws Exception{ byte[] encryted_bytes = Base64.decode(text…
has comment: http://stackoverflow.com/comment/43582587

http://stackoverflow.com/a/27628303
answers question: http://stackoverflow.com/q/27628229
has body: The list is in a different scope. Do this in your Jframe class: public MyFrame(List&lt;String&gt; data) { //now put your code for the Jlist here using the variable name "data" for your list }
type: Answer
score: 0

http://stackoverflow.com/a/27586058
upvote count: 0
answers question: http://stackoverflow.com/q/27586041
type: Answer
has body: You can add onPause and onResume methods: @Override public void onPause() { } and @Override public void onResume() { } Then put your pausing code and your resuming code in the proper section.
score: -3
downvote count: 3
has comment: http://stackoverflow.com/comment/43596617

http://stackoverflow.com/q/27635129
has body: I have recently migrated from Eclipse to IntelliJ and am trying to create a run configuration for a Maven project I have imported. The instructions for Eclipse are fairly simple and are described below To run the project, first create a run configuration: 1) Select project name and right click 2) Choose `Run As` then `Run Configurations` 3) Launch new configuration and enter the project's location as the base directory 4) Set the `goal` to run on a `localhost`. 5) Click Configure button to configure the external maven location My issue is at step 4. I am trying to create a goal for my Maven run but I can't seem to find the goal option anywhere. Is there a way to get this goal option? Alternatively what's the best way to run a Maven project in IntelliJ?
has comment: http://stackoverflow.com/comment/43689728
favorite count: 0
has answer: http://stackoverflow.com/a/27635298
type: Question
upvote count: 2
has title: Eclipse to IntelliJ IDEA: Create 'Run As' Configurations
tagged with: maven
accepted answer: http://stackoverflow.com/a/27635298
answer count: 1
tagged with: java
tagged with: eclipse
score: 2
tagged with: intellij-idea
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/27488397
has body: Use a custom row factory and configure the context menu in the updateItem(...) method. Assuming you have a TreeTableView&lt;MyDataType&gt; treeTable = ... ; you would do something like treeTable.setRowFactory(ttv -&gt; { ContextMenu contextMenu = new ContextMenu(); MenuItem inviteMenuItem = new MenuItem("Invite to Chat"); // ... MenuItem banMenuItem = new MenuItem("Ban"); // ... TreeTableRow&lt;MyDataType&gt; row = new TreeTableRow&lt;MyDataType&gt;() { @Override public void updateItem(MyDataType item, boolean empty) { super.updateItem(item, empty); if (empty) { setContextMenu(null); } else { // configure context menu with appropriate menu items, // depending on value of item setContextMenu(contextMenu); } } }; inviteMenuItem.setOnAction(evt -&gt; { MyDataType item = row.getItem(); // do something with item... }); // event handlers for other menu items... return row ; }); Caveat: this is not tested as you didn't provide an MCVE for me to test against, but it should give you the general idea. This will show the appropriate context menu for the row on which the user clicks (with the appropriate trigger for a context menu, e.g. right-click); this is independent of which item is selected.
has comment: http://stackoverflow.com/comment/43420289
type: Answer
accepted answer of: http://stackoverflow.com/q/27480403
has comment: http://stackoverflow.com/comment/43418392
has comment: http://stackoverflow.com/comment/43418327
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/27480403
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43426662
comment on: http://stackoverflow.com/a/27497517
score: 1
has text: Probably correct, but since users have a tendency to misspell things, you probably want to check `nameMap.get(str)` for `null` before trying to access any of its members.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43392149
type: Comment
type: QuestionComment
has text: the base package used in component scan matches with the controller's package?
comment on: http://stackoverflow.com/q/27478924
score: 0

http://stackoverflow.com/q/27612800
score: 2
has answer: http://stackoverflow.com/a/27612817
has comment: http://stackoverflow.com/comment/43647817
tagged with: java
type: Question
downvote count: 0
has body: I am new to Java and I am trying to do a ATM system for a school project. I am not sure how to update an ArrayList value using singleton, please help!!! I am trying to do something like Balance=Balance-withdrawAmount, but it keeps erroring out. public class Users { private static Users instance = null; public static List&lt;String&gt; cta = null; public List&lt;List&lt;String&gt;&gt; accounts = new ArrayList&lt;List&lt;String&gt;&gt;(); private Users() { accounts.add(Arrays.asList("259853430", "0191", "active","admin","Phil","Anselmo","500000","Citi")); accounts.add(Arrays.asList("100393938", "0330", "blocked","regular","Trent","Reznor","100000","Citi")); accounts.add(Arrays.asList("205000800", "0180", "active","regular","Troy","Smith","2006620","Scotiabank")); accounts.add(Arrays.asList("109000600", "0370", "active","regular","James","Hetfield","5049973","Citi")); accounts.add(Arrays.asList("202000500", "0350", "active","regular","Tom","Araya","2240070","JPMorgan")); accounts.add(Arrays.asList("110000200", "1270", "active","regular","Dave","Mustain","3000300","Citi")); } public static Users getObject() { if(instance == null) { instance = new Users(); } return instance; } } ////////////////////// in a different class public class UsuarioNormalMenu extends JFrame implements ActionListener{ public void actionPerformed (ActionEvent MenuNormal) { Users run = Users.getObject(); [ ... ] if(ok_cancel == -1) { if(Double.parseDouble(withdrawAmount) &gt; Double.parseDouble(Users.cta.get(6))) { JOptionPane.showMessageDialog( null,"&lt;html&gt;&lt;font size = 3.5&gt;&lt;font color = black&gt;" + "Inssuficient Funds. " ,"Withdraw", JOptionPane.WARNING_MESSAGE); } else if(Double.parseDouble( withdrawAmount)==Double.parseDouble(Users.cta.get(6))) { JOptionPane.showMessageDialog( null,"&lt;html&gt;&lt;font size = 3.5&gt;&lt;font color = black&gt;" + "Zero Balance!", null, JOptionPane.INFORMATION_MESSAGE); } else if(Mod==0) { // THIS IS WHERE IT IS ERRORING OUT, I WANT TO DO SOMETHI…
accepted answer: http://stackoverflow.com/a/27612817
has title: JAVA:How can I update my arraylist value (using singleton), asigning another value, it keeps erroring out
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43647763
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/27517678
has comment: http://stackoverflow.com/comment/43466193
accepted answer of: http://stackoverflow.com/q/27517265
answers question: http://stackoverflow.com/q/27517265
upvote count: 4
has comment: http://stackoverflow.com/comment/43465523
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43465574
score: 4
has body: The first thing you need to do is read the samples of the file, this will give you the min/max ranges of the waveform (sound wave)... File file = new File("..."); AudioInputStream ais = null; try { ais = AudioSystem.getAudioInputStream(file); int frameLength = (int) ais.getFrameLength(); int frameSize = (int) ais.getFormat().getFrameSize(); byte[] eightBitByteArray = new byte[frameLength * frameSize]; int result = ais.read(eightBitByteArray); int channels = ais.getFormat().getChannels(); int[][] samples = new int[channels][frameLength]; int sampleIndex = 0; for (int t = 0; t &lt; eightBitByteArray.length;) { for (int channel = 0; channel &lt; channels; channel++) { int low = (int) eightBitByteArray[t]; t++; int high = (int) eightBitByteArray[t]; t++; int sample = getSixteenBitSample(high, low); samples[channel][sampleIndex] = sample; } sampleIndex++; } } catch (Exception exp) { exp.printStackTrace(); } finally { try { ais.close(); } catch (Exception e) { } } //... protected int getSixteenBitSample(int high, int low) { return (high &lt;&lt; 8) + (low &amp; 0x00ff); } Then you would need to determine the min/max values, the next example simply checks for channel 0, but you could use the same concept to check all the available channels... int min = 0; int max = 0; for (int sample : samples[0]) { max = Math.max(max, sample); min = Math.min(min, sample); } FYI: It would be more efficient to populate this information when you read the file Once you have this, you can model the samples...but that would depend on framework you intend to use...
has comment: http://stackoverflow.com/comment/49435833
has comment: http://stackoverflow.com/comment/49429747
type: Answer

http://stackoverflow.com/q/27492590
upvote count: 1
score: 1
tagged with: java
tagged with: authentication
has comment: http://stackoverflow.com/comment/43421891
type: Question
tagged with: jakarta-ee
tagged with: shiro
downvote count: 0
has comment: http://stackoverflow.com/comment/43433454
has title: Share shiro environment between multiple modules
favorite count: 0
has body: I have a J2EE application consisting of two modules: An EJB module, with classes that implement the business logic of the application. It uses JPA for data persistence. A WAR module build with JAX-RS (RestEasy) that implements a RESTFul service for interact with my ejbs. The application is deployed inside an EAR in wildfly 8.2.0.Final I need to secure the REST api with Basic Authentication using users information stored in the database. I'm trying to use Apache Shiro 1.2 for this purpose: I've modified web.xml like these: org.apache.shiro.web.env.EnvironmentLoaderListener ShiroFilter org.apache.shiro.web.servlet.ShiroFilter ShiroFilter /* REQUEST FORWARD INCLUDE ERROR and added a shiro.ini file in WEB-INF: [main] cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager securityManager.cacheManager = $cacheManager userRealm=myapp.realm.UserRealm securityManager.realms=$userRealm [urls] /* = authcBasic then defined UserRealm class: public class UserRealm extends AuthorizingRealm { @EJB AppUserController appUserController; @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { // .... } @Override protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { String username = (String) token.getPrincipal(); AppUser user = appUserController.findByUsername(username); SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo( user.getUsername(), user.getPassword(), null, getName() ); return authenticationInfo; } } where AppUserController is a @Stateless ejb that manage users account. Now I have the first (little) problem: at runtime the appUserController ejb is always null. I know that this is because the UserRealm instance is not a managed object, and I bypassed this by getting an instance via JNDI InitialContext context = new InitialContext(); appUserController = (AppUserController) context.lookup("java:global/...../AppUserController"); but I would like t…
answer count: 0
type: UnansweredQuestion
tagged with: wildfly

http://stackoverflow.com/q/27507266
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27507585
tagged with: list
has comment: http://stackoverflow.com/comment/43455333
score: 1
has answer: http://stackoverflow.com/a/27507378
tagged with: java
has comment: http://stackoverflow.com/comment/43444678
type: Question
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/27507585
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27507564
downvote count: 0
tagged with: generics
favorite count: 0
has title: Implementing List instead of ArrayList while using generics instead of raw types
has body: After going through many posts and suggestions, I have found that instead of using a concrete implementation such as ArrayList, I should use List instead, to allow flexibility between different implementations of the List Interface. So far, I have seen that many programmers suggest the following line of code: List list = new ArrayList(); However, this would give a warning in the compiler for using the raw types List and ArrayList and that they should actually be parameterized. Synonymous to these warnings, I have found several posts telling me that raw types should never be used and that I should take advantage in using generics that java offers so conveniently. Personally, I am trying to implement a class that acts as a table requiring a 2 Dimensional List structure with ArrayLists being used internally. I am trying to implement the following lines of code: List&lt;List&gt; table; table = new ArrayList(); table.add(new ArrayList()); Envisioned in my head, the table structure should be able to hold multiple variable types such as the raw data types along with the String variable type. I have tried to implement generics such as using List&lt;List&lt;Object&gt;&gt; table = new ArrayList&lt;ArrayList&lt;Object&gt;&gt;(); but I have received many errors and hence failed so far. I am relatively new to programming, pursing a computer science major, so forgive me if I have any horrible misunderstanding of the lines of code that I have exemplified above. Thank You.
linked to: http://stackoverflow.com/q/2745265
tagged with: parameterized
accepted answer: http://stackoverflow.com/a/27507378
has comment: http://stackoverflow.com/comment/43444806

http://stackoverflow.com/comment/43631193
type: QuestionComment
comment on: http://stackoverflow.com/q/27528275
has text: MR might be effective... certainly writing to disk and then reading back in will hurt performance significantly. Have you looked at Apache-Spark? It uses the Hadoop filesystem and can handle MR (in parallel) but also has a much richer set of features (and it doesn't write to disk unless you make it).
score: 0
type: Comment

http://stackoverflow.com/comment/43436515
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27503162
has text: **dot_SpOt** thanks for your comment but I want to know how to handle in REST to show client INTERNAL SERVER ERROR message. My code works fine for all the others exception but not with INTERNAL SERVER ERROR.
type: AnswerComment

eclipse-rcp
tags question: http://stackoverflow.com/q/27634525
type: Tag
tags question: http://stackoverflow.com/q/27575862
tags question: http://stackoverflow.com/q/27621183
tags question: http://stackoverflow.com/q/27569683
tags question: http://stackoverflow.com/q/27498057
tags question: http://stackoverflow.com/q/27527288
tags question: http://stackoverflow.com/q/27562370
tags question: http://stackoverflow.com/q/27637478
tags question: http://stackoverflow.com/q/27529398
tags question: http://stackoverflow.com/q/27564906
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/27614073

http://stackoverflow.com/comment/43408652
comment on: http://stackoverflow.com/q/27487901
has text: Your instinct is correct that this assignment seems nonsensical. The `Address` class, for example, is completely useless as written. There only sensible way forward is to modify the existing classes. There is also a lot of crap in this code, like `int main` which isn't Java, and `(//...)` which isn't a proper Java (or C or C++) comment.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43492018
score: 0
type: AnswerComment
has text: What do you mean about "when the web application shuts down"? It is a web application which will be shutted down only if I reload server. Or maybe do you mean user session?
type: Comment
comment on: http://stackoverflow.com/a/27531505

http://stackoverflow.com/comment/43528051
score: 1
comment on: http://stackoverflow.com/q/27541918
type: Comment
type: QuestionComment
has text: It means you are trying to write to a websocket while the previous message has not finished transferring. So thus it causes an exception.

http://stackoverflow.com/comment/43563879
comment on: http://stackoverflow.com/a/27569216
type: AnswerComment
score: 0
type: Comment
has text: Well, I'm increasing count which holds the value of users[i].getNumBorrowed() so I'm not sure why it would't update the value.

http://stackoverflow.com/q/27575569
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
answer count: 0
score: 1
tagged with: java
has body: To begin, I am developing an app with android studio which uses a backend created using endpoints with Objectify. I have an existing entity containing several fields, one of which is a Collection. In working on this app I have successfully deployed to localhost and appspot and have been CRUD ing away without any issue.. until now. All of my previous @Index and @Unindex fields can be seen in the datastore viewer in the developer console. BUT when I create a new List field it is no where to be found. I can successfully add and remove all other data types except for collections. Here is a snippet: @Entity public class UserData { @Id String userEmail; @Index String userName; @Unindex String password; @Unindex String lastLogin; @Unindex List&lt;String&gt; friends = new ArrayList&lt;String&gt;(); ...Getters and setters Now when I add @Unindex List&lt;String&gt; newFriends = new ArrayList&lt;String&gt;(); and deploy nothing happens and I die a little inside. In going through what I can see from the generated client library, everything appears to match up with the previous "friends" collection. A quick thought. The development of this app has been slow and I have gone through a couple versions of Objectify and am currently on v5.1.3. Perhaps when the first collection field was created Objectify handled collections differently. The release Notes mention issues with the @Embed annotation in converting from v4 to v5 but nothing about what I am experiencing. Another weird note here. When I annotate the "newFriends" collection with @Serialize and deploy.. Voila we have lift off. Once this new @Serialize collection is recognized in the entity I can then go back and change the annotation to @Unindex and all is fine. So really I have solved what I wanted to solve, it just seems that there is a bug crawling around Objectify v5. Or perhaps I am missing something obvious which is why I am inquiring upon the ever so wise community of SO. Thanks in advance.
type: Question
downvote count: 0
has title: Endpoints with Objectify issue creating Collection
tagged with: android
has comment: http://stackoverflow.com/comment/44312652
favorite count: 0
tagged with: google-cloud-endpoints
tagged with: objectify

http://stackoverflow.com/comment/43684644
score: 0
has text: Make sure you are saving bmOverlay and not bm1
type: AnswerComment
comment on: http://stackoverflow.com/a/27599045
type: Comment

http://stackoverflow.com/q/27560451
tagged with: java
has comment: http://stackoverflow.com/comment/43552845
has comment: http://stackoverflow.com/comment/43547287
downvote count: 0
tagged with: jquery
has body: I want to dynamically generate select box and on change event I want to call action class. getInvcId is generating select box dynamically and on change event of it, is not sending request to action.
favorite count: 0
tagged with: ajax
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43547221
answer count: 0
upvote count: 1
has title: calling to action from dynamically generated select box using ajax is not working?
type: Question
has comment: http://stackoverflow.com/comment/43547915
score: 1

http://stackoverflow.com/comment/43637126
type: QuestionComment
comment on: http://stackoverflow.com/q/27607498
has text: Unless you are using labels (like `outer: for (...)`). Though that is not for novices.
score: 0
type: Comment

http://stackoverflow.com/q/27595252
has body: hibernate dirty flag works great for what they call "persistent" objects https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/objectstate.html but i have a web app, where the hib mang entity Order is also used as the Spring MVC command object. so when my controller marshals the request into an order, it is what hibernate calls a "detached" object. my problem senario can be illustrated with 2 web clients and 4 web requests against a single order. 1 - client 1 opens the order in detail view 2 - client 2 opens the same order and updates attribute 1 3 - client 1 clicks "save" to update any changed fields, but actually has not updated anything in step 3, client 1 issues session.update(order) (also tried session.merge() and session.saveOrUpdate()) and ends up reverting attribute 1 back to its original value. if it was a "persistent" object, then hibernate would have known that nothing had changed. but because it is a detached object, hibernate actually issues an update for every member of the Order object. Any ideas on how to get the dirty flag in hibernate detached objects to work like it does in persistent objects? test first test shows hibernate working with persistent objects, works great, session 1 issues no updates: try{Class.forName("net.sourceforge.jtds.jdbc.Driver");} catch(Exception e){e.printStackTrace();} Session session1 = null; Session session2 = null; SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session1 = sessionFactory.openSession(); session2 = sessionFactory.openSession(); Transaction tx1 = session1.beginTransaction(); Transaction tx2 = session2.beginTransaction(); // order 1 has a null dig user //session 1 opens order 1 //session 2 opens order 1 //session 2 assigns andrew as dig, save //session 1 hits save Query qo1 = session1.createQuery("select o from Order o where o.id = 536258"); Order o1 = (Order)qo1.list().get(0); Query qo2 = session2.createQuery("select o from Order o where o.id = 536258"); Order o2…
score: 3
has answer: http://stackoverflow.com/a/27595548
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/27605198
has title: hibernate sets dirty flag (and issues update) even though client did not change value
upvote count: 3
tagged with: relational-database
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/27602318
type: UnansweredQuestion

http://stackoverflow.com/a/27543397
downvote count: 0
type: Answer
has body: I'm not able to reproduce your code, i did it a simplified version without datatable. Instead of window.open function i simply used target="_blank" as explained in this this post. The error you made is use onclick coupled with f:setPropertyActionListener. The reason why that doesn't function is explained in this post. faces-redirect=true is needed for change url (read more on this post), and ajax must be false. However, when you want call bean function through js, take a look to remote command. xhtml Page: &lt;h:form id="form_open_window" target="_blank"&gt; &lt;p:commandLink value="show" title="show metatdata" action="#{columnsViewZwei.goToUrl()}" ajax="false" &gt; &lt;f:setPropertyActionListener value="metadata_parameter" target="#{columnsViewZwei.metadata}" /&gt; &lt;/p:commandLink&gt; &lt;/h:form&gt; Bean Code: private String testurl = "index"; private String metadata; public String getMetadata() { return metadata; } public void setMetadata(String metadata) { this.metadata = metadata; } public String goToUrl() { System.out.println(metadata); return testurl + "?faces-redirect=true&amp;fileIdentifier=" + metadata; } PS: If You don't want deviate too much from your solution, evaluate use of oncomplete instead of onclick, but i didn't try it. I hope this is useful.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27532911

http://stackoverflow.com/comment/43697377
has text: The accepted answer covers this case.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27639299

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

http://stackoverflow.com/q/27613915
has comment: http://stackoverflow.com/comment/43649999
type: UnansweredQuestion
tagged with: swing
score: 3
has comment: http://stackoverflow.com/comment/43650107
has comment: http://stackoverflow.com/comment/43662486
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43650569
has comment: http://stackoverflow.com/comment/43650396
has comment: http://stackoverflow.com/comment/43650162
type: Question
has answer: http://stackoverflow.com/a/27614345
has comment: http://stackoverflow.com/comment/43649857
has comment: http://stackoverflow.com/comment/43650173
has body: Below is the compiled program replica of actual problem code, import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class Dummy { public static boolean getUserCheck(int size, boolean Check) { if (Check) { int ret = JOptionPane.showConfirmDialog(null, size + " entries, Yes or no?", "Warning", 0); if (ret &gt; 0) { System.out.println("User said No: " + ret); return false; } else if (ret &lt;= 0) { System.out.println("user said Yes: " + ret); return true; } } return true; } public static void workerMethod1() { System.out.println("am worker method 1"); } public static void workerMethod2() { System.out.println("am worker method 2"); } public static void main(String[] args) { System.out.println("mainthread code line 1"); int size = 13; boolean thresholdBreach = true; if (getUserCheck(size, thresholdBreach)) { SwingUtilities.invokeLater(new Runnable() { public void run() { workerMethod1(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { workerMethod2(); } }); } System.out.println("mainthread code line 2"); System.out.println("mainthread code line 3"); } } where i would like to run the if{} block in main() on separate thread. Because these 2 lines, System.out.println("mainthread code line 2"); System.out.println("mainthread code line 3"); need not wait for completion of if(){} block Another problem is, experts recommend to run confirm-dialog methods on event thread. int ret = JOptionPane.showConfirmDialog(null, size + " entries, Yes or no?", "Warning", 0); Please help me!!!!
tagged with: swingutilities
tagged with: invokelater
has comment: http://stackoverflow.com/comment/43650627
answer count: 2
has comment: http://stackoverflow.com/comment/43650861
has comment: http://stackoverflow.com/comment/43650291
has comment: http://stackoverflow.com/comment/43650185
downvote count: 0
has comment: http://stackoverflow.com/comment/43649855
has comment: http://stackoverflow.com/comment/43649889
has answer: http://stackoverflow.com/a/27614071
has title: Query on creating separate thread in java?
has comment: http://stackoverflow.com/comment/43659568
has comment: http://stackoverflow.com/comment/43650188
favorite count: 0
has comment: http://stackoverflow.com/comment/43650420
has comment: http://stackoverflow.com/comment/43650130
has comment: http://stackoverflow.com/comment/43659902

http://stackoverflow.com/a/27504957
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27504454
has body: I see that you are using Maven for your project. NetBeans' support for Maven is best-in-class since you almost never need to add anything to your Maven project in order for NetBeans to load it properly. To enable Javadoc during your build, simply add the following code to the <plugins> element within your <build> element. org.apache.maven.plugins maven-javadoc-plugin 2.10.1 attach-javadocs jar Note: Since generating Javadoc may take a bit of time and those outputs are not necessary for debugging, I recommend only enabling the Javadoc output for a final build. However, the simplest path is certainly to just enable it all the time, which is what I've shown above.
downvote count: 0
has comment: http://stackoverflow.com/comment/43443391
type: Answer

http://stackoverflow.com/q/27584229
favorite count: 0
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has title: MouseListener is not working
upvote count: 0
has comment: http://stackoverflow.com/comment/43592977
has body: I have a JTable within a ScrollPane that displays data retrieved from a database. What I want to achieve, is to make a row highlight at the right click. However, nothing happens, when I click the right button. Any help will be appreciated. Here are the code fragments: [ItemTableModel.java]: class ItemTableModel extends AbstractTableModel { private final String[] modelColumnNames = {"Kod handlowy", "Nazwa", "Pojemność", "Napięcie", "Tolerancja", "Temp. min.", "Temp. maks.", "Ilość", "Cena", "Stan magazynowy"}; public Class[] modelColumnTypes = {String.class, String.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class, Integer.class}; protected static ItemTableModel itemTableModel; protected static JTable itemTable; ArrayList&lt;Item&gt; modelData = new ArrayList&lt;&gt;(); public ItemTableModel(ArrayList&lt;Item&gt; dataArray) { super(); modelData = dataArray; } @Override public int getColumnCount() { return modelColumnNames.length; } @Override public int getRowCount() { return modelData.size(); } @Override public void setValueAt(Object value, int row, int col) { Item data = modelData.get(row); switch (col) { case 0: data.setCommercialCode((String) value); break; case 1: data.setName((String) value); break; case 2: data.setCapacity((Integer) value); break; case 3: data.setVoltage((Integer) value); break; case 4: data.setTolerance((Integer) value); break; case 5: data.setTempMin((Integer) value); break; case 6: data.setTempMax((Integer) value); break; case 7: data.setQuantity((Integer) value); break; case 8: data.setPrice((Integer) value); break; case 9: data.setAvailability((Integer) value); break; } } @Override public String getColumnName(int col) { return modelColumnNames[col]; } @Override public Class getColumnClass(int col) { return modelColumnTypes[col]; } @Override public Object getValueAt(int row, int col) { Item data = modelData.get(row); switch (col) { case 0: return data.getCommercialCode(); case 1: …
has answer: http://stackoverflow.com/a/27584529
has comment: http://stackoverflow.com/comment/43592979
answer count: 1
accepted answer: http://stackoverflow.com/a/27584529

http://stackoverflow.com/comment/43450916
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27510344
has text: windows operating systems
score: 0

http://stackoverflow.com/comment/43423060
has text: Oh, I just realized you have an *all*-XML configuration. Add `<context:annotation-config/>`.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27494819
type: Comment

http://stackoverflow.com/comment/43492090
type: AnswerComment
has text: @Andy A Servlet container can maintain, dynamically, any number of web applications (servlet contexts). The container itself is a single `java` process, but it can be managing a number of web apps. You can shut down or turn on such web apps while the process is running. You'd want to `close` the `ApplicationContext` if you were to restart the webapp without killing the process. If you're going to kill the process, there's no (it really depends) point doing cleanup.
type: Comment
comment on: http://stackoverflow.com/a/27531505
score: 1

http://stackoverflow.com/comment/43550437
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27562351
has text: OK, but is there a way to tell if its a class declared in the project and not internally java one?

http://stackoverflow.com/a/27486911
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27486712
has body: Because it's an Array of MessageContainer and not a single MessageContainer instance. So your fromJson should be Type type = new TypeToken&lt;List&lt;MessageContainer&gt;&gt;(){}.getType(); List&lt;MessageContainer&gt; container = new Gson().fromJson(json, type);
downvote count: 0
type: Answer

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

http://stackoverflow.com/a/69744295
score: 1
upvote count: 1
has body: This is a repost of a comment. I give Arvind Kumar Avinash full credit. @arvindkumaravinash "Nice! For future visitors: In the code given above, the Locale used with dateFormatter doesn't necessarily have to be the same one as used to obtain defaultDateFormat. For example, String format = DateTimeFormatterBuilder.getLocalizedDateTimePattern( FormatStyle.FULL, null, IsoChronology.INSTANCE, Locale.FRANCE); LocalDate now = LocalDate.now(); System.out.println( now.format(DateTimeFormatter.ofPattern(format, Locale.ENGLISH))); System.out.println( now.format(DateTimeFormatter.ofPattern(format, Locale.FRANCE))); " For Americans, be sure to replace FRANCE with US, the British use UK, and so on. here is a list of currently used countries. https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html Also be sure to import all packages necessary separately, because time* will not work for this. So these essentially import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.util.Locale; import java.time.format.FormatStyle; import java.time.chrono.IsoChronology;
type: Answer
has comment: http://stackoverflow.com/comment/123280673
answers question: http://stackoverflow.com/q/27580655
downvote count: 0

http://stackoverflow.com/comment/43435095
comment on: http://stackoverflow.com/a/27502292
has text: list.add(vFruit); //<- index 4
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27620533
has comment: http://stackoverflow.com/comment/43681227
tagged with: request
score: 2
has title: Is this deadlock about httpclient?
has body: Recently my program got dead while postting a http request,here is the thread dump java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136) at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152) at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:270) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:161) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:153) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:254) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:214) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:160) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:136) a…
tagged with: java
has comment: http://stackoverflow.com/comment/43671987
has comment: http://stackoverflow.com/comment/43680714
has comment: http://stackoverflow.com/comment/61158872
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43844000
linked to: http://stackoverflow.com/q/36791569
tagged with: httpclient
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/27580991
answers question: http://stackoverflow.com/q/27575566
has body: To troubleshoot, can you add an echo statement at the final java execution ? Alternatively, you can invoke the script using bash -x
type: Answer
score: 0

http://stackoverflow.com/q/27592881
upvote count: 2
has answer: http://stackoverflow.com/a/27593405
answer count: 1
has title: Postgresql not connecting to android using JDBC throwing org.postgresql.util.PSQLException: The connection attempt failed
has comment: http://stackoverflow.com/comment/43609860
favorite count: 0
has comment: http://stackoverflow.com/comment/43609665
tagged with: postgresql
tagged with: android
tagged with: jdbc
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43609740
tagged with: java
has comment: http://stackoverflow.com/comment/43609998
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43609968
type: Question
has body: I am developing an android application for which I need to connect to Postgresql database, I installed it 9.3 version, and checked in PGAdminIII it is connecting. I also created a java project in eclipse just for testing JDBC it is connecting successfully but when I am trying to connet to Postgresql from Android project it is throwing error: org.postgresql.util.PSQLException: The connection attempt failed. Here is the code Which I written in MainActivity.java @Override protected Void doInBackground(Void... params) { try { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://192.168.43.207:5432/testdb", "postgres", "password"); System.out.println("connection success"); conn.close() ; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; and pg_hba.conf IPv4 local connections: host all all 192.168.43.207 trust IPv6 local connections: host all all ::1/128 trust postgresql.conf listen_addresses = '*' Note: If I am changing ip address 192.168.43.207 with localhost/127.0.0.1 it is throwing error- org.postgresql.util.psqlexception connection refused. check that the hostname and port are correct I have googled about it and also seen posts on Stackoverflow but nothing works. I am using windows7 please provide solution according to it. please help me as I am fighting it for last two days but nothing works. Edit: when I run these commands from CMD in windows I got following outout C:\Windows\system32&gt;sc query postgresql-9.3 SERVICE_NAME: postgresql-9.3 TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 C:\Windows\system32&gt;netstat -a | findstr 5432 TCP 0.0.0.0:5432 -PC:0 LISTENING TCP [::]:5432 -PC:0 LISTENING TCP [::1]:5432 -PC:49573 ESTABLISHED TCP [::1]:5432 -PC:49574 ESTABLIS…
has comment: http://stackoverflow.com/comment/43609437
accepted answer: http://stackoverflow.com/a/27593405

eclipse
tags question: http://stackoverflow.com/q/27599096
tags question: http://stackoverflow.com/q/27602234
tags question: http://stackoverflow.com/q/27576528
tag name: eclipse
tags question: http://stackoverflow.com/q/27536421
tags question: http://stackoverflow.com/q/27620218
tags question: http://stackoverflow.com/q/27517188
tags question: http://stackoverflow.com/q/27566852
tags question: http://stackoverflow.com/q/27623450
tags question: http://stackoverflow.com/q/27480547
tags question: http://stackoverflow.com/q/27528278
tags question: http://stackoverflow.com/q/27503704
tags question: http://stackoverflow.com/q/27539561
tags question: http://stackoverflow.com/q/27568112
tags question: http://stackoverflow.com/q/27622800
tags question: http://stackoverflow.com/q/27588764
tags question: http://stackoverflow.com/q/27539437
tags question: http://stackoverflow.com/q/27526578
tags question: http://stackoverflow.com/q/27617651
tags question: http://stackoverflow.com/q/27611160
tags question: http://stackoverflow.com/q/27506442
tags question: http://stackoverflow.com/q/27482089
tags question: http://stackoverflow.com/q/27593850
tags question: http://stackoverflow.com/q/27635581
tags question: http://stackoverflow.com/q/27613478
tags question: http://stackoverflow.com/q/27578891
tags question: http://stackoverflow.com/q/27512569
tags question: http://stackoverflow.com/q/27520024
tags question: http://stackoverflow.com/q/27614131
tags question: http://stackoverflow.com/q/27573103
tags question: http://stackoverflow.com/q/27591687
tags question: http://stackoverflow.com/q/27583038
tags question: http://stackoverflow.com/q/27565285
tags question: http://stackoverflow.com/q/27626959
tags question: http://stackoverflow.com/q/27618123
tags question: http://stackoverflow.com/q/27522514
tags question: http://stackoverflow.com/q/27503023
tags question: http://stackoverflow.com/q/27604923
tags question: http://stackoverflow.com/q/27519957
tags question: http://stackoverflow.com/q/27488897
tags question: http://stackoverflow.com/q/27581661
tags question: http://stackoverflow.com/q/27531249
tags question: http://stackoverflow.com/q/27610134
tags question: http://stackoverflow.com/q/27564250
tags question: http://stackoverflow.com/q/27477152
tags question: http://stackoverflow.com/q/27621974
tags question: http://stackoverflow.com/q/27572010
tags question: http://stackoverflow.com/q/27496565
tags question: http://stackoverflow.com/q/27635129
tags question: http://stackoverflow.com/q/27559965
tags question: http://stackoverflow.com/q/27596778
tags question: http://stackoverflow.com/q/27548387
tags question: http://stackoverflow.com/q/27534250
tags question: http://stackoverflow.com/q/27536788
tags question: http://stackoverflow.com/q/27550766
tags question: http://stackoverflow.com/q/27534141
tags question: http://stackoverflow.com/q/27630131
tags question: http://stackoverflow.com/q/27552091
tags question: http://stackoverflow.com/q/27598151
tags question: http://stackoverflow.com/q/27568002
tags question: http://stackoverflow.com/q/27538052
tags question: http://stackoverflow.com/q/27617532
tags question: http://stackoverflow.com/q/27541802
tags question: http://stackoverflow.com/q/27560087
tags question: http://stackoverflow.com/q/27527660
tags question: http://stackoverflow.com/q/27563741
tags question: http://stackoverflow.com/q/27502769
tags question: http://stackoverflow.com/q/27625698
tags question: http://stackoverflow.com/q/27594042
tags question: http://stackoverflow.com/q/27594586
tags question: http://stackoverflow.com/q/27623801
tags question: http://stackoverflow.com/q/27496960
tags question: http://stackoverflow.com/q/27499450
tags question: http://stackoverflow.com/q/27543026
tags question: http://stackoverflow.com/q/27497890
tags question: http://stackoverflow.com/q/27495414
tags question: http://stackoverflow.com/q/27493451
tags question: http://stackoverflow.com/q/27498536
tags question: http://stackoverflow.com/q/27574515
tags question: http://stackoverflow.com/q/27566889

http://stackoverflow.com/comment/43677166
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27627984
has text: Please ensure you understand what an object is and how it is used, as it is extremely vital in object orientated programming.

http://stackoverflow.com/comment/43590497
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27583006
has text: How and where do you set `title.mute`?

http://stackoverflow.com/q/27574173
has title: Run ProcessBuilder under another user in linux
tagged with: process
tagged with: su
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/45621304
accepted answer: http://stackoverflow.com/a/45621304
linked to: http://stackoverflow.com/q/1012792
has comment: http://stackoverflow.com/comment/77072643
has comment: http://stackoverflow.com/comment/43576918
upvote count: 1
answer count: 1
favorite count: 0
tagged with: debian
has comment: http://stackoverflow.com/comment/43575244
has body: I need to run another java app under Debian system but I need to run it under another user. The main java app is running under root. Now I am using this to start another java app but I need to run all this as another user, is it somehow possible ? ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"java", "-Xms256M", "-Xmx" + DataManager.getMaxMemory(server) + "M", "-XX:MaxPermSize=256M", "-jar", "/home/apps/jar/" + DataManager.getJar(server), "nogui"}); File folder = new File("/home/apps/servers/" + server + "/"); processBuilder.directory(folder); Process p = processBuilder.start(); Thanks.
downvote count: 0

http://stackoverflow.com/a/27632320
accepted answer of: http://stackoverflow.com/q/27621516
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27621516
score: 0
type: Answer
has body: Problem resolved. Reason was that after document added to couchbase view was not refresh. So just needed to add query.setStale( Stale.FALSE ); View will be refresh before receiving data.

http://stackoverflow.com/comment/43619843
score: 0
type: Comment
type: QuestionComment
has text: @Luiggi yes they are
comment on: http://stackoverflow.com/q/27568838

http://stackoverflow.com/comment/44566098
type: Comment
has text: Also-- is your class trying to access the variable before properties have been fully initialized? Maybe look at implementing Spring's `InitializingBean` interface?
score: 1
comment on: http://stackoverflow.com/a/28094675
type: AnswerComment

http://stackoverflow.com/q/27548524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43523512
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27548649
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43523789
possible better answer: http://stackoverflow.com/a/27548649
has comment: http://stackoverflow.com/comment/43523387
has body: I have written a piece of logic, where, my goal is to select random keys from the map. The map has been assigned as a ConcurrentSkipListMap&lt;Text,IntWritable&gt; tuples. Also, I don't have any industrial level experience with Java, so struggling to get over this. The piece of code is Set&lt;Text&gt; keys = tuples.keySet(); String randomKeys = keys.get(random.netInt(keys.size())) I am not able to figure out the error statement: method get(int) is undefined for the type Set&lt;Text&gt; Also, I have searched for the similar problem, and a solution do exist using List, but my key/value pairs are stored as ConcurrentSkipListMap, so not able to figure out this. Thanks.
answer count: 2
has answer: http://stackoverflow.com/a/27548635
downvote count: 0
has comment: http://stackoverflow.com/comment/43523360
favorite count: 0
accepted answer: http://stackoverflow.com/a/27548635
has comment: http://stackoverflow.com/comment/43523341
has title: method get(int) is undefined for the type Set
has comment: http://stackoverflow.com/comment/43523424
has comment: http://stackoverflow.com/comment/43523449

http://stackoverflow.com/q/27553708
has answer: http://stackoverflow.com/a/27557096
has comment: http://stackoverflow.com/comment/45003961
type: Question
has body: I am doing an HttpPost to send data to LoopBack and get the response. I am getting an error as below from LoopBack : HTTP/1.1 422 Unprocessable Entity [X-Powered-By: Express, Vary: Origin, Accept-Encoding, Access-Control-Allow-Credentials: true, Content-Type: application/json; charset=utf-8, Content-Length: 1528, Date: Thu, 18 Dec 2014 18:13:45 GMT, Connection: keep-alive] So, what I did in java is created a json from a java object , when I used this JSON in loopback api explorer, the data was inserted and gave me response 200, but doing from Java, I am getting this error. Does anyone have an idea about this. Java code is as below JSONObject json = new JSONObject(jsonString); StringEntity stringEntity = new StringEntity(json.toString()); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(POST_CLAIM_URL); post.setEntity(stringEntity); HttpResponse httpResponse = null; httpResponse = client.execute(post); I had make sure , I am not adding a duplicate entry. Regards, Varun
has comment: http://stackoverflow.com/comment/102316361
answer count: 1
score: 4
tagged with: rest
tagged with: loopbackjs
has title: HTTP/1.1 422 Unprocessable Entity Error when sending data to LoopBack from Java client
has comment: http://stackoverflow.com/comment/43533756
has comment: http://stackoverflow.com/comment/43538364
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43538573
upvote count: 4
has comment: http://stackoverflow.com/comment/43533934
tagged with: strongloop
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/43478368
score: 0
type: Comment
type: QuestionComment
has text: `println(sqrt(sq(l))); // ok` and `l = sqrt(l);`. `sqrt(sq(l))` should result in `l` whereas `sqrt(l)` results in the square root of `l`, that is why it is smaller.
comment on: http://stackoverflow.com/q/27524811

http://stackoverflow.com/q/27585971
downvote count: 0
has body: For the simplicity of the questions let's imagine we were storing a : int[][][][] values = new int[10][10][10][10]; I'm currently looking to generate tables of values which will be available for looking up later by the computer (not by a person). These values are basically scores for situations. So for example if we wanted to see the score where the first component is 2 the second is 3 the third is 7 and the fourth is 9 then we could go to [2][3][7][9] in the file instead of having to compute the value on the fly. I understand the technical details of writing and reading to a file but I'm having a hard time getting my head around how to do this. Let's say with a 2D array and I wanted to find the value of [X][Y] then I could just read and write to the row with value X and the column with value Y. However, with a 3 or even 4 D array how can we store those values in a text file so that we don't have to generate the array everytime we run the program?
has comment: http://stackoverflow.com/comment/43596498
favorite count: 0
possible better answer: http://stackoverflow.com/a/27586047
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/27586015
has comment: http://stackoverflow.com/comment/43596410
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43596402
has comment: http://stackoverflow.com/comment/43596382
has answer: http://stackoverflow.com/a/27586015
has comment: http://stackoverflow.com/comment/43596401
has title: Need a way of storing a 4D array
answer count: 2
has answer: http://stackoverflow.com/a/27586047

http://stackoverflow.com/comment/43435112
type: AnswerComment
comment on: http://stackoverflow.com/a/27485263
score: 0
has text: Which version of POI are you using? I found it here: http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFWorkbook.html
type: Comment

http://stackoverflow.com/q/27503046
tagged with: javaagents
downvote count: 4
favorite count: 0
tagged with: on-the-fly
score: -3
has comment: http://stackoverflow.com/comment/43438646
type: Question
type: AnsweredQuestion
tagged with: java
has body: I would like to know how to use java agent and how to install java agent. I handle for the first time java agent. So they are not familiar. So please explain in detail.
tagged with: agent
has comment: http://stackoverflow.com/comment/43436161
has answer: http://stackoverflow.com/a/27503541
accepted answer: http://stackoverflow.com/a/27503541
has title: How installing Java Agent?
upvote count: 1
tagged with: bytecode
answer count: 1
has comment: http://stackoverflow.com/comment/43436165

http://stackoverflow.com/q/27495129
linked to: http://stackoverflow.com/q/27251706
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43422926
has comment: http://stackoverflow.com/comment/43424263
has body: Does anybody know how to create an alfresco site from java? I found two api calls that are supposed to create a site: 1) POST /alfresco/service/api/sites. This successfully created a site but when i try to go to the site on alfresco it gives me this error: A server error has occured. There are a number of reasons why this could have happened: You have attempted to access a page that does not exist - check the URL in the address bar. You have attempted to access a page that is not accessible to you, such as a private Site dashboard. A valid page has been requested but the server was unable to render it due to an internal error - contact your administrator. Return to your dashboard page Alfresco Software Inc. © 2005-2013 All rights reserved. 2) POST /share/service/modules/create-site which gives me a 401 unauthorized. I am passing in the correct alfresco authentication ticket. Does anybody have any experience creating a site programmatically? Preferably with java.
tagged with: alfresco-share
type: UnansweredQuestion
has title: Create an Alfresco site programmatically in java
tagged with: alfresco
has answer: http://stackoverflow.com/a/29765285
has comment: http://stackoverflow.com/comment/43428915
linked to: http://stackoverflow.com/q/24255171
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/43423136
has answer: http://stackoverflow.com/a/27578546
answer count: 2

http://stackoverflow.com/comment/43580038
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27577019
has text: Thanks for giving the concepts.
type: AnswerComment

http://stackoverflow.com/q/27490387
tagged with: maven
type: Question
has comment: http://stackoverflow.com/comment/43414701
tagged with: java
tagged with: eclipse
score: 0
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/43415450
has comment: http://stackoverflow.com/comment/43414660
has body: There seem to be many many posts about similar questions however I have been unable to find exactly what I am looking for. Basically, I have a Java Application built using Maven in Eclipse. When I execute the project from withing Eclipse it works correctly as it can find all files in my resources directory. When I do a normal jar with dependencies build using maven it also works. However, in the final item I cannot get this to work: I would like the resources to be excluded from the main executable jar and placed into a directory on the same level as the jar itself. This was a user can just make changes to the settings and execute the jar, so: |--root level |-Jar |-resources |-log4j.properties |-settings.properties I have the maven-jar-plugin doing this: org.apache.maven.plugins maven-jar-plugin 2.4 true true com.org.interfaces.SharepointClient.App lib/ development http://org.com value resources/settings.properties resources/log4j.properties settings.properties log4j.properties And I have the maven-assembly-plugin creating the resources directory with all the resource files. The project compiles and generates the directory structure as I want it however, the class files are unable to locate anything in the resources directory even though I specifically added them the classpath in the manifest.mf This is the Manifest for details: Manifest-Version: 1.0 Build-Jdk: 1.7.0_17 Class-Path: resources/settings.properties resources/log4j.properties lib/log4j-1.2.17.jar lib/jaxws-api-2.2.11.jar lib/jaxb-api-2.2.9.ja r lib/javax.xml.soap-api-1.3.5.jar lib/javax.annotation-api-1.2-b03 .jar lib/jsr181-api-1.0-MR1.jar lib/saxon-9.1.0.8.jar lib/saxon-9.1 .0.8-dom.jar Created-By: Apache Maven 3.0.5 Main-Class: com.org.interfaces.SharepointClient.App key: value url: http://org.com mode: development Archiver-Version: Plexus Archiver When Executed I receive an error on this line of code: PropertyLoader.class.getClassLoader().getResourceAsStream("settings.properties"); The error is: Exce…
has answer: http://stackoverflow.com/a/27490989
has title: Exclude resources from java maven build
type: UnansweredQuestion

http://stackoverflow.com/a/27591752
score: 0
has body: All errors seems related to Android's specific classes: you may have a problem with you Eclipse+ADT installation you may have pasted the code into the wrong type of project you may simple missing the corrisponding import Last is simplier to verify, just hover with mouse over the error and see if Eclipse suggests you to add a specific import
has comment: http://stackoverflow.com/comment/43607336
type: Answer
answers question: http://stackoverflow.com/q/27591687

http://stackoverflow.com/a/27528865
score: 1
answers question: http://stackoverflow.com/q/27527610
type: AcceptedAnswer
downvote count: 0
has body: First of all that JDBC warning messages are nothing to worry about, read here. Following code read csv files and output its contents to console, see in github. package wekaExamples.loadDatasetExamples; import weka.core.Instances; import weka.core.converters.*; import java.io.*; /** * Created by atilla.ozgur on 17.12.2014. */ public class LoadCsvExample { public static void main(String[] args) { System.out.println("loading training data"); Instances instances = null; try { String fileName = "./data/deneme1.csv"; CSVLoader loader = new CSVLoader(); loader.setSource(new File(fileName)); instances = loader.getDataSet(); } catch (Exception e) { e.printStackTrace(); return; } System.out.println("training data loaded"); // Make the last attribute be the class instances.setClassIndex(instances.numAttributes() - 1); // Print header and instances. System.out.println("\ndataset:\n"); System.out.println(instances); } } Output is as following: loading training data training data loaded dataset: @relation deneme1 @attribute x numeric @attribute y numeric @data 1,2 2,3 1,4
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43486347
accepted answer of: http://stackoverflow.com/q/27527610

http://stackoverflow.com/q/27550357
tagged with: serialization
has comment: http://stackoverflow.com/comment/43528376
has comment: http://stackoverflow.com/comment/43529488
has comment: http://stackoverflow.com/comment/43527404
has answer: http://stackoverflow.com/a/27550447
type: AnsweredQuestion
has body: If you look into the StringBuffer's source you will see: /** * readObject is called to restore the state of the StringBuffer from * a stream. */ private synchronized void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { java.io.ObjectOutputStream.PutField fields = s.putFields(); fields.put("value", value); fields.put("count", count); fields.put("shared", false); s.writeFields(); } /** * readObject is called to restore the state of the StringBuffer from * a stream. */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { java.io.ObjectInputStream.GetField fields = s.readFields(); value = (char[])fields.get("value", null); count = fields.get("count", 0); } Why can it not be happen that two Objects are desynchronized from two different resources? Why can it not be happen that one Object is desynchronized deserialized from two different resources? See my example: final ObjectInputStream objectInputABC=new ObjectInputStream(new FileInputStream("ABC")); final ObjectInputStream objectInputDE=new ObjectInputStream(new FileInputStream("DE")); final ObjectStreamClass osc = new ObjectStreamClass(); final StringBuffer sb = (StringBuffer) objectInputABC.readObject(); osc.invokeReadObject(sb,objectInputDE);
has comment: http://stackoverflow.com/comment/43528101
tagged with: java
has comment: http://stackoverflow.com/comment/43527673
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43627484
type: Question
has comment: http://stackoverflow.com/comment/43527174
accepted answer: http://stackoverflow.com/a/27550447
has comment: http://stackoverflow.com/comment/43526986
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43526977
favorite count: 0
tagged with: synchronization
has title: Why is readObject of StringBuffer not synchronized?

http://stackoverflow.com/comment/43686103
score: 1
comment on: http://stackoverflow.com/a/27633102
type: AnswerComment
type: Comment
has text: @user3539809 Edited to give an example with a default path relative to the user's home. You can use something else as a base.

http://stackoverflow.com/q/27474915
favorite count: 0
type: Question
has title: How can I use the StringEscapeUtils Class to secure the code from LDAP injection vulnerabilities?
upvote count: 1
accepted answer: http://stackoverflow.com/a/27501350
tagged with: java
answer count: 1
has body: How can I use the StringEscapeUtils Class to secure the code from LDAP injection vulnerabilities? How do I escape searchBase, searchMask, scontrols? try { do { NamingEnumeration&lt;SearchResult&gt; answer = null; try { answer = ctx.search(searchBase, searchMask, scontrols); printSearchEnumeration(answer); if (maxSize == 0) exceedLimit = false; else { if (list.size() &gt;= maxSize)
tagged with: code-injection
tagged with: security
tagged with: ldap
has answer: http://stackoverflow.com/a/27501350
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/27636617
answers question: http://stackoverflow.com/q/27635757
has body: Given MyObject like this: class MyObject { private final double x; private final double y; public MyObject(double x, double y) { this.x = x; this.y = y; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MyObject myObject = (MyObject) o; if (Double.compare(myObject.x, x) != 0) return false; if (Double.compare(myObject.y, y) != 0) return false; return true; } @Override public int hashCode() { int result; long temp; temp = Double.doubleToLongBits(x); result = (int) (temp ^ (temp &gt;&gt;&gt; 32)); temp = Double.doubleToLongBits(y); result = 31 * result + (int) (temp ^ (temp &gt;&gt;&gt; 32)); return result; } } You can implement a unique method that returns a list with unique elements only: private List&lt;MyObject&gt; unique(List&lt;MyObject&gt; list) { List&lt;MyObject&gt; uniqueList = new ArrayList&lt;&gt;(); Set&lt;MyObject&gt; uniqueSet = new HashSet&lt;&gt;(); for (MyObject obj : list) { if (uniqueSet.add(obj)) { uniqueList.add(obj); } } return uniqueList; } And a unit test for it to verify it works: @Test public void removeDups() { List&lt;MyObject&gt; list = Arrays.asList(new MyObject(0, 0), new MyObject(0, 0), new MyObject(0.5, 0.5), new MyObject(0.5, 0.6), new MyObject(1, 1)); List&lt;MyObject&gt; results = Arrays.asList(new MyObject(0, 0), new MyObject(0.5, 0.5), new MyObject(0.5, 0.6), new MyObject(1, 1)); assertEquals(results, unique(list)); } Note: it's important to implement both equals and hashCode for this to work, because of the use of a hash map. But you should always do this anyway in your custom classes: provide appropriate equals and hashCode implementations. Btw, I didn't write those equals and hashCode methods. I let my IDE (IntelliJ) generate them automatically from the fields x and y of the class.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27635757
downvote count: 0
upvote count: 8
type: Answer
score: 8

http://stackoverflow.com/comment/43452746
type: AnswerComment
score: 0
has text: @shekharsuman I think that I interpreted the question differently than you. I thought the question was: "Why did the people who designed the standard lib choose such inconsistent names?", while you probably think the question is "what name should I choose when I design a class?".
type: Comment
comment on: http://stackoverflow.com/a/27511074

http://stackoverflow.com/comment/43412018
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your help. I found `User.process` further queried the database thereby closing the current `ResultSet`.
comment on: http://stackoverflow.com/q/27489637

http://stackoverflow.com/q/27594289
has answer: http://stackoverflow.com/a/27594779
accepted answer: http://stackoverflow.com/a/27594779
has comment: http://stackoverflow.com/comment/43613116
tagged with: jframe
possible better answer: http://stackoverflow.com/a/27594367
has comment: http://stackoverflow.com/comment/43612997
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27594367
tagged with: java
tagged with: bufferedimage
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43612809
tagged with: jpanel
tagged with: image
has comment: http://stackoverflow.com/comment/43612865
has comment: http://stackoverflow.com/comment/43612880
score: 0
has title: JPanel doesn't draw image until mouse click
has body: I have a small, simple program I've started and have a strange bug I haven't been able to figure out or find the cause for online. All my program does right now is build a JFrame, build a JPanel, and draw an image onto the JPanel from a thread. The issue is, the image does not display unless I click in the Frame, left click, right click, or even click with my mouse wheel makes the image display, but resizing the frame doesn't make the image display. I've tried validate() on the panel and frames both, and I've tried putting repaint() in the code called by the thread but the image flickers when repaint() is in the code. I put a print statement in the code that actually draws the image, but the statement never shows up until I click in the frame. I've walked through with the debugger and the code seems to be getting called correctly though. If I put a print statement anywhere in code being called from the main thread's update() function, the image displays correctly without having to click. Here is my code, any suggestions would be appreciated: The Frame public class GameFrame extends JFrame{ int w = 1300; int h = 740; public GameFrame() { this.setSize(w, h); setTitle("Frame"); GamePanel panel = new GamePanel(w, h); this.add(panel); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { GameFrame gameFrame = new GameFrame(); } } The Panel public class GamePanel extends JPanel implements Runnable{ //core classes GameRenderer renderer; GameManager manager; GameLoader loader; //graphics stuff private Graphics dbg; private Image dbImage = null; private int panelWidth; private int panelHeight; //game updating stuff Thread animator; boolean running; public GamePanel(int w, int h) { this.setSize(w, h); this.setVisible(true); this.setFocusable(true); this.panelWidth = w; this.panelHeight = h; renderer = new GameRenderer(); manager = new GameManager(); loader = new GameLoader(); startGame(); } private void startGame() { a…
has comment: http://stackoverflow.com/comment/43613029
has comment: http://stackoverflow.com/comment/43613022
has comment: http://stackoverflow.com/comment/43612626

http://stackoverflow.com/a/27502292
upvote count: 2
type: Answer
has body: You need a list and not a hashtable to get a correct ordered list. List&lt;Vector&gt; list = new ArrayList&lt;Vector&gt;(); list.add(0,vFruit); list.add(1,vFruit); list.add(2,vFruit); list.add(3,vFruit); list.add(vFruit); //&lt;- index 5
answers question: http://stackoverflow.com/q/27502102
has comment: http://stackoverflow.com/comment/43435095
has comment: http://stackoverflow.com/comment/43435205
score: 2
downvote count: 0

http://stackoverflow.com/q/27490831
has comment: http://stackoverflow.com/comment/43413260
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27490875
answer count: 5
type: UnansweredQuestion
upvote count: 1
has title: Java Try Catch NullPointerException
has answer: http://stackoverflow.com/a/27490964
score: 1
tagged with: java
has body: I was trying an example about try catch but it isn't working as I wanted. This is the code : public static void main(String[] args) { //This array's size is 5 and it has 4 Strings in it. String[] array = new String[5]; array[0] = "Hello"; array[1] = "World"; array[2] = "try catch"; array[4] = "error"; try { for(int i = 0 ; i&lt;array.length ; i++) System.out.println("This array has: "+array[i]); } catch (NullPointerException e) { System.out.println("Null!!!"); } } output is like that : This array has: Hello This array has: World This array has: try catch This array has: null This array has: error It supposed to enter catch block but it didn't. Any ideas?
type: Question
has answer: http://stackoverflow.com/a/27490866
tagged with: arrays
has answer: http://stackoverflow.com/a/27490873
has comment: http://stackoverflow.com/comment/43413264
has answer: http://stackoverflow.com/a/27490912

http://stackoverflow.com/q/27616470
has answer: http://stackoverflow.com/a/27616830
accepted answer: http://stackoverflow.com/a/27616830
has title: Webdriver - How to check if browser still exists or still open?
possible better answer: http://stackoverflow.com/a/27617443
has answer: http://stackoverflow.com/a/70495911
has answer: http://stackoverflow.com/a/60855716
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27617443
answer count: 5
type: AnsweredQuestion
upvote count: 19
tagged with: java
tagged with: selenium
score: 19
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/71750094
tagged with: browser
has body: I want to check if browser still exists and if it isn't then i want to open a new browser! Is there a api available in webdriver to check if the browser still exists?

http://stackoverflow.com/q/27500732
has body: In c#, @ sign is used before string literals to change how the compiler parses the string. Is there a counterpart of this in java? Using concatenation confuses me sometimes.
has title: Change how the compiler parses the string
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2673855
has comment: http://stackoverflow.com/comment/43432090
tagged with: java
has comment: http://stackoverflow.com/comment/43432246
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/2673855
has answer: http://stackoverflow.com/a/27500975
score: 0
has comment: http://stackoverflow.com/comment/43431915
answer count: 1
has comment: http://stackoverflow.com/comment/43432081
tagged with: string

http://stackoverflow.com/q/27580278
accepted answer: http://stackoverflow.com/a/27580441
tagged with: arrays
downvote count: 0
has title: Cloning an object and its inside arrays in Java DIY
tagged with: matrix
answer count: 1
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
has body: I am trying to clone an object without using any library. The object has other objects/arrays/matrixes in it. So I developed some methods to clone those as well. They are working fine when I am cloning arrays/matrixes that are not inside the object. These are the methods: public static int[] cloneArray(int[] array){ int i = 0; int[] clone = new int[array.length]; while (i &lt; array.length){ clone[i] = array[i]; i++; } return clone; } public static int[][] cloneMatrix(int[][] matrix){ int[][] clone = new int[matrix.length][matrix[0].length]; for (int i = 0;i&lt;matrix.length;i++) for(int j = 0;j&lt;matrix[0].length;j++) clone[i][j] = matrix[i][j]; return clone; } However, when I want to clone an object, the references of the array/matrix stay the same, as you can check in the output on the bottom of the post. This is the constructor I have: public State(int parentStateID, int stateID, int[][] board, int[] pieces, int points, int acquiredPoints){ State.parentStateID = parentStateID; State.stateID = stateID; State.currentBoard = cloneMatrix(board); //here takes place the matrix cloning State.currentPieces = cloneArray(pieces); //here takes place the array cloning State.totalPoints = points; State.acquiredPoints = acquiredPoints; } And this is the cloning method: public static State cloneState(State state){ int[][] currentBoard = state.getCurrentBoard(); int[] currentPieces = state.getCurrentPieces(); int totalPoints = state.getTotalPoints(); int acquiredPoints = state.getAcquiredPoints(); int parentStateID = state.getParentStateID(); int stateID = state.getStateID(); State clone = new State(parentStateID, stateID, currentBoard, currentPieces, totalPoints, acquiredPoints); return clone; } To better visualize the output, here are the arrays and matrix: public static int piecesList[] = {1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; public static int piecesList2[] = {2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; …
tagged with: clone
tagged with: java
has answer: http://stackoverflow.com/a/27580441
type: Question

http://stackoverflow.com/comment/43698625
type: QuestionComment
comment on: http://stackoverflow.com/q/27636829
has text: @midor If you look carefully at what is being asked, you'll see that OP does not seek clarification of what *happens-before* means, but rather how the specific rules of the JLS prevent unnatural outcomes such as circular causality.
score: 0
type: Comment

http://stackoverflow.com/a/27567556
has comment: http://stackoverflow.com/comment/43560680
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27566924
type: Answer
answers question: http://stackoverflow.com/q/27566924
has comment: http://stackoverflow.com/comment/43560426
has body: Typically with any kind of physics you want to store the speed of an object as well as its position. That way, each time though your update loop you just have to change the y position by the y speed. When the collision occurs, all you need to do is calculate the new yspeed and update rond. public void update(float delta) { if(collides(rond)){ rond.yspeed = -rond.yspeed; }else{ rond.y+=rond.yspeed*delta; } }
score: 0

http://stackoverflow.com/a/27512405
answers question: http://stackoverflow.com/q/27512221
has body: You cannot read and write the same file at the same time. Either read everything into memory first, before creating PrintWriter or write to a different file (and then, possibly, copy it over to the original after you are done). Also, be sure to .close() your writer after you are done writing to it. Oh, and, yes, you cannot read from the same reader twice. If you want to start reading from the beginning, create a new reader.
downvote count: 0
has comment: http://stackoverflow.com/comment/43455078
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/43400871
has text: I made a dummy program to run from 0 till 2147483648 that is 1 more than the limit in Python. I was surprised that till then the numbers are negative. The number was not unsigned. It works on unsigned numbers. What my thoughts are telling me is that the number `0xffffffff` used must be `0xfffffff` until the number `1073741824` and then `0xffffffff`. The problem is (as you have said) numbers are bounded in Python.
type: AnswerComment
comment on: http://stackoverflow.com/a/27483395
score: 0
type: Comment

http://stackoverflow.com/q/27523149
tagged with: ycsb
score: -3
has comment: http://stackoverflow.com/comment/43475163
downvote count: 4
type: UnansweredQuestion
has body: I am using YCSB for benchmarking. I am writing a custom code in Java. I have two fields which are of String and Int type but the db.insert method takes a HashMap of &lt;String,ByteIterator&gt; type. How can I convert String and integer into ByteIterator type? Please help
tagged with: hashmap
tagged with: java
has title: How to convert an integer into ByteIterator in Java for MongoDB
has answer: http://stackoverflow.com/a/27523362
type: Question
has comment: http://stackoverflow.com/comment/43475209
tagged with: mongodb
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27636864
has body: Following run time error is coming: javax/servlet/jsp/jstl/core/Config Caused by: java.lang.ClassNotFoundException - javax.servlet.jsp.jstl.core.Config I have also downloaded jstl-1.2.jar and jsp-api-2.0.jar file still above error is not resolving. So please help me...
has comment: http://stackoverflow.com/comment/43692747
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43692714
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27636908
accepted answer: http://stackoverflow.com/a/27636928
tagged with: tomcat
has title: Error not resolved
score: 0
possible better answer: http://stackoverflow.com/a/27636908
has comment: http://stackoverflow.com/comment/43692645
has comment: http://stackoverflow.com/comment/43692635
has answer: http://stackoverflow.com/a/27636928
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43563723
type: AnswerComment
score: 0
type: Comment
has text: You typo'd Triple just before the end, and `greatestCommonFactor` just before that
comment on: http://stackoverflow.com/a/27569212

http://stackoverflow.com/comment/43665857
type: Comment
comment on: http://stackoverflow.com/q/27622674
type: QuestionComment
score: 0
has text: java.lang.NoSuchMethodError: org.springframework.context.ApplicationContext.findAnnotationOnBean

http://stackoverflow.com/a/27498235
has comment: http://stackoverflow.com/comment/43427659
has comment: http://stackoverflow.com/comment/43427567
accepted answer of: http://stackoverflow.com/q/27498206
type: Answer
answers question: http://stackoverflow.com/q/27498206
has body: What do you intend to do with new ArrayList&lt;IP&gt;(ip2)? If you want to create a list with ip2 in it, you need to instantiate the list, and then add it. Like: List&lt;IP&gt; list = new ArrayList&lt;IP&gt;(); list.add(ip2) Check the java doc for new ArrayList(int) constructor here to learn what ArrayList(ip2) will try to do and why it fails. If you really want to shorten (not simplify really) your code, you can do: import java.util.Arrays; ... ... List&lt;IP&gt; list = new ArrayList&lt;IP&gt;(Arrays.asList(ip2));
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27587522
has comment: http://stackoverflow.com/comment/43599275
tagged with: java
has answer: http://stackoverflow.com/a/27587541
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/43599205
accepted answer: http://stackoverflow.com/a/27587596
score: 0
answer count: 3
has body: I created a building directory and it basically shows the user the entire directory (using a string array) and if they don't want to view the entire directory they can just search for the specific business in the building. However, I cannot seem to get the search option to work because in my array there are spaces in-between.. eg: String Floor [] = { "Ground Floor", "Vacant" }; If I remove the space in-between "Ground Floor" and make it "GroundFloor" it can then be searched, otherwise it just comes up as not found if you search "Ground Floor". What can I do to fix this? bones of program: import java.util.Arrays; import java.util.Scanner; public class Townsendtest { public static void main(String[] args) { //prints the Floor Number of index and he Business listed on the floor System.out.println("Floor Number\t\tBusiness"); //String array of businesses on each floor starting at floor 0-24 String floor [] = { "Ground Floor", "Advanced Technologies", "HiMark Marketing", "Law offices of John Daniels", "PST Systems", "Century United Brokers Inc.", "Creative Resources", "Design Centre Associates", "Ideal Media Group", "SF Net Developers", "Shears medical Services Inc.", "Green Space Construction Inc.", "Cornerstone Mortgage Capital", "Allied Advantage Realty", "JAMS the Resolution Experts", "Law Offices of Matt Dill", "Vacant", "The Drop in Centre", "Artisan Interiors Consultancy", "NGS Group", "Robert H. Greene Real Estate", "Vacant", "Vacant", "Denise A. Patterson Attorney at Law", "Conference Rooms 1-6" }; //for loop to print entire index to the user for(int counter=0; counter&lt;floor.length; counter++ ){ System.out.println(counter + "\t\t\t" + floor[counter]); }//end for loop Scanner businessname = new Scanner(System.in); String namefind; System.out.print("Enter the name of the Business: "); namefind = businessname.next(); for(int i = 0; i &lt; floor.length; i++){ if(namefind.equalsIgnoreCase(floor[i])) { System.out.println("Business Found!"); System.exit(0); } } Syst…
type: AnsweredQuestion
has title: Searching for elements in an array with spaces
has answer: http://stackoverflow.com/a/27587974
has comment: http://stackoverflow.com/comment/43599208
tagged with: spaces
type: Question
possible better answer: http://stackoverflow.com/a/27587541
has answer: http://stackoverflow.com/a/27587596

http://stackoverflow.com/comment/43688849
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27634308
has text: It frees memory, yes. But memory should not need to be manually freed; that's a sign that you aren't managing your resources well enough. If it restarts randomly, you should walk through it with a debugger to find out why. You should be asking "why is my application restarting?" instead of "how to manually invoke GC". I can promise you that your solution does not require you to manually GC. If you ask the right questions, you'll get the right answers. I suggest restructuring this question to better fit your situation: "Why is my app restarting?" with code and attempts at fixing
score: 0

http://stackoverflow.com/a/27496248
has body: You can access the previous value by using arrayYear[i-1]. Be careful though because if you start at i = 0, you will ask for element -1 in the array which doesn't exist. You can circumvent that by setting the first value to 9 and starting at i = 1: arrayYear[0] = 9; for (int i = 1; i &lt;= 40; i++) arrayYear[i] = arrayYear[i-1]-1;
score: 0
has comment: http://stackoverflow.com/comment/43424151
answers question: http://stackoverflow.com/q/27496216
type: Answer
has comment: http://stackoverflow.com/comment/43424184

http://stackoverflow.com/comment/43516346
comment on: http://stackoverflow.com/q/27544097
has text: Yes I manage to read other attachments. By removing the if part the body of the mail will be downloaded as text.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43478608
comment on: http://stackoverflow.com/a/27524469
has text: @Devrath: Well no, I never suggested moving to Joda Time, although that's generally better. It's not clear why you're using a specific time zone here, or what's wrong with what I actually suggested. If you *do* want to use Joda Time, you'd be better off using a `DateTimeFormatter` for the parsing, instead of passing the string into the constructor.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43462554
type: AnswerComment
has text: You didn't really answer his question, just looks like you suggested another pattern to use.
type: Comment
comment on: http://stackoverflow.com/a/27515897
score: 0

http://stackoverflow.com/comment/43615834
score: 0
comment on: http://stackoverflow.com/q/27595813
type: Comment
type: QuestionComment
has text: Why does the code have 2 separate classes that extend `Canvas`? BTW - I've done lots of animations in Swing. Never bothered to use a `Canvas` or `BufferStrategy`, and they all worked out (fast and) fine.

http://stackoverflow.com/q/27631374
score: 5
tagged with: polymorphism
has answer: http://stackoverflow.com/a/27631696
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/27632021
has answer: http://stackoverflow.com/a/27631700
has answer: http://stackoverflow.com/a/27631585
has answer: http://stackoverflow.com/a/27631416
has comment: http://stackoverflow.com/comment/43683433
tagged with: generics
upvote count: 6
has title: Java - Passing generic lists into class via constructor
accepted answer: http://stackoverflow.com/a/27631696
has body: I've been trying to play with generics and polymorphism. I've come across a problem I can't get my head around. Say I have public abstract class Animal { private age; private weight; public Animal(){} public void Move(){ //stuff } public void Eat(){ //stuff } //Getters and setters } And then public Cat extends Animal { //Constructors } public Snake extends Animal { //Constructors public void ShedSkin(){ //stuff } } I also have my own class "MyAbstractClass". It's here I can't seem to work things out. public abstract class MyAbstractClass { private List&lt;Animal&gt; myAnimalList; public MyAbstractClass(){} public MyAbstractClass(List&lt;? extends Animal&gt; animalList) { this.myAnimalList = animalList; } public List&lt;Animal&gt; getAnimalList() { return myAnimalList; } //Stuff which DOES NOT add to the list } I want to be able to do: public class MyCatClass extends MyAbstractClass { public MyCatClass(List&lt;Cat&gt; catList) { super(catList); } } public class MySnakeClass extends MyAbstractClass { public MySnakeClass(List&lt;Snake&gt; snakeList) { super(snakeList); } public ShedSkin(){ (Snake)getAnimalList().get(0).ShedSkin(); //Dont worry about indexing } } Then public static void main(string[] args) { //Make list of cats //Make list of snakes MyCatClass cats = new MyCatClass(catList); MySnakeClass snakes = new MySnakeClass(snakeList); snakes.ShedSkin(); } This does not work for me. It fails to compile at public MyAbstractClass(List&lt;? extends Animal&gt; animalList). This is a bit over my java experience and would greatly appreciated some guidance. I hope the example classes are made clear enough to understand my intention. Compiler tells me: java.util.List&lt;Animal&gt; in MyAbstractClass cannot be applied to java.util.List&lt;capture&lt;? extends Animal&gt;&gt; Thanks. Edit: Looks like I'll have to spell out what I'm trying to do. I have a list of animals which may or may not have more fields and methods than the superclass, but they all extend the superclass.…
downvote count: 1
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27631865
tagged with: java
has answer: http://stackoverflow.com/a/27631865
answer count: 6

android-actionbar
tags question: http://stackoverflow.com/q/27568002
type: Tag
tags question: http://stackoverflow.com/q/27613478
tags question: http://stackoverflow.com/q/27617336
tags question: http://stackoverflow.com/q/27607071
tags question: http://stackoverflow.com/q/27489695
tags question: http://stackoverflow.com/q/27581876
tags question: http://stackoverflow.com/q/27631587
tags question: http://stackoverflow.com/q/27549858
tag name: android-actionbar
tags question: http://stackoverflow.com/q/27615597
tags question: http://stackoverflow.com/q/27542297

http://stackoverflow.com/a/27555928
answers question: http://stackoverflow.com/q/27555796
downvote count: 0
has body: Your for loops are BOTH executing. They are both working too. Your results are 3,4,5,6 (now num1 = 7, which is not &lt;= 6) and 6,7 so an if statement to select the correct loop should solve your problems. Something like if (num1 &lt; num2) { //loop 1 } else //loop 2
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/43463659
score: 0
type: Comment
type: QuestionComment
has text: I mean poll until you see something that tells you that these threads have done whatever they need to do. Are you sure the library does not provide support for some kind of notification? You may get better answers if you can tell us what library this is.
comment on: http://stackoverflow.com/q/27516719

http://stackoverflow.com/comment/43557866
comment on: http://stackoverflow.com/q/27566310
score: 0
type: QuestionComment
has text: That's why I was asking.
type: Comment

http://stackoverflow.com/a/27631740
downvote count: 0
has body: get list of tables from db metadata, and then query with each: Statement stmt = conn.createStatement(); ResultSet locationRs = null; DatabaseMetaData md = conn.getMetaData(); ResultSet rs = md.getTables(null, null, "%", null); while (rs.next()) { locationRs = stmt.executeQuery("SELECT location from "+ rs.getString(3)); System.out.println(locationRs.getString(1)); }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27631657

http://stackoverflow.com/comment/43608282
has text: @VGR I can't agree that this is "clear, readable code". Perhaps you found that because you already knew very precisely what it was trying to achieve. I don't think most people who knew absolutely nothing about the problem being addressed would understand what that code was doing "right away" just by reading it. Even after knowing the problem being solved, most of the answers published below are easier to understand.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27587309
score: 0

http://stackoverflow.com/comment/43684007
has text: As soon as the class is *initialized* :)
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/27631896
type: Comment

http://stackoverflow.com/comment/43475103
type: QuestionComment
comment on: http://stackoverflow.com/q/27523093
has text: Do you *have* to use a static call, rather than having a normal dependency that you can mock out?
type: Comment
score: 3

http://stackoverflow.com/comment/43435967
type: QuestionComment
type: Comment
has text: I don't see where does the "SampleError" part of your URL come from. Have you tried leaving that out (depending on your servlet container configuration)? Also, does case 1 work?
score: 0
comment on: http://stackoverflow.com/q/27502579

http://stackoverflow.com/q/27583038
has answer: http://stackoverflow.com/a/27583104
type: UnansweredQuestion
tagged with: maven
tagged with: ninjaframework
score: 0
tagged with: java
tagged with: tomcat7
type: Question
has body: I just started to develop a java web application based on the ninjaframework. Everything works great, but: With all the ninja-dependencies, the deploy-war has around 25MB. I really hope, I won't have to upload a 25MB java archive all the time - especially due to the fact, that the dependencies won't barely change as often as e.g. a stylesheet of my app. Is there a practical solution to move the ninjaframework-dependencies to a separated jar? I am working with eclipse, therefore a solution that integrates in the IDE would be great. So far, I have had a look into the maven dependency-scoping and have (unsuccessfully) tried to move the dependencies into a separated project and refer to the project with a system-scoped dependency (which I would in my understanding be able to deploy as a separated jar file). I currently fail at building this dependency-jar with maven - but I also wonder, if there are better approaches. I deploy the application on a tomcat-server in a plesk installation
has title: How can a ninjaframework-web-application be split up?
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/27603386

http://stackoverflow.com/a/27532439
upvote count: 2
has body: You called the function reverse just once. Try to call it every time you get a string. What you are doing is, You took the first string as input and your program went into an loop near while(true) you printed the reverse of the string. You took two more strings. Where are you reversing them? and the break at the end of the loop doesn't make sense. you may remove the while loop and break and add call the reverse function. I am not writing any code as you could do it easily.
accepted answer of: http://stackoverflow.com/q/27532361
answers question: http://stackoverflow.com/q/27532361
has comment: http://stackoverflow.com/comment/43493429
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43493530
score: 2

http://stackoverflow.com/q/27608961
has answer: http://stackoverflow.com/a/27609363
favorite count: 0
has answer: http://stackoverflow.com/a/29742027
downvote count: 0
type: UnansweredQuestion
has body: I am trying to use Cross Origin Filter support for my web application. I am using eclipse jetty plugin to debug it from eclipse. When I run the class through console, using mvn jetty:run, I always get correct response. But when I run it using my jetty eclipse plugin, I get Class not found exception. java.lang.ClassNotFoundException: org.eclipse.jetty.servlets.CrossOriginFilter at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383) at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100) I have the following dependency in my pom.xml : org.eclipse.jetty jetty-servlets 9.2.5.v20141112 When I check the classpath configurations of my jetty project in eclipse, I see this dependency present as maven dependencies. Still I am not sure why the jetty plugin is not able to find org.eclipse.jetty.servlets.CrossOriginFilter as a part of classpath. Kindly help me with this. edit: Looks like it is not only for the CORS. Even other classes present in web.xml throws error for class not found. I checked in the jetty classpath of that debug configuration and able to find these jars in there. Not sure why this is happening.
tagged with: jetty
score: 3
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has title: eclipse jetty plugin Cross origin support Class not found
tagged with: cors
tagged with: eclipse-plugin
upvote count: 3

http://stackoverflow.com/comment/43417042
has text: I suppose so - as coded it won't, but your answer seemed to be a blanket one. Edit your answer (any change will do) so I can un-downvote
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27492565

http://stackoverflow.com/comment/43386612
comment on: http://stackoverflow.com/q/27476075
has text: Another way to look at it: heap memory is all mutable, and what makes it immutable is "only careful encapsulation". Immutable low level arrays might be useful for something, but they're not required to implement immutable lists, if encapsulation is enough for that. If you intend to not mutate something, and the language lets you mark it immutable, that's sort of like a compile-time test that you never accidentally mutate it.
score: 6
type: Comment
type: QuestionComment

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

http://stackoverflow.com/a/27555571
score: 1
type: Answer
upvote count: 1
has body: The cast needs to be applied to the value on which you are accessing the field. ((Manager)employee[i]).name You were using it like (Manager)employee[i].name which attempted to apply the cast to the value returned by accessing the field name.
answers question: http://stackoverflow.com/q/27555550
accepted answer of: http://stackoverflow.com/q/27555550
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43482988
has text: @amit isn't the whole point of programming that you should only do things when you know what you're doing? there's nothing magic about doubles in that respect
comment on: http://stackoverflow.com/a/27527045
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/27633771
has body: If you want stop listener you have to: Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare("myQueue", false, false, false, null); MyConsumer consumer = new MyConsumer(channel); String consumerTag = channel.basicConsume("myQueue", false, consumer); System.out.println("press any key to terminate"); System.in.read(); channel.basicCancel(consumerTag);&lt;----- this stop listening channel.close(); &lt;--- this close the channel and eventually all listening connection.close();&lt;-- this close the connection and all channels Please read this about "isOpen" method: https://www.rabbitmq.com/api-guide.html Use of the isOpen() method of channel and connection objects is not recommended for production code, because the value returned by the method is dependent on the existence of the shutdown cause.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27630695
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/43692229
downvote count: 0
has comment: http://stackoverflow.com/comment/104301054
upvote count: 6
answers question: http://stackoverflow.com/q/27630695

http://stackoverflow.com/comment/43605712
has text: What do you mean you have to use IS NULL instead of = I deleted = and writed IS NULL instead of = is this what you mean
type: AnswerComment
comment on: http://stackoverflow.com/a/27585964
type: Comment
score: 0

http://stackoverflow.com/comment/43457461
type: Comment
type: QuestionComment
has text: Check the brackets once buddy, They are the biggest fault lines in a programmer's code.
comment on: http://stackoverflow.com/q/27513580
score: 1

http://stackoverflow.com/a/27599482
type: Answer
has body: Change you sql query from "SELECT ImageID FROM "+ ImagesTableData.TABLE_NAME to "SELECT " + ImagesTableData.ImageID + " FROM "+ ImagesTableData.TABLE_NAME
answers question: http://stackoverflow.com/q/27599380
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/43554579
comment on: http://stackoverflow.com/q/27564527
score: 0
has text: is there a certain topic to focus on for this problem ??
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/56257416
type: Comment
comment on: http://stackoverflow.com/a/27585293
has text: @StefanHaustein I don't know, this is a really old answer ;-) Feel free to edit if you have any improvements.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43720975
comment on: http://stackoverflow.com/q/27636242
score: 1
has text: "Ã©" is a Latin-1 interpretation of the two UTF-8 bytes which represent "é". This has me wondering if perhaps your column and/or table is actually using Latin-1 (a.k.a. ISO 8859-1). Does a statement that uses non-Latin-1 characters work, such as `INSERT INTO table (name) VALUES("↑↑↑");`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27509253
has body: I want to create web interface for CRUD operation using JSF as frontend and hive as backend. Can anybody please guide me what all things/step I need in Hive to do this. Thanks in advance
score: -3
has comment: http://stackoverflow.com/comment/43453566
has answer: http://stackoverflow.com/a/27509766
type: UnansweredQuestion
has title: User Interface for crud operation in Hive
downvote count: 3
tagged with: hive
tagged with: java
type: Question
tagged with: hadoop
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43653566
score: 0
has text: the query is very simple. It is taking only few millisecond if I running in TOAD. Issue is intermittent.
comment on: http://stackoverflow.com/q/27567150
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43455393
type: Comment
has text: I'm surprised there's no `Collection#isAllowNull()` or some such, but apparently there's not. Yay for APIs that force you to use try/catch to test their capabilities and state.
comment on: http://stackoverflow.com/a/27512532
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43512351
comment on: http://stackoverflow.com/q/27542629
type: QuestionComment
has text: That's my client_socket it's like I said without code it's positive with code it's -1. Thanks for really quick response.
score: 0
type: Comment

http://stackoverflow.com/comment/43430147
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27499236
has text: I only want the difference between 2 Screenshots in a new image.

http://stackoverflow.com/comment/43467514
type: Comment
has text: @webcoder sorry buddy but you haven't understand the question properly. Its not about differentiating normal or ajax request.
type: QuestionComment
comment on: http://stackoverflow.com/q/27506015
score: 0

http://stackoverflow.com/comment/43633856
comment on: http://stackoverflow.com/a/27605291
score: 0
type: AnswerComment
has text: so something like this. sorry for code in comments...@Test public void testBasketWithCustomerIdWillReturnAnExBasketOfNull(){ when(mockBasket.getCustomerId()).thenReturn(null); basketInformationServiceImpl.createBasket(mockBasket); }
type: Comment

http://stackoverflow.com/comment/43596115
comment on: http://stackoverflow.com/q/27535087
type: Comment
type: QuestionComment
score: 0
has text: @Kalaschni I have now added the code that I'm using. The most important part is under the `createTextField()` method. What I mean with tabbing, is to replicate the behavior in Microsoft Excel, where you can shift your position inside a table with the tab key. When there is no free position in the current row, I want to shift down one row and enter the first cell in that row.

http://stackoverflow.com/comment/43642114
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27609818
has text: I want to remove the HTML tags, not to parse them, I'm trying to obtain raw data, please read the question I want to "REPLACE" with "" meaning that I want to delete them
type: QuestionComment

http://stackoverflow.com/a/27614903
answers question: http://stackoverflow.com/q/27614793
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: this may help you Properties props = new Properties(); props.setProperty("mail.transport.protocol", "smtp"); props.setProperty("mail.host", mailhost); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "465"); props.put("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.quitwait", "false"); session = Session.getDefaultInstance(props, this);

http://stackoverflow.com/q/27520145
has comment: http://stackoverflow.com/comment/43473257
has comment: http://stackoverflow.com/comment/43473006
tagged with: servlets
tagged with: sql-server
score: 0
has body: I want to run a procedure which takes approx 15 minutes to run in sql environment. Whereas when I am trying to run it using Servlet I am getting Network error(TCP error). I am using Http Server using ajp to transfer request to Tomcat server. This is my code. can anybody tell me what is going wrong here. import com.itech.softensity.utils.Utils; import java.io.IOException; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; public class JdbcServlet extends HttpServlet { protected static Logger logger = Logger.getLogger(JdbcServlet.class); static final String jtdsurl = "jdbc:jtds:sqlserver://&lt;server_name&gt;;instance=&lt;instance&gt;;DatabaseName=&lt;databasename&gt;;socketTimeout=100000;socketKeepAlive=true"; static final String USER = "username"; static final String PASS = "password"; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection con = null; CallableStatement stmt = null; ResultSet result =null; try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); logger.info("Connecting to database..."); con = DriverManager.getConnection(jtdsurl, "username","password"); logger.info("Creating statement..."); String sql = "exec populateMobRefLit"; stmt = con.prepareCall(sql); stmt.setQueryTimeout(100000); stmt.executeQuery(); logger.info("Executing stored procedure check new..."); if(stmt != null){ stmt.close(); } if(con != null){ con.close(); } logger.info("Procedure run successfully values: "); } catch (Exception e) { try { if(stmt != null){ stmt.close(); } if(con != null){ con.close(); } }catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } logger.info(Utils.stackTrace…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43470242
has comment: http://stackoverflow.com/comment/43476494
has title: Connection Timeout while running sql procedure from servlet
has comment: http://stackoverflow.com/comment/43477648
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43470415
type: Question
has comment: http://stackoverflow.com/comment/43475432

http://stackoverflow.com/a/27603455
has comment: http://stackoverflow.com/comment/43629651
score: 0
has comment: http://stackoverflow.com/comment/43630268
has comment: http://stackoverflow.com/comment/43630381
has comment: http://stackoverflow.com/comment/43630952
has body: You don't use the InputProcessor for that purpose, you use the InputProcessor to immediately process the input, e.g. public boolean keyDown(int keyCode) { if (keyCode == Keys.Escape) { closeGame(); } if (keyCode == Keys.Left) { startMovingLeft(); } } If you want to continuously check in a loop you just use the static method Gdx.input.isKeyPressed(int key) e.g. public void loop() { if (Gdx.input.isKeyPressed(Keys.Left)) { moveLeft(); } } But this is not recommended because you can miss key presses if you press the key in between loops, and certainly not recommended in the render loop because the rate at which you act upon key presses depends on the framerate. Thanks to noone for helping me improve the answer.
answers question: http://stackoverflow.com/q/27602892
type: Answer

http://stackoverflow.com/q/27546781
has comment: http://stackoverflow.com/comment/43520024
type: AnsweredQuestion
tagged with: guava
tagged with: java
type: Question
has body: I'm trying to have a nested layer of callbacks for ListenableFutures, something like this: ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)); ListenableFuture&lt;A&gt; futureA = service.submit(() -&gt; a.doSomething()); Futures.addCallback(futureA, new FutureCallback&lt;A&gt;() { @Override public void onSuccess(A result) { ListenableFuture&lt;B&gt; futureB = service.submit(() -&gt; b.doSomething(result) } }); How do I add a callback when both futureA and futureB complete? This is a simple example but I'm looking for a solution that may have multiple layers of ListenableFuture.
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27546978
accepted answer: http://stackoverflow.com/a/27546978
has title: Launching ListenableFuture within FutureCallback and calling back when all are complete

ajax
tags question: http://stackoverflow.com/q/27548844
tags question: http://stackoverflow.com/q/27508948
tags question: http://stackoverflow.com/q/27597680
type: Tag
tags question: http://stackoverflow.com/q/27483574
tags question: http://stackoverflow.com/q/27503805
tags question: http://stackoverflow.com/q/27521333
tags question: http://stackoverflow.com/q/27560451
tags question: http://stackoverflow.com/q/27606769
tags question: http://stackoverflow.com/q/27479432
tags question: http://stackoverflow.com/q/27582243
tags question: http://stackoverflow.com/q/27608439
tags question: http://stackoverflow.com/q/27560424
tag name: ajax

http://stackoverflow.com/comment/43635396
type: Comment
type: QuestionComment
has text: Look at http://stackoverflow.com/questions/6535676/webservlet-annotation-with-tomcat7
comment on: http://stackoverflow.com/q/27606355
score: 0

http://stackoverflow.com/q/27497797
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27498511
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/27498511
score: 0
answer count: 1
has title: Tyring to stop Thread and stop ffmpeg in background
has body: Hi Im trying to stop a Thread and stop the FFmpeg from continuing in the bachground. So when a user clicks the cancel button it stops the Thread and stop FFmpeg I will show my class MashRocks first , The button calls the method so i guess thats all i should show. package my.mashformcnts; import java.io.IOException; import java.util.Scanner; import java.util.regex.Pattern; /** * * @author brett */ public class MashRocks { public static Thread startThread(MashFormCnts mashFormCnts) throws IOException { ProcessBuilder pb = new ProcessBuilder("ffmpeg", "-i", "C:\\Users\\brett\\Documents\\Telegraph_Road.mp4", "C:\\Users\\brett\\Documents\\out.mp4"); final Process p = pb.start(); // create a new thread to get progress from ffmpeg command , override // it's run method, and start it! Thread t = new Thread() { @Override public void run() { Scanner sc = new Scanner(p.getErrorStream()); // Find duration Pattern durPattern = Pattern.compile("(?&lt;=Duration: )[^,]*"); String dur = sc.findWithinHorizon(durPattern, 0); if (dur == null) { throw new RuntimeException("Could not parse duration."); } String[] hms = dur.split(":"); double totalSecs = Integer.parseInt(hms[0]) * 3600 + Integer.parseInt(hms[1]) * 60 + Double.parseDouble(hms[2]); System.out.println("Total duration: " + totalSecs + " seconds."); // Find time as long as possible. Pattern timePattern = Pattern.compile("(?&lt;=time=)[\\d:.]*"); String match; String[] matchSplit; //MashForm pgbar = new MashForm(); while (null != (match = sc.findWithinHorizon(timePattern, 0))) { matchSplit = match.split(":"); double progress = (Integer.parseInt(matchSplit[0]) * 3600 + Integer.parseInt(matchSplit[1]) * 60 + Double.parseDouble(matchSplit[2])) / totalSecs; int prog = (int) (progress * 100); mashFormCunts.setbar(prog); } } }; t.start(); return t; } //This works but is it correct?? public synchronized static Thread stop(Thread t){ Runtime.getRuntime().exec("taskkill /F /IM ffmpeg.exe"); t = null; //t.interrupt(); //im not sure what e…

http://stackoverflow.com/comment/93903679
has text: @EricWang These are arbitrary command line arguments a program may need. It's nice to show that gradle supports any kind of arguments, since the raw string is passed to the built application.
type: AnswerComment
score: 5
type: Comment
comment on: http://stackoverflow.com/a/51407975

http://stackoverflow.com/comment/43489530
type: Comment
score: 7
comment on: http://stackoverflow.com/q/27530383
has text: Stop wasting your time with these kind of optimizations! Grab a profiler and **measure where the bottleneck of your application actually is** and try to optimize that!
type: QuestionComment

http://stackoverflow.com/a/34422044
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27580958
score: 4
has body: Still there are two points to clarify here First one in my post is actually load time weaving not run time weaving From this link Load-time weaving (LTW) is simply binary weaving defered until the point that a class loader loads a class file and defines the class to the JVM. To support this, one or more "weaving class loaders", either provided explicitly by the run-time environment or enabled through a "weaving agent" are required. Second one is compile time weaving Compile-time weaving is the simplest approach. When you have the source code for an application, ajc will compile from source and produce woven class files as output. The invocation of the weaver is integral to the ajc compilation process. The aspects themselves may be in source or binary form. If the aspects are required for the affected classes to compile, then you must weave at compile-time. Aspects are required, e.g., when they add members to a class and other classes being compiled reference the added members.

http://stackoverflow.com/comment/43555762
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27563207
type: QuestionComment
has text: @DávidHorváth - JAXB like any other bit of software expects a concrete subclass as the value, where the property is an abstract class.

http://stackoverflow.com/comment/43468339
type: Comment
comment on: http://stackoverflow.com/q/27519322
has text: I'm running it.. Crossed an hour.. Previously tried with some more parsing line codes and took almost 1 hour for 100,000 records.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27607768
downvote count: 0
tagged with: java
tagged with: swt
type: Question
has title: Get the item in the SWT list on Mouse Up
accepted answer: http://stackoverflow.com/a/27608368
upvote count: 3
has body: I wanted to know if its possible to get the item in the list on mouse up? I searched online and found many examples for SWT table using the X and the Y coordinate but none using a list. What I am basically doing is implementing a list in which the order of the items can be changed by drag and drop. For this I need to be able to get the item under the drop location so that I can swap that item with the dragged item.
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27608368
tagged with: drag-and-drop
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/27474825
tagged with: io
answer count: 1
accepted answer: http://stackoverflow.com/a/27474910
favorite count: 0
has comment: http://stackoverflow.com/comment/43384150
has comment: http://stackoverflow.com/comment/43384083
type: AnsweredQuestion
tagged with: nonblocking
score: 1
tagged with: tcp
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27474910
has body: In Java's blocking IO API accept() blocks until a connection is available and read() blocks until input is available. But does write() block also for different blocking IO OutputStreams? So how long does write() block in FileOutputStream and SocketOutputStream (TCP) classes? Edit: or to ask even more generally: Does nonblocking IO have any advantages for write operations?
has comment: http://stackoverflow.com/comment/43384286
has comment: http://stackoverflow.com/comment/43384023
has comment: http://stackoverflow.com/comment/43384203
downvote count: 0
has comment: http://stackoverflow.com/comment/43384263
tagged with: nio
has title: Java blocking IO - Are there any advantages for write operations?

scriptlet
tags question: http://stackoverflow.com/q/27638038
type: Tag
tag name: scriptlet

http://stackoverflow.com/a/27486586
type: Answer
accepted answer of: http://stackoverflow.com/q/27486442
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: From https://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html For example, it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances. Some Iterator implementations (including those of all the general purpose collection implementations provided by the JRE) may choose to throw this exception if this behavior is detected. You will need to implement some sort of synchronization yourself to avoid the exception. You may consider using Collections.synchronizedList and only operating on the list through that view.
answers question: http://stackoverflow.com/q/27486442

http://stackoverflow.com/comment/43482922
has text: I just added that plugin from the and added to my pom file in tag it's give me error as mention above near <execution> tag in eclipse
comment on: http://stackoverflow.com/a/27526719
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27565983
score: 4
has comment: http://stackoverflow.com/comment/43557440
accepted answer of: http://stackoverflow.com/q/27565911
type: Answer
answers question: http://stackoverflow.com/q/27565911
has body: Basically, you should use a local variable: BufferedImage localImage = null; try { localImage = ImageIo.read(...); } catch (IOException e) { // No need to set a value, given that it's already going to be null. // You probably want to log though. } connectionImage = localImage; Now you know for sure that your connectionImage variable will be assigned exactly once. I would then use a conditional operator for width, which makes it clearer that there's exactly one assignment: width = connectionImage != null ? connectionImage.getWidth() : 0;
upvote count: 4
has comment: http://stackoverflow.com/comment/43557262
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27635769
downvote count: 1
has body: Make sure to override equals() method in your custom Object(MyObject). Then add them into a Set. Now you have unique result set.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27635757
upvote count: 2

http://stackoverflow.com/q/27574945
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43578737
has answer: http://stackoverflow.com/a/27575014
has comment: http://stackoverflow.com/comment/43575661
accepted answer: http://stackoverflow.com/a/27575014
linked to: http://stackoverflow.com/q/5571466
has comment: http://stackoverflow.com/comment/43575510
tagged with: android
has comment: http://stackoverflow.com/comment/43575924
has body: I have a class DataGridView this is the constructor //this class is created in the MainActivity public DataGridView(Context CTX,TableLayout Tl,int[] Weight) { this.CTX = CTX; this.Tl = Tl; this.Weight= Weight; } I want to add a parameter that receive a class(what ever class) for example MainActivity public DataGridView(Context CTX,TableLayout Tl,int[] Weight,Class MA) { this.CTX = CTX; this.Tl = Tl; this.Weight= Weight; //HERE this.MA = MA; } To do this in The MainActivity public void Create(){ int[] weight = new int[2]; weight[0] = 1; weight[1] = 3; Dr= new DataGridView(CTX,Dt,weight,this); String[] Columnas = new String[2]; Columnas[0] = "ID"; Columnas[1] = "MATERIA"; Dr.ColumnsAdd(Columnas); } I dont want to put in the parameter MainActivity MA, Because i will send another Activities to this object. I Want to get it Dinamically.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43575403
tagged with: java
type: Question
has title: Get a class dynamically

javascript
tags question: http://stackoverflow.com/q/27478541
tags question: http://stackoverflow.com/q/27588775
tags question: http://stackoverflow.com/q/27598524
tags question: http://stackoverflow.com/q/27525308
tags question: http://stackoverflow.com/q/27496052
tags question: http://stackoverflow.com/q/27626181
tags question: http://stackoverflow.com/q/27511317
tags question: http://stackoverflow.com/q/27506866
tags question: http://stackoverflow.com/q/27510191
tags question: http://stackoverflow.com/q/27620195
tags question: http://stackoverflow.com/q/27601680
tags question: http://stackoverflow.com/q/27620914
tags question: http://stackoverflow.com/q/27533785
tags question: http://stackoverflow.com/q/27565269
tags question: http://stackoverflow.com/q/27621084
tag name: javascript
tags question: http://stackoverflow.com/q/27540029
tags question: http://stackoverflow.com/q/27522039
tags question: http://stackoverflow.com/q/27508249
tags question: http://stackoverflow.com/q/27520024
tags question: http://stackoverflow.com/q/27479169
tags question: http://stackoverflow.com/q/27500315
tags question: http://stackoverflow.com/q/27549075
tags question: http://stackoverflow.com/q/27540706
tags question: http://stackoverflow.com/q/27608110
type: Tag
tags question: http://stackoverflow.com/q/27629929
tags question: http://stackoverflow.com/q/27502744
tags question: http://stackoverflow.com/q/27610851
tags question: http://stackoverflow.com/q/27585339
tags question: http://stackoverflow.com/q/27516503
tags question: http://stackoverflow.com/q/27629194
tags question: http://stackoverflow.com/q/27492384
tags question: http://stackoverflow.com/q/27545408
tags question: http://stackoverflow.com/q/27531810
tags question: http://stackoverflow.com/q/27617349
tags question: http://stackoverflow.com/q/27604679
tags question: http://stackoverflow.com/q/27483681
tags question: http://stackoverflow.com/q/27600871
tags question: http://stackoverflow.com/q/27609387
tags question: http://stackoverflow.com/q/27636806
tags question: http://stackoverflow.com/q/27585864
tags question: http://stackoverflow.com/q/27550149
tags question: http://stackoverflow.com/q/27571189
tags question: http://stackoverflow.com/q/27562061

http://stackoverflow.com/q/27561635
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/27561815
has answer: http://stackoverflow.com/a/27561815
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27561776
tagged with: eclipse-plugin
has body: I created a plugin which queries the selected project name &amp; Path and displays it in a view at the startup. Here is my code on how i am querying for the selected project: IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection(); Object firstElement = selection.getFirstElement(); if (firstElement != null) { if (firstElement instanceof IAdaptable) { IProject project = (IProject) ((IAdaptable) firstElement).getAdapter(IProject.class); IPath path = project.getFullPath(); IPath location = project.getLocation(); } } If project been changed (User selects any other project) or if the selected project been closed, how could i get a notification ?
accepted answer: http://stackoverflow.com/a/27561776
type: AnsweredQuestion
has title: eclipse plugin: get notification when selected project changed
tagged with: java
tagged with: swt

http://stackoverflow.com/a/27636612
has body: Try following code: String test="12-12-2014 10:00:00"; Date date=new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").parse(test); String OutputDate=new SimpleDateFormat("yyyy-dd-MM HH:mm:ss").format(date); System.out.println(OutputDate); Output : 2014-12-12 10:00:00 The dig over here is to parse a string with date attributes using SimpleDateFormat into java.util.Date. For more on SimpleDateFormat visit this link.
type: Answer
has comment: http://stackoverflow.com/comment/43692290
has comment: http://stackoverflow.com/comment/43692307
has comment: http://stackoverflow.com/comment/43692490
score: 0
answers question: http://stackoverflow.com/q/27636575
has comment: http://stackoverflow.com/comment/43692414
has comment: http://stackoverflow.com/comment/43692607

http://stackoverflow.com/q/27592542
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43609667
has comment: http://stackoverflow.com/comment/43610038
score: 2
has comment: http://stackoverflow.com/comment/43609395
has comment: http://stackoverflow.com/comment/43609673
has comment: http://stackoverflow.com/comment/43609434
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43610127
has comment: http://stackoverflow.com/comment/43609464
downvote count: 0
tagged with: callback
has body: Please I would like to understand something that is happening to me. I kindly ask if somebody would be so kind to explain to me. Thanks THE ONCLICK I have an OnClickListener which contains 2 callbacks: onRequestFailure onRequestSuccess @Override public void onClick(View v) { spicemanager.execute( new RequestListener&lt;Alltips&gt;() { @Override public void onRequestFailure(SpiceException spiceException) { //Do soume stuff } @Override public void onRequestSuccess(final Alltips alltips) { //Do some other stuff } }); } WHAT HAPPENS When I click the first time everything goes fine, if I click for more times the onClick stops responding. WHY IS THAT HAPPENING? I suppose that if onClick never returns that could be the cause, but this is not the situation (I think), I think onClick returns even if the callbacks are not called... Please can somebody explain it to me? HOW TO AVOID how do I avoid such a situation?
favorite count: 0
has comment: http://stackoverflow.com/comment/43609417
tagged with: android
has comment: http://stackoverflow.com/comment/43609636
has title: Callback in onClick()
has comment: http://stackoverflow.com/comment/43609174
has comment: http://stackoverflow.com/comment/43609605
has comment: http://stackoverflow.com/comment/43609503
answer count: 0
has comment: http://stackoverflow.com/comment/43609542

http://stackoverflow.com/comment/43639475
score: 0
type: QuestionComment
has text: Not sure this helps, but take a look at that question maybe: http://stackoverflow.com/questions/744389/tomcat-what-is-the-init-context-params-to-use-for-making-an-external-client-con
type: Comment
comment on: http://stackoverflow.com/q/27606109

http://stackoverflow.com/a/27505039
score: 1
has comment: http://stackoverflow.com/comment/43510773
has comment: http://stackoverflow.com/comment/43508561
has comment: http://stackoverflow.com/comment/43509960
has body: Don't click on the image itself so that the popup will not appear. In your html code there should be an input element with type file. In your Selenium test you can find the input element and fill it with the path of the image you want to add. Then submit the form around the input element. The Selenium framework will handle the rest for you. For me it works fine with all browsers. I think its a cleaner solution than simulation a keyboard.
has comment: http://stackoverflow.com/comment/43506076
type: Answer
has comment: http://stackoverflow.com/comment/43509812
answers question: http://stackoverflow.com/q/27504824
has comment: http://stackoverflow.com/comment/43509765
upvote count: 1
has comment: http://stackoverflow.com/comment/43440570
downvote count: 0

http://stackoverflow.com/a/27603635
answers question: http://stackoverflow.com/q/27601302
has body: To fix both of your issues (show the message, and have the proper url) you should in original code change you exception handler method to e.g. @ExceptionHandler(IllegalStateException.class) public RedirectView handleIllegalStateException(IllegalStateException ex, HttpServletRequest request) { RedirectView rw = new RedirectView("/error"); FlashMap outputFlashMap = RequestContextUtils.getOutputFlashMap(request); if (outputFlashMap != null) { outputFlashMap.put("exceptionMsg", ex.getMessage()); } return rw; } Why? If you want your attributes to persist through redirect, you need to add them to flash scope. The code above uses the FlashMap, from the docs A FlashMap is saved before the redirect (typically in the session) and is made available after the redirect and removed immediately. If it were to be a normal controller method, you could have simply added RedirectAttributes as an argument, but on @ExceptionHandler methods, the arguments of RedirectAttributes are not resolved, so you need to add the HttpServletRequest and use the RedirectView.
accepted answer of: http://stackoverflow.com/q/27601302
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/q/27542593
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/27547165
tagged with: java
has body: I added tiles dependency in pom.xml. I get error on my jsp page when I am adding this line <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.nated.app.migration nated war 1.0-SNAPSHOT nated Maven Webapp http://maven.apache.org <spring.version>3.1.1.RELEASE</spring.version> <jdk.version>1.6</jdk.version> <jstl.version>1.2</jstl.version> <junit.version>4.11</junit.version> <tiles.version>2.2</tiles.version> junit junit ${junit.version} test jstl jstl ${jstl.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-core ${spring.version} org.springframework spring-beans ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-asm ${spring.version} org.springframework spring-expression ${spring.version} org.springframework spring-jdbc ${spring.version} mysql mysql-connector-java 5.0.5 org.apache.tiles tiles-api ${tiles.version} org.apache.tiles tiles-core ${tiles.version} org.apache.tiles tiles-jsp ${tiles.version} org.apache.tiles tiles-servlet ${tiles.version} org.apache.tiles tiles-template ${tiles.version} nated org.apache.maven.plugins maven-compiler-plugin 2.3.2 ${jdk.version} ${jdk.version} Now when ever i am running mvn eclipse:eclipse,its only downloading pom file not jar file Please see the Image below image-1 and image-2.That's why i am getting error see img-3
tagged with: apache-tiles
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/53743948
score: 0
tagged with: tiles
has title: Getting error with taglib uri="http://tiles.apache.org/tags-tiles"
type: UnansweredQuestion

http://stackoverflow.com/q/27620632
tagged with: class
has comment: http://stackoverflow.com/comment/43663006
has comment: http://stackoverflow.com/comment/43662493
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27626611
accepted answer: http://stackoverflow.com/a/27626611
has body: I have the following problem: If I execute.. wget https://somefunnydomain.com.br/test/java.class .. the file will download just fine. And if I execute.. wget https://ip.ip.ip.ip/test/java.class ..the file will also download just fine. But now, the strange part... In my java.php file, the following code will load an applet using a web browser: &lt;applet code="java.class" archive="java.jar" mayscript="true" height="400" width="400"&gt; Error there is no applet support in your browser. &lt;/applet&gt; I think this is okay, but it isn't. When I try to open the PHP page that calls the java.class, using the domain: https://somefunnydomain.com.br/test/java.php The PHP page runs, but it displays the error: CLASS NOT FOUND . But if I use the IP like this: https://ip.ip.ip.ip/test/java.php In other words, with the IP it works, with the domain it doesn't. I also tried to do this: &lt;applet code="https://somefunnydomain.com.br/test/java.class" archive="java.jar" mayscript="true" height="400" width="400"&gt; Error there is no applet support in your browser. &lt;/applet&gt; But I think it is stupid and it didn't solve my problem at all (still getting the CLASS NOT FOUND message) Here are some extra details: 1- The domain is internal and it is provided by a local DNS server. Computer is configured to use only the local DNS server, is Java using another DNS server? 2- There are no virtualhosts in Apache for the domain, it recognizes everything! How can I solve this?
favorite count: 0
has title: Java Class not found only if I am using a domain, but if I call by ip class is there
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43662997
upvote count: 0
has comment: http://stackoverflow.com/comment/95013497
tagged with: java
has comment: http://stackoverflow.com/comment/43663752
type: Question
has comment: http://stackoverflow.com/comment/43662323
score: -1

http://stackoverflow.com/q/27516340
tagged with: java
tagged with: file
type: Question
tagged with: filenotfoundexception
answer count: 2
has comment: http://stackoverflow.com/comment/43462946
has body: My project has two folders: folder1 and folder2. In folder1, I am trying to load a file present in folder2 using its reference path but it gives me the following exception: java.io.FileNotFoundException: /folder2/blah.txt (No such file or directory). It works when I use the absolute path. file = new FileInputStream("/folder2/blah.txt")
has answer: http://stackoverflow.com/a/27516383
accepted answer: http://stackoverflow.com/a/27516383
score: -1
possible better answer: http://stackoverflow.com/a/27516420
has title: FileNotFoundException when using the reference path
has comment: http://stackoverflow.com/comment/43462933
tagged with: exception
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/4032957
upvote count: 0
has answer: http://stackoverflow.com/a/27516420
type: AnsweredQuestion

http://stackoverflow.com/comment/43482520
has text: I would consider calling `cancel` to be cleaner than interrupting the thread, however, you have to consider that only tasks enqueued via `submit` are wrapped into a `FutureTask`; if you queue a `Runnable` via `execute`, that `Runnable` will be the very instance you get in `beforeExecute`. If that’s not an issue for you, you can use `cancel`. Note that the wrapping happens in [`newTaskFor`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/AbstractExecutorService.html#newTaskFor(java.util.concurrent.Callable)) and can be customized by overriding that method.
comment on: http://stackoverflow.com/a/27502781
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43397609
score: 0
comment on: http://stackoverflow.com/q/27481887
has text: Your edits made this question meaningless. NB when you get an exception, print it. Not some random message of your own devising. And this doesn't really have anything to do with serialization.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27548206
score: 0
has answer: http://stackoverflow.com/a/27548269
has comment: http://stackoverflow.com/comment/43522520
has comment: http://stackoverflow.com/comment/43522936
answer count: 1
linked to: http://stackoverflow.com/q/8553175
accepted answer: http://stackoverflow.com/a/27548269
has comment: http://stackoverflow.com/comment/43522565
has comment: http://stackoverflow.com/comment/43522592
duplicate of: http://stackoverflow.com/q/8553175
type: AnsweredQuestion
has body: I am a new java developer out here, and ive come across this weird thing, that eclipse still thinks my main class is called illuminati (just randomly wrote something..) here is a screenshot of the error i get: so what the problem is, basicly eclipse cant find the mainclass even though i changed the name.. and i dont know how to configure it that the class is gone (or changed name) Thanks in advance!
has comment: http://stackoverflow.com/comment/43522508
tagged with: java
type: Question
has title: Eclipse wanting to run wrong class
tagged with: eclipse

http://stackoverflow.com/comment/43665339
type: Comment
type: QuestionComment
has text: Are you sure it made incompaible changes? The index "knows" its Lucene version and higher versions can always deal with lower ones.
score: 0
comment on: http://stackoverflow.com/q/27622181

http://stackoverflow.com/comment/43781925
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27604708
type: QuestionComment
has text: What version of Neo4j are you using? Your stacktrace shows 1.9.4 classes as well as 2.1.5 from the auth extension.

http://stackoverflow.com/q/27511506
downvote count: 0
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27511653
favorite count: 0
tagged with: twilio
has title: Spring MVC Controller Redirection With Twilio
upvote count: 2
accepted answer: http://stackoverflow.com/a/27511653
has body: I have a twilio application that I'm trying to split between spanish and english using the same code. The idea is simple, split the XML into two functions that assign either the spanish version or english. That is fine, however I've run into an issue on redirecting the controller. All the answers I saw said to return "redirect:/route" but with Twilio, this merely causes the phone to say in english "redirect colon slash route" and then hangup the call What am I doing wrong? //assign english data and redirect to IVR greeting method @RequestMapping(value = "/ivr/en") public String ivrLangEn(@RequestParam("CallSid") String callID) { //english xml string assignments here return "redirect:/irv"; } //assign spanish data and redirect to IVR greeting method @RequestMapping(value = "/ivr/sp") public String ivrLangSp(@RequestParam("CallSid") String callID) { //spanish xml string assignments here return "redirect:/ivr"; } @RequestMapping(value = "/ivr", produces = MediaType.APPLICATION_XML_VALUE) /* * Main greeting method. Display greeting and default to question one * @return returns the XML for the greeting and question one */ @ResponseBody public String greeting(@RequestParam("CallSid") String callID) { repository.save(new Feedback(callID)); String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + " "+ " Hello. "+ one + " "; return xml; }
tagged with: spring
answer count: 1
tagged with: java
score: 2

http://stackoverflow.com/comment/43544156
comment on: http://stackoverflow.com/a/27557617
score: 0
type: AnswerComment
type: Comment
has text: Is there documentation somewhere for this? it wasn't in the javadocs for BigDecimal

http://stackoverflow.com/comment/43401981
comment on: http://stackoverflow.com/a/27484834
type: Comment
score: 0
has text: Thanks. It works But when record is added then i want that it added in a new line. So that i wrote the code `x.format("%s %s %s \n", rollno, fname, lname);` But it not works..
type: AnswerComment

http://stackoverflow.com/comment/43385840
has text: It doesn't always take in drop, depends on what the user searches however, I did just try to use this with the input and it didn't give the correct output.
type: Comment
comment on: http://stackoverflow.com/a/27475685
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43690689
has text: Why would `myWarrior` be a sword? Warriors are not, on the whole, swords.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27635770
type: Comment

http://stackoverflow.com/a/27689159
type: AcceptedAnswer
has body: Problem solved! For some reason there was missing the path for System32 in my PATH variable! I realized it when i run android on command line and there was a message: xcopy is not recognized as an internal or external command although sdk manager was running normally.
score: 0
answers question: http://stackoverflow.com/q/27635740
type: Answer
accepted answer of: http://stackoverflow.com/q/27635740

http://stackoverflow.com/q/27533774
has comment: http://stackoverflow.com/comment/43496219
has comment: http://stackoverflow.com/comment/43495984
has comment: http://stackoverflow.com/comment/43496162
downvote count: 0
accepted answer: http://stackoverflow.com/a/27533904
favorite count: 0
possible better answer: http://stackoverflow.com/a/27533986
has body: In Java, would an on-heap object be replicated on stack when a method is called? Consider this code - static void mirror(Node p){ if (p!=null) { Node temp = null; temp = p.left; p.left = p.right; p.right = temp; mirror(p.left); mirror(p.right); } } Would the space complexity be - O(n) because the Node object p is pushed/replicated on stack on every recursive call O(1) because the Node object is already in memory and p is just a reference to it O(n) because the reference p is being pushed on stack on method calls Edit: where n is the depth of the tree
has answer: http://stackoverflow.com/a/27533986
tagged with: space-complexity
tagged with: recursion
type: AnsweredQuestion
score: 1
tagged with: java
has title: Will objects on heap be replicated on stack on function call?
upvote count: 1
has answer: http://stackoverflow.com/a/27533904
type: Question
answer count: 2

http://stackoverflow.com/comment/43531820
has text: for the error i guess the `wrapper.removeAllViews()` did not remove the views, this is the only case the duplicate id comes into picture.
type: QuestionComment
comment on: http://stackoverflow.com/q/27552455
score: 0
type: Comment

minimax
type: Tag
tags question: http://stackoverflow.com/q/27637559
tag name: minimax
tags question: http://stackoverflow.com/q/27549969

http://stackoverflow.com/a/27623395
type: Answer
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/27522711
has body: I interpret your question in two different ways. 1. Is it possible to write rules for Drools without using the KIE workbench? Yes, it should support importing rules so all you need to do is open up a text editor and start typing. The rules are written as text using a fairly simple syntax that you can figure out in about 1-2 hours of reading. I do not know what your environment looks like but there should be a mechanism to parse and import a new rule. All rules you write will start out in a text editor looking like this: rule &quot;&lt;name&gt;&quot; &lt;attribute&gt; when &lt;conditional element&gt; then &lt;action&gt; end You will add to the conditions and actions. Of course you will have to know what conditions you can create which is limited to your environment and likewise for the actions. 2. Is it possible to create rules and use them programatically through some sort of API? Yes, I do it all of the time for the processing we do using the Java API. We have 2 types of rules that we use, static and dynamic. The static ones have pre-canned conditions and are written to perform the same comparisons (LHS) over and over and performing the same actions each time the conditions are met (RHS). The dynamic ones are created on the fly based upon a minimalistic set of object types and comparisons (LHS) specified by the user when they are created. The actions (RHS) are pre-canned but are selected for use depending on the need for the overall rule use. The entire rule is created as text then passed to the Drools parser before being added to the list of rules to evaluate. Hope this helps.
has comment: http://stackoverflow.com/comment/86830316
downvote count: 0
has comment: http://stackoverflow.com/comment/86784140

http://stackoverflow.com/a/27613927
downvote count: 3
upvote count: 1
answers question: http://stackoverflow.com/q/27613854
has comment: http://stackoverflow.com/comment/43650025
has body: Change the for loop condition to i &lt;= nums.length-2 instead of i &lt; nums.length-2, it works!!
type: Answer
score: -2

http://stackoverflow.com/a/27488757
answers question: http://stackoverflow.com/q/27488538
score: 0
type: Answer
has body: There is not standard of image/x-generic type. Frequent used types are here. So use image/jpg probably. private static final MediaType MEDIA_TYPE = MediaType.parse("image/jpg"); Also probably main issue is in server handling of this request (maybe for unexpected image type).
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27488538

http://stackoverflow.com/q/27545599
has comment: http://stackoverflow.com/comment/43517869
has answer: http://stackoverflow.com/a/27545651
accepted answer: http://stackoverflow.com/a/27545651
type: AnsweredQuestion
tagged with: java
type: Question
has title: Method from superclass cannot be overridden when return type is a List
tagged with: inheritance
has body: When I want to return a ArrayList of C2, it's not possible, because the return types are incompatible. package a; class C1 { private final ArrayList&lt;C2&gt; c2s = new ArrayList&lt;C2&gt;(); protected ArrayList&lt;C2&gt; getC2() { return c2s; } } class C2 {} package b; class C1 extends a.C1 { private final ArrayList&lt;C2&gt; c2s = new ArrayList&lt;C2&gt;(); @Override protected ArrayList&lt;C2&gt; getC2() { return c2s; } // won't work } class C2 extends a.C2 {} Update: Why doesn't this work, when following works (in a.C1 and b.C1): private final C2 c2 = new C2(); public C2 getC2() { return c2; }
score: 0
answer count: 1

http://stackoverflow.com/q/27492053
tagged with: java
accepted answer: http://stackoverflow.com/a/27492104
has title: Less input values than array length
has comment: http://stackoverflow.com/comment/43415652
has answer: http://stackoverflow.com/a/27492250
has answer: http://stackoverflow.com/a/27492105
tagged with: arrays
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/27492145
has body: For an assignment I have been asked to create a Java program that reads integer values from a file and stores them into an array with a length of 40, and prints the values in reverse order. My problem is that the assignment also requires it to work when there are less than 40 values in the file. This is what I have tried: import java.io.*; import java.util.Scanner; public class Set8_Prog3 { public static void main (String[] args) throws IOException { FileReader i = new FileReader("Set8_Prog3 numbers.txt"); Scanner j = new Scanner(i); int[] values = new int[40]; int k = 0; int last = -1; while (k &lt; 40) { values[k] = j.nextInt(); last = values[k]; k++; } System.out.println("The values from the file in reverse order is: "); while (last &gt;= 0) { System.out.println(values[last]); last--; } } } It compiles successfully, but when I run it I get an error saying java.util.NoSuchElementException. Also, I am not supposed to use an ArrayList.
has answer: http://stackoverflow.com/a/27492104
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27492145
has answer: http://stackoverflow.com/a/27492183
type: Question
has answer: http://stackoverflow.com/a/27492137
has comment: http://stackoverflow.com/comment/43415798

http://stackoverflow.com/comment/43577556
type: Comment
comment on: http://stackoverflow.com/q/27576039
type: QuestionComment
score: 0
has text: This is most likely implementation specific. Which JRE implementation are you referring to?

http://stackoverflow.com/comment/43627762
comment on: http://stackoverflow.com/q/27602489
score: 0
type: Comment
type: QuestionComment
has text: @chiastic-security: thanks for let me knowing. will consider this.

http://stackoverflow.com/q/27503285
possible better answer: http://stackoverflow.com/a/76315187
downvote count: 0
has answer: http://stackoverflow.com/a/27512275
has answer: http://stackoverflow.com/a/76315187
favorite count: 0
accepted answer: http://stackoverflow.com/a/27512275
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
has body: I'm trying to build a Java EE app prototype using different frameworks. Everything works fine except the security layer. I chose to use Spring Security configured with Spring configuration. The code is like this: Spring Security Config @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private MyUserDetailsService userDetailsService; @Override protected UserDetailsService userDetailsService () { return this.userDetailsService; } @Override public void configure(WebSecurity web) throws Exception { web .ignoring() .antMatchers("/resources/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http .formLogin() .loginPage("/login") .loginProcessingUrl("/login/authenticate") .failureUrl("/login?error=bad_credentials") .and() .logout() .logoutUrl("/signout") .deleteCookies("JSESSIONID") .and() .authorizeRequests() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/**").permitAll() .and() .csrf(); } } User Detail Service @Service("myUserDetailsService") public class MyUserDetailsService implements UserDetailsService { public static final Logger log = Logger.getLogger(MyUserDetailsService.class); public MyUserDetailsService() { } @Autowired private UserDao userDao; @Override public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException { final User user = getSystemUser(userName); final List&lt;GrantedAuthority&gt; authorities = getUserAuthorities(user); return buildUserForAuthentication(user, authorities); } private User buildUserForAuthentication(User user, List&lt;GrantedAuthority&gt; authorities) { //... } private User getSystemUser(String alias) { //... } private List&lt;GrantedAuthority&gt; getUserAuthorities(User user) { //... return null; } } What I'm expecting this code to do is that when /login/authenticate is reached with the user &amp; pass params, the underlying spring code invokes my user service, but this never happens. What am I missing? …
upvote count: 3
tagged with: java
tagged with: authentication
type: Question
answer count: 2
tagged with: spring-security
has title: Spring Security service configuration

http://stackoverflow.com/q/27506355
has comment: http://stackoverflow.com/comment/43442996
tagged with: portlet
has title: Difference between specifying plid in opening tag and passing it as a param in Liferay
accepted answer: http://stackoverflow.com/a/27510266
has body: What is the difference between specifying the plid in the opening tag when creating a portlet url &lt;liferay-portlet:renderURL var="myurl" windowState="normal" plid="123456"&gt; &lt;liferay-portlet:param name="struts.portlet.action" value='/view/myAction' /&gt; &lt;/liferay-portlet:renderURL&gt; and passing it as a param &lt;liferay-portlet:renderURL var="myurl" windowState="normal"&gt; &lt;liferay-portlet:param name="struts.portlet.action" value='/view/myAction' /&gt; &lt;liferay-portlet:param name="plid" value='123456' /&gt; &lt;/liferay-portlet:renderURL&gt; I get different error messages when the plid doesn't exist so I was wandering what the difference was
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27510266
tagged with: java
has answer: http://stackoverflow.com/a/27524918
type: Question
upvote count: 2
tagged with: liferay
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27524918
tagged with: url
has comment: http://stackoverflow.com/comment/43444418
favorite count: 0

http://stackoverflow.com/comment/43577439
type: Comment
type: QuestionComment
has text: How does it not work? What does it do? Why are you showing us so much code? Only give us an [MCVE](http://stackoverflow.com/help/mcve)
score: 0
comment on: http://stackoverflow.com/q/27575968

http://stackoverflow.com/a/27516261
accepted answer of: http://stackoverflow.com/q/27515626
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43464027
type: Answer
has body: For the list error you have to import java.util.* import java.util.* Importing LinkedList does not include using list.
has comment: http://stackoverflow.com/comment/43463777
answers question: http://stackoverflow.com/q/27515626
score: 0

http://stackoverflow.com/q/27523717
answer count: 2
score: 4
has title: Custom Error Handling with Retrofit when obfuscated using proguard gives java.lang.reflect.UndeclaredThrowableException
has answer: http://stackoverflow.com/a/27533168
accepted answer: http://stackoverflow.com/a/27533168
tagged with: retrofit
tagged with: android
tagged with: obfuscation
upvote count: 4
favorite count: 0
tagged with: proguard
downvote count: 0
possible better answer: http://stackoverflow.com/a/27532001
has answer: http://stackoverflow.com/a/27532001
type: AnsweredQuestion
has body: Have written custom error handling for retrofit. The code works perfectly when minifyEnabled false. When I enable proguard, I get the following exception 12-17 10:14:07.688 18568-19041/com.mobility.cariq.carscore W/System.err﹕ java.lang.reflect.UndeclaredThrowableException 12-17 10:14:07.688 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at $Proxy9.updatesForModel(Native Method) 12-17 10:14:07.688 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at com.mobility.cariq.carscore.rest.service.UpdateDatabaseService.jiijijliillliliilllil(UpdateDatabaseService.java:119) 12-17 10:14:07.688 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at com.mobility.cariq.carscore.rest.service.UpdateDatabaseService.onHandleIntent(UpdateDatabaseService.java:75) 12-17 10:14:07.689 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) 12-17 10:14:07.689 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:102) 12-17 10:14:07.689 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at android.os.Looper.loop(Looper.java:136) 12-17 10:14:07.689 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at android.os.HandlerThread.run(HandlerThread.java:61) 12-17 10:14:07.689 18568-19041/com.mobility.cariq.carscore W/System.err﹕ Caused by: com.mobility.cariq.carscore.rest.error.UnauthorizedException 12-17 10:14:07.690 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at com.mobility.cariq.carscore.rest.error.RestErrorHandler.handleError(RestErrorHandler.java:40) 12-17 10:14:07.690 18568-19041/com.mobility.cariq.carscore W/System.err﹕ at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:242) Error Handler public class RestErrorHandler implements ErrorHandler { @Override public Throwable handleError(RetrofitError cause) { Response r = cause.getResponse(); if (r != null &amp;&amp; r.getStatus() == 400) { try { RestError mRestError = (RestErro…
tagged with: java
type: Question

http://stackoverflow.com/comment/43512156
score: 0
comment on: http://stackoverflow.com/q/27542486
type: Comment
type: QuestionComment
has text: By incomplete to you mean not fully copied yet?

http://stackoverflow.com/comment/43670510
has text: Please check if [that](http://stackoverflow.com/questions/106770/standard-concise-way-to-copy-a-file-in-java) question helps you. Regards
score: 0
comment on: http://stackoverflow.com/q/27623933
type: Comment
type: QuestionComment

jsp
tags question: http://stackoverflow.com/q/27548844
tags question: http://stackoverflow.com/q/27583528
tags question: http://stackoverflow.com/q/27539608
tags question: http://stackoverflow.com/q/27503023
tags question: http://stackoverflow.com/q/27592365
tags question: http://stackoverflow.com/q/27538567
tags question: http://stackoverflow.com/q/27622892
tags question: http://stackoverflow.com/q/27501678
tags question: http://stackoverflow.com/q/27626025
tags question: http://stackoverflow.com/q/27516576
tags question: http://stackoverflow.com/q/27550552
tags question: http://stackoverflow.com/q/27498594
tags question: http://stackoverflow.com/q/27548076
tags question: http://stackoverflow.com/q/27539570
tags question: http://stackoverflow.com/q/27565266
tags question: http://stackoverflow.com/q/27496960
tags question: http://stackoverflow.com/q/27529211
tags question: http://stackoverflow.com/q/27481183
tags question: http://stackoverflow.com/q/27508513
tags question: http://stackoverflow.com/q/27516503
tags question: http://stackoverflow.com/q/27595346
tags question: http://stackoverflow.com/q/27566967
tags question: http://stackoverflow.com/q/27579458
tags question: http://stackoverflow.com/q/27508948
tags question: http://stackoverflow.com/q/27502102
tags question: http://stackoverflow.com/q/27580647
tags question: http://stackoverflow.com/q/27500315
tags question: http://stackoverflow.com/q/27617742
tags question: http://stackoverflow.com/q/27619414
tags question: http://stackoverflow.com/q/27582167
tags question: http://stackoverflow.com/q/27561908
tags question: http://stackoverflow.com/q/27512401
tags question: http://stackoverflow.com/q/27583912
tags question: http://stackoverflow.com/q/27516425
tags question: http://stackoverflow.com/q/27597680
tags question: http://stackoverflow.com/q/27503830
type: Tag
tags question: http://stackoverflow.com/q/27491950
tags question: http://stackoverflow.com/q/27497787
tags question: http://stackoverflow.com/q/27483574
tags question: http://stackoverflow.com/q/27499323
tags question: http://stackoverflow.com/q/27503805
tags question: http://stackoverflow.com/q/27504491
tags question: http://stackoverflow.com/q/27544973
tags question: http://stackoverflow.com/q/27620570
tags question: http://stackoverflow.com/q/27550368
tags question: http://stackoverflow.com/q/27537710
tags question: http://stackoverflow.com/q/27576098
tags question: http://stackoverflow.com/q/27533888
tags question: http://stackoverflow.com/q/27548068
tags question: http://stackoverflow.com/q/27517278
tags question: http://stackoverflow.com/q/27490460
tag name: jsp
tags question: http://stackoverflow.com/q/27503920
tags question: http://stackoverflow.com/q/27636367
tags question: http://stackoverflow.com/q/27495160
tags question: http://stackoverflow.com/q/27475077
tags question: http://stackoverflow.com/q/27571148
tags question: http://stackoverflow.com/q/27525585
tags question: http://stackoverflow.com/q/27499013
tags question: http://stackoverflow.com/q/27482634
tags question: http://stackoverflow.com/q/27503105
tags question: http://stackoverflow.com/q/27518403
tags question: http://stackoverflow.com/q/27536535
tags question: http://stackoverflow.com/q/27502466
tags question: http://stackoverflow.com/q/27531840
tags question: http://stackoverflow.com/q/27496052
tags question: http://stackoverflow.com/q/27638038
tags question: http://stackoverflow.com/q/27527955
tags question: http://stackoverflow.com/q/27551604
tags question: http://stackoverflow.com/q/27548562
tags question: http://stackoverflow.com/q/27530441
tags question: http://stackoverflow.com/q/27567504
tags question: http://stackoverflow.com/q/27605778
tags question: http://stackoverflow.com/q/27567511
tags question: http://stackoverflow.com/q/27540011
tags question: http://stackoverflow.com/q/27592050
tags question: http://stackoverflow.com/q/27545082
tags question: http://stackoverflow.com/q/27479306
tags question: http://stackoverflow.com/q/27518453

http://stackoverflow.com/comment/43594403
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27584881
has text: Could you post the exact result expected from your example input? As code, please.
type: Comment

http://stackoverflow.com/a/27502243
answers question: http://stackoverflow.com/q/27502080
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/101060642
has body: String s1 = "abc"; // s1 points to "abc" Here, "abc" will be added to the String Constants Pool and will usually not be GCed. Any string literal (within double quotes) will usually not be GCed. String s1 = new String("abc"); The above line creates 2 Strings. "abc" will be added to the String constants pool (assuming it is not present there already) and another String with value "abc" will on the heap. The String object present on the heap can be GCed once it becomes unreachable (i.e, there are no references to it)
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27502080
score: 1

http://stackoverflow.com/q/27511590
type: Question
has answer: http://stackoverflow.com/a/27511882
upvote count: 0
has title: Java: Compare dates on same timezone
has comment: http://stackoverflow.com/comment/43453543
downvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/43453444
accepted answer: http://stackoverflow.com/a/27511612
has comment: http://stackoverflow.com/comment/43461582
favorite count: 0
tagged with: timezone
possible better answer: http://stackoverflow.com/a/27511674
score: -4
has comment: http://stackoverflow.com/comment/43453401
has answer: http://stackoverflow.com/a/27511674
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43453275
has body: Given: SimpleDateFormat sd = new SimpleDateFormat ("yy-MM-dd hh:mm:ss.SSS"); sd.setTimeZone(TimeZone.getTimeZone("GMT")); Date d = sd.parse("a date similar to now on local computer"); if I compare d.getTime() with new Date().getTime(), the values are different with more than one hour. Why?
tagged with: java
has answer: http://stackoverflow.com/a/27511612
tagged with: date

http://stackoverflow.com/comment/43571751
score: 0
type: Comment
has text: Ok, just added the solution for complex shapes
type: AnswerComment
comment on: http://stackoverflow.com/a/27571232

database
tags question: http://stackoverflow.com/q/27576985
tags question: http://stackoverflow.com/q/27542256
tags question: http://stackoverflow.com/q/27540469
tags question: http://stackoverflow.com/q/27518380
tags question: http://stackoverflow.com/q/27564967
tags question: http://stackoverflow.com/q/27565594
tags question: http://stackoverflow.com/q/27581292
tags question: http://stackoverflow.com/q/27636754
tags question: http://stackoverflow.com/q/27540322
tags question: http://stackoverflow.com/q/27557513
tags question: http://stackoverflow.com/q/27482355
tags question: http://stackoverflow.com/q/27530514
tags question: http://stackoverflow.com/q/27597680
tags question: http://stackoverflow.com/q/27500578
type: Tag
tags question: http://stackoverflow.com/q/27627006
tags question: http://stackoverflow.com/q/27620147
tags question: http://stackoverflow.com/q/27483111
tags question: http://stackoverflow.com/q/27508513
tags question: http://stackoverflow.com/q/27626160
tags question: http://stackoverflow.com/q/27500455
tags question: http://stackoverflow.com/q/27549773
tags question: http://stackoverflow.com/q/27606636
tags question: http://stackoverflow.com/q/27625686
tag name: database
tags question: http://stackoverflow.com/q/27541817
tags question: http://stackoverflow.com/q/27506647
tags question: http://stackoverflow.com/q/27589206
tags question: http://stackoverflow.com/q/27631657
tags question: http://stackoverflow.com/q/27534178
tags question: http://stackoverflow.com/q/27542333
tags question: http://stackoverflow.com/q/27482465
tags question: http://stackoverflow.com/q/27499013
tags question: http://stackoverflow.com/q/27585374
tags question: http://stackoverflow.com/q/27480109
tags question: http://stackoverflow.com/q/27581710
tags question: http://stackoverflow.com/q/27546313
tags question: http://stackoverflow.com/q/27617763
tags question: http://stackoverflow.com/q/27579685
tags question: http://stackoverflow.com/q/27500712
tags question: http://stackoverflow.com/q/27637890
tags question: http://stackoverflow.com/q/27496442

http://stackoverflow.com/comment/43659425
score: 0
type: AnswerComment
type: Comment
has text: if each .java file is an individual java project then create a jar file for each java program. Then write a code some thing like this in another java file. public class DriverProgram{ public static void main(String[] args){ Runtime.getRuntime().exec("cmd.exe /c start java -jar Demo.jar"); Runtime.getRuntime().exec("cmd.exe /c start java -jar Demo1.jar"); Runtime.getRuntime().exec("cmd.exe /c start java -jar Demo1.jar"); } } The above program will execute jar files one by one in cmd promt.
comment on: http://stackoverflow.com/a/27617826

http://stackoverflow.com/a/28531519
answers question: http://stackoverflow.com/q/27620754
has body: Either: send a new Message object each time instead of refreshing the old one send it using `writeUnshared()’, or call ObjectOutputStream.reset() before sending a refreshed Message object.
score: 0
type: Answer

http://stackoverflow.com/a/27533948
has comment: http://stackoverflow.com/comment/43496663
downvote count: 0
has body: i am guessing even though the "user" has access to the database, they need permission to access it from the new environment's ip address. ensure that the GRANT for that user includes the new hosts name or ip address in the GRANT.
answers question: http://stackoverflow.com/q/27530529
has comment: http://stackoverflow.com/comment/43498388
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43498329
upvote count: 1

http://stackoverflow.com/q/27549864
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/77384428
tagged with: java
has body: I came across an interesting problem and was wondering if and how could this be done in Java: Create a method which can memoize any function/method . The method has the following arguments : the method/function and the argument(s) for it. For example let's say i have this method : int addOne(int a) { return a + 1;} and i call my memoization method two times with the same arguments : addOne and 5 for example, the first call should actually call the addOne method and return the result and also store that result for that given argument. The second time when i call it should know this has been called before and just look up the previous answer. My idea would be to have something like a HashMap&lt;Callable,HashMap&lt;List&lt;Objects&gt;,Object&gt;&gt; where you would store the previous answers and look them up later on.I think this can be somehow done with lambda expressions but i'm not that familiar with them.I'm not quite sure how to write this method and would appreciate some help. Can this be done with this approach?
score: 23
has title: Java memoization method
type: Question
linked to: http://stackoverflow.com/q/37087809
upvote count: 23
linked to: http://stackoverflow.com/q/3623754
accepted answer: http://stackoverflow.com/a/27549948
answer count: 3
possible better answer: http://stackoverflow.com/a/27550960
has answer: http://stackoverflow.com/a/27550960
has comment: http://stackoverflow.com/comment/43525915
favorite count: 0
has answer: http://stackoverflow.com/a/27549948
tagged with: memoization
tagged with: lambda

http://stackoverflow.com/comment/43520436
type: Comment
comment on: http://stackoverflow.com/a/27546036
has text: yes, propably....I'll try to figure out how to do it in my code. If I have any question could I leave a message on chatter?
score: 0
type: AnswerComment

http://stackoverflow.com/a/27503162
answers question: http://stackoverflow.com/q/27502993
has body: I don't know what webserver you are using, but as long as it adheres to JEE specs you could simply handle it in your web.xml: 500 /path/to/myErrorPage.html
has comment: http://stackoverflow.com/comment/43436515
score: 0
has comment: http://stackoverflow.com/comment/43439545
type: Answer

nodelist
type: Tag
tags question: http://stackoverflow.com/q/27598860
tags question: http://stackoverflow.com/q/27503155
tag name: nodelist

http://stackoverflow.com/q/27588569
tagged with: java
has answer: http://stackoverflow.com/a/27606881
type: Question
score: 5
tagged with: luaj
upvote count: 5
has comment: http://stackoverflow.com/comment/43623716
has comment: http://stackoverflow.com/comment/43601345
answer count: 2
has comment: http://stackoverflow.com/comment/43602927
has body: I am trying to embed a lua-based script system into my game engine. I would like the scripting to be able to have both blocking and non-blocking commands, for example: character.walkTo(24, 359); // Blocks until character arrives c = 35; // Non blocking, execution goes on to the next statement Since the "walkTo" needs to be "active" for more than 1 frame of execution, I would like to be able to run 1 statement at time from the Java host instead of the whole function. This is because it would be overkill to have real multithreading, which is not needed. If I could execute just 1 statement, and keep the execution state "paused" until next statement execution, I would be able to implement blocking commands like "walkTo" by checking if the command is finished in the host, and if it is, go on to the next statement, otherwise, wait until the next frame iteration. Is there any way to execute 1 statement a time from the Java host with LuaJ(or with any other Lua api), or am I forced to develop my own script engine with lex and yacc? Any good idea is welcome, thanks!
downvote count: 0
accepted answer: http://stackoverflow.com/a/27606881
favorite count: 0
has comment: http://stackoverflow.com/comment/43622076
possible better answer: http://stackoverflow.com/a/27631292
has comment: http://stackoverflow.com/comment/43603147
has answer: http://stackoverflow.com/a/27631292
tagged with: lua
type: AnsweredQuestion
has title: Is it possible to execute a single lua statement from a host program?

http://stackoverflow.com/q/27552445
has answer: http://stackoverflow.com/a/27556079
tagged with: embeddable
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
score: 13
upvote count: 13
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27556079
type: Question
has title: JPA SubGraph to define fetchtype of an embedded property
tagged with: java
has body: I have an entity Ride which embeds an embeddable "entity" Route. Route has a List property towns with ManyToMany relation, so it has fetchtype LAZY (and I don't want to use EAGER). So I want to define an NamedEntityGraph for the entity Ride, to load load a Ride object with a Route with instantied List of towns. But when I deploy my war, I get this exception: java.lang.IllegalArgumentException: Attribute [route] is not of managed type Ride @Entity @NamedQueries({ @NamedQuery(name = "Ride.findAll", query = "SELECT m FROM Ride m")}) @NamedEntityGraphs({ @NamedEntityGraph( name = "rideWithInstanciatedRoute", attributeNodes = { @NamedAttributeNode(value = "route", subgraph = "routeWithTowns") }, subgraphs = { @NamedSubgraph( name = "routeWithTowns", attributeNodes = { @NamedAttributeNode("towns") } ) } ) }) public class Ride implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Embedded private Route route; // some getter and setter } Route @Embeddable public class Route implements Serializable { private static final long serialVersionUID = 1L; @ManyToMany private List&lt;Town&gt; towns; // some getter and setter }
tagged with: jpa-2.1

http://stackoverflow.com/comment/43640347
type: Comment
comment on: http://stackoverflow.com/a/27608980
has text: Okay, thanks great thanks, it no longer crashes. However, upon clicking, there is no activity... The dialogue box isn't brought up
type: AnswerComment
score: 0

http://stackoverflow.com/a/27478647
type: Answer
answers question: http://stackoverflow.com/q/27478545
upvote count: 1
has comment: http://stackoverflow.com/comment/43390820
score: 1
has comment: http://stackoverflow.com/comment/43390856
has comment: http://stackoverflow.com/comment/43390843
accepted answer of: http://stackoverflow.com/q/27478545
has body: Does it really matter which programming languages you are using, which is first or second? All you need to have is 2 executable ready and then use shell scripting, use "pipe" to forward the output from one program to other.. e.g. ls -l | sed -e "s/[aeio]/u/g" Update: cppprogram1 | java program2 cppprogram1.txt cppprogram1.txt is output file generated by cppprogram1.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43390908
has comment: http://stackoverflow.com/comment/43391143

http://stackoverflow.com/a/70630531
type: Answer
answers question: http://stackoverflow.com/q/27585437
score: 0
has body: I guess this may have been answered by now on a different thread but as I am new to Java and Eclipse (2 weeks) I thought that I'd be kind-spirited and give a de facto answer. Unlike other IDEs, Eclipse likes to control everything so you have to tell it what directory you want to use as a resource and then place all the files in the resource directory individually. This is all done through Project Explorer. First, create the folder resource (New -&gt; Folder) then in that folder create each File resource. Luckily, for both the Folder and File, they can be linked to external locations.

http://stackoverflow.com/q/27620400
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43662802
tagged with: java
has body: I have a CriteriaBuilder where I am trying to get characters starting from 0 to 10. However I am not able to get the desired output. CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery&lt;Emp&gt; cq = cb.createQuery(Emp.class); Root&lt;Emp&gt; c = cq.from(Emp.class); cb.substring(c.&lt;String&gt;get("projDesc"), 0, 10); cq.orderBy(cb.desc(c.get("salary"))); Query query = em.createQuery(cq); ..... What could be the reason for this?
has answer: http://stackoverflow.com/a/55585845
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/27620661
tagged with: jpa
downvote count: 0
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43662594
answer count: 3
tagged with: eclipselink
possible better answer: http://stackoverflow.com/a/70664292
has answer: http://stackoverflow.com/a/70664292
tagged with: jpa-2.0
has answer: http://stackoverflow.com/a/27620661
tagged with: criteria-api
has title: JPA CriteriaBuilder and Substring

http://stackoverflow.com/a/27586303
has comment: http://stackoverflow.com/comment/43645054
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27583802
score: 3
has body: You're calling $set on "metadata" which discards whatever is there and sets the new value with whatever you pass in. If you only want to partially update a document like that that, you'll either have to pass a complete document to reflect the new state or just issue $set updates: one for each field to change.
upvote count: 4
has comment: http://stackoverflow.com/comment/43598520
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27583802
type: Answer

http://stackoverflow.com/q/27495153
has comment: http://stackoverflow.com/comment/43422113
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43423074
has comment: http://stackoverflow.com/comment/43423005
has answer: http://stackoverflow.com/a/27495495
type: Question
has answer: http://stackoverflow.com/a/27496885
has body: Please excuse my bad english. I am having a problem while implementing a 2d camera. I made the camera to follow the player until it reaches near the edge of the game-level, where only the player moves and the camera stops. I made this easily but my problem is that the camera is not proper. The camera continues to move 1 extra pixel every time you reach at the edge of the game-level limit in all four directions (The code I posted only shows horizontal movement. This I did for simplicity). This means if you move 40 times to and fro near the left edge of the game, camera will move 40 extra pixels right! I have no idea how to solve this. I posted a very simplified version from my original code below and made it as small as i could to show how the program works. Following just moves the player and camera horizontally across the screen. This is 'theGamePanel' class (it is the main class) :- public class TheGamePanel extends JPanel implements Runnable, KeyListener { private boolean left, right; private float cameraX, cameraY; private World world = new World(); private Player player = new Player(); public TheGamePanel() { //setting the size of panel } public static void main(String[] args) { //setting the window } public void paint(Graphics g) { super.paint(g); // drawing the game-level and player g.translate((int)cameraX, (int)cameraY); world.paint(g); player.paint(g); g.translate(-(int)cameraX, -(int)cameraY); } public void upd() { player.update(left, right, this); } @Override public void run() { // game-loop } @Override public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if(code == KeyEvent.VK_LEFT) { left = true; } if(code == KeyEvent.VK_RIGHT) { right = true; } } @Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_LEFT) { left = false; } if(e.getKeyCode() == KeyEvent.VK_RIGHT) { right = false; } } @Override public void keyTyped(KeyEvent e) { } //to set camera position public void setCameraX(float cameraDx) { cameraX += cameraDx;…
has comment: http://stackoverflow.com/comment/43422399
has answer: http://stackoverflow.com/a/27495368
score: 0
has title: In my 2d game, the camera is moving 1 extra pixel each time the player is at the left or the right limit of the screen
tagged with: 2d
tagged with: camera
tagged with: java
answer count: 3

http://stackoverflow.com/a/27610337
has comment: http://stackoverflow.com/comment/43667748
has comment: http://stackoverflow.com/comment/43646505
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27609348
answers question: http://stackoverflow.com/q/27609348
type: Answer
has comment: http://stackoverflow.com/comment/43643239
upvote count: 16
has body: Those are two different constructs that are doing two different things. In the first case, you are getting the method reference of a specific object: this needs to be done only once, after which the JVM has its own reference (so effectively final) to the object f and can call the handle method. In the second case, at each call the JVM has to resolve the f reference and it thus complains that f must be final. You could easily write code that sets f to null while the forEach is running and thus cause a NPE.
has comment: http://stackoverflow.com/comment/43643691
downvote count: 1
score: 15
has comment: http://stackoverflow.com/comment/43647616

http://stackoverflow.com/a/27515546
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27515347
has body: Set&lt;String&gt; s = new HashSet(); for(int i=0;i&lt;RateSheet.size;i++){ Rate rate = (Rate)RateSheet.get(i); s.add(rate.desName); } Set&lt;Rate&gt; rs = new HashSet(); for(int i=0;i&lt;RateSheet.size;i++){ Rate rate = (Rate) RateSheet.get(i); Iterator it = s.iterator(); while(it.hasNext()){ if(rate.desName.equals(it.next()){ rs.add(rate); } } }
downvote count: 0

http://stackoverflow.com/a/27548753
has body: Try that in your form: action="&lt;%= request.getContextPath()%&gt;/showIssue"
answers question: http://stackoverflow.com/q/27548562
type: Answer
score: 0

http://stackoverflow.com/comment/43463617
type: Comment
type: QuestionComment
has text: @MattCoubrough so if I understood correctly, I would have an interface of some sort that would have abstract methods like `getCursor()` or `changePanelCompStates(OptionPanel panel)` that could be implemented by ui state classes. How would I got about input listeners though? Would every one of those state classes have their own listeners that would be added to and removed from my panel whenever the state changes?
comment on: http://stackoverflow.com/q/27516478
score: 0

http://stackoverflow.com/comment/43508663
has text: I uninstalled everything completely including JDK. and I installed back Jdk and eclipse and tomcat and start configuring new.. At that time also i'm getting the same error. sometimes i deleted some registry key also.. But i couldn't find the proper solution'
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27539846
type: QuestionComment

http://stackoverflow.com/comment/43569058
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27571707
has text: @Joe I suggest sorting the files in reverse order of last modified and stop as soon as you get an acceptable file.
score: 0

http://stackoverflow.com/a/27632795
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has body: You misspelled default. Instead of: defalut charset=utf8" Your query should end with default charset=utf8"
type: Answer
accepted answer of: http://stackoverflow.com/q/27632722
has comment: http://stackoverflow.com/comment/43685577
answers question: http://stackoverflow.com/q/27632722
has comment: http://stackoverflow.com/comment/43685531

http://stackoverflow.com/q/27502137
linked to: http://stackoverflow.com/q/23897376
tagged with: java
tagged with: hibernate
tagged with: spring-data
type: Question
score: 2
has answer: http://stackoverflow.com/a/27583757
downvote count: 0
has body: I am currently using JpaSort with Spring Data commons 1.9.1 and Spring JPA 1.7.1. I need to use QueryDSL because JPA does not allow defining the sort for null values. This is my Repository public interface DatasheetRepository extends JpaRepository&lt;Datasheet, Long&gt;, JpaSpecificationExecutor&lt;Datasheet&gt; I am doing this in my Controller: Page&lt;Datasheet&gt; page = m_datasheetRepository.findAll( new PageRequest( pageNumber, pageSize, createSortForDatasheets() ) ); This is what I had with JPA: private Sort createSortForDatasheets() { // First sort on the component type name, then on the subtype name return new JpaSort( JpaSort.path( Datasheet_.componentSubtype ).dot( ComponentSubtype_.componentType ).dot( ComponentType_.name ) ) .and( new JpaSort( JpaSort.path( Datasheet_.componentSubtype ).dot( ComponentSubtype_.name ) ) ); } This is what I have changed it to for QueryDSL: private Sort createSortForDatasheets() { return new QSort( new OrderSpecifier&lt;&gt;( Order.ASC, QDatasheet.datasheet.componentSubtype.componentType.name,OrderSpecifier.NullHandling.NullsLast ) ) .and( new OrderSpecifier&lt;&gt;( Order.ASC, QDatasheet.datasheet.componentSubtype.name, OrderSpecifier.NullHandling.NullsLast ) ); } However, nothing seems to get sorted. I have enabled DEBUG logging and I see this: Rendered criteria query -&gt; select generatedAlias0 from Datasheet as generatedAlias0 order by generatedAlias0.name asc, generatedAlias0.name asc If I change it to: private Sort createSortForDatasheets() { return new QSort(QDatasheet.datasheet.name.desc()); } Then the sorting by the name of my "Datasheet" type in reverse order does work. This is my "Datasheet" entity: @Entity public class Datasheet { // ------------------------------ FIELDS ------------------------------ @Id @GeneratedValue private long id; @Column(unique = true) private String name; private String description; @ManyToOne private ComponentSubtype componentSubtype; @OneToMany(cascade = CascadeType.REMOVE) private Se…
tagged with: spring-data-jpa
tagged with: querydsl
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27583757
upvote count: 2
has comment: http://stackoverflow.com/comment/43591890
type: AnsweredQuestion
has title: QueryDSL sorting not working with Spring Data

mongodb
tags question: http://stackoverflow.com/q/27582568
tags question: http://stackoverflow.com/q/27476675
tags question: http://stackoverflow.com/q/27523149
tags question: http://stackoverflow.com/q/27500776
tags question: http://stackoverflow.com/q/27523751
tag name: mongodb
tags question: http://stackoverflow.com/q/27515656
tags question: http://stackoverflow.com/q/27609999
tags question: http://stackoverflow.com/q/27531153
tags question: http://stackoverflow.com/q/27545283
tags question: http://stackoverflow.com/q/27605362
type: Tag
tags question: http://stackoverflow.com/q/27518766
tags question: http://stackoverflow.com/q/27591685
tags question: http://stackoverflow.com/q/27606986
tags question: http://stackoverflow.com/q/27521797
tags question: http://stackoverflow.com/q/27529244
tags question: http://stackoverflow.com/q/27598245
tags question: http://stackoverflow.com/q/27522953
tags question: http://stackoverflow.com/q/27607773
tags question: http://stackoverflow.com/q/27583802
tags question: http://stackoverflow.com/q/27498459
tags question: http://stackoverflow.com/q/27510765
tags question: http://stackoverflow.com/q/27636130

http://stackoverflow.com/q/27501819
possible better answer: http://stackoverflow.com/a/57775773
answer count: 2
has title: How to add a client side pkcs12 certificate to Postman Chrome, W7 ?
has comment: http://stackoverflow.com/comment/93940623
tagged with: postman
has answer: http://stackoverflow.com/a/29830140
accepted answer: http://stackoverflow.com/a/29830140
favorite count: 0
tagged with: android
upvote count: 17
downvote count: 0
tagged with: google-chrome
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/57775773
has body: I try to test a 'strange' GET request where I have to provide a BASIC authentication and a client side certificate. I try to check it with Postman Chrome but I did not understand how to link the certificate from chrome personal certificate to my request. I saw this discussion : https://github.com/a85/POSTMan-Chrome-Extension/issues/482 but it is about MAC keystore and I can't transpose is to W7/Chrome. Here is my java code set up that should do the same job as postman to help you understand what I want postman to do. We use that post to write it InputStream is = context.getResources().getAssets().open("CertificateFile.p12"); KeyStore keyStore = KeyStore.getInstance("PKCS12"); BufferedInputStream bis = new BufferedInputStream(is); String password ="xxxxx"; keyStore.load(bis, password.toCharArray()); // password is the PKCS#12 password. If there is no password, just pass null // Init SSL Context KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509"); kmf.init(keyStore, password.toCharArray()); KeyManager[] keyManagers = kmf.getKeyManagers(); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, null, null); HttpsURLConnection urlConnection = null; String strURL = "theUrlITryToHit"; url = new URL(strURL); urlConnection = (HttpsURLConnection) url.openConnection(); if(urlConnection instanceof HttpsURLConnection) { ((HttpsURLConnection)urlConnection) .setSSLSocketFactory(sslContext.getSocketFactory()); } urlConnection.setRequestMethod("GET"); String basicAuth = "Basic " + Base64.encodeToString("pseudo:password".getBytes(), Base64.NO_WRAP); urlConnection.setRequestProperty ("Authorization", basicAuth);
tagged with: java
tagged with: ssl
score: 17
type: Question

http://stackoverflow.com/comment/43646559
type: Comment
type: AnswerComment
has text: Here's a dedicated question since that's already off-topic (and for more rep for great answers, of course): http://stackoverflow.com/questions/27612165/how-would-you-make-a-java-util-stream-collector-that-collects-to-com-google-comm
comment on: http://stackoverflow.com/a/27611973
score: 0

http://stackoverflow.com/q/27521504
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: sax
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/43472650
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43476733
type: Question
has comment: http://stackoverflow.com/comment/43472333
has body: I am using java sax parser and i override @Override public void characters(char ch[], int start, int length) throws SAXException { value = new String(ch, start, length); in some case array ch contains qName of element but not contains entire value. Example: ch = [... , x, s, d, :, n, a, m, e, >, 1, 2, 3] but the real value of xsd:name is 123456789 EDIT String responseString = Utils.getXml(url); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); handler = new SimpleHandler(); saxParser.parse(new InputSource(new StringReader(responseString)), handler); List<Entit> list = handler.getList(); I have xml like this (ofcourse the original xml is much bigger) <xsd:name>11111111</xsd:name> <xsd:name>22222222</xsd:name> <xsd:name>123456789</xsd:name> <xsd:name>333333333</xsd:name> i get error just for one value in xml. How to fix that.
has comment: http://stackoverflow.com/comment/43472787
has title: Java sax parser bug
has answer: http://stackoverflow.com/a/27521839
tagged with: saxparser
accepted answer: http://stackoverflow.com/a/27521839
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/43460908
type: QuestionComment
comment on: http://stackoverflow.com/q/27515020
type: Comment
has text: Then use a Mockito `Answer` in the mocks used by your threads, to set up some kind of state that you can check from your main thread.
score: 0

http://stackoverflow.com/q/27530514
has comment: http://stackoverflow.com/comment/43532104
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/43606778
score: 0
has body: I have a problem running a Trigger on my H2 Database. The Trigger should cover 2 cases (INSERT and UPDATE) on a table. The following 2 tables are involved in this process: Betellposition (bestellnr (PK), bestellposnr (PK), artikelnr (FK), menge, summe) and Artikel (artikelnr (PK), bezeichnung, preis, artikelgrnr (FK)) The Trigger should calculate the sum (Summe) out of amount (Menge) * price (Preis) if you are doing an INSERT or UPDATE (change the article (Artikel) or amount (Menge)) on Bestellposition. Here is the code for the Trigger: import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.h2.api.Trigger; public class TriggerBestellpositionSumme implements Trigger { @Override public void close() throws SQLException {} @Override public void fire(Connection con, Object[] oldRow, Object[] newRow) throws SQLException { int neueBestellnr = 0; int neueBestellposnr = 0; int neueArtikelnr = 0; neueBestellnr = (int) newRow[0]; neueBestellposnr = (int) newRow[1]; neueArtikelnr = (int) newRow[2]; PreparedStatement prep = con.prepareStatement ("update bestellposition set summe = menge * " + "(select artikel.preis from artikel where artikel.artikelnr = ?) " + "where bestellnr = ? and bestellposnr = ?"); prep.setInt(1, neueArtikelnr); prep.setInt(2, neueBestellnr); prep.setInt(3, neueBestellposnr); prep.execute(); } @Override public void init(Connection con, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException {} @Override public void remove() throws SQLException {} } The INSERT just works fine. There is only a problem with the UPDATE statement. The functionality in the fire()-method must be the same for INSERT or UPDATE. If I try to make an UPDATE on Bestellposition, it stops loading and i must terminate the application. After this, my database is destroyed. Maybe this is a bug or something. I can´t figure out the problem. I hope anyone could help me. Edit: I have noticed that the…
has comment: http://stackoverflow.com/comment/43518798
answer count: 0
type: UnansweredQuestion
tagged with: triggers
has comment: http://stackoverflow.com/comment/43537779
tagged with: java
tagged with: h2
has title: H2 Trigger crashes and destroy Database
tagged with: database

http://stackoverflow.com/comment/43419827
comment on: http://stackoverflow.com/q/27494014
type: Comment
type: QuestionComment
has text: Do you want to do it manually or want to use 3rd party library?
score: 2

http://stackoverflow.com/a/27603617
upvote count: 1
has comment: http://stackoverflow.com/comment/43629461
has comment: http://stackoverflow.com/comment/43629912
answers question: http://stackoverflow.com/q/27603521
downvote count: 0
has body: ROUND(X), ROUND(X,D) Rounds the argument X to D decimal places. The rounding algorithm depends on the data type > of X. D defaults to 0 if not specified. D can be negative to cause D digits left of the decimal point of the value X to become zero. see http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_round so 35418.8 with two places to the left of the decimal point is 35400 edit: Sorry to do this in java public class HelloWorld{ public static void main(String []args){ Double x=35418.18; int representation=(x.intValue()/100)*100; System.out.println(representation); } }
type: Answer
score: 1

http://stackoverflow.com/comment/43575118
type: Comment
comment on: http://stackoverflow.com/q/27572734
type: QuestionComment
score: 1
has text: @user3019104 sure, http://pastebin.com/b6cd3DrE

http://stackoverflow.com/comment/43601651
comment on: http://stackoverflow.com/q/27585534
type: QuestionComment
has text: Thanks. I've pasted the code.
score: 0
type: Comment

http://stackoverflow.com/comment/43596370
type: Comment
type: QuestionComment
has text: @jeff the need was real: the situation was roughly adding items to a shopping cart, each addition returned error info (certain combinations of items were not valid), but only the last addition's error info (when all items had been added and a fair assessment of the cart could be done) was the info needed. (Yes, the API we are using is broken and can not be fixed).
score: 1
comment on: http://stackoverflow.com/q/27547519

http://stackoverflow.com/comment/43464379
has text: @Alex It wouldn't really make sense as the `iterator` method would really need to create a new instance of the `Iterator` each time it was called, you'd end up basically acting as a proxy, but that would just become a nightmarish mess
comment on: http://stackoverflow.com/a/27516982
type: Comment
score: 1
type: AnswerComment

jakarta-mail
tags question: http://stackoverflow.com/q/27498183
tags question: http://stackoverflow.com/q/27498213
tags question: http://stackoverflow.com/q/27565495
tags question: http://stackoverflow.com/q/27553117
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/27633260
type: Tag
tags question: http://stackoverflow.com/q/27624047
tags question: http://stackoverflow.com/q/27526854
tags question: http://stackoverflow.com/q/27511985
tags question: http://stackoverflow.com/q/27609343
tags question: http://stackoverflow.com/q/27544097
tags question: http://stackoverflow.com/q/27578102
tags question: http://stackoverflow.com/q/27596860
tags question: http://stackoverflow.com/q/27475079

http://stackoverflow.com/q/27495028
type: AnsweredQuestion
downvote count: 0
tagged with: final
has answer: http://stackoverflow.com/a/27495080
has answer: http://stackoverflow.com/a/27495168
linked to: http://stackoverflow.com/q/685300
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27495167
score: 4
possible better answer: http://stackoverflow.com/a/27495168
tagged with: inheritance
favorite count: 0
has body: I have the following problem. I want one broad abstract type called MessageField. The run-time use of the MessageField is to carry around a String value; the rest of the type should be a bunch of constant definitions and behavior. Each subclass of MessageField should be a set of constant final members that define the type and, if necessary, can also override other behavioral methods. So for example: public abstract class MessageField { //whatever needs to go here to make this work //methods that define behavior //e.g. public int getFieldId() { return fieldId; } } public class TypeOne extends MessageField { public final int fieldId = 1; //type defining member public final String tag = "-&gt;"; //type-defining member public String fieldValue; //freely settable/gettable //change any behavior if necessary } public class TypeTwo extends MessageField { public final int fieldId = 2; public final String tag = "++"; public String fieldValue; } public class TypeThree extends MessageField { public final int fieldId = 3; public final String tag = "blah"; public String fieldValue; } Each subclass should be forced to define a value for fieldId and tag when it's written. I guess conceptually these are static final constants for each type, but how does that work with inheritance? I need all the various types to conform to one broad overarching type which can be passed around. Maybe inheritance isn't the best way to accomplish this pattern, but if not, what is? And if inheritance is the way to do this, how would it be done? Thanks!
answer count: 3
has title: Final constant values with inheritance in Java?
accepted answer: http://stackoverflow.com/a/27495080
upvote count: 4

http://stackoverflow.com/comment/43477556
score: 0
comment on: http://stackoverflow.com/q/27524357
type: Comment
type: QuestionComment
has text: I know, but it is a question I was asked during a job intreview to see if I know threads well enough...

http://stackoverflow.com/comment/43605983
type: Comment
has text: This error is due to @GeneratedValue(strategy=GenerationType.TABLE), you need to have table which Hibernate would use to manage the sequences of primary keys.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27590549

http://stackoverflow.com/a/27493331
score: 2
has comment: http://stackoverflow.com/comment/43418382
has comment: http://stackoverflow.com/comment/43418458
has comment: http://stackoverflow.com/comment/43496117
accepted answer of: http://stackoverflow.com/q/27492990
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43447444
has comment: http://stackoverflow.com/comment/43423059
has comment: http://stackoverflow.com/comment/43447321
type: Answer
has body: What you plotted is the Y component of the gradient. Consider this: g2.drawImage(sobelX, null, 0, 0); g2.drawImage(sobelY, null, 0, 0); sobelX is hidden behind sobelY, so you only see the latter. What you want is the norm of the gradient. You'll have to scan both images and calculate z = sqrt(x*x + y*y) for each pixel x of sobelX and its corresponding y of sobelY. Pseudocode: norm = image of the same size of sobelX and sobelY; for (int x = 0; x &lt; horizontal dimension of the image; ++x) { for (int y = 0; y &lt; vertical dimension of the image; ++y) { xPixel = sobelX.pixelAt(x,y); yPixel = sobelY.pixelAt(x,y); norm.pixelAt(x,y) = Math.hypot(xPixel, yPixel); } } return norm;
upvote count: 2
has comment: http://stackoverflow.com/comment/43421505
answers question: http://stackoverflow.com/q/27492990

http://stackoverflow.com/q/27519657
has comment: http://stackoverflow.com/comment/43468946
type: Question
score: 1
tagged with: java
has title: difference between creating java string with and without new operator
has comment: http://stackoverflow.com/comment/43469018
has answer: http://stackoverflow.com/a/27519722
has answer: http://stackoverflow.com/a/27519706
has answer: http://stackoverflow.com/a/27519702
has body: With new operator String create the string in heap and put a copy in string const pool so the result of hashcode is same in below case; String s1 = new String("Test"); String s2 = new String("Test"); System.out.println(s1.hashCode() + " "+ s2.hashCode() + " " + s1.equals(s2)); But without using new operator its still giving the same hashcode String s1 = new String("Test"); String s2 = "Test"; System.out.println(s1.hashCode() + " "+ s2.hashCode() + " " + s1.equals(s2)); Then what is the differnce between above two notation of string creation although they are referening to same string in string const. pool
favorite count: 0
has answer: http://stackoverflow.com/a/27519701
linked to: http://stackoverflow.com/q/6952581
duplicate of: http://stackoverflow.com/q/6952581
answer count: 4
linked to: http://stackoverflow.com/q/3052442
has comment: http://stackoverflow.com/comment/43468901
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15518418
downvote count: 2

http://stackoverflow.com/q/27602622
accepted answer: http://stackoverflow.com/a/27603834
has comment: http://stackoverflow.com/comment/43627844
has answer: http://stackoverflow.com/a/27602926
tagged with: replace
has comment: http://stackoverflow.com/comment/43627699
tagged with: jtable
type: AnsweredQuestion
tagged with: rowfilter
has title: JTable filter - replace foreign characters
has body: this code below works for filtering JTable until I use english alphabet. It is also not case-sensitive. My goal is to filter white spaces and foreign characters. I need to replace characters in needle and in haystack somehow, for example č,ľ,ť,ž,ý,á replace with c,l,t,z,y,a. Does anybody have experience or working code for my request? Thanks in advance. import javax.swing.RowFilter; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; public class Home extends javax.swing.JFrame { DefaultTableModel model; TableRowSorter sorter; public Home() { initComponents(); model = (DefaultTableModel) jTable1.getModel(); model.setRowCount(0); String data[] = {"šing","čamg","búng","wámg","fáng","raňk","moňk","púťk","šank","dung","puck","rig","an da da","ku nd ada","c ic inada"}; for(int i=0;i&lt;data.length;i++) { model.addRow(new Object[] { data[i] }); } sorter = new TableRowSorter&lt;TableModel&gt;(model); jTable1.setRowSorter(sorter); } private void initComponents() {///} private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) { String text = jTextField1.getText(); if(text.length() == 0) { sorter.setRowFilter(null); } else { sorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); } } public static void main(String args[]) {///} // Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; // End of variables declaration }
possible better answer: http://stackoverflow.com/a/27602793
has answer: http://stackoverflow.com/a/27603834
type: Question
has answer: http://stackoverflow.com/a/27602793
tagged with: swing
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43627944
answer count: 3

http://stackoverflow.com/comment/43677005
comment on: http://stackoverflow.com/a/27627592
type: AnswerComment
type: Comment
has text: still the same behavior, I click on the 3 dots and nothing happens
score: 0

http://stackoverflow.com/comment/43972713
score: 0
comment on: http://stackoverflow.com/q/27606778
type: Comment
type: QuestionComment
has text: Thank you for your link, I'm talking about annotations annotated as `@Target(ElementType.TYPE_PARAMETER)` or `@Target(ElementType.TYPE_USE)`. They're not passed to annotation processor's `process` method.

http://stackoverflow.com/a/27628895
has body: It's a valid regular expression pattern, but \s is not a valid String literal escape sequence. Escape the \. String str2 = str.replace("\\s+", " "); As suggested, String#replace(CharSequence, CharSequence) doesn't consider the arguments you provide as regular expressions. So even if you got the program to compile, it wouldn't do what you seem to want it to do. Check out String#replaceAll(String, String).
type: Answer
answers question: http://stackoverflow.com/q/27628884
score: 4
has comment: http://stackoverflow.com/comment/43678470
upvote count: 4
downvote count: 0

intellij-idea
tags question: http://stackoverflow.com/q/27517786
tags question: http://stackoverflow.com/q/27613679
tags question: http://stackoverflow.com/q/27619720
tags question: http://stackoverflow.com/q/27578348
tags question: http://stackoverflow.com/q/27570974
tags question: http://stackoverflow.com/q/27618325
tags question: http://stackoverflow.com/q/27613577
tags question: http://stackoverflow.com/q/27588448
tags question: http://stackoverflow.com/q/27635129
tags question: http://stackoverflow.com/q/27582337
tags question: http://stackoverflow.com/q/27623326
type: Tag
tags question: http://stackoverflow.com/q/27588677
tags question: http://stackoverflow.com/q/27585320
tags question: http://stackoverflow.com/q/27603348
tag name: intellij-idea
tags question: http://stackoverflow.com/q/27614682
tags question: http://stackoverflow.com/q/27483207
tags question: http://stackoverflow.com/q/27518111
tags question: http://stackoverflow.com/q/27586785
tags question: http://stackoverflow.com/q/27499132
tags question: http://stackoverflow.com/q/27496565
tags question: http://stackoverflow.com/q/27521069
tags question: http://stackoverflow.com/q/27607025
tags question: http://stackoverflow.com/q/27505141
tags question: http://stackoverflow.com/q/27605490
tags question: http://stackoverflow.com/q/27542216
tags question: http://stackoverflow.com/q/27581310
tags question: http://stackoverflow.com/q/27575974
tags question: http://stackoverflow.com/q/27605277
tags question: http://stackoverflow.com/q/27488943
tags question: http://stackoverflow.com/q/27536240
tags question: http://stackoverflow.com/q/27607367
tags question: http://stackoverflow.com/q/27561391
tags question: http://stackoverflow.com/q/27537256

http://stackoverflow.com/a/27520356
answers question: http://stackoverflow.com/q/27520288
type: Answer
has body: Reason for the error is that you have following constructor for transaction class: public Transaction() {} public Transaction( String transactionType, int transactionDate, double transactionAmount) And you are passing 4 argument which doesnt match any of these. Instead try: Transaction transaction = new Transaction("Deposit", 0, depositAmount); As bankAccount has currentBalance details, you dont need to pass those. Also there is no need to pass the size of transaction in your case as i dont see any purpose in your code.
score: 0

http://stackoverflow.com/a/27605870
has body: In Java as many programming language, the count begins with 0, so an array of length 3, when the computer begins to count is : 0,1,2 and not 1,2,3. The general rules is: Array Length - 1. As you are working with arrays use the attribute length for check it , it is more secure.
answers question: http://stackoverflow.com/q/27605613
score: 0
type: Answer

http://stackoverflow.com/comment/43440735
score: 0
has text: you can use `goto` though its deprecated but might be help ful to you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27505269

http://stackoverflow.com/comment/53597896
score: 0
has text: Although you can do it (like @CommuSoft stated in his anwer) you should avoid such constructs, as they create code that is harder to understand. For simple checks the abbreviated if is fine, for anything more complex you should use if...else if...else. Memory is not a restricting factor and anyone who will work with your code in the future will be thankful to not have to handle with loooong oneliner if constructions.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27604724

http://stackoverflow.com/q/27543060
upvote count: 3
has body: Recently I ported the HVDF project's dropwizard version from 0.6.2 to 0.8.2.Once I try to run the application I get the following error.I provide the config class and yml file below: Config class: package com.mongodb.hvdf; import io.dropwizard.Configuration; import java.util.LinkedHashMap; import java.util.Map; import com.mongodb.hvdf.configuration.MongoGeneralConfiguration; public class HVDFConfiguration extends Configuration { public MongoGeneralConfiguration mongodb = new MongoGeneralConfiguration(); public Map&lt;String, Object&gt; services = new LinkedHashMap&lt;String, Object&gt;(); } Yaml file: server: applicationConnectors: - type: http port: 8080 I get the following error at runtime: config.yml has an error: * Failed to parse configuration at: server.applicationConnectors.[0]; Could not resolve type id 'http' into a subtype of [simple type, class io.dropwizard.jetty.ConnectorFactory] at [Source: N/A; line: -1, column: -1] (through reference chain: com.mongodb.hvdf.HVDFConfiguration["server"]-&gt;io.dropwizard.server.DefaultServerFactory["applicationConnectors"]-&gt;java.util.ArrayList[0])
has comment: http://stackoverflow.com/comment/43567439
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/29250737
downvote count: 0
possible better answer: http://stackoverflow.com/a/27774996
has answer: http://stackoverflow.com/a/27774996
favorite count: 0
tagged with: dropwizard
tagged with: yaml
has title: Why does dropwizard configuration is not working?
accepted answer: http://stackoverflow.com/a/29250737

http://stackoverflow.com/a/27567724
has comment: http://stackoverflow.com/comment/43561774
has body: What is executed is the main method of your class, so, putting the calls to SayMyName outside it does not make the desired effect. You need to put the call to your method inside the main method. Also, the SayMyName has to be static in order for it to be called from the main. You might want to see this (about static methods in java) just like this: package apollo.exercises.ch03_methods; public class Ex2_SayMyName { public static void main(String[] args) { String name1 = "Billy"; String name2 = "Jake"; String name3 = "Michael"; SayMyName(name1); SayMyName(name2); SayMyName(name3); } public static void SayMyName(String name){ System.out.println("Hello " + name + ", it's good to meet you!"); }
has comment: http://stackoverflow.com/comment/43561616
score: 0
has comment: http://stackoverflow.com/comment/43562214
type: Answer
has comment: http://stackoverflow.com/comment/43560507
answers question: http://stackoverflow.com/q/27567697

http://stackoverflow.com/a/27615845
has comment: http://stackoverflow.com/comment/43698994
has comment: http://stackoverflow.com/comment/43725665
score: 0
has body: Three things that you are missing in your code: Firstly, in your code you are looking for only first element in your list. Secondly, in getAttribute you are passing link instead of href: if(eachResult.getAttribute(getSiteName).equals(getSiteName)){ it should be: if(eachResult.getAttribute("href").equals(getSiteName)){ Thirdly, on clicking next the page is loaded via Google Ajax Api. Thus webdriver click will never block the execution of your code and will load linkElements with previous page links only. To avoid this let the driver get refreshed or put some wait for certain condition in your code. Can u try out with this code: WebDriverWait wait = new WebDriverWait(driver, 10) while (!flag) { // get all the search results linkElements = wait .until(ExpectedConditions .presenceOfAllElementsLocatedBy(By .xpath("//h3[@class='r']/a"))); for (WebElement eachResult : linkElements) { if (eachResult.getAttribute("href").contains(getSiteName)) { eachResult.click(); flag = true; break; } } if (!flag) { driver.findElement(By.xpath("//a[@id='pnnext']/span[1]")) .click(); pageNumber++; linkElements.clear(); // celean list wait.until(ExpectedConditions .textToBePresentInElementLocated( By.xpath("//td[@class='cur']"), pageNumber + "")); // Checking whether page number is changed as expected. } }// end while loop EDIT: List&lt;WebElement&gt; linkElements = new ArrayList&lt;WebElement&gt;(); ListIterator&lt;WebElement&gt; itr = null; System.setProperty("webdriver.chrome.driver", "webdrivers/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); // Maximize window driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); driver.get("http://google.com"); WebElement element1 = driver.findElement(By.name("q")); WebElement toClick = null; element1.sendKeys(getText); element1.submit(); // try{ int pageNumber = 1; WebDriverWait wait = new WebDriverWait(driver, 10); boolean flag = false; while (!flag) { linkElements = wait.until(ExpectedCondit…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43725643
has comment: http://stackoverflow.com/comment/43709791
accepted answer of: http://stackoverflow.com/q/27603446
answers question: http://stackoverflow.com/q/27603446
has comment: http://stackoverflow.com/comment/43697701
type: Answer
has comment: http://stackoverflow.com/comment/43694760
has comment: http://stackoverflow.com/comment/43712673
has comment: http://stackoverflow.com/comment/43725311
has comment: http://stackoverflow.com/comment/43723672

http://stackoverflow.com/comment/43483334
type: Comment
has text: I think it is interesting question, i never heard about anyone use return in finally block at all. Personally i want consider this as bug, more as bad practice. Other thing is, as i remember finally block is not always executed, if i remeber if you call `System.exit` it want be executed
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27527265

http://stackoverflow.com/a/27491700
answers question: http://stackoverflow.com/q/27488949
type: Answer
upvote count: 1
has body: I found the solution, I just added single quotes around my property bean in my jsp : &lt;td class="details-control" data-agencies='&lt;bean:write name="rrag" property="agencies" /&gt;'&gt;&lt;/td&gt;
score: 1
downvote count: 0

http://stackoverflow.com/comment/43680583
score: 0
type: AnswerComment
has text: @FurkanAktaş you can always upvote if you find the answer useful :)
type: Comment
comment on: http://stackoverflow.com/a/27629913

http://stackoverflow.com/q/27636806
accepted answer: http://stackoverflow.com/a/27636915
tagged with: nashorn
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
tagged with: reactjs
tagged with: javascript
has title: Using React with Nashorn throws "ReferenceError: "console" is not defined"
answer count: 1
favorite count: 0
has body: Im using "react": "~0.12.2" And the following code: @RequestMapping("/") @ResponseBody private String home() throws ScriptException, IOException { loadReact(); InputStream jsStream = resourceLoader.getResource("classpath:public/js/server.js").getInputStream(); engine.eval(new InputStreamReader(jsStream)); return engine.eval("renderServerside()").toString(); } private void loadReact() throws ScriptException, IOException { InputStream jsStream = resourceLoader.getResource("classpath:public/lib/react/react.js").getInputStream(); // React expects 'window' or 'global' to be set engine.eval("var global = this"); engine.eval(new InputStreamReader(jsStream)); } My server.js looks like this: function renderServerside() { var MyComponent = React.createClass({ render: function () { return React.DOM.h1(null, 'Hi, ' + this.props.msg) } }); return React.renderComponentToString(MyComponent({msg: 'World!'})); } And getting this exception: javax.script.ScriptException: ReferenceError: "console" is not defined in &lt;eval&gt; at line number 18108] with root cause jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined So how can nashorn not provide a console? I tired to implement the basic example from this page: React with Nashorn
has answer: http://stackoverflow.com/a/27636915

http://stackoverflow.com/q/27509969
linked to: http://stackoverflow.com/q/17506428
has comment: http://stackoverflow.com/comment/43452631
tagged with: java
has comment: http://stackoverflow.com/comment/43516760
type: Question
tagged with: base64
accepted answer: http://stackoverflow.com/a/27562861
score: 0
has comment: http://stackoverflow.com/comment/43450247
answer count: 1
has title: Save Base64 decoed image on file system
has body: I am getting my image as base 64 decoded string in my spring mvc application. e.g. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABUUAAAkFCAYAAAD3GsjUAAAgAElEQVR4nOy9eXSb932vqc50fJs2Z+6ZOefeO2dmbm/aSW9ve+MmrZv2Nmmm7TROs7q2Yzl2HNWxtmihZNmSLMd24t= I am trying save it as a png image: byte[] imageByte = Base64.decodeBase64(base64encodedImage); String directory = "D:\\Image Capture\\sample.png"; FileOutputStream outputStream = new FileOutputStream(directory); outputStream.write(imageByte); outputStream.flush(); outputStream.close(); but it is saving my image as I am not able to figure out the reason. This encoded image is obtained using canvas.toDataUrl in javascript. It opens in browser tab perfectly.
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27562861

http://stackoverflow.com/comment/43429855
has text: Try now - I'd put the charset on the wrong object when converting your code, sorry
type: Comment
comment on: http://stackoverflow.com/a/27498347
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43596426
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27585977
type: Comment
has text: I switched to INTERNAL_CONTENT_URI as you mentioned but it has exactly the same behaviour..

http://stackoverflow.com/a/27616222
answers question: http://stackoverflow.com/q/27615889
has body: The problem is with your maven-compiler-plugin configuration. As the error message states the compiler plugin does not have an exec goal (Could not find goal 'exec' in plugin org.apache.maven.plugins:maven-compiler-plugin). It only has two goals available and these are: compile testCompile Also I'm not sure what you expect the compiler plugin to do with the variables configuration. It doesn't know about variables so will ignore it. Change your compiler-plugin configuration to be as follows: org.apache.maven.plugins maven-compiler-plugin 2.3.2 compile But actually this is the default configuration so you can simplify it even further to just be: org.apache.maven.plugins maven-compiler-plugin 2.3.2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43656043
upvote count: 1
has comment: http://stackoverflow.com/comment/43656068
score: 1

http://stackoverflow.com/comment/65885607
type: Comment
has text: Is there any reason for they hadn't make an overload that allows the developer to choose the thrown exception?
comment on: http://stackoverflow.com/a/27511204
score: 0
type: AnswerComment

http://stackoverflow.com/q/27502758
has title: Using findBy in transactional context
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: grails-orm
has body: Given: controller PersonController with a @Transactional action save service PersonService with a method populateProperties(PersonInstance) being called from the controller action I'd like to populate personInstance properties based on some data already persisted in the database, like this: def personLookupData = PersonLookupData.findByUsername(personInstance.username) personInstance.firstName = personLookupData.firstName The findByUsername method flushes the hibernate session and in order to avoid it (because it has been giving me problems described here), I do this: def personLookupData = PersonLookupData.withNewSession { PersonLookupData.findByUsername(personInstance.username) } personInstance.firstName = personLookupData.firstName This does what I want (lets me use findBy without flushing the session), and this is fine when there is only a couple of findBys to use, but given a deeper call stack (in terms of services) and more database lookups in different places, using withNewSession everywhere becomes a bit ugly. Apart from making a PersonLookupService which will collect all the required data in one withNewTransaction block and return it, is there any other nice (groovy) way of doing this?
score: 2
tagged with: transactions
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/27309229
type: Question
tagged with: grails
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27505467

http://stackoverflow.com/q/27590183
upvote count: 3
tagged with: final
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27590201
answer count: 2
has title: private static field that is not final?
has answer: http://stackoverflow.com/a/27590203
favorite count: 0
accepted answer: http://stackoverflow.com/a/27590203
tagged with: static
has body: Can someone give me an example of when you'd use a private static field over a private static final field? I struggle to think of an example of when you'd want to declare a private class variable, that was subject to change.
possible better answer: http://stackoverflow.com/a/27590201
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/27640891
has comment: http://stackoverflow.com/comment/43703133
has comment: http://stackoverflow.com/comment/43702837
score: 0
has comment: http://stackoverflow.com/comment/43703113
type: Answer
has comment: http://stackoverflow.com/comment/43703004
has comment: http://stackoverflow.com/comment/43702925
has comment: http://stackoverflow.com/comment/43702981
has comment: http://stackoverflow.com/comment/43703029
has comment: http://stackoverflow.com/comment/43702890
has body: Move your timer code and your action listener into the constructor: //constructor public TheGame() throws IOException { super("Simple Drawing"); setSize(x_width, y_height); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); jp = new DrawingPanel(); add(jp); addMouseListener(this); // Timer class initiazation--animating the ball ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { update(); repaint(); } }; Timer t = new Timer(50,action); } Try calling this method from the restart buttons onclick listener: retry.addMouseListener( new MouseListener(){ @Override public void mouseClicked(MouseEvent e) { restartApplication(); } //------------------------------------------------------------------------------ public void restartApplication() { final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; final File currentJar = new File(TheGame.class.getProtectionDomain().getCodeSource().getLocation().toURI()); /* is it a jar file? */ if(!currentJar.getName().endsWith(".jar")) return; /* Build command: java -jar application.jar */ final ArrayList&lt;String&gt; command = new ArrayList&lt;String&gt;(); command.add(javaBin); command.add("-jar"); command.add(currentJar.getPath()); final ProcessBuilder builder = new ProcessBuilder(command); builder.start(); System.exit(0); }
has comment: http://stackoverflow.com/comment/43703059
has comment: http://stackoverflow.com/comment/43702953
has comment: http://stackoverflow.com/comment/43700888
answers question: http://stackoverflow.com/q/27579627

http://stackoverflow.com/comment/43624221
comment on: http://stackoverflow.com/q/27600812
has text: Do you need to take each entry into hash map everytime?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43626932
comment on: http://stackoverflow.com/q/27602234
score: 0
type: QuestionComment
type: Comment
has text: You need to set the appcompat_v7's target sdk to the highest version.

http://stackoverflow.com/a/27603840
answers question: http://stackoverflow.com/q/27603789
type: Answer
upvote count: 1
downvote count: 0
has body: In my experience StringTokenizer performs better than calling split. After that I convert the tokens into ints the same way you do. I think this is the best performing method to input a series of many integers printed on a single line. Here is a thread where different approaches are discussed and measured. Also I would like to point out that this is the approach used by most programming competitors such as the legend Petr Mitrichev, thus I believe it is as good as you can get.
score: 1

http://stackoverflow.com/comment/43633962
comment on: http://stackoverflow.com/q/27601744
has text: although, it's off-topic here, but I can assure you, that switching to Grails brings you way beyond just simplifying your XML config :) hell, even incorporating only groovy (or any other dynamic JVM lang) into your project boosts your productivity a lot
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43551547
type: Comment
has text: Lesson, Senses, Games, Intro About Myself, Worksheet, Five senses, Sense of touch, in this string that last "uch" not printing.
comment on: http://stackoverflow.com/a/27561734
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43667485
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27623134
has text: Thank you. How is Java versioning managed, through the IDE?
score: 0

http://stackoverflow.com/a/58088070
answers question: http://stackoverflow.com/q/27577922
has body: I know this is old, but if anyone else wants to know why they get incomplete json like above is because the ampersand &amp; is a special character in URLs used to separate parameters. In your data there is an ampersand in R&amp;R. So the acc parameter ends when it reaches the ampersand character. That's why you are getting chopped data. The solution is either url encode the data or send as POST like the accepted solution suggests.
type: Answer
score: 6
upvote count: 6
downvote count: 0

http://stackoverflow.com/q/27560449
tagged with: java
has answer: http://stackoverflow.com/a/43625057
accepted answer: http://stackoverflow.com/a/27560505
has comment: http://stackoverflow.com/comment/43547048
possible better answer: http://stackoverflow.com/a/43625057
has comment: http://stackoverflow.com/comment/43547015
tagged with: nullpointerexception
type: Question
type: AnsweredQuestion
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/27560505
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43546969
downvote count: 1
has title: Android Null Pointer Exception for onclick listener
has comment: http://stackoverflow.com/comment/43546954
has body: The following code is giving me null pointer exception even though I can't find anything wrong with the code. Tried commenting it out and it seems to be working. But still not able to find out what is wrong with the code? tried my own trouble shooting of commenting out the code and such and right now the code below is giving me nullpointer exception Log Cat 12-19 05:49:14.833: E/AndroidRuntime(3392): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference 12-19 05:49:14.833: E/AndroidRuntime(3392): at com.techiequickie.bharath.boadraf.newBet_activity.onCreate(newBet_activity.java:80) Code: package com.techiequickie.bhr.boadraf; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.SeekBar; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; import databasehandler.DatabaseHandler; import databasehandler.UserFunctions; /** * Created by YP on 17-Nov-14. */ public class newBet_activity extends ActionBarActivity { EditText inputBetname, inputBetbrief, inputBetdescription; SeekBar valueSeekbar; //= null; Button placeBet; // JSON Response node names private static String KEY_SUCCESS = "success"; @SuppressWarnings("unused") private static String KEY_ERROR = "error"; @SuppressWarnings("unused") private static String KEY_ERROR_MSG = "error_msg"; //private static String KEY_UID = "uid"; private static String KEY_BETNAME = "bet_name"; private static String KEY_BETBRIEF = "bet_brief"; private static String KEY_BETDESCRIPTION = "bet_description"; private static String KEY_BETVALUE = "bet_value"; // private static String KEY_CREATED_AT = "created_at"; @Override protected void onCreate(Bundle savedInsta…
score: 0

http://stackoverflow.com/comment/43639862
score: 1
type: QuestionComment
has text: System.out.println is printing the string onto the commandline, if you didn't start your program from the commandline, you probably will not see the output.
comment on: http://stackoverflow.com/q/27608738
type: Comment

http://stackoverflow.com/comment/43436922
comment on: http://stackoverflow.com/a/27502228
has text: Yes indeed, you (@Bruno Lowagie) solved it very very quickly! I think! need to point this answer to the other [questions](http://stackoverflow.com/questions/1625455/itext-positioning-text-absolutely) as well.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27634725
accepted answer of: http://stackoverflow.com/q/27627498
type: AcceptedAnswer
downvote count: 0
has body: Oh my godness I got it. Thank you for all your help guys! The problem was that I had a RelativeLayout which was overlapping the toolbar but I did not see this directly. THe solution was to add android:layout_below="@+id/toolbar" to the relativ layout and now everything works fine. Again thanks for all your help guys and sorry!
answers question: http://stackoverflow.com/q/27627498
type: Answer
upvote count: 6
score: 6

http://stackoverflow.com/comment/43473182
comment on: http://stackoverflow.com/q/27521776
has text: @andresoviedo what do you mean?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43676525
score: 0
has text: I wasn't sure that codereview was the appropriate place for this post, because I am more interested in completely novel algorithms for this problem than in reworkings of the existing code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27627570

http://stackoverflow.com/comment/43547031
comment on: http://stackoverflow.com/a/27559856
type: AnswerComment
has text: Enumeration Keys = properties.keys(); , can i store Keys in a String Array so that i can sort it at this stage .
score: 0
type: Comment

http://stackoverflow.com/a/27628593
answers question: http://stackoverflow.com/q/27628202
accepted answer of: http://stackoverflow.com/q/27628202
type: Answer
has comment: http://stackoverflow.com/comment/43678837
score: 1
upvote count: 1
has body: You can get the referrer on your server side from the http request header, which is not visible to the user. This could identify visitors coming from youtube or facebook. To solve your problem of converting the hash to a alphanumeric string, you could convert the resulting bytes to hex code. final String result = DatatypeConverter.printHexBinary(checkSumBytes);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43538280
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27553697
type: Comment
has text: I'm sorry we can't solve this together ! Thanks for the upvote ! I'm going through the same kind of problems (Mac vs Windows) with one of my JavaFX project...

http://stackoverflow.com/comment/109057379
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27535909
has text: it is avaibable for me, you can try it again then check the generated jar whether it takes effect. com.google shade.com.google
score: 0

http://stackoverflow.com/comment/43656548
comment on: http://stackoverflow.com/q/27617259
has text: Yes, if I try only with the FMX4 or TIFF expressions it's ok.
score: 0
type: QuestionComment
type: Comment

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/27588226
tags question: http://stackoverflow.com/q/27585913
type: Tag
tags question: http://stackoverflow.com/q/27577772
tags question: http://stackoverflow.com/q/27523861

http://stackoverflow.com/comment/43532111
type: QuestionComment
has text: For rewritten question answer is "no". You can't expect strict evaluation to be translated to lazy evaluation if side effects are not known.
score: 0
comment on: http://stackoverflow.com/q/27551904
type: Comment

ftp
tags question: http://stackoverflow.com/q/27593685
type: Tag
tag name: ftp
tags question: http://stackoverflow.com/q/27511782
tags question: http://stackoverflow.com/q/27498475

http://stackoverflow.com/comment/43657398
has text: @aioobe as you are right about name, i disagree about must-be-a static thing or part of parent class
type: AnswerComment
comment on: http://stackoverflow.com/a/27618162
type: Comment
score: 0

http://stackoverflow.com/comment/43454752
comment on: http://stackoverflow.com/q/27512221
score: 2
has text: Are you getting an error or is it just not working? Please provide more information.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27514235
tagged with: java
has answer: http://stackoverflow.com/a/27514414
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27514414
score: 0
has comment: http://stackoverflow.com/comment/43459209
has body: I know java basics but, I don't know what I'm suppose to do here: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.action_search: openSearch(); return true; case R.id.action_settings: openSettings(); return true; default: return super.onOptionsItemSelected(item); } } I want to display strings when I press on the actionbar buttons, so what am I going to have to do? Do I have to create the methods openSearch and openSettings? If so, what am I suppose to put inside them??
tagged with: android
possible better answer: http://stackoverflow.com/a/27514401
has title: How to set actions for actionbar buttons?
has answer: http://stackoverflow.com/a/27514401
has comment: http://stackoverflow.com/comment/43458937
type: AnsweredQuestion

gxt
tags question: http://stackoverflow.com/q/27630564
tags question: http://stackoverflow.com/q/27609167
tag name: gxt
type: Tag
tags question: http://stackoverflow.com/q/27610366
tags question: http://stackoverflow.com/q/27551276
tags question: http://stackoverflow.com/q/27618638
tags question: http://stackoverflow.com/q/27638443

http://stackoverflow.com/comment/61913806
type: Comment
comment on: http://stackoverflow.com/a/27522819
score: 1
type: AnswerComment
has text: Note that the IntStream approach has slightly different semantics than using asList; changes to the underlying array are not reflected in the resulting list. (so there is a copy of some sort going on). asList(T...) does no copying. I don't know of any way around that, unfortunately.

http://stackoverflow.com/a/32898280
has body: I had this same problem, I right-clicked on the server on the console from Eclipse, clicked on its properties, and deleted the /domain/domain1 from the Domain path, making the path end with /glassfish and then I ran the server again and it worked. When I checked the domain path again, it had generated the /domain/domain1 part of itself again, but the server kept running afterwards.
type: Answer
answers question: http://stackoverflow.com/q/27634750
score: 0

http://stackoverflow.com/a/27603648
has body: I tried the following simple unit test, which passes successfully: @Test public void coalesceTest() { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("PersistenceUnit"); EntityManager entityManager = entityManagerFactory.createEntityManager(); EntityTransaction transaction = entityManager.getTransaction(); DepartmentEmployee employee = new DepartmentEmployee(); EmployeeDepartment department = new EmployeeDepartment(); department.getEmployees().add(employee); employee.setDepartment(department); transaction.begin(); try { entityManager.persist(employee); entityManager.persist(department); transaction.commit(); Assert.assertTrue("Employee not persisted", employee.getId() > 0); Assert.assertTrue("Department not persisted", department.getId() > 0); } catch (Exception x) { if(transaction.isActive()) { transaction.rollback(); } Assert.fail("Failed to persist: " + x.getMessage()); } TypedQuery<String> query = entityManager.createQuery("select coalesce(e.name, 'No Name') from EmployeeDepartment d join d.employees e", String.class); String employeeName = query.getSingleResult(); Assert.assertEquals("Unexpected query result", "No Name", employeeName); } DepartmentEmployee class: @Entity public class DepartmentEmployee implements Serializable { @Id @GeneratedValue private int id; private String name; @ManyToOne private EmployeeDepartment department; public int getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public EmployeeDepartment getDepartment() { return department; } public void setDepartment(EmployeeDepartment department) { this.department = department; } } EmployeeDepartment class: @Entity public class EmployeeDepartment implements Serializable { @Id @GeneratedValue private int id; @OneToMany private List<DepartmentEmployee> employees; public EmployeeDepartment() { employees = new ArrayList<DepartmentEmployee>(); } public int getId() { return id; } public List<Departm…
score: 0
answers question: http://stackoverflow.com/q/27528976
has comment: http://stackoverflow.com/comment/43639893
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43658397

http://stackoverflow.com/q/27610012
tagged with: performance
tagged with: large-files
has comment: http://stackoverflow.com/comment/43643170
tagged with: java
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/43643145
type: UnansweredQuestion
has body: Although aware that there are plenty of offered solutions to my problem in general, I am still not satisfied with the runtime they require in my special case. Consider a 35G large text file in FASTA format, like this: >Protein_1 So nice and cute little fella MTTKKCLQKFHLESLGKLGDSFLKYAISIQLFKSYENHYEGLPSIKKNKIISNAALFKLG YARKILRFIRNEPFDLKVGLIPSDNSQAYNFGKEFLMPSVKMCSRVK* >Protein_2 Fancy incredible description of its function MADDSKFCFFLVSTFLLLAVVVNVTLAANYVPGDDILLNCGGPDNLPDADGRKWGTDIGS […] etc. I need to extract the &gt; lines only. Using grep '&gt;' proteins.fasta &gt; protein_descriptions.txt to achieve this takes only a couple of minutes. But using Java 7 this is now already running for over 90 minutes: public static void main(String[] args) throws Exception { BufferedReader fastaIn = new BufferedReader(new FileReader(args[0])); List&lt;String&gt; l = new ArrayList&lt;String&gt;(); String str; while ((str = fastaIn.readLine()) != null) { if (str.startsWith("&gt;")) { l.append(str); } } fastaIn.close(); // … } Does anyone have an idea of how to speed this up to grep performance? Your help will be much appreciated. Cheers!
has comment: http://stackoverflow.com/comment/43642358
has answer: http://stackoverflow.com/a/27610140
has comment: http://stackoverflow.com/comment/43642778
has title: Java: How to extract matching lines from a large text file fast?
downvote count: 0
has comment: http://stackoverflow.com/comment/43644403
score: 1
favorite count: 0
tagged with: text-files
tagged with: fasta
type: Question
has answer: http://stackoverflow.com/a/27610531
has answer: http://stackoverflow.com/a/27610192

quartz-scheduler
tags question: http://stackoverflow.com/q/27481509
type: Tag
tags question: http://stackoverflow.com/q/27480324
tags question: http://stackoverflow.com/q/27605506
tags question: http://stackoverflow.com/q/27563340
tags question: http://stackoverflow.com/q/27545411
tags question: http://stackoverflow.com/q/27589086
tags question: http://stackoverflow.com/q/27593730
tag name: quartz-scheduler
tags question: http://stackoverflow.com/q/27546965

http://stackoverflow.com/comment/43677565
type: Comment
type: QuestionComment
has text: Probably because it has to compile, initialize the JVM multiple times, etc.
score: 2
comment on: http://stackoverflow.com/q/27628373

http://stackoverflow.com/q/27635637
tagged with: java
score: 6
type: Question
has answer: http://stackoverflow.com/a/27635664
has answer: http://stackoverflow.com/a/27635893
upvote count: 6
tagged with: runtimemodification
has answer: http://stackoverflow.com/a/27635745
has answer: http://stackoverflow.com/a/27635704
tagged with: class
tagged with: arraylist
has answer: http://stackoverflow.com/a/27646377
accepted answer: http://stackoverflow.com/a/27646377
has body: I use an ArrayList in one of my Java project's classes. The class keeps track of whether the list has been changed and offers public methods to add and remove elements from the list that automatically set the variable to "changed". So far the list is public because I want my list to be publicly readable from everywhere. But I only want the class that owns the list to be able to modify it. So no modifications from outside classes. Is that possible? If so, how? Usually for access control you'd probably use getter and setter methods. But even with a getter method and the list set to private another class could still do getList().remove(element) and thereby modify the list from the outside without the class noticing that the list was changed.
has comment: http://stackoverflow.com/comment/43690455
favorite count: 0
has title: Java: No ArrayList modifications from outside classes
answer count: 5
possible better answer: http://stackoverflow.com/a/27635704
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/43619918
type: AnswerComment
has text: have a normal jar artifact, which serves for normal dependency. Uber jar can be created with separate classifier, so not to mix up with the main artifact. http://maven.apache.org/plugins/maven-shade-plugin/examples/attached-artifact.html
type: Comment
comment on: http://stackoverflow.com/a/27595673
score: 0

http://stackoverflow.com/q/27551276
tagged with: gridview
score: 1
tagged with: java
tagged with: gxt
accepted answer: http://stackoverflow.com/a/27559046
upvote count: 1
has title: Add (hover) listener for grid cell after grid first attach
tagged with: grid
type: Question
has comment: http://stackoverflow.com/comment/43529535
has body: I have something like this. Grid&lt;Stock&gt; mygrid = new Grid&lt;Stock&gt;(store, cm) { @Override protected void onAfterFirstAttach() { super.onAfterFirstAttach(); //here do the binding for the cell elements that have myclass } }; And for the view of mygrid I have this view.setViewConfig(new GridViewConfig&lt;Stock&gt;() { @Override public String getRowStyle(Stock model, int rowIndex) { return ""; } @Override public String getColStyle(Stock model, ValueProvider&lt;? super Stock, ?&gt; valueProvider, int rowIndex, int colIndex) { String style = ""; if(SOME_CASE) { style = "myclass"; } return style; } }); What I want to do is onAfterFirstAttach I want to add some listener/handler that during hover will do something, let's say for the sake of simplicity, give an alert. Is what I'm trying to do possible? Can I accomplish what I want without using JSNI or a library like gwtquery? Is it sure that onAfterFirstAttach all the cells that should have the class myclass will be available and accessible? If yes how can I attach the listener/handler that I want? The questions seem a lot, but I believe they are all interconnected. I'm using GWT 2.6 with GXT 3.1 on top of it. Update I forgot to mention that a feasible solution would be to add a listener for the mouse move on the whole grid, and then get each cell and check if it has the required class, but this seems such an overkill. There must be a simpler way.
tagged with: gwt
has comment: http://stackoverflow.com/comment/43534053
has comment: http://stackoverflow.com/comment/43529576
has comment: http://stackoverflow.com/comment/43534277
has comment: http://stackoverflow.com/comment/43528940
has comment: http://stackoverflow.com/comment/43529462
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27559046
favorite count: 0
has comment: http://stackoverflow.com/comment/43529034
has comment: http://stackoverflow.com/comment/43529573
type: AnsweredQuestion

http://stackoverflow.com/a/27604130
upvote count: 1
answers question: http://stackoverflow.com/q/27601744
has comment: http://stackoverflow.com/comment/43632666
score: 1
has body: Have you looked at the groovy dsl? It hasn't had much activity lately but it might give you some pointers (it has a JMS module). You might also want to look at the new (actively maintained) Java DSL.
downvote count: 0
type: Answer

http://stackoverflow.com/a/27534266
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27534179
has body: The reason to re-throw over try / catch is that you want the Exception to bubble up the stack and deal with it from a calling method. You use a try / catch when you want to deal with the Exception there and then. For a simple example such as yours, a try / catch should suffice. E.G. though, if you had a web application, you would want to handle that Exception gracefully and bubble it up the method calls in such a way that the user got a meaningful error message on the web page.

http://stackoverflow.com/a/27550469
upvote count: 1
score: 1
has body: You are correct. Solr will sort result by default using score value (score desc) and will return first one document. You can read more about it here
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27549913
answers question: http://stackoverflow.com/q/27549913
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43414457
has text: You'd be better off doing a one time parse of the string, storing the name/value pairs into an array (or hash type).
type: Comment
comment on: http://stackoverflow.com/q/27491239
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43506142
comment on: http://stackoverflow.com/a/27538754
score: 0
type: AnswerComment
type: Comment
has text: @MikeM ok,i did not knew abt it, then he can use ArrayList..??

http://stackoverflow.com/a/27622696
score: 0
has comment: http://stackoverflow.com/comment/43672417
has body: Don't read the whole file at once. Read it line-by-line, do your corrections, and write to the output as you go. Also, it does not look like you need to parse and recreate json here. Should be able to do all the processing you need at the raw text level. And also I don't think you need recursion in your readPartOfFileAndSave(), can do everything within the outer loop.
has comment: http://stackoverflow.com/comment/43688654
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43673469
type: Answer
has comment: http://stackoverflow.com/comment/43675280
has comment: http://stackoverflow.com/comment/43672548
accepted answer of: http://stackoverflow.com/q/27622499
has comment: http://stackoverflow.com/comment/43665955
answers question: http://stackoverflow.com/q/27622499
has comment: http://stackoverflow.com/comment/43674554
has comment: http://stackoverflow.com/comment/43667318

http://stackoverflow.com/comment/43615248
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27595650
has text: Thanks man! But the problem isnt that its not getting the information its just that it wont update, all i really need to do is somehow update my method with the click of the button in my other class. I have ALOT of code almost 1000 lines added up togethere, so it's hard so simplify :(
score: 0

http://stackoverflow.com/a/61594325
answers question: http://stackoverflow.com/q/27547091
type: Answer
has body: The Problem: seems that elasticsearch stops sending data to kibana as the disk space is exceeded. You get org.elasticsearch.action.UnavailableShardsException and timeout based on the fact that your primary shard is not active. To strengthen the theory - run sudo df -h and You'll probably might get high percentages of data volumes from /var/data in your machine. Explanation: according to documentation on elasticserach disk space shard allocation, Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node. You have 4 variables that need to be set in order to override the default disk space shard allocation 1.cluster.routing.allocation.disk.threshold_enabled Defaults to true. Set to false to disable the disk allocation decider. 2.cluster.routing.allocation.disk.watermark.low Controls the low watermark for disk usage. It defaults to 85%, meaning that Elasticsearch will not allocate shards to nodes that have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent Elasticsearch from allocating shards if less than the specified amount of space is available. This setting has no effect on the primary shards of newly-created indices but will prevent their replicas from being allocated. 3.cluster.routing.allocation.disk.watermark.high Controls the high watermark. It defaults to 90%, meaning that Elasticsearch will attempt to relocate shards away from a node whose disk usage is above 90%. It can also be set to an absolute byte value (similarly to the low watermark) to relocate shards away from a node if it has less than the specified amount of free space. This setting affects the allocation of all shards, whether previously allocated or not. 4.cluster.routing.allocation.disk.watermark.flood_stage Controls the flood stage watermark. It defaults to 95%, meaning that Elasticsearch enforces a read-only index block (index.blocks.read_on…
score: 15
upvote count: 15
downvote count: 0

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/27542342
tags question: http://stackoverflow.com/q/27600166
tags question: http://stackoverflow.com/q/27603160
type: Tag
tags question: http://stackoverflow.com/q/27550590
tags question: http://stackoverflow.com/q/27594855

http://stackoverflow.com/comment/43684804
comment on: http://stackoverflow.com/q/27632323
score: 0
type: Comment
type: QuestionComment
has text: if you want to store it as a key value pair then use Map instead of java array

http://stackoverflow.com/q/27559963
accepted answer: http://stackoverflow.com/a/28184819
has comment: http://stackoverflow.com/comment/43546183
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/28184819
tagged with: java
has answer: http://stackoverflow.com/a/27561090
tagged with: eclipse
type: Question
has body: I am getting compile errors in eclipse when using the @Override annotation for a class that is implementing an interface. JDK compliance level is set to 1.7. I am using the latest version of the jdk7. Error: "The method {methodname} of type {classname} must override a superclass method" public interface DataDictionary { public Map&lt;String, ? &gt; getAllEntries(String dictionaryName); ... ... } public class StringDictionary implements DataDictionary { @Override // this generates the error public Map&lt;String, ?&gt; getAllEntries(String dictionaryName) { // some implementation return dataDictEntries; }
has comment: http://stackoverflow.com/comment/43546056
has comment: http://stackoverflow.com/comment/43546170
possible better answer: http://stackoverflow.com/a/27560746
has comment: http://stackoverflow.com/comment/43578130
has title: @Override compile error, implementing an interface (eclipse jre7 Windows)
has comment: http://stackoverflow.com/comment/43546208
upvote count: 1
has answer: http://stackoverflow.com/a/27561149
favorite count: 0
has answer: http://stackoverflow.com/a/27560746

http://stackoverflow.com/q/27569724
type: AnsweredQuestion
tagged with: gps
has comment: http://stackoverflow.com/comment/43564828
accepted answer: http://stackoverflow.com/a/27569883
tagged with: java
score: -1
has body: Hello i need get location Latitude and location longitude only one no need listener location, any example? per example in MainActivity.java Location location = Myexample.location; Myexample.class extends service // code need here regards!
type: Question
has title: GPS Android (Only one)
upvote count: 0
has comment: http://stackoverflow.com/comment/43564831
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27569883
linked to: http://stackoverflow.com/q/5314155
favorite count: 0
linked to: http://stackoverflow.com/q/7979230
linked to: http://stackoverflow.com/q/10484239
downvote count: 1

http://stackoverflow.com/q/27478029
has title: Generating unique serializable id for each of the generated classes in JAXB
has comment: http://stackoverflow.com/comment/43389793
score: 12
has comment: http://stackoverflow.com/comment/70102334
answer count: 2
has comment: http://stackoverflow.com/comment/43596804
has answer: http://stackoverflow.com/a/28083453
linked to: http://stackoverflow.com/q/1513972
favorite count: 0
upvote count: 12
tagged with: serialization
tagged with: xjc
type: UnansweredQuestion
downvote count: 0
has body: I am using ant wsimport to generate client stub from the wsdls. Also, I would like to generate client classes that implements Serializable. I would like to generate a different serialVersionUID for each class. I tried with the binding file that was shown below. But its generating same serialVersionUID for all the classes. Is there any way I can give my own serialVersionUID to each class? binding configuration <serializable uid="1" />
tagged with: java
has comment: http://stackoverflow.com/comment/43394387
tagged with: wsimport
has answer: http://stackoverflow.com/a/28121786
tagged with: jaxb
has comment: http://stackoverflow.com/comment/43391638
type: Question

http://stackoverflow.com/q/27612226
linked to: http://stackoverflow.com/q/18169627
downvote count: 0
score: 1
favorite count: 0
tagged with: currency
duplicate of: http://stackoverflow.com/q/18169627
type: Question
has comment: http://stackoverflow.com/comment/43679221
has comment: http://stackoverflow.com/comment/43646727
has comment: http://stackoverflow.com/comment/43668646
has body: Here is my postgres table CREATE TABLE bid ( id SERIAL NOT NULL, price MONEY NOT NULL, date TIMESTAMP NOT NULL, customer_id INT NOT NULL, item_id INT NOT NULL, CONSTRAINT bid_pk PRIMARY KEY (id) ); I use BigDecimal to store the price in Java. But when I run my application I get error org.apache.openjpa.lib.jdbc.ReportingSQLException: ERROR: column t2.buyoutprice does not exist What is the best way to store PostgreSQL Money Type in Java?
tagged with: java
upvote count: 1
has title: What is the equivalent of PostgreSQL Money Type in Java?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43654392
has comment: http://stackoverflow.com/comment/43669816
has comment: http://stackoverflow.com/comment/43668201
tagged with: postgresql

http://stackoverflow.com/q/27586296
tagged with: c3p0
has comment: http://stackoverflow.com/comment/43597225
has comment: http://stackoverflow.com/comment/43597087
has comment: http://stackoverflow.com/comment/43597104
has comment: http://stackoverflow.com/comment/43615178
type: UnansweredQuestion
tagged with: java
has title: Error While Using c3p0 Connection Pool
has body: Hi I am using c3p0 connection Pooling : My JDBC Class: public static Connection connect() { Connection conn = null; ComboPooledDataSource dataSource; try{ dataSource = new ComboPooledDataSource(); dataSource.setDriverClass( "com.mysql.jdbc.Driver" ); //loads the jdbc driver dataSource.setJdbcUrl( "jdbc:mysql://localhost/circuit" ); dataSource.setUser("root"); dataSource.setPassword(""); dataSource.setAutoCommitOnClose(false); dataSource.setMaxIdleTime(5); // the settings below are optional -- c3p0 can work with defaults //conn.setMinPoolSize(5); //conn.setAcquireIncrement(5); //conn.setMaxPoolSize(20); conn = dataSource.getConnection(); conn.setAutoCommit(false); }catch(Exception e){ //Handle errors for Class.forName e.printStackTrace(); }finally{ return conn; }//end try } Then i have servlet: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { BasicConfigurator.configure(); logger.info("Entered doGet method of AdvisorMyAccountRequestController"); int advisorId = 0; String username = ""; //int[] id = new int[50]; //int[] userIds = new int[]; List&lt;Integer&gt; userIds = new ArrayList&lt;Integer&gt;(); //List&lt;Integer&gt; requestId = new ArrayList&lt;Integer&gt;(); int i= 0; try{ advisorId = (int) request.getSession().getAttribute("advisorId"); username = (String) request.getSession().getAttribute("username"); }catch(Exception e){ response.sendRedirect("Error.jsp"); } List&lt;UserDetailsDTO&gt; userDetailsList = new ArrayList&lt;UserDetailsDTO&gt;(); //List&lt;UserRequestDTO&gt; userRequestDetails = new ArrayList&lt;UserRequestDTO&gt;(); int userId = 0; //int requestId = 0; Timestamp bookingDate = null; if(username != null &amp;&amp; advisorId != 0 &amp;&amp; !("").equals(username)) { /* //Getting request Id from the session table where STATUS = "PENDING FOR USER PAYMENT" AND "PENDING FOR USER PAYMENT WITH NEW DATES" MyAccountRequestDAO requestIdList = new MyAccountRequestDAO(); requestId = requestI…
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/43597034
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27586407

http://stackoverflow.com/comment/43595590
comment on: http://stackoverflow.com/a/27585546
type: AnswerComment
score: 0
has text: Ok, i see that you have added Picasso library to download the image, but it may be a bit complicated for this simple task; there is not a simpler way to load the image without using external libraries like Picasso?
type: Comment

http://stackoverflow.com/q/27612316
type: Question
tagged with: java
tagged with: pagination
answer count: 2
has answer: http://stackoverflow.com/a/27788444
has body: In AtTask API Calls, How do I use Pagination when I need More than 2000 records to return? For example, given the following off of the Developers Site of https://developers.attask.com/api-docs/#Basics I see the following Paginated Responses To override the default number of results and set the response to provide 200 results you would include the following in your query: GET /attask/api/project/search?$$LIMIT=200 To ensure reliability and performance for other tenants in the system, the maximum allowed limit per query is 2000 objects. Attempting to specify a larger limit will result in an error. Therefore, it is recommended you consider using paginated responses for large datasets. To specify the first result that should be returned, the $$FIRST filter can be added. The following will return results 201-250 for a query. GET /attask/api/project/search?$$FIRST=201&amp;$$LIMIT=50 What I'm not understanding is how to figure out how many I have in the first place. If I am looking to download the hours in the system, how do I know how many times I have to call (is there a count(*)) or some method like that? Am I simply going to get the first 2k, process, attempt to get the next 2k, and process if not empty? Rinse and repeat?
downvote count: 0
score: 1
has title: Pagination example for greater than 2000 Records in AtTask API
has answer: http://stackoverflow.com/a/28118898
favorite count: 0
type: UnansweredQuestion
tagged with: attask
upvote count: 1

http://stackoverflow.com/comment/43553085
type: QuestionComment
comment on: http://stackoverflow.com/q/27563721
score: 0
has text: What is the problem?
type: Comment

static-methods
tags question: http://stackoverflow.com/q/27504136
tag name: static-methods
tags question: http://stackoverflow.com/q/27577727
tags question: http://stackoverflow.com/q/27496864
type: Tag

http://stackoverflow.com/q/27522716
score: 3
tagged with: session
tagged with: java
has body: In my web-application I have a scoped session bean that is used among other things to keep some credential information required to connect to underlying systems (store a SAML that need to be sent for underlying web-services access). And I have that bean that does inject the credential at the right place right before the call to the web-serivce. @Autowired private MyScopedSession myScopedSession; @Autowired private SomeWebService someWebService; public void someCall() { ... injectSamlPart ... } I want to add background task (one war packaging both web-app + some background task) that runs every hour for this I use a scheduler. Problem is that this background task can't use scoped-session bean (make sense as it is not driven by http request). So I get this kind of error: Scope 'session' is not active for the current thread; But I'd like to define a static credential for my background task (e.g. define a system account or so) and thus define a kind of a replacement bean MyScopedSession for the background task so that autowiring works. Is this possible? For sure what I could do is to define my bean as @Autowired private SomeWebService someWebService; public void someCall(MyScopedSession myScopeSession) { ... injectSamlPart ... } But I don't like this much as I don't want to pass by parameter my credential through all my business services (maybe 10 layers of beans over this up to my background tasks, or up to my rpc calls) Is there any solution or architecture change that you could recommend?
type: Question
answer count: 1
downvote count: 0
tagged with: scheduled-tasks
favorite count: 0
has title: Replace scoped session bean for background task
has answer: http://stackoverflow.com/a/27524842
tagged with: spring
type: UnansweredQuestion
upvote count: 3

http://stackoverflow.com/a/56542042
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27589701
has body: If somebody looking the same for Dart and Flutter: the code without if statements - easy to read and edit. main() { int hourValue = DateTime.now().hour; print(checkDayPeriod(hourValue)); } String checkDayPeriod(int hour) { int _res = 21; Map&lt;int, String&gt; dayPeriods = { 0: 'Good night', 12: 'Good morning', 16: 'Good afternoon', 21: 'Good evening', }; dayPeriods.forEach( (key, value) { if (hour &lt; key &amp;&amp; key &lt;= _res) _res = key; }, ); return dayPeriods[_res]; }

http://stackoverflow.com/q/27496046
tagged with: java
has body: I am still working on my h:selectOneMenu and I am able to produce a good list of values but the converter is not doing something right and I can not figure out the problem. Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to com.ray.adtf.jpa.Gridmaster THANK YOU for any help! xhtml: &lt;h:selectOneMenu id="mypick" converter="#{categoryConverterBean}" value="#{gridMaster_backing.pickedGrid}" title="Test" &gt; &lt;f:selectItems value="#{gridMaster_backing.gridList}" var="prog" itemValue="#{prog.gridid}" itemLabel="#{prog.gridid} - #{prog.program} - #{prog.project} - #{prog.ci}" /&gt; &lt;/h:selectOneMenu&gt; jpa: import java.io.Serializable; import javax.persistence.*; import java.math.BigDecimal; import java.util.List; /** * The persistent class for the GRIDMASTER database table. * */ @Entity @NamedQuery(name="Gridmaster.findAll", query="SELECT g FROM Gridmaster g") public class Gridmaster implements Serializable { private static final long serialVersionUID = 1L; @Id private long gridid; private String ci; @Column(name="\"PROGRAM\"") private String program; private String project; public Gridmaster() { } public Long getGridid() { return this.gridid; } public void setGridid(Long gridid) { this.gridid = gridid; } public String getCi() { return this.ci; } public void setCi(String ci) { this.ci = ci; } public String getProgram() { return this.program; } public void setProgram(String program) { this.program = program; } public String getProject() { return this.project; } public void setProject(String project) { this.project = project; } Converter: import javax.faces.bean.ManagedBean; import com.ray.adtf.jpa.Gridmaster; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.FacesConverter; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; //You must annotate the converter as a managed bean, if you want to inject //anything in…
type: Question
has comment: http://stackoverflow.com/comment/43426928
answer count: 2
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/43487119
has answer: http://stackoverflow.com/a/27498490
accepted answer: http://stackoverflow.com/a/27499498
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27499498
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/27498490
tagged with: jsf
has title: Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to

http://stackoverflow.com/comment/43512422
comment on: http://stackoverflow.com/a/27539076
type: AnswerComment
has text: Yeas and then I have a file called `WebAppInterface.java` In hear i have many functions that i call from my javascript like `Android.showCategories()` Is this where im going to have to call my barcode scan function, and not in the `MainActivity` Which makes sense but then some of the default functions are not defined. such as `startActivityForResult(intent, 0);` and a constant `RESULT_OK` Any advice for this?
score: 0
type: Comment

http://stackoverflow.com/q/27573904
has answer: http://stackoverflow.com/a/27574008
type: Question
linked to: http://stackoverflow.com/q/1751844
has comment: http://stackoverflow.com/comment/43573447
has comment: http://stackoverflow.com/comment/43573391
has comment: http://stackoverflow.com/comment/43573372
score: 0
has comment: http://stackoverflow.com/comment/43573341
answer count: 3
has comment: http://stackoverflow.com/comment/43573389
possible better answer: http://stackoverflow.com/a/27573973
has comment: http://stackoverflow.com/comment/43573269
has title: Why still get [ ] after using toString method?
has comment: http://stackoverflow.com/comment/43573381
has comment: http://stackoverflow.com/comment/43573270
duplicate of: http://stackoverflow.com/q/1751844
tagged with: tostring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27573969
has body: Here is my code: public class StackStudy{ public static void main(String[] args){ Stack&lt;String&gt; st = new Stack&lt;String&gt;(); st.push("hi"); st.push("bye"); st.push("awful"); System.out.println(st.toString()); } } and console prints out this: [hi, bye, awful] I thought using toString will get rid of the [], why is it still there? EDIT: If toString is not the proper way to get rid of[], what is the right way to do it?
accepted answer: http://stackoverflow.com/a/27573969
has comment: http://stackoverflow.com/comment/43573385
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/27573973

http://stackoverflow.com/comment/43826712
type: AnswerComment
type: Comment
score: 0
has text: Please consider including some information about your answer, rather than simply posting code. We try to provide not just 'fixes', but help people learn. You should explain what was wrong in the original code, what you did differently, and why your change(s) worked.
comment on: http://stackoverflow.com/a/27636689

http://stackoverflow.com/q/27613849
tagged with: exception
possible better answer: http://stackoverflow.com/a/27614047
has comment: http://stackoverflow.com/comment/43650009
has comment: http://stackoverflow.com/comment/43649717
score: 2
type: AnsweredQuestion
has body: I am trying to use a Matcher for some reason, but sometimes it gives me the PatternSyntax Exception . i know in my case it means that + is a reserved character and should escape it. but my string has no such character in it at all: Pattern p=Pattern.compile(test,Pattern.CASE_INSENSITIVE); StringBuffer testing=new StringBuffer (node.getNodeValue()); matcher=p.matcher(testing); if(!matcher.hitEnd()) { if(matcher.find()) { i++; } } the exception is thrown at Pattern p=Pattern.compile(test,Pattern.CASE_INSENSITIVE); the test string is just some words or characters which are not in any case a + or * etc. here is the list of words that test will be replaced with them in a for-loop: EDIT I used the answer of Elliott Frisch however now a strange exception is happening: for(int j=0;j&lt;index2;j++) { test = (test != null) ? test.toLowerCase() : null; str = (str != null) ? str.toLowerCase() : ""; if (str.contains(test)) { X[Index]= keArrayList.indexOf(test); Index++; } } int[] X=new int[100000]; private static final double[] Y=new double[100000]; for(int i=0;i&lt;Index;i++) { felan=Y[X[i]]; } here although the both loop indexes are much smaller than 100000 but in first iteration I get this: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 is this anything related to the if condition or what?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43649867
has title: PatternSyntax Exception,Dangling meta character '+' near index 0
has comment: http://stackoverflow.com/comment/43649772
has answer: http://stackoverflow.com/a/27614080
has comment: http://stackoverflow.com/comment/43649907
tagged with: arrays
tagged with: matcher
answer count: 2
has comment: http://stackoverflow.com/comment/43649729
has comment: http://stackoverflow.com/comment/43649803
downvote count: 0
has answer: http://stackoverflow.com/a/27614047
has comment: http://stackoverflow.com/comment/43649746
has comment: http://stackoverflow.com/comment/43649953
favorite count: 0
tagged with: pattern-matching
has comment: http://stackoverflow.com/comment/43649899
has comment: http://stackoverflow.com/comment/43649828
accepted answer: http://stackoverflow.com/a/27614080
upvote count: 2

http://stackoverflow.com/a/63430113
has body: Building on @k_g's answers, but for US numbers. static boolean isValidTelephoneNumber(String number) { long num = Long.parseLong("0" + number.replaceAll("[^0-9]", "")); return 2000000000L <= num && num < 19999999999L; } public static void main(String[] args) { var numbers = List.of("+1 212-788-8609", "212-788-8609", "1 212-788-8609", "12127888609", "2127888609", "7143788", "736103355"); numbers.forEach(number -> { boolean isPhoneValid = isValidTelephoneNumber(number); log.debug(number + " matches = " + isPhoneValid); }); }
answers question: http://stackoverflow.com/q/27631692
score: 0
type: Answer

http://stackoverflow.com/a/27494589
has comment: http://stackoverflow.com/comment/43464464
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43426114
has comment: http://stackoverflow.com/comment/43466169
has comment: http://stackoverflow.com/comment/43428945
has comment: http://stackoverflow.com/comment/43426219
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27494442
has comment: http://stackoverflow.com/comment/43464425
has body: Are you sure you need to set the actual JAVA_HOME variable? If I remember correctly, for git bash it looks at the $PATH variable for the java version. Maybe try appending your java location here. also, to double check (sorry if you already know this), you can run the env command to list all your environment variables. $ env Try setting the path and run the java -v command to verify the installation is correct. If not, what is the exact error? $ java -v Edit Some more info, to set the $PATH in git windows I think you have to update your $HOME. See this or some other posts (google) for an explanation Git for Windows: .bashrc or equivalent config files for Git Bash shell
answers question: http://stackoverflow.com/q/27494442
has comment: http://stackoverflow.com/comment/43427784

http://stackoverflow.com/a/27586116
type: Answer
accepted answer of: http://stackoverflow.com/q/27552555
upvote count: 6
has comment: http://stackoverflow.com/comment/69218290
answers question: http://stackoverflow.com/q/27552555
has body: You cannot assume that the Uri returned by the media picker will correspond to a local file. It looks like you're selecting a G+ photo or some other image that is not in the device. The correct way to go would be to use a ContentResolver to access the picture as a stream. For example: InputStream inputStream = null; if (ContentResolver.SCHEME_CONTENT.equals(selectedImage.getScheme())) { inputStream = context.getContentResolver().openInputStream(selectedImage); } else if (ContentResolver.SCHEME_FILE.equals(selectedImage.getScheme())) { inputStream = new FileInputStream(selectedImage.getPath()); } bitmap = BitmapFactory.decodeStream(inputStream); That should work for both content:// or file:// uris. And (very important) make sure to do this from a background thread (e.g. AsyncTask), otherwise you'll get a NetworkOnMainThreadException if the uri is a "remote" one.
score: 6
has comment: http://stackoverflow.com/comment/43597339
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43597356

http://stackoverflow.com/q/27510891
upvote count: 0
answer count: 1
has title: Trouble understanding how the global variable is being passed in the depth first search algorithm pseudocode
has comment: http://stackoverflow.com/comment/43452406
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/27510987
type: UnansweredQuestion
tagged with: recursion
has body: I was reading the pseudocode of depth-first-search algorithm below . According to the pseudocode, I understand how the global variable within DFS(G) is defined but I have trouble understanding how is it possible that the global variable within DFS(G) is not being passed into the recursive method DFS-visit(G, u) but time is being incremented within the recursive method. I tried doing writing the code out like this: class Algo{ ... public void dfs(Graph g){ .... long time = 0; // for-loop dfs_visit(g , u); } public void dfs_visit(Graph G, Vertex u){ long time = time + 1; ..... } } And this generates a compilation error in the dfs-visit(G, u): error: variable time might not have been initialized long time = time + 1; I am sensing that I am thinking this in a wrong way but I just do not understand how time can be incremented in dfs-vist method without being passed as an argument. Please help me correct my logic.
has comment: http://stackoverflow.com/comment/43451874
tagged with: java
has comment: http://stackoverflow.com/comment/43452081
downvote count: 1
has comment: http://stackoverflow.com/comment/43453046
type: Question
has comment: http://stackoverflow.com/comment/43451890
tagged with: algorithm
has comment: http://stackoverflow.com/comment/43452980

http://stackoverflow.com/a/60610616
type: Answer
has comment: http://stackoverflow.com/comment/139977695
answers question: http://stackoverflow.com/q/27598078
score: 0
has body: You should use double instead of float for precise calculations, and float instead of double when using less accurate calculations. Float contains only decimal numbers, but double contains an IEEE754 double-precision floating point number, making it easier to contain and computate numbers more accurately. Hope this helps.

http://stackoverflow.com/comment/43434998
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27501605
has text: That's ok, the project has the exact same code above and it's throwing IllegalMonitorStateException, can't figured it out how you can run it.

http://stackoverflow.com/q/27615842
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27628468
answer count: 2
has title: Is there a configurable pre-commit hook solution available for android?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36586585
tagged with: android
has body: Coming from a python background have been using flake8 to install pre-commit hooks that check python code for pylint/pep08 violations. Is there a similar solution available for android? Came across git-lint but looking for something that is more customized for android project. Also the lint tool that comes with android tools runs quite long and doesn't seem to be an ideal solution for a pre-commit hook. Seems using checkstyle.xml with the list of rules is the most standard way. Went through a bunch of open source android projects and most seem to be using checkstyle.xml. Any other better alternatives out there?
upvote count: 3
type: UnansweredQuestion
tagged with: gradle
tagged with: pre-commit-hook
has comment: http://stackoverflow.com/comment/43653213

http://stackoverflow.com/comment/43660353
comment on: http://stackoverflow.com/a/27619671
type: AnswerComment
score: 0
type: Comment
has text: Please read my Question it's mention that i have same mount point like Path 1 :/storage/Folder1/Folder2/image.png Path2 :/storage/Folder3/Folder4/image.png

http://stackoverflow.com/a/27499106
type: Answer
answers question: http://stackoverflow.com/q/27499077
has comment: http://stackoverflow.com/comment/43429061
score: 6
downvote count: 0
has body: Your call to System.gc(); makes no difference, since your Temp instance has a reference (obj) so it's not eligible for garbage collection. Even if it was eligible for garbage collection, calling System.gc(); doesn't necessarily collect all the objects that have no reference to them immediately.
has comment: http://stackoverflow.com/comment/43429139
upvote count: 6

http://stackoverflow.com/comment/43591136
score: 0
comment on: http://stackoverflow.com/q/27581005
type: Comment
type: QuestionComment
has text: Nop, I was interessted on how to save XML file without the usage of `openFileOutput()`. "then XMLWriter needs to write XML. There are many ways of doing that in Android. Only one involves openFileOutput(). " please read clearly what you have written before you post it !

http://stackoverflow.com/q/27571712
possible better answer: http://stackoverflow.com/a/39357523
favorite count: 0
has answer: http://stackoverflow.com/a/27571879
accepted answer: http://stackoverflow.com/a/27571879
has body: I am using this code. However when ever i click on EditText to open the keyboard, the view is not totally up. Why the view is not going up all the way, EditText is hidden behind Keyboard <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/loadingAnimationImg" android:layout_height="35dp" android:layout_width="35dp" android:adjustViewBounds="true" android:contentDescription="@null" android:background="@drawable/img05"/> <ImageView android:layout_marginBottom="5dp" android:layout_height="wrap_content" android:layout_width="120dp" android:adjustViewBounds="true" android:contentDescription="@null" android:src="@drawable/simple_logo"/> <GridView android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="300dp" android:id="@+id/gridView" android:numColumns="5" android:verticalSpacing="5dp" /> <TextView android:layout_marginTop="5dp" android:layout_marginLeft="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@android:color/white" android:text="@string/hashtagText" /> <com.trib.devicebee.custom.FlowLayout android:id="@+id/flowLayout" android:layout_margin="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" /> <EditText android:layout_margin="10dp" android:id="@+id/hashTagsText" android:hint="" android:inputType="textFilter" android:singleLine="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="12sp" />
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Keyboard is not scrolling EditText above
has answer: http://stackoverflow.com/a/39357523
type: Question
linked to: http://stackoverflow.com/q/3295672
has answer: http://stackoverflow.com/a/27571875
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/43579326
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27576805
type: QuestionComment
has text: There are a bunch of things you can make use of in the `java.util.concurrent` that might make things easier than dealing directly with a thread lifecycles. Will be hard to know without seeing any code.

http://stackoverflow.com/a/27560064
has comment: http://stackoverflow.com/comment/43549907
has comment: http://stackoverflow.com/comment/43559908
score: 6
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43559952
accepted answer of: http://stackoverflow.com/q/27560034
has comment: http://stackoverflow.com/comment/43554290
type: Answer
answers question: http://stackoverflow.com/q/27560034
upvote count: 6
has comment: http://stackoverflow.com/comment/43546365
has body: I see a number of problems: you check both a2 + b2 = c2 and b2 + a2 = c2, but these are actually equivalent you never check if a2 + c2 = b2. you use Math.pow to square a number, which is both inefficient and imprecise. (You should just use *.) you expect floating-point arithmetic to give an exact value &mdash; suitable for == &mdash; which it generally does not.
has comment: http://stackoverflow.com/comment/43554553

http://stackoverflow.com/comment/43420902
type: AnswerComment
type: Comment
has text: Well it doesnt work as I wouldd want to.Actually, I have an option that directly access ajout_jeux(),wich create an object and add it to the list.information(List<Game>thegame) needs to print out that list.However, what you told me to do actually ask again for inputs and add them to list before printing it.But I want to be able to display the list without having to input a new object.Thank you
comment on: http://stackoverflow.com/a/27494407
score: 0

http://stackoverflow.com/q/27487924
upvote count: 2
accepted answer: http://stackoverflow.com/a/27488268
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: itext
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27488268
has title: Move LineSeparator to the bottom of the page
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
has body: I have LineSeparator which plots it on the top of the page All I am trying to move the LineSeparator bottom of the page like I wasn't successfully to set the absolute position to the LineSeparator. So far: Paragraph paragraph = new Paragraph(); LineSeparator UNDERLINE = new LineSeparator(0.5f, 92, null, Element.ALIGN_CENTER, -2); paragraph.add(UNDERLINE); document.add(paragraph); Please give me some directions, thanks.

http://stackoverflow.com/comment/43564545
type: QuestionComment
comment on: http://stackoverflow.com/q/27569619
score: 0
has text: Does that restriction apply to the entire XML or to the contents only? And what's the reason for that restriction? Can you provide an example?
type: Comment

http://stackoverflow.com/a/27489236
has body: change this : if ( number &lt; 0 ) { negativeList [ i ] = reader . nextDouble ( ) ; } if ( number % 2 == 0 ) { evenList [ i ] = reader . nextDouble ( ) ; } else { oddList [ i ] = reader . nextDouble ( ) ; } to this : if ( number &lt; 0 ) { negativeList [ i ] = number ; } if ( number % 2 == 0 ) { evenList [ i ] = number ; } else { oddList [ i ] = number ; }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27489167
downvote count: 0

http://stackoverflow.com/comment/43603283
type: Comment
has text: @MohamadNabeel i have updated the answer, in case you need them class-scope, you can declare them as member variables, and init them inside `onCreate()`
type: AnswerComment
comment on: http://stackoverflow.com/a/27589173
score: 0

http://stackoverflow.com/q/27508859
tagged with: android
possible better answer: http://stackoverflow.com/a/27509235
has comment: http://stackoverflow.com/comment/43450521
has answer: http://stackoverflow.com/a/27509235
has title: Missing Back Button Material Theme
linked to: http://stackoverflow.com/q/13086840
type: AnsweredQuestion
tagged with: java
tagged with: material-design
has answer: http://stackoverflow.com/a/27510250
accepted answer: http://stackoverflow.com/a/27510250
type: Question
has comment: http://stackoverflow.com/comment/43449722
answer count: 2
has body: I'm using the Material Design (Android Support V7 AppCompat) and using the Support Toolbar instead of the ActionBar. But I've noticed that the Back Button it's gone, on previous versions of Android, when adding to the back stack a Fragment Transaction, automatically added the Back Button, now it's gone. The only way I found to show the Back Button, it's using an Activity and calling it. Have someone found and resolved this? Thanks! EDIT I'm using a DrawerLayout and an ActionBarDrawerToggle, now, I've used the answer that was given and used this: private FragmentManager.OnBackStackChangedListener mOnBackStackChangedListener = new FragmentManager.OnBackStackChangedListener() { @Override public void onBackStackChanged() { boolean displayHomeAsUpEnabled = getSupportFragmentManager().getBackStackEntryCount() &gt; 0; getSupportActionBar().setDisplayHomeAsUpEnabled(displayHomeAsUpEnabled); } }; FragmentManager it's from android.support.v4. Now, when returning to the Home Screen, the 'Home' (Hamburger button) disappears. I now it's because "setDisplayHomeAsUpEnabled" it's on false... But how do I show the home button again?, on previous versions of Android, just adding the back stack and having the back stack to 0 were enough to show the Home Button and the Back Button. Thanks
score: 0

http://stackoverflow.com/a/27540042
downvote count: 0
score: 1
has body: It is because of the livecyle of a bean and a java class! in your ClassB you have two variables. mybean will been populated by Spring after the object instance ins created (by spring). But String str = mybean.methodA(); will be assinged as soon as the object instance is created. And at this point the variable mybean is still null, and therfor the instance creation will fail! Solution: use @PostConstruct, spring init-method, or implement InitializingBean -- see this answer for an overview public class ClassB { @Autowired private InterfaceA mybean; private String str; void afterPropertiesSet() { String str = mybean.methodA(); } }
upvote count: 1
answers question: http://stackoverflow.com/q/27539784
type: Answer

http://stackoverflow.com/comment/51234075
has text: Thanks for the insight! For point 1), actually I was trying to simulate a "mt non blocking" wait call, so that the script stops, but the caller thread goes on doing other things (i.e.: process the walking progress), which I just simulated with sleep(2000), and finally notifying that the walk progress has ended by calling g.get("co").call() to unyield the script thread
type: Comment
comment on: http://stackoverflow.com/a/27631292
type: AnswerComment
score: 0

server
tags question: http://stackoverflow.com/q/27611160
type: Tag
tags question: http://stackoverflow.com/q/27544800
tags question: http://stackoverflow.com/q/27553114
tags question: http://stackoverflow.com/q/27593006
tags question: http://stackoverflow.com/q/27536841
tag name: server
tags question: http://stackoverflow.com/q/27542689
tags question: http://stackoverflow.com/q/27550936
tags question: http://stackoverflow.com/q/27522451
tags question: http://stackoverflow.com/q/27637327
tags question: http://stackoverflow.com/q/27636963
tags question: http://stackoverflow.com/q/27526116
tags question: http://stackoverflow.com/q/27499307
tags question: http://stackoverflow.com/q/27518380
tags question: http://stackoverflow.com/q/27562326
tags question: http://stackoverflow.com/q/27634750

http://stackoverflow.com/comment/43434246
type: AnswerComment
has text: He asks to use a primitive type, Integer isn't
type: Comment
comment on: http://stackoverflow.com/a/27501768
score: 1

http://stackoverflow.com/q/27591365
has answer: http://stackoverflow.com/a/27591511
has comment: http://stackoverflow.com/comment/43606554
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43606437
accepted answer: http://stackoverflow.com/a/27591511
has comment: http://stackoverflow.com/comment/43606485
has comment: http://stackoverflow.com/comment/43606505
tagged with: algorithm
tagged with: java
has body: Trying to make a HIT(x). when Hit called it decreases the elements( which are greater than x) of array by one and then print the array. and x is also an array which contains some element. For example. AR[7 4 5 3] and x= [4 2 5] then output is [5 3 4 2]. I am trying but not getting the relevant output. my code terminates only after taking the array element. import java.util.Scanner; public class Kom1 { static int[] array; public void hit(int x) { for (int i = 0; i &lt; array.length; i++) { if (array[i] &gt; x) { array[i] --; } } printArray(); } public void printArray() { for (int i = 0; i &lt; array.length; i++) { System.out.println(array[i]); } } public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int maxElements = scanner.nextInt(); array = new int[maxElements]; for (int i = 0; i &lt; maxElements; i++) { array[i] = scanner.nextInt(); } } }
score: -1
has comment: http://stackoverflow.com/comment/43608798
upvote count: 0
tagged with: arrays
answer count: 1
has title: Decrease the array value when another array is called
favorite count: 0
has comment: http://stackoverflow.com/comment/43606498
has comment: http://stackoverflow.com/comment/43606645
type: AnsweredQuestion

http://stackoverflow.com/q/27496507
has title: How to shoot "bullets" in java swing animation game
has answer: http://stackoverflow.com/a/27496535
type: AnsweredQuestion
downvote count: 3
score: -3
accepted answer: http://stackoverflow.com/a/27496535
tagged with: swing
type: Question
tagged with: game-physics
tagged with: graphics
tagged with: java
has comment: http://stackoverflow.com/comment/43424614
has body: I have created a simple animation game in which the user can move a circle with the arrow keys. I have drawn a square that 'follows' the center of the circle around. My goal is for there to be an infinite supply of squares (bullets) in the center of the circle (that follow it around), that can shoot left right up down using asdf while moving around. I am trying to figure out how to type code that will detach the bullet from following the circle around once shot. Thanks in advance. I am a beginner so i apologize in advance for the messy code:) public class Game extends JPanel implements ActionListener, KeyListener { Timer t = new Timer(5, this); int x, y, velx, vely, movx, movy = 0; int shootx, shooty; int xaim = 0; int yaim = 0; int xpts[], ypts[]; int aim; Polygon bullet; public Game(){ t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g){ Graphics2D g2d = (Graphics2D) g; //Background g2d.setColor(Color.BLUE); g2d.fillRect(0, 0, 600, 600); g2d.fillRect(x, y, 30, 30); //Borders g2d.setColor(Color.GREEN); g2d.fillRect(0, 0, 20, 600); g2d.fillRect(0, 0, 600, 20); g2d.fillRect(580, 0, 20, 600); g2d.fillRect(0,560,600,20); //Player g2d.setColor(Color.RED); g2d.fillOval(x, y, 30, 30); //Bullet g2d.setColor(Color.BLACK); g2d.fillRect(xaim+28,yaim+28,15,15); } public void actionPerformed(ActionEvent e) { checkbounds(); x += movx; y += movy; xaim += velx; yaim += vely; repaint(); } public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEvent.VK_UP) { up(); } if (code == KeyEvent.VK_DOWN) { down(); } if (code == KeyEvent.VK_LEFT) { left(); } if (code == KeyEvent.VK_RIGHT) { right(); } if (code == KeyEvent.VK_A) { //code to shoot left } if (code == KeyEvent.VK_W) { //code to shoot up } if (code == KeyEvent.VK_D) { //code to shoot right } if (code == KeyEvent.VK_S) { //code to shoot down } } public void up(){ movy = -1; movx = 0; velx = 0; vely = -1; } public void down(){ movy…
has comment: http://stackoverflow.com/comment/43424793
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43445085
favorite count: 0
has comment: http://stackoverflow.com/comment/43424599
tagged with: animation

http://stackoverflow.com/a/33295480
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/54390316
score: 1
upvote count: 1
has body: you can use setOut() method for filewrite with System.out.println(); after call setOut() whenever use System.out.println() then the method sop will be print on file or whichever you give in setOut() method
answers question: http://stackoverflow.com/q/27571850

http://stackoverflow.com/q/27500682
type: UnansweredQuestion
tagged with: commonsware-cwac
upvote count: 1
has comment: http://stackoverflow.com/comment/43444363
has answer: http://stackoverflow.com/a/27507248
tagged with: fullscreen
score: 1
tagged with: java
type: Question
tagged with: layout
downvote count: 0
has comment: http://stackoverflow.com/comment/43443837
has comment: http://stackoverflow.com/comment/43443983
has comment: http://stackoverflow.com/comment/43438495
has comment: http://stackoverflow.com/comment/43443907
has body: My question is about the Android facility for utilizing the secondary screen of device, i.e. android.app.Presentation I'm using this wrapper: https://github.com/commonsguy/cwac-presentation Unfortunately I cannot force the second screen layout to be in fullscreen mode: although its width fully matches the screen, its height is always restricted to a stripe in the center of screen, approximately 1/4 of screen height Correspondingly, all its content is displayed within this narrow boundary, while the remaining parts of the screen keep staying black and useless For those who don't have an idea about this API, android.app.Presentation is a special type of Dialog which is shown on secondary screen of device, The wrapper I've mentioned above, is based on PresentationFragment which extends DialogFragment. User creates a class extending PresentationFragment, and in its overridden onCreateView() he creates the layout he wishes to be displayed on second screen. Example: public class CustomPresentationFragment extends PresentationFragment { public static CustomPresentationFragment newInstance(Context ctxt, Display display) { CustomPresentationFragment frag=new CustomPresentationFragment(); frag.setDisplay(ctxt, display); //we may prepare bundle to pass, if necessary //Bundle b=new Bundle(); //b.putString("key1", value1); //b.putString("key2", value2); //frag.setArguments(b); return(frag); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View myView = new View(getContext()); //here we create layout that we want to be displayed on second screen, and return it return(myView); } } This is the implementation of PresentationFragment. As we see, it contains Presentation variable: package com.commonsware.cwac.preso; import android.app.Dialog; import android.app.DialogFragment; import android.app.Presentation; import android.content.Context; import android.os.Bundle; import android.view.Display; public abstract class Presen…
tagged with: android
answer count: 1
has title: Cannot make a fullscreen Android Presentation on the second screen
favorite count: 0

http://stackoverflow.com/q/27564670
has comment: http://stackoverflow.com/comment/43554989
has comment: http://stackoverflow.com/comment/122376944
tagged with: java
tagged with: loops
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27564904
tagged with: arrays
tagged with: counter
tagged with: arraylist
score: 0
has body: I am going to create a program that keeps track of the balance on a bank account. The program shall use a loop that continues until the user choses to exit by answering no to the question Do you want to continue?. In the loop the user shall be asked to enter an amount (positive for deposit and negative for withdraw). The amount shall be added/subtracted from an account balance variable. All deposits/withdraws shall be saved as a history so that we can print it later. When the user choses to exit the loop the current account balance together with the account history (from the array/ArrayList) shall be printed. Now, I want to use an array with ten slots for the history feature. My question is how can I keep track of the all deposit, withdraw and current account balance (using an array with ten slots for the history feature) so that I can print it out while the user exits the program? My code: BankApp class: package bankapp; import java.util.Scanner; public class BankApp { public static void main(String[] args) { Scanner input = new Scanner(System.in); askingUser au = new askingUser(); System.out.println("WELCOME TO OUR BANK!\nYou have 100 SEK by default in your account."); while (true) { au.userInput(); System.out.println("Do you want to continue? Answer by Yes or No."); String yesOrNo = input.next(); if (yesOrNo.equalsIgnoreCase("yes")) { au.userInput(); } else if (yesOrNo.equalsIgnoreCase("no")) { System.out.println("History: "); //print out the transaction history System.exit(0); } else { System.out.println("Invalid character input."); } } } } askingUser class: package bankapp; import java.util.Scanner; public class askingUser { Scanner input = new Scanner(System.in); double initialBal = 100; public void userInput() { System.out.println("Enter your amount: (+ve for deposit &amp; -ve for withdraw)"); double inputAmount = input.nextDouble(); if (inputAmount &gt;= 0) { double newPosAm = initialBal + inputAmount; System.out.println("Your current balance is: " + newPosA…
has title: How do I keep track of the balance on a bank account?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27564909
has comment: http://stackoverflow.com/comment/43555164

http://stackoverflow.com/q/27614900
type: UnansweredQuestion
tagged with: https
type: Question
tagged with: java
tagged with: ssl
tagged with: ssl-certificate
has answer: http://stackoverflow.com/a/27614972
answer count: 1
score: 0
has body: I have a class that hits a secured URL (starts with https) with a xml and at their end it process the xml and send back the response. But while doing this i am getting some exception. javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target I googled a lot and found so many answers but none of worked for me. I added the certificate to my cacerts file under ../jre/lib/security directory and also installed the certificate. but nothing is working for me. I have also checked the certificate by running InstallCert.java file and it says No errors, certificate is already trusted. Please help. Thanks in advance.
has title: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed

http://stackoverflow.com/comment/44097020
comment on: http://stackoverflow.com/a/27839747
type: Comment
has text: I have made the complete application using java fx 2. Using fx 8 might create problems ? Actually I tried switching to fx8 but there were problems like black flickering screen.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27584105
has body: You are using multiple page directives at line 1 and 4. Use one of them. And check updated code bellow. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%> <%@page import="java.io.*"%> <%@page import="java.net.URL"%> <% String jspPath = "C:\\Users\\Farshid\\workspace\\STPT\\WebContent\\file\\title.txt"; BufferedReader reader = new BufferedReader(new FileReader(jspPath)); //BufferedReader br = new InputStreamReader(new FileInputStream(txtFilePath)); StringBuilder sb = new StringBuilder(); String line; line = reader.readLine(); out.println(sb.toString()); System.out.println("line" +line); %> <%=line %> <%=line %>
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27583912
score: 0
answers question: http://stackoverflow.com/q/27583912
type: Answer

http://stackoverflow.com/a/27517904
answers question: http://stackoverflow.com/q/27517803
type: Answer
score: 1
has body: The for-each loop structure in java goes as follows: // works with collections and arrays, everything // that has an iterator Collection&lt;Object&gt; c = new Collection&lt;Object&gt;(); for (Object i : c) { // do code } For you, this would look like this: // I don't know what your movieArrayList contains for (Movie i : movieArrayList) { System.out.println(i.getId() + " " + i.getAction()); } Hope this helps!
upvote count: 1
has comment: http://stackoverflow.com/comment/43466555
downvote count: 0
has comment: http://stackoverflow.com/comment/43465836
has comment: http://stackoverflow.com/comment/43465954

http://stackoverflow.com/q/27525849
has comment: http://stackoverflow.com/comment/43480890
tagged with: java
has comment: http://stackoverflow.com/comment/43481600
tagged with: concurrency
has answer: http://stackoverflow.com/a/27526648
has title: Difference between Java Concurrency, Akka and RxJava?
type: Question
has comment: http://stackoverflow.com/comment/43481344
score: 39
accepted answer: http://stackoverflow.com/a/27526648
has comment: http://stackoverflow.com/comment/43480339
has answer: http://stackoverflow.com/a/55635466
upvote count: 39
answer count: 2
tagged with: akka
tagged with: rx-java
downvote count: 0
has comment: http://stackoverflow.com/comment/43481304
possible better answer: http://stackoverflow.com/a/55635466
favorite count: 0
has body: Today I found that, for concurrency in java we have good framework like Akka and I also found that, there is a reactive programming frameworks like RxJava for performing multithreading in application. But I'm still confused! Why are both better than Java Concurrency framework? Nowadays reactive programing is mature topic, and most languages have support for Functional Reactive Programing like Netflix provide APIs regarding Reactive programming for more than one language. Rxjava is one of the api that is used for java, scala etc. According to RxJava, they internally use actors for maintaining multithreading and Akka also uses Actors for multithreading programming. So, what is the difference between Akka and Reactive Programming approach and why they are good from Java Concurrency ?
has comment: http://stackoverflow.com/comment/43480824
type: AnsweredQuestion

http://stackoverflow.com/comment/43585687
type: QuestionComment
comment on: http://stackoverflow.com/q/27580655
type: Comment
has text: Look at the Scanner class for handling user input.
score: 1

http://stackoverflow.com/a/27515436
upvote count: 1
has comment: http://stackoverflow.com/comment/43512268
type: AcceptedAnswer
downvote count: 0
has body: How about using this pattern: public class Particle { // Particle code } public class Particles implements Iterable&lt;Particle&gt; { ArrayList&lt;Particle&gt; myParticles = new ArrayList&lt;Particle&gt;(); public void add(Particle particle) { myParticles.add(particle); } public Iterator&lt;Particle&gt; iterator() { return myParticles.iterator(); } // more code on particles } void bla() { Particles particles = new Particles(); particles.add(new Particle()); particles.add(new Particle()); for (Particle particle : particles) { System.out.println("P="+particle); } } If you want to inhibit the remove() on this iterator you might use this pattern: public static class Particles implements Iterable&lt;Particle&gt; { ArrayList&lt;Particle&gt; myParticles = new ArrayList&lt;Particle&gt;(); public void add(Particle particle) { myParticles.add(particle); } public Iterator&lt;Particle&gt; iterator() { return new Iterator&lt;Particle&gt;() { Iterator&lt;Particle&gt; listIterator = myParticles.iterator(); @Override public boolean hasNext() { return listIterator.hasNext(); } @Override public Particle next() { return listIterator.next(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }
score: 1
accepted answer of: http://stackoverflow.com/q/27510671
has comment: http://stackoverflow.com/comment/43512118
answers question: http://stackoverflow.com/q/27510671
type: Answer
has comment: http://stackoverflow.com/comment/43476906

http://stackoverflow.com/a/27546682
has body: I'm not and Android developer. But I know the problem is with your request. You are passing all data in GET request method (appending parameters in URL). But It has limitation of 2,083 character length. (It depends on webserver actually) So, If your image size is higher than that, it will simply truncate from URL. For the solution, you have to use POST request to submit data to webservice. Android Refer answer of this question for android code snippet PHP code &lt;?php $json=json_decode($_POST['json']); //decoding json which is received from Android. $photo=$json-&gt;images; //get image data (which is encoded in base64) /* Decoding image */ $binary = base64_decode ( $photo ); /* Opening image */ $file = fopen ( 'file_name_to_create.jpeg', 'wb' ); /* Writing to server */ fwrite ( $file, $binary ); /* Closing image file */ fclose ( $file ); ?&gt; It will create file_name_to_create.jpeg in current directory. Reference Maximum Length of GET request POST request using Android
has comment: http://stackoverflow.com/comment/43521433
downvote count: 0
answers question: http://stackoverflow.com/q/27546608
has comment: http://stackoverflow.com/comment/43520315
has comment: http://stackoverflow.com/comment/43547016
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43548235

http://stackoverflow.com/a/27518311
answers question: http://stackoverflow.com/q/27518290
has comment: http://stackoverflow.com/comment/43466540
score: 0
has comment: http://stackoverflow.com/comment/43466712
has comment: http://stackoverflow.com/comment/43466831
has body: You are passing the object of JFrame to your method before creating the JFrame object. createMenuBar(frame); frame = new JFrame("game"); It should be: frame = new JFrame("game"); createMenuBar(frame); Edit You have called frame.setJMenuBar(menuBar); method even before adding components to your JMenu Bar. It means when you set JMenuBar to your frame, JMenuBar doesn't have any menus. First you are extending your class from JFrame so it itself becomes a JFrame then you have created a new JFrame object in your method createGrids() and then you pass this object to your second method createMenuBar(frame). As Java is pass by value, it simply means the object of JFrame which you created in your method createGrids() is copied to the argument frame and then you add your JMenuBar to this third JFrame, which you don't display.
type: Answer
has comment: http://stackoverflow.com/comment/43466606

http://stackoverflow.com/comment/43706666
score: 0
type: AnswerComment
type: Comment
has text: you mean to say hub and node concept?
comment on: http://stackoverflow.com/a/27642870

http://stackoverflow.com/q/27588009
type: AnsweredQuestion
favorite count: 0
upvote count: 2
tagged with: double
answer count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43600224
has comment: http://stackoverflow.com/comment/43636810
has body: i would like to know how to get the fractional part of a double. Im trying the following code: double auxValMin= Double.parseDouble("5.3"); double auxDecimal= auxValMin-floor(auxValMin); System.out.println(auxDecimal); //I get 0.2999999999999998 instead of 0.3 How can i fix the "0.2999999999999998"?
has comment: http://stackoverflow.com/comment/43600119
possible better answer: http://stackoverflow.com/a/27588193
score: 2
has answer: http://stackoverflow.com/a/27588058
has answer: http://stackoverflow.com/a/27588193
has title: How to to check fractional part on double?
downvote count: 0
has comment: http://stackoverflow.com/comment/43600131
linked to: http://stackoverflow.com/q/5017072
accepted answer: http://stackoverflow.com/a/27588058
type: Question
linked to: http://stackoverflow.com/q/3413448

http://stackoverflow.com/a/27555039
answers question: http://stackoverflow.com/q/27555002
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: If you use a PrepareStatement to bind a String, you don't need the single quotes (which indicate a string literal) around the ? - the JDBC driver will take care of the typing for you. Just drop them, and you should be fine: String sqlQuery = "DELETE FROM inventory WHERE inventory = ?";

http://stackoverflow.com/comment/43426620
has text: It's some kind of primitive binary splitting algorithm, using `BigDecimal` where it really ought to use `int`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27496475

http://stackoverflow.com/a/27507022
downvote count: 1
has comment: http://stackoverflow.com/comment/43446778
answers question: http://stackoverflow.com/q/27507008
has body: It actually has been initialized. Variables in the global scope are initialized automatically. Variables of Object type will be initialized to null primitive like int will be initialized to 0. A variable declared not in the global scope must be initialized ie. declared in a method. Another problem is declaring it as final this is telling the compiler it must be explicitly initialized. So by adding the x=5 you are bypassing the compiler error saying it must be explicitly initialized. When you access it before this line at run-time it is initialized to 0 like any other primitive int type variable in the global scope.
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/comment/43476421
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27523670
has text: Use GridLayout on `gamePanel1`, avoid use of set bounds on button

http://stackoverflow.com/comment/43563965
comment on: http://stackoverflow.com/a/27558576
score: 0
type: AnswerComment
has text: @dave_thompson_085 You can only reduce it if the base modulo n is actually an element of the multiplicative group, which it may not be. For example, if n = 4, the order of the multiplicative group is 2. But if you work out 2 ^ 2 mod 4 you get 0. Reducing the power by 2 you get 2 ^ 0 = 1 mod 4. I know my number theory!
type: Comment

http://stackoverflow.com/q/27475308
downvote count: 0
answer count: 7
tagged with: string
has answer: http://stackoverflow.com/a/27475409
favorite count: 0
has answer: http://stackoverflow.com/a/32834428
has comment: http://stackoverflow.com/comment/43385001
has comment: http://stackoverflow.com/comment/43385002
has comment: http://stackoverflow.com/comment/43384970
has answer: http://stackoverflow.com/a/51335645
has comment: http://stackoverflow.com/comment/43385044
has answer: http://stackoverflow.com/a/41592048
has answer: http://stackoverflow.com/a/43964374
accepted answer: http://stackoverflow.com/a/27475341
has comment: http://stackoverflow.com/comment/43384978
has comment: http://stackoverflow.com/comment/43384964
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43385073
has body: I have a question about a programming problem from the book Cracking The Code Interview by Gayl Laakmann McDowell, 5th Edition. I'm not sure what is wrong with my answer? It varies a lot from the answer given in the book. public String replace(String str){ String[] words = str.split(" "); StringBuffer sentence = new StringBuffer(); for(String w: words){ sentence.append("%20"); sentence.append(w); } return sentence.toString(); }
has comment: http://stackoverflow.com/comment/43385015
tagged with: java
has answer: http://stackoverflow.com/a/27475353
has title: Write a method to replace all spaces in a string with '%20'?
has comment: http://stackoverflow.com/comment/43385033
has answer: http://stackoverflow.com/a/27475341
linked to: http://stackoverflow.com/q/10007631
possible better answer: http://stackoverflow.com/a/27475409
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/43384976
score: 4
has comment: http://stackoverflow.com/comment/43384948
has comment: http://stackoverflow.com/comment/43384977
upvote count: 4
tagged with: char

http://stackoverflow.com/a/27558589
has comment: http://stackoverflow.com/comment/43564992
accepted answer of: http://stackoverflow.com/q/27551346
score: 0
has body: I think the basic problem is with the type of the joint you're trying to use. Distance Joint assumes that the distance between two connected points is constant (the basic assumptions of box2d joints in general, can bend this rule a bit, but still...). Try using MouseJoint and just remember: When you're creating the MouseJoint and attaching it to the body (so exactly when you're creating MouseJointDef), you specify a target which in this specific moment (AND ONLY THEN) means the part of the body in which you want to anchor the MouseJoint (pointing out once again - it's within this body!). So in your case this target should be indicating the touched part of your wheel. When you're done with creating of the joint (so after you had called &lt;World_Object&gt;.createJoint(&lt;your_joint&gt;)) the target indicates the place you would like the previously set target(within this body) to be moved to (so this anchor at the top of the wheel). So basically you should create your mouse joint on touch with code similar to this: MouseJoint wheelJoint; MouseJointDef mouseJointDef = new MouseJointDef(); mouseJointDef.bodyA = &lt;something&gt;; mouseJointDef.bodyB = wheelBody; mouseJointDef.target.set(0 + chosenWheelPositionOffsetX, 0 + chosenWheelPositionOffsetY); mouseJointDef.target.addLocal(wheelCenterX, wheelCenterY); mouseJointDef.dampingRatio = &lt;chosen_value&gt;; mouseJointDef.frequencyHz = &lt;chosen_value&gt;; mouseJointDef.maxForce = &lt;chosen_value&gt;; wheelJoint = (MouseJoint) mWorld.createJoint(mouseJointDef); and after that you should call wheelJoint.setTarget(topAnchorX, topAnchorY); Tweak &lt;chosen_value&gt;s so they make your view work exactly as intended. I hope it's all clear, let me know if something isn't. Also just pls let me know if changing the joint type helps with your issues.
answers question: http://stackoverflow.com/q/27551346
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43561926
type: Answer
has comment: http://stackoverflow.com/comment/44321565

http://stackoverflow.com/comment/43550243
type: QuestionComment
has text: also, I'd advise (while debugging) to use in the `SimpleDateFormat` ZZZZ as well, to see the timezone it uses. In my case, your date format returns correctly for my timezone.
comment on: http://stackoverflow.com/q/27562142
score: 0
type: Comment

http://stackoverflow.com/a/27612732
has comment: http://stackoverflow.com/comment/43648172
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43648932
type: Answer
answers question: http://stackoverflow.com/q/27612495
has comment: http://stackoverflow.com/comment/43648307
has comment: http://stackoverflow.com/comment/43648267
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27612495
has body: First thing to understand is that request have mainly two parts, the body and the headers. What the documentation you posted is saying, is that an annotation-less parameter, is ultimately the body of the request. You normally wouldn't send any entity body with a GET request, but for PUT and POST, there are put(Entity&lt;?&gt; entity) and post(Entity&lt;?&gt; entity), which Ivocation.Builder inherits from SyncInvoker. The Entity class has static methods from which we can form the entity body. For example // application/json data target.request().post(Entity.json(jsonStringDataOrPojo)); // application/xml data target.request().post(Entity.xml(xmlStringDataOrPojo)); // text/plain data target.request().post(Entity.entity(stringData, MediaType.TEXT_PLAIN)); // text/plain data target.request().post(Entity.text(stringData)); In you case, with String, you could actually send any one of these. Since you haven't specified @Consumes annotation on your resource method, it could be plain text xml or json. For xml and json, you would just get the data in raw form. If you had @POST @Consumes(MediaType.TEXT_PLAIN) public Response postString(String param){ Then you would need to send it plain text, i.e. one of the last of the above examples See more information on using the Client API
score: 1

http://stackoverflow.com/q/27584983
has body: I need to remove \s*,\s* but only when it's not between ". For example, this string a, b , c, "a, b , , c," a ,, should look like abc"a, b , , c," a. As I found out [^abc] means don't touch abc and \.* means everything so I tried this: str = str.replaceAll("[^\"\\.*,\\.*\"]\\s*,\\s*", ""); Important: amount of " is even.
has comment: http://stackoverflow.com/comment/43594537
has comment: http://stackoverflow.com/comment/43594667
has comment: http://stackoverflow.com/comment/43594683
score: 2
has comment: http://stackoverflow.com/comment/43594557
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43594705
type: Question
has title: Java regex replaceAll
has comment: http://stackoverflow.com/comment/43594548
answer count: 1
accepted answer: http://stackoverflow.com/a/27585089
has comment: http://stackoverflow.com/comment/43594607
favorite count: 0
upvote count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/27585089
tagged with: regex

http://stackoverflow.com/q/27597841
favorite count: 0
has answer: http://stackoverflow.com/a/27598170
score: 3
has comment: http://stackoverflow.com/comment/43619646
has comment: http://stackoverflow.com/comment/43619150
answer count: 4
accepted answer: http://stackoverflow.com/a/27598170
has title: Long.parseLong gives java.lang.NumberFormatException
downvote count: 1
has comment: http://stackoverflow.com/comment/43619215
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43619446
has comment: http://stackoverflow.com/comment/43619506
tagged with: java
has body: So I've tried a whole bunch of things, but I'm unable to get around this. id in my Service class is of data type long. I've tried to convert serviceAuth to long but it throws a java.lang.NumberFormatException. How do I fix this? String[] serviceList = getUser.serviceList.split(","); for(String serviceAuth: serviceList) { Long temp = Long.parseLong(serviceAuth.toString()); Criteria ctr = sessionFactory.getCurrentSession().createCriteria(Service.class) .add(Restrictions.eq("id",temp)); } serviceList looks like this 5,18,19. It is loaded from a csv file. When I print the values in the for loop, it looks like this: 1 2 14 15 Error report: java.lang.NumberFormatException: For input string: "" java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) java.lang.Long.parseLong(Long.java:601) java.lang.Long.parseLong(Long.java:631) org.x.y.gateway.MainController.getUsers(MainController.java:1433) org.x.y.gateway.MainController$$FastClassBySpringCGLIB$$6e5db2d9.invoke(&amp;lt;generated&amp;gt;) org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:266) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) org.x.y.gateway.MainController$$EnhancerBySpringCGLIB$$149bedb6.getUsers(&amp;lt;generated&amp;gt;) sun.reflect.NativeMe…
has answer: http://stackoverflow.com/a/27598128
has comment: http://stackoverflow.com/comment/43619693
has comment: http://stackoverflow.com/comment/43619156
has answer: http://stackoverflow.com/a/27598136
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/27597887
has answer: http://stackoverflow.com/a/27597887
has comment: http://stackoverflow.com/comment/43619205

http://stackoverflow.com/a/27575746
has body: Split off the content filter code to a separate method: private static boolean accept(File file) { // this is what I gather from your description boolean containsNull = false; boolean containsMA = false; try (Scanner scanner = new Scanner(file)) { while (scanner.hasNextLine()) { final String line = scanner.nextLine(); if (line.contains("DEBUG - null")) { containsNull = true; } if (line.contains("DEBUG - MA") || line.contains("INFO - MA")) { containsMA = true; } } return containsMA || !containsNull; } catch (FileNotFoundException e) { return false; } } Then to determine the most recent file that is acceptable, first sort the files and then feed them to the filter method one by one, stopping as soon as you find the first match: private static File recentLog(File directory) { File[] files = directory.listFiles(); // sort Arrays.sort(files, new Comparator&lt;File&gt;() { @Override public int compare(File f1, File f2) { // reverse comparison, looking for the highest value of lastModified return -Long.compare(f1.lastModified(), f2.lastModified()); } }); // find first acceptable file for (File file : files) { if (accept(file)) { return file; } } // no acceptable files found return null; }
accepted answer of: http://stackoverflow.com/q/27571707
answers question: http://stackoverflow.com/q/27571707
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43628899

http://stackoverflow.com/q/27521672
has comment: http://stackoverflow.com/comment/43472866
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27522099
tagged with: java
has comment: http://stackoverflow.com/comment/43473077
has title: How autowired RedisTemplate<String,Long>
has answer: http://stackoverflow.com/a/34032390
type: Question
upvote count: 12
linked to: http://stackoverflow.com/q/47449006
score: 12
has comment: http://stackoverflow.com/comment/43472728
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/42549597
linked to: http://stackoverflow.com/q/40695893
accepted answer: http://stackoverflow.com/a/27522099
has answer: http://stackoverflow.com/a/49966252
tagged with: redis
has body: I want to use RedisTemplate on spring boot. I can use StringRedeisTemplate successfully, but when i cant use RedisTemplate . here is the code. @Service public class MyService { @Autowired private RedisTemplate&lt;String, Long&gt; template; public void execute() { template.opsForValue().set("hoge", 1l); } } But, when start apps, get errors. &gt; Exception in thread "main" &gt; org.springframework.beans.factory.BeanCreationException: Error &gt; creating bean with name 'MyService': Injection of autowired &gt; dependencies failed; nested exception is &gt; org.springframework.beans.factory.BeanCreationException: Could not &gt; autowire field: private &gt; org.springframework.data.redis.core.RedisTemplate &gt; org.hoge.service.MyService.template; nested exception is &gt; org.springframework.beans.factory.NoSuchBeanDefinitionException: No &gt; qualifying bean of type &gt; [org.springframework.data.redis.core.RedisTemplate] found for &gt; dependency: expected at least 1 bean which qualifies as autowire &gt; candidate for this dependency. Dependency annotations: &gt; {@org.springframework.beans.factory.annotation.Autowired(required=true)} &gt; at &gt; org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) &gt; at &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202) &gt; at &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) &gt; at &gt; org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) &gt; at &gt; org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) &gt; at &gt; org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistr…
tagged with: spring
answer count: 4
possible better answer: http://stackoverflow.com/a/34032390

http://stackoverflow.com/comment/99494760
comment on: http://stackoverflow.com/a/27569704
type: AnswerComment
score: 0
type: Comment
has text: Seems distributable attribute must be in web.xml in order for persistent-sessions to work. Using Wildfly 16 and Keycloak 5 with Elytron. Thought distributable only applied to domain/cluster setups, but apparently it applies to standalone setup too. Note: session persistence on single server mode (non clustered) worked in GlassFish without distributable...

http://stackoverflow.com/q/27571887
has comment: http://stackoverflow.com/comment/43624744
has title: Configuring Spring Batch with java. Exception: DataSource is null
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43570721
answer count: 0
tagged with: java
type: Question
tagged with: configuration
tagged with: datasource
tagged with: spring-batch
has body: I created a SpringBatch application with java configuration. I have a main method and a class that represents a job. @ComponentScan @EnableAutoConfiguration public class App { public static void main( String[] args ) { System.out.println( "Starting Spring Batch Execution -------" ); SpringApplication.run(App.class, args); } } @Configuration @EnableBatchProcessing public class FlatFileJob { @Autowired private JobBuilderFactory jobs; @Autowired private StepBuilderFactory steps; /** * Create and configure job * @return */ @Bean(name = "Read RabbitMQ") public Job addFlatFileJob(){ return jobs.get("carJob") .start(this.flatFileStep()) .build(); } /** * Create and configure the only step * @return */ @Bean public Step flatFileStep(){ return steps.get("step") .&lt;Car, Car&gt; chunk(3) .reader(new CarItemReader()) .processor(new CarItemProcessor()) .writer(new CarItemWriter()) .build(); } @Bean public PlatformTransactionManager transactionManager(){ return new ResourcelessTransactionManager(); } @Bean public JobRepository jobRepository() throws Exception{ JobRepository jobRepository = (JobRepository) new JobRepositoryFactoryBean(); return jobRepository; } @Bean public JdbcTemplate jdbcTemplate(DataSource dataSource){ return new JdbcTemplate(dataSource); } @Bean public DataSource getDataSource(){ BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.postgresql.Driver"); dataSource.setUrl("jdbc:postgresql://127.0.0.1:5432/spring_batch"); dataSource.setUsername("xxx"); dataSource.setPassword("xxx"); return dataSource; } } When I execute this, I got an exception. Caused by: java.lang.IllegalArgumentException: DataSource must not be null. at org.springframework.util.Assert.notNull(Assert.java:112) at org.springframework.batch.core.repository.support.JobRepositoryFactoryBean.afterPropertiesSet(JobRepositoryFactoryBean.java:171) at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean.getObject(AbstractJobRepositoryFac…
score: 0

http://stackoverflow.com/a/27546765
score: 2
answers question: http://stackoverflow.com/q/27545996
has body: Hey you can use this method for sending image to server public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; public static JSONObject sendJSONDataWithImage() { String Content = null; DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://192.168.8.84:8003/savetofile.php"); File file = new File(yourFilePathwithfileName); MultipartEntity reqEntity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); Charset chars = Charset.forName("UTF-8"); int size = (int) file.length(); byte[] bytes = new byte[size]; ByteArrayBody bab = null; try { BufferedInputStream buf = new BufferedInputStream( new FileInputStream(file)); buf.read(bytes, 0, bytes.length); buf.close(); bab = new ByteArrayBody(bytes, yourFilePathwithfileName); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { // reqEntity.addPart("user_id", new StringBody(otherParameter,chars)); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); } reqEntity.addPart("myFile", bab); httpPost.setEntity(reqEntity); // execute HTTP post request HttpResponse response; try { response = httpClient.execute(httpPost); BufferedReader reader = new BufferedReader(new InputStreamReader( response.getEntity().getContent(), "UTF-8")); StringBuilder s = new StringBuilder(); String sResponse; while ((sResponse = reader.readLine()) != null) { s = s.append(sResponse); } json = s.toString(); System.out.println("Response.............: " + json); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { jObj = new JSONObject(json); Log.e("add emp with img Response", "&gt; " + json.toString()); } catch (JSONException e) { Log.e("JSON Parser", "Error parsing data " + e.toString()); } return jObj; } }
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/27551517
has title: How remove popup of basic authentication
tagged with: basic-authentication
tagged with: spring
has answer: http://stackoverflow.com/a/34474096
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has body: Does anybody know how to 'hide' popup message from basic authentication without removing possibility to login in the next way: 'http://username:password@example.com/'
upvote count: 1
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/27551662
type: UnansweredQuestion

http://stackoverflow.com/a/27580441
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27580278
accepted answer of: http://stackoverflow.com/q/27580278
has body: The problem with your code is that the fields (not shown) obviously are static, as can be told from your constructor: public State(int parentStateID, int stateID, int[][] board, int[] pieces, int points, int acquiredPoints){ State.parentStateID = parentStateID; State.stateID = stateID; State.currentBoard = cloneMatrix(board); //here takes place the matrix cloning State.currentPieces = cloneArray(pieces); //here takes place the array cloning State.totalPoints = points; State.acquiredPoints = acquiredPoints; } The constructor should instead read like this: public State(int parentStateID, int stateID, int[][] board, int[] pieces, int points, int acquiredPoints){ this.parentStateID = parentStateID; this.stateID = stateID; this.currentBoard = cloneMatrix(board); //here takes place the matrix cloning this.currentPieces = cloneArray(pieces); //here takes place the array cloning this.totalPoints = points; this.acquiredPoints = acquiredPoints; } A field which is static exists only once per class. A field which is not static exists once per each object constructed from that class (or any subclass). Because of that, you actually created objects which are empty, and whatever you thought you would store in the object you actually stored in the class, thus sharing the same data among all objects. As a rule of thumb, you usually do not want any static non-final fields in your classes. Exceptions apply, but they're rare and mostly limited to a few tiny bootstrapping things in frameworks.
type: AcceptedAnswer

http://stackoverflow.com/q/27551784
has answer: http://stackoverflow.com/a/27552880
has comment: http://stackoverflow.com/comment/43529992
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43529998
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43530086
has comment: http://stackoverflow.com/comment/43529776
tagged with: properties
has title: Can't write this method?
tagged with: java
has answer: http://stackoverflow.com/a/27552001
upvote count: 1
has body: I need to create a pizza ordering system. I have created a array list of pizza toppings and each pizza topping must have a cost property associated with it, then the user can pick the toppings they want and the cost of each topping will be added up and the total cost of the whole pizza will be displayed. But I don't know how to associate a cost with each topping. I have been told that I can access the cost through a get/set method and store it in a private member variable. But I don't know how to do this? I've also been told that the Pizza class should have a special method to add toppings. After a Pizza object is created, that method would be called repeatedly to add whatever toppings are to be added to the pizza. The Topping class could have the name and cost for the topping. But I don't know how I would write this method... My arrayList is as follows: private List&lt;String&gt; Toppings = new ArrayList&lt;String&gt;(); public void arrayList(){ Toppings.add("Pepperoni"); Toppings.add("Chicken"); Toppings.add("Ham"); Toppings.add("Onion"); } Can anyone help as this is a major stumbling block that I can't overcome?
tagged with: methods
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43529793

http://stackoverflow.com/q/27518480
answer count: 2
has title: Java Process return permission denied only sometime.
score: 0
has comment: http://stackoverflow.com/comment/43466952
tagged with: bash
has body: I am running a shell script from Java. it work most of the time, but occasionally it raise exception "permission denied" PrintWriter writer = new PrintWriter(folder + cmdFile, "UTF-8"); writer.println("#!/bin/bash"); writer.println(commandLine.toString()); writer.close(); Process processUtil = Runtime.getRuntime().exec("/bin/chmod +x " + folder + cmdFile ); Process process = Runtime.getRuntime().exec(folder + "./" + cmdFile); try { int processResponseCode = processUtil.waitFor(); processUtil = Runtime.getRuntime().exec("sleep 0.1s"); processResponseCode = processUtil.waitFor(); processResponseCode = process.waitFor(); processUtil = Runtime.getRuntime().exec(" rm " + folder + cmdFile); processResponseCode = processUtil.waitFor(); The exception java.io.IOException: Cannot run program "/tmp/./cmd755784": error=13, Permission denied any idea what could be causing this ?
has answer: http://stackoverflow.com/a/27518626
has comment: http://stackoverflow.com/comment/43466891
type: UnansweredQuestion
tagged with: process
type: Question
has answer: http://stackoverflow.com/a/29601672
has comment: http://stackoverflow.com/comment/43466869
tagged with: java
has comment: http://stackoverflow.com/comment/43467005

http://stackoverflow.com/a/27522549
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43474397
accepted answer of: http://stackoverflow.com/q/27522447
has body: It's not possible (assuming Foo and Bar have no common super class other than Object and no common interface). The reason: Suppose it was possible : List&lt;Foo|Bar&gt; list = new ArrayList&lt;Foo|Bar&gt;(); list.add(new Foo());//Allow list.add(new Bar());//Allow Now, what type would list.get(0) return? Neither of these two lines can pass compilation, since list.get(0) can't be of both types: Foo foo = list.get(0); Bar bar = list.get(0); This means the only thing that can compile would be : Object obj = list.get(0); and that has no advantage over using the raw List type.
answers question: http://stackoverflow.com/q/27522447
downvote count: 0

http://stackoverflow.com/comment/43713288
has text: Thanks a lot for your detailed solution. I tried your idea step by step, but it did not work. when I launch the app, still the result is: 'F:\nxf-work\newapp>sbt Getting org.scala-sbt sbt 0.13.7 ...' and download a lot of things very slowly. Is it a normal state?
type: Comment
comment on: http://stackoverflow.com/a/27640805
score: 0
type: AnswerComment

http://stackoverflow.com/q/27602171
tagged with: payment-gateway
tagged with: java
has body: I am implementing the paymentGateway for the Citrus in my android app. I am getting below error in console. 12-22 17:13:03.041: I/chromium(13772): [INFO:CONSOLE(12)] "Uncaught ReferenceError: paymentResponse is not defined", source: http://www.palamsilk.com/Webservice/PayResponseIOS.aspx (12) Below is code of my Webview : private WebView loadwebview; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.netpayscreen); initScreen(); String url = getIntent().getStringExtra("URL"); startWebView(url); } private void initScreen() { // TODO Auto-generated method stub loadwebview = (WebView) findViewById(R.id.webView1); } private void startWebView(String url) { // Create new webview Client to show progress dialog // When opening a url or click on link loadwebview.setWebViewClient(new WebViewClient() { ProgressDialog progressDialog; // @Override // public void onPageStarted(WebView view, String url, Bitmap // favicon) { // super.onPageStarted(view, url, favicon); // // if (progressDialog == null) { // // in standard case YourActivity.this // progressDialog = new ProgressDialog(NetPayActivity.this); // progressDialog.setMessage("Loading..."); // progressDialog.show(); // } // } // If you will not use this method url links are opeen in new brower // not in webview public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } // Show loader on url load public void onLoadResource(WebView view, String url) { if (progressDialog == null) { // in standard case YourActivity.this progressDialog = new ProgressDialog(NetPayActivity.this); progressDialog.setMessage("Loading..."); progressDialog.show(); } } public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); try { if (progressDialog.isShowing()) { progressDialog.dismiss(); progressDialog = null; } } catch (Exceptio…
score: 0
has title: Payment Gateway in Android
answer count: 1
tagged with: android
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/27602418

http://stackoverflow.com/a/27611977
score: -3
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/43648536
has comment: http://stackoverflow.com/comment/43653153
answers question: http://stackoverflow.com/q/27611108
downvote count: 3
has comment: http://stackoverflow.com/comment/43647159
has body: I have just examined DigestUtils class , there is a try-catch handle for NoSuchAlgorithmException. You can check in here. You are missing throws declaration or try-catch block to handle exception. The error should be compilation error. If it's not a compilation error check the "MD5" string typo. For compilation error , Try to surrond your code with try-catch block. try { MessageDigest md = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } Or add your method throws declaration. public static void main(String[] args) throws NoSuchAlgorithmException {
has comment: http://stackoverflow.com/comment/43646633

http://stackoverflow.com/q/27598014
has body: I have some web application that uses Spring-security and deployed in Tomcat7. In tomcat there are two connectors (8080, 8081). I want to share part of my application and give access to requests like ${ip}:8080/${servercontext}/resource and secure the rest of application by this port, i.e. deny requests like ${ip}:8080/${servercontext}/otherresource. But requests like ${ip}:8081/${servercontext}/otherresource must be accessible (8081 port). How can I do it ?
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/43662606
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27599157
tagged with: spring-mvc
tagged with: java
type: Question
has title: How can I use port number in securing web request
answer count: 1

http://stackoverflow.com/comment/43585255
comment on: http://stackoverflow.com/a/27580450
has text: So how do I pass an attribute from servlet a to servlet b? I haven't changed much in web.xml, but the forward IS WORKING ( but the request attribute isn't)
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43398705
has text: Ok. how do i do it using cookies ??
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27482634
type: Comment

http://stackoverflow.com/q/27543771
tagged with: java
tagged with: spring-data
has title: Best way of handling entities inheritance in Spring Data JPA
has comment: http://stackoverflow.com/comment/43525029
type: Question
has answer: http://stackoverflow.com/a/27549198
has body: I've three JPA entity classes A, B and C with the following hierarchy: A | +---+---+ | | C B That is: @Entity @Inheritance public abstract class A { /* ... */ } @Entity public class B extends A { /* ... */ } @Entity public class C extends A { /* ... */ } Using Spring Data JPA, what is the best way to write repositories classes for such entities? I know that I can write these: public interface ARespository extends CrudRepository&lt;A, Long&gt; { } public interface BRespository extends CrudRepository&lt;B, Long&gt; { } public interface CRespository extends CrudRepository&lt;C, Long&gt; { } but if in the class A there is a field name and I add this method in the ARepository: public A findByName(String name); I've to write such method also in the other two repositories, and this is a bit annoying.. Is there a better way to handle such situation? Another point I would like to have is that ARespository should be a read-only repository (i.e. extend the Repository class) while the other two repositories should expose all the CRUD operations. Let me know possible solutions.
accepted answer: http://stackoverflow.com/a/27549198
answer count: 1
has comment: http://stackoverflow.com/comment/79184515
tagged with: spring-data-jpa
score: 50
has comment: http://stackoverflow.com/comment/43524870
favorite count: 0
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
downvote count: 0
upvote count: 50

http://stackoverflow.com/q/27587569
accepted answer: http://stackoverflow.com/a/27587587
has answer: http://stackoverflow.com/a/27587634
tagged with: jtable
type: AnsweredQuestion
tagged with: sql
downvote count: 0
has body: I have made a project on railway management system and want to insert values from text fields and Java table to MySQL database. How can I get rid of this error? Please help!! int rows = jTable1.getRowCount(); for(int row = 0; row&lt;rows ; row++){ int index=1; String S_No = (String) jTable1.getValueAt(row, 1); String Name = (String) jTable1.getValueAt(row, 2); String Age = (String) jTable1.getValueAt(row, 3); String Gender = (String) jTable1.getValueAt(row, 4); String berth_preference = (String) jTable1.getValueAt(row, 5); String Quota = (String) jTable1.getValueAt(row, 6); String tno =(String) cb1.getSelectedItem(); String tname =(String) cb2.getSelectedItem(); String clas =(String) cb3.getSelectedItem(); String tic= tick.getText(); String frms=frm.getText(); String tos=to.getText(); String boarding=bp.getText(); String reser=ru.getText(); String jdate=date.getText(); String pnr=l1.getText(); try{ Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/railway","root","ridhi"); st =con.prepareStatement("INSERT INTO pnr(pnr_no,Train_Number,Train_Name,From_m,T_o,Date,Class,Reserved_Upto,Boarding_Pt,no_tickets,S_No,Name,Age,Gender,berth_preference,Quota) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); st.setString(1, S_No); st.setString(2, Name); st.setString(3, Age); st.setString(4, Gender); st.setString(5, berth_preference); st.setString(6, Quota); st.executeUpdate(); index++; this.setVisible(true); new payment().setVisible(true); } catch(Exception e){ JOptionPane.showMessageDialog(null,e.getMessage()); } } Error: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 6 &gt;= 6 at java.util.Vector.elementAt(Vector.java:427) at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277) at javax.swing.JTable.convertColumnIndexToModel(JTable.java:2553) at javax.swing.JTable.getValueAt(JTable.java:2695) at reservation.reservationActionPerformed(reservation.java:341) at reservation.access$1…
possible better answer: http://stackoverflow.com/a/27587634
favorite count: 0
type: Question
has title: ArrayIndexOutOfBoundsException inserting JTable data to SQL database
score: 3
tagged with: jdbc
has answer: http://stackoverflow.com/a/27587587
upvote count: 3
answer count: 2
tagged with: java

http://stackoverflow.com/comment/60574471
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27596141
has text: Good answer. Worked for me.
type: AnswerComment

http://stackoverflow.com/comment/43505489
type: Comment
type: QuestionComment
has text: I see nothing wrong with "failing early" here by throwing an `IllegalArgumentException`, especially as passing `null` would be invalid. I'd probably consider using the version of `IllegalArgumentException` that takes a `String` to describe what went wrong though. If shuffle were a method of the Deck class that would remove any need to check for nulls.
score: 4
comment on: http://stackoverflow.com/q/27538706

http://stackoverflow.com/comment/43730688
comment on: http://stackoverflow.com/a/27594253
score: 0
type: AnswerComment
type: Comment
has text: jetty-runner.jar is *NOT* an embedded jetty server. It is a testing and QA only convenience to execute the most bare boned and simplistic *NON-PRODUCTION* environments to get people comfortable with Jetty and eventually move into the distribution (which *USES* a proper Jetty Embedded setup via XML) or a true Jetty Embedded of your own design.

http://stackoverflow.com/q/27622438
type: Question
answer count: 2
has body: I am trying to write a class, that has exportToString and importFromString methods. ExportToString serializes this class to JSON string: public String exportToString() { Gson gson = new Gson(); String json = gson.toJson(this); return json; } I need to write importFromString(String str). The problem is that "this" variable is final and I can't reassign this value completely. This is what I have: public void importFromString(String str) { Gson gson = new Gson(); Object obj = gson.fromJson(str, this.getClass()); this = (PlayerData) obj; // ERROR: cannot assign value to final variable this } P.S. Sorry for my english
has comment: http://stackoverflow.com/comment/43665534
has answer: http://stackoverflow.com/a/27622496
has comment: http://stackoverflow.com/comment/43665463
upvote count: 1
tagged with: this
has comment: http://stackoverflow.com/comment/43665388
favorite count: 0
tagged with: serialization
tagged with: final
accepted answer: http://stackoverflow.com/a/27622517
has title: Java self unserialization
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43665506
downvote count: 0
possible better answer: http://stackoverflow.com/a/27622496
score: 1
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/27622517

http://stackoverflow.com/comment/43526742
type: Comment
score: 2
has text: The bug report is wrong and what it describes is impossible. A listening socket can be bound to either one IP address or all of them: nothing else.
comment on: http://stackoverflow.com/q/27548406
type: QuestionComment

http://stackoverflow.com/a/27536251
has comment: http://stackoverflow.com/comment/43500978
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27536250
has body: /* A method that will only accept a parameter that : extends SomeClass , AND implements SomeInterface . */ private &lt; T extends SomeClass &amp; SomeInterface &gt; void someMethod ( T parameter ) { // do something ... }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43501531

numbers
tags question: http://stackoverflow.com/q/27571474
tags question: http://stackoverflow.com/q/27497903
tags question: http://stackoverflow.com/q/27591028
tags question: http://stackoverflow.com/q/27575159
tags question: http://stackoverflow.com/q/27556855
tags question: http://stackoverflow.com/q/27503872
tags question: http://stackoverflow.com/q/27505055
tags question: http://stackoverflow.com/q/27516786
type: Tag
tag name: numbers

http://stackoverflow.com/comment/43610069
score: 0
comment on: http://stackoverflow.com/q/27593126
type: Comment
type: QuestionComment
has text: You can have 2 such arrays, and use System.arrayCopy from one to another. You still get the speed, and if you re-use the arrays you don't hog the GC. Looping here might be too slow for a game (depends on board size).

http://stackoverflow.com/q/27635989
has comment: http://stackoverflow.com/comment/43699064
has comment: http://stackoverflow.com/comment/43691727
type: Question
has comment: http://stackoverflow.com/comment/43700011
has comment: http://stackoverflow.com/comment/43700809
downvote count: 0
favorite count: 0
tagged with: struts2
has title: Is it possible to pass a from struts.xml as hidden parameter?
has body: I wondered if it is possible to pass a hidden parameter to an action defining it inside struts.xml. I've read the struts.xmlDocument Type Definition HERE and it seems that it's not supported. I need to pass an user's name and surname from an action to another and I don't want this two parameters to appear on the URL (I seek a POST request but from struts.xml I only know how to send GET ones). Another option would be to send them programmatically form my action's code, but I can't use any <s:form/> as I'm not calling it from any JSP, so it has to be done straight from the action's java code. My current struts.xml action code looks like this (parameters showing on URL): ${name} ${surname} success.jsp EDIT - Clarifying my question: I want to archieve the same thing you can archieve using a <s:form/>with hidden parameters like this: <s:form theme="simple" action="myAction"> <s:hidden name="name"/> <s:hidden name="surname"/> <s:submit value="%{'Submit'}"/> </s:form> That would trigger myAction and pass through the two parameters, nameand surnamebut the user would not be able to see those parameters.
has comment: http://stackoverflow.com/comment/43700977
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43692599
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43691498

http://stackoverflow.com/q/27493504
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: selenium
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43418695
has comment: http://stackoverflow.com/comment/43418971
answer count: 2
has answer: http://stackoverflow.com/a/27493596
has title: Have to add Selenium jar after every pull from Git
has body: This is likely my limited understanding of the workings of Git but I have a private remote repository that I use just for myself between 3 different machines. I'm using Netbeans 8.0.2 with selenium-server-standalone-2.44.0.jar on each machine. If I commit a file to the remote repository from one machine and pull it down on another, I have to add the selenium jar file to the libraries folder manually each time. Surely there's a way that I can keep my project configuration? I'm sure this is just something I haven't learned yet but would appreciate some direction or instruction. Any suggestions?
favorite count: 0
possible better answer: http://stackoverflow.com/a/27493632
accepted answer: http://stackoverflow.com/a/27493596
has answer: http://stackoverflow.com/a/27493632
tagged with: git

http://stackoverflow.com/comment/43438522
has text: Thanks! Works now, I have downloaded from repo.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27503760

http://stackoverflow.com/q/27478272
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27478327
has comment: http://stackoverflow.com/comment/43390218
has comment: http://stackoverflow.com/comment/43390192
tagged with: java
possible better answer: http://stackoverflow.com/a/27478326
has answer: http://stackoverflow.com/a/27478326
type: Question
score: 5
has title: And bitwise operation gets negative value
upvote count: 5
accepted answer: http://stackoverflow.com/a/27478327
answer count: 3
has comment: http://stackoverflow.com/comment/43390217
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43390226
has answer: http://stackoverflow.com/a/27478442
has body: I have this code: int code = 0x92011202; int a = (code &amp; 0xF0000000) &gt;&gt; 28; int b = (code &amp; 0x0F000000) &gt;&gt; 24; // .. int n = (code &amp; 0x0000000F); But if most significant bit of code is equal to 1 (from 9 to F) a comes negative value. All other variables works fine. Why this happen?
linked to: http://stackoverflow.com/q/1049722
linked to: http://stackoverflow.com/q/2811319
has comment: http://stackoverflow.com/comment/43390204

http://stackoverflow.com/q/27621939
downvote count: 0
has comment: http://stackoverflow.com/comment/43665345
favorite count: 0
has answer: http://stackoverflow.com/a/29583798
upvote count: 2
tagged with: scala
tagged with: swing
accepted answer: http://stackoverflow.com/a/27623634
possible better answer: http://stackoverflow.com/a/29583798
has title: Type mismatch error when adding Label to Scala Swing Panel
linked to: http://stackoverflow.com/q/29558983
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43664445
has comment: http://stackoverflow.com/comment/43665215
type: Question
has body: I have this Class extending FlowPanel and I'm trying to add Labels into it: import java.awt.{Label, Color} import scala.swing._ import scala.util.Random class MyPanel extends FlowPanel{ val dimension = new Dimension(600,400) maximumSize = dimension minimumSize = dimension preferredSize = dimension foreground = Color.white background = Color.LIGHT_GRAY def drowLabels(size: Int) = { for(i &lt;- 0 until size){ contents += new Label() revalidate(); repaint(); } } But I get an error message: type mismatch; found : java.awt.Label required: scala.swing.Component contents += new Label() ^ But for example if I change new Label() to new Button(), everything works fine. Actually I can't add Label to any kind of container, there are always some errors. I have been trying to find answer for an hour, but without succeed.
answer count: 2
tagged with: jpanel
tagged with: label
has answer: http://stackoverflow.com/a/27623634

http://stackoverflow.com/q/27477472
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27477497
tagged with: java
score: -1
type: Question
possible better answer: http://stackoverflow.com/a/27477497
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/27477484
favorite count: 0
has comment: http://stackoverflow.com/comment/43388802
has body: I keep getting this error message: Error: Syntax error, insert ". class" to complete ArgumentList How should I fix it? inserting other words because stackoverflow won't let me post this otherwise import java.util.Scanner; import java.io.*; public class javahw5_11 { public static void main(String [] args) { Scanner keyboard = new Scanner(System.in); int saleData[] = new int[5]; System.out.print("How many shares are you buying?"); saleData[0] = keyboard.nextInt(); System.out.print("What is the purchase price per share?"); saleData[1] = keyboard.nextInt(); System.out.print("How much was the sales price per share?"); saleData[2] = keyboard.nextInt(); System.out.print("How much is the purchase commission?"); saleData[3] = keyboard.nextInt(); System.out.print("How much was the sales commission?"); saleData[4] = keyboard.nextInt(); double profit = getProfit(saleData[]); System.out.print("Your profit is "+profit); keyboard.close(); } public static double getProfit(int saleData[]) { double profit = (((saleData[0]*saleData[2])-saleData[4])-((saleData[0]*saleData[1])+saleData[3])); return profit; } }
downvote count: 2
has answer: http://stackoverflow.com/a/27477484
has comment: http://stackoverflow.com/comment/43388793
has title: Eclipse Error "Syntax error, insert ". class" to complete ArgumentList"
has answer: http://stackoverflow.com/a/27477524

http://stackoverflow.com/q/27486509
downvote count: 0
favorite count: 0
tagged with: android
has body: i want to save the settings from my game(bgMusic, sounds and vibration) but while loading the app crashes when starting. The code is: private SharedPreferences preferences; private SharedPreferences.Editor editor; private boolean bgMusicToggleState, soundToggleState, vibratorToggleState; ... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); dialog.getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); dialog.setContentView(R.layout.pause_dialog); dialog.hide(); initDialog(); this.preferences = this.getSharedPreferences(GAME_NAME, MODE_PRIVATE); this.editor = preferences.edit(); ... } ... public void saveMusicSettings(){ editor.putBoolean("bgMusicToggleState", bgmusic_toggle.isChecked()); editor.commit(); } public void saveVibratorSettings(){ editor.putBoolean("vibratorToggleState", vibrateToggle.isChecked()); editor.commit(); } public void saveSoundSettings(){ editor.putBoolean("soundToggleState", sounds_toggle.isChecked()); editor.commit(); } ... private void initDialog(){ /// The App crashes here bgMusicToggleState = preferences.getBoolean("bgMusicToggleState", false); continue_Button = (Button) dialog.findViewById(R.id.continue_button); restart_Button = (Button) dialog.findViewById(R.id.restart_button); exit_Button = (Button) dialog.findViewById(R.id.exit_button); continue_Button.setOnClickListener(pauseClick); exit_Button.setOnClickListener(pauseClick); restart_Button.setOnClickListener(pauseClick); bgmusic_toggle = (ToggleButton) dialog.findViewById(R.id.backgroundsound_toggle); bgmusic_toggle.setChecked(bgMusicToggleState); bgmusic_toggle.setOnClickListener(toggleClickListener); sounds_toggle = (ToggleBu…
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43404818
upvote count: 1
accepted answer: http://stackoverflow.com/a/27486543
type: Question
has answer: http://stackoverflow.com/a/27486543
has title: Android App crash while loading SharedPreferences 'getBoolean'
answer count: 1

http://stackoverflow.com/comment/47212413
has text: Thanks, i derped a bit there.
type: Comment
comment on: http://stackoverflow.com/a/27583458
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43636670
comment on: http://stackoverflow.com/q/27607188
score: 0
has text: The javadoc is usually helpful in understanding what exceptions mean: http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html
type: Comment
type: QuestionComment

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/27634161
tags question: http://stackoverflow.com/q/27511216
type: Tag
tags question: http://stackoverflow.com/q/27514668

http://stackoverflow.com/comment/43557082
comment on: http://stackoverflow.com/a/27566050
has text: I can read the file by changing its position, however I shouldn't do that.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/87627942
has text: Hello..I did not modify the wordings of my question...I just explained it more in the addendum...I am really not sure what your ask is? There is no correlation between your answer and the question...as for 4 years..you commented recently on an old thread asking me to explain the downvote
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27561025

http://stackoverflow.com/comment/82221521
type: QuestionComment
has text: Sorry @csharpnewbie, but it's been a while since this answer and I'm now even doing the same job. Anyway, the configuration of the server was in hands of the customer's IT service and they handled the issue. I'm sorry I can't help you out any more...
comment on: http://stackoverflow.com/q/27505954
score: 0
type: Comment

http://stackoverflow.com/comment/43515248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27544196
score: 0
has text: and @Reimeus means this - `object2.notify();`. Also, it is better to *handle InterruptedException* instead of *throwing* it..

http://stackoverflow.com/comment/43581124
comment on: http://stackoverflow.com/q/27578118
has text: yes...i want to return remaining_amount whenever this method is called..
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43439433
comment on: http://stackoverflow.com/a/27502856
score: 0
type: AnswerComment
has text: and you're sure that you generate a debug build when trying to test it, and not a release build? I'd also make sure to double check the gradle files.
type: Comment

http://stackoverflow.com/q/27500499
type: AnsweredQuestion
has title: How exactly does the instanceof method work? and why is it not working in my code shown below?
has answer: http://stackoverflow.com/a/27500607
tagged with: instanceof
has answer: http://stackoverflow.com/a/27500793
type: Question
possible better answer: http://stackoverflow.com/a/27500579
has answer: http://stackoverflow.com/a/27500579
has answer: http://stackoverflow.com/a/27500585
score: 0
tagged with: java
answer count: 5
linked to: http://stackoverflow.com/q/2551337
has answer: http://stackoverflow.com/a/27500545
duplicate of: http://stackoverflow.com/q/2551337
tagged with: inheritance
has comment: http://stackoverflow.com/comment/43431440
accepted answer: http://stackoverflow.com/a/27500545
has comment: http://stackoverflow.com/comment/43431642
has body: So i have defined the main class to be shown below and i have defined a words class and a sentence class. Note the program should return false when ran. However, i am getting a "Incompatible conditional operand types words and sentence" error when i run it. Isn't this how the instanceof operator is to be used or am i confused? How can my program be modified to run without crashing? public class main{ public static void main (String[] args){ words example = new words("heyo"); sentence ex = new sentence("wats up dog"); System.out.println(example instanceof sentence); } }

http://stackoverflow.com/comment/43699199
comment on: http://stackoverflow.com/q/27640256
type: Comment
type: QuestionComment
score: 1
has text: you can use them straightforward. Just store there bits of your data

http://stackoverflow.com/comment/43654491
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27608646
type: Comment
has text: My HTML page is running at http://localhost:8080/WSE_Web/ and when clicking the action form I'm hitting http://localhost:8080/WSE_Web/QueryServlet so everything should be fine.

http://stackoverflow.com/comment/43485940
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27528160
type: AnswerComment
has text: Tu parles de tableaux HTML ?

http://stackoverflow.com/comment/43529767
type: Comment
has text: Basically the context refers to the application context. If you are in an activity, passing `this` as the first argument should do it.
comment on: http://stackoverflow.com/q/27551692
score: 0
type: QuestionComment

http://stackoverflow.com/comment/69271142
type: Comment
comment on: http://stackoverflow.com/a/27604536
has text: Saw this too. Still looking. All of these methods seem to want to edit/massage the current properties and pass them along. Command line and Java properties for running an application or service are akin to "Context" or "Configuration" setting. It would be better to have a plug-in that does things like "run parameters" as a side-by-side profiles or something.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43476494
has text: There is no error message coming in logs. Only TCP error is coming in browser.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27520145
score: 0

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/27511506
type: Tag

http://stackoverflow.com/q/27513489
has body: I'm making a java 2D online game. I use a tiledmap and I've been thinking about a way to prevent map hack. My idea is to send the player's map file (compressed) which contains all cells and collision cells to the server and to compare it with the original one (on the server). If they are equals, the player can connect. This way, the player can't remove collisions cells on their map. Is it a good idea ? Is there better alternatives ?
accepted answer: http://stackoverflow.com/a/27513675
has comment: http://stackoverflow.com/comment/43457266
favorite count: 0
downvote count: 2
upvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has title: How to prevent map hacking in MMO
has answer: http://stackoverflow.com/a/27513675
answer count: 1
tagged with: tiled

http://stackoverflow.com/comment/43661944
has text: Thanks @Mike,I will try. will AsyncTask update the progress of other views' progressBar which are not in view of screen.
type: Comment
comment on: http://stackoverflow.com/a/27620554
score: 0
type: AnswerComment

http://stackoverflow.com/q/27567185
has body: Here is the file MyRemoteImplement.java: import java.rmi.*; import java.rmi.server.*; //for UnicastRemoteObject public class MyRemoteImplement extends UnicastRemoteObject implements MyRemote { public String sayHello() { return "Remote server says hello"; } public MyRemoteImplement() throws RemoteException { ; } public static void main(String[] args) { try { MyRemote server = new MyRemoteImplement(); Naming.rebind("Remote Hello Server", server); } catch(Exception rex) { System.out.println("Error when registering server."); } } } I compiled this code to obtain MyRemoteImplement.class I then navigated to the directory containing the file MyRemoteImplement.class and ran the following command in command line(Windows XP): rmic MyRemoteImplement According to the text book I am following, both the stub code and the skeleton code must be generated in the same directory as a consequence of running the above command. But, I only the stub file MyRemoteImplement_stub.class is generated, not the skeleton code. Why is the skeleton code not generated? How to rectify it?
tagged with: rmi
tagged with: java
tagged with: stub
type: Question
answer count: 1
score: 0
has title: Why is the MyRemoteImplement_Skel.class not generated when rmic MyRemoteImplement is run in the terminal?
has answer: http://stackoverflow.com/a/27573529
type: UnansweredQuestion

memoization
type: Tag
tags question: http://stackoverflow.com/q/27549864
tag name: memoization

http://stackoverflow.com/a/27699890
answers question: http://stackoverflow.com/q/27612680
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43936303
has body: You could use a database, or setup a json/xml api on the PHP end, and access the database, or access the json/xml from Java with this example code to open the url. URL url = new URL("site.com/api/foo.json"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) { for (String line; (line = reader.readLine()) != null;) { System.out.println(line); } } You can look at this tutorial to parse JSON with Java.
has comment: http://stackoverflow.com/comment/43935172
score: 1
upvote count: 1

http://stackoverflow.com/a/27566357
has comment: http://stackoverflow.com/comment/43558466
has comment: http://stackoverflow.com/comment/43558563
type: Answer
score: 0
has body: Since your agent is Java anyway, you can save the trouble of spinning up a new class loader and jvm environment. Move the code into a jar and call it directly from the XPage. I can't think of a good reason to use the agent (because it was there isn't a good reason in this case)
has comment: http://stackoverflow.com/comment/43565493
has comment: http://stackoverflow.com/comment/43562398
answers question: http://stackoverflow.com/q/27564900

http://stackoverflow.com/comment/43603373
score: 0
type: QuestionComment
has text: this is launching error ...means you have not defined any of your `textview` or `button`(or any layout) in the xml file.
type: Comment
comment on: http://stackoverflow.com/q/27589439

http://stackoverflow.com/a/27526100
type: Answer
answers question: http://stackoverflow.com/q/27525053
downvote count: 0
has body: Previous Interface i was using public interface RetrofitInterface { // asynchronously with a callback @GET("/") Header getUser(@Query("user_id") int userId, Callback&lt;Header&gt; callback); } Modified Interface i am using and its working. public interface RetrofitInterface { // asynchronously with a callback @GET("/") void getUser(@Query("user_id") int userId, Callback&lt;Header&gt; callback); }
score: 3
upvote count: 3

http://stackoverflow.com/a/27567422
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27560783
has comment: http://stackoverflow.com/comment/43570774
score: 1
answers question: http://stackoverflow.com/q/27560783
has body: In PlayScreen's constructor, you create a mapStage which will have its own viewport and camera. Then you give that camera to the tiled map renderer. But then in show(), you create a new mapStage which will replace the reference that was created in the constructor. So when you are changing the camera in render(), it is the camera from the new stage, not the old camera that the tiled map renderer is still using. You'll want to avoid using new Stage(...) in the show method anyway, because then you'll be creating a new Stage every time the screen changes, which will waste time creating a new sprite batch (which takes up a lot of memory and compiles a shader each time). And the old stage that you replace each time will leak because it's not having dispose() called on it before its reference is lost. I'm not sure of your constraints, but one solution would be to revise your show method to this: public void show() { mapStage.setViewport(new FitViewport(mainFrame.SCREEN_WIDTH, mainFrame.SCREEN_HEIGHT)); otmr.setView((OrthographicCamera)mapStage.getCamera()); } A couple of other things... You should dispose of your stage in dispose() to avoid potential leaks (the sprite batch in the stage will leak a shader when the screen changes if you don't). And your camera movements should always involve multiplying by delta so the movement speed is framerate independent.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27501310
answers question: http://stackoverflow.com/q/27501221
has comment: http://stackoverflow.com/comment/43441686
upvote count: 1
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/43433033
has body: Method currentTimeMillis() returns the current time in milliseconds in long so convert long to string, and s.substring(5, s.length()) give you last 8 digit's of milliseconds those are always identical for each millisecond. public static void main(String[] args) { String s = String.valueOf(System.currentTimeMillis()); System.out.println(s.substring(5, s.length())); } You have to make sure that this string is available or not in your database each time.
score: 0

http://stackoverflow.com/q/27485351
has comment: http://stackoverflow.com/comment/43402806
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27485421
has body: A task has been set to use a recursive method inside a custom hashtable to find the next available place inside the array to store a key and a value. Starting at the startPos(which is the hashed value of the key), and incrementing the stepNo each time to keep track of the place, if it is occupied I have a method to find the next location depending on the probe type/number of steps taken so far. For some reason I am getting an over flow error. private int findEmpty(int startPos, String key, int stepNum) { if(arr[startPos] == null) return startPos; int next = getNextLocation(startPos, stepNum++, key); findEmpty( next ,key, stepNum); return startPos; } The below method takes finds the next location to check based on its probe type, it takes the startPos(hashed value of the key) the stepNo(to keep track of the steps after hashing to place) and the key its self. private int getNextLocation(int startPos, int stepNum, String key) { int step = startPos; switch (probeType) { case LINEAR_PROBE: step++; break; case DOUBLE_HASH: step += doubleHash(key); break; case QUADRATIC_PROBE: step += stepNum * stepNum; break; default: break; } return step % max; } Thanks any advice or criticism is welcome.
tagged with: hashtable
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: recursion
has title: StackOverFlow error recursion
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27565672
has comment: http://stackoverflow.com/comment/43557068
has comment: http://stackoverflow.com/comment/43556932
score: 2
has body: Complex Objects In general you may consider avoiding new for reasonably complex objects with non-trivial creation. You can consider some factory/builder which add versatility. For example if you create a big composite object it is good to use builder pattern. (Long example here) Simple Objects For simple objects (most common case) it is best to stick with new. For example if you have simple class public class Dog{ private string name; //getter + setter } Then it is an overkill to create factory for this and you should call it by new Dog() Dependency Injection In enterprise applications you commonly use dependency injection, which let's you avoid using new explicitly. You won't remove all object instantiations, but it provides nice improvement. (Basic Spring tutorial here)
downvote count: 0
has comment: http://stackoverflow.com/comment/43556412
answers question: http://stackoverflow.com/q/27565611
has comment: http://stackoverflow.com/comment/43556519
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43467548
score: 0
type: QuestionComment
type: Comment
has text: How sure are you the query is correct? If you replaced the parameters parts with the just hard coded values do you get what you would expect?
comment on: http://stackoverflow.com/q/27518666

http://stackoverflow.com/comment/43624395
type: QuestionComment
has text: Show us some code ! What have you tried ?
score: 1
comment on: http://stackoverflow.com/q/27600856
type: Comment

http://stackoverflow.com/q/27501996
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43434678
has comment: http://stackoverflow.com/comment/43434406
type: Question
upvote count: 2
answer count: 2
has body: I have a method which should find a number of appearances of following words combination in array. This method is re-written in Java from C# code i've made but it performs 50 times slower which makes me think i don't know much in Java internals to properly translate it. This is the Java code: private Map&lt;String, Long&gt; WeightWords(Map&lt;Sentence, Long&gt; wordsWithWeight) { Map&lt;String, Long&gt; newWordsWithWeight = new HashMap(); for (Map.Entry&lt;Sentence, Long&gt; item : wordsWithWeight.entrySet()) { String title = item.getKey().getTitle().toLowerCase(); String[] split = title.split("-"); String goodName = title.replace(split[0].trim() + " - ", ""); if (title.contains(split[0].trim() + " - ")) { goodName = title.replace(split[0].trim() + " - ", ""); } else if (title.contains(split[0].trim() + "- ")) { goodName = title.replace(split[0].trim() + "- ", ""); } String[] strings = goodName.split(" "); String fullString = ""; for (String s : strings) { if (!s.isEmpty()) { fullString += s + " "; String currentString = fullString.trim(); Long counter = 0L; for (Map.Entry&lt;Sentence, Long&gt; wordEntry : wordsWithWeight.entrySet()) { { if (wordEntry.getKey().getTitle().toLowerCase().trim().contains(currentString)) counter++; } } if (!newWordsWithWeight.containsKey(s)) newWordsWithWeight.put(s, counter); } } } return Utils.sortByValue(newWordsWithWeight); }
has answer: http://stackoverflow.com/a/27507774
has comment: http://stackoverflow.com/comment/43434741
accepted answer: http://stackoverflow.com/a/27507774
favorite count: 0
tagged with: android
score: 2
possible better answer: http://stackoverflow.com/a/27503799
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27503799
has title: Method performance on Android

http://stackoverflow.com/comment/43568692
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27571474
has text: What I already learned in the book is the basics of classes and objects, getting user input, declaring and using variables and all the control senteces such as if, for, while... But still on the basics and the subject where this exercise is located is about arrays. I was able to do other exercises but this one got me blocked.
score: 0

http://stackoverflow.com/comment/43399414
score: 0
type: QuestionComment
has text: @Sid Then both code examples would have to result in a compiler error since both times the methods are ambiguous.
comment on: http://stackoverflow.com/q/27483410
type: Comment

http://stackoverflow.com/comment/43656484
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27617688
type: QuestionComment
has text: you could use a switch statement, but why dont you put your values in an array and get the item with the random index?

http://stackoverflow.com/q/27605301
tagged with: android
tagged with: c++
has body: Please help me to understand JNI programming. Iam new to Java and android. There is a requirement for me to call Java API's from C++. I have followed Stackoverflow url's, still unable to pass through. Following is the Java Code which I need to call from native CPP import android.app.Activity; import android.os.Bundle; import android.util.Log; public class JniTestActivity extends Activity { private static String LIB_NAME = "JNItest"; static { System.loadLibrary(LIB_NAME); } public native void javaCallJNI(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Log.i("onCreate", "Native function begining"); javaCallJNI(); Log.i("onCreate", "Native function ending"); } void callFromCPP() { Log.i("callFromCPP", "JNI can call JAVA !"); return; } void externalcallFromCPP() { Log.i("externalcallFromCPP", "3rd Party JNI can call JAVA !"); return; } } Following is the JNI code which gets JNIENV and calls Java APIs #include &lt;jni.h&gt; #include &lt;android/log.h&gt; #define CLASS_NAME "com/test/jnitest/JniTestActivity" #define LOG_TAG "testjni" #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) typedef struct JniMethodInfo_ { JNIEnv *env; jclass clazID; jmethodID methodID; } JniMethodInfo; static JavaVM *gJavaVM; static jobject g_obj; extern "C" { jint JNI_OnLoad(JavaVM *vm, void *reserved) { LOGI("JNI INIT"); gJavaVM = vm; return JNI_VERSION_1_6; } JNIEXPORT void JNICALL Java_com_test_jnitest_JniTestActivity_javaCallJNI(JNIEnv* env, jobject obj) { LOGI("JNI work !"); jclass clazz = env-&gt;FindClass("com/test/jnitest/JniTestActivity"); if (clazz == 0) { LOGI("FindClass error"); return; } jmethodID javamethod = env-&gt;GetMethodID(clazz, "callFromCPP", "()V"); if (javamethod == 0) { LOGI("GetMethodID error"); return; } env-&gt;CallVoidMethod(obj, javamethod); g_obj = env-&gt;NewGlobalRef(obj); LOGI("JNI work done !!!!"); } // get env and cache it static JNIEnv* getJNIEnv(void) …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43648151
type: Question
tagged with: java-native-interface
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/27613160
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
has title: Unable to cache JAVA VM while calling Java from NativeC/C++

http://stackoverflow.com/comment/43482194
has text: No, the service does not implement swagger, they use Jersey
comment on: http://stackoverflow.com/a/27509568
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27541996
accepted answer of: http://stackoverflow.com/q/27508999
type: AcceptedAnswer
score: 0
has body: Simply listen to the selection model's selected item: treeview.getSelectionModel().getSelectedItem(); OR treeview.getSelectionModel().selectedItemProperty(); Happy Coding, Kalasch
type: Answer
answers question: http://stackoverflow.com/q/27508999

http://stackoverflow.com/a/27623987
has comment: http://stackoverflow.com/comment/43690556
has comment: http://stackoverflow.com/comment/43696832
has comment: http://stackoverflow.com/comment/43691330
upvote count: 3
has comment: http://stackoverflow.com/comment/43826556
has comment: http://stackoverflow.com/comment/43827228
has comment: http://stackoverflow.com/comment/43727321
has comment: http://stackoverflow.com/comment/43768403
score: 3
has comment: http://stackoverflow.com/comment/43827487
has comment: http://stackoverflow.com/comment/43690516
has comment: http://stackoverflow.com/comment/43827535
has comment: http://stackoverflow.com/comment/43827737
has comment: http://stackoverflow.com/comment/43696418
has comment: http://stackoverflow.com/comment/43698822
has body: Your application is considered to be self-signed because you've signed it with a certificate that's not intended for code signing. Self-signed applications are blocked with this nasty-looking popup: You can prevent this popup, if you sign using a code signing certificate that's signed by a trusted certificate authority. Then the user will get a way nicer looking confirmation dialog that lists your name as the publisher of the application: See also Oracle's documentation on security dialogs for a description of the dialogs and why and when they appear. Take a look at the documentation on working with Signed RIAs, in particular 23.2 "Signing RIAs", for information on how to create a code signing certificate to sign your applet. A second nice link is http://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html#5 --UPDATE-- What exactly makes a certificate a Code Signing Certificate? X.509 certificates may include key usage fields (KU's) and extended key usage fields (EKU's). These fields, when present, restrict the valid usage of the certificate. The java plugin checks for the presence of these fields. I've found the source code for the EndEntityChecker that performs this check. /** * Check whether this certificate can be used for code signing. * @throws CertificateException if not. */ private void checkCodeSigning(X509Certificate cert) throws CertificateException { Set<String> exts = getCriticalExtensions(cert); if (checkKeyUsage(cert, KU_SIGNATURE) == false) { throw new ValidatorException ("KeyUsage does not allow digital signatures", ValidatorException.T_EE_EXTENSIONS, cert); } if (checkEKU(cert, exts, OID_EKU_CODE_SIGNING) == false) { throw new ValidatorException ("Extended key usage does not permit use for code signing", ValidatorException.T_EE_EXTENSIONS, cert); } [...] checkRemainingExtensions(exts); } The check methods look as follows: /** * Utility method checking if the extended key usage extension in * certificate cert allows use for exp…
has comment: http://stackoverflow.com/comment/43699850
has comment: http://stackoverflow.com/comment/43819056
downvote count: 0
has comment: http://stackoverflow.com/comment/43766886
has comment: http://stackoverflow.com/comment/43827663
has comment: http://stackoverflow.com/comment/43690866
type: Answer
has comment: http://stackoverflow.com/comment/43827068
answers question: http://stackoverflow.com/q/27564307
has comment: http://stackoverflow.com/comment/43692022

http://stackoverflow.com/comment/43662444
has text: easiest way is to go for keeping the `parent node` ref in each `Node`. I am updating with code :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27620881

http://stackoverflow.com/a/27588313
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43600836
upvote count: 2
score: 2
has body: ingrediant should be treated as a string literal and not as an identifier such as a column name. In SQL you use single quotes for string literals. It's a better idea to use ? placeholders for binding literal values, though: String countQuery = "SELECT * FROM " + TABLE_CONTACTS2 + " WHERE id = "+id+ " AND ingrediant = ?"; Cursor cursor = db.rawQuery(countQuery, new String[] { ingrediant }); Also, don't call any cursor methods after closing it.
accepted answer of: http://stackoverflow.com/q/27588245
answers question: http://stackoverflow.com/q/27588245
type: AcceptedAnswer

http://stackoverflow.com/q/27506053
has comment: http://stackoverflow.com/comment/43442724
has comment: http://stackoverflow.com/comment/43442202
tagged with: java
has comment: http://stackoverflow.com/comment/43442108
score: 23
downvote count: 1
has comment: http://stackoverflow.com/comment/43442433
type: Question
has comment: http://stackoverflow.com/comment/43442241
linked to: http://stackoverflow.com/q/13778650
duplicate of: http://stackoverflow.com/q/13778650
has comment: http://stackoverflow.com/comment/43442489
has title: Why can't we set the value of static final variable in static block through class name
answer count: 1
has answer: http://stackoverflow.com/a/27506569
tagged with: static-block
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/43442454
tagged with: final
type: UnansweredQuestion
has body: For example, consider code snap below: public static final int a; public static final int b; static { a = 8; // it's working Test.b = 10; // compilation error Test.b cannot be assigned. } Why can't we use Test.b = 10; inside a static block of the Test class itself? Without the class name it's working fine. Is there any reason behind this?
upvote count: 24
has comment: http://stackoverflow.com/comment/43442563

http://stackoverflow.com/q/27607006
score: 1
has title: How to add Paragraph into a rectangle using IText
tagged with: itext
type: Question
linked to: http://stackoverflow.com/q/25991936
tagged with: java
has answer: http://stackoverflow.com/a/27607389
accepted answer: http://stackoverflow.com/a/27607389
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43636368
has body: I have created 2 paragraphs and added them to paragraph3 this way, PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("NextLineTextPDF.pdf")); document.open(); PdfContentByte cb = writer.getDirectContent(); cb.beginText(); BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); Font grey = new Font(bf,12f,0,Color.gray); Chunk blueText = new Chunk(leading1, grey); Font blue = new Font(bf,12f,0,Color.BLUE); Chunk greenText = new Chunk(leading2, blue); Paragraph p1 = new Paragraph(blueText); Paragraph p2 = new Paragraph(greenText); Paragraph p3 = new Paragraph(); p3.add(blueText); p3.add(greenText); document.add(p3); cb.endText(); But the problem is, if the string inside paragraph3 is is lenghty, characters are trimmed and the string is nor wrapped. Is there any way, so that I can enclose my Paragraph3 into a recctangle , to wrap my string, without trimming?
favorite count: 0
tagged with: http://stackoverflow.com/tag/pdf
linked to: http://stackoverflow.com/q/13523099
linked to: http://stackoverflow.com/q/13526043
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/27580237
has comment: http://stackoverflow.com/comment/43584929
score: 3
has answer: http://stackoverflow.com/a/27580282
has answer: http://stackoverflow.com/a/27580313
linked to: http://stackoverflow.com/q/1515437
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43584952
has answer: http://stackoverflow.com/a/27580353
has answer: http://stackoverflow.com/a/27580322
type: Question
tagged with: stringbuilder
has body: I am having a Vector&lt;String&gt; containing some items. I want to search those items in database. For that purpose I need to make a String consisting of comma separated items out of that Vector so that I can pass it to SQL Query. I am doing something like this. StringBuilder list = new StringBuilder(""); for (String items : itemList) { if(its last element then) //How to check here list.append(items); else list.append(items+","); } but that will return me the output like "item1,item2,item3," where as I want to omit the last comma (,) in case if it is last element of Vector. I have checked Vector API and found this method lastElement() (which returns last element not boolean). How can I check it in the loop or is there any smarter/efficient way to do it?
tagged with: java
has answer: http://stackoverflow.com/a/27580290
has title: How to convert Vector elements to comma separated String
has answer: http://stackoverflow.com/a/27580275
has answer: http://stackoverflow.com/a/27580409
tagged with: vector
has comment: http://stackoverflow.com/comment/43584988
downvote count: 0
answer count: 7
tagged with: string
favorite count: 0

http://stackoverflow.com/q/27630128
has title: Liferay transactional method
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43680876
has answer: http://stackoverflow.com/a/27699330
type: Question
tagged with: transactions
has body: I want to call method filterFindByG_U from DLFileEntryUtil. The problem is, that the method in which I call filterFindBy must be transactional. But I dont know how to do this. I tried to write an annotation @Transactional before the method declaration but this didn't help. Can someone please give me some idea how to do this in Liferay 6.2? The method that should be transactional is: public List&lt;DLFileEntry&gt; filterEntriesPermissions(User user) { List&lt;DLFileEntry&gt; filtered = new ArrayList&lt;DLFileEntry&gt;(); try { filtered = DLFileEntryUtil.filterFindByG_U(user.getGroupId(), user.getUserId()); } catch (SystemException | PortalException e) { // TODO Auto-generated catch block e.printStackTrace(); } return filtered; } I will be thankful for some help and explanation.
tagged with: java
has comment: http://stackoverflow.com/comment/43680975
has comment: http://stackoverflow.com/comment/43680883
tagged with: liferay
has comment: http://stackoverflow.com/comment/43680949
accepted answer: http://stackoverflow.com/a/27699330
answer count: 1
has comment: http://stackoverflow.com/comment/43680934
score: 0
has comment: http://stackoverflow.com/comment/43728968
has comment: http://stackoverflow.com/comment/43680836

http://stackoverflow.com/comment/43630631
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27603782
has text: Looking at the source code , we can also pass charset to StringHttpMessageConverter(),you can pass it `UTF-8` charset because defaultCharSet is `ISO-8859-1`
type: Comment

http://stackoverflow.com/a/27566183
upvote count: 27
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27561391
answers question: http://stackoverflow.com/q/27561391
type: Answer
score: 27
has body: You can right-click a tab with test results and select the "Pin Tab" option from the context menu. Then further test executions will not overwrite this tab, and you can still refer to it to see which other tests you need to fix.
has comment: http://stackoverflow.com/comment/80298464

http://stackoverflow.com/q/27611838
linked to: http://stackoverflow.com/q/14571273
type: Question
answer count: 2
has title: Spring-WS set SOAPAction header for SOAP version 1.2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/11631833
tagged with: soap
has answer: http://stackoverflow.com/a/27733099
upvote count: 2
tagged with: web-services
possible better answer: http://stackoverflow.com/a/47864450
score: 2
type: AnsweredQuestion
has body: I have to connect to a SOAP 1.2 Web Service with Spring-WS, but I'm having difficulties in setting SOAPAction header that is required by the service. I've already looked here and there, but none seems to give solution that would apply in my case. I receive an error message basically stating that SOAPAction cannot be empty. (I'll post the actual error message if required) The default behaviour with WebServiceTemplate seems to be that it'll sent the header as empty String. I've used two approaches with WebServiceTemplate in order to set the action Using SoapActionCallback with webServiceTemplate#sendAndReceive() Manually setting the header in callback with setSoapAction( String s ) Option 1 doesn't do anything. Option 2 sets the header, but only temporarily. I can see it set if I log getSoapAction() call in the callback, but it's not sent anywhere. At least not as a separate header as I suspect is required by the service. I digged a bit the sources of SaajSoapMessage implementation and it is in fact setting the action as part of the Content-Type header, which is, according to some references I read, correct behaviour. The problem is that I don't see the action in Content-Type header either. The other SO questions had an answer stating that there's a bug in Saaj implementation, which causes the change of action header to be ignored. Based on the issue timestamp, I'd expect it to be fixed for the version in use. For the debugging purposes I'm using SoapUI mock I have created. I don't have access to the source or logs of the actual WS implementation. I believe it uses .NET / WCF if that makes any difference. So, it all boils down to simple question: How do I set the SOAPAction header for SOAP 1.2 with Spring-WS I'm using version 2.1.4-RELEASE of Spring-WS, but instead of the default dependencies to Spring-core version 3.2.4 etc., I've manually set dependencies for the same libs, but for version 3.2.7. The reason for this is that I wish to have exactly same version of Spr…
has answer: http://stackoverflow.com/a/47864450
tagged with: spring-ws
accepted answer: http://stackoverflow.com/a/27733099
tagged with: java

http://stackoverflow.com/q/27598862
tagged with: eclipse
type: Question
downvote count: 0
has body: I get this error under the problems tab. I downloaded a project off of github then imported it to eclipse and added the libraries to the build path. When I try to run I get the error : Could not find or load main class blah.blah.blah.StartupClass I've done a ton of googling and I cant figure it out. Thanks for you help. Here is my project http://puu.sh/dEMHk/4609006ff1.png also here is my eclipse project in a zip http://puu.sh/dEMLZ/1092da9f36.zip
score: 2
tagged with: mainclass
has title: Eclipse: The project was not built due to "A resource exists with a different case: '/project/bin/License.txt'."
tagged with: github
favorite count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13108465
answer count: 0
has comment: http://stackoverflow.com/comment/43620954
tagged with: java

http://stackoverflow.com/comment/43573187
type: QuestionComment
comment on: http://stackoverflow.com/q/27573849
score: 0
has text: Use a simple `if` statement? If combobox value is this then create a new Savings object, else if combobox valus is that create a new Checking object.
type: Comment

http://stackoverflow.com/a/27498958
has comment: http://stackoverflow.com/comment/43431066
has comment: http://stackoverflow.com/comment/43429107
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44001822
has comment: http://stackoverflow.com/comment/43432052
has body: Check these codes SERVER #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;sys/ioctl.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #include &lt;pthread.h&gt; #include &lt;error.h&gt; #define PORT 5000 #define filename "incoming.txt" void* thread_proc(void *arg); int main(int argc, char *argv[]) { struct sockaddr_in sAddr; int sockfd,connfd; int status; pthread_t thread_id; int val; sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); val = 1; status = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &amp;val, sizeof(val)); if (status &lt; 0) { perror("Error - port"); return 0; } sAddr.sin_family = AF_INET; sAddr.sin_port = htons(PORT); sAddr.sin_addr.s_addr = INADDR_ANY; status = bind(sockfd, (struct sockaddr *) &amp;sAddr, sizeof(sAddr)); if (status &lt; 0) { perror("Error - Bind"); return 0; } status = listen(sockfd, 5); if (status &lt; 0) { perror("Error - Listen"); return 0; } while(1) { connfd = accept(sockfd, NULL, NULL); if (connfd &lt; 0) { printf("Accept error on server\n"); //error("ERROR on accept"); return 0; } printf("client connected to child thread %i with pid %i.\n", pthread_self(), getpid()); status = pthread_create(&amp;thread_id, NULL, thread_proc, (void *) connfd); if (status != 0) { printf("Could not create thread.\n"); return 0; } sched_yield(); } pthread_join (thread_id, NULL); } void* thread_proc(void *arg) { int connfd; int nread,n; char buffer[1000]; FILE *fp; connfd = (int) arg; fp = fopen(filename, "ab"); if (fp == NULL) { printf("File not found!\n"); return NULL; } else { printf("Found file %s\n", filename); } while ((n = recv(connfd, buffer, sizeof buffer, 0)) &gt; 0) { fwrite(buffer, sizeof(char), n, fp); fprintf(stdout, "Received %d bytess\n", n); } fclose(fp); close(connfd); printf("client disconnected from child thread %i with pid %i.\n", pthread_self(), getpid()); return NULL; } CLIENT import java.net.*; import java.io.*; import java.util.Arrays; //…
type: Answer
has comment: http://stackoverflow.com/comment/43429516
accepted answer of: http://stackoverflow.com/q/27498845
upvote count: 1
answers question: http://stackoverflow.com/q/27498845
score: 1

http://stackoverflow.com/comment/43999438
has text: Ah, the reason for that error is that you use a **CalRGB** color space without **WhitePoint** (which is a required value). As you thereafter use `DeviceRGB` colors, though, that should not matter.
type: Comment
comment on: http://stackoverflow.com/q/27600166
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43483341
has text: commons-io-2.4.jar, commons-lang-2.6.jar, commons-collections-3.2.1.jar, jsr305-2.0.1.jar, javassist-3.18.1-GA.jar
type: Comment
comment on: http://stackoverflow.com/q/27524636
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43655913
has text: @secmask, but after using LD_LIBRARY_PATH there is no need of Djava.library.path
comment on: http://stackoverflow.com/q/27615378
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27636369
type: Answer
score: 1
upvote count: 1
has body: So first - Warrior should not implement Weapon definitely. Implementing an interface or extending a class is an IS A relationship. Gun is a Weapon, but Warrior is not. He just uses a Weapon, which is a composition - a HAS A relationship. Weapon should probably be an interface Interface is something that tells what can be done with the object of a class implementing that interface. It doesn't tell how it is achieved. This separation is good for your clean design. If there is any common behavior that all weapons or some of them share, you can introduce an abstract class that in hierarchy could stand between interface and concrete implementation. Note here (this is a common mistake) that behavior does not mean adding a new method. So if you think for instance that a gun can be reloaded, so it needs another method for it, the abstract class can't help here. In this case you could introduce another interface, like Reloadable and make Gun implement both Weapon and Reloadable. The common behavior is just when some concrete classes implement some interface method in same or similar way. The abstract class could then implement this one method but leave the rest not implemented.
accepted answer of: http://stackoverflow.com/q/27635770
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27635770

http://stackoverflow.com/a/27870340
accepted answer of: http://stackoverflow.com/q/27575071
score: 0
type: AcceptedAnswer
has body: I ran the code on the production server again and I got a TransactionRollbackException right before the detached entity exceptions. I think that this might be the actual cause of the exception I observed. The transaction timed out and was rolled back due to the huge number of objects I was trying to save, and this led to the Foo objects becoming detached. Somehow the TransactionRollbackException didnt show up in the logs the first time around, probably because it happened exactly at 12:0am UT. In support of this theory, the program hasn't crashed so far after I decreased the batch size to ~1000 For those interested, a TransactionRollbackException does lead to entities getting detached: entityManager.getTransaction().rollback() detaches entities? There are ways to handle this when it occurs, but I opted against implementing them for simplicity's sake
type: Answer
answers question: http://stackoverflow.com/q/27575071

http://stackoverflow.com/comment/43649772
comment on: http://stackoverflow.com/q/27613849
score: 0
type: Comment
has text: its a very long list and it varies from page to page but if tyou want I can show you for one page that gives this exception
type: QuestionComment

http://stackoverflow.com/q/27633335
downvote count: 0
has comment: http://stackoverflow.com/comment/43686441
tagged with: linux
has comment: http://stackoverflow.com/comment/43686861
has body: I want to move all tar files from a directory to another directory using java code and my java code runs on linux machine. I have tried below code but nothing happened - try { String command = "mv " + "/home/" + name + "/*.tar"+ " "+ "/home/Program/MovedTar/"+ name + "/" + ""; Process proc = Runtime.getRuntime().exec(command); int waitFor = proc.waitFor(); closeStdStream(proc); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }
score: 2
has title: mv command for linux using java
possible better answer: http://stackoverflow.com/a/27655361
favorite count: 0
has answer: http://stackoverflow.com/a/27633585
has answer: http://stackoverflow.com/a/27655361
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/27633433
has answer: http://stackoverflow.com/a/27633373
has comment: http://stackoverflow.com/comment/43686714
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35638556
tagged with: java
has comment: http://stackoverflow.com/comment/43687436
type: Question
accepted answer: http://stackoverflow.com/a/27633433

http://stackoverflow.com/comment/43607394
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27591475
type: Comment
has text: What happens if you do as wanted @Autowired Views views ? The variable views remain unset?

http://stackoverflow.com/comment/43607838
has text: WHy do you have another `setContentView(R.layout.new_location);`?
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27592044

http://stackoverflow.com/comment/43451085
has text: @JonStory yes, this can be done by implementing `writeObject` and `readObject` methods on the classes to serialize/deserialize, but I think that's outside of the scope of this question because OP is asking if the file can be deserialized even if OP uninstall and install JVM and not doing another changes.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27509765
type: AnswerComment

http://stackoverflow.com/a/27544951
accepted answer of: http://stackoverflow.com/q/27543837
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43518625
upvote count: 2
has body: I think you are looking for a lossless a compression scheme that is such that you can retrieve a secret from steganography. That means you need to move away from jpg as your compression format - it is lossy. That means that once you have put your secret + cover image through the jpg compression, the original cannot be recovered by a simple 'decompression' call at the other end, i.e. the JPEG compression algorithm is not reversible. You ask in comments about libraries for compression / decompression rather than steganography. You are already using one in your code example (ImageIO). If you want to take your original image and transcode it to PNG (i.e. lossless compression), ImageIO can do that simply - see this question for details. JAI is commonly used if you need more advanced features. The PNG format offers a lossless compression option. EDIT: some code to show using ImageIO using PNG format as requested by OP in comments. By default ImageIO uses compression when you write PNG's. At the receive end, simply read the PNG, you get the original back.: public class JPEGFileToPNG { public static void main(String[] args) throws IOException { File imageFile = new File("C:\\Users\\user\\Desktop\\encryption\\d.jpg"); File compressedImageFile = new File("C:\\Users\\user\\Desktop\\encryption\\compress.png"); BufferedImage image = ImageIO.read(imageFile.toURI().toURL()); ImageIO.write(image, "png", compressedImageFile); } P.S. There are two levels at which to answer your question. At the more advanced (maybe research) level - people do work on using the actual errors introduced by JPG encoding to encode the secret in steganography (e.g. http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1357167&amp;tag=1) From the wording of your question, I don't think this is what you want, but it might be. In which case, your task is quite hard (writing a JPEG encoder / decoder and adapting it to hide secrets in the encoding table), but it has been done (e.g. this paper describes the meth…
has comment: http://stackoverflow.com/comment/55106924
has comment: http://stackoverflow.com/comment/43517110
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27543837
has comment: http://stackoverflow.com/comment/43547359
has comment: http://stackoverflow.com/comment/43548723
has comment: http://stackoverflow.com/comment/43557289

http://stackoverflow.com/comment/43577802
type: Comment
comment on: http://stackoverflow.com/a/27576183
has text: @Beth you can use debugger or before `int x=...` add `System.out.println(p.plant);` `System.out.println(p.plant.getName());` `System.out.println(p.plant.analyzeText);` `System.out.println(p.plant.analyzeText.getText());` which ever print null is/are causing the Exception
score: 0
type: AnswerComment

http://stackoverflow.com/a/27498225
has body: There is no specialized FloatStream, so what you want is not doable with the Streams API. If you want to get the benefits of float (half the memory of double) and still use streams, you will have to store your floats encoded in ints: double[] doubles = new double[]{1.2, 3.5, 4}; int[] floatsAsInts = Arrays.stream(doubles) .mapToInt(d -&gt; Float.floatToRawIntBits((float) d)) .toArray(); Arrays.stream(floatsAsInts) .forEach(i -&gt; System.out.println(Float.intBitsToFloat(i))); You would have to have an overwhelmingly good reason to torture yourself like this. Unless you are planning to store a hundred million numbers in this array, you are likely better off just using double[].
score: 7
answers question: http://stackoverflow.com/q/27497386
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27497386
type: Answer
upvote count: 7

http://stackoverflow.com/q/27634511
tagged with: java
has answer: http://stackoverflow.com/a/27980828
has answer: http://stackoverflow.com/a/27634737
has comment: http://stackoverflow.com/comment/43708700
upvote count: 8
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27656484
has body: I have a proprietary dependency that I use in my project that I can not refuse. It was built in one big fat jar with all dependent packages collected inside. By all I mean even common ones like slf4j-api, apache-commons, javax packages, etc. Using it together with my own list of declared dependecies is risky because there's always a race in classloader on which class will be loaded first - mine or outdated class inside fat jar. I was wondering is there a way around this problem? How to treat such fat jars? I'm using maven for dependency management.
has comment: http://stackoverflow.com/comment/43696712
possible better answer: http://stackoverflow.com/a/27634847
favorite count: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/27980828
tagged with: dependency-management
answer count: 4
score: 8
downvote count: 0
has title: How to deal with fat jar dependency
has answer: http://stackoverflow.com/a/27634847

http://stackoverflow.com/q/27605329
tagged with: java
has answer: http://stackoverflow.com/a/27605457
has comment: http://stackoverflow.com/comment/43632834
tagged with: concurrency
has answer: http://stackoverflow.com/a/27606554
type: Question
has comment: http://stackoverflow.com/comment/43632899
has answer: http://stackoverflow.com/a/27605782
has title: How can I access the method of one thread from another thread?
has comment: http://stackoverflow.com/comment/43633104
has answer: http://stackoverflow.com/a/27606030
type: UnansweredQuestion
tagged with: multithreading
has body: The app I currently developing should create the bunch of threads, each containing some data collection and creating the bunch of threads itself. These threads (third layer) should receive some data and send it to the collection in their parent thread, which then will send this data further. My problem here is I can't find a way to access either collection itself or the method made to modify it from another thread. Any suggestions?
has comment: http://stackoverflow.com/comment/43633039
answer count: 4
score: 0

http://stackoverflow.com/q/27530999
answer count: 2
possible better answer: http://stackoverflow.com/a/50818268
favorite count: 0
has comment: http://stackoverflow.com/comment/50482090
has answer: http://stackoverflow.com/a/50818268
tagged with: spring
tagged with: spring-ldap
has answer: http://stackoverflow.com/a/31067062
type: AnsweredQuestion
score: 7
tagged with: java
has title: Spring Ldap unit testing with custom schema definition
upvote count: 7
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/50478844
type: Question
has body: I am trying to setup embedded ldap for unit test with Spring Ldap. But I need to use a custom schema for custom objectClasses/attributes definitions. How can I configure it with Spring Ldap test (LdapTestUtils?) Actually if I run test, it fail saying that my custom objectClass "myOb" is not defined in the schema with the following message : org.springframework.ldap.UncategorizedLdapException: Failed to populate LDIF; nested exception is javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - NO_SUCH_ATTRIBUTE: failed for Add Request : ... : OID for name 'myOb' was not found within the OID registry]; remaining name 'cn=123456, ou=MyUser, o=company.com' If I comment objectClass: myOb from ldif, the test fail with a null value (attribute is not read). Here is my test class : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = LdapConfiguration.class, loader = AnnotationConfigContextLoader.class) public class LdapTest { // Ldap port private static final int LDAP_PORT = 18880; // Base DN for test data private static final LdapName baseName = LdapUtils.newLdapName("o=company.com"); @Autowired LdapTemplate ldapTemplate; @BeforeClass public static void setupBeforeClass() { LdapTestUtils.startEmbeddedServer(LDAP_PORT, baseName.toString(), "ldaptest"); // How to load schema definition ? } @AfterClass public static void teardownAfterClass() throws Exception { LdapTestUtils.shutdownEmbeddedServer(); } @Before public void setup() throws Exception { LdapTestUtils.cleanAndSetup(ldapTemplate.getContextSource(), baseName, new ClassPathResource("ldap/test-users.ldif")); } @Test public void testSearchLdap() throws Exception { String myObId = ldapTemplate.lookup(LdapNameBuilder.newInstance("ou=MyUser, o=company.com").add("cn", "123456").build(), new AbstractContextMapper&lt;String&gt;() { @Override protected String doMapFromContext(DirContextOperations ctx) { return ctx.getStringAttribute("myObId"); // custom type } }); Assert.assertNotNull(myObId); …
has comment: http://stackoverflow.com/comment/50527263
downvote count: 0
accepted answer: http://stackoverflow.com/a/31067062
tagged with: ldap

http://stackoverflow.com/comment/76319515
comment on: http://stackoverflow.com/a/27583440
type: AnswerComment
score: 0
type: Comment
has text: @user2542004 I can't reproduce that. I get a `MalformedURLException` because you're missing a protocol in your url.

http://stackoverflow.com/q/27566466
has comment: http://stackoverflow.com/comment/43558548
tagged with: arrays
has body: I am tasked to make a program which returns true if in a 2D array 1-s encircle 0-s. I tried something like this, but i cant find the right solution. public boolean checkGameState(){ for(int i=0;i&lt;fields.length;i++){ for(int j=0;j&lt;fields.length;j++){ if(fields[i][j]!=0){ if(row(i,j){ return true; } } } } return false; } private boolean row(int a, int b){ int checkI=a; int checkJ=b; while(fields[checkI][checkJ]==1){ checkJ++; } while(fields[checkI][checkJ]==1){ checkI++; } while(fields[checkI][checkJ]==1){ checkJ--; } while(fields[checkI][checkJ]==1){ checkI--; } return a==checkI &amp;&amp; b==checkJ; } The 2D array looks something like this: 111100 100100 100101 111100 001100 For this array the method should return true.
favorite count: 0
has answer: http://stackoverflow.com/a/27566864
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/43557808
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27566572
has comment: http://stackoverflow.com/comment/43557852
has comment: http://stackoverflow.com/comment/43557884
has answer: http://stackoverflow.com/a/27566572
accepted answer: http://stackoverflow.com/a/27566864
score: 1
tagged with: java
has title: Java 2D array encirclement
has comment: http://stackoverflow.com/comment/43557837
answer count: 2

http://stackoverflow.com/q/27601570
type: UnansweredQuestion
tagged with: thermal-printer
has comment: http://stackoverflow.com/comment/43641081
has comment: http://stackoverflow.com/comment/43641021
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43627386
has comment: http://stackoverflow.com/comment/43627002
has comment: http://stackoverflow.com/comment/43626875
has answer: http://stackoverflow.com/a/31224916
tagged with: arrays
has comment: http://stackoverflow.com/comment/43626091
has title: ESC commands to print barcode to a thermal printer?
has body: When you purchase a thermal receipt printer, you also get a manual that tells you which byte sequence should be used to do what (cutting, finishing job, setting fonts etc). However I do not have an understanding of Java that is sufficient for me to be able to use the ESC/POS commands. I have a Citizen CT S2000 thermal receipt printer. I have already managed to use the byte sequences for cutting and line feeding and manipulating what fonts the thermal printer is supposed to have. However I can not figure out how to use the ESC commands for generating and printing barcode. The manual on how to do this is here on page 144. Here a sample code is provided in BASIC. LPRINT CHR$(&amp;H1D);"k"; CHR$(73); CHR$(10); LPRINT "{BNo.{C"; CHR$(12); CHR$(34); CHR$(56); LPRINT CHR$(&amp;HA); END Here is my attempt to print the barcode. public static void barcode() throws Exception{ byte[] b = {0x7b, 0x43, 0x12, 0x34}; //This is the commands as I interpreted the to print out 12 and 34 DocPrintJob job = PrintServiceLookup.lookupDefaultPrintService().createPrintJob(); DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE; /*This is how I send byte sequences. if you got something better then don't hesitate yelling at me :D : ). */ Doc doc = new SimpleDoc(b, flavor, null); job.print(doc, null); } Yet this does not yield anything at all and the printer doesn't do anything at all. I really can't find any examples of how to do it. Any answers/comments would be appreciated.
score: 0
tagged with: printing
has comment: http://stackoverflow.com/comment/43627447
answer count: 1
tagged with: barcode

http://stackoverflow.com/q/27636550
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27636819
has title: regex to match secial char and string and new line
downvote count: 5
answer count: 2
has answer: http://stackoverflow.com/a/27637389
favorite count: 0
has body: !54993A3D.0000!========================&gt; XXX Service Log &lt;======================== +54993A3D.0000 System Name: XXXXXXXXXXX Process ID: 1404 +54993A3D.0000 Program Name: XXXXXXXXXXX User Name: SYSTEM +54993A3D.0000 Task Name: XXXXXXXXXXX System Type: Win2008;6.0-SP2 +54993A3D.0000 MAC1_ENV Macro: 0xC112 Start Date: 2014/12/23 +54993A3D.0000 Start Time: 15:17:41 CPU Count: 2 +54993A3D.0000 Page Size: 4K Phys Memory: 4095M +54993A3D.0000 Virt Memory: 2048M Page Space: 8413M +54993A3D.0000 UTC Start Time: 54993a3d ITM Home: C:\XXXXXXXXXXX\test2.exeX +54993A3D.0000 EEM Process: esx9-v52_vm Effective User Name: SYSTEM +54993A3D.0000 Service Point: system.esx9-v52_vm +54993A3D.0000 Executable Name: C:\XXXXXXXXXXX\test2.exe +54993A3D.0000 KBB_RAS1: ERROR +54993A3D.0000 KBB_RDFBB_ENS: C:\XXXXXXXXXXX\test2.exe +54993A3D.0000 ================================================================================ (54993A3D.0000-1450:RDAS1,630,"CTBLD") +54993A3D.0000 Component: kbb +54993A3D.0000 Driver: tms_ctbs630:d2325a/4288607.1 +54993A3D.0000 Timestamp: Nov 20 2012 20:21:28 I want to extract data between !54993A3D.0000!========================&gt; XXX Service Log &lt;======================== +54993A3D.0000 ======================================================================= using java or regex I tried using this below code ,it ditn work out String pattern1 = "^.*?========================&gt; XXX Service Log &lt;========================"; String pattern2 = "^.*?================================================================================"; Pattern p = Pattern.compile(Pattern.quote(pattern1) + "(.*?)" + Pattern.quote(pattern2),Pattern.DOTALL); Matcher m = p.matcher(text); while (m.find()) { System.out.println(m.group(1)); }
upvote count: 2
type: UnansweredQuestion
score: -3
tagged with: regex

http://stackoverflow.com/comment/43533222
type: Comment
has text: @ne1410s it looks like he's changing 'or' to 'our' at the ends of words. At least, that's what the code looks like.
type: QuestionComment
comment on: http://stackoverflow.com/q/27553455
score: 0

http://stackoverflow.com/comment/43567374
has text: This answer on depending on one `tr` you have provide? does the page contains more `tr` with same properties?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27570939
type: Comment

http://stackoverflow.com/q/27532330
tagged with: multithreading
has answer: http://stackoverflow.com/a/27532786
answer count: 1
has comment: http://stackoverflow.com/comment/43494996
has body: I am having a server application which processes 2 jobs(file processing) which are completely different flows. i invoke the client giving either job1 or job 2 so it could be either of these 2 in some interval of time .since the files are picked from a folder I want to synchronize the jobs i.e. if for example i trigger job 2 again quickly after triggering job 2 the first time ;the files in that might not have been processed so i should not pick them up again . and also i would rather wait for the first executor (executor service ) to finish off before triggering another job/executor. I have tried using a map where i store the job and executor and trying to synchronize the map .but I am not sure how to proceed.some code has been left out for clarity. Server class: public class ProcessServer { public static void main(String[] args) { try { Integer port = Integer.parseInt(Configuration.getProperty("Environment", "PORT")); ServerSocket serverSocket = new ServerSocket(port); LOG.info("Process Server listening on PORT: " + port); while (true) { Socket socket = serverSocket.accept(); new Thread(new ProcessEvent(socket)).start(); } } catch (Throwable th) { LOG.error("Exception occured starting server.", th); } } } ProcessEvent Class: public class ProcessEvent implements Runnable { //code to extract argument(event/jobtype) from socket stream private void processEvent(Event event) { switch (event.getType()) { case 1: new ProcessJob1().execute(MAP1); break; case 2: new ProcessJob2().execute(MAP2); break; default: break; } } Job Class 1: public class ProcessJob1 extends Job { private static Map&lt;String, ExecutorService&gt; isRunning = new HashMap&lt;String, ExecutorService&gt;(); @Override public void execute(Map&lt;String, Object&gt; jobData) { String txn = (String)jobData.get(TYPE); ExecutorService executor = null; synchronized (isRunning) { executor = isRunning.get(type); if (executor != null &amp;&amp; !executor.isTerminated()) { return; } executor = Executors.newFixedThre…
score: 0
accepted answer: http://stackoverflow.com/a/27532786
tagged with: java
tagged with: executor
has title: how to synchronize 2 jobs/processes
type: Question
type: AnsweredQuestion
tagged with: executorservice
tagged with: synchronization

http://stackoverflow.com/comment/43649729
score: 0
type: QuestionComment
type: Comment
has text: as i explained in the question, it is some words that i extracted from a random Web page
comment on: http://stackoverflow.com/q/27613849

http://stackoverflow.com/a/27583646
type: Answer
answers question: http://stackoverflow.com/q/27583560
has body: You probably did not override the hashCode method. Why is that required ? To answer this, you must understand how an hashtable works. An hashtable is basically an array of linkedlists. Each bucket in the array corresponds to a particular value of hashCode % numberOfBuckets. All the objects with the same hashCode % numberOfBuckets will be stored within a linkedlist in the associated bucket and will be recognized (during the lookup for instance) basing on their equals method. Therefore, the exact specification is a.hashCode() != b.hashCode() =&gt; !a.equals(b) which is equivalent to a.equals(b) =&gt; a.hashCode() == b.hashCode(). If you use the default implementation of hashCode, which is based on the reference, then two objects that are equal but have a different reference (and so, most probably, a different hashCode) will be stored in a different bucket, resulting in a duplicate key.
score: 0

http://stackoverflow.com/comment/43540427
type: Comment
has text: It's not reporting any error in the app, it is just moving as if its a queen
comment on: http://stackoverflow.com/q/27557064
score: 0
type: QuestionComment

http://stackoverflow.com/a/27551071
type: AcceptedAnswer
downvote count: 0
has body: The SurfaceView's Surface is double- or triple-buffered. Every call to unlockCanvasAndPost() submits a new buffer to the compositor. If you're only rendering 1/5th of the scene each time (let's call then A-B-C-D-E), then you'll get a frame with just the 'A' balls, then one with just the 'B' balls, and so on. That assumes that your threads are scheduled fairly round-robin, which they are generally not on Android/Linux. I suspect you're seeing flicker because you're essentially running at 50fps, showing only one set of objects at a time. If you don't clear the Canvas each time, the glitches will be less obvious, because Android doesn't erase the Canvas for you. So you start with the contents of the previous front buffer, which will probably be a different set of balls. The system provides exclusive access while the canvas is locked. You can try moving your (should-be-unnecessary) locking of the SurfaceHolder outside the canvas lock/unlock to see if it makes a difference. For a full explanation, see the Android System-Level Graphics Architecture doc. As far as your situation goes, while you can have multiple threads updating state like the position of the balls, it's difficult to have multiple threads sharing a single Canvas for rendering. If you really want to do it all in software, try this: create a bitmap, and render the circles yourself (with Bresenham or bitmaps) using as many threads as you like. Periodically have one thread freeze the bitmap, lock the canvas, and blit your bitmap to it. If you'd like some examples of simple 2D GLES rendering, see Grafika or Android Breakout (the latter of which uses Bresenham to generate a circular ball texture).
has comment: http://stackoverflow.com/comment/43543612
accepted answer of: http://stackoverflow.com/q/27535501
type: Answer
answers question: http://stackoverflow.com/q/27535501
has comment: http://stackoverflow.com/comment/61043819
has comment: http://stackoverflow.com/comment/61039705
has comment: http://stackoverflow.com/comment/61039434
has comment: http://stackoverflow.com/comment/61042984
upvote count: 5
has comment: http://stackoverflow.com/comment/61044587
has comment: http://stackoverflow.com/comment/61042285
has comment: http://stackoverflow.com/comment/61044520
has comment: http://stackoverflow.com/comment/61043686
score: 5

http://stackoverflow.com/comment/43443633
score: 0
type: Comment
has text: thanks a lot. This seems to be much easier then reading from any type of file
comment on: http://stackoverflow.com/a/27506370
type: AnswerComment

http://stackoverflow.com/a/27495974
has comment: http://stackoverflow.com/comment/43440283
has comment: http://stackoverflow.com/comment/43425378
type: Answer
has comment: http://stackoverflow.com/comment/43423853
score: 1
has comment: http://stackoverflow.com/comment/43426582
upvote count: 1
has comment: http://stackoverflow.com/comment/43440702
has body: You just need to catch an exception: try { return questionIdMap.get(questionId).newInstance(); } catch(InstantiationException e) { System.out.println("Constructor failed: ); e.printStackTrace(); return null; } This should compile fine.
answers question: http://stackoverflow.com/q/27495618
has comment: http://stackoverflow.com/comment/43423908
downvote count: 0
has comment: http://stackoverflow.com/comment/43439268

http://stackoverflow.com/comment/43650652
comment on: http://stackoverflow.com/q/27614324
score: 0
type: Comment
type: QuestionComment
has text: Any reason for the downvotes? I'm trying to see where the problem is...

http://stackoverflow.com/comment/43486449
comment on: http://stackoverflow.com/q/27528778
score: 0
has text: @codor: oh I'm sorry. I need it for java
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27607806
has answer: http://stackoverflow.com/a/27613154
has comment: http://stackoverflow.com/comment/43638024
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43647707
upvote count: 1
has comment: http://stackoverflow.com/comment/43637959
has title: JPA entities: How to establish relationship between Parent and multiple Child classes
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43637822
tagged with: ejb
has comment: http://stackoverflow.com/comment/43638218
accepted answer: http://stackoverflow.com/a/27613154
has body: I have the following Java classes: public Class Parent { int someValue1; ChildType child; } public Class ChildType { int someValue2; } public Class ChildA extends ChildType { int id; String string; } public Class ChildB extends ChildType { int id; Integer integer; } I need to represent Parent, ChildA and ChildB as entity beans with each having a related table in the database. When I load a Parent I also need to load either ChildA or ChildB depending on the relationship.
has comment: http://stackoverflow.com/comment/43637855
has comment: http://stackoverflow.com/comment/43637845
score: 0
tagged with: jpa
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27484474
has body: I am trying to add a customer via a GUI input. The user enters the address consisting the parts shown below and this becomes the defaultColAddress. There is a problem as the defaultColAddress must be Address but the components that make this up are String, I am trying to convert these to an Address but cannot the problem line is: Address defaultColAddress = Address.parseAddress(addrLine1, addrLine2, city, postcode); I get an error on Address.parseAddress I know there is not parse for Address but I have also tried all variants such as toAddress and such. Any help would be appreciated. private void saveItem() { if(this.isSaveable()){ double costPerKg = Integer.parseInt(txtDefaultCost.getText()); String addrLine1 = txtAddressLine1.getText(); String addrLine2 = txtAddressLine2.getText(); String city = txtCity.getText(); String postcode = txtPostcode.getText(); Person itemToAdd = null; Address defaultColAddress = Address.parseAddress(addrLine1, addrLine2, city, postcode); //Address defaultColAddress = Address.parseAddress(txtAddressLine1.getText(),txtAddressLine2.getText(),txtCity.getText(), txtPostcode.getText()); itemToAdd = new Customer(txtForename.getText(),txtSurname.getText(), costPerKg, defaultColAddress); peopleList.addCustomer((Customer) itemToAdd); } } private Boolean isSaveable() { Boolean blnValid = false; try { Integer intQty = Integer.parseInt(txtDefaultCost.getText()); if (txtForename.getText().length() &gt; 0 &amp;&amp; intQty &gt;= 0) { blnValid = true; } } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(this, "The provided data is invalid", "Error reading data", JOptionPane.ERROR_MESSAGE); } return blnValid; } Here is the entire Address class as requested public class Address implements ISubject, Serializable { private String addressLine1; private String addressLine2; private String city; private String postcode; private ISubject subjectDelegate; /** * Default constructor initialises all attributes to the string "UNKNOWN". * Required fo…
favorite count: 0
has comment: http://stackoverflow.com/comment/43401054
downvote count: 5
has comment: http://stackoverflow.com/comment/43401717
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27484909
has answer: http://stackoverflow.com/a/27484909
tagged with: user-interface
answer count: 1
tagged with: string
has title: GUI Java String convert to Address

http://stackoverflow.com/a/27564904
has comment: http://stackoverflow.com/comment/43557497
score: 1
answers question: http://stackoverflow.com/q/27564670
downvote count: 0
has body: If you use an array, you have to keep track of the number of elements stored inside and resize the array when necessary. The easiest way would be to keep the history as strings in ArrayList. You would add one message to that list per transaction: ArrayList&lt;String&gt; history = new ArrayList&lt;String&gt;(); void addToHistory(String transaction) { history.add(transaction); } void printHistory() { for(String s : history) { System.out.println(s); } } addToHistory("Withdrawal: 100 SEK" ); addToHistory("Deposit: 200 SEK" ); printHistory();
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43556479

http://stackoverflow.com/comment/43508806
score: 0
type: Comment
has text: Yeah..@Prathap ..Same thing it is showing...
type: AnswerComment
comment on: http://stackoverflow.com/a/27540616

http://stackoverflow.com/a/27505152
type: Answer
has body: I would do it like this: public final class QuestionBuilder { private QuestionBuilder(){} public enum Type { LICENSE_NUMBER { @Override Question getQuestion() { return new LicenseNumberQuestion(); } }, USP { @Override Question getQuestion() { return new USPQuestion(); } }; abstract Question getQuestion(); } public static Question getQuestion(Type type) { return type.getQuestion(); } } With your solution the user of the class has to write Question question = QuestionBuilder.getQuestion(1); This isn't great because it's not clear what "1" here means, and she is going to have to learn the meaning of a load of numbers. Also, if you pass in a number that doesn't mean anything, there's a problem (hence the need for a BusinessProfileInputException). With the enum approach, the user of the class would write Question question = QuestionBuilder.getQuestion(QuestionBuilder.Type.LICENSE_NUMBER); Now this is obviously longer, but there are 3 major advantages. (1) The user of the class doesn't need to remember any abstract code numbers. In fact if the user is using a decent IDE, she should actually be presented with a meaningful list of choices as she types. (2) There is no longer the need for the BusinessProfileInputException because it is now impossible to pass something that doesn't mean anything (except null, but in this case a NullPointerException would be thrown anyway). (3) You no longer need reflection to create the new Question, so there is no need for the irritating try block. But it's even better than this. You'll notice that since we've got rid of the Map, the class QuestionBuilder doesn't actually do anything at all. You could improve things further by getting rid of the class completely, and making the enum a top-level class with a simple name like TypeOfQuestion. Then all the user would have to type is Question question = TypeOfQuestion.LICENSE_NUMBER.getQuestion(); enums in Java are absolutely brilliant. They are far superior to the counterparts in other languages…
score: 0
accepted answer of: http://stackoverflow.com/q/27495618
answers question: http://stackoverflow.com/q/27495618
type: AcceptedAnswer

http://stackoverflow.com/a/27588735
type: AcceptedAnswer
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/43622754
has comment: http://stackoverflow.com/comment/43622659
has comment: http://stackoverflow.com/comment/43622844
has comment: http://stackoverflow.com/comment/43622251
has comment: http://stackoverflow.com/comment/43601626
accepted answer of: http://stackoverflow.com/q/27588663
has comment: http://stackoverflow.com/comment/43622638
has body: If you are using java-8, you can use the map operation on Stream: V[] arr = Arrays.stream(arrayOfTypeT).map(t -&gt; t.v).toArray(V[]::new); or even better (if good encapsulation) V[] arr = Arrays.stream(arrayOfTypeT).map(T::getV).toArray(V[]::new); So here's the benchmark (note that I'm not a JMH guru): @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) public class Benchmark { static Integer[] ints = IntStream.range(0, 1_000_000).boxed().toArray(Integer[]::new); public static void main(String... args) throws RunnerException { Options opt = new OptionsBuilder() .include(".*" + Benchmark.class.getSimpleName() + ".*") .forks(1) .warmupIterations(20) .build(); new Runner(opt).run(); } @GenerateMicroBenchmark public void standardForLoop() { final String[] arr = new String[ints.length]; for (int i = 0; i &lt; ints.length; i++) { arr[i] = String.valueOf(ints[i]); } } @GenerateMicroBenchmark public void forEachLoop() { final String[] arr = new String[ints.length]; for (int i : ints) { arr[i] = String.valueOf(i); } } @GenerateMicroBenchmark public void streamMapOperation() { @SuppressWarnings("unused") String[] arr = Arrays.stream(ints).map(String::valueOf).toArray(String[]::new); } @GenerateMicroBenchmark public void streamParallelMapOperation() { @SuppressWarnings("unused") String[] arr = Arrays.stream(ints).parallel().map(String::valueOf).toArray(String[]::new); } } And the results: Benchmark Mode Samples Mean Mean error Units b.Benchmark.forEachLoop avgt 20 58,455 2,359 ms/op b.Benchmark.standardForLoop avgt 20 59,214 2,415 ms/op b.Benchmark.streamMapOperation avgt 20 62,877 2,887 ms/op b.Benchmark.streamParallelMapOperation avgt 20 40,171 6,456 ms/op As you can see, for huge data-set there is no big difference between a standard loop and the stream approach. But with the stream approach, you can easily call parallel(), which makes the computations slightly more efficient (of course you could write your own multithreaded utility to do this, but that…
answers question: http://stackoverflow.com/q/27588663
has comment: http://stackoverflow.com/comment/43621892
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/43621609

http://stackoverflow.com/q/27592344
tagged with: node.js
type: UnansweredQuestion
score: 6
has title: Is it possible for node.js to import a java library
has answer: http://stackoverflow.com/a/27599284
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27595777
downvote count: 0
favorite count: 0
has body: I have a nodejs application that has some expensive computations. I'm thinking of doing this part in java so I can more easily take advantage of threading and math libraries. Is there an easy way to have nodejs talk to external java libraries? The java library will contain a loop that frequently calls javascript functions. Will I see a big performance hit due to having these two libraries constantly cross talk (rather than packaging the entire task, sending it to the jvm, and then getting a result back)
upvote count: 6

http://stackoverflow.com/comment/43439258
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27504597
has text: where can i set the param ? which part ? I mean in the loop.
score: 0

http://stackoverflow.com/comment/56786710
has text: Well as some of us review about a 1000 a day, [this Reference](http://meta.stackoverflow.com/a/260641/1816093) ... you have a high rep. Problem is with rep <100 spamming. Thanks. Keep on truckin'
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/34509348
type: Comment

http://stackoverflow.com/q/27527969
has answer: http://stackoverflow.com/a/27528017
type: Question
has body: I am trying to build a program that libraries can use. The user inputs the date they loaned the book, and it calculates that date + 5 days (when the book is due). Then checks if the current date is before or after the due date. Then says if it is late or not.
score: -1
has title: How do you input initialize and add days to dates? (java)
answer count: 2
upvote count: 0
tagged with: days
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27528231
has comment: http://stackoverflow.com/comment/43484561
tagged with: java
has comment: http://stackoverflow.com/comment/43484800
downvote count: 1

http://stackoverflow.com/comment/43474999
comment on: http://stackoverflow.com/q/27522936
score: 0
type: QuestionComment
type: Comment
has text: @Harbinger - Check *Bathsheba's* answer.. :)

http://stackoverflow.com/comment/43609975
comment on: http://stackoverflow.com/a/27588790
score: 0
type: Comment
type: AnswerComment
has text: thanks. I figured out the reason)))http://dl1.joxi.net/drive/0005/3037/338909/141221/1c708cb30a.jpg

http://stackoverflow.com/a/27481388
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27481282
has body: This is actually not about Java, but about the shell you're using. On the shell (i.e. bash, command prompt, etc.) arguments are generally broken up using spaces. For instance, java my.class The quick brown fox would result in an argument list of String[] { "The", "quick", "brown", "fox" } However, the shell usually allows the user to make multiple spaced strings a single argument by surrounding them with double quotes - the behavior you're seeing. For instance, java my.class The quick "brown fox" would result in an argument list of String[] { "The", "quick", "brown fox" } This means double quotes are removed from the argument list and are not literally inserted into the string. If my assumption is correct, and you're running shell commands via your program given some sort of other command system, then you can simply surround every piece of the command in double quotes.

http://stackoverflow.com/comment/43523780
type: QuestionComment
comment on: http://stackoverflow.com/q/27548448
score: 0
has text: JRE is 1.6.0. Compiler is 1.6.0_11
type: Comment

http://stackoverflow.com/comment/43587088
comment on: http://stackoverflow.com/q/27581347
has text: @rafalopez79 well when I create private String playerInput; and then get and set methods. then my instance stops working in my main method.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43539498
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27556533
type: AnswerComment
has text: There are more than just 3 objects: String pool (1 object), `String.class` (1 object), the backing `char[]` for each `String` (since an array in Java is an object, 3 more objects), and on...

http://stackoverflow.com/comment/43401386
type: QuestionComment
comment on: http://stackoverflow.com/q/27484606
has text: @Marv I agree, they look similar, but my error message says `unable to obtain a line`, while his error says `line with format...`
score: 0
type: Comment

http://stackoverflow.com/comment/43607692
has text: Yes you should call the method. Where depends on your app. Find a method that is triggered when you leave the screen. For example: OnPause for android, windowclosing event for swing. If you are using a button to close the screen its onclick event. In this method have your observers remove themselves.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27591041
type: Comment

http://stackoverflow.com/q/27636829
linked to: http://stackoverflow.com/q/11761552
downvote count: 0
tagged with: java
has title: Happens-Before relation in Java Memory Model
has comment: http://stackoverflow.com/comment/43698625
tagged with: happens-before
type: Question
has comment: http://stackoverflow.com/comment/43694550
tagged with: java-memory-model
tagged with: jvm-hotspot
upvote count: 6
has answer: http://stackoverflow.com/a/27636936
answer count: 2
linked to: http://stackoverflow.com/q/10439527
has comment: http://stackoverflow.com/comment/43693781
has body: Regarding JLS ch17 Threads and Locks, it says "if one action happens-before another, then the first is visible to and ordered before the second"; I wonder: (1) What does it really mean by saying "ordered before"? Because even if action_a happens-before action_b, action_a can be executed after action_b in some implementation, right? (2) If action_a happens-before action_b, does it mean action_a MUST NOT see action_b? Or action_a may see or may not see action_b? (3) If action_a does NOT happen-before action_b, and action_b does NOT happen-before action_a, does it mean action_a may see or may not see action_b? (4) There could not be any cyclic happens-before, right? Any answer would be appreciated :)
has answer: http://stackoverflow.com/a/27637513
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/43693269

http://stackoverflow.com/a/27571768
downvote count: 0
answers question: http://stackoverflow.com/q/27570896
upvote count: 2
type: Answer
score: 2
has body: Does anyone know if I should be concerned with the overhead of resuming/pausing a Java thread at very rapid intervals when using Thread.sleep(), Possibly. Sleeping gives up the CPU and there is no guarentee it will wake promptly. It might take 11 or 15 ms in rare cases. After waking up, you CPU will run slower for about 200 micro-seconds while the CPU cache warms up again. is there another alternative I should be looking at? Don't sleep ever. It costs more but your code won't slow down. For starters I don't see another option other than Thread.sleep(), There is LockSUpport.park(nanos) which has more precision. hope this makes sense! I would sleep by the length of time between quote updates as it occurred originally. I would put an upper limit on this like 10 to 100 ms depending on your use case. If you want to be precise, you can busy wait for the delay you need.

http://stackoverflow.com/comment/43435825
type: QuestionComment
comment on: http://stackoverflow.com/q/27499317
has text: @dimo414 ......please suggest a better pattern of achieving this business objective??
score: 0
type: Comment

http://stackoverflow.com/a/27623991
answers question: http://stackoverflow.com/q/27623206
type: Answer
accepted answer of: http://stackoverflow.com/q/27623206
has body: I finally figured out why. I decompiled the SDK to have a closer look. The package name was hardcoded into some of the conditions that relate to the non-firing listeners. I refactor their package name within my build script, but the script ignores strings. So naturally they wouldn't fire because the package name has changed.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/27492710
has comment: http://stackoverflow.com/comment/43418460
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43417370
has comment: http://stackoverflow.com/comment/43417361
score: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I have some code that encodes a map as XML, and later decodes this XML. It works as expected when the map values only have ASCII characters, otherwise it crashes. How can I make it work with Unicode characters? Keep in mind that I have legacy data that's encoded using this scheme, so switching to a totally different encoding method is not an option. String firstName = "Влади́мир"; Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); map.put("firstName", firstName); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); XMLEncoder encoder = new XMLEncoder(outputStream); encoder.writeObject(map); encoder.close(); String serialized = outputStream.toString("UTF-8"); System.out.println(serialized); // output looks OK XMLDecoder decoder = new XMLDecoder(new StringInputStream(serialized)); Map&lt;String, Object&gt; mapOut = (Map&lt;String, Object&gt;) decoder.readObject(); // exception! Error: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x12) was found in the element content of the document. Continuing ... Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at com.sun.beans.ObjectHandler.dequeueResult(ObjectHandler.java:139) at java.beans.XMLDecoder.readObject(XMLDecoder.java:206)
type: UnansweredQuestion
has title: Java XMLEncoder, XMLDecoder, and UTF-8

http://stackoverflow.com/comment/43438142
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27504047
type: Comment
has text: That means i cannot make objects in the second class right??

http://stackoverflow.com/comment/43514524
has text: As you're working with WPS you might be interested in the [ogc-schemas](https://github.com/highsource/ogc-schemas) project.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27543072

code-duplication
tags question: http://stackoverflow.com/q/27503251
tag name: code-duplication
type: Tag

http://stackoverflow.com/comment/43453893
type: Comment
has text: I'm saying if a method's argument is an object defined only thru an interface isn't that method using without any knowledge of the concrete implementation? In that sense it is abstract no?
comment on: http://stackoverflow.com/a/27509901
score: 0
type: AnswerComment

http://stackoverflow.com/a/27521300
score: 1
answers question: http://stackoverflow.com/q/27521246
downvote count: 0
has body: Your question doesn't make much sense. When you call a constructor, you are passing it data from outside the instance being created with this constructor. The method getSubj looks like a setter (despite its name). It is another way to update the state of the object after the constructor is called, but it's not passing anything to the constructor, since it can't be called before the constructor is executed (unless the constructor calls it, in which case the constructor would be passing data to it and not the other way). You code would make more sense this way: private int sub; public void setSubj (int sub) // renamed from getSubj, since it's a setter { this.sub = sub; } public schedule (int sub) { this.sub = sub; } public static void main (String[] args) { schedule s = new schedule (10); // invoke the constructor s.setSubj(20); // invoke the setter method to change the state of the instance }
type: Answer
upvote count: 1

http://stackoverflow.com/q/27496641
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: maven
score: 2
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
tagged with: debugging
has title: Debugging appengine in Java with breakpoints
has body: I'm struggling to get breakpoints to work in a Google Appengine project. I followed the guide here https://cloud.google.com/appengine/docs/java/webtoolsplatform which explains how to set up a google app engine server on your local machine and run your app locally. I can do all that. I can access my app via http://localhost:8888 as well as http://localhost:8888/_ah/api/explorer etc. Now onto my problem. None of my breakpoints stop! Even when I place a break point in every possible location the server could go to, nothing happens. This is true when I browse code normally on the regular http://localhost:8888 site, or the /_ah/api/explorer section. When I shut down the server, everything stops (so I know the server created by Eclipse is the one running the show) and when I am in debug-view I can manually suspend the entire app (which will also I am running the Google App Engine tutorial project from Udacity: https://www.udacity.com/course/progress#!/c-ud859 It is a maven based project (though for this debugging, I am compiling using the Google App Engine tutorial linked at the top) It github repo is here https://github.com/udacity/ud859 And my forked repo where I have my exact code is here: https://bitbucket.org/esend7881/udacity-googleapp.git I really can't tell what I am missing here.
has answer: http://stackoverflow.com/a/27575344
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/82714301

http://stackoverflow.com/q/27639753
has answer: http://stackoverflow.com/a/27639846
possible better answer: http://stackoverflow.com/a/27639948
has answer: http://stackoverflow.com/a/27640018
score: 0
has body: My question might seem ditto duplicate, but I have seen several questions and could not satisfy my quest. I have a data like this: index value 1 220 2 123 3 11123 4 440 5 3400 I have saved it into String[] data= new String[5]; as following: data[0]= 1 + " " + 220; data[1]= 2 + " " + 123; ... Now what I do is: Arrays.sort(data); What it does is sorting, but w.r.t. 1st column. I want this to do it for me w.r.t. 2nd column. Is it possible or if I am wrong? Also I am not sure if this is the right way I have used to save this kind of data? How about, if I want to use int(s) to save these values, how will everything go? i.e. from saving data to get it sorted in formal Java style? EDIT: This is a two columns case, where I have said index and value. I am particularly interested in a case with more than two columns and different data types. Where sorting should be performed w.r.t. the elements of any column specified.
has title: How to sort an array of objects w.r.t. key using Java?
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/27639846
tagged with: java
has comment: http://stackoverflow.com/comment/43698473
has comment: http://stackoverflow.com/comment/43699134
has comment: http://stackoverflow.com/comment/46137355
answer count: 4
type: AnsweredQuestion
tagged with: arrays
tagged with: string
tagged with: sorting
has answer: http://stackoverflow.com/a/27639948
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27639800

http://stackoverflow.com/comment/43618085
type: QuestionComment
comment on: http://stackoverflow.com/q/27596904
has text: @user2248702 str.split() does take a regex too ie `(?<!\\),` to split string on comma not followed by a `\`
score: 0
type: Comment

http://stackoverflow.com/q/27526794
has comment: http://stackoverflow.com/comment/43482327
has comment: http://stackoverflow.com/comment/43482912
has comment: http://stackoverflow.com/comment/43482054
answer count: 0
score: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/43482346
has comment: http://stackoverflow.com/comment/43482652
tagged with: java
has body: I have never dealt with .data files before. I have 50 csv files which are 2-dimensional. I would like to split them into 2 separate .data files (as is required by a library I am using). Is there any easy way to do this? How does a .data file look like?
has comment: http://stackoverflow.com/comment/43483846
has title: Java multiple csv files to .data file?
has comment: http://stackoverflow.com/comment/43482189

http://stackoverflow.com/q/27637335
possible better answer: http://stackoverflow.com/a/27637406
favorite count: 0
downvote count: 2
upvote count: 1
tagged with: spring
tagged with: autowired
type: AnsweredQuestion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27647678
type: Question
has title: Spring Bean created before AutowiredAnnotationBeanPostProcessor added to AbstractBeanFactory.beanPostProcessors
has body: In spring-context 4.0.5 call invokeBeanFactoryPostProcessors in AbstractApplicationContext.refresh() maybe leads to create some bean in BeanFactoryPostProcessor implementation. The problem is AutowiredAnnotationBeanPostProcessor not added to AbstractbeanFactory.beanPostProcessors at the time that the bean created(It was added by call registerBeanPostProcessors(beanFactory) in the next line) so @Autowired properties will be null. How can I solve this issue?
answer count: 2
has answer: http://stackoverflow.com/a/27637406
accepted answer: http://stackoverflow.com/a/27647678

rcp
tags question: http://stackoverflow.com/q/27485302
tags question: http://stackoverflow.com/q/27509698
tags question: http://stackoverflow.com/q/27486061
tags question: http://stackoverflow.com/q/27550002
tags question: http://stackoverflow.com/q/27562370
type: Tag
tags question: http://stackoverflow.com/q/27528375
tag name: rcp
tags question: http://stackoverflow.com/q/27634525

http://stackoverflow.com/comment/43486548
comment on: http://stackoverflow.com/q/27528835
type: QuestionComment
type: Comment
score: 0
has text: Just use a `SimpleDateFormat`. Data validation is incredibly complex and almost impossible to implement correctly.

http://stackoverflow.com/comment/43450026
type: Comment
has text: is there a reason you used hex over decimal?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27509914

http://stackoverflow.com/comment/43585385
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/27580504
type: Comment
has text: `charAt(0)` should be `s.charAt(0)`.

http://stackoverflow.com/q/27561662
score: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43551429
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: coldfusion
has comment: http://stackoverflow.com/comment/43551290
tagged with: cookies
upvote count: 3
has title: How to get java class in CF
downvote count: 1
type: Question
tagged with: phantomjs
tagged with: java
has answer: http://stackoverflow.com/a/29761338
has body: I want to access the return value from a java method in my coldfusion file. I have loaded all the jar files in coldfusion file and got the java class object successfully. Using the class object, I want to access java class method which returns a Set; but I can't get any return value. Here is my Java Code: public Set getSession(String url) { result+="hello"; try { DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability("takesScreenshot", false); caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "E:\\TicketScraper\\phantomjs\\phantomjs.exe" ); driver = new PhantomJSDriver(caps); driver.get(url); driver.findElement(By.id("login:loginName")).sendKeys("XXXX"); driver.findElement(By.id("login:password")).sendKeys("XXXX"); waitForJQueryProcessing(driver, 5); driver.findElement(By.id("login:j_idt145")).click(); Thread.sleep(10000); Set&lt;org.openqa.selenium.Cookie&gt; allCookies=driver.manage().getCookies(); for ( org.openqa.selenium.Cookie loadedCookie : allCookies) { System.out.println(String.format("%s -&gt; %s", loadedCookie.getName(),loadedCookie.getValue())); } } catch(Exception e) { System.out.println(e); } return allCookies; } The java code runs the Phantom JS driver, logs in to the URL in the above code, and gets all cookies. All cookies are collected in a Set variable and returned from the method. I want to get this set variable in CF code. But when I have tried to access the java method's Set variable in CF it doesn't return any value. By contrast, when I have commented out all the Phantom JS code and return only a String variable then CF can access the string value. Here is my CF code: &lt;cfscript&gt; paths = arrayNew(1); paths[1] = expandPath("lib\apache-mime4j-0.6.jar"); paths[2] = expandPath("lib\bsh-1.3.0.jar"); paths[3] = expandPath("lib\cglib-nodep-2.1_3.jar"); paths[4] = expandPath("lib\commons-codec-1.9.jar"); paths[5] = expandPath("lib\commons-collections-3.2.1.jar"); paths…
has comment: http://stackoverflow.com/comment/43570549

http://stackoverflow.com/comment/43661432
has text: I read the question, and I presume that a deleted record from 'active_sessions' table would effectively kill the session within the rest of the webapp (otherwise, why not just leave Tomcat etc to do session management?). Can you guarantee that the entire network path is secure? If not, an attacker may be able to see sessionId's and perform the required calls to kick an active user out. Session management on client side is virtually always a bad idea.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27620264

http://stackoverflow.com/comment/43691586
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27567843
has text: This is my first time to post questions here，Thank you very much for your help, is very useful to me
score: 0

http://stackoverflow.com/comment/43519516
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27545013
type: QuestionComment
has text: i think that, this exception is not fault of the missing libraries, but proably POIFSFileSystem has closed the inputStream connection.

http://stackoverflow.com/q/27592298
tagged with: java
upvote count: 3
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/43608318
favorite count: 0
has comment: http://stackoverflow.com/comment/43608650
has title: ArrayIndexOutOfBoundsException when creating shaded jar with minimizeJar option
downvote count: 0
has answer: http://stackoverflow.com/a/47047458
type: UnansweredQuestion
has body: I am getting the error, when creating the shaded jar with maven-shade plugin. I tried debugging the error with mvnDebug but no helps. My end goal was to minimize the size of the jar. Any other option other than minimizeJar also welcomed. Thanks in advance Error creating shaded jar: 6952 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: 6952 at org.apache.maven.pl…
tagged with: maven
type: Question
score: 3
has comment: http://stackoverflow.com/comment/78596986

http://stackoverflow.com/q/27522741
answer count: 3
downvote count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/43474477
duplicate of: http://stackoverflow.com/q/17520964
possible better answer: http://stackoverflow.com/a/27522873
has title: incompatible types: inference variable T has incompatible bounds
tagged with: java
has answer: http://stackoverflow.com/a/27522835
score: 54
has answer: http://stackoverflow.com/a/27522819
type: AnsweredQuestion
upvote count: 55
has body: I have the following piece of code public int solution(int X, int[] A) { List&lt;Integer&gt; list = Arrays.asList(A); For some reason it's throwing the following compilation error Solution.java:11: error: incompatible types: inference variable T has incompatible bounds List list = Arrays.asList(A); ^ equality constraints: Integer lower bounds: int[] where T is a type-variable: T extends Object declared in method asList(T...) I assume this a Java 8 feature, but I'm not sure how to resolve the error
favorite count: 0
linked to: http://stackoverflow.com/q/25483854
type: Question
accepted answer: http://stackoverflow.com/a/27522819
duplicate of: http://stackoverflow.com/q/25483854
linked to: http://stackoverflow.com/q/17520964
has answer: http://stackoverflow.com/a/27522873

http://stackoverflow.com/comment/43469645
comment on: http://stackoverflow.com/q/27519927
score: 0
type: Comment
has text: If you need one with and without the model and have the same functionality you might need to rethink (part) of your design. Also the model attribute is already optional, a new instance will be created (depending on how you initially created/stored the model attribute).
type: QuestionComment

http://stackoverflow.com/a/50367718
type: Answer
has comment: http://stackoverflow.com/comment/93916978
upvote count: 24
has body: If you have guava dependency on your project you could do this: StreamSupport.stream(Iterables.partition(simpleList, 1000).spliterator(), false).forEach(...); See https://google.github.io/guava/releases/23.0/api/docs/com/google/common/collect/Lists.html#partition-java.util.List-int- Update to use Iterators on Stream.iterator(). This will terminate but NOT consume the Stream in creating the grouping Iterator. This could be converted back to a Stream if needed. Iterator&lt;List&lt;T&gt;&gt; listIterator = Iterators.partition(stream.iterator(), desiredSize); Stream&lt;List&lt;T&gt;&gt; listStream = StreamSupport.stream( Spliterators.spliteratorUnknownSize(listIterator, Spliterator.ORDERED), false); https://guava.dev/releases/17.0/api/docs/com/google/common/collect/Iterators.html#partition(java.util.Iterator,%20int)
score: 24
answers question: http://stackoverflow.com/q/27583623
has comment: http://stackoverflow.com/comment/130236597
has comment: http://stackoverflow.com/comment/118794626
downvote count: 0

http://stackoverflow.com/comment/43490729
type: QuestionComment
comment on: http://stackoverflow.com/q/27531092
type: Comment
score: 3
has text: Can you show the relevant code, i.e. the `FrmServer` class?

http://stackoverflow.com/a/27498571
type: Answer
score: 4
upvote count: 4
has body: Go to your Gmail account setting page and Enable access of Less secure apps. Then try with Java Mail API. Hope it works for you.
has comment: http://stackoverflow.com/comment/61782801
downvote count: 0
answers question: http://stackoverflow.com/q/27498183

http://stackoverflow.com/comment/43684134
has text: Thanks for the clue @SGC. Turns out the authorization code had timed out. Not sure if it's ok to add that much of my confusion came from using the Gmail API Quick Start Program to try and figure out OAuth authorization for an offline program. I have since discovered this very helpful link https://github.com/googleads/googleads-java-lib/blob/master/examples/dfa_axis/src/main/java/dfa/axis/auth/GetRefreshToken.java
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27615139

http://stackoverflow.com/q/27515406
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27515443
tagged with: java
has body: I am trying to find the amount of 3's in the inputed array but instead it comes up with zero or one, so I placed System.out.print to see what my array is and it was all zeros except the last value. I need the array to keep all of its values. import java.util.Scanner; public class FunArray1 { static Scanner keyboard = new Scanner(System.in); private static String input, command; private static int a, b, i, j; private static int[] inputArray; private static int total, count; public static void main(String[] args){ System.out.println("Enter A Command ::"); System.out.println("1. PNumber - Your Numbers!"); System.out.println("2. LCount - Your Lucky Numbers!"); System.out.println("3. LTotal - Your Lucky Total!"); command = keyboard.nextLine(); if (command.equals("PNumber")){ Coverter(); purifiedNumbers(inputArray); } if (command.equals("LCount")){ Coverter(); luckyCount(inputArray); System.out.println("Your Lucky Number Count is "+count); } if (command.equals("LTotal")){ Coverter(); luckyTotal(inputArray); } } private static void purifiedNumbers(int[] e){ } private static int luckyCount(int[] e){ for (i = 0; i&lt;inputArray.length; i++){ System.out.println((int)inputArray[i]); if (inputArray[i] == 3){ count++; } } return count; } private static void luckyTotal(int[] e) { for (i = 0; i&lt;inputArray.length; i++){ for(j = 3; j&lt;inputArray.length; j++){ total += inputArray[j]; if(j == 5){ i = j; break; } } } System.out.println(total); } private static int[] Coverter(){ System.out.println("Enter Your Life Numbers! ::"); input = keyboard.nextLine(); String[]Covert = input.split(" "); for (a = 0; a&lt;Covert.length; a++){ inputArray = new int[Covert.length]; inputArray[a] = Integer.parseInt(Covert[a]); } return inputArray; } }
downvote count: 1
type: Question
upvote count: 0
tagged with: arrays
has title: Why is my array turning into a bunch of zeros except the last value?
answer count: 1
score: -1
favorite count: 0

http://stackoverflow.com/a/27628612
upvote count: 4
has comment: http://stackoverflow.com/comment/43680020
downvote count: 0
answers question: http://stackoverflow.com/q/27628563
has comment: http://stackoverflow.com/comment/43678077
accepted answer of: http://stackoverflow.com/q/27628563
score: 4
has comment: http://stackoverflow.com/comment/43679837
type: AcceptedAnswer
has body: Your program is creating 2 sockets that tries to listen on the same port: ServerSocket s = new ServerSocket(0); in your main() method, and then you have ServerSocket ss = new ServerSocket(localport); in your runServer() method, which you pass in the same port as the socket created in main(). Use only one of these sockets, e.g. pass in the ServerSocket you create in main() to the runServer() method.
has comment: http://stackoverflow.com/comment/43679092
type: Answer

http://stackoverflow.com/a/30008312
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27507004
type: Answer
has body: I think the problem is not that the standard error is blocking, but that the standard output is blocking causing the application you are calling to block. Standard output is normally buffered. If the process you are calling writes less to standard output than the buffer size all is well and it can reach the code that writes to standard error. If the process fills the buffer, its attempt to write to standard output will block and it will never reach the point where it writes to standard error. This could be why you see it working occasionally - sometimes the standard output does not fill the buffer. It could also be why it works after a long time: eventually the write to standard output times out. As a demonstration, this simple process always block like you describe on my Windows 8 machine: public class Proc { public static void main(String[] args) { for(int i=0;i&lt;1000;i++) { System.out.print("More data "); } System.out.println(); System.err.println("An error line"); } }

http://stackoverflow.com/comment/43486186
type: QuestionComment
comment on: http://stackoverflow.com/q/27528218
has text: @Sizik `Integer.parseInt("1") == "1"` is clear, since `Integer` and `String` have no direct connection, except their inheritance to object.
score: 0
type: Comment

http://stackoverflow.com/comment/43651389
has text: i'm a little bit confused, i just put the manifest on the question
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27614759
type: Comment

http://stackoverflow.com/a/27512275
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27503285
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27503285
has comment: http://stackoverflow.com/comment/43456122
has comment: http://stackoverflow.com/comment/43457089
type: Answer
has comment: http://stackoverflow.com/comment/43456766
downvote count: 0
has body: You should register your custom authentication in SecurityConfig class which have extended WebSecurityConfigureAdapter: @Autowired private MyUserDetailsService userDetailsService; @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(this.userDetailsService); } for 3.2.3 the config should be @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(this.userDetailsService); }

http://stackoverflow.com/a/27622735
has comment: http://stackoverflow.com/comment/43681656
has comment: http://stackoverflow.com/comment/43693571
type: Answer
has body: Make sure external.jar exist on your classpath (either by adding to maven dependency, eclipse project settings, using -cp jvm command line arguments, etc), and just refer to the package name of the classes inside external .jar you want to include. And add &lt;context:annotation-config/&gt; to your spring-servlet.xml
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43697149
has comment: http://stackoverflow.com/comment/43687327
downvote count: 0
answers question: http://stackoverflow.com/q/27622658
has comment: http://stackoverflow.com/comment/43695922

http://stackoverflow.com/comment/43436851
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/27503324
has text: Doesn't work as shown because Base does not have the required method.

http://stackoverflow.com/comment/43513575
comment on: http://stackoverflow.com/a/27542271
has text: oh that sorry. It says 0 but i deleted 1 row.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27557682
accepted answer of: http://stackoverflow.com/q/27557504
has body: type these lines st=con.createStatement(); String sql="SELECT * FROM TAB"; rs=st.executeQuery(sql); and try to print a a field; to test quickly if the problem is in you prepared statement but probably it's in your conn object.
has comment: http://stackoverflow.com/comment/43541584
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/43542845
has comment: http://stackoverflow.com/comment/43542663
upvote count: 1
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/27557504

http://stackoverflow.com/q/27633886
tagged with: raspberry-pi
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java-me
favorite count: 0
has body: I'm writing a test application for UART in Java ME8 and this applicatuon is running on Raspberry Pie board. I have used GPIO 15 and 15 for TXD and RXD. and made a level converter DB9. DB9 connected tested with Pi to PC(working). But when I connect Pi with other device (Pi - Device) its not working. this is due to DTR required for other device. On Pi board I don't have option for DTR pin, how can I solve this issue? is there anyway we can use jdk.dio.uart.UART to solve this ? Can I set DTR using jdk.dio.uart.UART? Can I make DB9 pin4 always high to solve this problem? import jdk.dio.DeviceManager; import jdk.dio.uart.UART; import jdk.dio.uart.UARTConfig; private UART uart; private InputStream iStream; private OutputStream oStream; private final int UART_DEVICE_ID = 40; //standard for Rasp Pi private final int UART_BAUD_RATE = 9600; private final int UART_DATA_BITS = UARTConfig.DATABITS_8; private final int UART_PARITY_BIT = UARTConfig.PARITY_NONE; private final int UART_STOP_BIT = UARTConfig.STOPBITS_1; uart =(UART) DeviceManager.open(UART_DEVICE_ID); // 40 is UART device ID uart.setBaudRate(UART_BAUD_RATE); uart.setDataBits(UART_DATA_BITS); uart.setParity(UART_PARITY_BIT); uart.setStopBits(UART_STOP_BIT); oStream = Channels.newOutputStream(uart); iStream = Channels.newInputStream(uart); Thanks, Ashok
type: Question
tagged with: serial-port
tagged with: uart
tagged with: java
upvote count: 1
has title: Confure DTR for UART in Java ME8 on Raspberry Pi board

http://stackoverflow.com/comment/43443997
score: 0
type: AnswerComment
type: Comment
has text: @misco - I have updated my answer with some information that should help.
comment on: http://stackoverflow.com/a/27504984

http://stackoverflow.com/comment/43629261
score: 0
type: AnswerComment
has text: ...and how does he configure it?
type: Comment
comment on: http://stackoverflow.com/a/27603366

http://stackoverflow.com/a/27594694
has comment: http://stackoverflow.com/comment/43617980
type: Answer
has body: Make a java package like Icons for example , place the image in there , and then call getResource("Icons/YahtzeeBoard.png") this way the images will be packaged inside the jar . or you can put the images in the same folder as the jar for the path "/YahtzeeBoard.png" to be found , since that points to the folder where the jar is .
score: 0
answers question: http://stackoverflow.com/q/27594586

http://stackoverflow.com/q/27634746
accepted answer: http://stackoverflow.com/a/27635142
tagged with: android
favorite count: 0
upvote count: 2
has body: I have an app in which I have a WebView where I display some websites. I want create a Share button in Menu.I've tried a lot of code. What should I write here ? private void action_shareMenuItem(){ //??????????????? What should I write here ? } MainActivity.java package com.kefelon.goldplak; import android.app.AlertDialog; import android.content.DialogInterface; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.support.v7.widget.ShareActionProvider; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; public class MainActivity extends ActionBarActivity { WebView webview; private ShareActionProvider mShareActionProvider; ProgressBar loadingProgressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webview = (WebView) findViewById(R.id.webview); webview.getSettings().setSupportZoom(true); webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www.goldplak.com"); webview.setWebViewClient(new WebViewClient() { }); loadingProgressBar=(ProgressBar)findViewById(R.id.progressbar_Horizontal); webview.setWebChromeClient(new WebChromeClient() { // this will be called on page loading progress @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); loadingProgressBar.setProgress(newProgress); //loadingTitle.setProgress(newProgress); // hide the progress bar if the loading is complete if (newProgress == 100) { loadingProgressBar.setVisibility(View.GONE); } else{ loadingProgressBar.setVisibility(View.VISIBLE); } } }); } @Override public void onBackPressed() { if(webview.canGoBack()){ webview.goBack(); }else{ new AlertDialog.Builder(this) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle("Çıkış") .se…
has title: Android Share Menu
tagged with: webview
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43688918
type: Question
answer count: 2
downvote count: 4
possible better answer: http://stackoverflow.com/a/27634907
has answer: http://stackoverflow.com/a/27635142
score: -2
has answer: http://stackoverflow.com/a/27634907
tagged with: share

http://stackoverflow.com/comment/43619337
type: Comment
score: 0
type: AnswerComment
has text: have you test this... for my xml it returns #text.
comment on: http://stackoverflow.com/a/27597917

http://stackoverflow.com/comment/43746762
comment on: http://stackoverflow.com/a/27542035
has text: @Paul I don't see how column aliases would help you with an update statement. You might want to post a new question.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27481338
has comment: http://stackoverflow.com/comment/43395513
has comment: http://stackoverflow.com/comment/43395946
answers question: http://stackoverflow.com/q/27481282
has body: So you want your String object to contain quotes? Try escaping them with backslash: cmd.add("some string with \"quotes\"");
downvote count: 0
has comment: http://stackoverflow.com/comment/43396353
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/43633565
comment on: http://stackoverflow.com/q/27604932
score: 1
has text: You said you used "java -cp", did you try ./gradlew run as detailed in the README?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27522071
has body: The MediaPlayer#setDataSource(String) method expects a path to a file, which a Resource within your package is not. You can parse your String as a URI, and use an overload: Uri uri = Uri.parse("android.resource://com.example.test/raw/paulemma.mp3"); mediaPlayer.setDataSource(this, uri); Or, you can use the static MediaPlayer.create() method with a Resource id to create a prepared player: mediaPlayer = MediaPlayer.create(this, R.raw.paulemma); With the second method, you do not need to call setDataSource() or prepare().
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27520490
answers question: http://stackoverflow.com/q/27520490
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/27546005
type: Answer
answers question: http://stackoverflow.com/q/27545934
score: 2
downvote count: 0
upvote count: 2
has body: You read the line in the loop, split it, and assign to words array, defined outside. On the next iteration, you get the next line, split it, and (re-) assign the same array. After the the last iteration, the words array therefore contains the results of splitting the last line, that's what you print out in the end.

http://stackoverflow.com/a/27754484
accepted answer of: http://stackoverflow.com/q/27606819
score: 3
answers question: http://stackoverflow.com/q/27606819
upvote count: 3
has comment: http://stackoverflow.com/comment/46817387
has body: Add Java.net repo in your app: java.net https://maven.java.net/content/repositories/public/
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27531154
answers question: http://stackoverflow.com/q/27531085
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/43491309
has body: That doesn't make much sense. If the response content was encoded with a character encoding X, decoding it with character encoding Y would cause undefined results. instead I need to force to use always the utf-8 content-type I don't recommend this, but you can always get the response's InputStream and process the bytes as you see fit. InputStream responseContent = entity.getContent(); (Don't forget to close() it.)
downvote count: 0

http://stackoverflow.com/comment/43595903
type: QuestionComment
has text: Place your token fetching code inside `StatusActivity` `onCreate()´ method, instead. Make sure you are sending some value as token in the FirstActivity.
score: 0
comment on: http://stackoverflow.com/q/27585607
type: Comment

http://stackoverflow.com/q/27575311
has comment: http://stackoverflow.com/comment/43576069
has answer: http://stackoverflow.com/a/27575425
accepted answer: http://stackoverflow.com/a/27575425
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27575492
tagged with: java
has body: I have a class like this: public class AbstractParameter&lt;T extends Comparable&gt; { .... public void validate(T tempVal, StringBuilder msg) { if(tempVal.compareTo(new Integer(0)) != 0 ) { //do something } } .... } The tempVal will be an Integer. It compiles and runs fine. But if I change the T extends Comparable to T extends Comparable&lt;T&gt; Above if statement generated the following compile error: required: T#1 found: Integer reason: actual argument Integer cannot be converted to T#1 by method invocation conversion where T#1,T#2 are type-variables: T#1 extends Comparable&lt;T#1&gt; declared in class AbstractParameter T#2 extends Object declared in interface Comparable I can cast the new Integer(0) to T to remove the compile error. My question is should I use public class AbstractParameter&lt;T extends Comparable&gt; or public class AbstractParameter&lt;T extends Comparable&lt;T&gt;&gt;? I guess the public class AbstractParameter&lt;T extends Comparable&lt;T&gt;&gt; should be the way to go but that (T)new Integer(0) cast seems annoyance. Is there anything wrong in my code?
type: Question
has title: Why generic constraint T extends Comparable<T> is not sufficient to avoid a cast?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27575492

http://stackoverflow.com/a/27475502
has comment: http://stackoverflow.com/comment/43386837
has comment: http://stackoverflow.com/comment/43385333
has comment: http://stackoverflow.com/comment/43386071
has comment: http://stackoverflow.com/comment/43386740
type: Answer
has comment: http://stackoverflow.com/comment/43385848
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43385577
answers question: http://stackoverflow.com/q/27475205
upvote count: 2
has comment: http://stackoverflow.com/comment/43385678
has body: The first problem with your code is the style. Here is what it should look like, using the coding conventions for java: void dispItem(){ ItemNode current = head; current = findItem(); if(current == null){ System.out.println("\nThe item was not found.\n"); } else current.dispItem(); } ItemNode findItem(){ ItemNode current = head; System.out.println("\nPlease enter the ID of the item you are looking for.\n"); int ID = keyboard.nextInt(); while(current != null){ if(ID == current.getItemID()){ current.dispItem(); } else System.out.println("Error."); } return (current); } public static void processChoice(int qChoice, InvenLL qMyAcct){ switch(qChoice){ case 1: qMyAcct.dispItems(); break; case 2: qMyAcct.addItem(); break; case 3: qMyAcct.dispItem(); break; case 4: qMyAcct.modifyItem(); break; case 5: System.out.println("\nYou have exited the program. The item data will now be saved. Good bye!\n"); break; } } With stylistic problems out of the way, the logical error becomes more obvious. The logical error in your program is right here in this loop: while(current != null){ if(ID == current.getItemID()){ current.dispItem(); } else System.out.println("Error."); } As written, this loop will never terminate, because current is never updated inside the loop. You probably meant to do something like this: while(current != null){ if(ID == current.getItemID()){ current.dispItem(); } else System.out.println("Error."); current = current.next(); //or whatever function returns the next node. } However, this still makes no sense. findItem should not be printing errors or displaying the list contents; it should be finding the item and nothing else. This is a result of mixing your business logic with your application logic. A proper implementation of this sort of thing would have the linkedlist be entirely separate from the menu prompts and stuff. In fact, in the real world one wouldn't be implementing a linked list at all -- one would use a java.util.LinkedList. I suspect that that isn't a…

http://stackoverflow.com/comment/43425787
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27497123
has text: I use 4 in the loop because for a 7x7 board, you are printing "+-+-+-+" 4 times, and are printing "| | | |" 3 times. If I were to remove the break at x=3 (Which is the fourth time the loop is running since the loop starts at 0, and goes like this 0,1,2,3) then the program would also print "| | | |" 4 times, however what I do is that after it has printed "+-+-+-+" 4 times, that means up to that it has printed "| | | |" 3 times, and since we don't want to print "| | | |" any more times, we break and exit the loop.

http://stackoverflow.com/comment/43471659
comment on: http://stackoverflow.com/a/27519693
has text: If i want to substring multiple fields from a record and need to concatenate them, then creating StringBuilder is the right option or not? Like some more parsing and concatenations in the above for loop.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/32431512
score: 1
answers question: http://stackoverflow.com/q/27528652
has body: Just Copy the tools.jar from your jdk to Android lib directory.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/27540803
upvote count: 2
type: AcceptedAnswer
has body: Can you give a try with the below out.write(buf.getBytes("UTF-8")); or out.write(new String(buf, "UTF-8")); and also change while reading the file - ((new FileInputStream(file), "UTF8")); Hope this helps you
has comment: http://stackoverflow.com/comment/43527296
type: Answer
has comment: http://stackoverflow.com/comment/43521708
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27540240
answers question: http://stackoverflow.com/q/27540240

http://stackoverflow.com/comment/43574624
has text: Fair enough, but the logic would be the same. You can either use user87049's answer, or do a generic "get all entities of kind" and run a "count()" on the returned object.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27573330

http://stackoverflow.com/comment/43645114
comment on: http://stackoverflow.com/a/27611282
score: 0
type: AnswerComment
type: Comment
has text: @pbabcdefp: no, pass by reference doesn't imply you have any tools to **modify** the reference. That would by *pass-by-pointer*. There is a clear difference between a reference and a pointer. It depends on how you see an `object`. If you see an object only as the *reference* to that object, it is indeed, pass-by-value. But if you see objects as the objects themselves, it is pass-by-value.

http://stackoverflow.com/comment/43528204
comment on: http://stackoverflow.com/q/27550929
score: 0
type: Comment
type: QuestionComment
has text: If you want to use a class in a JSP you have to tell the jsp engine about it (i.e. import it). Some reading: http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files

http://stackoverflow.com/comment/43667303
score: 0
type: Comment
has text: I am going to upgrade my spring and log4j libraries. If that does not help then I will open a support ticket with Oracle.
comment on: http://stackoverflow.com/a/27600182
type: AnswerComment

http://stackoverflow.com/comment/43439894
type: QuestionComment
score: 1
has text: If you want to make calculations on the date/time, maybe better normalize it to UTC and then save the timestamp value ( milliseconds since epoch)
comment on: http://stackoverflow.com/q/27504888
type: Comment

http://stackoverflow.com/a/27517723
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27517649
has comment: http://stackoverflow.com/comment/43465511
type: Answer
downvote count: 1
score: 3
upvote count: 4
answers question: http://stackoverflow.com/q/27517649
has body: As @JaredRummler suggested, you need to read the contents of the file into a String first, and then pass that String to the JSONArray constructor. Here's some sample code that uses Apache Commons IO to read the file: import org.apache.commons.io.IOUtils; ... public static String readJsonFile(String filename) throws IOException { try (InputStream is = new FileInputStream(filename)) { return IOUtils.toString(is, StandardCharsets.UTF_8); } } .... JSONArray array = new JSONArray(readJsonFile(jsonFilePath));

http://stackoverflow.com/comment/43476191
type: Comment
has text: myMap return as `projects = {projectId=24, projectName=K245}`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27523336

http://stackoverflow.com/a/27526375
has body: You could use String's matches method with a regex like below to resolve both kind of your validation requirements: if (!textFieldValue.matches("[0-9]+")) { throw new IllegalArgumentException("Hey Your textbox value contains illegal value " + textFieldValue); }
has comment: http://stackoverflow.com/comment/43509725
has comment: http://stackoverflow.com/comment/43504252
score: 0
answers question: http://stackoverflow.com/q/27526232
type: Answer

http://stackoverflow.com/comment/43622709
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27570773
has text: Or is it one NM for a multinode cluster.

http://stackoverflow.com/comment/43598577
type: Comment
score: 2
has text: Java GUIs have to work on different OS', screen size, screen resolution etc. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556).
type: QuestionComment
comment on: http://stackoverflow.com/q/27587048

http://stackoverflow.com/q/27609071
score: 9
answer count: 1
tagged with: gwt
has title: Deploy libgdx to html5 on android studio
upvote count: 9
tagged with: java
accepted answer: http://stackoverflow.com/a/27637635
type: AnsweredQuestion
tagged with: libgdx
downvote count: 0
has body: I created a game using libgdx with android studio (Intellij) and I would like to deploy it as a html5 code. Can someone please help me doing this? I saw that when using eclipse it's simply right clicking on the html package, and selecting "Google -> GWT Compile" but i can't find anything like that in android studio (intellij. Thanks alot!
type: Question
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
tagged with: android-studio
has answer: http://stackoverflow.com/a/27637635

http://stackoverflow.com/a/27717046
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27501221
downvote count: 0
has body: So there are two issues here - creating the random string, and making sure there's no duplicate already in the db. If you are not bound to 8 characters, you can use a UUID as the commenter above suggested. The UUID class returns a strong that is highly statistically unlikely to be a duplicate of a previously generated UUID so you can use it for this precise purpose without checking if its already in your database. UUID.randomUUID().toString(); Or if you don't care whether what the unique id is as long as its unique you could use an identity or autoincrement field which pretty much all DB's support. If you do that, though you have the read the record after you commit it to get the identity assigned by the db. which produces a string which looks something that looks like this: 5e0013fd-3ed4-41b4-b05d-0cdf4324bb19 If you are have to have an 8 character string as your unique id and you don't want to import the apache library, \you can generate random 8 character string like this: final String alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; final Random rand= new Random(); public String myUID() { int i = 8; String uid=""; while (i-- &gt; 0) { uid+=alpha.charAt(rand.nextInt(26)); } return uid; } To make sure its not a duplicate, you should add a unique index to the column in the db which contains it. You can either query the db first to make sure that no row has that id before you insert the row, or catch the exception and retry if you've generated a duplicate.

http://stackoverflow.com/comment/43582452
has text: http://stackoverflow.com/questions/4945178/cannot-run-eclipse-jvm-terminated-exit-code-13
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27578891

http://stackoverflow.com/q/27639173
type: Question
upvote count: 2
has title: PulleyJoint odd behaviour Box2D
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27639238
accepted answer: http://stackoverflow.com/a/27639238
has body: I am trying to build a lever in an android game using box2d and libgdx. When the game starts, the 2 platforms of the lever are balancing perfectly and when I move a box on one platform of the lever, it goes down as expected but when I move the body out, the 2 platforms doesn't balance again as before. I am using this code to create the 2 platforms: private Body setupShape(World world, float cx, float cy, float cw, float ch){ Body ptf; PolygonShape shape = new PolygonShape(); shape.setAsBox(cw / 2, ch / 2); FixtureDef fdef = new FixtureDef(); fdef.shape = shape; fdef.density = 1.0f; fdef.friction = 1.0f; fdef.restitution = 0.0f; BodyDef bd = new BodyDef(); //bd.allowSleep = false; bd.position.set(cx, cy); bd.fixedRotation = true; ptf = world.createBody(bd); //lever.setGravityScale(10); ptf.createFixture(fdef); ptf.setType(BodyDef.BodyType.DynamicBody); ptf.setUserData("Lever"); shape.dispose(); return ptf; } And this code for creating the lever using "PulleyJoint": PulleyJointDef pulleyDef = new PulleyJointDef(); Vector2 bodyoneanchor = new Vector2(Constants.Pixel2SIf(360), Constants.Pixel2SIf(400)); Vector2 bodytwoanchor = new Vector2(Constants.Pixel2SIf(660), Constants.Pixel2SIf(400)); pulleyDef.initialize(bodyA, bodyB, bodyoneanchor, bodytwoanchor, bodyA.getWorldCenter(), bodyB.getWorldCenter(), 1); world.createJoint(pulleyDef); I would like to know what's wrong with my code and how to make the lever re-balance again after moving out objects from it. Here's a drawing to demonstrate my problem more clearly: http://costheta.net/quest.png It will be very much appreciated if you could help me fixing that problem. Best regards! UPDATE: Here's my new code after adding Prismatic joints: PulleyJointDef pulleyDef = new PulleyJointDef(); Vector2 bodyoneanchor = new Vector2(Constants.Pixel2SIf(360), Constants.Pixel2SIf(400)); Vector2 bodytwoanchor = new Vector2(Constants.Pixel2SIf(660), Constants.Pixel2SIf(400)); pulleyDef.initialize(bodyA, bodyB, bodyoneanchor, bodytwoancho…
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: libgdx
tagged with: java
tagged with: box2d

http://stackoverflow.com/comment/43385813
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27475674
score: 0
has text: which operating system?

http://stackoverflow.com/comment/43413043
type: Comment
type: QuestionComment
has text: What is the part that is missing from you web.xml? Also you still have a single application, how many xml files or contexts doesn't matter. Generally speaking you already should have 2 contexts, one from the `ContextLoaderListener` and another from the `DispatcherServlet`. The one from the `ContextLoaderListener` functions as a parent for the one from the `DispathcerServlet`. In your posted web.xml you only have a single context the one from the `ContextLoaderListener`, how many xml files you have doesn't matter.
score: 0
comment on: http://stackoverflow.com/q/27489969

http://stackoverflow.com/q/27555582
tagged with: jtable
downvote count: 2
has comment: http://stackoverflow.com/comment/43537472
upvote count: 1
has body: I have a JTable with an AbstractTableModel containing data in a ArrayList. The list is only a few elements, but the properties of the objects changes rapidly (maybe 100 times per second) I guess it will give bad performance to fire changes all the time. Is it okay to use a timer to trigger JTable update every 1 second? Timer timer = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myModel.fireTableChanged(new TableModelEvent(myModel)); } }); timer.start();
has title: Update jtable with changes from model every 1 second
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/43537522
favorite count: 0
tagged with: timer
has comment: http://stackoverflow.com/comment/43539485
linked to: http://stackoverflow.com/q/11837749
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43538369
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/17383799
score: -1
has answer: http://stackoverflow.com/a/27559099

http://stackoverflow.com/q/27491414
answer count: 2
has body: My app is crashing when setting a TextView to be visible in my fragment. In onCreateView I have and I get a NullPointerException on setVisibility() settingsTitle = (TextView)getActivity().findViewById(R.id.settingsTitle); settingsTitle.setVisibility(View.VISIBLE); Here is the xml. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/plain_background"&gt; &lt;TextView android:id="@+id/settingsTitle" android:layout_width="match_parent" android:layout_height="50dp" android:layout_centerHorizontal="true" android:text="Choose Your Default Screen" android:textAlignment="center" android:gravity="center" android:textColor="@color/black_text" android:visibility="gone"/&gt; &lt;ListView android:id="@+id/listFeed" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/settingsTitle" android:fadeScrollbars="true" android:fastScrollEnabled="true" android:fadingEdge="none" android:divider="@color/kfb_blue" android:dividerHeight="1dp" android:background="@color/plain_background"/&gt; &lt;/RelativeLayout&gt; Here is all of the code in my fragment as requested. package kyfb.android.kyfb.com.kyfb; import android.app.Fragment; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; public class SettingsFragment extends Fragment { private ListView defaultScreen; private static SharedPreferences sharedPref; private static SharedPreferences.Editor editor; private static TextView settingsTitle; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstan…
tagged with: textview
has answer: http://stackoverflow.com/a/27491848
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27491519
has comment: http://stackoverflow.com/comment/43414529
has comment: http://stackoverflow.com/comment/43414431
type: Question
tagged with: java
has title: Crash When Setting TextView to Visible
has comment: http://stackoverflow.com/comment/43414426
score: 0

http://stackoverflow.com/q/27475957
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43386243
tagged with: java
type: Question
upvote count: 12
has body: I can't really understand why this line of code doesn't compile: String str = new Object(); while the following does: Object o = new String("Hello"); To my understand, String, like every other class, extends Object. So why doesn't the first line compile?
has answer: http://stackoverflow.com/a/27476090
answer count: 2
possible better answer: http://stackoverflow.com/a/27476090
has answer: http://stackoverflow.com/a/27475965
has title: String to Object but not Object to String?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27475965
has comment: http://stackoverflow.com/comment/43386483
score: 6
downvote count: 6

http://stackoverflow.com/comment/43601215
type: Comment
type: QuestionComment
has text: @CPUTerminator I doubt they will. At most they may swap the default at some point, but compatibility will keep it around and even make that difficult. Possibly politics and pride too- Google doesn't like to admit they had a bad idea. The idea itself dates back to 1.0, when an average phone app was nothing more complicated than a calculator, not the complex things like we do today.
score: 0
comment on: http://stackoverflow.com/q/27588317

http://stackoverflow.com/q/27571608
has comment: http://stackoverflow.com/comment/43568715
score: 0
has answer: http://stackoverflow.com/a/27571689
answer count: 1
has comment: http://stackoverflow.com/comment/43568668
has title: Java Multithread Priorities
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27571689
tagged with: java
type: Question
has body: If you are running multiple threads all with the same priority, why do you not need to call the yield or sleep method in any of the threads? I must have misunderstood how threading works. I was under the assumption that if two threads are of the same priority, one will finish before the other is started on a single core system. That is, unless you call one of the control functions ie.) yield() sleep() join() ... ect Anyone with the knowledge of this subject I would appreciate any clarifications you may have for me. StackOverFlow would not let me add a comment to your answer: Also according to my book: "The JVM always picks the currently runnable thread with the highest priority. A lower priority thread can run only when no higher-priority threads are running."

http://stackoverflow.com/a/27506460
accepted answer of: http://stackoverflow.com/q/27505536
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43464969
has comment: http://stackoverflow.com/comment/43444873
type: Answer
answers question: http://stackoverflow.com/q/27505536
upvote count: 31
has comment: http://stackoverflow.com/comment/43444064
score: 31
has body: Couple of things. First, What version of HikariCP, Java, and the MySQL driver? Second, 400 connections in one pool? Way too many! Start with 10 to 20, in each pool. You'll be surprised that you can handle a few thousand transactions per second. Third, this is the second question in the FAQ. Read the answer and the link. You need to set maxLifetime to something shorter (by 1 minute) than your MySQL native timeout. Lastly, turn on DEBUG logging, HikariCP is not noisy. Every 30 seconds, the housekeeping thread runs and logs pool statistics.

http://stackoverflow.com/q/27571620
score: 1
tagged with: java
has title: NewLine Character for Unix
upvote count: 1
has body: I have a Java Application running on Linux machine, it is generating a file in which each record is separated by new line, This file will be used by an application running on Unix SunOS system and my code below does not generate proper file . I mean following code generates a file in which each line end with ^M charater when I open it with vi editor in Unix system bw = new BufferedWriter(new FileWriter(file)); bw.write("\n"); Which character I have to write in order to see the file properly in Unix system.
has comment: http://stackoverflow.com/comment/43569849
type: Question
has comment: http://stackoverflow.com/comment/43569663
has comment: http://stackoverflow.com/comment/43569056
has comment: http://stackoverflow.com/comment/43568769
has comment: http://stackoverflow.com/comment/43571415
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27571661
has comment: http://stackoverflow.com/comment/43568714
favorite count: 0
has comment: http://stackoverflow.com/comment/43569207
tagged with: linux
has comment: http://stackoverflow.com/comment/43569769
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/207947
tagged with: unix
duplicate of: http://stackoverflow.com/q/207947

http://stackoverflow.com/a/27614397
score: 0
has comment: http://stackoverflow.com/comment/43650837
type: Answer
has body: When you get such a dialog, one of two things might have happened: either there was a JavaScript error that happened on the browser, or there was an error the server. When the former happens, the dialog includes some more information about the error, which doesn't seem to be showing here. So you're most likely in the latter case: an error happened on the server. To see what it is, you need to look at the orbeon.log. It is in ../logs/orbeon.log relative to the directory where you start Tomcat, which if you start it in bin will point to Tomcat's logs directory. Check the orbeon.log just after you get such an error, and see if you can find an exception at the bottom of the file. (If looking at the log file doesn't help, feel free to post it somewhere, e.g. on https://gist.github.com/, update your question to include a link to the file, and post a comment here, so I'm notified do you did so.)
answers question: http://stackoverflow.com/q/27559332
has comment: http://stackoverflow.com/comment/43948970

http://stackoverflow.com/a/27577344
answers question: http://stackoverflow.com/q/27577311
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43579897
score: 1
has body: You could throw new IOException like try { throw new IOException("Like this"); } catch (IOException e) { e.printStackTrace(); System.err.println(e); } Output is java.io.IOException: Like this at com.stackoverflow.Main.main(Main.java:8) java.io.IOException: Like this
upvote count: 1
has comment: http://stackoverflow.com/comment/43579873
accepted answer of: http://stackoverflow.com/q/27577311
has comment: http://stackoverflow.com/comment/43579808

http://stackoverflow.com/q/27475072
type: Question
possible better answer: http://stackoverflow.com/a/27475108
has body: When running my project, I get this error. Error:java.lang.IllegalArgumentException: Invalid resource path: C:\Android\Source Code and Samples\turbo-editor-master\turbo-editor-master\app\src\main\res Any idea what is causing this? I am using source code from the Turbo Editor app and have done no changes to the app prior to running it.
has answer: http://stackoverflow.com/a/27475181
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0
has title: IllegalArgumentException when running app. (Android)
has answer: http://stackoverflow.com/a/27475108
tagged with: exception
accepted answer: http://stackoverflow.com/a/27475822
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27475822
score: 1
tagged with: java

http://stackoverflow.com/q/27507299
has body: I have the following endpoint declared in my JAX-RS application: @WebService public interface AlertWeb { @POST @Path("/add") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public StringResponse addAlert(String name, int amount, String timespan, String repo, String action); } I'm using the following curl command to call this endpoint: curl -X POST -H "Cache-Control: no-cache" -H "Content-Type: application/x-www-form-urlencoded" -d "name=yellow&amp;amount=2&amp;timespan=DAY&amp;repo=A&amp;action=%7Baction%3A'GreenDivAction'%2C+message%3A'Simple+Message'%2C+args%3A+%5B'arg1'%2C'arg2'%5D%7D" http://localhost:8080/AdminService/alert/add but keep getting the following error when I make the request: javax.ws.rs.BadRequestException: java.lang.NumberFormatException: For input string: "" Note Line breaks in curl syntax added for readability. What am I doing wrong?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43446302
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43446169
accepted answer: http://stackoverflow.com/a/27508045
has comment: http://stackoverflow.com/comment/43446052
has comment: http://stackoverflow.com/comment/43446540
answer count: 1
has comment: http://stackoverflow.com/comment/43446029
downvote count: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/43463282
has title: BadRequestException in JAX-RS endpoint
favorite count: 0
has comment: http://stackoverflow.com/comment/43446097
has answer: http://stackoverflow.com/a/27508045
tagged with: curl
type: AnsweredQuestion

http://stackoverflow.com/a/27589893
upvote count: 3
has body: try this code(get hours and get minute methods in Date class are deprecated.) private void getTimeFromAndroid() { Date dt = new Date(); Calendar c = Calendar.getInstance(); c.setTime(dt); int hours = c.get(Calendar.HOUR_OF_DAY); int min = c.get(Calendar.MINUTE); if(hours&gt;=1 &amp;&amp; hours&lt;=12){ Toast.makeText(this, "Good Morning", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=12 &amp;&amp; hours&lt;=16){ Toast.makeText(this, "Good Afternoon", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=16 &amp;&amp; hours&lt;=21){ Toast.makeText(this, "Good Evening", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=21 &amp;&amp; hours&lt;=24){ Toast.makeText(this, "Good Night", Toast.LENGTH_SHORT).show(); } }
type: Answer
answers question: http://stackoverflow.com/q/27589701
downvote count: 0
score: 3

http://stackoverflow.com/a/27591471
type: Answer
answers question: http://stackoverflow.com/q/27591348
score: 0
has body: A constructor method should only initialize the class members, and that's it. The best practice would be to call the static method afterwards.

http://stackoverflow.com/comment/43499029
score: 3
type: Comment
type: QuestionComment
has text: Well the code you've given won't even compile, as you haven't declared `fltMinimum` and `fltMaximum`...
comment on: http://stackoverflow.com/q/27535280

http://stackoverflow.com/q/27504828
has comment: http://stackoverflow.com/comment/43439721
has title: Strange behaviour of synchronized
has comment: http://stackoverflow.com/comment/43439800
accepted answer: http://stackoverflow.com/a/27504948
type: AnsweredQuestion
tagged with: java
tagged with: thread-safety
type: Question
has answer: http://stackoverflow.com/a/27504948
has body: class TestSync { public static void main(String[] args) throws InterruptedException { Counter counter1 = new Counter(); Counter counter2 = new Counter(); Counter counter3 = new Counter(); Counter counter4 = new Counter(); counter1.start(); counter2.start(); counter3.start(); counter4.start(); counter1.join(); counter2.join(); counter3.join(); counter4.join(); for (int i = 1; i &lt;= 100; i++) { if (values[i] &gt; 1) { System.out.println(String.format("%d was visited %d times", i, values[i])); } else if (values[i] == 0) { System.out.println(String.format("%d wasn't visited", i)); } } } public static Integer count = 0; public static int[] values = new int[105]; static { for (int i = 0; i &lt; 105; i++) { values[i] = 0; } } public static void incrementCount() { count++; } public static int getCount() { return count; } public static class Counter extends Thread { @Override public void run() { do { synchronized (count) { incrementCount(); values[getCount()]++; } } while (getCount() &lt; 100); } } } That is a code from one online course. My task is to make this code visit each element of array only once (only for elements from 1 to 100). So I have added simple synchronized block to run method. In case of using values inside of that statement everything works. But with count it doesn't want to work. What the difference? Both of this objects are static fields inside of the same class. Also I have tried to make count volatile but it hasn't helped me. PS: a lot of elements are visited 2 times and some of them even 3 times. In case of using values in synchronized all elements are visited only once!!!
answer count: 1
score: 0
tagged with: multithreading

http://stackoverflow.com/comment/43424717
has text: I'm not entirely sure what you mean by "vertical bar". At least, in my currently open IntelliJ window, I have four such bars.
score: 0
comment on: http://stackoverflow.com/q/27496565
type: QuestionComment
type: Comment

hibernate
tags question: http://stackoverflow.com/q/27523259
tags question: http://stackoverflow.com/q/27507879
tags question: http://stackoverflow.com/q/27633027
tags question: http://stackoverflow.com/q/27477821
tags question: http://stackoverflow.com/q/27535728
tags question: http://stackoverflow.com/q/27597514
tags question: http://stackoverflow.com/q/27594455
tags question: http://stackoverflow.com/q/27485111
tags question: http://stackoverflow.com/q/27595252
tags question: http://stackoverflow.com/q/27532069
tags question: http://stackoverflow.com/q/27622045
tags question: http://stackoverflow.com/q/27636754
tags question: http://stackoverflow.com/q/27564691
tags question: http://stackoverflow.com/q/27528455
tags question: http://stackoverflow.com/q/27509077
tags question: http://stackoverflow.com/q/27540974
tags question: http://stackoverflow.com/q/27602318
tags question: http://stackoverflow.com/q/27631742
tags question: http://stackoverflow.com/q/27533302
tags question: http://stackoverflow.com/q/27567634
tags question: http://stackoverflow.com/q/27590623
tags question: http://stackoverflow.com/q/27575071
tags question: http://stackoverflow.com/q/27577403
tags question: http://stackoverflow.com/q/27565338
tags question: http://stackoverflow.com/q/27608224
tags question: http://stackoverflow.com/q/27596345
tags question: http://stackoverflow.com/q/27551196
tags question: http://stackoverflow.com/q/27594552
tags question: http://stackoverflow.com/q/27562301
tags question: http://stackoverflow.com/q/27502137
tags question: http://stackoverflow.com/q/27529208
tags question: http://stackoverflow.com/q/27526625
tags question: http://stackoverflow.com/q/27589111
tags question: http://stackoverflow.com/q/27524120
tags question: http://stackoverflow.com/q/27607743
tags question: http://stackoverflow.com/q/27507061
tags question: http://stackoverflow.com/q/27561658
tags question: http://stackoverflow.com/q/27580256
tags question: http://stackoverflow.com/q/27579991
tags question: http://stackoverflow.com/q/27523351
tags question: http://stackoverflow.com/q/27567150
tags question: http://stackoverflow.com/q/27519399
tags question: http://stackoverflow.com/q/27482032
tags question: http://stackoverflow.com/q/27558124
tags question: http://stackoverflow.com/q/27563561
tags question: http://stackoverflow.com/q/27541543
tags question: http://stackoverflow.com/q/27503691
tags question: http://stackoverflow.com/q/27500455
tag name: hibernate
tags question: http://stackoverflow.com/q/27486104
tags question: http://stackoverflow.com/q/27570641
tags question: http://stackoverflow.com/q/27567571
tags question: http://stackoverflow.com/q/27510331
tags question: http://stackoverflow.com/q/27481214
tags question: http://stackoverflow.com/q/27607949
tags question: http://stackoverflow.com/q/27492342
tags question: http://stackoverflow.com/q/27546376
tags question: http://stackoverflow.com/q/27582757
tags question: http://stackoverflow.com/q/27564411
tags question: http://stackoverflow.com/q/27623383
tags question: http://stackoverflow.com/q/27613136
tags question: http://stackoverflow.com/q/27489595
tags question: http://stackoverflow.com/q/27502758
tags question: http://stackoverflow.com/q/27587610
tags question: http://stackoverflow.com/q/27560775
tags question: http://stackoverflow.com/q/27578603
tags question: http://stackoverflow.com/q/27487159
tags question: http://stackoverflow.com/q/27638961
tags question: http://stackoverflow.com/q/27625686
tags question: http://stackoverflow.com/q/27515201
tags question: http://stackoverflow.com/q/27590138
tags question: http://stackoverflow.com/q/27612537
tags question: http://stackoverflow.com/q/27501119
tags question: http://stackoverflow.com/q/27496231
tags question: http://stackoverflow.com/q/27589543
tags question: http://stackoverflow.com/q/27564389
tags question: http://stackoverflow.com/q/27548300
tags question: http://stackoverflow.com/q/27508327
tags question: http://stackoverflow.com/q/27624410
tags question: http://stackoverflow.com/q/27483457

http://stackoverflow.com/comment/43543068
type: Comment
has text: How are you sending the data? One immediate problem I can see- if you're using a Java string, it uses 2 byte characters. The printer appears to be expecting ASCII data, so it wants 1 byte characters. Are you converting before sending?
score: 0
comment on: http://stackoverflow.com/q/27558019
type: QuestionComment

http://stackoverflow.com/a/27565199
has comment: http://stackoverflow.com/comment/43565189
upvote count: 1
has body: Where Did the Abstract Class Come From? JAXB would generate an abstract class to correspond to an abstract complex type in the XML Schema. In the example below the complex type contactInfo would correspond to an abstract class called ContactInfo, also the generated class Customer would have a property of this type. &lt;xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.example.com/foo" targetNamespace="http://www.example.com/foo"&gt; &lt;xs:element name="customer"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="contactInfo" type="contactInfo" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:complexType name="contactInfo" abstract="true"&gt; &lt;xs:sequence/&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="address"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="contactInfo"&gt; &lt;xs:sequence&gt; &lt;xs:element name="street" type="xs:string" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="phoneNumber"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="contactInfo"&gt; &lt;xs:attribute name="number" type="xs:string"/&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; How to Set a Property that is an Abstract Type For a property of this type you set the value to be one of the concrete subclasses. Address address = new Address(); customer.setContactInfo(address); Or PhoneNumber phoneNumber = new PhoneNumber(); customer.setContactInfo(phoneNumber); How to Decide Which Subclass to Use? How do decide which of the concrete subclasses to use? There isn't really an automated way to do this, you need to make a specific choice based on the data you are trying to represent. In the example above if you want the customer to be contacted by mail you set an instance of Address otherwise you set an instance of PhoneNumber. UPDATE I did try usi…
answers question: http://stackoverflow.com/q/27563207
has comment: http://stackoverflow.com/comment/43556664
has comment: http://stackoverflow.com/comment/43564013
has comment: http://stackoverflow.com/comment/43566176
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/27594552
type: UnansweredQuestion
has title: ERROR: Unknown column 'DTYPE' in 'field list'
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/27597030
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: jpa
answer count: 1
favorite count: 0
has body: I'm trying to make a simple example of persistence using JPA with Hibernate as provider. I'm using MySQL as database. But I'm getting this error: Hibernate: insert into person (NAME, DTYPE) values (?, 'person') dez 21, 2014 8:35:01 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 1054, SQLState: 42S22 dez 21, 2014 8:35:01 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: Unknown column 'DTYPE' in 'field list' Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1187) at Test.main(Test.java:17) Caused by: org.hibernate.exception.SQLGrammarException: could not execute statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:211) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.…

http://stackoverflow.com/comment/43641259
has text: @Adz: Then you should probably check if result is null instead of trying to print it ;) What is suggested, is that the results variable is _null_.
score: 1
comment on: http://stackoverflow.com/q/27609424
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27633431
has comment: http://stackoverflow.com/comment/43690628
has title: Cannot update text in EditText inside onActivityResult
has comment: http://stackoverflow.com/comment/43686549
answer count: 1
has answer: http://stackoverflow.com/a/27645987
has comment: http://stackoverflow.com/comment/43686724
has comment: http://stackoverflow.com/comment/43686651
has comment: http://stackoverflow.com/comment/43692363
tagged with: android
has body: I am trying to use Voice Recognition on Android. Following is my code. This is the code of the Button that is responsible to start speech recognition. speak.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "City Name Please?"); startActivityForResult(intent, REQUEST_CODE); }}); Here is a onActivityResult method. protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE &amp;&amp; resultCode == RESULT_OK) { ArrayList&lt;String&gt; matches_Text = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); Log.v("Results", matches_Text.get(0).toString()); //Update EditText cityname here String normalized_cityname = matches_Text.get(0).toString().trim(); normalized_cityname = normalized_cityname.replace(" ","%20"); try { getResponseString("http://api.openweathermap.org/data/2.5/weather?q="+normalized_cityname+"&amp;units=metric", true); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } } The code worked ok but there are two problems I am encountering now and I am afraid that they may be related. If I try to update text in an EditText instance cityname using cityname.setText(matches_Text.get(0).toString()), it crashes the app. If I hit the speak button now, the google voice dialog comes up but shows can't reacg google at the moment. Please suggest what can I do? Adding the getResponseString method also. public void getResponseString(String Url, boolean IsCalledOnVoiceInput) throws IOException, JSONException { String temperature=""; String city; String country; String weather_main, weather_description; MyAsyncTask xxx = new MyAsyncTask(); try { String responseString = xxx.execute(Url).get(); TextView txtTemp = (TextView)find…
has comment: http://stackoverflow.com/comment/43690884
has comment: http://stackoverflow.com/comment/43686748
tagged with: speech-recognition
has comment: http://stackoverflow.com/comment/43686725
accepted answer: http://stackoverflow.com/a/27645987
has comment: http://stackoverflow.com/comment/43690659
has comment: http://stackoverflow.com/comment/43690617
has comment: http://stackoverflow.com/comment/43688410
has comment: http://stackoverflow.com/comment/43687588
tagged with: voice-recognition
has comment: http://stackoverflow.com/comment/43686814
has comment: http://stackoverflow.com/comment/43691259
has comment: http://stackoverflow.com/comment/43687429
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43708550
score: 0
has comment: http://stackoverflow.com/comment/43692322
tagged with: java
has comment: http://stackoverflow.com/comment/43686677
type: Question

http://stackoverflow.com/a/27551486
has body: Yes it is. You create object in infinite loop and it end up with StackOverflow
type: Answer
answers question: http://stackoverflow.com/q/27551338
has comment: http://stackoverflow.com/comment/43530912
score: 0

http://stackoverflow.com/q/27600599
answer count: 0
tagged with: clipboard
score: 1
tagged with: java
upvote count: 1
type: Question
has title: getClipboard broken after setClipboard
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: So, I have a loop for checking for any changes in the system clipboard, during this loop, a user can request that sets the clipboard. However, after setting the clipboard, anything that is copied in the system is not picked up by getClipboard, while pasting into any text editor will display any text you've just copied. Here's the code I've been using to test: public final class TextTransfer implements ClipboardOwner { public static void main(String... aArguments ) throws InterruptedException { TextTransfer textTransfer = new TextTransfer(); //display what is currently on the clipboard System.out.println("Clipboard contains:" + textTransfer.getClipboardContents()); //change the contents and then re-display textTransfer.setClipboardContents("blah, blah, blah"); System.out.println("Clipboard contains:" + textTransfer.getClipboardContents()); Thread.sleep(5000); System.out.println("Clipboard contains:" + textTransfer.getClipboardContents()); } /** * Empty implementation of the ClipboardOwner interface. */ @Override public void lostOwnership(Clipboard aClipboard, Transferable aContents){ //do nothing } /** * Place a String on the clipboard, and make this class the * owner of the Clipboard's contents. */ public void setClipboardContents(String aString){ StringSelection stringSelection = new StringSelection(aString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, this); } /** * Get the String residing on the clipboard. * * @return any text found on the Clipboard; if none found, return an * empty String. */ public String getClipboardContents() { String result = ""; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); boolean hasTransferableText = (contents != null) &amp;&amp; contents.isDataFlavorSupported(DataFlavor.stringFlavor) ; if (hasTransferableText) { try { result = (Strin…

http://stackoverflow.com/comment/43716433
comment on: http://stackoverflow.com/a/27638714
type: Comment
has text: @MertKarakas but what is x velX ?without seeing it i cannot guess.and i don't see you have improved codes .i only see the codes with errors.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27503954
downvote count: 0
answers question: http://stackoverflow.com/q/27503924
type: Answer
score: 3
has body: The size() method is implemented (directly or indirectly) by any class that implements the List interface. Your List&lt;WebElement&gt; variable holds a reference to an instance of some class that implements List&lt;WebElement&gt;, and therefore contains an implementation of the size() method.
upvote count: 3

http://stackoverflow.com/q/27575516
type: AnsweredQuestion
downvote count: 0
tagged with: user-interaction
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27577757
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/27577757
favorite count: 0
answer count: 1
has body: So I have a socket situation where I have a multithread server that receive X number of connections and manage all of them (I use this code to base mine: http://www.java2s.com/Code/Java/Network-Protocol/AmultithreadedSocketServer.htm). That's not completely my code but I used that as a base for the multithreading: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class EchoServer { public static void main(String[] args) throws Exception { ServerSocket m_ServerSocket = new ServerSocket(12111); int id = 0; while (true) { Socket clientSocket = m_ServerSocket.accept(); ClientServiceThread cliThread = new ClientServiceThread(clientSocket, id++); cliThread.start(); } } } class ClientServiceThread extends Thread { Socket clientSocket; int clientID = -1; boolean running = true; ClientServiceThread(Socket s, int i) { clientSocket = s; clientID = i; } public void run() { System.out.println("Accepted Client : ID - " + clientID + " : Address - " + clientSocket.getInetAddress().getHostName()); try { BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintWriter out = new PrintWriter(new OutputStreamWriter(clientSocket.getOutputStream())); while (running) { String clientCommand = in.readLine(); System.out.println("Client Says :" + clientCommand); if (clientCommand.equalsIgnoreCase("quit")) { running = false; System.out.print("Stopping client thread for client : " + clientID); } else { out.println(clientCommand); out.flush(); } } } catch (Exception e) { e.printStackTrace(); } } } The problem is that all those clients connected to me are waiting a response from the user which provide that response using keyboard input (BufferedReader SYSTEM_IN = new BufferedReader(new InputStreamReader(System.in)); ) But I need to list all the threads that I have opened and select manually the one that I want to interac…
tagged with: sockets
tagged with: multithreading
has title: Select thread to interact with Java

http://stackoverflow.com/a/27491693
type: Answer
answers question: http://stackoverflow.com/q/27485690
has body: Managed to find a solution myself by using the constrain() method provided by the processing api.
score: 0

http://stackoverflow.com/q/27485377
has title: define attribute in arff file using java
upvote count: 3
type: UnansweredQuestion
tagged with: java
score: 3
has body: I'm using j48 method in weka. My sample training data .arff file is follows, @relation l4_tbl_final @attribute MouseVariance numeric @attribute EyeValue numeric @attribute SocialTime numeric @attribute KeyWords numeric @attribute InvolvedTime numeric @attribute grade {B,A,C} @data 2731.35,87,47.55,0,49.7,B 864.891,55,0,0,94.33,B 2495.8,1386,0,2,71.75,A 1104.04,4490,0,0,61.91,B The first 5 values are parameters and based on that Grade 'A','B','C' is given. Now I need to provide test data set and predict the grade of those data. for that I should provide testdata.arff file as follows (? marks at the grade) @attribute MouseVariance numeric @attribute EyeValue numeric @attribute SocialTime numeric @attribute KeyWords numeric @attribute InvolvedTime numeric @attribute grade {B,A,C} @data 2731.35,87,47.55,0,49.7,? 864.891,55,0,0,94.33,? 2495.8,1386,0,2,71.75,? 1104.04,4490,0,0,61.91,? I used the following java code to convert sql databases to csv and after that csv converted to arff: while (resultSet.next()) { row = spreadsheet.createRow(i); cell = row.createCell(0); cell.setCellValue(resultSet.getString("MouseVariance")); cell = row.createCell(1); cell.setCellValue(resultSet.getString("EyeValue")); cell = row.createCell(2); cell.setCellValue(resultSet.getString("SocialTime")); cell = row.createCell(3); cell.setCellValue(resultSet.getString("KeyWords")); cell = row.createCell(4); cell.setCellValue(resultSet.getString("InvolvedTime")); cell = row.createCell(5); cell.setCellValue("?"); i++; } but when I create the arff file in that way the attribute is shows as @attribute grade {numaric} value. so expected grade is not predicted. but if it is as follows that would solved the problem. @attribute grade {B,A,C} How can I solve that??
type: Question
tagged with: weka
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27494300
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/q/27577191
type: Question
tagged with: sorting
possible better answer: http://stackoverflow.com/a/28603917
has body: I am working on OpenCms, a Java-based CMS. I have a List collection in which I am storing CMSResources which I get from a category like: CmsObject cmso = cms.getCmsObject(); // Get the category service instance CmsCategoryService cs = CmsCategoryService.getInstance(); // Get resources assigned a specific category. (You could also provide a CmsResourceFilter here.) List&lt;CmsResource&gt; categoryResourcesNewBies = cs.readCategoryResources(cmso, "newbies/", true,"/"); Now, I have written some code to sort it like: final SimpleDateFormat outputFormat = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss zzz"); final Comparator&lt;CmsResource&gt; CREATE_ORDER = new Comparator&lt;CmsResource&gt;() { public int compare(CmsResource one, CmsResource another) { String oneCreated = ""; String anotherCreated = ""; try { oneCreated = outputFormat.format(new Date(one.getDateCreated())); anotherCreated = outputFormat.format(new Date(another.getDateCreated())); } catch (Exception e) { oneCreated = ""; anotherCreated = ""; } return oneCreated.compareTo(anotherCreated); } }; Collections.sort(categoryResourcesNewBies,CREATE_ORDER); When I loop through the collection using Iterator then the order is not correct. It should be ordered according to date, ascending or descending, as I am trying to do with the Comparator. I have iterated through using: Iterator&lt;CmsResource&gt; inew = categoryResourcesNewBies.iterator(); while (inew.hasNext()) { CmsResource r = inew.next(); // Here, you could check the file type ID and/or file extension, and do something // based on that info. For example, you could group PDF and DOC files separately, or // discard all files other than PDFs, and so on. String urinew = cmso.getSitePath(r); &lt;li class="margin-bottom-10 left-nav-list"&gt;&lt;a href="&lt;%= cms.link(urinew) %&gt;" target="_blank"&gt;&lt;%= cms.property(CmsPropertyDefinition.PROPERTY_TITLE, urinew, urinew) %&gt;&lt;img src="/.content/flexiblecontents/img/new.gif" alt = "New"/&gt; &lt;%out.print…
has answer: http://stackoverflow.com/a/27577929
accepted answer: http://stackoverflow.com/a/27577929
score: 0
answer count: 2
has title: Unable to sort List Collection by ascending or desending order in OpenCms
has answer: http://stackoverflow.com/a/28603917
type: AnsweredQuestion
tagged with: java
tagged with: opencms
tagged with: collections

http://stackoverflow.com/q/27618223
type: UnansweredQuestion
tagged with: design-patterns
has answer: http://stackoverflow.com/a/27618461
tagged with: refactoring
tagged with: java
has body: I currently have a class with some code which basically calls some functions and then perform the max/min on all the results float limitOtherSide = limitImposedByPreviousVerticesOnOtherSide(other, pNewX, minimumDistance, pIsUpper); float limitInterpolation = limitToPreventInterpolatedPointsTooClose(other, pNewX, temp, minimumDistance, pIsUpper); float limitToPreventChocksOnMiddleSCurve = limitToAvoidChockesAlongAllTheSCurve(other, pNewX, temp, minimumDistance, playerWidth, pIsUpper); float limitToGrantMinimumDistanceVertically = limitToAvoidChockesAlongAllTheSCurve(other, pNewX, temp, minimumDistance, 0, pIsUpper); float limitOutOfScreenInterpolation = limitToPreventeForcedOutOfScreenNextOppositeVertex(other, pNewX, minimumDistance, pIsUpper); float limitChocke = limitToAvoidChocke(other, pNewX, minimumDistance, pIsUpper); if(pIsUpper) { float max1 = Math.max(limitOtherSide, limitInterpolation); float max2 = Math.max(limitToPreventChocksOnMiddleSCurve, limitOutOfScreenInterpolation); float minimumY = Math.max(Math.max(max1, limitToGrantMinimumDistanceVertically), Math.max(max2, limitChocke)); newLowerY = MathUtilities.clamp(minimumY, 0.1f, 1); newUpperY = 1.f; } else { float min1 = Math.min(limitOtherSide, limitInterpolation); float min2 = Math.min(limitToPreventChocksOnMiddleSCurve, limitOutOfScreenInterpolation); float maximumY = Math.min(Math.min(min1, limitToGrantMinimumDistanceVertically), Math.min(min2, limitChocke)); newUpperY = MathUtilities.clamp(maximumY, 0 , 0.9f); newLowerY = 0.f; } float newY = (float) RANDOM.nextGaussian(newLowerY, newUpperY); I'd like to reorganize it for several reasons: the functions are almost pure and self contained I'd like to be able to switch on and off easily which checks to perform (even if it's a matter of changing the source code) I'd like to separate the limit checking from the rest of the code of the class which is more general about how to generate points I plan on adding more functions, which will clutter the class even…
has title: Reorganize code: from many function to interface system
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/27646756
favorite count: 0
score: -1

http://stackoverflow.com/q/27619121
tagged with: liferay-6
type: AnsweredQuestion
score: 0
tagged with: java
has title: How use the getFolders() method of the DLFolderLocalServiceUtil class?
type: Question
tagged with: jakarta-ee
tagged with: liferay
accepted answer: http://stackoverflow.com/a/27622105
tagged with: content-management-system
has body: I am absolutly new in LifeRay development and I have some doubts related to the use of the DLFolderLocalServiceUtil class. In my code I have something like this: List&lt;DLFolder&gt; listFolder = DLFolderLocalServiceUtil.getDLFolders(-1, -1); private Map&lt;String, DLFolder&gt; treePath = new TreeMap&lt;String, DLFolder&gt;(); What exaclty do the previous code? I think that is is something related to the LifeRay document library. I think that the previous code retrieve the root of the document library of my portal. But, if my reasoning is correct, what exactly is the document library in LifeRay? Is it something used to stored documents on the portal? If so what exactly is a document in LifeRay? any type of file or specific type of content? Looking on the official LifeRAy documentation, here: https://docs.liferay.com/portal/6.2/javadocs-all/com/liferay/portlet/documentlibrary/service/DLFolderLocalServiceUtil.html it seems to me that, in the previous code snippet, it is used this version of the getDLFolders() method: getDLFolders(int start, int end) and say that: Returns a range of all the document library folders But what exactly mean a range of all document library folder? And what means if, as in the previous snippet, is used the start and end values setted to -1 ?
answer count: 1
has answer: http://stackoverflow.com/a/27622105

http://stackoverflow.com/q/27600820
type: Question
answer count: 1
tagged with: jpa
score: 0
has title: Eclipse giving error at @SequenceGenerator "schema" not a valid attribute
has comment: http://stackoverflow.com/comment/43624455
has answer: http://stackoverflow.com/a/27601600
type: UnansweredQuestion
has body: @Id @SequenceGenerator(schema = "cobra_oltp",name = "INTERFACE_ACTIVITY_LOG_GENERATOR", sequenceName = "SEQ_INTERFACE_ACTVTY_LOG", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "INTERFACE_ACTIVITY_LOG_GENERATOR") The abbove codein eclipse showing that "The attribute schema is undefined for the annotation type SequenceGenerator". Can you please help me out as far as I know its a valid attribute. I am using JPA for implementation.
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/27630507
has comment: http://stackoverflow.com/comment/43684150
accepted answer: http://stackoverflow.com/a/27639609
tagged with: excel
type: AnsweredQuestion
upvote count: 9
has comment: http://stackoverflow.com/comment/43683499
tagged with: java
has answer: http://stackoverflow.com/a/27639609
has title: Is there a max number items while generating drop down list in Excel using Apache POI?
has comment: http://stackoverflow.com/comment/94910885
type: Question
score: 9
has comment: http://stackoverflow.com/comment/43683576
tagged with: apache
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43683383
has comment: http://stackoverflow.com/comment/43683653
has body: I am trying to add a drop down list for one cell using Apache POI. The drop down list contains 302 Strings. I always got this error: Excel found unreadable content in test.xlsx. Then I did the following test. When number of items &lt;=88, the drop down list created successfully. When the number >88, I got an error when opening the excel file and no drop down list. Thank you !!! import org.apache.poi.xssf.usermodel.*; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.ss.usermodel.*; import java.io.FileOutputStream; import java.io.IOException; import java.util.TreeSet; public class Test { public static void main(String[] args) { TreeSet&lt;String&gt; temp_rxGroups = new TreeSet&lt;String&gt;(); for (int i = 0; i &lt; 100; i++) { temp_rxGroups.add("" + i); } String[] countryName = temp_rxGroups.toArray(new String[temp_rxGroups.size()]); XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet realSheet = workbook.createSheet("realSheet"); XSSFSheet hidden = workbook.createSheet("hidden"); for (int i = 0, length= countryName.length; i &lt; length; i++) { String name = countryName[i]; XSSFRow row = hidden.createRow(i); XSSFCell cell = row.createCell(0); cell.setCellValue(name); } Name namedCell = workbook.createName(); namedCell.setNameName("hidden"); namedCell.setRefersToFormula("hidden!$A$1:$A$" + countryName.length); DataValidation dataValidation = null; DataValidationConstraint constraint = null; DataValidationHelper validationHelper = null; validationHelper=new XSSFDataValidationHelper(hidden); CellRangeAddressList addressList = new CellRangeAddressList(0,10,0,0); //line constraint =validationHelper.createExplicitListConstraint(countryName); dataValidation = validationHelper.createValidation(constraint, addressList); dataValidation.setSuppressDropDownArrow(true); workbook.setSheetHidden(1, true); realSheet.addValidationData(dataValidation); FileOutputStream stream = new FileOutputStream("c:\\test.xlsx"); workbook.write(stream); stream.close(); }…
has comment: http://stackoverflow.com/comment/43682856
has comment: http://stackoverflow.com/comment/43683027
favorite count: 0
tagged with: apache-poi

http://stackoverflow.com/q/27499323
tagged with: servlets
tagged with: get
score: 0
answer count: 3
has title: Servlet error HTTP Status 405 - HTTP method GET is not supported by this URL
possible better answer: http://stackoverflow.com/a/27499461
has body: I've written the following Servlet (Search1.java): package ergasia; import java.sql.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.ArrayList; public class Search1 extends HttpServlet { @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); Connection connection= null; String url = "jdbc:mysql://localhost:3306/"; String dbName = "ergasia"; String user = "root"; String password = "password"; PreparedStatement selectProteins = null; ResultSet resultSet = null; ArrayList al = null; try { connection = DriverManager.getConnection(url + dbName, user, password); String keyword = request.getParameter("keyword"); selectProteins = connection.prepareStatement("SELECT * FROM protein WHERE proteinName LIKE ?"); selectProteins.setString(1, "%" + keyword + "%"); resultSet = selectProteins.executeQuery(); ArrayList keyword_list = new ArrayList(); while (resultSet.next()) { al = new ArrayList(); al.add(resultSet.getString(1)); al.add(resultSet.getString(2)); al.add(resultSet.getString(3)); al.add(resultSet.getString(4)); al.add(resultSet.getString(5)); al.add(resultSet.getString(6)); al.add(resultSet.getString(7)); keyword_list.add(al); } request.setAttribute("results", keyword_list); RequestDispatcher view = request.getRequestDispatcher("/search_proteins.jsp"); view.forward(request, response); } catch (SQLException e) { e.printStackTrace(); } } @Override public String getServletInfo() { return "info"; } } that I access from a jsp page with the following command: but when I try to run it tomcat gives me the following error: HTTP Status 405 - HTTP method GET is not supported by this URL type:Status report message:HTTP method GET is not supported by this URL description:The specified HTTP method is not allowed for the requested resource. Here's my web.xml file too: <?xml version="1.0" encoding="UTF-8"?> Search_proteins ergasia.Search1 …
has answer: http://stackoverflow.com/a/27499619
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27499571
tagged with: post
accepted answer: http://stackoverflow.com/a/27499571
type: Question
has answer: http://stackoverflow.com/a/27499461
tagged with: jsp

http://stackoverflow.com/comment/43454362
has text: Calculate `sum` for each row in one loop (`for`), as well as `totalRowsSum`. Then in one more loop compare previous rows `sum` (which increases in every iteration by the `currentRowSum`) with `totalRowsSum - sum`.
comment on: http://stackoverflow.com/q/27511980
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43723672
score: 0
has text: @Oren i have edited my answer. The thing that clipped your code was that your list was getting modified so a concurrent modification exception was preventing your code from further execution. Hope this helps now.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27615845

http://stackoverflow.com/q/27531634
has comment: http://stackoverflow.com/comment/43564985
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/44061521
has comment: http://stackoverflow.com/comment/43554143
has comment: http://stackoverflow.com/comment/43571387
has comment: http://stackoverflow.com/comment/43570065
answer count: 0
has comment: http://stackoverflow.com/comment/43583105
type: UnansweredQuestion
tagged with: spring
has body: In my Spring Boot application, I have assigned the HAL object-mapper to MappingJackson2HttpMessageConverter. This is because my custom media-types end with +json and end up being recognized by the default converter. The custom MappingJackson2HttpMessageConverter instance registered by Spring HATEOAS only recognizes application/hal+json. My custom media-types are of the form application/vnd.service.entity.v1.hal+json, which are recognized by the default instance (because it supports application/json and application/*+json). However, the default instance does not serialize links properly into the HAL convention. I have been able to get around it by registering the mapper like so: @Bean public HttpMessageConverters customConverters() { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converter.setSupportedMediaTypes(Arrays.asList( new MediaType("application", "json", Charset.defaultCharset()), new MediaType("application", "*+json", Charset.defaultCharset()), new MediaType("application", "hal+json") )); ObjectMapper halObjectMapper = beanFactory.getBean(HAL_OBJECT_MAPPER_BEAN_NAME, ObjectMapper.class); converter.setObjectMapper(halObjectMapper); return new HttpMessageConverters(converter); } There is a concern that I am now polluting regular JSON serialization/deserialization with HAL concerns, but I cannot think of any other way (short of explicitly specifying every single custom media-type I use) to do this. Thoughts?
has comment: http://stackoverflow.com/comment/43549087
has comment: http://stackoverflow.com/comment/43564882
tagged with: hal-json
tagged with: java
tagged with: spring-hateoas
type: Question
has title: Is it alright to override MappingJackson2HttpMessageConverter to support HAL+JSON?

http://stackoverflow.com/comment/43518625
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27544951
score: 0
has text: I think you may be misunderstanding. Once you have compressed the JPEG using quality = 0.5 **you can never get the original back**. Of course you can view the new more compressed image and it will still look a bit like the original, just lower quality. But the full information contained in the original is irretrievably lost. I've edited my question to give a code snippet to show using PNG as the format.

http://stackoverflow.com/comment/43495603
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27533045
has text: You're very welcome.. Stuck on the remove line.. giving little issue.. brb
type: AnswerComment

http://stackoverflow.com/a/27555068
has comment: http://stackoverflow.com/comment/43536435
answers question: http://stackoverflow.com/q/27554937
type: Answer
upvote count: 0
has body: Try following.... public class NewClass { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); List&lt;Integer&gt; integers = new ArrayList&lt;Integer&gt;(); // Enter three numbers System.out.print("Enter five numbers: "); int number1 = input.nextInt(); int number2 = input.nextInt(); int number3 = input.nextInt(); int number4 = input.nextInt(); int number5 = input.nextInt(); integers.add(number1); integers.add(number2); integers.add(number3); integers.add(number4); integers.add(number5); System.out.println("The sorted numbers are " +integers); System.out.println("Enter a number to search: "); int searchNum = input.nextInt(); if(integers.contains(seacrchNum)){ System.out.println(searchNum+" is on the list"); }else{ System.out.println(searchNum+" is not on the list"); } } Explainations : Placed all the entered numbers into an arrayLists and then prompt for the search Number to be entered. and Check wheather the search number is der in the ArrayLists or not. Based on the condition display the Message
has comment: http://stackoverflow.com/comment/43536425
score: -2
has comment: http://stackoverflow.com/comment/43536433
downvote count: 2

http://stackoverflow.com/comment/43522667
comment on: http://stackoverflow.com/a/27547964
type: Comment
has text: I have a reference to the thread so i can just call t.getStackTrace() but its a shame there doesnt see to be a method to convert to a single String to get output similar to when you use logger with a throwable included as parameter because I want to write this to my logs
score: 0
type: AnswerComment

http://stackoverflow.com/a/27556813
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43540154
answers question: http://stackoverflow.com/q/27556334
has body: This is a dependency issue. Try without ehcache depency to see if it works. If not, try version "2.8.3" of ehcache which should be the one Spring 4 wants.
has comment: http://stackoverflow.com/comment/43539920
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43561025
accepted answer of: http://stackoverflow.com/q/27556334
has comment: http://stackoverflow.com/comment/43539909
type: Answer
has comment: http://stackoverflow.com/comment/43568747
score: 1

http://stackoverflow.com/a/27497835
has body: Both your base class and child class then should return the Base object. To use it appropriately you then have to typecast it.
score: 0
answers question: http://stackoverflow.com/q/27497720
type: Answer

http://stackoverflow.com/comment/43512174
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27541989
score: 0
has text: @AbhishekShukla I use the Nexus7 for testing. same result.

http://stackoverflow.com/comment/43396018
score: 0
type: QuestionComment
type: Comment
has text: Please paste your R.layout.layout_listview file :-)
comment on: http://stackoverflow.com/q/27481609

http://stackoverflow.com/q/27503805
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27504048
has comment: http://stackoverflow.com/comment/43438400
tagged with: java
has body: I am developing a jsp application using eclipse. Currently trying to detect which button is pressed while submitting a form with ajax call. however the request.getParameter(button-name) returns null within the doPost method of servlet. below is the code for jsp, ajax call(jquery) and servlet. //jsp New User Information Name : Surname : User name : E-mail : Password : Re-enter password : Is Admin ? //jquery $(document).ready(function() { $("#btnSubmit").click(function(e) { $.ajax({ url : 'CreateUserServlet', type : 'POST', dataType : 'json', data : $("#formCreateUser").serialize(), success : function(data) { //something here } }); return false; }); }); servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map<String, Object> map = new HashMap<String, Object>(); if (request.getParameter("btnSubmit") != null) { System.out.println("It works"); } else { System.out.println("It doesn't work"); } } any help is highly appreciated Regards
has comment: http://stackoverflow.com/comment/43439416
type: Question
has title: retrieve button-name on jsp page servlet
tagged with: jsp
tagged with: jquery
tagged with: servlets
tagged with: ajax
score: 0

http://stackoverflow.com/q/27512365
has comment: http://stackoverflow.com/comment/43460770
has comment: http://stackoverflow.com/comment/43460894
type: Question
downvote count: 4
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43460500
has body: This is class of patient public class Patient { private String name; private String sex; public Patient(String name, String sex) { this.name = name; this.sex = sex; } public String getName() { return name; } public String getSex() { return sex; } } This is class of process public class Process { private String numberProcess; private Patient patient; public Process(String numberProcess, Patient patient) { this.numberProcess = numberProcess; this.patient = patient; } public String getNumberProcess() { return this.numberProcess ; } } This is class of Clinic public class Clinic{ private Patient patient[]; private Process process[]; Method that takes as parameters the name and sex of a patient, checks for, creates and returns the process instance. in the case of successful creation of a new process or null in case of failure.->DOUBT HERE public Process createNewProcess (String namePatient,String sexPatient) { if (this.process == null) { this.process = new Process[1]; } else { this.process = Arrays.copyOf (this.process, this.process.length + 1); } for(int i = 0; i &lt;this.patient.length; i ++) { if ((namePatient.equals(this.patient[i].getName())) &amp;&amp; (sexPatient.equals(this.patient[i].getSex()))) { return this.process[this.process.length-1] = new Process (getNewNumberProcess(), this.patient[i]); } } return null; } Method that returns the next file number to be allocated -> return Number of new process -> DOUBT IS HERE in this method getNewNumberProcess() public String getNewNumberProcess() { int i = 0; return String.valueOf(i+1); } in main when I test: Exception in thread "main" java.lang.NullPointerException My question is is like an accountant but each time a process is created, then returns the new next number, that is, each time it is created, more is incremented one unit on. example: to create 3 processes, we obtain the three consecutive numbers, as defined here process number = 0001 process number = 0002 process number = 0003 when a new process is created, t…
has title: how to get next new number when you create a process in an array without using collections in Java
has comment: http://stackoverflow.com/comment/43461023
has comment: http://stackoverflow.com/comment/43460965
has comment: http://stackoverflow.com/comment/43460874
has comment: http://stackoverflow.com/comment/43460714
score: -4
has comment: http://stackoverflow.com/comment/43460889
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27515417
accepted answer: http://stackoverflow.com/a/27515417
tagged with: java
has comment: http://stackoverflow.com/comment/43460712
has comment: http://stackoverflow.com/comment/43460550

http://stackoverflow.com/comment/43435710
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27502774
has text: Try with Guava and its BaseEncoding; note: Guava works on Android too.

http://stackoverflow.com/q/27538626
has comment: http://stackoverflow.com/comment/43505282
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27538650
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43505271
has body: I love Java. I have heard a lot of bad things about java on how it is slow and all, but for me, it seems like a better alternative to C and C++. The only reason that I don't like java is because the standard library is SO BIG and it takes forever to just set up all of the import statements in my code. Why can't I just do import java.*; and have all of my import statements in one neat package. I am not making a big program so speed is not an issue. Thank you!
has comment: http://stackoverflow.com/comment/43505274
score: 1
tagged with: java
has title: Why cant I just import everything?
upvote count: 1
has comment: http://stackoverflow.com/comment/43505280
tagged with: import
has answer: http://stackoverflow.com/a/27539146
has comment: http://stackoverflow.com/comment/43505296
type: Question
has comment: http://stackoverflow.com/comment/43505294
has comment: http://stackoverflow.com/comment/43505265
has comment: http://stackoverflow.com/comment/43505283
has comment: http://stackoverflow.com/comment/43505309

arrays
tags question: http://stackoverflow.com/q/27517303
tags question: http://stackoverflow.com/q/27592892
tags question: http://stackoverflow.com/q/27539419
tags question: http://stackoverflow.com/q/27490347
tags question: http://stackoverflow.com/q/27556556
tags question: http://stackoverflow.com/q/27537899
tags question: http://stackoverflow.com/q/27548334
tags question: http://stackoverflow.com/q/27556104
tags question: http://stackoverflow.com/q/27529190
tags question: http://stackoverflow.com/q/27551946
tags question: http://stackoverflow.com/q/27580278
tags question: http://stackoverflow.com/q/27523670
type: Tag
tags question: http://stackoverflow.com/q/27592684
tags question: http://stackoverflow.com/q/27546608
tags question: http://stackoverflow.com/q/27538651
tags question: http://stackoverflow.com/q/27534062
tags question: http://stackoverflow.com/q/27497109
tags question: http://stackoverflow.com/q/27613854
tags question: http://stackoverflow.com/q/27626446
tags question: http://stackoverflow.com/q/27549336
tags question: http://stackoverflow.com/q/27475594
tags question: http://stackoverflow.com/q/27558890
tags question: http://stackoverflow.com/q/27518999
tags question: http://stackoverflow.com/q/27603735
tags question: http://stackoverflow.com/q/27547151
tags question: http://stackoverflow.com/q/27570061
tags question: http://stackoverflow.com/q/27512052
tags question: http://stackoverflow.com/q/27475308
tags question: http://stackoverflow.com/q/27510768
tags question: http://stackoverflow.com/q/27515406
tags question: http://stackoverflow.com/q/27514850
tags question: http://stackoverflow.com/q/27538600
tags question: http://stackoverflow.com/q/27581641
tags question: http://stackoverflow.com/q/27592360
tags question: http://stackoverflow.com/q/27497441
tags question: http://stackoverflow.com/q/27489185
tags question: http://stackoverflow.com/q/27583587
tags question: http://stackoverflow.com/q/27587522
tags question: http://stackoverflow.com/q/27500271
tags question: http://stackoverflow.com/q/27526245
tags question: http://stackoverflow.com/q/27481850
tags question: http://stackoverflow.com/q/27639439
tags question: http://stackoverflow.com/q/27495429
tags question: http://stackoverflow.com/q/27584543
tags question: http://stackoverflow.com/q/27508856
tags question: http://stackoverflow.com/q/27485489
tags question: http://stackoverflow.com/q/27495049
tags question: http://stackoverflow.com/q/27573841
tags question: http://stackoverflow.com/q/27551305
tags question: http://stackoverflow.com/q/27525029
tags question: http://stackoverflow.com/q/27630192
tags question: http://stackoverflow.com/q/27524298
tags question: http://stackoverflow.com/q/27597480
tags question: http://stackoverflow.com/q/27534949
tags question: http://stackoverflow.com/q/27593863
tags question: http://stackoverflow.com/q/27589311
tags question: http://stackoverflow.com/q/27603982
tags question: http://stackoverflow.com/q/27591365
tags question: http://stackoverflow.com/q/27485663
tags question: http://stackoverflow.com/q/27516204
tags question: http://stackoverflow.com/q/27590548
tags question: http://stackoverflow.com/q/27593721
tags question: http://stackoverflow.com/q/27607421
tags question: http://stackoverflow.com/q/27481282
tags question: http://stackoverflow.com/q/27639753
tags question: http://stackoverflow.com/q/27604551
tags question: http://stackoverflow.com/q/27539835
tags question: http://stackoverflow.com/q/27622097
tags question: http://stackoverflow.com/q/27627716
tags question: http://stackoverflow.com/q/27487371
tags question: http://stackoverflow.com/q/27601570
tags question: http://stackoverflow.com/q/27599605
tags question: http://stackoverflow.com/q/27564936
tags question: http://stackoverflow.com/q/27492809
tags question: http://stackoverflow.com/q/27492053
tags question: http://stackoverflow.com/q/27565668
tags question: http://stackoverflow.com/q/27476845
tags question: http://stackoverflow.com/q/27616918
tags question: http://stackoverflow.com/q/27624848

http://stackoverflow.com/q/27633700
upvote count: 1
has answer: http://stackoverflow.com/a/27636479
downvote count: 1
has comment: http://stackoverflow.com/comment/43687085
has comment: http://stackoverflow.com/comment/43687102
has answer: http://stackoverflow.com/a/27633757
has answer: http://stackoverflow.com/a/27634055
has answer: http://stackoverflow.com/a/27633779
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/43687149
tagged with: android-activity
favorite count: 0
has title: Android Login button stops working
type: Question
has body: Hi I am developing an android app, but my login button not working properly, as I am able to signup with web service but after in login page its stopped working, as I can navigate from signup to other page but login button does not let me login, please help me, below is my code for login functionality thanks public class Login extends ActionBarActivity { Button btnLogin; Button fbbutton; Button gpbutton; Button twbutton; Button btnRegister; EditText username, password; String uname, pass; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); Button btnLogin = (Button) findViewById(R.id.btnLogin); //import button Button btnRegister = (Button) findViewById(R.id.btnRegister); btnRegister.setOnClickListener(new View.OnClickListener(){ public void onClick(View view){ Intent i = new Intent(getApplicationContext(), Signup.class); startActivity(i); finish(); } }); } public void send(View v) { try { // CALL post method to make post method call post(); } catch (Exception ex) { String error = ex.getMessage(); } } //Method to get list value pair and form the query private String getQuery(List&lt;NameValuePair&gt; params) throws UnsupportedEncodingException { StringBuilder result = new StringBuilder(); boolean first = true; for (NameValuePair pair : params) { if (first) first = false; else result.append("&amp;"); result.append(URLEncoder.encode(pair.getName(), "UTF-8")); result.append("="); result.append(URLEncoder.encode(pair.getValue(), "UTF-8")); } return result.toString(); } //Method to post data to webservice public void post() throws UnsupportedEncodingException { try { // Calling async task to get json new DownloadOperation().execute(); } catch (Exception e) { e.printStackTrace(); } } //Handle popout messages public void error(boolean flag, String etext) { if (flag == true) { Toast.makeText(getBa…
has comment: http://stackoverflow.com/comment/43687121
tagged with: android
has comment: http://stackoverflow.com/comment/43687045
has comment: http://stackoverflow.com/comment/43687069
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43687283

http://stackoverflow.com/comment/43429879
score: 0
comment on: http://stackoverflow.com/q/27499395
has text: Consider also having them run jstat regularly and plotting the results. Find out if it really is unpredictable. Also, running with -XX:+HeapDumpOnOutOfMemoryError will have the JVM create the dump exactly when it matters. Third, run these tools on a development server to get acquainted with the results. Better still, run jvisualvm.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27591641
has answer: http://stackoverflow.com/a/27591667
has answer: http://stackoverflow.com/a/27591684
has body: I have a third party jar file that I have to use, but unfortunately it contains an embedded log4j configuration file as a resource. When I include the third party jar as a Maven dependency, I also pick up their log4j configuration, which overrides my own. Is there a way to tell Maven to include a jar dependency, while excluding a specific resource within that jar?
favorite count: 0
type: Question
score: 3
tagged with: log4j
linked to: http://stackoverflow.com/q/1140358
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/27591690
tagged with: maven
has title: Exclude resources from a dependent jar with Maven
tagged with: java
type: UnansweredQuestion
tagged with: resources
tagged with: jar
downvote count: 0

http://stackoverflow.com/comment/43431504
type: Comment
type: QuestionComment
has text: Right now my guess would be: You can't do that in an annotation definition - find another way. Anyone would agree on that?
score: 0
comment on: http://stackoverflow.com/q/27489439

http://stackoverflow.com/comment/43575887
score: 0
type: Comment
type: QuestionComment
has text: It doesn't matter what the site is written in, webservers all basically do the same thing. So, in plain English, this is what you do: You send a POST with the proper credentials, it returns a page that also includes a session cookie in headers. You read those headers, and in subsequent requests, you send the cookies from the headers so the server sees you as having a session.
comment on: http://stackoverflow.com/q/27575193

http://stackoverflow.com/comment/43566541
comment on: http://stackoverflow.com/a/27570363
score: 2
type: AnswerComment
type: Comment
has text: Alternatively you can use `list.stream().max(Comparator.naturalOrder()).get()`.

http://stackoverflow.com/comment/43652770
has text: then you have set them in your custom exception in your actual method and you can use aspect only to set classname and method name. but that is not worthy. This handling part of your dto, if it is some common code, then you can do that in aspect.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27614598
type: AnswerComment

http://stackoverflow.com/q/27629863
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27629888
score: 0
has comment: http://stackoverflow.com/comment/43680643
answer count: 2
has answer: http://stackoverflow.com/a/27630022
has title: Error due to action bar activity
has body: Hey guys when i add any action to action bar in android studio it just says add app combat..... When i added that it says to to change android to app and i changed that but when i run my application there is no action bar here is my xml and java code. xml <item android:title="search" android:icon="@drawable/ic_action_search" android:id="@+id/search_icon" android:text="search1" android:showAsAction="always" /> java public boolean onCreateOptionsMenu(android.view.Menu menu) { MenuInflater i= getMenuInflater(); i.inflate(R.menu.search_bar,menu); return super.onCreateOptionsMenu(menu); } app is running successfully but with no action bar when i remove that function oncreateOptionMenu it still does not shows any action bar but it shows on my first activity actually this is menu of app here is code public class Menu extends Activity { @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); setContentView(R.layout.menu); } //@Override /*public boolean onCreateOptionsMenu(android.view.Menu menu) { MenuInflater i= getMenuInflater(); i.inflate(R.menu.search_bar,menu); return super.onCreateOptionsMenu(menu); }*/ } and here is manifest <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name=".Menu" /> <category android:name="android.intent.category.DEFAULT" /> </manifest>
has comment: http://stackoverflow.com/comment/43680410
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/q/27536329
has comment: http://stackoverflow.com/comment/43501089
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/27536349
upvote count: 0
has comment: http://stackoverflow.com/comment/43501243
has body: I just begin to do the problems in cracking the coding interview. this is the first question: implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures? Here is the solution: Using a boolean array to track the occurrence of each possible character in ASCII set. Initially every value in that array is false, until the corresponding character value appears. If that character value appears again, then if the corresponding value in array is already true, return false. Time: O(n), n is the length of string. Space: O(n), the array named mask. Source Code: public class Interview { // Assume every character in string is in ASCII. public boolean uniqueChars(String s) { boolean[] mask = new boolean[256]; for (int i = 0; i &lt; s.length(); i++) { if (mask[s.charAt(i)]) return false; mask[s.charAt(i)] = true; } return true; } } I cannot understand this: mask[s.charAt(i)]. I think s.charAt(i) is a char but not a number, so I am don't know how this works. I know this is a simply question, but I cannot find a direct answer. Hope you guys can help me.Thanks a lot.
tagged with: boolean
linked to: http://stackoverflow.com/q/19484406
answer count: 1
has title: Java, what does mask[s.charAt(i)] mean? mask is a boolean array
accepted answer: http://stackoverflow.com/a/27536349
favorite count: 0
has comment: http://stackoverflow.com/comment/43501041
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/27488636
has body: when i maximize it the value is 360 but actual value is 1260 hot to get width after maximize? Try wrapping your code in a SwingUtiltities.invokeLater(). This will place the code at the end of the Event Dispatch Thread (EDT) so it should execute after the resizing code has been completed.
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27488432
downvote count: 0

http://stackoverflow.com/comment/118295952
score: 0
type: Comment
has text: @BuntuLinux do you remember, what the solution was? that link no longer works...
type: AnswerComment
comment on: http://stackoverflow.com/a/27518514

http://stackoverflow.com/comment/43429258
has text: @reto yes correct, it was just one possibility of making reference null, but yes still not guranteed. :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27499135

http://stackoverflow.com/q/27504508
possible better answer: http://stackoverflow.com/a/28570441
has comment: http://stackoverflow.com/comment/43440157
has comment: http://stackoverflow.com/comment/43439852
has comment: http://stackoverflow.com/comment/43439077
has comment: http://stackoverflow.com/comment/43442669
has title: java.lang.NoClassDefFoundError: org/json/JSONObject
has comment: http://stackoverflow.com/comment/43439875
has comment: http://stackoverflow.com/comment/43440659
has comment: http://stackoverflow.com/comment/43439583
score: 34
has answer: http://stackoverflow.com/a/27506960
has body: I am using Eclipse IDE and am writing a servlet. The servlet should accept values from an html file and return JSON response accordingly. My doPost() is: protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { try { res.setContentType("application/json"); res.setHeader("Cache-Control", "nocache"); res.setCharacterEncoding("utf-8"); PrintWriter out = res.getWriter(); JSONObject json = new JSONObject(); String un=req.getParameter("uname"); String pw=req.getParameter("password"); if(un.equals("xxx") &amp;&amp; pw.equals("xxx")) json.put("result", "success"); else json.put("result", "fail"); out.print(json.toString()); } catch(Exception e){System.out.print( e.getMessage());} } When I run this servlet in Eclipse I get a file download dialog. When run outside Eclipse with Tomcat, I get error: root cause java.lang.NoClassDefFoundError: org/json/JSONObject Server1.doPost(Server1.java:25) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) root cause java.lang.ClassNotFoundException: org.json.JSONObject org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) Server1.doPost(Server1.java:25) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) The line Server1.doPost(Server1.java:25) refers to JSONObject json = new JSONObject(); I have added the org.json.jar to the build path as well as added it to deployment path in Properties-&gt;Configure build path-&gt;Deployment assembly
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43439494
has comment: http://stackoverflow.com/comment/43443039
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43439535
has comment: http://stackoverflow.com/comment/43441011
has answer: http://stackoverflow.com/a/27504580
has comment: http://stackoverflow.com/comment/43440757
has comment: http://stackoverflow.com/comment/43439750
duplicate of: http://stackoverflow.com/q/6792197
downvote count: 1
has comment: http://stackoverflow.com/comment/43444168
type: Question
has answer: http://stackoverflow.com/a/28570441
linked to: http://stackoverflow.com/q/6792197
has comment: http://stackoverflow.com/comment/43439327
has comment: http://stackoverflow.com/comment/43442597
has comment: http://stackoverflow.com/comment/43440439
has comment: http://stackoverflow.com/comment/43439976
has comment: http://stackoverflow.com/comment/43439412
tagged with: servlets
has answer: http://stackoverflow.com/a/27504582
linked to: http://stackoverflow.com/q/16362302
linked to: http://stackoverflow.com/q/14657585
has comment: http://stackoverflow.com/comment/43439360
has comment: http://stackoverflow.com/comment/43440917
upvote count: 35
has comment: http://stackoverflow.com/comment/43440307
has comment: http://stackoverflow.com/comment/43439022
has comment: http://stackoverflow.com/comment/43439049
has comment: http://stackoverflow.com/comment/43440355
answer count: 4
accepted answer: http://stackoverflow.com/a/27506960
has comment: http://stackoverflow.com/comment/43442302
favorite count: 0

http://stackoverflow.com/a/27549226
score: 14
accepted answer of: http://stackoverflow.com/q/27546730
downvote count: 0
has comment: http://stackoverflow.com/comment/43527066
has body: In your activeMQ.xml you would have some configuration like this .... you need to specify a value which is available on your disk,as error clearly mentions there is only 29021 MB of free space you need to set to a value lesser than your free space you can do something like Hope this helps! Good luck!
upvote count: 14
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43587941
has comment: http://stackoverflow.com/comment/43627571
has comment: http://stackoverflow.com/comment/43623049
has comment: http://stackoverflow.com/comment/43525611
answers question: http://stackoverflow.com/q/27546730
has comment: http://stackoverflow.com/comment/43529529
type: Answer
has comment: http://stackoverflow.com/comment/43530017

http://stackoverflow.com/q/27497005
tagged with: collections
type: Question
has body: Okay I cannot for the life of me figure out how to sort my data by tournament placings. Here is my code. if (o == 5) { double RD, t, old, x; String tournament, player; int a, number_of_players, place; place = 0; ArrayList&lt;player&gt; players = new ArrayList&lt;player&gt; (); ArrayList&lt;placeDisplay&gt; placeVar = new ArrayList&lt;placeDisplay&gt; (); List&lt;placeDisplay&gt; sort = new ArrayList&lt;placeDisplay&gt; (); System.out.println("1:Add a tournament \t2:View Existing"); a = keyIn.nextInt(); if (a == 1) { System.out.println("\nEnter tournament name"); tournament = keyIn.next(); System.out.println("\nEnter number of players"); number_of_players = keyIn.nextInt(); System.out.println("Enter players"); for (int i = 0; i &lt; number_of_players; i++) { String name = keyIn.next(); player plr = new player(); plr.setName(name); players.add(plr); } System.out.println("\nEnter places for"); System.out.println(players); for (int i = 0; i &lt; players.size(); i++) { System.out.println("\n" + players.get(i)); int places = keyIn.nextInt(); placeDisplay placer = new placeDisplay(); placer.setPlace(places); placeVar.add(placer); } Collections.sort(sort); System.out.println("\nThe Places are as follows"); for (int i = 0; i &lt; players.size() &amp;&amp; i &lt; placeVar.size(); i++) { System.out.println(placeVar.get(i) + ":" + players.get(i)); } } } here is my public placeDisplay class file. public class placeDisplay implements Comparable&lt;placeDisplay&gt; { private int places; public void setPlace(int nPlace) { places = nPlace; } public int getPlace() { return places; } @Override public String toString() { return Integer.toString(places); } @Override public int compareTo(placeDisplay placeDisplay){ if (places &gt; places) return 1; else if (places == places) return 0; else return -1; } } Here is the public class file public class player { private String name; public void setName(String pName) { name = pName; } public String getName() { return name; } @Override public Str…
tagged with: sorting
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43425541
answer count: 2
downvote count: 0
favorite count: 0
has title: ArrayList sorting tournament placings
upvote count: 2
has answer: http://stackoverflow.com/a/27497069
has answer: http://stackoverflow.com/a/27497074
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43425458
tagged with: java
possible better answer: http://stackoverflow.com/a/27497069
accepted answer: http://stackoverflow.com/a/27497074

http://stackoverflow.com/q/27498623
has title: Spring RestController custom view resolver
has body: I've recently started implementing an application using spring, and particularly making some use of the @RestController annotations. I've defined a custom view resolver before for normal controllers, but I'm wondering how I could do something similar for the rest controller. I'm just trying to capture the JSON before it gets returned so I can pretty print it. I guess since it's not really routing to a "view" a view resolver is probably the wrong approach. What should I be using? Can I use a HandlerInterceptor perhaps? How would I target only @RestController annotated classes?
tagged with: spring
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/27499547
score: 1
has answer: http://stackoverflow.com/a/27499547
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43429941
answer count: 2
has answer: http://stackoverflow.com/a/27499827
accepted answer: http://stackoverflow.com/a/27499827
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43443984

http://stackoverflow.com/comment/43512268
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27515436
has text: I updated the answer to include an option to inhibit the remove()

http://stackoverflow.com/q/27634308
has comment: http://stackoverflow.com/comment/43688774
type: Question
has comment: http://stackoverflow.com/comment/43689016
has comment: http://stackoverflow.com/comment/43689024
has comment: http://stackoverflow.com/comment/43688689
has comment: http://stackoverflow.com/comment/43688159
tagged with: java
tagged with: memory
has comment: http://stackoverflow.com/comment/43688544
has answer: http://stackoverflow.com/a/27634537
answer count: 1
tagged with: slideshow
has comment: http://stackoverflow.com/comment/43688960
has comment: http://stackoverflow.com/comment/43688450
has title: Why DDMS can free memory by clicking GC button while GC is never automatically called?
score: 0
has comment: http://stackoverflow.com/comment/43688849
tagged with: android
has comment: http://stackoverflow.com/comment/43688874
has comment: http://stackoverflow.com/comment/43688182
has comment: http://stackoverflow.com/comment/43688357
type: UnansweredQuestion
tagged with: garbage-collection
has body: I am making a slide show like application. However, I found it will be auto restarted after 30 min of slide show. Doing ps and I can see the RSS section is increasing everytime when switching pictures. I tried to add System.gc() before loading the next picture, and even calling Thread.sleep() to yield the current thread. But the gc never happens... I think I am NOT keeping any useless reference in my code, since if I attached it with DDMS and click the GC button, it will perform GC very well. And the size of RSS section is reduced to the level at the time the process started. The question is Why DDMS can free a lot of memory by clicking GC button but GC is not automatically called (just leaving the useless objects there)?

http://stackoverflow.com/comment/43481800
comment on: http://stackoverflow.com/a/27523636
score: 0
type: AnswerComment
has text: after logging in is successfully viewer should be able to access files in /sp/, which will not happen because of filter.how can i access sp without logging in into login1..?
type: Comment

http://stackoverflow.com/a/27590229
answers question: http://stackoverflow.com/q/27590169
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43604433
score: 0
has comment: http://stackoverflow.com/comment/43604499
has comment: http://stackoverflow.com/comment/43604472
has body: First of all, do you use an IDE? Your run() method is inside your main() method. You don't need a run method anyway. Just instantiate from main() new SwingDemo(); and remove the run() function like this: public static void main(String[] args) { new SwingDemo(); }
type: Answer
has comment: http://stackoverflow.com/comment/43604393

http://stackoverflow.com/comment/43543346
comment on: http://stackoverflow.com/a/27558562
type: AnswerComment
score: 0
has text: @GabeSechan I don't see how this a "wrong answer." He didn't say anything about his other requirements.
type: Comment

http://stackoverflow.com/a/27492555
has comment: http://stackoverflow.com/comment/43522101
type: Answer
has comment: http://stackoverflow.com/comment/43453260
has comment: http://stackoverflow.com/comment/43416878
has comment: http://stackoverflow.com/comment/43477308
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43482999
has body: Yes, if you already did this in JavaScript you can use the code by creating a definition file for it and port it to TypeScript. An example might be like this: declare module Java { export enum ErrorCodeAuthority { item1, item2 } export function type(arg: "com.domain.ErrorCodeAuthority"): ErrorCodeAuthority; export function type(arg: string): any; } var JavaErrorCodeAuthority = Java.type("com.domain.ErrorCodeAuthority"); The enum and the first type function with the "com.domain.ErrorCodeAuthority" is optional but it gives you better typeinfo when passed in that particular string. Note the declare module part doesn't generate any code and you can add it to a .ts or .d.ts file. More info about creating a definition file can be found here: https://github.com/Microsoft/TypeScript/wiki/Writing%20Definition%20Files EDIT after the info from the comments I hope this code below will better suite your need. This has the downside that it isn't usable in a switch statement but in this case I think it is better to see the java enum as a module (or class was possible to). This might not be 100% correctly modelled but hopefully it gives you some extra idea's. Just a small side note, I find your case very interesting and challenging! declare module Java { interface ErrorCodeValue { toString(): string; value(): number; } module ErrorCodeAuthority { var ENTITY_NOT_FOUND: IErrorCodeAuthority; var HTTP_VERB_NOT_SUPPORTED: IErrorCodeAuthority; var BAD_REQUEST: IErrorCodeAuthority; } interface IErrorCodeAuthority { httpStatus: ErrorCodeValue; } export function type(arg: "com.domain.ErrorCodeAuthority"): typeof ErrorCodeAuthority; export function type(arg: string): any; } export class HttpResult { constructor(code: number, description: string) { } } export class HttpFailResult extends HttpResult { constructor(public errorCode: Java.IErrorCodeAuthority, public userParams? :any[]) { super(errorCode.httpStatus.value(), errorCode.toString()); } } var JavaErrorCodeAuthority = Java.type("com.dom…
has comment: http://stackoverflow.com/comment/43417094
has comment: http://stackoverflow.com/comment/43500211
has comment: http://stackoverflow.com/comment/43424282
answers question: http://stackoverflow.com/q/27492384
upvote count: 1

http://stackoverflow.com/comment/43446035
type: QuestionComment
comment on: http://stackoverflow.com/q/27507175
score: 0
has text: i don't see why the date won't work. convert the strings into dates then Collections.sort() on a list of java.util.Date will work
type: Comment

http://stackoverflow.com/comment/43449986
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27509890
has text: what are the initial values?

http://stackoverflow.com/comment/43530328
has text: Well, your edit wouldn't work no, but it is not an abstract class and I believe there are other ways to get that information as well. It will work for an abstract class. For a non-abstract class there are ways as well: http://stackoverflow.com/questions/3403909/get-generic-type-of-class-at-runtime ... For interfaces it will always work pre-lambdas
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27551269
type: Comment

http://stackoverflow.com/comment/43662260
comment on: http://stackoverflow.com/q/27620645
has text: Input "seven" implies to me that you are doing a depth first search which lands on "supervisor 1" as the seventh node you reach. What is the meaning of the number in parentheses?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43618912
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27552876
type: AnswerComment
has text: Thanks @Guardanis. what you said is right. my code is working fine.

http://stackoverflow.com/comment/43422801
type: Comment
type: QuestionComment
has text: 99% chance you've got a Threading problem where you're likely inadvertently tying up the Swing event thread with your sound clips. 100% chance that we're not going to be able to help you based on the code you've posted. As @MadProgrammer recommends and which I second, isolate your problem by creating a small runnable example, an [mcve](https://stackoverflow.com/help/mcve), that we can run, modify and help correct. Yes, this asking you to do some work for us, but it is work that is well worthwhile to do.
score: 2
comment on: http://stackoverflow.com/q/27495340

http://stackoverflow.com/comment/43688990
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27517862
has text: Got DistributionID, but there is another error: User: ... is not authorized to perform: cloudfront:CreateInvalidation
type: Comment

http://stackoverflow.com/comment/43482711
type: AnswerComment
has text: Similar to the OPs code, this will break (in a different way - but still) for large values.
type: Comment
comment on: http://stackoverflow.com/a/27527045
score: 0

http://stackoverflow.com/a/27622632
answers question: http://stackoverflow.com/q/27622064
accepted answer of: http://stackoverflow.com/q/27622064
type: AcceptedAnswer
downvote count: 0
has body: The behavior you want to get is the following A a = new A(); B b = new B(); a.setB(b); b.setA(a); @Bean methods don't give you that. They run to completion to provide a bean instance. You basically have to partially create one of the instances, then finish initializing it when you've created the other. @Configuration class Config { @Bean public A a() { A a = new A(); return a; } @Bean public B b() { B b = new B(); A a = a(); b.setA(a); a.setB(b); return b; } } or @Bean public B b(A a) { B b = new B(); b.setA(a); a.setB(b); return b; }
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/47351754
has comment: http://stackoverflow.com/comment/43666203
has comment: http://stackoverflow.com/comment/43666237

http://stackoverflow.com/comment/43661250
type: Comment
comment on: http://stackoverflow.com/q/27620071
has text: When you _write_ to a file, do you remember to `writer.newLine()` before you write another line? Also, what do you mean by "encoded" anyway? ALL text written to a file is written using a character coding, by definition
score: 0
type: QuestionComment

http://stackoverflow.com/a/27509678
score: 1
has body: Cassandra has definitely deviated away from the thrift model of storing data but you can still get a similar partition layout in cql with something like: partition blob, key blob , value blob, PRIMARY KEY partition,key or key blob, value blob, PRIMARY KEY key Depending on if you want to have multiple keys in a partition or not. Thrift is still available but is definitely one foot out the door at the moment.
accepted answer of: http://stackoverflow.com/q/27506665
has comment: http://stackoverflow.com/comment/43667320
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27506665
downvote count: 0

http://stackoverflow.com/comment/43393294
has text: The application is basically written in java. Is it possible to integrate the templates with java?
comment on: http://stackoverflow.com/a/27477771
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/43596553
comment on: http://stackoverflow.com/a/27583174
type: AnswerComment
has text: @TheDDestroyer12 yes exactly.
score: 0
type: Comment

http://stackoverflow.com/comment/43584360
type: Comment
comment on: http://stackoverflow.com/q/27577337
type: QuestionComment
score: 1
has text: A CompletionExecutorService would probably be a better fit for your use case.

http://stackoverflow.com/comment/43602682
type: Comment
comment on: http://stackoverflow.com/a/27587306
has text: Thanks for your answer but I am getting same error when I write like this. In this StackOverflow ocean is not anyone who know this. what is Nvl ?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27508936
answer count: 1
has comment: http://stackoverflow.com/comment/43448899
has comment: http://stackoverflow.com/comment/43448261
has answer: http://stackoverflow.com/a/27516071
has body: i'm trying to print a xsl:message in a JTextArea. I know I have to use a MessageEmitter Here is my Java Code: public static void xslTransform(File xmlFile,File xslFile, JTextArea output){ StreamSource source = new StreamSource(xmlFile); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory transFact = new TransformerFactory.newInstance(); transFact.setAttribute(FeatureKeys.MESSAGE_EMITTER_CLASS, "net.sf.saxon.serialize.MessageEmitter"); Transformer transformer = transFact.newTransformer(new StreamSource(xslFile)); transformer.transform(source, result); Can anybody help me to get a String from the &lt;xsl:message&gt; ? This is my current Code: public static void xslTransform(File xmlFile)throws IOException, TransformerException{ File xslFile = ...; StreamSource xmlSource = new StreamSource(xmlFile); StreamSource xslSource = new StreamSource(xslFile); StreamResult result = new StreamResult (new StringWriter()); //maybe here is the problem? TransformerFactory transformerFact = TransformerFactory.newInstance(); transformerFact.setAttribute(FeatureKeys.MESSAGE_EMITTER_CLASS, "MyMessageEmitter"); Transformer transformer = transformerFact.newTransformer(xslSource); transformer.transform(xmlSource,result); } MyMessageEmitter Class: public class MyMessageEmitter extends net.sf.saxon.serialize.MessageEmitter{ String message; private StringWriter stwriter = new StringWriter(); public void MyMessageEmitter() throws XPathException{ setWriter(stwriter); } @Override public void close() throws XPathException{ super.close(); message=stwriter.toString(); System.out.println(message); stwriter = new StringWriter(); } } why is message now all the time null? KaFu
has comment: http://stackoverflow.com/comment/43470024
type: UnansweredQuestion
tagged with: java
tagged with: xslt
linked to: http://stackoverflow.com/q/27420589
type: Question
score: 0
has title: print xsl:message as String in TextArea
has comment: http://stackoverflow.com/comment/43454262

http://stackoverflow.com/comment/43689338
has text: @NikhilEm It definitely is. You need to download [Eclipse for Java Developers](https://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/lunasr1)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27634919
score: 1

http://stackoverflow.com/q/27541349
has title: Inject user entity with EJB
upvote count: 1
has comment: http://stackoverflow.com/comment/43510330
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27542018
tagged with: ejb
downvote count: 0
answer count: 1
tagged with: rest
favorite count: 0
tagged with: cdi
has body: I use JAAS authentication in my application. Think think that I have User Entity class like this: @Entity public class User { @Id public Long id; public String name; ... and a rest API like this: @Stateless @LocalBean @Path("/users") public class Users { // INJECT USER OBJECT HERE @Inject private User user; @Path("/me") @Produces({ MediaType.APPLICATION_JSON }) @GET public User getUser() { return user; } ... Is there anyway I create a @Produces method to generate User entity object from @SessionContext.getCallerPrincipal() and EntityManager and Inject it directly into the all rest apis that I want?
type: UnansweredQuestion

http://stackoverflow.com/a/27607955
type: Answer
has body: I found in this forum which OpenCV doesn't Works properly with stream in mjpg format. In this forum also, I found a code to use with JavaCV, and this worked fine for me: public static void main(String[] args) throws Exception { OpenCVFrameGrabber grabber = new OpenCVFrameGrabber("http://USER:PASSWORD@187.45.142.127:80/mjpeg.cgi?user=USER&amp;password=PASSWORD&amp;channel=0&amp;.mjpg"); grabber.setFormat("mjpeg"); grabber.start(); IplImage frame = grabber.grab(); CanvasFrame canvasFrame = new CanvasFrame("Camera"); canvasFrame.setCanvasSize(frame.width(), frame.height()); while (canvasFrame.isVisible() &amp;&amp; (frame = grabber.grab()) != null) { canvasFrame.showImage(frame); } grabber.stop(); canvasFrame.dispose(); System.exit(0); }
score: 0
answers question: http://stackoverflow.com/q/27552251
accepted answer of: http://stackoverflow.com/q/27552251
type: AcceptedAnswer

spring-social
tags question: http://stackoverflow.com/q/27525125
tag name: spring-social
type: Tag

http://stackoverflow.com/q/27588390
has answer: http://stackoverflow.com/a/27588457
has title: App crush while running a simple ball app
score: -1
tagged with: multithreading
downvote count: 1
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27588457
has comment: http://stackoverflow.com/comment/43600902
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/43601002
has body: I am trying to launch a very basic app - a ball that should bounce on the screen but I am getting an error while trying to launch app on device. Here's my code, I may have some errors but please explain to me what are they and how could I fix them, I'm new to android development.. public class Ball { float x; float y; boolean movingRight; boolean movingBottom; float screenWidth; float screenHeight; public Ball(float x, float y, float screenWidth, float screenHeight) { this.x = x; this.y = y; this.screenWidth = screenWidth; this.screenHeight = screenHeight - 150; this.movingBottom = false; this.movingRight = false; } public void move() { if (movingRight) this.x++; else this.x--; if (movingBottom) this.y++; else this.y--; if (this.x &gt;= this.screenWidth) this.movingRight = false; else if (this.x &lt;= 1) this.movingRight = true; if (this.y &gt;= this.screenHeight) this.movingBottom = false; else if (this.y &lt;= 1) this.movingBottom = true; } public float getX(){ return this.x; } public float getY() { return this.y; } public class MySurfaceView extends SurfaceView{ private Ball ball; private SurfaceHolder holder; Paint paint; public Paint getBallPaint() { if(paint == null) { paint = new Paint(); paint.setColor(Color.RED); paint.setStrokeWidth(3); } return this.paint; } public MySurfaceView(Context context) { super(context); holder = getHolder(); holder.addCallback(new SurfaceHolder.Callback() { @Override public void surfaceDestroyed(SurfaceHolder holder) { } @Override public void surfaceCreated(SurfaceHolder holder) { Canvas c = holder.lockCanvas(null); draw(c); holder.unlockCanvasAndPost(c); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } }); } @Override public void draw(Canvas canvas) { canvas.drawColor(Color.WHITE); canvas.drawCircle(ball.x,ball.y,15,getBallPaint()); } } public class GameLoopThread extends Thread { private MySurfaceView view; private boolean running = false; public GameLoopThread(MySurfaceView v…
favorite count: 0
has comment: http://stackoverflow.com/comment/43601038
type: Question
tagged with: android

http://stackoverflow.com/comment/43388793
has text: What do you think `getProfit(saleData[])` does and why do you think so?
score: 0
comment on: http://stackoverflow.com/q/27477472
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27488432
has answer: http://stackoverflow.com/a/27488640
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43408482
has comment: http://stackoverflow.com/comment/43408761
tagged with: java
has title: trap maximize event and get new width of frame
has answer: http://stackoverflow.com/a/27488636
type: Question
has answer: http://stackoverflow.com/a/27488617
has comment: http://stackoverflow.com/comment/43408666
possible better answer: http://stackoverflow.com/a/27488636
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/43408502
answer count: 3
has body: I tried to do this in Java: public class Fram extends JFrame{ public void init(){ addWindowStateListener(new java.awt.event.WindowStateListener() { public void windowStateChanged(java.awt.event.WindowEvent evt) { wsc(evt); } }); } private void wsc(java.awt.event.WindowEvent evt) { System.out.println(evt.getNewState() == Frame.MAXIMIZED_BOTH); System.out.println(this.getWidth()); } } And the output is late. When I maximize it the value is 360, but actual value is 1260. How do I the get width after maximizing?
accepted answer: http://stackoverflow.com/a/27488617
has comment: http://stackoverflow.com/comment/43408495
linked to: http://stackoverflow.com/q/11148950
upvote count: 1
tagged with: swing
downvote count: 1

http://stackoverflow.com/comment/43588365
score: 0
type: Comment
has text: @fge this is not (strictly conforming) standard C; this is Windows API code, and the Windows API implements a type called [`FILETIME`](http://msdn.microsoft.com/en-us/library/windows/desktop/ms724284%28v=vs.85%29.aspx).
type: QuestionComment
comment on: http://stackoverflow.com/q/27581734

http://stackoverflow.com/q/27632462
upvote count: 2
tagged with: java
tagged with: mysql
tagged with: swing
has comment: http://stackoverflow.com/comment/43685095
type: Question
has title: Connection Pooling in a java chat server
has answer: http://stackoverflow.com/a/27633501
has body: I have already developed a LAN client-server chat application in java.My server establishes connection to a mysql database using jdbc where i save client information.Now i want to know should i use Connection pooling in server for establishing connection to mysql.Can anyone tell me if i am on the right track.I actually came across this concept on internet and i thought of implementing it in my project.Can anyone just tell me if it is necessary to use connection pooling and if it can be helpful for my chat application.
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/43686085
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43686116
has answer: http://stackoverflow.com/a/27632990
accepted answer: http://stackoverflow.com/a/27633501
has comment: http://stackoverflow.com/comment/43685545
tagged with: jdbc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27632990
tagged with: connection-pooling
has comment: http://stackoverflow.com/comment/43686242

http://stackoverflow.com/q/27578891
score: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4945178
upvote count: 1
has comment: http://stackoverflow.com/comment/43582452
downvote count: 1
has title: Eclipse - Java was started but returned exit code=13
has comment: http://stackoverflow.com/comment/43582889
has comment: http://stackoverflow.com/comment/136593022
has comment: http://stackoverflow.com/comment/43582727
has comment: http://stackoverflow.com/comment/43582733
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/43582676
has comment: http://stackoverflow.com/comment/43582794
answer count: 1
has answer: http://stackoverflow.com/a/27579110
favorite count: 0
has body: I've been trying to simply install Eclipse, but something went wrong apparently... I've even tried uninstalling Java and re-installing the latest Java hoping that would do something, but still nothing. Here's what I get when I run the eclipse.exe file (This is a temporary laptop by the way): http://gyazo.com/ccbc408dcf1bdbcbfae0143600eb58cd Now I barely know anything about computers and all, so I'll need a really numbed down explanation... any help is appreciated! ~Deion
tagged with: installation

http://stackoverflow.com/comment/43525073
type: Comment
has text: MgYaar, that's the problem! Because I can only perform the desired task if the usuario_login have these 3 nivelAcesso
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27549356

http://stackoverflow.com/comment/43440157
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27504508
has text: Try by **clean and build** and then run your project. For Eclipse, adding a class path variable is enough to avoid class reference error in eclipse. Only if you add your library in your deployment assembly, library will be available on run time (jar will be moved to your lib)
score: 0

http://stackoverflow.com/q/27587013
has comment: http://stackoverflow.com/comment/43598380
tagged with: java
has answer: http://stackoverflow.com/a/27587084
type: Question
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/12945537
has body: I have a project that I'm a bit stuck on. I have a JFrame with a JTextArea and a button when the button is clicked it is to open the test class in the text area of the frame. So my question is, how do I get the test class to open in the text area of the frame? I have tried getText(test()) but it say that can not find symbol method test. This is my JFrame code: package sunday; /** * * @author warwick */ public class sunday1 extends javax.swing.JFrame { /** * Creates new form sunday1 */ public sunday1() { 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() { jScrollPane1 = new javax.swing.JScrollPane(); TxtField = new javax.swing.JTextArea(); btnOpen = new javax.swing.JToggleButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); TxtField.setColumns(20); TxtField.setRows(5); jScrollPane1.setViewportView(TxtField); btnOpen.setText("Open"); btnOpen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOpenActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnOpen) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(57, 57, 57)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.A…
score: 0
has comment: http://stackoverflow.com/comment/43598421
has comment: http://stackoverflow.com/comment/43598321
has title: Display class output in a text area when button clicked
answer count: 1
tagged with: button
accepted answer: http://stackoverflow.com/a/27587084
tagged with: jframe
has comment: http://stackoverflow.com/comment/43598371
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/a/27628521
has comment: http://stackoverflow.com/comment/43678113
has comment: http://stackoverflow.com/comment/43681176
has comment: http://stackoverflow.com/comment/43680801
has comment: http://stackoverflow.com/comment/62768464
downvote count: 0
has comment: http://stackoverflow.com/comment/43803058
has comment: http://stackoverflow.com/comment/43682567
answers question: http://stackoverflow.com/q/27623383
has comment: http://stackoverflow.com/comment/43680527
has comment: http://stackoverflow.com/comment/43679785
upvote count: 2
type: Answer
has body: The class is not automatically available in the App Engine runtime. You must enable it by adding &lt;use-google-connector-j&gt;true&lt;/use-google-connector-j&gt; to your appengine-web.xml. This is documented at: https://cloud.google.com/appengine/docs/java/cloud-sql/#enable_connector_j Edited to add (from comments below): Also, when connecting to Cloud SQL from GAE you should leave the password field empty. You should also make sure that if your code is running outside GAE (e.g. on your workstation, on GCE, on a Jenkins build) it uses stock MySQL connector as the Google connector is only available on GAE. You might also want too look into using the stock MySQL driver, which works both from GAE and other connections. There is a demo of this at https://github.com/GoogleCloudPlatform/appengine-cloudsql-native-mysql-hibernate-jpa-demo-java
has comment: http://stackoverflow.com/comment/65657870
score: 2

http://stackoverflow.com/comment/43496117
type: Comment
has text: Thanks for you help on this. I moved on to Canny's and I seem to have an issue with my operations Hysteresis, I would greatly appreciate if you can help me on it like you've helped me here :). [http://stackoverflow.com/questions/27531747/cannys-algorithm-hysteresis-mal-function]
type: AnswerComment
comment on: http://stackoverflow.com/a/27493331
score: 0

soa
type: Tag
tags question: http://stackoverflow.com/q/27591243
tag name: soa

http://stackoverflow.com/q/27573762
downvote count: 1
type: Question
tagged with: split
linked to: http://stackoverflow.com/q/10796160
has comment: http://stackoverflow.com/comment/43573089
has body: I have a file and i have to read it line by line. The file contains similar lines, like these: asd@lol kek|1.1.1.1 title@content m e s s a g e|2.3.4.5 I read these lines to String variables. How can i split these strings to other variables? For example: var1=title, var2=content, var3=m e s s a g e, var4=2.3.4.5 I tried something like this, but i cant find the solution: stringArray=line.split("|");
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43573121
has comment: http://stackoverflow.com/comment/43573046
upvote count: 2
tagged with: regex
has answer: http://stackoverflow.com/a/27573852
accepted answer: http://stackoverflow.com/a/27573852
type: AnsweredQuestion
has title: java split string with regex and store it in variables
score: 1
tagged with: java

http://stackoverflow.com/comment/43613299
type: Comment
type: QuestionComment
has text: It won't give an error only in that case; it will throw an exception if an empty string is given to `sc.nextLine()` as soon as the first entry
comment on: http://stackoverflow.com/q/27594811
score: 0

plugins
tags question: http://stackoverflow.com/q/27494208
tags question: http://stackoverflow.com/q/27589444
tags question: http://stackoverflow.com/q/27553341
tags question: http://stackoverflow.com/q/27535145
tags question: http://stackoverflow.com/q/27562938
tags question: http://stackoverflow.com/q/27523039
tag name: plugins
tags question: http://stackoverflow.com/q/27480547
tags question: http://stackoverflow.com/q/27596778
type: Tag
tags question: http://stackoverflow.com/q/27568917

http://stackoverflow.com/q/27638418
has comment: http://stackoverflow.com/comment/43696391
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43695725
tagged with: java
downvote count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/27638976
has comment: http://stackoverflow.com/comment/43696277
has comment: http://stackoverflow.com/comment/43695798
has comment: http://stackoverflow.com/comment/43695781
has comment: http://stackoverflow.com/comment/43696469
type: Question
has comment: http://stackoverflow.com/comment/43695782
has title: Arrays.sort does not work in java
has comment: http://stackoverflow.com/comment/43695947
has body: I am having a custom class called Company, and it has fields being latitude and longitude. I want to sort them based on distance from current location but it does not seem to work. I have double checked all the data, and they are correct but for a reason the sorting does not seem to work. Code is : currentCompanies=AllCompanies.sortByDistanceFromOwnLocation(currentCompanies, AppConstant.userLatitude, AppConstant.userLongitude); which calls these : public static Vector&lt;Company&gt; sortByDistanceFromOwnLocation( Vector&lt;Company&gt; locations, final double myLatitude, final double myLongitude) { Comparator comp = new Comparator&lt;Company&gt;() { @Override public int compare(Company o, Company o2) { float[] result1 = new float[3]; android.location.Location.distanceBetween(myLatitude, myLongitude, Double.parseDouble(o.getLatitude().trim()), Double.parseDouble(o.getLongitude().trim()), result1); Float distance1 = result1[0]; float[] result2 = new float[3]; android.location.Location.distanceBetween(myLatitude, myLongitude, Double.parseDouble(o2.getLatitude().trim()), Double.parseDouble(o2.getLongitude().trim()), result2); Float distance2 = result2[0]; return distance1.compareTo(distance2); } }; Collections.sort(locations, comp); return locations; } which calls this from the Collection.class: /** * Sorts the given list using the given comparator. The algorithm is * stable which means equal elements don't get reordered. * * @throws ClassCastException if any element does not implement {@code Comparable}, * or if {@code compareTo} throws for any pair of elements. */ @SuppressWarnings("unchecked") public static &lt;T&gt; void sort(List&lt;T&gt; list, Comparator&lt;? super T&gt; comparator) { T[] array = list.toArray((T[]) new Object[list.size()]); Arrays.sort(array, comparator); int i = 0; ListIterator&lt;T&gt; it = list.listIterator(); while (it.hasNext()) { it.next(); it.set(array[i++]); } } What am I doing wrong? EDIT : Ok more info on that. I am having 8 companies - l…
has comment: http://stackoverflow.com/comment/43696601
has comment: http://stackoverflow.com/comment/43696402
has answer: http://stackoverflow.com/a/27638976
score: -1
tagged with: sorting
has comment: http://stackoverflow.com/comment/43695807
has comment: http://stackoverflow.com/comment/43695585
answer count: 1
has comment: http://stackoverflow.com/comment/43695856
has comment: http://stackoverflow.com/comment/43696585
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43695714

http://stackoverflow.com/comment/43694838
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27636084
has text: This is an entirely different question. In any case, simply follow a simple rule: never use commas in the `from` clause. Use explicit joins and you will fix your problem.
score: 0

http://stackoverflow.com/comment/43650939
has text: This supports aspect oriented programming in java. You can have your code in single place by defining that before and after which all methods it can be called. You can look for any tutorial site for same, it is pretty simple and is for same kind of scenario. I use Spring framework so I use Spring AOP, however you can use any aspect oriented framework.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27601781

http://stackoverflow.com/comment/43648869
has text: You've read the tutorials right? You understand that in order to display an applet, the class needs to extend from `Applet`? You do realise that there is a significant difference between a windowed application and a applet?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27613331
type: QuestionComment

http://stackoverflow.com/a/27490080
downvote count: 0
has comment: http://stackoverflow.com/comment/43412159
has comment: http://stackoverflow.com/comment/43412142
has comment: http://stackoverflow.com/comment/43411862
score: 31
upvote count: 31
has body: Could you try like tihs; // create a calendar Calendar cal = Calendar.getInstance(); cal.setTime(datetime); //use java.util.Date object as arguement // get the value of all the calendar date fields. System.out.println("Calendar's Year: " + cal.get(Calendar.YEAR)); System.out.println("Calendar's Month: " + cal.get(Calendar.MONTH)); System.out.println("Calendar's Day: " + cal.get(Calendar.DATE)); As mentioned in javadocs; @Deprecated public int getYear() Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900. Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in time represented by this Date object, as interpreted in the local time zone. Returns: the year represented by this date, minus 1900.
has comment: http://stackoverflow.com/comment/43412183
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43411812
accepted answer of: http://stackoverflow.com/q/27489980
has comment: http://stackoverflow.com/comment/43412102
answers question: http://stackoverflow.com/q/27489980
type: Answer
has comment: http://stackoverflow.com/comment/43411790
has comment: http://stackoverflow.com/comment/43411982
has comment: http://stackoverflow.com/comment/43411748
has comment: http://stackoverflow.com/comment/43412204

http://stackoverflow.com/q/27497775
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43427535
tagged with: jdbi
type: Question
has comment: http://stackoverflow.com/comment/43427666
has body: I'm using the SQL query which uses a custom written function similar to this CREATE OR REPLACE FUNCTION per_cont(myarray integer[], percentile real) This works perfectly in the pgAdmin tool, but when I use this query in my java application it gives me an error: function per_cont(integer[], real) does not exist I'm using JDBI library to interact with the database. Why doesn't it find the function when running it from a java application? How can I fix it?
has answer: http://stackoverflow.com/a/27505705
linked to: http://stackoverflow.com/q/9067335
tagged with: postgresql
upvote count: 1
tagged with: sql
answer count: 1
tagged with: jdbc
has title: PostgreSQL function does not exist
favorite count: 0
has comment: http://stackoverflow.com/comment/43441019
type: UnansweredQuestion

http://stackoverflow.com/a/27596735
has comment: http://stackoverflow.com/comment/43617350
score: 3
has body: And it will change every time I run code. Yes. That's due to Optimal Asymmetric Encryption Padding (OAEP). If you send the same message twice, like Attack at dawn, your adversary who observes the message won't be able to learn anything (or make an educated guess) when he sees the message again. The property is known as semantic security or Ciphertext Indistinguishability (IND-CPA). Here's a related talk by Dr. Matt Green on PKCS padding versus OAEP padding. Its very approachable: A bad couple of years for the cryptographic token industry. Is "AAAAAAAA..." padding is correct for no padding of java? Possibly. I believe its just a string of leading 0x00 bytes that have been Base64 encoded. What has openssl done in C++ code to cause the result seems to have padding and time varying? Its using OAEP. So, the question become to: What has openssl done to fill the input to reach the required length? Its using OAEP. The question may become: why is Java not using it because lack of OAEP means you could leak information for each message encrypted.
accepted answer of: http://stackoverflow.com/q/27596300
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27596300
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43617307

http://stackoverflow.com/comment/43394362
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27480691
type: Comment
has text: Putting something inside WebContent folder automatically serves as resource

http://stackoverflow.com/a/27500292
has comment: http://stackoverflow.com/comment/43431872
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43431940
has comment: http://stackoverflow.com/comment/43432677
has comment: http://stackoverflow.com/comment/43432319
type: Answer
has body: Try with this Proxy regProxy = PowerMock.createNiceMock(Proxy.class); when you do EasyMock.createMock() in chained methods, it fails as Easymock does not recognize that this method is going to be called somewhere else, but when we do EasyMock.createNiceMock() the mocking does not fail on this unexpected method, and the mocking can be executed as we want. As a matter of fact I had myself toiled around this error for something like a week, and when I found this workaround, it was like a blessing. Hope this helps! Good luck!
has comment: http://stackoverflow.com/comment/43432628
upvote count: 3
has comment: http://stackoverflow.com/comment/43432661
has comment: http://stackoverflow.com/comment/43431924
has comment: http://stackoverflow.com/comment/43432348
score: 3
has comment: http://stackoverflow.com/comment/43434649
accepted answer of: http://stackoverflow.com/q/27487592
answers question: http://stackoverflow.com/q/27487592

sensors
type: Tag
tags question: http://stackoverflow.com/q/27502497
tag name: sensors
tags question: http://stackoverflow.com/q/27538097

http://stackoverflow.com/a/27499876
has body: I'm not sure whether I get your question right, but shouldn't the following work? int hours = (int)userInput; decimal minutestmp = ((userInput - hours) * 60); int minutes = (int)minutestmp; String TimeString = hours + ":" + minutes; Date date = new SimpleDateFormat("HH:mm").parse(TimeString); String newTimeString = new SimpleDateFormat("H:mm").format(date);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27499771

http://stackoverflow.com/q/27618200
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: reporting
has body: Am trying to generate a dynamic excel report using jXLS library. Below is the jXLS template I am using as input. |&lt;jx:forEach items="${headers1}" var="header"&gt; | ${header.headerText} | &lt;/jx:forEach&gt;| |&lt;jx:forEach items="${rows1}" var="rowItem"&gt; | | | |&lt;jx:forEach items="${rowItem.columns}" var="cell"&gt;| ${cell.value} |&lt;/jx:forEach&gt; | |&lt;/jx:forEach&gt; | | | With this, I am able to generate excel report with as many as columns returned by the query result set and values. But the problem I am facing is how to format the cells if the column is a date column. I cannot apply the format in jXLS template as its single cell representing all the cells in the report. Here is the definition of Cell.java public class Cell { public Cell(Object value) { super(); this.value = value; } private Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } How can I apply formatting to the cells dynamically?
tagged with: jxls
has answer: http://stackoverflow.com/a/50342201
type: UnansweredQuestion
upvote count: 1
tagged with: excel
has title: How to Format a dynamically generated cell
score: 1
tagged with: java

http://stackoverflow.com/comment/43535681
type: Comment
comment on: http://stackoverflow.com/a/27553777
type: AnswerComment
score: 0
has text: Can you provide the full onMapLongClick code (updated) please ? It sounds like the bitmap is not added with the right markerId

http://stackoverflow.com/a/27508785
answers question: http://stackoverflow.com/q/27508525
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: If you add listeners to your class, this class has to implement the listener interfaces in order to get the notifications: public class StateController extends GraphicsProgram implements MouseListener, KeyListener Or you do it on-the-fly: yourUiElement.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} public void keyPressed(KeyEvent e) { System.out.println(x); } });

http://stackoverflow.com/q/27497386
downvote count: 0
has comment: http://stackoverflow.com/comment/43433931
has body: I am trying to convert a double[] to float[] using Java 8 lambda calculus. So far, I just created a toy method which should be revised. Trying to find help for converting primitive arrays. Mostly, is there any approach to get rid of the guava conversion because converting to List and back are too heavy for large arrays. import com.google.common.primitives.Floats; public static float[] doubleToFloat(double[] vector) { Float[] f = Arrays.stream(vector).&lt;Float&gt;mapToObj(x -&gt; (float) x).toArray(Float[]::new); return Floats.toArray(Arrays.asList(f)); }
possible better answer: http://stackoverflow.com/a/27499947
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/27499947
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27498225
accepted answer: http://stackoverflow.com/a/27498225
tagged with: java
score: 10
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/26951431
has comment: http://stackoverflow.com/comment/43426290
has comment: http://stackoverflow.com/comment/43426813
upvote count: 10
has comment: http://stackoverflow.com/comment/43426613
favorite count: 0
has title: Lambda on primitive arrays

http://stackoverflow.com/comment/43676711
type: Comment
has text: How confusing; where do these `FileSystem` and `Path` class come from? They are not java.nio.file's
type: QuestionComment
comment on: http://stackoverflow.com/q/27627894
score: 0

http://stackoverflow.com/comment/43441718
comment on: http://stackoverflow.com/q/27505807
has text: Sorry that was my mistake, I forgot to add the last line.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43655813
score: 0
type: Comment
has text: As i am debugging and have realized that when i receive a message second time it is coming correct. But for the first time NUL is there for every new type of message.
comment on: http://stackoverflow.com/a/27616780
type: AnswerComment

http://stackoverflow.com/q/27564760
type: Question
tagged with: parameters
linked to: http://stackoverflow.com/q/2236599
has answer: http://stackoverflow.com/a/27564815
score: 1
tagged with: java
has body: I have read some source codes. In the package of util, I saw much usage of 'final' keyword. For instance, there is a method in PrefUtil.java: public static void setAttendeeAtVenue(final Context context, final boolean isAtVenue) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); sp.edit().putBoolean(PREF_ATTENDEE_AT_VENUE, isAtVenue).commit(); } In this method, all parameters are modified by 'final'. And I encountered a few cases like this somewhere else. But I didn't understand the effect of 'final'. So, I ask for help here to erase questions in my mind.
has title: What's the difference between final parameters and non-final ones in Java?
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27564807
has answer: http://stackoverflow.com/a/27564818
tagged with: final
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2236599

http://stackoverflow.com/a/27605688
has comment: http://stackoverflow.com/comment/43633656
answers question: http://stackoverflow.com/q/27605539
has comment: http://stackoverflow.com/comment/43633773
type: Answer
has comment: http://stackoverflow.com/comment/43633792
has comment: http://stackoverflow.com/comment/43633559
score: 0
has body: You haven't initialized the Request call back delegate and you are using it like: delegate.onGetMenuSuccess(listMenu); If you initialise it, that would resolve your issue.

http://stackoverflow.com/comment/43558261
type: Comment
type: QuestionComment
score: 1
has text: Consider using List<String> myList = new ArrayList<>(list); Not necessary you need to use clone for everything.
comment on: http://stackoverflow.com/q/27566606

http://stackoverflow.com/comment/43654963
type: Comment
comment on: http://stackoverflow.com/a/27616613
type: AnswerComment
has text: It would appear that my edit was ninja'd because I accidentally pressed enter instead of shift-enter and submitted the comment early :P
score: 0

http://stackoverflow.com/a/27523440
score: 2
has body: The standard tools don't produce DRL files. Instead they encourage you to have templates which are applied to your data at runtime. You should take a look at the documentation on Decision Tables (specially structured spreadsheets): http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html_single/#d0e4221 ... and Rule Templates: http://docs.jboss.org/drools/release/6.0.1.Final/drools-docs/html_single/#d0e4969
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43477898
downvote count: 0
answers question: http://stackoverflow.com/q/27522711

http://stackoverflow.com/comment/43397461
type: Comment
has text: Java tor libraries allow you to do that. For instance: http://sourceforge.net/projects/silvertunnel/
comment on: http://stackoverflow.com/a/27481718
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43520810
score: 1
has text: If you want to be better than ArrayList, you are going to have to develop your own structure and work hard. JVM structures are well optimized, my friend.
type: QuestionComment
comment on: http://stackoverflow.com/q/27547151
type: Comment

http://stackoverflow.com/q/27579517
accepted answer: http://stackoverflow.com/a/27579630
has answer: http://stackoverflow.com/a/27579707
has answer: http://stackoverflow.com/a/27579630
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27579913
tagged with: java
type: Question
has body: My pgrm returns news from a webpage in string format. I want to split the string each time when it sees a date format as dd-mm-yyyy. Is it possible to split each time it sees a date??? Pattern patern=Pattern.compile("-"); Matcher matcher = pattern.matcher(s); while (matcher.find()) { System.out.println(matcher.group(1)); } My data format is like this String s="Meow looks like cocaine, is 20 times cheaper, more dangerous, and not illegal; with children as young as 14 addicted to it, CM Devendra Fadnavis has asked the Centre to ban it under the Narcotics Act 18-Dec-2014l The girl was allegedly raped by a school supervisor last week; an activist wrote to the DCP following which the police approached and convinced the survivor’s family to register the offence 18-Dec-2014 Former principal of a Mumbai school has written to education minister against reinstatement of a teacher, accused of sexually harassing nearly 40 Std X students, who is now out on bail 19-Dec-2014"
possible better answer: http://stackoverflow.com/a/27579707
has title: Break line while seeing a date format
score: 0
answer count: 3
tagged with: regex

http://stackoverflow.com/comment/70061165
type: Comment
comment on: http://stackoverflow.com/a/27558698
has text: how does threads are handled using .parallelStream() ? Does it use any internal thread-pool ?
type: AnswerComment
score: 4

http://stackoverflow.com/q/27481609
has body: I want to create a ListView where each row would have two buttons. Button1 and Button2. I have read few tutorials on how to create CustomAdapter or extend BaseAdapter, but none of them worked in my case, that is why I'm opening a new question here. I have a static (not changing) String Array in my strings.xml: Item1 Item2 I want to use this Array in my ListView ( I manage to create a normal ListView with onClick event, but now I want to add buttons to each row ) and add two buttons to each row where each will have their own onClick event. I have followed steps from this answers here and few other tutorials on web, but I always get NullPointerException when trying to setText. CustomAdapter.java: public class CustomAdapter extends BaseAdapter implements ListAdapter { private ArrayList<String> list = new ArrayList<>(); private Context ctx; public CustomAdapter(ArrayList<String> list, Context ctx){ this.list = list; this.ctx = ctx; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { Log.d("TAG", list.get(position)); return list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if(view == null){ LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.layout_listview,null); } Log.d("TAG", list.get(position)); TextView listItemText = (TextView) view.findViewById(R.id.list_item_string); listItemText.setText(list.get(position)); Button localData = (Button) view.findViewById(R.id.button1); Button onlineData = (Button) view.findViewById(R.id.button2); localData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); onlineData.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); return view; } } And here I use the adapter in my Fragme…
upvote count: 6
has title: ListView with Buttons and static String Array
answer count: 4
has comment: http://stackoverflow.com/comment/43396625
has comment: http://stackoverflow.com/comment/43396018
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27481830
accepted answer: http://stackoverflow.com/a/27482109
score: 6
has comment: http://stackoverflow.com/comment/43396242
has answer: http://stackoverflow.com/a/27481891
type: Question
has comment: http://stackoverflow.com/comment/43396476
tagged with: java
linked to: http://stackoverflow.com/q/17525886
tagged with: listview
has comment: http://stackoverflow.com/comment/43396733
has comment: http://stackoverflow.com/comment/43396799
has comment: http://stackoverflow.com/comment/43396178
downvote count: 0
has answer: http://stackoverflow.com/a/27482109
favorite count: 0
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/27481945
has answer: http://stackoverflow.com/a/27481830

http://stackoverflow.com/a/27616741
downvote count: 0
has body: non-static classes can lead to unintended references to outer classes. In your case you could pass in a reference to an outer class which would make it clearer as to what you are doing but also make your code more complex. There is no wrong or right, I suggest you do what you believe will be less error prone. I have to make doSomething be static and also field1 and field2 be static. I wouldm't do that. Instead you can pass the instance of MyFragment to the constructor to CertainListenerImpl and store this as field, which is what Java does for you. BTW: This internal field is called this$0 for the Oracle/OpenJDK, and if you create a field with this name it will call it this$$0 or with more $$$$ What you have now is equivalent to private static class CertainListenerImpl implements CertainListener { private final MyFragment this$0; // rename to taste CertainListenerImpl(MyFragment myFragment) { this$0 = myFragment; } @Override private void onCertainEventsOccurrence() { this$0.doSomething(); } }
answers question: http://stackoverflow.com/q/27616696
has comment: http://stackoverflow.com/comment/43654912
has comment: http://stackoverflow.com/comment/43655023
type: Answer
has comment: http://stackoverflow.com/comment/43654784
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43655322
has comment: http://stackoverflow.com/comment/43654926
has comment: http://stackoverflow.com/comment/43655289
accepted answer of: http://stackoverflow.com/q/27616696
has comment: http://stackoverflow.com/comment/43654898
type: AcceptedAnswer

http://stackoverflow.com/a/27614227
accepted answer of: http://stackoverflow.com/q/27614140
answers question: http://stackoverflow.com/q/27614140
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43650752
type: Answer
has body: You can think of it as the HttpSession on a web application. What you save on HttpSession is available across different requests to the web server. Likewise what you store as class variables in a session EJB is available across different method invocations done on the same session EJB. Refer: Lookup returns new instance of Stateful session bean http://www.javaworld.com/article/2071724/java-web-development/ejb-fundamentals-and-session-beans.html
has comment: http://stackoverflow.com/comment/43650528

http://stackoverflow.com/comment/43402846
type: Comment
type: QuestionComment
has text: @Biffen True. I stand corrected.
score: 0
comment on: http://stackoverflow.com/q/27484941

http://stackoverflow.com/comment/43438892
type: Comment
comment on: http://stackoverflow.com/q/27504360
score: 0
type: QuestionComment
has text: @Price-2-3 years ago I also tried the same foolish thing! So similar---ha ha ha. But,it doesn't work that way!

http://stackoverflow.com/a/27475092
accepted answer of: http://stackoverflow.com/q/27475034
has comment: http://stackoverflow.com/comment/43384989
type: Answer
answers question: http://stackoverflow.com/q/27475034
downvote count: 0
has comment: http://stackoverflow.com/comment/43392687
score: 3
type: AcceptedAnswer
has body: You will get a ConcurrentModificationException if you remove elements from a list while you are iterating over the list, as you are doing in your example above. To avoid this, you should use an explicit iterator instead of the enhanced for loop, and call remove() on the iterator instead of on the list when you find the element that must be removed: for (Iterator&lt;String&gt; i = list.iterator(); i.hasNext(); ) { String st = i.next(); if (st.equalsIgnoreCase("str3")) { // Remove the element that the iterator is currently pointing to i.remove(); } } Just wrapping the list with Collections.synchronizedList(...) does not make it so that you can have multiple threads iterating over the list at the same time, where one of them is removing elements from the list. You will still get a ConcurrentModificationException when you do this. Wrapping the list with Collections.synchronizedList(...) will make the individual methods on the list synchronized, but there is no synchronization over multiple methods. You must make sure that if one thread is removing elements from the list, no other threads are iterating over the list, by properly synchronizing your own methods that iterate and remove elements.
upvote count: 3

http://stackoverflow.com/comment/43696613
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27638831
has text: Yes, but on development server, not on live one. Instead log the errors and warnings in daily log files.
score: 0

http://stackoverflow.com/q/27503174
tagged with: fasterxml
tagged with: jackson
duplicate of: http://stackoverflow.com/q/38124704
has title: JsonFormat annotation to parse two date type
has comment: http://stackoverflow.com/comment/43469341
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43467964
favorite count: 0
linked to: http://stackoverflow.com/q/5591967
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43478836
has comment: http://stackoverflow.com/comment/43480263
has comment: http://stackoverflow.com/comment/43476489
has comment: http://stackoverflow.com/comment/43477793
tagged with: spring
answer count: 0
has body: I have a problem, I want to parse to different type of date string to timestamp. I used @JsonFormat(shape=JsonFormat.Shape.STRING, pattern ="dd-MMM-yyyy HH:mm:ss.SSS z",timezone="IST") private Timestamp validUptoDate; and parsing is Ok when milisecond value is given after second, But if I provide "16-DEC-2014 15:20:30 IST" this type of date, getting below exception :: Failed to parse Date value '15-AUG-2019 19:30:00 IST' (format: "dd-MMM-yyyy HH:mm:ss.SSS z"): Unparseable date: "15-AUG-2019 19:30:00 IST" But If I provide "16-DEC-2014 15:20:30.000 IST" , then no issues. But I dont want to mention milisecond value if not present. I tried to provide two pattern value llike @JsonFormat(shape=JsonFormat.Shape.STRING, pattern ={"dd-MMM-yyyy HH:mm:ss z","dd-MMM-yyyy HH:mm:ss.SSS z"} ,timezone="IST") but compilation error happens. I tried using different combination, but no hope. Please help. Thanks a lot.
tagged with: java
tagged with: annotations
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/38124704
linked to: http://stackoverflow.com/q/7161638
has comment: http://stackoverflow.com/comment/43441922

http://stackoverflow.com/q/27564527
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43554761
has comment: http://stackoverflow.com/comment/43554463
upvote count: 1
has comment: http://stackoverflow.com/comment/43554641
tagged with: java
has body: My objective is to retrieve data from the database using SQL command then use the data retrieved from the cell as an argument for a method and save the result of the function in the database. for example: id column1 column2 result 1 5 9 -- 2 22 40 -- what i want is a command to retrieve the data from column1 and column2 with SQL query then use them as arguments for the a method ( example: minus(column2,column1) //which calculâtes the difference between the data of the 2 columns) then save the result in the column called result. And then do this for all the columns of the database.
has title: retrieve data from the database, use the data as an argument for a java method
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/43556719
has answer: http://stackoverflow.com/a/27564772
has comment: http://stackoverflow.com/comment/43554598
has comment: http://stackoverflow.com/comment/43554509
downvote count: 0
has comment: http://stackoverflow.com/comment/43554579
tagged with: sql
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/43554318

http://stackoverflow.com/comment/137022856
type: Comment
comment on: http://stackoverflow.com/a/77166044
score: 0
type: AnswerComment
has text: Specifying the java plugin here is redundant, see: https://docs.gradle.org/current/userguide/application_plugin.html

http://stackoverflow.com/a/27551227
has comment: http://stackoverflow.com/comment/43566183
type: Answer
answers question: http://stackoverflow.com/q/27550821
downvote count: 0
score: 1
upvote count: 1
has body: The XML output of your class is: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> x xx <c>true</c> If you want the boolean value to result in <c value="true" /> then you need a wrapper element around the boolean c field. This can be of type Boolean or some other custom type with the boolean c inside of it, and marked with @XmlAttribute. Example: class MyBool { @XmlAttribute(name="value") private boolean c = true; } @XmlAccessorType(XmlAccessType.NONE) class MyClass { @XmlElement private String a = "x"; @XmlElement private String b = "xx"; @XmlElement private MyBool c = new MyBool(); } Output: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> x xx <c value="true"/> Note: If you don't want to use a wrapper, you can still annotate boolean c with @XmlAttribute like this: @XmlAttribute(name="value") private boolean c = true; But then it will be rendered as an attribute of the wrapper class which in this case is MyClass, so the output will be: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> x xx

http://stackoverflow.com/comment/43465770
type: Comment
has text: True -- and that `Set` doesn't support addition, so I'm okay with that. From the spec: "The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations."
comment on: http://stackoverflow.com/a/27491199
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43450363
type: Comment
has text: I finally solved it.... i was supposed to add .jpg to the name value of the image at this line of code .addFormDataPart("filename", "name.jpg", RequestBody
comment on: http://stackoverflow.com/q/27488538
score: 1
type: QuestionComment

http://stackoverflow.com/q/27561920
type: Question
has comment: http://stackoverflow.com/comment/43550063
has answer: http://stackoverflow.com/a/27563729
score: 0
accepted answer: http://stackoverflow.com/a/27563729
answer count: 1
tagged with: spring-security
tagged with: spring
has title: Set Cookie before Spring Security Filter Chain
type: AnsweredQuestion
tagged with: java
has body: I would like to set a referrer cookie as I need to exclude some pages (e.g. error, login, logout, ...) to be able to redirect to the last called but not excluded page after login: public class CookieReferrerFilter extends OncePerRequestFilter { public static final String REFERRER_COOKIE_NAME = "REFERRER"; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { if (!isReferrerExcluded(request)) { Cookie sessionCookie = new Cookie(REFERRER_COOKIE_NAME, request.getRequestURI()); sessionCookie.setPath(!"".equals(request.getContextPath()) ? request.getContextPath() : "/"); sessionCookie.setSecure(false); sessionCookie.setMaxAge(-1); response.addCookie(sessionCookie); } filterChain.doFilter(request, response); } private boolean isReferrerExcluded(HttpServletRequest request) { for (String pattern : EXCLUDED_REFERRER) { if (new AntPathRequestMatcher(pattern).matches(request)) { return true; } } return false; } } But Spring Security Filter Chain getting triggered before CookieReferrerFilter. So calling a secured page will redirect me immediately to the login page without calling CookieReferrerFilter.doFilterInternal before and no cookie is set. There's a class configuring the webbapp (setting config classes, mappings, filters) which extends AbstractAnnotationConfigDispatcherServletInitializer: public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[] { ApplicationContextConfig.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return null; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } @Override protected Filter[] getServletFilters() { CookieReferrerFilter cookieReferrerFilter = new CookieReferrerFilter(); CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(); charac…

http://stackoverflow.com/comment/43387781
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27476845
has text: You can have a zero-length array -- contains no elements. You can have a null array reference -- the reference is null, meaning that no array actually exists. You can have an array with elements that are all set to null -- this is the default for an array of references when it's initially created.
score: 1

http://stackoverflow.com/comment/43687956
type: QuestionComment
has text: Wrap the logic in the ListSelectionListener in SwingUtilities.invokeLater()
score: 1
comment on: http://stackoverflow.com/q/27634161
type: Comment

http://stackoverflow.com/q/27628110
answer count: 1
accepted answer: http://stackoverflow.com/a/27628307
has title: Drawing a tilemap slows down my thread in java
has body: I have this very weird problem that when I draw my tilemap the thread slows down by a big margin. Here is tile map code: public class TileMap { Tile[][] map; int x = 30, y = 0; public TileMap(String map) { String sCurrentLine; try { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/" + map))); while (true) { /** Starts reading the buffered line **/ String line = bufferedReader.readLine(); /** Closes the loop if there is no line to read **/ if (line == null) { bufferedReader.close(); break; } /** Adds a line to the list if it is not commented **/ if (!line.startsWith("#")) { list.add(line); } } readClass(list); } catch (IOException e) { e.printStackTrace(); } } public void readClass(List&lt;String&gt; stringList){ int x = 0; int y = 0; map = new Tile[stringList.get(0).length()][stringList.size()]; for(String s : stringList){ int i = 0; while (i &lt; s.length()){ char c = s.charAt(i); // if(c == 'A'){ map[x][y] = new Tile(); // } i++; x++; } x = 0; y++; } } public void draw(Graphics g){ for (int x = 0; x &lt; map.length; x++) { for (int y = 0; y &lt; map[0].length; y++) { g.drawImage(map[x][y].getImage(), (x * 20), (y * 20), null); } } } } Now here is my code for the main class which basic checks the method that draws my character and draws the tilemap before the character (Note: When I change the wait speed when the tilemap is slowing the game down, nothing happens): public class GamePane extends JPanel implements Runnable { public static GameStateHandler gameStateHandler = new GameStateHandler(); private static final long serialVersionUID = 1L; public static int WIDTH, HEIGHT; public static boolean running; Graphics graphics; Thread thread; public GamePane(Graphics g) { thread = new Thread(this); this.graphics = g; init(); thread.start(); setFocusable(true); requestFocusInWindow(); addKeyListener(new GameKeyListener(this)); } public void init() { WIDTH = …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27628307
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/43707506
has text: So iterate through and print each. That's how it's supposed to be done, unless I've forgotten about something. Maybe there's a utility function in the `Arrays` class that does that; I should really check. It might be useful.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27633166

http://stackoverflow.com/q/27485390
tagged with: etl
type: Question
has title: Configuring a spring-batch without using any XML
tagged with: spring-batch
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: Disclaimer: I am a noob in Spring. What I am asking may be very "odd" as I don't even know what I don't know. I am trying to create a batch data movement/manipulation tool (may I say a ETL tool) using Java. Someone suggested me to check out spring-batch which I really liked as it has many libraries for data reading/writing and processing. But my trouble is- my data sources (flatfile or table) are not fixed. There is a fronted where user will select which flatfile or database table(s) they want to load and the program will automatically load that. This means, usual things like: Source / target entity structures source or target database URL/DSN Job parameters etc. are not pre-determined in my case. They are determined in runtime. But, so far, whatever spring-batch examples I have seen - they have configured these information in XML. I can't do that as that will make these information static. My Question is - If I do not want to use Spring Container (and all its XML based bean configuration) but still want to use spring-batch to take advantage of it's batch processing libraries, will that be possible/viable?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27487030
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/43596605
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27586047
has text: Yes. Java was made so you get favored by the classes. If you want to work on such low level as 4th dimensional primitive arrays you can always go for C
type: AnswerComment

http://stackoverflow.com/comment/43640998
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27609013
has text: If your AVD is slow, you might wanna use Genymotion or install (if you're running an intel-powered CPU) Intel HAXM. Read here concerning the second option : https://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture If you don't have an Intel-base computer, I'd suggest you check Genymotion.

http://stackoverflow.com/comment/43698800
type: AnswerComment
score: 0
type: Comment
has text: In that case im only printing second column, im not printing the contents of other column of the row. I just wanted to ignore the content from first column.
comment on: http://stackoverflow.com/a/27638793

http://stackoverflow.com/a/27497573
has comment: http://stackoverflow.com/comment/43426659
has comment: http://stackoverflow.com/comment/43426738
has comment: http://stackoverflow.com/comment/43426851
has comment: http://stackoverflow.com/comment/43426634
has comment: http://stackoverflow.com/comment/43426916
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27497441
has comment: http://stackoverflow.com/comment/43426817
has comment: http://stackoverflow.com/comment/43426761
has body: public class TestComparator implements Comparator&lt;String&gt; { List&lt;String&gt; order; public TestComparator(String[] desiredOrder) { order = Arrays.asList(desiredOrder); } public static void main(String args[]) throws InterruptedException { String[] desiredOrder = {"Pizza","Salad","Cold Cereal"}; TreeMap&lt;String, List&lt;String&gt;&gt; treeMap = new TreeMap&lt;String, List&lt;String&gt;&gt;(new TestComparator(desiredOrder)); //add into Map } @Override public int compare(String o1, String o2) { Integer index1 =order.indexOf(o1); Integer index2 =order.indexOf(o2); return index1.compareTo(index2); } }

http://stackoverflow.com/a/27529892
has comment: http://stackoverflow.com/comment/43488691
has body: Coalesce is supported by JPA 2.0 API. The new construct is proprietary to Hibernate, not necessarily supported in all JPA implementations. First try the query without also trying to construct an object: select COALESCE(k.projectId,'N') as projectId, k.projectName from Emp o inner join o.projects k
upvote count: 14
score: 14
answers question: http://stackoverflow.com/q/27528976
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43572346
score: 0
type: Comment
has text: @NEPat10 Different OS's don't use `C:/` and this will work on **every platform** that Java supports.
comment on: http://stackoverflow.com/a/27573354
type: AnswerComment

http://stackoverflow.com/q/27547908
has comment: http://stackoverflow.com/comment/43521958
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/43522026
has comment: http://stackoverflow.com/comment/43522058
has body: I have a problem. public class Deck { //deck contents returns every card in the deck String[] suits = {"Clubs", "Hearts", "Diamonds", "Spades"}; String[] ranks = {"Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace"}; int[] values = {2,3,4,5,6,7,8,9,10,10,10,10,11}; ArrayList&lt;Card&gt; deck = new ArrayList&lt;Card&gt;(); ArrayList&lt;Card&gt; cardsDealt = new ArrayList&lt;Card&gt;(); //unused here Random rand = new Random(); //unused here public Deck(){ for(int i = 0; i &lt; suits.length; i++){ for(int k = 0; i &lt; ranks.length; k++){ deck.add(new Card(suits[i], ranks[k], values[k])); } } } I get an IndexOutOfBoundsException Error. My task is to create a Deck object which will then add 52 Card Objects into an ArrayList called deck. I wrote the for loops to create each of the possible 52 cards in a card deck. What is the error?
has comment: http://stackoverflow.com/comment/43521984
has title: ArrayIndexOutOfBounds Error
type: Question
accepted answer: http://stackoverflow.com/a/27547988
has comment: http://stackoverflow.com/comment/43521979
tagged with: java
tagged with: indexoutofboundsexception
answer count: 2
possible better answer: http://stackoverflow.com/a/27548058
downvote count: 0
has answer: http://stackoverflow.com/a/27548058
has comment: http://stackoverflow.com/comment/43522056
has comment: http://stackoverflow.com/comment/43521999
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/27547988
has comment: http://stackoverflow.com/comment/43522043

http://stackoverflow.com/comment/43592629
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27584038
has text: Of course it won't work. All it does is change the object referenced by a variable, jp, and nothing else. -1. Changing a variable is not the same as changing the state of an object, which is what you need to do. Yes jp was added to the GUI, but changing the object jp refers to **after** the original jp object was added does nothing to the GUI whatsoever.
score: 0

http://stackoverflow.com/comment/43423512
comment on: http://stackoverflow.com/a/27489718
type: AnswerComment
has text: You'd be sharing the one connection among all requests.
score: 1
type: Comment

http://stackoverflow.com/a/27509765
has comment: http://stackoverflow.com/comment/43451085
downvote count: 0
has comment: http://stackoverflow.com/comment/43450890
type: Answer
has body: As long as the serialized classes don't change its definition, there won't be any problem. You may even move these serialized files into another OS which deserializes to the same classes definition and it will work with no problem (unless you use libraries specific to an OS, thus breaking portability).
upvote count: 1
has comment: http://stackoverflow.com/comment/43451171
answers question: http://stackoverflow.com/q/27509682
score: 1

http://stackoverflow.com/q/27564988
answer count: 2
tagged with: selenium
upvote count: 1
tagged with: webdriver
possible better answer: http://stackoverflow.com/a/27565382
has comment: http://stackoverflow.com/comment/43559833
has body: I have HTML code like : test1 test2 test3 test2 I'm using Selenium Webdriver. And I need to create Java code which could: If test3 then select a which located inside the same div class="ex2" But since I have div's and spans with the same className inside one main I can't differ this spans.. Could you help me please with this issue? So,something like this: If test3 then test2. or If test1 then test2. Thanks
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27565052
score: 1
favorite count: 0
type: Question
has title: Selenium Webdriver (Java) - selecting specific element depending on the condition
accepted answer: http://stackoverflow.com/a/27565052
has answer: http://stackoverflow.com/a/27565382
tagged with: java

http://stackoverflow.com/a/27583267
has body: The code String phoneNumber; declares a new variable reference which is different from your global variable. Also the scope of this local variable phoneNumber exists only till the function and could be used only from within the function. Thus the reference specified by your global var was never actually modified when you tried to change the value. The simple fix for this is to refer the global variable by either this.phoneNumber or simply removing the new variable declaration.
type: Answer
answers question: http://stackoverflow.com/q/27583192
score: 0

http://stackoverflow.com/q/27607619
tagged with: macos
has answer: http://stackoverflow.com/a/36957341
has title: Custom built Java Mac app won't run when in /Applications folder
has comment: http://stackoverflow.com/comment/43637457
tagged with: java
type: Question
score: 0
has body: I have a Java-based application that I've developed for a while now. When I create a Mac .app bundle, I do so by copying the following contents into the .app folder: https://github.com/bobbylight/RText/tree/master/mac When I build the .app, I notice the following: The application runs when I copy the .app onto my desktop, and double-click it. The application runs when I drag the .app directly to my task bar and click it. The application does not run when I copy the .app into my /Applications folder. I see a "do not enter" icon drawn over the app's actual icon, and trying to start it yields the error: "You can't open the application "RText" because it is not supported on this type of Mac." The application does run from the /Applications folder if I run it from the command line: cd /Applications open -a RText.app I do have the Java for OS X 2014-001 package installed for Java 6 support. I believe my Info.plist requires Java 6. Unfortunately I'm not sure how to debug this problem. Any pointers would be appreciated. I'm on OS X 10.10.1. Here's the list of JVMs on my system: $ /usr/libexec/java_home -V Matching Java Virtual Machines (4): 1.8.0_25, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home 1.7.0_09, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home 1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 1.6.0_65-b14-466.1, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home $ env | grep -i java JAVA_HOME=/Library/Java/Home $ which java /usr/bin/java $ java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
answer count: 2
has answer: http://stackoverflow.com/a/27614239
has comment: http://stackoverflow.com/comment/43650442
type: UnansweredQuestion

http://stackoverflow.com/q/27519301
accepted answer: http://stackoverflow.com/a/27519330
type: Question
tagged with: java.util.concurrent
answer count: 2
possible better answer: http://stackoverflow.com/a/27519426
downvote count: 0
has answer: http://stackoverflow.com/a/27519426
tagged with: executorservice
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27519330
score: 1
tagged with: java
has title: Java ExecutorService and Synchronization
has body: I am trying to understand the ExecutorService and how it will avoid the usage of synchronized keyword. I tried something like this below (avoiding imports to for clarity) which gave wrong results: public class ReadWebPage { public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(5); FinTrans ft = new FinTrans (); TransThread tt1 = new TransThread (ft, "Deposit Thread"); TransThread tt2 = new TransThread (ft, "Withdrawal Thread"); executor.submit(tt2); executor.submit(tt1); executor.shutdown(); } } class FinTrans { public static String transName; public static double amount; } class TransThread implements Runnable { private FinTrans ft; private String name; TransThread (FinTrans ft, String name) { this.name = name; this.ft = ft; } public String getName(){ return name; } public void run () { for (int i = 0 ; i &lt; 10 ; i++ ) { if (getName ().equals ("Deposit Thread")) { ft.transName = "Deposit"; try { Thread.sleep ((int) (Math.random () * 100)); } catch (InterruptedException e) { } ft.amount = 2000.0; System.out.println (ft.transName + " " + ft.amount); } else { ft.transName = "Withdrawal"; try { Thread.sleep ((int) (Math.random () * 10)); } catch (InterruptedException e) { } ft.amount = 250.0; System.out.println (ft.transName + " " + ft.amount); } } } } Which gave me the wrong result: Deposit 250.0 //wrong Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 250.0 Withdrawal 2000.0 //wrong Deposit 250.0 //wrong Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Deposit 2000.0 Could you please explain what is going wrong here? 1. Is it because both the Runnables share the same FinTrans object? 2. Does this mean we need same old synchronize mechanism here too? I am trying to understand at what situation we can use the ServiceExecutors Anand
upvote count: 1

http://stackoverflow.com/comment/43674393
type: AnswerComment
comment on: http://stackoverflow.com/a/27626852
score: 0
has text: See my answer. There's no problem to declare the same variable over and over inside a loop. Just get rid of the `[i]` array operator and your fine.
type: Comment

http://stackoverflow.com/comment/43508998
has text: please try to do something first.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27540706
score: 3

http://stackoverflow.com/comment/43620822
comment on: http://stackoverflow.com/q/27591313
has text: The question is indeed unclear. For insance "If `String2` is having only 5 or 10 characters, the remaining 85 or 80 characters should be spaces." Why? The concept of spaces in PDF is special. In PDF, text is added at absolute positions. Spaces may not be necessary. Also: why don't you just check `string1.length() + string2.length()`? Why is this a PDF question? This question should be rephrased.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/27590753
has body: I have java code were the methods are all private and called via reflection. Any IDE i use throws unused method warning. I don't want any warnings in my code. Is there any suppression warnings for the methods that are called via reflection?
tagged with: java
type: Question
has title: Suppression warnings for methods called via reflection
has answer: http://stackoverflow.com/a/27590767
has comment: http://stackoverflow.com/comment/43605386
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43605627
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27590801
has comment: http://stackoverflow.com/comment/43605328

http://stackoverflow.com/a/27611057
has comment: http://stackoverflow.com/comment/43644519
type: Answer
score: 8
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27611026
answers question: http://stackoverflow.com/q/27611026
has body: You should use an AtomicInteger. I would however consider AtomicInteger as a fairly low level primitive. I would question the design. Have you considered using ExecutorService, Callable, Futures, Semaphore, CountDownLatch, the Fork/Join framework or other classes from the high level java.util.concurrent API?
has comment: http://stackoverflow.com/comment/43646642
upvote count: 8
type: AcceptedAnswer

http://stackoverflow.com/q/27622499
score: 0
has comment: http://stackoverflow.com/comment/43666514
has comment: http://stackoverflow.com/comment/43689895
has comment: http://stackoverflow.com/comment/43670154
accepted answer: http://stackoverflow.com/a/27622696
has comment: http://stackoverflow.com/comment/43672472
has comment: http://stackoverflow.com/comment/43673333
has comment: http://stackoverflow.com/comment/43665720
has comment: http://stackoverflow.com/comment/43666231
has comment: http://stackoverflow.com/comment/43665606
has comment: http://stackoverflow.com/comment/43666680
tagged with: swing
has answer: http://stackoverflow.com/a/27622696
has comment: http://stackoverflow.com/comment/43665612
has comment: http://stackoverflow.com/comment/43665563
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43665692
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43673290
has comment: http://stackoverflow.com/comment/43673361
type: Question
has comment: http://stackoverflow.com/comment/43673223
has comment: http://stackoverflow.com/comment/43665809
has comment: http://stackoverflow.com/comment/43667075
answer count: 1
has body: I have a problem regarding the conversion of json to csv - especially a memory problem (at least I think it is one). I wrote some functions which should handle this case and it works great - for small json-files. For large json-files the JFrame gets stucked and it happens nothing for minutes (I killed the process with the task manager after ~5min). The source json-file has about 30.000 lines. What I'm up to: Reading the (large) json-file Correct it (some values are not json-typical, i.e. "actor" : "ObjectId("12345") etc. should be corrected to "actor" : "12345" split the large json file into smaller ones. process with the small json-files. What I have so far: public void mongoExportAndSplitFilter() { ReadFileAndSave reader = new ReadFileAndSave(); String jsonFilePath = this.converterView.sourceTextField.getText(); //String targetFilePath = this.converterView.targetTextField.getText(); File jsonFile = new File(jsonFilePath); Scanner scanner = new Scanner(reader.readFileAndCorrectOutput(jsonFile)); int j = 0; StringBuffer sb = new StringBuffer(); reader.readPartOfFileAndSave("src/main/resources", scanner, j, sb); //System.out.println("STEP 1: INPUT FILE (" + jsonFilePath + ") HAS BEEN CORRECTED!"); //System.out.println("STEP 2: INPUT FILE (" + jsonFilePath + ") HAS BEEN SPLITTED WHILE PARSING!"); this.filterView.setVisible(false); this.filterView.dispose(); this.filterFlag = 1; } /** * Utility function to correct the MongoExport-JSON-Output. * * @param file The file which should be corrected. * @return Returns the correct JSON-String. */ public String readFileAndCorrectOutput(File file) { String jsonStringCorrected = ""; StringBuffer sb = new StringBuffer(); try { Scanner scanner = new Scanner(file); while (scanner.hasNext()) { String next = scanner.next(); if (next.contains("ObjectId") || next.contains("ISODate")) { Matcher m = Pattern.compile(this.regEx) .matcher(next); if (m.find()) { next = next.replaceAll(this.regEx, this.innerString); } } //jsonStringCorrected +…
has title: Parsing large json files

http://stackoverflow.com/q/27637559
accepted answer: http://stackoverflow.com/a/27637796
tagged with: java
tagged with: tic-tac-toe
type: Question
has comment: http://stackoverflow.com/comment/43694059
has answer: http://stackoverflow.com/a/27637796
score: -2
has body: I am trying to implement the Minimax algorithm for Tic Tac Toe, and just can't seem to get it run correctly. I have tried re-writing it several times, but it is not giving correct output. Here is the code for MinimaxGame.java, that implements the game- public class MinimaxGame { public MinimaxResult play(MinimaxBoard board) { ArrayList&lt;Position&gt; possibleMoves = board.getAllPossibleMoves(); MinimaxBoard bestChild = null; int bestScore= Integer.MIN_VALUE; for (Position position : possibleMoves) { MinimaxBoard child = new MinimaxBoard((MinimaxBoard)board.clone(), position, 'O'); int moveScore = max(child); if (moveScore &gt; bestScore) { bestChild = child; bestScore = moveScore; } } MinimaxResult result = new MinimaxResult(bestChild, bestScore); return result; } private int max(MinimaxBoard child) { ArrayList&lt;Position&gt; possibleMoves = child.getAllPossibleMoves(); if (possibleMoves.isEmpty()) { int score = evaluateScore(child); return score; } int bestScore = Integer.MIN_VALUE; for (Position position : possibleMoves) { MinimaxBoard currentChild = new MinimaxBoard((MinimaxBoard)child.clone(), position, 'X'); int moveScore = min(currentChild); if (moveScore &gt; bestScore ) { bestScore = moveScore; } } return bestScore; } private int min(MinimaxBoard child) { ArrayList&lt;Position&gt; possibleMoves = child.getAllPossibleMoves(); if (possibleMoves.isEmpty()) { int score = evaluateScore(child); return score; } int bestScore = Integer.MAX_VALUE; for (Position position : possibleMoves) { MinimaxBoard currentChild = new MinimaxBoard((MinimaxBoard)child.clone(), position, 'O'); int moveScore = max(currentChild); if (moveScore &lt; bestScore ) { bestScore = moveScore; } } return bestScore; } private boolean hasWon(MinimaxBoard board, char player) { boolean status = false; char [][] boardArray = board.boardArray; // Check rows for (int i = 0; i &lt; 3; i++) { status |= (boardArray[i][0] == player) &amp;&amp; (boardArray[i][1] == player) &amp;&amp; (boardArray[i][2] ==…
has comment: http://stackoverflow.com/comment/43744661
tagged with: minimax
downvote count: 2
has comment: http://stackoverflow.com/comment/43694157
answer count: 1
favorite count: 0
has title: Minimax Algorithm behaving unexpectedly
has comment: http://stackoverflow.com/comment/43744668
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/43669614
has text: @Daniel I was just thinking that too. If you're allowed only one line of code after the `if`, declaring a variable wouldn't make sense.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27624402
score: 3

http://stackoverflow.com/comment/43495360
comment on: http://stackoverflow.com/a/27533410
has text: Sorry my bad, used . instead of ,
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43443662
score: 0
comment on: http://stackoverflow.com/a/27506277
type: Comment
has text: Easiest type of mistake to make. I've made that and similar mistakes dozens if not hundreds of times.
type: AnswerComment

http://stackoverflow.com/q/27619385
accepted answer: http://stackoverflow.com/a/27619464
downvote count: 0
has title: Specifying more than one class modifier
favorite count: 0
has comment: http://stackoverflow.com/comment/43659819
has answer: http://stackoverflow.com/a/27619441
type: AnsweredQuestion
has body: In section 8.1.1 Class Modifiers of the Java Language Specification 8, it states that: ClassModifier: one of &nbsp;&nbsp;&nbsp;&nbsp;Annotation public protected private abstract static final strictfp But I managed to compile the following: public strictfp A{} That is, it states that one of the class modifiers should be chosen but I was able to choose more than one. Am I misinterpreting the specification here?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43659752
upvote count: 1
possible better answer: http://stackoverflow.com/a/27619441
type: Question
has comment: http://stackoverflow.com/comment/43660014
has answer: http://stackoverflow.com/a/27619464
has comment: http://stackoverflow.com/comment/43659793
has comment: http://stackoverflow.com/comment/43659720
answer count: 2

http://stackoverflow.com/q/27502102
has body: May i know why my hashtable number is not in order? after reach certain number. Please, really need help from expert. Any helps would be appreciated. Thanks alot!! Code in jsp file. &lt;% Vector vRow2 = new Vector(); Vector vFruit = new Vector(); Hashtable htItem = new Hashtable(); vRow2.addElement("apple"); vRow2.addElement("banana"); vFruit.addElement(vRow2); htItem.put("1", vFruit); htItem.put("2", vFruit); htItem.put("3", vFruit); htItem.put("4", vFruit); htItem.put("5", vFruit); htItem.put("6", vFruit); // if htItem put only up to 6 it show correct order result 6,5,4,3,2,1 htItem.put("7", vFruit); // if htItem put up to 7 it show incorrect order result 6,5,4,3,2,1,7 htItem.put("8", vFruit); // if htItem put up to 8 it show result 6,5,4,3,2,1,8,7 htItem.put("9", vFruit); // if htItem put up to 9 it show correct order 9,8,7,6,5,4,3,2,1 htItem.put("10", vFruit); // if htItem put up to 10 it show incorrect order result 9,8,6,5,4,3,2,10,1 System.err.println("htItem==="+htItem); %&gt; output htItem==={9=apple, banana, 8=apple, banana, 7=apple, banana, 6=apple, banana, 5=apple, banana, 4=apple, banana, 3=apple, banana, 2=apple, banana, 10=apple, banana, 1=apple, banana} expected output : 10,9,8,7,6,5,4,3,2,1 how to make the number of list are in correct sequence every time htItem put new number.?
tagged with: java
downvote count: 3
type: Question
linked to: http://stackoverflow.com/q/1419708
has comment: http://stackoverflow.com/comment/43434593
has comment: http://stackoverflow.com/comment/43434557
has comment: http://stackoverflow.com/comment/43434636
linked to: http://stackoverflow.com/q/2748829
has comment: http://stackoverflow.com/comment/43434748
has answer: http://stackoverflow.com/a/27503663
duplicate of: http://stackoverflow.com/q/1419708
has comment: http://stackoverflow.com/comment/43434765
has answer: http://stackoverflow.com/a/27502198
upvote count: 0
has answer: http://stackoverflow.com/a/27502272
tagged with: jsp
has answer: http://stackoverflow.com/a/27502275
favorite count: 0
has comment: http://stackoverflow.com/comment/43434527
answer count: 5
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/27502292
tagged with: hashtable
has title: How to Sort a HashTable

http://stackoverflow.com/q/27526363
has body: Just wondering how I get the hostname, i.e. the result of running 'hostname' on the command prompt, of an AWS machine (RHEL) via the Java API. I can call the following com.amazonaws.services.ec2.model.Instance awsInstance = ... awsInstance.getPublicIpAddress()) awsInstance.getPrivateIpAddress()) awsInstance.getPrivateDnsName()) awsInstance.getPublicDnsName()) But cannot find out how to get the hostname - theres no getHostname() method.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43481306
has comment: http://stackoverflow.com/comment/43481485
score: 2
has comment: http://stackoverflow.com/comment/43481369
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27526517
downvote count: 0
tagged with: amazon-ec2
answer count: 1
tagged with: amazon-web-services
has title: Get hostname of AWS instance via Java API

http://stackoverflow.com/a/27567452
score: 4
type: Answer
answers question: http://stackoverflow.com/q/27567429
upvote count: 4
has body: Because mm is minutes (not month). I believe you wanted SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
downvote count: 0

http://stackoverflow.com/q/27565611
type: AnsweredQuestion
has body: I have found some blog where there is a suggestion of avoiding new keyword while creating object of a class. Some examples of creating object without the new keyword are- SampleObject obj = Class.forName("com.example.SampleObject").newInstance(); Or using clone() method - SampleObject obj1 = new SampleObject(); SampleObject obj2 = obj.clone(); Then here I have found some good examples of creating object without new keyword I can understand the advantages of 'Factory' pattern while avoiding new keyword from main portion of code. If I am not using any design pattern (for creating objects) is there any benefit of creating object without the new keyword? Or what are the reasons for creating of object without new?
tagged with: oop
linked to: http://stackoverflow.com/q/95419
tagged with: java
has comment: http://stackoverflow.com/comment/43556451
has answer: http://stackoverflow.com/a/27566395
has answer: http://stackoverflow.com/a/27566110
score: 5
has answer: http://stackoverflow.com/a/27565807
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/43556221
upvote count: 6
accepted answer: http://stackoverflow.com/a/27566110
possible better answer: http://stackoverflow.com/a/27565672
has answer: http://stackoverflow.com/a/27565672
tagged with: instance
tagged with: object-create
has title: Benefits of Avoiding 'new' Keword When Creating Object in Java
has answer: http://stackoverflow.com/a/27565653
downvote count: 1
type: Question
tagged with: instantiation

http://stackoverflow.com/comment/43575457
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27574713
type: AnswerComment
has text: You need the *instance* of `ResolveInfo`, which you have placed in the map. You get that through `getValue()` as shown. The way you had it, you'd iterate the map entries, but not do anything with them, and instead tried to access non-existing static fields on the class `ResolveInfo`.

http://stackoverflow.com/comment/43609605
comment on: http://stackoverflow.com/q/27592542
score: 0
type: QuestionComment
type: Comment
has text: @GabeSechan Hi Gabe thanks, but the point is not if the callbacks are called or not, but what happens to the `onClick` method in particular if the callbacks are not called before `onClick` finishes...

http://stackoverflow.com/a/27629669
accepted answer of: http://stackoverflow.com/q/27629498
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27629498
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/43679949
has body: Your code doesn't make sense. A file name that is read from a ZIP file doesn't necessarily represent a file that already exists on the disk, and neither does a File constructed from it. So testing isDirectory() on it is futile, and testing it to see whether you should call mkdirs() is even more futile. If it was a directory you shouldn't call mkdirs(). What you should be checking is ZipEntry.isDirectory().

http://stackoverflow.com/a/27630709
accepted answer of: http://stackoverflow.com/q/27629802
has body: Figured it out. For posterity: You need to update to the latest version of the Android Maven Plugin, in order to avoid this error. In addition, an old bug I was running into where ActivityCompat21 was not being found along several other classes that I fixed with a hacky workaround is also fixed by updating to version 4.0.0-rc2 of the plugin. com.jayway.maven.plugins.android.generation2 android-maven-plugin 4.0.0-rc.2 true <includeLibsJarsFromAar>true</includeLibsJarsFromAar>
answers question: http://stackoverflow.com/q/27629802
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/50446117

http://stackoverflow.com/a/27604048
score: 2
answers question: http://stackoverflow.com/q/27603915
has comment: http://stackoverflow.com/comment/43632528
has body: It does not makes sense that there would be a one to one mapping as a .java file can have multiple method calls on the same line. This is not true for a .class file. Meta data about the .java file is stored in the .class file, as is the case with generics. Extract from the VM spec: The LineNumberTable attribute is an optional variable-length attribute in the attributes table of a Code attribute. It may be used by debuggers to determine which part of the Java virtual machine code array corresponds to a given line number in the original source file. If LineNumberTable attributes are present in the attributes table of a given Code attribute, then they may appear in any order. Furthermore, multiple LineNumberTable attributes may together represent a given line of a source file; that is, LineNumberTable attributes need not be one-to-one with source lines.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/89700205
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27603915

http://stackoverflow.com/comment/43687048
type: Comment
comment on: http://stackoverflow.com/a/27633286
type: AnswerComment
has text: swing GUI,i created a textfield to let user enter the name of file. Besides that, i create a button to execute it
score: 0

http://stackoverflow.com/q/27508513
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43447294
has comment: http://stackoverflow.com/comment/43448125
tagged with: database
has answer: http://stackoverflow.com/a/27512240
score: 0
has body: I'm trying to get value out of the select option. But it doesn't seems to be able to get since it's on form. How do I do it ? I mean by having taking the value out of the option select. Select a product : <c:forEach var="row" items="${STOCKS1.rowsByIndex}"> <c:out value="${row[0]}"/> </c:forEach> <%!int query = 0; %> <% if(request.getParameter("stockid") != null){ Connection connection = DriverManager.getConnection( "jdbc:derby://localhost:1527/healthdb", "nbuser", "nbuser"); PreparedStatement statement = connection.prepareStatement("select stockqty from stocks where stockid = ?"); statement.setString(1,request.getParameter("stockid")); ResultSet resultset = statement.executeQuery( ) ; if(resultset.next()){ out.print(resultset.getString("stockqty")); query = resultset.getInt("stockqty"); } else out.print("lol");}%>
tagged with: sql
answer count: 1
tagged with: jsp
accepted answer: http://stackoverflow.com/a/27512240
type: AnsweredQuestion
has title: Trying to get value out of a select option in the same form

http://stackoverflow.com/comment/43467069
comment on: http://stackoverflow.com/q/27518544
has text: @JigarJoshi there are 2 problems here **1)how can i pass parameters to java, see it asked me to pass java parameters?** **2) how can i pass arguments?**
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43575614
has text: Modify `Places` to implement `Comparable<Places>`.
comment on: http://stackoverflow.com/q/27575067
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43526295
score: 0
comment on: http://stackoverflow.com/q/27547445
type: QuestionComment
type: Comment
has text: You read this post: http://stackoverflow.com/questions/8253653/exception-when-writing-to-the-xlsx-document-several-times-using-apache-poi-3-7

http://stackoverflow.com/q/27625106
tagged with: filter
tagged with: validation
answer count: 1
has title: Ninja Framework JSR303Validation in Filter
tagged with: ninjaframework
has body: I'm working on a Ninja JSON-based application in which I am implementing @JSR303Validation annotations across multiple controller methods. I'm currently checking validations in the controllers themselves by passing in the Validation object and calling validation.hasBeanViolations() to see if there are failures. If there are, I'm returning a failing Result to the client. Rather than doing this in the controller, I would like to validate requests using a Filter. However, I'm at a loss as to how to go about doing this? Could somebody help? As far as I can tell, you can't pass validations to a filter as a parameter, and the context.getValidation() object does not seem to be catching any validation failures.
has answer: http://stackoverflow.com/a/27626777
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27626777
type: Question
score: 0

http://stackoverflow.com/q/27495841
has title: readTree Jackson cannot be resolved
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/43423521
upvote count: 2
accepted answer: http://stackoverflow.com/a/27495932
possible better answer: http://stackoverflow.com/a/27495979
has answer: http://stackoverflow.com/a/27495979
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
downvote count: 0
tagged with: jackson
favorite count: 0
has body: So I'm quite new to json and jackson and I'm trying to use readTree but it keeps telling me "The type com.fasterxml.jackson.core.TreeNode cannot be resolved. It is indirectly referenced from required .class files" . I'm using jackson-databind-2.4.4.jar and jackson-mapper-asl-1.9.13.jar, should I use another library instead? String response = ""; ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(response);
has answer: http://stackoverflow.com/a/27495932

http://stackoverflow.com/comment/43512230
type: QuestionComment
has text: this question is for compile and answers displayed are for run program.
comment on: http://stackoverflow.com/q/27542298
score: 0
type: Comment

http://stackoverflow.com/q/27574528
favorite count: 0
type: UnansweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/27574699
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43574734
tagged with: http://stackoverflow.com/tag/json
tagged with: jackson
score: -1
has title: NullpointerException while reading a json with null value for array
has comment: http://stackoverflow.com/comment/43574846
answer count: 1
has body: Is there a way to read this json without causing nullpointer exception through jackson. { "years": [ null ] } years is an array of String Also is that a valid format of json when there are no years?

http://stackoverflow.com/a/27554445
has comment: http://stackoverflow.com/comment/43535665
answers question: http://stackoverflow.com/q/27554358
score: 1
accepted answer of: http://stackoverflow.com/q/27554358
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You need to add your buttons: public Test1() { setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5)); jButton = new JButton(); jButton2 = new JButton(); jButton3 = new JButton(); add(jButton); add(jButton2); add(jButton3); }
upvote count: 1

http://stackoverflow.com/comment/43655103
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27616482
has text: Can you share you code please?

http://stackoverflow.com/comment/43467137
comment on: http://stackoverflow.com/a/27518605
has text: Yes, you could do that
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/43465657
comment on: http://stackoverflow.com/a/27517557
score: 0
type: Comment
has text: Thank you for your reply. Maybe i have left some important point, i don't want to use the Controller to handle menu items. I would like to have an independent class to handle menu.jsp. With your solution i would have to make every method return `ModelAndView("default","menuItems",menu.menuItems()))` and this is not what i'm planning to do! Thank you anyway.
type: AnswerComment

http://stackoverflow.com/q/27528278
has comment: http://stackoverflow.com/comment/43485424
favorite count: 0
tagged with: out-of-memory
possible better answer: http://stackoverflow.com/a/27528335
tagged with: android
has answer: http://stackoverflow.com/a/27530397
has answer: http://stackoverflow.com/a/27528335
type: AnsweredQuestion
has body: I was developing an App. I had to modify my eclipse.ini so I wanted to know the purpose and meaning of these parameters XXMaxPermSize, vmargs, Xms and Xms, in order to correctly use them. I am using eclipse 3.8 on ubuntu 14.04, with java 7. --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vmargs -Xms40m -Xmx384m -Dorg.eclipse.equinox.p2.reconciler.dropins.directory=/usr/share/eclipse/dropins
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
answer count: 2
score: 8
accepted answer: http://stackoverflow.com/a/27530397
upvote count: 9
has title: Purpose of the parameters XXMaxPermSize, vmargs, Xms and Xms in eclipse.ini, what do they do
tagged with: ubuntu
linked to: http://stackoverflow.com/q/2129044
has comment: http://stackoverflow.com/comment/87601825

http://stackoverflow.com/a/27531558
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/43492493
upvote count: 5
has body: This is called "shadowing." Before we start, though, let's just use arpan for the two things in question, since having a method by that name (and using Arpan as the class name) gets confusing. :-) Let's refer to this code instead: public class Foo { String arpan; public void method1() { String arpan; arpan = "myname"; } public void method2() { arpan = "myname"; } } The arpan variable in method1 is a local variable. Using the free symbol arpan within that method will refer to the variable, because the variable shadows the instance field. Using the free symbol arpan inside method2 will use the arpan instance field (it's not a "variable") declared in Foo, because it isn't shadowed by a local variable. In general, think of it like this: The compiler looks for the symbol in the current scope and if not found, looks at the containing scope, and so on. More in JLS §6.4.1: Shadowing. Subjectively, I've always preferred to be explicit when referring to instance fields and methods by using this. in front of them, so that there's no ambiguity whether I'm referring to an instance field or a variable. Many tools can be configured to require that even though Java, the language, does not.
accepted answer of: http://stackoverflow.com/q/27531523
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27531523

http://stackoverflow.com/comment/43500462
type: QuestionComment
has text: Is there a reason why you're not just loading a `BufferedImage` with `ImageIO`, then then obtaining the raster from that one? (Not sure whether there is a difference, just for clarification)
comment on: http://stackoverflow.com/q/27535691
score: 0
type: Comment

http://stackoverflow.com/comment/43573449
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27572814
has text: @DavidSchwartz In that case the intention is that killing and restarting the library would also restart the task count. If the task count is a shared mutable variable then Akka is not an appropriate library to use (unless that shared mutable variable can be put in a parent actor that can also be restarted), and with the code snippet I've provided it wouldn't be possible for to create such a shared mutable variable - my intention was that if he was sufficiently interested in Akka then I could explain these details, rather than my giving a humongous intro to a fairly involved library.
type: AnswerComment

http://stackoverflow.com/comment/43420911
has text: Finaly I found a solution a few minutes ago on the net: [link](http://quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-08) You can use a Scheduler listener
comment on: http://stackoverflow.com/a/27480602
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43498096
has text: possible duplicate of [What does it mean to "program to an interface"?](http://stackoverflow.com/questions/383947/what-does-it-mean-to-program-to-an-interface)
comment on: http://stackoverflow.com/q/27527347
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43522006
type: AnswerComment
score: 0
type: Comment
has text: Say I have 1 request a second. Should I pool the connections, or just one connection is enough? Is there a possiblity that the connection expires or something like that?
comment on: http://stackoverflow.com/a/27547512

http://stackoverflow.com/comment/43649436
has text: Regarding the createNewFile, it returns true if the named file does not exist and was successfully created; false if the named file already exists. What if it fails to create the file due to incorrect path? will it return false?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27613442
type: Comment

http://stackoverflow.com/q/27480324
tagged with: quartz-scheduler
type: Question
has title: Quartz scheduler failed to get JNDI DB resource but starts anyway
tagged with: jndi
has answer: http://stackoverflow.com/a/27480602
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43394014
has comment: http://stackoverflow.com/comment/43393956
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27480602
tagged with: jdbc
has body: I'm using the QuartzInitializerListener to init the Quartz scheduler in my tomcat 8. When Quartz is not able to get a connection to my DB (JNDI resource): 15-Dec-2014 09:26:58.201 INFO [http-nio-8080-exec-10] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/.../ org.quartz.SchedulerConfigException: Failure occured during job recovery. [See nested exception: org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'DBConnectionPool': java.sql.SQLException: Could not retrieve datasource via JNDI url 'java:comp/env/jdbc/DBConnectionPool' java.sql.SQLException: Cannot create PoolableConnectionFactory (Communications link failure it starts anyway according to the quartz.propertiesn. It is not doing anything ... but I want Quartz to stop if this happens! How can i achieve this? Regards Sebastian
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/43607168
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27584357
type: AnswerComment
has text: I don't know where and how you use PersonListener. How do you create instance of this class?

http://stackoverflow.com/comment/43442642
has text: Yeah I understood and deleted the comment ... sorry
score: 0
comment on: http://stackoverflow.com/q/27506201
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27609111
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43669972
type: Answer
answers question: http://stackoverflow.com/q/27609026
downvote count: 0
has body: Is someClass is normal java class? Then no need to extends Activity, Use class constructor for getting Context in someClass form Activity to access getSharedPreferences as: public someClass(Context mContext){ this.sharedPreferences = mContext.getSharedPreferences(s haredPreferencesFileName,0); }

deserialization
type: Tag
tags question: http://stackoverflow.com/q/27584327
tags question: http://stackoverflow.com/q/27601522
tags question: http://stackoverflow.com/q/27542699
tags question: http://stackoverflow.com/q/27565556
tag name: deserialization
tags question: http://stackoverflow.com/q/27494911
tags question: http://stackoverflow.com/q/27608249
tags question: http://stackoverflow.com/q/27524371

http://stackoverflow.com/comment/92703154
score: 0
has text: To add context this post, the question comes from the book "Spring MVC Beginner's Guide" (ISBN: 978-1-78588-063-6) halfway down page 106. Does this fall under "Homework"?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27484526

http://stackoverflow.com/q/27482662
score: 0
has comment: http://stackoverflow.com/comment/43397844
has comment: http://stackoverflow.com/comment/43398974
has answer: http://stackoverflow.com/a/27483610
has body: i have a problem that stunned me a lot. I have a class (Bar) with a getter method which returns a List: public abstract class Bar&lt;T extends IdentifiableObject&gt; { ... public List&lt;Bar&gt; getBars() { return bars; } ... The hierarchy i have is: public abstract class Bar&lt;T extends IdentifiableObject&gt;; public abstract class IdentifiableObject&lt;T extends Comparable&lt;T&gt;&gt;; Until here everything works fine, the problem is when I execute: for(Bar bar : bars.getBars()) { } The previous sentence throws a compilation error: incompatible types: java.lang.Object cannot be converted to java.util.List&lt;com.x.Bar&gt; I was suprised with this error but i was more suprised when i performed List&lt;Bar&gt; bars = bar.getBars(); Iterator&lt;Bar&gt; iterator = bar.getBars().iterator(); both without problems What is wrong here in the "for" sentence? Thank you
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43398105
tagged with: compilation
has comment: http://stackoverflow.com/comment/43408048
has title: Java "for" compilation error
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/43398012
linked to: http://stackoverflow.com/q/5436656

http://stackoverflow.com/comment/43549561
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27561090
score: 0
has text: I compiled the entire code in JDK 1.6 it is fine. But when I recompile the code using JDK 1.7 it gives error.

search-engine
type: Tag
tag name: search-engine
tags question: http://stackoverflow.com/q/27480913

http://stackoverflow.com/q/27612706
has answer: http://stackoverflow.com/a/27615252
accepted answer: http://stackoverflow.com/a/27615252
tagged with: sockets
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43647758
type: Question
answer count: 1
has body: I'm doing a kind of Clock using Sockets with Java however I need that my client can interact with the Server changing the time. My main problem is: if I add any code for listen the Client, the Server Stop. I think I could use a thread or a async function nevertheless I'm totally new in Java and I don't know how to manipulate it. These are my current codes: server.java import java.io.IOException; import java.io.ObjectOutputStream; import java.net.ServerSocket; import java.net.Socket; import java.util.ArrayList; public class server { public static void main(String[] args) throws IOException, ClassNotFoundException { ServerSocket ss = new ServerSocket(2000); Timer data = new Timer(); while (true) { Socket s = ss.accept(); ArrayList&lt;Integer&gt; time = new ArrayList&lt;Integer&gt;(); data.updateTime(); time.add(data.getHour()); time.add(data.getMinute()); time.add(data.getSecond()); System.out.println(time.get(0) + ":" + time.get(1) + ":" + time.get(2)); try { ObjectOutputStream oos = new ObjectOutputStream( s.getOutputStream()); oos.writeObject(time); } catch (IOException e) { e.printStackTrace(); } try { Thread.sleep(1000); // 1000 milliseconds is one second. } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } } } Timer.java import java.util.Random; public class Timer { private int hour; private int minute; private int second; public Timer() { this.hour = randInt(0, 23); this.minute = randInt(0, 59); this.second = randInt(0, 59); } public void changeTime(int hour, int minute, int second) { this.hour = hour; this.minute = minute; this.second = second; } public static int randInt(int min, int max) { // NOTE: Usually this should be a field rather than a method // variable so that it is not re-seeded every call. Random rand = new Random(); // nextInt is normally exclusive of the top value, // so add 1 to make it inclusive int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } private void updateHour() { if (this.hour == 23) this…
has title: How to create a socket that constantly listen from the Server in Java?
score: 0

http://stackoverflow.com/comment/43676320
type: Comment
type: QuestionComment
score: 0
has text: @BrianGoetz yes, I agree. I have voted to reopen.
comment on: http://stackoverflow.com/q/27626148

http://stackoverflow.com/a/27594108
has comment: http://stackoverflow.com/comment/43612275
has comment: http://stackoverflow.com/comment/43629887
type: Answer
answers question: http://stackoverflow.com/q/27594087
score: 2
has comment: http://stackoverflow.com/comment/43611836
downvote count: 0
has body: GWT code compiles to JavaScript. It will work in every supported browser, including mobile and desktop browsers. So yes, you need to use com.google.gwt.i18n.client.DateTimeFormat.
upvote count: 2

http://stackoverflow.com/comment/43424431
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27484964
type: Comment
has text: @Jesper is it help you

http://stackoverflow.com/comment/43411840
score: 0
has text: Hello @ajb - i thought return values in case ( return boolean, short, long etc.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27489588

http://stackoverflow.com/comment/43446097
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27507299
has text: @peeskillet how did you get your environment set up that quickly btw? It always takes me a while to create new projects. Did you modify an old one?
type: Comment

http://stackoverflow.com/q/27606236
type: Question
has comment: http://stackoverflow.com/comment/43634695
has comment: http://stackoverflow.com/comment/43634723
has body: when creating an android application (using gradle and libgdx) i get the following errors, what's the best way to solve them? Any help would be appreciated
score: 0
tagged with: sdk
has comment: http://stackoverflow.com/comment/43637778
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43634665
answer count: 0
tagged with: java
has title: Problems with creating an android application

http://stackoverflow.com/comment/43651326
comment on: http://stackoverflow.com/q/27609720
has text: @MaartenBodewes-owlstead I know how to do it in theory but it doesn't work in the implemntation.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43441193
comment on: http://stackoverflow.com/q/27504877
score: 0
type: Comment
type: QuestionComment
has text: What's stopping you from running a single query and extracting `t.id`, `t.name` and `t2.*`?

http://stackoverflow.com/a/27585041
answers question: http://stackoverflow.com/q/27584941
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: readAllLines() puts everything in memory in one time so nothing can be faster than that. Don't use it if your file is large.
has comment: http://stackoverflow.com/comment/98866434
has comment: http://stackoverflow.com/comment/43594721
has comment: http://stackoverflow.com/comment/43594637
type: Answer
has comment: http://stackoverflow.com/comment/43595279
accepted answer of: http://stackoverflow.com/q/27584941

http://stackoverflow.com/q/27519967
has body: I'm using some code to generate a 16 bytes length String and I noticed a strange behaviour while using my code which is: public static String generateMyUniqueString() { return new BigInteger(64,oRandom).toString(16); } This is giving me a nice 16 characters length string 99% of the time. But yes, sometimes, the generated string is 15 characters length and, for now, I did not find why.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43469948
tagged with: biginteger
tagged with: java
has comment: http://stackoverflow.com/comment/43469889
type: Question
has answer: http://stackoverflow.com/a/27520922
possible better answer: http://stackoverflow.com/a/27520530
has answer: http://stackoverflow.com/a/27520530
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43470439
tagged with: byte
accepted answer: http://stackoverflow.com/a/27520922
linked to: http://stackoverflow.com/q/388461
has comment: http://stackoverflow.com/comment/43470512
has title: 16 bytes length becomes sometimes 15 bytes length
tagged with: tostring

http://stackoverflow.com/q/27539561
possible better answer: http://stackoverflow.com/a/30396441
accepted answer: http://stackoverflow.com/a/27554046
has answer: http://stackoverflow.com/a/30396441
tagged with: android
type: AnsweredQuestion
has title: Conversion to Dalvik Unable to execute dex:Java heap space and Unhandled event loop exception error in creating map activity
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43508229
tagged with: memory
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43507249
score: 0
answer count: 2
tagged with: google-maps
has answer: http://stackoverflow.com/a/27554046
favorite count: 0
has body: I am facing this error: unable to execute dex:Java heap space and unhandled event loop exception in eclipse after when I am trying to use map api v2.then it also prompt a internal error dialog and show "An out of memory has occurred". I am beginner and have no idea to solve this. I followed this tutorial for using api: http://code.tutsplus.com/tutorials/android-sdk-working-with-google-maps-application-setup--mobile-15771 I found some previous almost similar question like but not worked.I already set my dx.bat file defaultXmx=-Xmx1624M.may be this case is different.please help.

http://stackoverflow.com/comment/43663675
has text: Why not use a database, and query the database for synonyms?
score: 3
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27621597

http://stackoverflow.com/a/27568286
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/27559231
has body: Having a combination of filter and map in one step is not that useful in Java given its type system. E.g. there is no such PartialFunction type. The closest thing is flatMap: List&lt;Object&gt; list=Arrays.asList(0, "foo", 0L, 42.0, true, "false"); List&lt;String&gt; sList = list.stream() .flatMap(o-&gt; o instanceof String? Stream.of((String)o): Stream.empty()) .collect(Collectors.toList()); System.out.println(sList); but the expressiveness of .flatMap(o-&gt; o instanceof String? Stream.of((String)o): Stream.empty()) is not that bigger compared to .filter(o -&gt; o instanceof String).map(o -&gt; (String)o) Of course, you may create a helper method encapsulating these steps in a single, undissolvable operation: static &lt;T&gt; Stream&lt;T&gt; onlyType(Stream&lt;?&gt; s, Class&lt;T&gt; type) { return s.filter(type::isInstance).map(type::cast); } then you can use it like List&lt;String&gt; sList=onlyType(list.stream(), String.class).collect(Collectors.toList());
score: 9
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27559231

http://stackoverflow.com/comment/43550063
score: 0
has text: [The Security Filter Chain](http://docs.spring.io/spring-security/site/docs/3.0.x/reference/security-filter-chain.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27561920

http://stackoverflow.com/comment/43529591
comment on: http://stackoverflow.com/q/27551692
type: QuestionComment
type: Comment
score: 0
has text: Are you looking for a [`Toast`](http://developer.android.com/guide/topics/ui/notifiers/toasts.html)?

http://stackoverflow.com/a/27637796
accepted answer of: http://stackoverflow.com/q/27637559
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43766953
has comment: http://stackoverflow.com/comment/43771618
answers question: http://stackoverflow.com/q/27637559
has comment: http://stackoverflow.com/comment/43788312
has body: I think you must clone your board. In your's case you set '0' at all possible position MinimaxBoard child = new MinimaxBoard(board, position, 'O'); you must change to MinimaxBoard child = new MinimaxBoard(board.clone(), position, 'O'); and implement clone() method in your Board class Example of clone implementation: @Override public Object clone() { try { MinimaxBoard cloned = (MinimaxBoard)super.clone(); cloned.boardArray = (char[][])boardArray.clone(); for(int row=0; row&lt; cloned.boardArray.length;row++) cloned.boardArray[row] = (char[])boardArray[row].clone(); return cloned; } catch(CloneNotSupportedException e) { return null; } } }
score: 0

http://stackoverflow.com/q/27508223
has answer: http://stackoverflow.com/a/27519492
has body: I'm making an RxJava call and the end result I subscribe to is a List of Booking. The code works fine but I get this annoying highlight: A cast doesn't work here because I can't cast List &lt;Booking&gt; to List &lt;Object&gt;. Ok, you might say I should just replace it with a lambda expression, but in the call() method I need to call a method that takes List &lt;Booking&gt; as a parameter: How can I avoid highlighting in any of these cases?
downvote count: 0
answer count: 1
favorite count: 0
tagged with: rx-java
accepted answer: http://stackoverflow.com/a/27519492
has comment: http://stackoverflow.com/comment/43465428
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43448102
type: Question
has title: When returning a List of custom Objects RxJava highlights an error but compiles

date
tags question: http://stackoverflow.com/q/27568464
tags question: http://stackoverflow.com/q/27479140
tags question: http://stackoverflow.com/q/27545114
tags question: http://stackoverflow.com/q/27535224
tags question: http://stackoverflow.com/q/27479387
tag name: date
tags question: http://stackoverflow.com/q/27611159
tags question: http://stackoverflow.com/q/27617841
tags question: http://stackoverflow.com/q/27614322
tags question: http://stackoverflow.com/q/27512307
tags question: http://stackoverflow.com/q/27509817
tags question: http://stackoverflow.com/q/27523639
tags question: http://stackoverflow.com/q/27571377
tags question: http://stackoverflow.com/q/27482606
tags question: http://stackoverflow.com/q/27578886
tags question: http://stackoverflow.com/q/27579727
tags question: http://stackoverflow.com/q/27549974
tags question: http://stackoverflow.com/q/27567429
tags question: http://stackoverflow.com/q/27523162
type: Tag
tags question: http://stackoverflow.com/q/27601063
tags question: http://stackoverflow.com/q/27540235
tags question: http://stackoverflow.com/q/27589701
tags question: http://stackoverflow.com/q/27580655
tags question: http://stackoverflow.com/q/27617154
tags question: http://stackoverflow.com/q/27511590
tags question: http://stackoverflow.com/q/27631691
tags question: http://stackoverflow.com/q/27481579
tags question: http://stackoverflow.com/q/27502519
tags question: http://stackoverflow.com/q/27628954
tags question: http://stackoverflow.com/q/27606815
tags question: http://stackoverflow.com/q/27632506

http://stackoverflow.com/comment/43582655
has text: You need to iterate over the array, fetching out the JSONObjects from that. See edit
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27578989
type: Comment

http://stackoverflow.com/q/27628735
tagged with: spring-security
tagged with: url-rewriting
type: UnansweredQuestion
has body: I am building a Spring boot project where in all my request mapping URLs will map to respective actions in my Controller classes. For e.g., I have a feature to visit a page which shows the "Book" details given the "book_id". So the URL looks like this http://my-site.com/viewBookDetailsById?12345 The above URL maps to the action in my Java code as shown below. @RequestMapping(value = "/viewBookDetailsById", method = RequestMethod.GET) My goal is to change the URL that comes in browser to something meaningful like below. http://my-site.com/book_name How can I convert that URL to some other alias URL even though it should hit the same controller method?
tagged with: spring-annotations
answer count: 0
score: 0
tagged with: java
type: Question
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/43690106
has comment: http://stackoverflow.com/comment/43688309
has title: Change Request Mapping URL in browser

http://stackoverflow.com/comment/43692714
type: Comment
type: QuestionComment
has text: Add standard-1.1.2 and jstl-1.2.jar in your lib
comment on: http://stackoverflow.com/q/27636864
score: 0

http://stackoverflow.com/comment/43545195
type: QuestionComment
comment on: http://stackoverflow.com/q/27559498
type: Comment
has text: possible duplicate of [How to get source file-name/line-number from a java.lang.Class object](http://stackoverflow.com/questions/7483421/how-to-get-source-file-name-line-number-from-a-java-lang-class-object)
score: 1

http://stackoverflow.com/q/27637477
has comment: http://stackoverflow.com/comment/43694171
accepted answer: http://stackoverflow.com/a/27637574
has comment: http://stackoverflow.com/comment/43695390
tagged with: java
has comment: http://stackoverflow.com/comment/43693974
has answer: http://stackoverflow.com/a/27637590
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/27637591
favorite count: 0
has body: a friend of mine came up with an idea for a racing game, and i'm trying to create that in java. now, i have made 3 classes for cars, 1 for player cars, 1 for computer(ai)cars and a main one that holds some variables like location (x,y on the screen) and name to name a few. the first 2 inherit from the last one. i hoped this would allow me to create one array with both the players and the computer players in it. this however doesnt work, and now my question: is there any way it is possible to have an array with different kinds of objects in them, and if this is possible, how can i do it or are there any tutorials on it? i have looked at interfaces, but i dont think that would do the trick, but please correct me if im wrong. this was the idea that i had: MainCar[] carsArray = new MainCar[totalPlayers]; for(int i = 0; i &lt; totalHumanPlayers; i++) { carsArray[i] = new PlayerCar(); } for(int i = 0; i &lt; totalComputerPlayers; i++) { carsArray[i] = new ComputerCar(); } the idea with it is that i can loop through all the players(human and computer) to draw them at their locations and to decide whos turn it is next turn many thanks, and please forgive my english, i don't know if it's correct or not, not my first language :)
score: 3
has answer: http://stackoverflow.com/a/27637574
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27637586
upvote count: 3
possible better answer: http://stackoverflow.com/a/27637586
type: Question
has title: How to use objects of different classes in one array?(Java)
tagged with: object

http://stackoverflow.com/q/27498183
has answer: http://stackoverflow.com/a/27498571
tagged with: java
type: UnansweredQuestion
tagged with: jakarta-mail
has body: I have a running and working implementation of the Java Mail API. I am using the api to send out bulk email messages. On some occasions, the login gets blocked by google. So, I go to my gmail account and allow access to apps and set the security level to give access to apps that don't use what google calls "modern security". So, the google page tells me to try my program again. I try it again and it still won't let me log in. On some occasions when I have a login fail, I can go to the account, log in, and type in the recaptcha. This will allow me to log back in shortly after and send emails. However, the problem I am now experiencing does not show any recaptcha, nor does it say anything about any unknown apps that tried to access the account. It says nothing, and just wont let me log in to my account. I created two new accounts for testing and they worked fine. The account that I created that doesn't work only allowed me to send 17 emails before it blocked my service. Does anyone have any suggestions? Thanks!
downvote count: 0
has answer: http://stackoverflow.com/a/27498420
score: 1
favorite count: 0
type: Question
has title: Java Mail being blocked by gmail in some cases
tagged with: email
has answer: http://stackoverflow.com/a/27500010
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/43409597
score: 0
has text: `blankText.setText("" + var1+var2)` ??
type: QuestionComment
comment on: http://stackoverflow.com/q/27489020
type: Comment

http://stackoverflow.com/q/27577351
answer count: 3
has answer: http://stackoverflow.com/a/27577372
downvote count: 0
possible better answer: http://stackoverflow.com/a/27577381
favorite count: 0
tagged with: android
has title: Android: Using SharedPreferences with a Tab Layout
accepted answer: http://stackoverflow.com/a/27577372
tagged with: tabs
has answer: http://stackoverflow.com/a/27577673
upvote count: 1
has comment: http://stackoverflow.com/comment/43579860
type: Question
type: AnsweredQuestion
has body: So I learned about making tabs in Android using FragmentActivity from THIS TUTORIAL. So now I have a FragmentActivity that holds 3 tabs, which means within those tabs are three different Fragments. FragmentActivity class public class ProductSingle_Activity extends FragmentActivity { ViewPager Tab; public TabPagerAdapter TabAdapter; ActionBar actionBar; Context ctx = this; @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.product_single); .... and so on And I have two Fragments that become the two tabs of the FragmentActivity: One Fragment: public class details_frag_activity extends Fragment { Context ctx; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View android = inflater.inflate(R.layout.details_frag, container, false); } } So I have stored some information such as 'name' and 'description' in the SharedPreferences of the application. SharedPreferences pref = ctx.getSharedPreferences("product_details", 0); //ctx being the context Editor editor = pref.edit(); editor.putString("pname", name); editor.commit(); I want to access those information through one of the Fragments like this: public class details_frag_activity extends Fragment { Context ctx; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View android = inflater.inflate(R.layout.details_frag, container, false); SharedPreferences pref = ctx.getSharedPreferences("product_details", 0); //I cant access the ctx (Context). To avoid the error I just declared a local variable. I need to get the context of the FragmentActivity String pname = pref.getString("pname", null); However I can't access the 'ctx' (Context) through the fragment. Is there a way to pass the context of the FragmentActivity to the Fragment Classes such that they can retrieve stored information from the SharedPreferences?…
tagged with: android-fragments
score: 1
tagged with: java
tagged with: sharedpreferences
has answer: http://stackoverflow.com/a/27577381

http://stackoverflow.com/a/27539154
accepted answer of: http://stackoverflow.com/q/27533692
has comment: http://stackoverflow.com/comment/76788627
has comment: http://stackoverflow.com/comment/50237226
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27533692
upvote count: 2
type: Answer
score: 2
has body: Okay I found a way to make it work. I had uninstall the existing app from the device, and start afresh. The tests ran fine after that.
downvote count: 0

http://stackoverflow.com/a/27635772
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: Use this - &lt;activity android:name="Your activity" android:screenOrientation="portrait" &gt;
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27635701
answers question: http://stackoverflow.com/q/27635701

http://stackoverflow.com/comment/44197612
comment on: http://stackoverflow.com/q/27524788
type: Comment
has text: Can you provide more information, like logs or exceptions?
score: 0
type: QuestionComment

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/27616002
tags question: http://stackoverflow.com/q/27541796
tag name: android-gridview

http://stackoverflow.com/comment/43481469
has text: Yeah I tried this, in client I moved: os = socket.getOutputStream(); which was in 'sendMessage()', to 'connectToServer()' underneath: socket = new Socket(host, port); and then obviously took away the os.close(); in 'sendMessage()', however once I do this, the server did not even receive the first message I sent once the socket has been created. And when you say every so often, do you mean like every 2 hours? And why is this not working? :S Thanks for the quick reply :)
comment on: http://stackoverflow.com/a/27526335
score: 0
type: AnswerComment
type: Comment

encryption
tags question: http://stackoverflow.com/q/27517883
tags question: http://stackoverflow.com/q/27576763
tags question: http://stackoverflow.com/q/27596300
tags question: http://stackoverflow.com/q/27618981
tag name: encryption
tags question: http://stackoverflow.com/q/27492292
tags question: http://stackoverflow.com/q/27562220
tags question: http://stackoverflow.com/q/27635742
tags question: http://stackoverflow.com/q/27604170
tags question: http://stackoverflow.com/q/27561494
tags question: http://stackoverflow.com/q/27618584
tags question: http://stackoverflow.com/q/27632605
tags question: http://stackoverflow.com/q/27582847
tags question: http://stackoverflow.com/q/27527156
tags question: http://stackoverflow.com/q/27614456
tags question: http://stackoverflow.com/q/27530067
type: Tag
tags question: http://stackoverflow.com/q/27577680
tags question: http://stackoverflow.com/q/27539868

http://stackoverflow.com/a/27536946
type: Answer
score: 3
answers question: http://stackoverflow.com/q/27536551
upvote count: 3
has body: This is bit tricky, but I would probably try to create a Reader that actually blocks if no data is available, sleeps a bit, checks, and so on. This way Jackson need not concern itself with lack of content. Return 0 from Reader or InputStream will not actually help, as there isn't much parser can do, as there is really no way to properly block. Or, put another way: underlying reader or stream MUST try to read at least one byte (if one or more requested), blocking if none is found; or return -1 if nothing will be available.
downvote count: 0
has comment: http://stackoverflow.com/comment/43503421

http://stackoverflow.com/comment/43606799
has text: Could you post the complete code (where you call the asyncTask) ?
type: QuestionComment
comment on: http://stackoverflow.com/q/27591503
score: 0
type: Comment

http://stackoverflow.com/comment/43587287
type: QuestionComment
comment on: http://stackoverflow.com/q/27581495
score: 0
has text: Yes, this is fine. There are two different `_x` fields, one for each class, and each class only accesses its own one. None of that has any effect on being able to call parent methods (including `super()`) from the derived class.
type: Comment

http://stackoverflow.com/comment/43480851
comment on: http://stackoverflow.com/q/27520374
has text: By removing implicit wait from code unhandledAlertException is resolved. I wonder why it was throwing this exception. But sometimes unresponsiveness of elements on IE is still persist for same code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27574690
has comment: http://stackoverflow.com/comment/43575694
has comment: http://stackoverflow.com/comment/43575304
type: Answer
has comment: http://stackoverflow.com/comment/43575494
has comment: http://stackoverflow.com/comment/43575428
score: 0
answers question: http://stackoverflow.com/q/27573582
has comment: http://stackoverflow.com/comment/43575623
has body: I'm not really familiar with android but your java code looks fine. What response code do you get when you call this: urlConnection.getResponseCode() I was facing some issues with sending a post data some time ago and I found really helpful to know what I'm exactly sending in a HTTP request. You could use netcat to display what you are sending to service. FE. nc -l 80 to listen for your requests on port 80 and just send a request to localhost or some other computer in your network that is able to execute such a command. All received requests will be written to your console. If you will see that the request payload is correct there is probably some problem with webservice that you are trying to call. EDIT: I've tried executing a similar code against netcat and it worked fine. try { HttpURLConnection urlConnection = (HttpURLConnection) (new URL("http://localhost:3333").openConnection()); //urlConnection.setConnectTimeout(1500); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); String urlParameters = "message=blabla"; DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); System.out.println(urlConnection.getResponseCode()); } catch (Exception e) { e.printStackTrace(); } i got POST / HTTP/1.1 User-Agent: Java/1.8.0_25 Host: localhost:3333 Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive Content-type: application/x-www-form-urlencoded Content-Length: 14 message=blabla

http://stackoverflow.com/a/27555088
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43536482
upvote count: 1
has body: I added comments to document what the code was doing. This should hopefully help you grasp the concept. public class NewClass { public static void main(String[] args) { Scanner input = new Scanner(System. in ); //Create an array of integers to store user input int[] userNumbers = new int[5]; System.out.print("Enter " userNumbers.length + " numbers: "); //Goes into a loop, and sets each array index to the user inputted integer for (int i = 0; i &lt; userNumbers.length; i++) { userNumbers[i] = input.nextInt(); } System.out.println("Enter a number you would like to search for"); boolean exists = false; int numToSearch = input.nextInt(); //for each number in the user numbers array, check to see if that number matches the number to search. If so, set exists = true and break out of the loop to check no further. for (int num: userNumbers) { if (numToSearch == num) { exists = true; break; } } //if else to decide which output to show the user. if (exists) { System.out.println(numToSearch + " is in the list"); } else { System.out.println(numToSearch + " is not in the list"); } } }
answers question: http://stackoverflow.com/q/27554937
score: 1
accepted answer of: http://stackoverflow.com/q/27554937
type: AcceptedAnswer

http://stackoverflow.com/comment/43392687
has text: Yes, if at least one of the threads is changing the collection, you need to synchronize over the entire loop. Second question: The trick is that you remove by calling `remove()` on the iterator instead of on the list itself - that way the iterator knows that the collection has changed. With an enhanced `for`-loop you don't have access to the iterator so you cannot call `remove()` on the iterator.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27475092

http://stackoverflow.com/comment/43469217
comment on: http://stackoverflow.com/q/27507004
score: 0
type: Comment
type: QuestionComment
has text: Updated the question. Using ProcessBuilder and rediretErrorStream seems to get me half way.

http://stackoverflow.com/a/27584357
downvote count: 0
has comment: http://stackoverflow.com/comment/43613002
has comment: http://stackoverflow.com/comment/43607168
type: Answer
has comment: http://stackoverflow.com/comment/43609021
answers question: http://stackoverflow.com/q/27584274
upvote count: 3
has comment: http://stackoverflow.com/comment/43606955
has comment: http://stackoverflow.com/comment/43602138
score: 3
has comment: http://stackoverflow.com/comment/43605674
has comment: http://stackoverflow.com/comment/43607751
has body: @Autowired works only in objects which are managed by Spring. So annotate your class PersonListener for example with @Component and don't create instance as new Object(). Use for example @Autowired to get instance.

http://stackoverflow.com/comment/43633792
type: AnswerComment
has text: Pastei n your question its definition please.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27605688

http://stackoverflow.com/comment/43661943
comment on: http://stackoverflow.com/a/27620111
score: 0
type: Comment
has text: Thank your for the additional your information. I shall surely go through those materials.
type: AnswerComment

http://stackoverflow.com/comment/43512909
score: 0
type: Comment
type: QuestionComment
has text: @Gungnir Java doesn't throw error messages any more than C does. You're just misusing terminology. It doesn't have anything to do with Java *versus* C. You've made the mistake of not calling `perror()` etc at several points, not just one. For example, `printf("Bind Error\n")`. Error messages of your own devising that don't contain the actual error are completely useless.
comment on: http://stackoverflow.com/q/27542629

http://stackoverflow.com/a/27612766
has body: U really should use @PathParam("param") to the method param, like @PathParam("param") param if u want to know more ,I suggest to see The source code.
answers question: http://stackoverflow.com/q/27612495
upvote count: 0
downvote count: 1
score: -1
type: Answer

http://stackoverflow.com/q/27565366
tagged with: jsp
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/43555834
has title: java.lang.NoClassDefFoundError when hit the jsp
accepted answer: http://stackoverflow.com/a/27574773
possible better answer: http://stackoverflow.com/a/27567095
has comment: http://stackoverflow.com/comment/43556170
has comment: http://stackoverflow.com/comment/43556415
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27574773
has comment: http://stackoverflow.com/comment/43556015
has answer: http://stackoverflow.com/a/27567095
has comment: http://stackoverflow.com/comment/43557629
tagged with: java
has comment: http://stackoverflow.com/comment/43556689
type: Question
answer count: 2
has body: I have code, in which I have package called: package com.test.core.it; All classes inside this package only. There is a .jsp file, which has this line of code: test.executeAllTestCase(); the test is an instance of TestA which is in the package com.test.core.it. executeAllTestCase has line like: TestB.getInstance() TestB is also in same package. I builded the war and deployed to tomcat. When hit the url: http://localhost:8080 the jsp is getting called, which is throwing me the exception: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.test.core.it.TestB org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:912) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841) I'm not sure, where I'm making mistake. Edit I can see the classes are loaded in WEB-INF-&gt;classes-&gt;&lt;package wise directory&gt; -&gt; TestA.class, TestB.class
has comment: http://stackoverflow.com/comment/43555881
has comment: http://stackoverflow.com/comment/43556947

http://stackoverflow.com/comment/43626390
comment on: http://stackoverflow.com/q/27586415
type: Comment
has text: OT: `DateTickUnit` is deprecated.
score: 0
type: QuestionComment

http://stackoverflow.com/a/27534124
has comment: http://stackoverflow.com/comment/43497189
upvote count: 1
has comment: http://stackoverflow.com/comment/43496816
type: AcceptedAnswer
downvote count: 0
score: 1
has body: findMaxPos is a static method of your class staticMethod. When you are not calling a static function inside the class where it is defined, you need to call it with the name of the class before: public static void main(String[] args) { Object[] type = new Object2[3]; yp[0] = new Object(5); yp[1] = new Object(6); yp[2] = new Object(8); staticMethods.findMaxPos(type);// This should be ok. } Note that in java, the convention is to give classes a name which begin with an uppercase letter (Names which begin with a lowercase letters are given to instances).
has comment: http://stackoverflow.com/comment/43496764
type: Answer
answers question: http://stackoverflow.com/q/27534062
accepted answer of: http://stackoverflow.com/q/27534062

http://stackoverflow.com/comment/43536879
type: Comment
comment on: http://stackoverflow.com/a/27553697
has text: I'm using JDK version: 1.8.0_11
type: AnswerComment
score: 0

http://stackoverflow.com/q/27513037
has answer: http://stackoverflow.com/a/27533261
tagged with: reactor
tagged with: spring
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27514714
answer count: 2
has body: I wanted to prototype an example where I call a ServiceC using a value returned by ServiceA using Spring Reactor Stream API. So I wrote code like this final ExecutorService executor = new ThreadPoolExecutor(4, 4, 10, TimeUnit.MINUTES, new LinkedBlockingQueue&lt;Runnable&gt;()); Streams.defer(executor.submit(new CallToRemoteServiceA())) .flatMap(s -&gt; Streams.defer(executor.submit(new CallToRemoteServiceC(s)))) .consume(s -&gt; System.out.println("End Result : " + s)); To simulate the latency involved in ServiceA and ServiceC the call() methods of CallToRemoteServiceA and CallToRemoteServiceC has Thread.sleep() methods. The problem is that when I comment out the Thread.sleep() method i.e. the service method calls have no latency which is not true in the real world the consume method gets called. If the Thread.sleep() methods are kept in place then the consume method doesn't get called. I understand that the Streams.defer() returns a cold stream and hence it probably only executes the consume method for items accepted after it's registration but then I was wondering how I could create a HotStream from a Future returned by the ExecutorService?
has title: Creating a HotStream out of a Future via Spring Reactor
score: 0
tagged with: reactive-programming
type: UnansweredQuestion

http://stackoverflow.com/comment/43512598
type: QuestionComment
comment on: http://stackoverflow.com/q/27542674
type: Comment
has text: File Format for example let it be image1.jpg. I want to convert this file into a stream of binary Strings of 8 bits.
score: 0

http://stackoverflow.com/a/27612340
has comment: http://stackoverflow.com/comment/43646920
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43647458
downvote count: 0
has comment: http://stackoverflow.com/comment/43646886
has body: So it appears that writing a custom collector in this case is not such a difficult task as I imagined it to be: package org.tendiwa.collections; import com.google.common.collect.ImmutableSet; import java.util.Set; import java.util.function.BiConsumer; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collector; public class ImmutableSetCollector&lt;T&gt; implements Collector&lt;T, ImmutableSet.Builder&lt;T&gt;, ImmutableSet&lt;T&gt;&gt; { @Override public Supplier&lt;ImmutableSet.Builder&lt;T&gt;&gt; supplier() { return ImmutableSet.Builder::new; } @Override public BiConsumer&lt;ImmutableSet.Builder&lt;T&gt;, T&gt; accumulator() { return (builder, element) -&gt; builder.add(element); } @Override public BinaryOperator&lt;ImmutableSet.Builder&lt;T&gt;&gt; combiner() { return (b1, b2) -&gt; b1.addAll(b2.build()); } @Override public Function&lt;ImmutableSet.Builder&lt;T&gt;, ImmutableSet&lt;T&gt;&gt; finisher() { return ImmutableSet.Builder::build; } @Override public Set&lt;Characteristics&gt; characteristics() { return ImmutableSet.of(); } } Usage: public static void main(String[] args) { ImmutableSet&lt;Point2D&gt; set = Arrays.asList( new Point2D(1, 2), new Point2D(2, 4), new Point2D(3, 5), new Point2D(4, 4), new Point2D(5, 6), new Point2D(8, 6) ).stream().collect(new ImmutableSetCollector&lt;&gt;()); System.out.println(set); } Output: [{1.0:2.0}, {2.0:4.0}, {3.0:5.0}, {4.0:4.0}, {5.0:6.0}, {8.0:6.0}]
has comment: http://stackoverflow.com/comment/43646998
answers question: http://stackoverflow.com/q/27612165

http://stackoverflow.com/comment/43589336
type: AnswerComment
comment on: http://stackoverflow.com/a/27579958
type: Comment
has text: I got your second point that we need to put in a Hashmap. I assume you need the various boolean properties to merge using OR semantics. - you are right. Can you please let me know how to achieve it
score: 0

http://stackoverflow.com/q/27509698
has body: I'm trying to use the same core expression that works like a charm for a HandleMenuItem, also for a HandledToolItem, but unforunaly I got stuck since the compiler doesn't care at all. The HandledToolItem is never hidden. So I tried to dig around and it seems there's a known bug for core expression and HandledToolItem, are you aware about that? Thanks
answer count: 0
tagged with: java
tagged with: rcp
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/43454070
has comment: http://stackoverflow.com/comment/43623063
score: 0
linked to: http://stackoverflow.com/q/23567917
has comment: http://stackoverflow.com/comment/43451268
tagged with: e4
type: UnansweredQuestion
has title: ECLIPSE E4 LUNA - CoreExpression for a HandledToolItem

http://stackoverflow.com/q/27534853
has title: Storing subclasses with same properties in a data store
has body: What’s the best way to store inheritance in a database like Neo4j? Let’s say I have two types of vehicle; car and test car, where test car inherits from car. In our example there’s no difference in properties so all data stored in the data store is the same, but in our app's model, test car has methods that car doesn’t. Is it best to store a new property like car_type with some kind of enum? Or is there a better way to store/determine a subclass when downloading and initting it in an application?
tagged with: inheritance
score: 0
answer count: 1
tagged with: datastore
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27545474
accepted answer: http://stackoverflow.com/a/27545474
type: Question

http://stackoverflow.com/comment/43390158
score: 0
has text: i have used below link for configuring the ehcache.http://www.javacodegeeks.com/2012/02/hibernate-cache-levels-tutorial.html.can you please let me know if anything is missed out in the configuration?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27478138

http://stackoverflow.com/comment/43693404
has text: `hasRole` is needed `use-expressions` is enabled in `http` tag, but it is not, so `access="ROLE_ADMIN"` is correct
comment on: http://stackoverflow.com/a/27637230
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27481953
has body: Whenever I try to build any maven project or generate some archetype, I get this error: [ERROR] Error executing Maven. [ERROR] java.lang.NoClassDefFoundError: com/google/inject/internal/cglib/core/$CodeGenerationException [ERROR] Caused by: com/google/inject/internal/cglib/core/$CodeGenerationException [ERROR] Caused by: com.google.inject.internal.cglib.core.$CodeGenerationException Maven used to work ok just yesterday, and don't remember changing anything in its' configurations lately. I use jdk8 oracle and jdk7 openjdk on Ubuntu 14.04 (I switch between 2 javas from time to time using Ubuntu's update-alternative --config javac). If I run mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app -X I get this output: username@pcname:~/Desktop/projects/mvn_simple$ mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app -X Apache Maven 3.0.5 Maven home: /usr/share/maven Java version: 1.8.0_25, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-oracle/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.13.0-40-generic", arch: "amd64", family: "unix" [ERROR] Error executing Maven. com.google.common.collect.ComputationException: java.lang.NoClassDefFoundError: com/google/inject/internal/cglib/core/$CodeGenerationException at com.google.common.collect.MapMaker$ComputingMapAdapter.get(MapMaker.java:890) at com.google.inject.internal.FailableCache.get(FailableCache.java:49) at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:50) at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:127) at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:530) at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:179) at com.google.inject.internal.ProcessedBindingData.initializeBindi…
has answer: http://stackoverflow.com/a/69703688
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/122558357
possible better answer: http://stackoverflow.com/a/69703688
tagged with: linux
accepted answer: http://stackoverflow.com/a/27482059
upvote count: 24
favorite count: 0
has answer: http://stackoverflow.com/a/72879695
answer count: 9
has answer: http://stackoverflow.com/a/27482059
has answer: http://stackoverflow.com/a/69425040
has answer: http://stackoverflow.com/a/75034781
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/69205104
has comment: http://stackoverflow.com/comment/122558102
downvote count: 0
tagged with: java
score: 24
has answer: http://stackoverflow.com/a/44773393
has title: Maven: java.lang.NoClassDefFoundError: com/google/inject/internal/cglib/core/$CodeGenerationException
type: Question
has answer: http://stackoverflow.com/a/72250176
has answer: http://stackoverflow.com/a/74646073

http://stackoverflow.com/a/27523336
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43476191
has body: Try to understand, projects = {projectId=24, projectName=K245} is nothing but Map&lt;String, Map&lt;String,Object&gt;&gt; Map&lt;"projects", Map&lt;"projectId",24&gt;&gt; Map&lt;"projectName",K245&gt;&gt; Just iterate over a map, Map&lt;String, String&gt; map = objectMapper.convertValue(emp, HashMap.class); Map&lt;String, Object&gt; myMap = new HashMap&lt;String, Object&gt;(); if (null != map &amp;&amp; map.size() &gt; 0) { for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) myMap.put(entry.getKey(), entry.getValue()); } myMap will contain data as Map&lt;"projectId",24&gt; &lt;"projectName",K245&gt; Also you can iterate and check for value if value is instanceOf Map Map&lt;String, Object&gt; myMap = null; if (null != map &amp;&amp; map.size() &gt; 0) { for (Map.Entry&lt;String, Object&gt; entry : map.entrySet()) if (entry.getValue() instanceof java.util.Map) { myMap = (Map&lt;String, Object&gt;) entry.getValue(); } } or assign value to myMap and iterate over it.
answers question: http://stackoverflow.com/q/27522969
type: Answer
accepted answer of: http://stackoverflow.com/q/27522969
has comment: http://stackoverflow.com/comment/43476775
has comment: http://stackoverflow.com/comment/43489033
downvote count: 0
score: 1

http://stackoverflow.com/comment/43664745
comment on: http://stackoverflow.com/q/27622087
has text: You can override the .equals() method to implement your comparison logic. Please see: http://stackoverflow.com/a/185942/439716
type: Comment
type: QuestionComment
score: 0

cassandra
tags question: http://stackoverflow.com/q/27489980
type: Tag
tags question: http://stackoverflow.com/q/27506665
tag name: cassandra
tags question: http://stackoverflow.com/q/27632543
tags question: http://stackoverflow.com/q/27519841
tags question: http://stackoverflow.com/q/27603306
tags question: http://stackoverflow.com/q/27621935
tags question: http://stackoverflow.com/q/27613035

http://stackoverflow.com/q/27599570
accepted answer: http://stackoverflow.com/a/27600410
tagged with: android-annotations
tagged with: java
has comment: http://stackoverflow.com/comment/43623474
linked to: http://stackoverflow.com/q/1624084
has comment: http://stackoverflow.com/comment/43623472
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27600410
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43622734
score: 1
tagged with: annotations
upvote count: 1
type: Question
has title: How to extend annotations in Java?
has body: I'm using Android Annotations library and there is @UIThread annotation, which takes an optional argument propagation. I always use this annotation with REUSE value of this parameter: @UiThread(propagation = UiThread.Propagation.REUSE) void doSomething() { } So can I make somehow my own annoation @UIThreadReuse which would extend the @UIThread annotation and pass REUSE as a parameter? So I could just write like this: @UiThreadReuse void doSomething() { }

http://stackoverflow.com/a/27581829
score: 2
has body: I want to achieve this by making my current frame view.getFrame2() invisible and make a view.getFrame3() visible. Don't be hiding/showing different windows. Users don't like frames disappearing. Instead you can simply display a modal JDialog containing your image on top of your main frame. Or another approach is to use a GlassPane that paints over top of your main frame. See Disabled Glass Pane for an example of this approach. The existing example doesn't use an Icon, but you can easily change that.
downvote count: 0
has comment: http://stackoverflow.com/comment/43617003
accepted answer of: http://stackoverflow.com/q/27580177
has comment: http://stackoverflow.com/comment/43696046
has comment: http://stackoverflow.com/comment/43699338
answers question: http://stackoverflow.com/q/27580177
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43599670
has comment: http://stackoverflow.com/comment/43694714

http://stackoverflow.com/comment/43478451
has text: You might want to use some IDE ( eclipse ?) .. it will help find the issue easily ..
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/27524894
type: Comment

http://stackoverflow.com/comment/43384831
comment on: http://stackoverflow.com/a/27475124
type: AnswerComment
has text: Agree with @MadProgrammer, this approach is not the way to go. -1
score: 0
type: Comment

http://stackoverflow.com/a/27602317
score: 1
has body: B are C are both correct - only one thread can enter any synchronized method at once. This applies even if different synchronized methods are being called simultaneously. Regarding part 2, wait(), notify() and notifyAll() are instance methods of the Object class, so "true" is correct - they are called on the (lock) Object.
upvote count: 1
has comment: http://stackoverflow.com/comment/43627205
has comment: http://stackoverflow.com/comment/43627173
type: Answer
answers question: http://stackoverflow.com/q/27602264
downvote count: 0

http://stackoverflow.com/comment/43515757
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27536074
score: 0
has text: I also tried this and it still doesn't work

http://stackoverflow.com/comment/43659032
comment on: http://stackoverflow.com/a/27616388
type: Comment
has text: Note that in order to have 200 decimals, you need to run 10^200 throws, this is uncomputable !
score: 0
type: AnswerComment

http://stackoverflow.com/a/27554495
type: Answer
has body: You can have an public Enum called SigletonEnum with a single instance called INSTANCE. This is a singleton. As this is an enum, it is not required to be instantiated.And then in the application you can call it as SingletonEnum.INSTANCE.doSomething();
has comment: http://stackoverflow.com/comment/43537241
answers question: http://stackoverflow.com/q/27554432
has comment: http://stackoverflow.com/comment/43537436
score: 0
has comment: http://stackoverflow.com/comment/43535335
has comment: http://stackoverflow.com/comment/43537070

http://stackoverflow.com/comment/43405622
has text: Did you consider `ThreadLocal`s?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27482032

http://stackoverflow.com/q/27568917
has title: Signed Applet for Intranet app
tagged with: plugins
has answer: http://stackoverflow.com/a/27570844
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27570844
has body: Is it possible to have self-signed Applets without restrictions in local network? I can configure my user's PCs since they are all in LAN. The idea is that I self-sign Applet, and out IT department edits client's PCs, so that they auto trust our Applets. Is this possible, or are there any restrictions?
tagged with: security
tagged with: browser
score: 0
answer count: 1
tagged with: applet

http://stackoverflow.com/comment/43478305
comment on: http://stackoverflow.com/q/27509256
has text: @Hardy I put embraces in the key and don´t worked.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27480818
has comment: http://stackoverflow.com/comment/43394913
answer count: 0
has comment: http://stackoverflow.com/comment/43395505
has comment: http://stackoverflow.com/comment/43394750
has body: Consider I have a rest API like this: @Path("/TestAPI") public class APIMapper { @GET @Path("/hello") public String sayHello() { return "Hello"; } } Basically user can hit URL like this: http://localhost/app/TestAPI/hello and they would get response as "Hello" but if they hit URL like this: http://localhost/app/TestAPI they generally get blank screen/response as output We want that if user just give URL like this http://localhost/app/TestAPI without giving any specific api, instead of giving blank response, we want to output something like Welcome to API, below list of services available(slightly similar to .NET webservices where if we hit URL, it displays "Following operations available"). Is there a way I can do same thing using Java/Jersey? Can anyone please help me?
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/43394716
has comment: http://stackoverflow.com/comment/43394783
has comment: http://stackoverflow.com/comment/43397906
has comment: http://stackoverflow.com/comment/43395234
score: 0
tagged with: java
tagged with: jersey
has title: Jersey - welcome message when user hits API URL
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43395451

http://stackoverflow.com/q/27585489
tagged with: toast
has answer: http://stackoverflow.com/a/27585536
has title: How can i load a external image into an android toast?
type: UnansweredQuestion
tagged with: android
tagged with: android-toast
linked to: http://stackoverflow.com/q/21012964
score: 0
has body: How can i load an external image (from url) into a toast? Currently i have this code working that displays a simple text: cordova.getActivity().runOnUiThread(new Runnable() { public void run() { android.widget.Toast toast = android.widget.Toast.makeText(webView.getContext(), 'Hello, i'm a toast!', 0); toast.setDuration(android.widget.Toast.LENGTH_LONG); toast.show(); callbackContext.success(); } }); what i want is to put a little icon to the left, that it's downloaded from a url, so i think it should be loaded from async task in background..
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/11288475
has answer: http://stackoverflow.com/a/27585546
answer count: 2

http://stackoverflow.com/a/27614345
upvote count: 3
has comment: http://stackoverflow.com/comment/43695333
score: 3
answers question: http://stackoverflow.com/q/27613915
has comment: http://stackoverflow.com/comment/43654277
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43650849
has comment: http://stackoverflow.com/comment/43692908
has body: JOptionPane is a Swing method and should be called on the EDT, the Event Dispatch Thread, and only on this thread, and so it suggests that all your code above should be on the EDT, and that most of your SwingUtilities.invokeLater(new Runnable() calls are completely unnecessary. The only necessary ones will be the main one, where you launch your Swing GUI code, and any areas where Swing calls need to be made from within background threads. Again, if any of the above code is being made within background threads, then the JOptionPane should not be in that thread. For more specific information in this or any other answer, please provide more specific information in your question. Let's end all confusion. The best way to get us to fully and quickly understand your problem would be if you were to to create and post a minimal example program, a small but complete program that only has necessary code to demonstrate your problem, that we can copy, paste, compile and run without modification. I have a sneaking suspicion that a decent refactoring along MVC lines could solve most of your problems. Your code is very linear with its lines of code that must follow one another and its if blocks, and it is also tightly coupled with your GUI, two red flags for me. Perhaps better would be less linear code, more event and state-driven code, code where your background code interacts with the GUI via observer notification, and where the background code likewise responds to state changes in the GUI from control notification. Your control needs two SwingWorkers, one to get the row count and the other to get the rest of the data if the user decides to do so. I'd add a PropertyChangeListener to the first SwingWorker to be notified when the row count data is ready, and then once it is, present it to the view for the user to select whether or not to proceed. If he decides to proceed, I'd then call the 2nd SwingWorker to get the main body of the data. For example, a rough sketch of what I'm tal…
has comment: http://stackoverflow.com/comment/43697652

http://stackoverflow.com/comment/43507825
type: QuestionComment
has text: you use for `singleton object` using `inner class` for further reference use (http://docs.oracle.com/javase/tutorial/java/javaOO/whentouse.html)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27540045

http://stackoverflow.com/q/27585248
tagged with: java
tagged with: gradle
has title: completely messed up my android studio app's package setup
type: Question
has comment: http://stackoverflow.com/comment/44003601
answer count: 1
downvote count: 0
has body: my android studio app package setup is all messed up and when I try to compile my app it cannot find my MainActivity class What happened is when I first imported my project from eclipse it made all my source folders into different packages so I got rid of the packages and made them just regular source dirs. my hierarchy is now like this TestApp/app/src/main/java/ TestApp/app/src/main/java/Base TestApp/app/src/main/java/Adapters TestApp/app/src/main/java/Interfaces and has no packages at all just regular java src dirs there is no root package directory anymore and I don't know how to put one back in. Please help! PS: here is the full error that comes up Unexpected error: Error: Activity class {com.L33TRUS.TestApp/MainActivity} does not exist. my MainActivity.java file is inside the TestApp/app/src/main/java/Base/ folder
favorite count: 0
tagged with: android
tagged with: android-studio
tagged with: package
upvote count: 1
has answer: http://stackoverflow.com/a/27585288
accepted answer: http://stackoverflow.com/a/27585288
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/27537944
answers question: http://stackoverflow.com/q/27537787
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27537787
has body: Just change asSortedList to public static &lt;T&gt; List&lt;T&gt; asSortedList( Collection&lt;T&gt; c, Comparator&lt;? super T&gt; comparator) ...since T is a subtype of Bacon, and your Comparator is a Comparator&lt;Bacon&gt;.
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/q/27561735
tagged with: jackson
linked to: http://stackoverflow.com/q/2414105
has comment: http://stackoverflow.com/comment/43569953
has comment: http://stackoverflow.com/comment/43626316
has title: Retained Heap size is more while using jackson ObjectMapper
answer count: 1
has answer: http://stackoverflow.com/a/27577564
has comment: http://stackoverflow.com/comment/43621995
favorite count: 0
score: 8
upvote count: 8
tagged with: heap-memory
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/43618157
tagged with: java
has comment: http://stackoverflow.com/comment/43650548
type: Question
has comment: http://stackoverflow.com/comment/43635457
has body: Am using Jackson mapper to convert my java objects to String, But these objects are not removed by GC in heap. My code List&lt;Object[]&gt; reportList; // This contains my objects ObjectMapper map = new ObjectMapper(); // org.codehaus.jackson.map.ObjectMapper return map.writeValueAsString(reportList); This returns String to my view layer, But Objects parsed via object mapper retained in heap. I have taken heap dump. Class Name | Objects | Shallow Heap | Retained Heap ------------------------------------------------------------------ char[] | 5,03,267 | 5,48,74,336 | &gt;= 54,874,336 byte[] | 18,067 | 3,09,01,016 | &gt;= 30,901,016 java.lang.reflect.Method| 2,60,262 | 2,08,20,960 | &gt;= 32,789,040 java.util.HashMap$Entry | 4,31,423 | 1,38,05,536 | &gt;= 92,963,752 java.lang.String | 4,97,172 | 1,19,32,128 | &gt;= 60,889,416 ------------------------------------------------------------------ While seeing char Class Name | Shallow Heap | Retained Heap ----------------------------------------------------------------------------------------------------- [2] char[4][] @ 0x72119e690 | 32 | 5,28,352 '- _charBuffers org.codehaus.jackson.util.BufferRecycler @ 0x72119e658| 24 | 5,28,408 ----------------------------------------------------------------------------------------------------- Class Name | Shallow Heap | Retained Heap ----------------------------------------------------------------------------------------------------- [2] char[4][] @ 0x721158a78 | 32 | 5,28,352 '- _charBuffers org.codehaus.jackson.util.BufferRecycler @ 0x721158a40| 24 | 5,28,408 ----------------------------------------------------------------------------------------------------- Class Name | Shallow Heap | Retained Heap ----------------------------------------------------------------------------------------------------- [2] char[4][] @ 0x7210bc5e0 | 32 | 5,28,352 '- _charBuffers org.codehaus.jackson.util.BufferRecycler @ 0x7210bc5a8| 24 | 5,28,408 -----------------------------------------------------…
downvote count: 0

http://stackoverflow.com/a/27482025
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27481887
has body: According to the documentation fo FileOutputStream, there are a few constructors for the FileOutputStream class: Using a File object Using a File object and a boolean Using a FileDescriptor object Using a String object Using a String object and a boolean value Since you're using a constructor which you supply with one parameter, you're using either option 1, 3 or 5. The board variable has type GameBoard, which is not File, FileDescriptor or String, so the compiler tells you there is no constructor that matches the type of variable board. The easiest is to give the FileOutputStream constructor a filename to write to. Other options are a File object or a FileDescriptor.

http://stackoverflow.com/q/27607498
has body: I am trying to see if the multidimensional array is rectangular or not. I am new to programming and can't exactly figure out why the "break;" will not kick me out of the loop and it continues to run. Even with the array not being rectangular, I still get back true. public static void main(String[] args) { int a2d[][] = {{1, 2, 3, 4, 5}, {2, 3, 4}, {1, 2, 3, 4, 5}}; int test = a2d[0].length; for (int i = 0; i &lt; a2d.length; i++) { for (int j = 0; j &lt; a2d[i].length; j++) { if (a2d[i].length == test) { System.out.println("True"); } else { System.out.println("False"); break; } } } }
has answer: http://stackoverflow.com/a/27607667
tagged with: break
score: 3
has title: Conditionally breaking for loops in Java
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/43637092
duplicate of: http://stackoverflow.com/q/886955
downvote count: 1
has answer: http://stackoverflow.com/a/27607631
type: Question
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/27607696
has comment: http://stackoverflow.com/comment/43637184
favorite count: 0
has comment: http://stackoverflow.com/comment/43637126
linked to: http://stackoverflow.com/q/886955
linked to: http://stackoverflow.com/q/3821827
type: UnansweredQuestion

http://stackoverflow.com/a/27487457
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27487385
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27487385
score: 3
has body: When you create a JFrame, the program starts a new thread running the message loop. It won't terminate while this loop is running. Simplest thing is to just call System.exit(0).

http://stackoverflow.com/a/27604603
has comment: http://stackoverflow.com/comment/43639873
has comment: http://stackoverflow.com/comment/43639800
upvote count: 2
type: AcceptedAnswer
has body: You can easily write one yourself: public static&lt;T&gt; List&lt;T&gt; append (List&lt;T[]&gt; input) { List&lt;T&gt; res = new ArrayList&lt;T&gt;(); for(T[] subarr : input) { if(subarr != null) { int n = subarr.length; for(int i = 0; i &lt; n; i++) { res.add(subarr[i]); } } } return res; } The function appends the different arrays and null arrays are ignored, null elements are however not. Thus if the input is [null,[a,b],[null,null],[c,null,d],null]. The output is [a,b,null,null,c,null,d].
has comment: http://stackoverflow.com/comment/43631454
accepted answer of: http://stackoverflow.com/q/27604551
answers question: http://stackoverflow.com/q/27604551
type: Answer
has comment: http://stackoverflow.com/comment/43631385
score: 2
downvote count: 0

http://stackoverflow.com/comment/43531661
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27552694
has text: Also, by "time complexity" do you mean big-O or something, or are you just talking about "run time"?

http://stackoverflow.com/comment/43432774
comment on: http://stackoverflow.com/q/27500677
score: 0
type: Comment
type: QuestionComment
has text: When merging everything is added to the first level cache. Each time you merge all the objects in the first level cache are checked if they need to be persisted. So the more objects you add, the longer that check will take. To fix after each X iterations, do a flush and clear of the EntityManager.

http://stackoverflow.com/q/27573312
tagged with: file-io
has answer: http://stackoverflow.com/a/27573352
favorite count: 0
has answer: http://stackoverflow.com/a/27573363
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27575055
has answer: http://stackoverflow.com/a/27573354
score: 3
has title: How can I just use the relative file name instead of the absolute file name?
downvote count: 0
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/27573432
type: Question
has body: I am having my program read a .txt file and I don't want to use the absolute file name because it is machine dependent and I just want to use the relative file name. I don't know how to get it to do that. Here is the part of my program I am talking about: private List&lt;String&gt; readFile() { List&lt;String&gt; wordsList = new ArrayList&lt;&gt;(); try { String fileName = "C:/Users/Phil/Documents/FourLetterWords.txt"; File fourLetterWords = new File(fileName); Scanner in = new Scanner(fourLetterWords); while (in.hasNextLine()) { String line = in.nextLine(); if (line!=null &amp;&amp; !line.isEmpty()) { wordsList.add(line); } } } catch (FileNotFoundException ex) { System.out.println("File not found."); } return wordsList ; } If I were to make it just: "C:/FourLetterWords.txt" then my catch exception comes in and says File not found. But I really just want to use... "FourLetterWords.txt"
has comment: http://stackoverflow.com/comment/43572164
upvote count: 3

http://stackoverflow.com/q/27517893
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43465782
downvote count: 1
type: Question
has body: A sample of the statement to type when using the method is System.arraycopy(data, i, data, i+1, data.length-i-1); The way it works according to my book is that the system move all element from i onward one position up. But intuitively I will think that the method will move all the element after i one position down. So there is empty space to put the copied element. I am confused now as to how to move elements around in the same array. What does the statement really say?
tagged with: arrays
has title: How does the System.arraycopy method work?
has comment: http://stackoverflow.com/comment/43466711
has comment: http://stackoverflow.com/comment/43467110
answer count: 1
linked to: http://stackoverflow.com/q/80476
has answer: http://stackoverflow.com/a/27517943
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/43682034
comment on: http://stackoverflow.com/q/27528275
type: QuestionComment
type: Comment
has text: @TravisJ Thanks a lot. I will consider another solution using Spark:)
score: 0

http://stackoverflow.com/a/27589658
has body: InstanceMethodClass::testStr has 3 arguments - the two arguments of the method - String str1,String str2, and the InstanceMethodClass instance for which it is called. Arrays.sort expects a Comparator&lt;String&gt;, which requires a method with 2 String arguments. Your InstanceMethodClass::testStr doesn't match. If you change testStr to be static, you will get rid of the InstanceMethodClass argument, and it should work.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27589621
type: Answer
has comment: http://stackoverflow.com/comment/43604057
accepted answer of: http://stackoverflow.com/q/27589621
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/43603415

http://stackoverflow.com/comment/43596377
type: QuestionComment
comment on: http://stackoverflow.com/q/27578348
score: 0
has text: I've restarted several times, problem still exist. The latest Android Studio uses IntelliJ, previous Android Studio was associated with Eclipse.
type: Comment

url
tags question: http://stackoverflow.com/q/27506355
tags question: http://stackoverflow.com/q/27484606
tag name: url
tags question: http://stackoverflow.com/q/27537766
tags question: http://stackoverflow.com/q/27624740
tags question: http://stackoverflow.com/q/27591709
tags question: http://stackoverflow.com/q/27537703
tags question: http://stackoverflow.com/q/27615328
tags question: http://stackoverflow.com/q/27577695
tags question: http://stackoverflow.com/q/27525874
tags question: http://stackoverflow.com/q/27490959
tags question: http://stackoverflow.com/q/27611424
tags question: http://stackoverflow.com/q/27562766
tags question: http://stackoverflow.com/q/27540090
tags question: http://stackoverflow.com/q/27550927
type: Tag
tags question: http://stackoverflow.com/q/27638754

http://stackoverflow.com/comment/43450521
type: Comment
type: QuestionComment
has text: yes I tried it, and it didn't work.
score: 0
comment on: http://stackoverflow.com/q/27508859

http://stackoverflow.com/comment/78509132
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27677257
type: AnswerComment
has text: Yes, I created the diagram with IntelliJ. IntelliJ however uses yFiles under the hood (as noted by the watermark).

http://stackoverflow.com/a/27626319
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27626221
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43673543
has comment: http://stackoverflow.com/comment/43673923
has body: You're initializing sb every time you enter the loop, meaning that you're disposing of your StringBuilder every time you enter the loop and recreate it with only the next subtring. Fixed: String relativeDN = "cn=abc,dn=xyz,ou=abc/def"; String[] stringData = relativeDN.split(","); StringBuilder sb = new StringBuilder(); CharSequence charAdded = ","; for (String stringoutput : stringData) { System.out.print(stringoutput); sb.append(stringoutput).append(charAdded); } sb.setLength(sb.length() - 1); System.out.print(sb.toString());

http://stackoverflow.com/comment/43697906
type: AnswerComment
type: Comment
has text: That's not ok. Define a common interface, then sub interfaces and the implementation of each for your specific database. Note that your database engine could change from MySQL to another rdbms, similar with Redis.
comment on: http://stackoverflow.com/a/27638589
score: 0

http://stackoverflow.com/a/27614598
has comment: http://stackoverflow.com/comment/43655738
has comment: http://stackoverflow.com/comment/43655165
has body: If you are writing same code in after every method like logging entering , existing the method or if you have same kind of exception handling for each method, then you should go fore some aspect oriented framework like aspectj and write code at one place instead of calling from everywhere. In Aspect you need to define pointcuts and you will get your class name and method name from parameters. You can use simple aspectj framework or Spring AOP if you are using Spring. Apart from that there are other frameworks for aspect oriented coding. You just need to define some wildcard entries for your methods and classes and your aspect code automatically will be called after method calls. http://www.javacodegeeks.com/2014/02/applying-aspect-oriented-programming.html http://www.javatpoint.com/spring-aop-tutorial
score: 1
has comment: http://stackoverflow.com/comment/43652523
answers question: http://stackoverflow.com/q/27601781
upvote count: 1
has comment: http://stackoverflow.com/comment/43656038
has comment: http://stackoverflow.com/comment/43655693
has comment: http://stackoverflow.com/comment/43652770
has comment: http://stackoverflow.com/comment/43652912
downvote count: 0
has comment: http://stackoverflow.com/comment/43652665
type: Answer
has comment: http://stackoverflow.com/comment/43655321

http://stackoverflow.com/a/27600395
accepted answer of: http://stackoverflow.com/q/27600309
score: 2
has body: A NullPointerException normally says that an object that is needed to be not null is null. Here, this is probably mainFrame. Java is not C++, so the statement is equal to: MainFrame mainFrame = null; You should change this so that mainFrame is not null. There are two ways: assign value in declaration: MainFrame mainFrame = new MainFrame(); assign value in constructor: private MainFrame mainFrame; // don't must be private public PartLogin () { super(); // call ctor of superclass mainFrame = new MainFrame(); // ... }
downvote count: 0
answers question: http://stackoverflow.com/q/27600309
has comment: http://stackoverflow.com/comment/43623941
upvote count: 2
has comment: http://stackoverflow.com/comment/43624137
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27577403
has comment: http://stackoverflow.com/comment/127973873
has title: Non empty collections always marked dirty after Hibernate merge of detached object
type: UnansweredQuestion
upvote count: 4
has body: I wasn't expecting this behaviour and unsure whether it's a bug or by design. We have a parent object with a List of child objects. It's a uni-directional relationship using a join table. If a client requests a parent object merge, Hibernate increments the version of the parent object even though none of its details have changed. I wasn't expecting the parent object version to change as, logically, the parent object is exactly the same. Does anyone have an explanation? Note 1: it's due to the collection being marked as dirty in the flush, however this doesn't happen if the collection is empty or the parent object doesn't contain a collection Note 2: very similar to https://hibernate.atlassian.net/browse/HHH-3007 which has been auto closed due to inactivity Note 3: using Hibernate 4.3.7.Final, but tested same behaviour in Hibernate 3 Test to reproduce @Test public void testCreateAndUpdate() throws Exception { // POST from client - note: deptartment object containing a single empty employee String jsonFromClient = "{\"employees\":[{}]}"; Department department = mapper.readValue(jsonFromClient, Department.class); Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); session.persist(department); tx.commit(); // simulates sending it back to client String jsonToClient = mapper.writeValueAsString(department); System.out.println(jsonToClient); // {"id":1,"version":0,"employees":[{"id":1,"version":0}]} // PUT from client, but nothing has actually changed jsonFromClient = jsonToClient; department = mapper.readValue(jsonFromClient, Department.class); // new session emulates the client updating the Department session = sessionFactory.openSession(); tx = session.beginTransaction(); department = (Department) session.merge(department); tx.commit(); // NOTE: PARENT VERSION INCREMENTED!! jsonToClient = mapper.writeValueAsString(department); System.out.println(jsonToClient); // {"id":1,"version":1,"employees":[{"id":1,"version":0}]} } Department…
answer count: 0
downvote count: 0
favorite count: 0
type: Question
score: 4
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27497811
tagged with: java
has title: Java zip - zip unwanted directory
has comment: http://stackoverflow.com/comment/43427255
type: Question
answer count: 2
tagged with: playframework
has comment: http://stackoverflow.com/comment/43427623
downvote count: 0
possible better answer: http://stackoverflow.com/a/27497998
has answer: http://stackoverflow.com/a/27497998
has comment: http://stackoverflow.com/comment/43427122
has comment: http://stackoverflow.com/comment/43427733
has body: I'm an OSX user and currently using Play Framework, there is a weird issue when I use java.util.zip to zip some files in a folder. The files will be auto generated (Done) into /Users/vorsz/Desktop/MonthlyReport/August. But when I try to zip them using below code: val baseURL: String = "/Users/vorsz/Desktop/MonthlyReport/" val directoryToZip = new File(baseURL+"August").mkdir() val writer = new PrintWriter(baseURL+"August/test.html", "UTF-8") writer.println(" 45296 2014-07-23 2014-08-01 010194 120 C-00322 ANK 007 ") writer.close() val writer1 = new PrintWriter(baseURL+"August/test2.html", "UTF-8") writer1.println(" 45296 2014-07-23 2014-08-01 010194 120 C-00322 ANK 007 ") writer1.close() val f = new FileOutputStream(baseURL+"test.zip") val zip = new ZipOutputStream(new BufferedOutputStream(f)) zip.putNextEntry(new ZipEntry(baseURL+"August/test.html")) zip.putNextEntry(new ZipEntry(baseURL+"August/test2.html")) zip.close() It will produce a zip file in a right folder, however when I extract it, it produces some unwanted folders like Users,vorsz,Desktop and MonthlyReport. So I need to open them up until I can access test.html and test2.html. What I want when I extract the zip file is only an August Folder with its files or the files itself, both way if possible. Can anyone help me here ? Note: I also had tried implementing ZipUtils class, but still got same result..
favorite count: 0
has comment: http://stackoverflow.com/comment/43427484
has answer: http://stackoverflow.com/a/27498347
upvote count: 1
accepted answer: http://stackoverflow.com/a/27498347
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15968883
score: 1
has comment: http://stackoverflow.com/comment/43427402

http://stackoverflow.com/q/27615772
has title: Array out of bound exception?
has body: Consider the following code: Map&lt;Integer, Material&gt; TestMap= new HashMap&lt;Integer, Material&gt;(); if (TestMap.get(index)!= null) { index++; } What will happen if TestMap.get(index) is null? Some say it will exit the code, some say it will throw ArrayIndexOutOfBoundsException.
has comment: http://stackoverflow.com/comment/43653053
upvote count: 0
has comment: http://stackoverflow.com/comment/43653312
downvote count: 5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27615862
score: -5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27615862
answer count: 1
has comment: http://stackoverflow.com/comment/43653052
has comment: http://stackoverflow.com/comment/43653054
favorite count: 0
has comment: http://stackoverflow.com/comment/43653181

http://stackoverflow.com/comment/43522592
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27548206
has text: You haven't explained how you're trying to run the class. If you're using the old run configuration, then yes - it will fail. So right-click on the class and select "Run As..." and then you'll create a new run configuration.

http://stackoverflow.com/a/27551133
answers question: http://stackoverflow.com/q/27550977
score: 0
type: Answer
has body: You have added those prints in Constructor. System.out.print(i); System.out.print(" | "); System.out.print(Thread.currentThread().getName()); System.out.println(); So It will prints the output while creating objects. Note : Until you call the method start its a simple java Object

http://stackoverflow.com/comment/43541958
type: QuestionComment
comment on: http://stackoverflow.com/q/27557064
has text: Yes I can see when i have everything together it is a bit harder to navigate through the code
score: 0
type: Comment

http://stackoverflow.com/comment/43634607
type: Comment
comment on: http://stackoverflow.com/a/27605131
score: 0
type: AnswerComment
has text: oh, thanks. I have small question about that org.w3c.dom.Node/Element, how to convert it to String with HTML?

http://stackoverflow.com/comment/43658670
type: QuestionComment
has text: I have done that but the problem I am facing is TCPClient requires a port number. Do wifi routers have a port number? I am searching on google and I am still not able to find what is the port number of my router.
comment on: http://stackoverflow.com/q/27618694
score: 0
type: Comment

http://stackoverflow.com/q/27481528
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: session-cookies
type: Question
has answer: http://stackoverflow.com/a/27482166
tagged with: java
has body: I have problem with a Java Applet that I can't get to send the proper cookie. The flow is as follows: Without the crossdomain.xml file on port 80 the Applet just refuses to do any CORS request at all but with the crossdomain-file the requests comes through BUT without any cookies. However the client certificate is sent in the request. It is also worth mentioning that the JNLP is downloaded from the same domain as the REST interface which should allow Java to communicate with that domain. How can I make Java make the REST requests using cookies. The session cookie does not have HTTP_ONLY or Secure flag enabled.
score: 5
tagged with: crossdomain.xml
answer count: 1
downvote count: 0
tagged with: applet
has title: How can I make a Java Applet do crossdomain request with client certificate and session-cookie?

http://stackoverflow.com/q/27544466
favorite count: 0
tagged with: package
has body: Generally we structure package structure based on below convention we form a unique package name by first having (or belonging to an organization that has) an Internet domain name, such as sun.com. You then reverse this name, component by component, to obtain, in this example, com.sun, and use this as a prefix for your package names, using a convention developed within your organization to further administer package names. I am working in a company abc which has website with domain abc.com. Now i am building a product xyz which does not have any domain and website. Different clients will buy it and then get domains for themselves. My question is should package name by convention start with com.abc or com.xyz
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43515738
has answer: http://stackoverflow.com/a/27544539
type: Question
tagged with: naming-conventions
possible better answer: http://stackoverflow.com/a/27544539
has answer: http://stackoverflow.com/a/27545560
answer count: 3
has answer: http://stackoverflow.com/a/27544553
upvote count: 1
accepted answer: http://stackoverflow.com/a/27544553
has title: Package structure naming convention?

http://stackoverflow.com/comment/43471133
type: AnswerComment
type: Comment
has text: I have created another question for the above error http://stackoverflow.com/q/27520496/599528
comment on: http://stackoverflow.com/a/27510548
score: 0

http://stackoverflow.com/q/27607509
favorite count: 0
has answer: http://stackoverflow.com/a/27607738
type: AnsweredQuestion
has body: I have written an annotation processor. The user can pass an option as parameter for the processor. I can also read this parameter in my annotation processor. So far so good, everything works like expected! However, I get a warning from the compiler, that the option passed to the annotation processor has not been recorgnized by any annotation processor: Warning:The following options were not recognized by any processor: '[fragmentArgsLib]' Actually, my processor has recognized and read this option successfully: @Override public boolean process(Set&lt;? extends TypeElement&gt; type, RoundEnvironment env) { String fragementArgsLib = processingEnv.getOptions().get("fragmentArgsLib"); ... } I guess I have to say manually that I have used this option to make this compiler warning disappear. Does anyone of you know how to do that?
has comment: http://stackoverflow.com/comment/43637145
score: 7
tagged with: java
upvote count: 7
type: Question
tagged with: annotation-processing
accepted answer: http://stackoverflow.com/a/27607738
has title: AnnotationProcessor option not recorgnized by any processor
has comment: http://stackoverflow.com/comment/43637090
downvote count: 0
answer count: 1

http://stackoverflow.com/q/27534111
upvote count: 1
answer count: 0
tagged with: java
tagged with: jax-ws
tagged with: datasource
type: Question
downvote count: 0
tagged with: apache-tomee
favorite count: 0
tagged with: jdbc
score: 1
has title: TomEE Exception when trying to access datasource from JAX-WS
has body: I have class called ConnectionManager public class ConnectionManager{ public static getDBConnection() { Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mydb"); return ds.getConnection(); } } When it tried to call this class from jsp page, servlet, jax-rs restful service, it just works fine. However, I go the following exception when i try to call ConnectionManager.getDBConnection() from JAX-WS web service: Name [comp/env/jdbc/mydb] is not bound in this Context. Unable to find [comp]. Please note that i defined the Resource inside TomEE_HOME/conf/context.xml: &lt;Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" username="user" password="pass" driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://10.x.x.x:xxxx;databaseName=MyDBName"/&gt; Please advice.
type: UnansweredQuestion

http://stackoverflow.com/comment/43662219
type: QuestionComment
comment on: http://stackoverflow.com/q/27620570
has text: @Brovoker, I have 2 dates for my true/false test - 12/1/2014, 12/23/2014. Renaming didn't work either.
score: 0
type: Comment

http://stackoverflow.com/comment/43400994
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27483422
has text: My fault, I added the wrong code, I edited It.. That's the code that doesn't work

http://stackoverflow.com/q/27528148
tagged with: rest
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27529030
has title: Sending JSON Request to restful weservice to JAXB object
upvote count: 1
has body: My Web Service consumes "text/xml" and produces "text/xml". Am sending request parametes in request body like below &lt;?xml version="1.0"?&gt; &lt;sx1:user xmlns:sx1="http://www.abcd.com/service/user/dto" xmlns:sx2="http://www.abcd.com/service/common/student/dto"&gt; &lt;sx1:getUserType&gt; &lt;sx1:username&gt;user1&lt;/sx1:username&gt; &lt;sx1:userexists&gt;true&lt;/sx1:userexists&gt; &lt;sx1:student/&gt; &lt;/sx1:getUserType&gt; &lt;/sx1:user&gt; I would like to do the same for JSON format. With the help of jersey-jackson jar i could able to produce JSON as a response by using @Consumes("text/xml") @Produces("text/xml") So my question is how can i send JSON request to my service (which is a JAXB object compiled from my xsd with namespace)
has answer: http://stackoverflow.com/a/27632129
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: jaxb
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/43430013
score: 0
comment on: http://stackoverflow.com/q/27499522
type: QuestionComment
type: Comment
has text: @Thilo Sorry, you are right. `int` to `double` is lossless but `int` to `float` cannot be for the reason you mention. The implicit conversion still takes place, however. I'll look up where this is defined.

http://stackoverflow.com/q/27530383
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/43490995
possible better answer: http://stackoverflow.com/a/27530599
type: Question
has comment: http://stackoverflow.com/comment/43490753
has answer: http://stackoverflow.com/a/27531080
accepted answer: http://stackoverflow.com/a/27531273
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/43489401
has comment: http://stackoverflow.com/comment/43489470
tagged with: execution
has comment: http://stackoverflow.com/comment/43489473
score: 0
has title: Which is a more efficient way to write this block of code
answer count: 3
tagged with: for-loop
has comment: http://stackoverflow.com/comment/43490572
has comment: http://stackoverflow.com/comment/43489655
has comment: http://stackoverflow.com/comment/43490665
has comment: http://stackoverflow.com/comment/43489983
has comment: http://stackoverflow.com/comment/43489530
favorite count: 0
has comment: http://stackoverflow.com/comment/43489959
has body: I am writing a module that will generate a DDL based on certain input files. I am trying to figure out which way is more efficient. This: for (int i = 0; i &lt; Common.testFields.size(); i++) { line = ""; line += " " + Common.testFields.get(i).toString() + " "; line += Common.dataTypes.get(i).toString(); if (i != Common.testFields.size() - 1) line += ","; ddl += line; if (i != Common.testFields.size() - 1) ddl += "\n"; } or this: for (int i = 0; i &lt; Common.testFields.size(); i++) { line = ""; line += " " + Common.testFields.get(i).toString() + " "; if (i == Common.testFields.size() - 1) { line += Common.dataTypes.get(i).toString(); ddl += line; } else { line += Common.dataTypes.get(i).toString() + ","; ddl += line + "\n"; } } I timed the execution for both for loops using System.currentTimeMillis(), but when I print out the elapsed time, it prints out 1 millisecond for both. Common.testFields.size() is currently 165. Considering the fact that both of these have the same complexity of O(n), If Common.testFields.size() were considerably larger, say 1000 or even 10000 times larger than it is currently, which one of these,if any, would be faster?
has answer: http://stackoverflow.com/a/27531273
has comment: http://stackoverflow.com/comment/43489559
has comment: http://stackoverflow.com/comment/43489817
has answer: http://stackoverflow.com/a/27530599
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43491146

http://stackoverflow.com/comment/43533273
type: QuestionComment
has text: you have to set them always in a method..
score: 2
comment on: http://stackoverflow.com/q/27553538
type: Comment

http://stackoverflow.com/a/27616285
downvote count: 0
has comment: http://stackoverflow.com/comment/43654164
upvote count: 2
type: AcceptedAnswer
has body: You need to close your FileWriter fileWriter.close(); As Suggested by JoeBlade, this should be done in a finally block : } catch (IOException e){ e.printStackTrace(); } finally { if (fileWriter != null) { fileWriter.close(); } }
type: Answer
answers question: http://stackoverflow.com/q/27616250
score: 2
accepted answer of: http://stackoverflow.com/q/27616250

http://stackoverflow.com/q/27560783
has title: Libgdx: Translating a Scene2d Camera
score: 0
has answer: http://stackoverflow.com/a/27567422
answer count: 1
accepted answer: http://stackoverflow.com/a/27567422
has body: I'm working on a tile based game with Libgdx that moves the map using WASD. I'm using the scene2d features to draw the screen, and the TiledMap that I'm rendering shows up just fine. But when I try and call the stage.getCamera().translate(float x, float y, float z); method to move the viewport with Gdx.Input.IsKeyPressed() method, the viewport does not translate. The method is getting called, because "KEY PRESSS" is being output onto the console, but the camera is not translating. Is there another method to moving the viewport? Does the Stage class have some other method to move the camera? Here's my source for the Screen: package com.BurntToast.SolidDiamond; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.maps.tiled.TiledMap; import com.badlogic.gdx.maps.tiled.TmxMapLoader; import com.badlogic.gdx.maps.tiled.renderers.OrthogonalTiledMapRenderer; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pool; import com.badlogic.gdx.utils.viewport.FitViewport; public class PlayScreen implements Screen { private MainFrame mainFrame; private OrthographicCamera camera; private Vector3 touchCoord; private TiledMap currentMap; private OrthogonalTiledMapRenderer otmr; private ConveyorActor convActor; private Stage mapStage; public PlayScreen(MainFrame passedGame){ mainFrame = passedGame; convActor = new ConveyorActor(mainFrame.conveyorFrames, 1, 0, 0); mapStage = new Stage(); mapStage.addActor(convActor); currentMap = new TmxMapLoader().load("maps/MenuMap2.tmx"); otmr = new OrthogonalTiledMapRenderer(currentMap); otmr.setView((OrthographicCamera)mapSta…
type: AnsweredQuestion
type: Question
tagged with: libgdx
tagged with: scene2d
tagged with: java

http://stackoverflow.com/q/27589543
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/66126958
score: 10
has comment: http://stackoverflow.com/comment/87920058
upvote count: 11
has comment: http://stackoverflow.com/comment/43604371
accepted answer: http://stackoverflow.com/a/27590297
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43605847
has answer: http://stackoverflow.com/a/27590297
tagged with: log4j
favorite count: 0
has body: I am developing a project which accesses the database but im having some problems. I try to use hibernate 3.2 and 4.52 but it doesn't work. log4j:WARN No appenders could be found for logger (org.jboss.logging). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" java.lang.NoSuchFieldError: TRACE at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:60) at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35) at org.jboss.logging.Logger.logv(Logger.java:1953) at org.jboss.logging.DelegatingBasicLogger.tracev(DelegatingBasicLogger.java:89) at org.hibernate.cfg.EJB3DTDEntityResolver.resolveEntity(EJB3DTDEntityResolver.java:59) at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:110) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:994) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1154) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) at com.sun.org.apache.xerces.inter…
has comment: http://stackoverflow.com/comment/43604487
has title: Exception in thread "main" java.lang.NoSuchFieldError: TRACE

android-layout
tags question: http://stackoverflow.com/q/27550048
tags question: http://stackoverflow.com/q/27552455
tag name: android-layout
tags question: http://stackoverflow.com/q/27494179
tags question: http://stackoverflow.com/q/27596380
tags question: http://stackoverflow.com/q/27534512
tags question: http://stackoverflow.com/q/27484486
tags question: http://stackoverflow.com/q/27568537
type: Tag
tags question: http://stackoverflow.com/q/27498900
tags question: http://stackoverflow.com/q/27631587
tags question: http://stackoverflow.com/q/27608212
tags question: http://stackoverflow.com/q/27629121

http://stackoverflow.com/q/27560775
has comment: http://stackoverflow.com/comment/43555880
answer count: 0
type: UnansweredQuestion
tagged with: spring
has body: I am trying to update a BLOB column in my database as follows using Session.doWork() in hibernate: PreparedStatement pStmt = null; ResultSet rs = null; try { String sql = " SELECT " + "ITEM_IMAGE" + " FROM " + "ITEM_IMAGES" + " WHERE " + "ITEM_CODE" + " = ? " + " FOR UPDATE"; pStmt = con.prepareStatement(sql,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE); pStmt.setString(1, fileDesign.getItem_code()); rs = pStmt.executeQuery(); if (rs.next()) { Blob blob = rs.getBlob("ITEM_IMAGE"); blob.truncate(0); blob.setBytes(1, fileDesign.getFile()); //here getFile() returns byte[] and causes exception here rs.updateBlob("ITEM_IMAGE", blob); rs.updateRow(); } } finally { if(rs != null) rs.close(); if(pStmt != null) pStmt.close(); } Above code works just fine in my local system but produces following exception in production enviroment: org.hibernate.exception.GenericJDBCException: error executing work at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:2001) at com.arex.cbs.dao.DesignMasterDaoImpl.saveDesignActionGifUpload(DesignMasterDaoImpl.java:432) at com.arex.cbs.service.DesignMasterManagerImpl.saveDesignActionGifUpload(DesignMasterManagerImpl.java:98) at com.arex.cbs.controller.DesignController.saveDesignActionGIF(DesignController.java:658) 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.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:175) at org.springf…
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43551149
has comment: http://stackoverflow.com/comment/43602745
type: Question
linked to: http://stackoverflow.com/q/2126607
has comment: http://stackoverflow.com/comment/43551402
has title: java.sql.SQLException while updating BLOB data in Oracle db
has comment: http://stackoverflow.com/comment/43551306
score: 0
tagged with: oracle-database
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/2126607

gwt
tags question: http://stackoverflow.com/q/27550399
tags question: http://stackoverflow.com/q/27617354
tags question: http://stackoverflow.com/q/27638443
tags question: http://stackoverflow.com/q/27551276
tags question: http://stackoverflow.com/q/27618638
tag name: gwt
tags question: http://stackoverflow.com/q/27599758
tags question: http://stackoverflow.com/q/27582243
tags question: http://stackoverflow.com/q/27502322
tags question: http://stackoverflow.com/q/27594087
type: Tag
tags question: http://stackoverflow.com/q/27522728
tags question: http://stackoverflow.com/q/27533785
tags question: http://stackoverflow.com/q/27599583
tags question: http://stackoverflow.com/q/27521731
tags question: http://stackoverflow.com/q/27627471
tags question: http://stackoverflow.com/q/27544278
tags question: http://stackoverflow.com/q/27607168
tags question: http://stackoverflow.com/q/27630564
tags question: http://stackoverflow.com/q/27609167
tags question: http://stackoverflow.com/q/27620471
tags question: http://stackoverflow.com/q/27588445
tags question: http://stackoverflow.com/q/27588056
tags question: http://stackoverflow.com/q/27620987
tags question: http://stackoverflow.com/q/27526310
tags question: http://stackoverflow.com/q/27581492
tags question: http://stackoverflow.com/q/27609071
tags question: http://stackoverflow.com/q/27479391
tags question: http://stackoverflow.com/q/27509439
tags question: http://stackoverflow.com/q/27483681

http://stackoverflow.com/q/27498506
tagged with: report
tagged with: subreport
tagged with: reporting-services
has answer: http://stackoverflow.com/a/27518890
type: AnsweredQuestion
tagged with: java
has body: I am using Jaspersoft studio to create reports. I am having a sub report in my Jasper main report. The problem is I am unable to make this work, because if I add the sub report into the Detail band of the main report, the sub report get generated number of times, sometimes row by row, sometimes entire sub report repeated in number of pages. I can't put this in Summery Band due to the same reason. I am unable to put this in Column Footer Band or other footers because it displays the below error net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Subreport overflowed on a band that does not support overflow. at com.jaspersoft.studio.editor.preview.view.control.ReportControler.fillReport(ReportControler.java:467) at com.jaspersoft.studio.editor.preview.view.control.ReportControler.access$18(ReportControler.java:442) at com.jaspersoft.studio.editor.preview.view.control.ReportControler$4.run(ReportControler.java:334) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: net.sf.jasperreports.engine.JRRuntimeException: Subreport overflowed on a band that does not support overflow. at net.sf.jasperreports.engine.fill.FillerSubreportParent.addPage(FillerSubreportParent.java:113) at net.sf.jasperreports.engine.fill.JRBaseFiller.addPageToParent(JRBaseFiller.java:1213) at net.sf.jasperreports.engine.fill.JRVerticalFiller.addPage(JRVerticalFiller.java:1836) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBreak(JRVerticalFiller.java:1919) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBreak(JRVerticalFiller.java:1948) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:730) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:124) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:540) at net.sf.jasperreports.engine.…
type: Question
tagged with: jasper-reports
has title: Unable to make sub reports with Jasper
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27518890

http://stackoverflow.com/comment/43423074
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27495153
has text: @David Oh yes you are right. that else statements are useless

http://stackoverflow.com/q/27558264
score: -1
has body: I'm having some trouble with reading an arraylist from file in Java. I have a "User" class which implements Serializable, so when I go to save an ArrayList of these users it seems to work fine - but when I try read them it's a different story. ava.lang.ClassCastException: User cannot be cast to java.util.ArrayList The Code I have for reading in is as follows .. private List&lt;User&gt; userList = new ArrayList&lt;User&gt;(); public void readList() throws FileNotFoundException, IOException, ClassNotFoundException { System.out.println("Trying to read list.."); FileInputStream fis = new FileInputStream("userList.txt"); ObjectInputStream ois = new ObjectInputStream(fis); System.out.println("Created Streams...."); userList = ((ArrayList&lt;User&gt;)ois.readObject()); ois.close(); } Has anyone has similar problems or know how to help me out? Thanks.
tagged with: arraylist
answer count: 1
has answer: http://stackoverflow.com/a/27558424
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/43542995
type: UnansweredQuestion
tagged with: classcastexception
tagged with: java
has comment: http://stackoverflow.com/comment/43542772
downvote count: 1
type: Question
has title: Object Cannot Be Cast to ArrayList
upvote count: 0

http://stackoverflow.com/comment/43513631
has text: @tinker101 and if no record is deleted because user not exists?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27542271
type: Comment

http://stackoverflow.com/a/42529045
type: Answer
has body: This is the code in the client application and I can nothing change here. The "regex" variable is the given string and "scannedValue" is the user input (123456). The given string is in my concrete example 00123456. Like I wrote before, I cannot manipulate 00123456. I can only add regex before or after it, for example ???00123456???. And 00???123456 is not possible. scannedValue.matches(regex) The regex rules make the fulfillment of your wish impossible.
answers question: http://stackoverflow.com/q/27541211
score: 0

http://stackoverflow.com/comment/43520417
type: QuestionComment
comment on: http://stackoverflow.com/q/27546965
has text: You mean calling a servlet from a servlet ?
score: 0
type: Comment

http://stackoverflow.com/comment/43533526
score: 0
type: Comment
type: QuestionComment
has text: I FOUND THE PROBLEM. When entering a single character or number, it gives me an error. Anyone know how to fix this?
comment on: http://stackoverflow.com/q/27553455

http://stackoverflow.com/comment/43587820
has text: The book is now quite old; you should expect it to be outdated. There are several innacuracies in that short paragraph when compared to current Java.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27581595

http://stackoverflow.com/comment/43571461
comment on: http://stackoverflow.com/q/27561765
score: 0
type: Comment
type: QuestionComment
has text: @Mailkov that sounds like what I want. Or at least part of such buffer. How is that done?

http://stackoverflow.com/comment/43451120
type: Comment
comment on: http://stackoverflow.com/a/27496430
has text: publicId and systemId aren't DocuSign values so I assume that error is in your application code, not being returned from DocuSign?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43686389
type: Comment
has text: you're welcome :) and don't upset so much.Great developer had so many mistake in pass.
comment on: http://stackoverflow.com/a/27633290
score: 1
type: AnswerComment

http://stackoverflow.com/q/27636242
tagged with: mysql
has comment: http://stackoverflow.com/comment/43721165
has answer: http://stackoverflow.com/a/27651493
has comment: http://stackoverflow.com/comment/43720111
has comment: http://stackoverflow.com/comment/43719983
accepted answer: http://stackoverflow.com/a/27663340
has body: For the first time, I'm creating a simple website with JSP, Servlets, a Tomcat server, MySQL and Netbeans (if that helps). Thanks to JPA EntityManager, I can insert data into my database like this : EntityManager entityManager = Persistence.createEntityManagerFactory("test").createEntityManager(); entityManager.getTransaction().begin(); entityManager.persist(usr); entityManager.getTransaction().commit(); Where usr is an Entity Class User generated thanks to Netbeans. Everything works perfectly except the fact that it doesn't support characters such as accents. Assuming I want to insert the word "cliché" : If I try to print the value from my User class, everything is fine. When the value is sent, if I try to SELECT the value from my base, I've got strange characters instead of the "é" Database fields are utf8_unicode_ci. If I try to make a simple INSERT from MySQL prompt such as INSERT INTO table (name) VALUES("ééé"); it's working perfectly. As I read on some websites, I modified my persistence.xml with the following line : &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;characterSetResults=UTF-8&amp;amp;zeroDateTimeBehavior=convertToNull"/&gt; but the result is the same. EDIT : Here are the properties of my User Class @Entity @Table(name = "users") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Users.findAll", query = "SELECT u FROM Users u"), @NamedQuery(name = "Users.findByIdUsers", query = "SELECT u FROM Users u WHERE u.idUsers = :idUsers"), @NamedQuery(name = "Users.findByUsername", query = "SELECT u FROM Users u WHERE u.username = :username"), @NamedQuery(name = "Users.findByPasswd", query = "SELECT u FROM Users u WHERE u.passwd = :passwd"), @NamedQuery(name = "Users.findByFirstName", query = "SELECT u FROM Users u WHERE u.firstName = :firstName"), @NamedQuery(name = "Users.findByLastName", query = "SELECT u FROM Users u WHERE u.lastName = :lastName"), @NamedQuer…
possible better answer: http://stackoverflow.com/a/27636448
has answer: http://stackoverflow.com/a/27636448
type: AnsweredQuestion
score: 3
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/43714853
tagged with: jpql
favorite count: 0
has comment: http://stackoverflow.com/comment/43720975
type: Question
linked to: http://stackoverflow.com/q/16527576
has title: JPA EntityManager and character encoding
has answer: http://stackoverflow.com/a/27663340
has comment: http://stackoverflow.com/comment/43691686
upvote count: 3
tagged with: java
answer count: 3

http://stackoverflow.com/q/27546946
type: AnsweredQuestion
has body: I have a scenario as outlined in the screenshot below: So, I've built some code which will allow me to click on the bar charts on the left....each time I do it will display a relational bar chart on the right. If the bar chart is particularly big on the left it might take a while for the relational bar chart on the right to show. To counter this, I built a fluentWait method, as below: public static void fluentWaitOnRelationalBarChartSelector(InternetExplorerDriver driver) { WebElement relationalBarSelect = (new WebDriverWait(driver, 20)) .until(ExpectedConditions.elementToBeClickable(By.tagName("rect"))); relationalBarSelect.click(); } However, not always, but sometimes, I am getting an error in the console as below: Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: Element is no longer valid (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 33 milliseconds What I'm not sure on is why this timeout is occurring after 33 milliseconds when I have applied a wait of 20 seconds? Is there a way of me being able to cater for this StaleElementReferenceException? Any help would be appreciated.
has comment: http://stackoverflow.com/comment/43521953
has answer: http://stackoverflow.com/a/27547110
has comment: http://stackoverflow.com/comment/43521925
tagged with: eclipse
answer count: 2
possible better answer: http://stackoverflow.com/a/47895614
has comment: http://stackoverflow.com/comment/43520662
upvote count: 1
downvote count: 0
has title: Selenium fluentWait is resulting in a StaleElementReferenceException
favorite count: 0
linked to: http://stackoverflow.com/q/4846454
has answer: http://stackoverflow.com/a/47895614
score: 1
accepted answer: http://stackoverflow.com/a/27547110
tagged with: java
tagged with: selenium
tagged with: webdriver
type: Question

http://stackoverflow.com/a/27570363
has comment: http://stackoverflow.com/comment/43566541
answers question: http://stackoverflow.com/q/27570295
type: Answer
upvote count: 15
accepted answer of: http://stackoverflow.com/q/27570295
downvote count: 0
has body: Stream#max(Comparator) takes a Comparator. You'll want to use Integer#compare(int, int) as that comparison function. list.stream().max(Integer::compare).get() You were providing Integer#max(int, int) as an implementation of Comparator#compare(int, int). That method doesn't match the requirements of Comparator#compare. Instead of returning a value indicating which is biggest, it returns the value of the biggest.
score: 15
type: AcceptedAnswer

http://stackoverflow.com/comment/43385461
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27475384
has text: Also, please use code formatting for code and code snippets, structured documents like HTML/XML or input/output. To do that, select the text and click the `{}` button at the top of the message posting/editing form.
type: Comment

http://stackoverflow.com/comment/43409464
type: AnswerComment
score: 0
type: Comment
has text: @user3760100 see [this link](http://stackoverflow.com/questions/13895867/java-io-notserializableexception). Without making non-serializable fields `transient` or implementing `readObject` and `writeObject`, you'll get `NotSerializableException` anyway.
comment on: http://stackoverflow.com/a/27478471

http://stackoverflow.com/a/55635466
has body: Akka Streams being based on actors provides interop between actors and streams, e.g.: reading from actor and passing it to streams and reading from streams and passing it to actors
upvote count: 1
answers question: http://stackoverflow.com/q/27525849
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/43795079
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27614824
has text: Finger crossed. However, setting Xms ( initial memory allocation) to almost 10 GB is a little big don't you thing ? Unless your server is well equipped...
score: 0

http://stackoverflow.com/a/27504984
downvote count: 0
has comment: http://stackoverflow.com/comment/43446350
score: 3
answers question: http://stackoverflow.com/q/27504774
has comment: http://stackoverflow.com/comment/43440925
has comment: http://stackoverflow.com/comment/43441042
accepted answer of: http://stackoverflow.com/q/27504774
has comment: http://stackoverflow.com/comment/43443997
has comment: http://stackoverflow.com/comment/43446375
type: AcceptedAnswer
has body: You will need to add a zero-arg constructor, or create an XmlAdapter for the Pair class to get it to unmarshal correctly (see: http://blog.bdoughan.com/2010/12/jaxb-and-immutable-objects.html). UPDATE I'm using JAXB marshaller for it and when I made a debugging of non-marshalled element, it has wrong type. ElementNSImpl instead of Integer. As far as JAXB is concerned first and second will be treated as type Object, since it derives metadata at the class level Pair instenad of the type level Pair&lt;Integer, Integer&gt;. Because of this the XML will need to qualify the XML elements with the necessary type information. This is done using the xsi:type attribute. public class Pair&lt;T1,T2&gt; implements Serializable { private T1 first; private T2 second; Try populating your object model with the data you want and then marshalling it and you will see what the XML should look like for the unmarshal operation.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43442097

http://stackoverflow.com/comment/43384423
score: 0
has text: How would this be done? @Quincunx
comment on: http://stackoverflow.com/q/27475048
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43629057
comment on: http://stackoverflow.com/a/27516938
score: 0
type: AnswerComment
has text: The problem is solved. You were right, the problem was related to the content of the InputStream. In the second case, the IS is being parsed throught two kind of parsers which alterated its content (the root node wasn't there).
type: Comment

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/27505265
tags question: http://stackoverflow.com/q/27485310
tag name: google-oauth

http://stackoverflow.com/comment/43557623
has text: /products.jsp
type: QuestionComment
comment on: http://stackoverflow.com/q/27565324
score: 0
type: Comment

http://stackoverflow.com/a/27514111
has body: if you're returning two different types, I'd definitely not recommend using a List, for the type reason you mention yourself. My suggestion would be creating a result/response type such as Tuple&lt;Figure,Movement&gt; or reuse Map.Entry. Also, read this question and answers. Cheers,
has comment: http://stackoverflow.com/comment/43458716
score: 0
answers question: http://stackoverflow.com/q/27513970
type: Answer

http://stackoverflow.com/a/27485076
answers question: http://stackoverflow.com/q/27485046
has comment: http://stackoverflow.com/comment/43596254
upvote count: 2
has body: You should use Oracle HTTP Server, Apache Web Server (with WebLogic plugin), or Oracle Traffic Director, to correctly map that, instead of deploying an application to root context. Keep all apps deployed to their / context roots. Map the external context root on the Web Tier.
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27485046
has comment: http://stackoverflow.com/comment/43402122
type: AcceptedAnswer

http://stackoverflow.com/q/27535191
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43532715
answer count: 0
has comment: http://stackoverflow.com/comment/43521794
tagged with: garbage-collection
upvote count: 1
type: Question
tagged with: java
has title: Full GC due to concurrent mode failure
linked to: http://stackoverflow.com/q/2918124
has body: I am using Java 6_13. My gc.log shows that I run into concurrent mode failure. However, part of the line shown here confuses me a lot since the Full GC does not clean the memory but instead increases the occupied memory. (concurrent mode failure): 778598K-&gt;781522K(786432K), 1.2618790 secs] Is it normal? In addition, if anyone has any explanations on why I run into this problem, please share too. As this problem does not always happen when I do load testing, but when it happens, it slows everything down (which is quite expected as a result of Full GC). I also include my log here in case you need a complete picture. 2014-12-17T10:36:21.839-0500: 22.094: [GC 22.094: [ParNew: 262144K-&gt;5947K(327680K), 0.0186840 secs] 262144K-&gt;5947K(720896K), 0.0188600 secs] [Times: user=0.09 sys=0.02, real=0.02 secs] 2014-12-17T10:37:40.865-0500: 101.119: [GC [1 CMS-initial-mark: 0K(393216K)] 133041K(720896K), 0.1643040 secs] [Times: user=0.16 sys=0.01, real=0.17 secs] 2014-12-17T10:37:41.029-0500: 101.284: [CMS-concurrent-mark-start] 2014-12-17T10:37:41.210-0500: 101.464: [CMS-concurrent-mark: 0.067/0.180 secs] [Times: user=0.31 sys=0.01, real=0.18 secs] 2014-12-17T10:37:41.210-0500: 101.464: [CMS-concurrent-preclean-start] 2014-12-17T10:37:41.256-0500: 101.510: [CMS-concurrent-preclean: 0.044/0.046 secs] [Times: user=0.08 sys=0.00, real=0.04 secs] 2014-12-17T10:37:41.256-0500: 101.510: [CMS-concurrent-abortable-preclean-start] 2014-12-17T10:37:45.249-0500: 105.503: [GC 105.503: [ParNew: 268091K-&gt;55535K(327680K), 0.0379060 secs] 268091K-&gt;55535K(720896K), 0.0381190 secs] [Times: user=0.18 sys=0.05, real=0.03 secs] CMS: abort preclean due to time 2014-12-17T10:40:13.781-0500: 254.036: [CMS-concurrent-abortable-preclean: 0.246/152.525 secs] [Times: user=14.81 sys=1.02, real=152.51 secs] 2014-12-17T10:40:13.782-0500: 254.036: [GC[YG occupancy: 181472 K (327680 K)]254.036: [Rescan (parallel) , 0.0427610 secs]254.079: [weak refs processing, 0.0017680 secs]254.081: [class unload…
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/43534349
score: 2
has text: It depends on the filesystem and its options. e.g. Ext[234] has a `dir_index` option, which means that it will use H-trees for storing (filename, inode) tuples in directories.
comment on: http://stackoverflow.com/q/27552694
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27561666
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43549623
type: Answer
answers question: http://stackoverflow.com/q/27561458
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43549804
accepted answer of: http://stackoverflow.com/q/27561458
has body: new BigInteger(b, 16).toString(); Sample program: public static void main(String[] args) { final BigInteger original = new BigInteger("27"); final String converted = original.toString(16); final BigInteger convertedBack = new BigInteger(converted, 16); System.out.println("original = [" + original.toString() + "]"); System.out.println("converted = [" + converted + "]"); System.out.println("convertedBack = [" + convertedBack.toString() + "]"); } Output: original = [27] converted = [1b] convertedBack = [27]
has comment: http://stackoverflow.com/comment/43549659
has comment: http://stackoverflow.com/comment/43549508
has comment: http://stackoverflow.com/comment/43549486

http://stackoverflow.com/q/27576025
possible better answer: http://stackoverflow.com/a/27576346
type: Question
has answer: http://stackoverflow.com/a/27576346
has comment: http://stackoverflow.com/comment/43577520
linked to: http://stackoverflow.com/q/15745140
downvote count: 0
has title: Singleton class or instance in java
has answer: http://stackoverflow.com/a/27582342
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43577501
has answer: http://stackoverflow.com/a/27582952
has comment: http://stackoverflow.com/comment/43577583
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has body: I understand that in Spring framework, the default scope of the bean is Singleton. It means that only one instance of the bean is created per the container. But I am not able to understand practically below scenario. For example class , let say class "SingleTonClass" is configured as singleton bean in spring context.xml, 1) for every time there is a request for this class ,does it use same instance. If yes then if I make a call like new SingleTonClass().sum(3,4) from another class and new SingleTonClass().sum(5,6) , will give me the results correctly or there will be a problem some times? 2) if same instance is used by all the requests, how is it possible behind the scenes that using only one instance is used by all the requests? if there are 100 requests to the same singleton class , each request has to wait until previous request is finished? Edit: Let say I am using @Autowired and not new operator In my main class, I am trying to use bean configured using spring. Let say if MyMain is called multiple times(may or may not be concurrent calls), I want to understand point 2 in my post above(edit) public class MyMain() { @Autowired SingleTonClass singleTonClass; } public class SingleTonClass { private int a=0; private int b=0; public int sum(int a ,int b) { return a+b; } }
accepted answer: http://stackoverflow.com/a/27582952
has comment: http://stackoverflow.com/comment/43577479
score: 1
linked to: http://stackoverflow.com/q/11189907
tagged with: java
has comment: http://stackoverflow.com/comment/43577502

http://stackoverflow.com/comment/43673418
score: 0
type: Comment
type: QuestionComment
has text: @Willis Aren't eclipse and the Android-tools already taking care of that? I did Project-> Clean Up several times. Do you perhaps mean something else?
comment on: http://stackoverflow.com/q/27625261

http://stackoverflow.com/comment/43531331
type: Comment
type: QuestionComment
has text: Have a look at reflection - it's great for testing, and it allows you to set any field of a class.
comment on: http://stackoverflow.com/q/27552499
score: 0

http://stackoverflow.com/comment/43439012
comment on: http://stackoverflow.com/q/27504454
type: Comment
type: QuestionComment
has text: NFI man, it works on a clean netbeans install with your project. (8.0.2 - latest)
score: 0

http://stackoverflow.com/q/27592060
favorite count: 0
has title: Error while compliling DROP IF EXISTS , syntax error near table Android SQLite
accepted answer: http://stackoverflow.com/a/27592099
type: AnsweredQuestion
has body: I am trying to make a small program that contains two EditTexts for user to enter his name and his password and a button which adds them in a table using SQLite in Android, but I got that message by my SQLException : android.database.sqlite.SQLiteException:near "table":syntax error (code1):,while compiling: DROP TABLE IF EXISTS and in my logcat this line appear : (1) near "table" : syntax error and I can't figure out where the problem Here is my code : package com.example.database; import android.content.ContentValues; import android.content.Context; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class DataBaseAdapter { Helper helper ; public DataBaseAdapter(Context context){ helper = new Helper ( context); } public long insertData (String name , String password) { SQLiteDatabase db = helper.getWritableDatabase(); ContentValues contenValues = new ContentValues (); contenValues.put(Helper.NAME, name); contenValues.put(Helper.PASSWORD, password); long id = db.insert(Helper.TABEL_NAME, null, contenValues); return id ; } static class Helper extends SQLiteOpenHelper { private static final String DATABSE_NAME = "myDataBase"; private static final String TABEL_NAME = "table"; private static final int DATABASE_VERSION = 10; public static final String NAME = "Name"; public static final String PASSWORD = "password"; private static final String CREATE_TABLE = "CREATE TABLE "+TABEL_NAME+" (_id INTEGER PRIMARY KEY AUTOINCREMENT , "+NAME+" TEXT not null , "+PASSWORD+" TEXT not null)"; private Context context; private static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABEL_NAME; public Helper(Context context) { super(context, DATABSE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub this.context = context; Message.message(context, "constructor called"); } @Override public void onCreate(SQLiteDatabase…
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/27592146
type: Question
answer count: 2
upvote count: 0
score: -1
possible better answer: http://stackoverflow.com/a/27592146
has answer: http://stackoverflow.com/a/27592099
tagged with: android
tagged with: sqlite

http://stackoverflow.com/a/27583638
type: Answer
answers question: http://stackoverflow.com/q/27583483
has body: you need one more class using composition to decide which implementation is needed. public ClassHelper{ private A a; public ClassHelper(A a){ this.a = a; } public void execute() { this.a.execute(); } } public class main { /** * @param args */ public static void main(String[] args) { ClassHelper param1 = new ClassHelper(new ClassAImplA(10)); param1.execute(); //or when you need classBIMpl param1 = new ClassHelper(new ClassAImplB(true)); param1.execute(); } } And about the ability to access member of implA or implB , no you cannot have that flexibilty with this patter, whole point of this pattern is that caller need not be aware of implementation details.
score: 0

http://stackoverflow.com/a/27523321
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27523093
answers question: http://stackoverflow.com/q/27523093
upvote count: 6
has comment: http://stackoverflow.com/comment/66602371
has body: You could do it using powermockito as below: Say this is your class with static method: public final class MyStaticClass { public static String helloWorld() { return "Hello World"; } } And you want to mock out helloWorld method, and let it return "Hi World" instead while testing. You could do the following: @RunWith(PowerMockRunner.class) @PrepareForTest({MyStaticClass.class}) public class PowerMockItoTest { @Test public void mockStaticClassTest() { PowerMockito.mockStatic(MyStaticClass.class); final String mockedResult = "Hi World"; Mockito.when(MyStaticClass.helloWorld()).thenReturn(mockedResult); Assert.assertEquals(AStaticClass.helloWorld(), mockedResult); } } If you want to use PowerMock, you could do it as below: @RunWith(PowerMockRunner.class) @PrepareForTest({MyStaticClass.class}) public class PowerMockTest { @Test public void testRegisterService() throws Exception { PowerMock.mockStatic(MyStaticClass.class); final String mockedResult = "Hi World"; expect(MyStaticClass.helloWorld()).andReturn(mockedResult); replay(MyStaticClass.class); Assert.assertEquals(AStaticClass.helloWorld(), mockedResult); verify(MyStaticClass.class); } }
has comment: http://stackoverflow.com/comment/43475718
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43475532
score: 6

http://stackoverflow.com/q/27638311
type: Question
has answer: http://stackoverflow.com/a/27638331
tagged with: android
has title: Error when sending post request in Android
has body: I have this method : public String post(String urlParameters, String url) throws IOException{ URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", "Chrome"); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } It compiles fine but it won't run. Un the manifest, the Internet permission is present. It says (in logcat) 12-24 14:59:31.028 E/AndroidRuntime(30941): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fliife.bitvisitorbot/com.fliife.bitvisitorbot.MainActivity}: android.os.NetworkOnMainThreadException What can I do ?
upvote count: 1
tagged with: http
tagged with: java
type: UnansweredQuestion
answer count: 4
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27638330
has answer: http://stackoverflow.com/a/27638354
favorite count: 0
has answer: http://stackoverflow.com/a/27638562

http://stackoverflow.com/q/27617786
tagged with: java
type: Question
has title: How to inject a network file resource with Spring?
downvote count: 0
has body: How can I tell Spring that the resource is supposed to be a network resource, and let it autowire accordingly? @Value("\\MY-MACHINE\thefile.txt") private Resource file; Result: Caused by: java.io.FileNotFoundException: class path resource [MY-MACHINE\thefile.txt] cannot be resolved to URL because it does not exist
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27619892
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27618261
tagged with: spring
has answer: http://stackoverflow.com/a/27617877
score: 3
linked to: http://stackoverflow.com/q/2171822
has answer: http://stackoverflow.com/a/27618495
upvote count: 3

http://stackoverflow.com/q/27631654
has body: I tried to explain my problem as best as I could so sorry if it didn't make sense. The problem I'm having is when I call the asyncTask class in the onCreate method the String doesn't seem to get passed to doInBackground. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.Timer; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; public class MainActivity extends Activity { String question; TextView price; Document document; TextView article; private Element overview; EditText respText; TextView text; TextView ans; String siteUrl; private class ParseURL extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... strings) { StringBuffer buffer = new StringBuffer(); try { Log.d("JSwa", "Connecting to ["+strings[0]+"]"); Document doc = Jsoup.connect(strings[0]).get(); Log.d("JSwa", "Connected to ["+strings[0]+"]"); //Get document (HTML page) title String title = doc.title(); Log.d("JSwA", "Title ["+title+"]"); buffer.append("Title: " + title + "\r\n"); // Get meta info Elements metaElems = doc.select("meta"); buffer.append("META DATA\r\n"); for (Element metaElem : metaElems) { String name = metaElem.attr("name"); String content = metaElem.attr("content"); buffer.append("name ["+name+"] - content ["+content+"] \r\n"); } Elements topicList = doc.select("h2.topic"); buffer.append("Topic list\r\n"); for (Element topic : topicList) { String data = topic.text(); buffer.append("Data ["+data+"] \r\n"); } } catch(Throwable t) { t.printStackTrace(); } return buffer.toString(); } @Override protected void onPostExecute(String…
has answer: http://stackoverflow.com/a/27631707
answer count: 1
has comment: http://stackoverflow.com/comment/43683736
has comment: http://stackoverflow.com/comment/43683606
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
downvote count: 1
has comment: http://stackoverflow.com/comment/43683589
tagged with: java
score: -1
type: Question
has title: When calling the class that extends AsyncTask the parameter doesnt seem to receive the sent String
upvote count: 0

http://stackoverflow.com/q/27476662
tagged with: string
has title: How do you check that the user entered a String value instead of a number?
score: 0
answer count: 3
tagged with: while-loop
has answer: http://stackoverflow.com/a/27517513
tagged with: input
has comment: http://stackoverflow.com/comment/43387536
has body: I wrote a simple program that calculates the hypotenuse of a triangle when the user inputs side A and B. I have a while loop that prompts the user to enter a value greater than 0 if they do, but how do I check if the user enters a String value? while (sideA&lt;=0 || sideB&lt;=0){ What should I add so if the user enters a string value, the loop will also start? Thanks
has answer: http://stackoverflow.com/a/27476720
has comment: http://stackoverflow.com/comment/43387517
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27476710
type: Question

http://stackoverflow.com/q/27532036
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43494427
tagged with: jdbc
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: No operations allowed after connection closed
score: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43505253
has body: I'm getting this error from a Java application: com.mchange.v2.c3p0.impl.NewPooledConnection - [c3p0] Another error has occurred [ com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. ] which will not be reported to listeners! The Java code: try { sessionFactory.beginTransaction(); //... sessionFactory.commitTransaction(); } catch (Exception e) { sessionFactory.rollbackTransaction(); throw new RuntimeException(e); } The session factory: try { sessionFactory.beginTransaction(); ... sessionFactory.commitTransaction(); } catch (Exception e) { sessionFactory.rollbackTransaction(); throw new RuntimeException(e); } public Transaction beginTransaction() throws HibernateException { try { return sessionFactory.getCurrentSession().beginTransaction(); } catch (HibernateException hex) { LOG.error(String.format("Unable to start database transaction due to exception: %s.", ExceptionUtils.getRootCauseMessage(hex))); throw hex; } } public void commitTransaction() throws HibernateException { LOG.debug("Committing database transaction."); try { if (sessionFactory.getCurrentSession().getTransaction().isActive()) { sessionFactory.getCurrentSession().getTransaction().commit(); } else { throw new HibernateException("Transaction is no longer Active."); } } catch (HibernateException hex) { LOG.error(String.format("Unable to commit due to exception: %s.", ExceptionUtils.getRootCauseMessage(hex))); throw hex; } } public void rollbackTransaction() throws HibernateException { LOG.debug("Trying to rollback database transaction after exception."); Session session = sessionFactory.getCurrentSession(); try { if (session.getTransaction().isActive()) { session.getTransaction().rollback(); } else { throw new HibernateException("Transaction is no longer Active."); } } catch (HibernateException hex) { LOG.error(String.format("Unable to rollback due to exception: %s.", ExceptionUtils.getRootCauseMessage(hex))); throw hex; } finally { if (se…
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/42593795
upvote count: 8
has answer: http://stackoverflow.com/a/28118215

http://stackoverflow.com/comment/103808890
score: 0
comment on: http://stackoverflow.com/a/27475069
type: AnswerComment
type: Comment
has text: I think it is an error when the driver fetches the procedure metadata from the database. When I step through in the debugger, it shows the correct number of parameters, but all have the form `IN x VARCHAR`. The `noAccessToProcedureBodies` is a variable in the source code that tells the driver to just trust the application.

http://stackoverflow.com/comment/43572269
has text: In first case `src/` is your working directory. You have to put all your files there or update paths to `"../readThisFile.txt"`. If you use the second option `Project1/` is your working directory (like when launching from eclipse) and no changes are necessary.
type: AnswerComment
comment on: http://stackoverflow.com/a/27573191
score: 0
type: Comment

http://stackoverflow.com/comment/43656132
type: Comment
has text: Put dummy panel in it, and catch TabSelected event (or so) to build real view
comment on: http://stackoverflow.com/q/27612837
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43556415
comment on: http://stackoverflow.com/q/27565366
score: 0
type: QuestionComment
type: Comment
has text: First time. when java loads a class, the static initializers are performed. If you have a exception in this, java will not try again to load the class definition, instead a NoClassDefFoundError is thrown. So maybe there is an oversight exception before the first NoClassDefFoundError.

http://stackoverflow.com/comment/43507921
score: 0
has text: Did you check the [docs](http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html)?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27540045

http://stackoverflow.com/comment/43513289
comment on: http://stackoverflow.com/a/27542752
score: 0
has text: Sir I am new to this..please provide me complete process for this..and thank you very much
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27612496
accepted answer: http://stackoverflow.com/a/27612515
tagged with: parsing
type: AnsweredQuestion
type: Question
has body: This should be a really simple question, but i got confused and something isn't working right. I want to parse the input string to replace " with [5178] and ' with [5179] which works well, i get the string like i want it to, but when i go the other way, i want to parse [5178] to " and [5179] to ', i get something strange. Here is my code: text = text.replaceAll("[5178]","\""); text = text.replaceAll("[5179]","\'"); That part doesn't work, and this part does: text = text.replaceAll("\"","[5178]"); text = text.replaceAll("\'","[5179]"); When i input text let's say: Single quote ' and double quote " i get: Single quote [5179] and double quote [5178] , but when i go other way aroung i get Single quote ["""'] and double quote [""""]. I don't know what is going on, any ideas?
tagged with: java
has answer: http://stackoverflow.com/a/27612515
answer count: 1
tagged with: string
score: 0
tagged with: android
has title: Android parse quote in string

http://stackoverflow.com/a/27574716
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43657660
has comment: http://stackoverflow.com/comment/43576581
has body: If you know you skip the first line you don't need a regex for that line then use: Pattern pattern = Pattern.compile("[Q|A][ ]*"); String s = "Q How much room was there between the bike rack and the snow pile?"; Matcher match = pattern.matcher(s); System.out.println(match.replaceFirst(""));
accepted answer of: http://stackoverflow.com/q/27574410
answers question: http://stackoverflow.com/q/27574410
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43576823

http://stackoverflow.com/comment/43452796
comment on: http://stackoverflow.com/q/27511335
type: Comment
type: QuestionComment
score: 1
has text: Most important: what's your motivation for doing this? What effect are you trying to achieve and why? If we better understand your overall problem, we'll likely be better at offering a decent solution. Also note that the child window should most definitely not be a JFrame but rather a JDialog.

http://stackoverflow.com/a/28673477
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27638043
has body: Since VerifyError is thrown during class loading by the JVM if incorrect byte code has been encountered, it's likely that any errors are caused by instrumentation. Your error on Android means that your bytecode contains a reference to com/google/android/gms/auth/GoogleAuthUtil which Dalvik isn't able to load. It could also happen if there are used methods in GoogleAuthUtil which require a higher API level than what's present on the device. Beyond this, it's hard to deduce more facts from your customer's devices. As you suggest, it could be that someone is trying to modify bytecode of the app or (in case of rooted devices probably more likely) the API resulting in GoogleAuthUtil not executing properly. Considering that a) you can't deduce the root cause in most cases and b) even if, not do much about it, letting the app crash is perfectly fine imo.
answers question: http://stackoverflow.com/q/27638043
upvote count: 1

http://stackoverflow.com/a/41091083
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27577922
score: 0
type: Answer
has body: As @RE350 suggested passing the JSON data in the body in the post would be ideal. However, you could still send the json object as a parameter in a GET request, decode the json string in the server-side logic and use it as an object. For example, if you are on php you could do this (use the appropriate json decode in other languages): Server request: http://&lt;php script&gt;?param1={"nameservice":[{"id":89},{"id":3}]} In the server: $obj = json_decode($_GET['param1'], true); $obj["nameservice"][0]["id"] out put: 89

relative-path
type: Tag
tags question: http://stackoverflow.com/q/27532492
tag name: relative-path

http://stackoverflow.com/q/27486712
downvote count: 1
has body: I have this JSON [ {"Description":"When settir\n"} ] And my container class is class MessageContainer { private String Description; public String getDescription() { return Description; } public void setDescription(String description) { Description = description; } } I get an exception when I use MessageContainer container = mGson.fromJson(result, MessageContainer.class); The exception reads EXPECTED BEGIN OBJECT , but found string . Anyone knows what gives ?
type: AnsweredQuestion
has title: How to parse a single field through Gson
has answer: http://stackoverflow.com/a/27486899
possible better answer: http://stackoverflow.com/a/27486911
favorite count: 0
has answer: http://stackoverflow.com/a/27486911
type: Question
answer count: 2
tagged with: android
score: 0
tagged with: java
tagged with: gson
upvote count: 1
accepted answer: http://stackoverflow.com/a/27486899

http://stackoverflow.com/q/27564351
answer count: 1
has title: How to update the settings of an HttpClient in httpclient 4.3+?
has answer: http://stackoverflow.com/a/27567117
tagged with: java
type: AnsweredQuestion
tagged with: httpclient
downvote count: 0
score: 1
has body: In httpclient 4.3, if you respect all the deprecations, you must build and configure your HttpClient using an HttpClientBuilder (documentation here). The methods are explicit, they seem easy to use, and HttpClient's interface is clear. But maybe a tad too much. In my own case, I have to inherit Spring's HttpComponentsHttpInvokerRequestExecutor (documentation here). As a consequence, I can easily get the HttpClient, but all I know about this object is that it implements the interface. Since the client is already built, and I do not know anything about its implementation, I cannot access methods such as AbstractHttpClient's setHttpRequestRetryHandler or addRequestInterceptor (though yes, I know, they are deprecated). So, what would be the cleanest way of updating the settings of this HttpClient (the retry handler and request interceptor are those I am most concerned with at the moment)? Should I... ... savagely cast my client to AbstractHttpClient, hoping I will always receive this implementation? ... create a new HttpClient in my HttpInvokerRequestExecutor's constructor, and get something like the example reproduced below? I might add that Spring's constructor (in 3.2.4 at least) uses methods deprecated in httpclient 4.3 too. Would there be any side effect I missed using this strategy? ... do something I have not proposed yet? Custom constructor example: public CustomHttpInvokerRequestExecutor() { super(); // will create an HttpClient // Now overwrite the client the super constructor created setHttpClient(HttpClientBuilder.custom(). ... .build()); }
favorite count: 0
accepted answer: http://stackoverflow.com/a/27567117
tagged with: apache-httpclient-4.x
type: Question
linked to: http://stackoverflow.com/q/2014700
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/27610667
type: Question
tagged with: jersey
tagged with: notifications
answer count: 2
upvote count: 1
has title: Reporting progress from RESTful service based on Jersey
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27610882
has body: I have a RESTful service developed using Jersey(Java) which does heavy lifting for a user including the multiple file transfer part of a single complete operation. I would like to provide some sort of progress notification to the client(user) using this service indicating what is going or what percent of the operation is done. Accuracy of the notification is not an issue. Given that this is a RESTful service, any thought how this could be achieved? Any existing sample might be helpful. Update/clarification: This notification is like progress/status notification while the main operation is still in progress, since in certain scenarios the whole operation might take more than 5 minutes I want to make sure I update the client as to what is going on on the service side and why it is taking this long to fulfill the request. Ex. Request ... status... status .... status.... final Response. I am assuming that this is not going to happen on same Request/Response pipe, this might involve creating another communication pipe between client and service.
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/28768508
has answer: http://stackoverflow.com/a/28810343

http://stackoverflow.com/comment/43556254
type: Comment
type: QuestionComment
has text: Have you tried to specify a file extension like this: `fileContents = fss.saveFileDialog(null, { "txt" }, is, "JWSFileChooserDemo");` ? Also, just for debugging purpose, you should do this to know when `fss` is `null`: `catch (UnavailableServiceException exc) { log.append("Debug: fss is null." + newline); }`
comment on: http://stackoverflow.com/q/27565458
score: 0

http://stackoverflow.com/q/27636101
has title: to get time in GMT from locale
upvote count: 1
has body: I am facing one issue. Suppose the user is logging to my website at 2014-12-24 01:00 am from China, so i stored his logged in time. Now if he logged in again from France at so i need to show his last logged in time as per timezone of France, 2014-12-23 17:00 as per GMT. I am having locale information of user from where he is logging in. This is my code: String lastLoggedIndatetime = "2014-11-23 04:01" ; //time of last logged in from China; Locale locale = Locale.FRANCE; //suppose this i am getting as args from Http request SimpleDateFormat loggedInDateFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm"); Calendar c = Calendar.getInstance(locale); TimeZone loggedInTimeZone = c.getTimeZone(); System.out.println("Time Zone is "+ c.getTimeZone().getDisplayName()); SimpleDateFormat gmtFormat = new SimpleDateFormat("yyyy-mm-dd hh:mm"); TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT"); gmtFormat.setTimeZone(gmtTimeZone); try { String lastLoggedIndatetimeAsPerFrance = loggedInDateFormat.format(new SimpleDateFormat("yyyy-mm-dd hh:mm").parse(lastLoggedIndatetime.trim())); String gmtDateTime= gmtFormat.format(new SimpleDateFormat("yyyy-mm-dd hh:mm").parse(lastLoggedIndatetimeAsPerFrance.trim())); System.out.println("last logged in Date as per France is "+ lastLoggedIndatetimeAsPerFrance + " TimeZone is "+loggedInTimeZone); System.out.println("GMT Date is "+ gmtDateTime + " TimeZone is "+ gmtTimeZone); //formattedDate.append(gmtDateTime) //.append(" - "); //" - " is delimiter for date } catch (ParseException ex) { Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, null, ex); } And output is : Time Zone is India Standard Time last logged in Date as per France is 2014-01-23 04:01 TimeZone is sun.util.calendar.ZoneInfo[id="Asia/Calcutta",offset=19800000,dstSavings=0,useDaylight=false,transitions=6,lastRule=null] GMT Date is 2014-31-22 10:31 TimeZone is sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null] it is not showing ti…
favorite count: 0
type: UnansweredQuestion
tagged with: datetime
downvote count: 0
has comment: http://stackoverflow.com/comment/43691691
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27637471
has comment: http://stackoverflow.com/comment/43691580
answer count: 2
has answer: http://stackoverflow.com/a/27637065
tagged with: locale

http://stackoverflow.com/a/73138344
has comment: http://stackoverflow.com/comment/130422967
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/130423011
has body: My two cents. Prefer NativePRNG over SHA1PRNG Configure JVM parameter to take entropy from /dev/urandom e.g. -Djava.security.egd=file:/dev/./urandom Do not reseed frequently Reason : Periodic entroy injection happens in NativePRNG , which adds more randomness compared to SHA1PRNG. By providing entropy source from /dev/urandom instead of /dev/random, you are avoiding blocking call to RNG during entropy generation. EDIT: Post java 8, -Djava.security.egd parameter is not required.
has comment: http://stackoverflow.com/comment/130344225
has comment: http://stackoverflow.com/comment/129804535
has comment: http://stackoverflow.com/comment/130411369
answers question: http://stackoverflow.com/q/27622625
upvote count: 1
has comment: http://stackoverflow.com/comment/130322277
type: Answer
has comment: http://stackoverflow.com/comment/129798763

http://stackoverflow.com/comment/43464425
has text: This is incredibly frustrating this is what i get now: `$ java -v Unrecognized option: -v Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.` Additionally when I attempt to compile, I get this: `[ERROR] Unable to locate the Javac Compiler in: [ERROR] T:\Program Files\Java\jre1.8.0_25\..\lib\tools.jar [ERROR] Please ensure you are using JDK 1.4 or above and [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).`
type: Comment
comment on: http://stackoverflow.com/a/27494589
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43624514
type: QuestionComment
has text: I already checked the android developer site, they are talking about optimization inside the app, not about coding
comment on: http://stackoverflow.com/q/27600586
score: 0
type: Comment

http://stackoverflow.com/comment/43408468
type: AnswerComment
comment on: http://stackoverflow.com/a/27487496
score: 0
type: Comment
has text: Every divisor he finds automatically has a counterpart: the divisors come in pairs. You only need to count the lower of each pair and add 2 when you find it -- making allowance for square numbers.

animation
tags question: http://stackoverflow.com/q/27496507
type: Tag
tags question: http://stackoverflow.com/q/27491790
tags question: http://stackoverflow.com/q/27495195
tags question: http://stackoverflow.com/q/27514994
tags question: http://stackoverflow.com/q/27639226
tags question: http://stackoverflow.com/q/27509360
tag name: animation
tags question: http://stackoverflow.com/q/27485690
tags question: http://stackoverflow.com/q/27515056
tags question: http://stackoverflow.com/q/27475048

glyph
type: Tag
tags question: http://stackoverflow.com/q/27492995
tag name: glyph

http://stackoverflow.com/comment/43606501
type: QuestionComment
has text: I personally believe the fields should not be `static` and randomly adding keywords to your code is not a successful long-term programming strategy.
score: 4
comment on: http://stackoverflow.com/q/27591348
type: Comment

http://stackoverflow.com/comment/43636610
type: QuestionComment
type: Comment
has text: So I understand the question properly: The Category drop down is empty because you are never setting it. How do you get the values populated and returned to the form?
score: 0
comment on: http://stackoverflow.com/q/27607106

http://stackoverflow.com/q/27502061
has title: How to create framework.odex in android
has answer: http://stackoverflow.com/a/27502842
favorite count: 0
tagged with: android-framework
upvote count: 1
has body: I'm trying to make changes in Android OS so I downloaded AOSP, make some changes and build it. Now I want to replace framework.jar and framework2.jar on my device (Nexus 5, 4.4.4) but I see that this is an "odex" device - Which means - I have also framework.odex and frameork2.odex. Can someone help me and explain me how to create those 2 files? I Google it but found only how to odex apk and not framework. Thank you guys!
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27502842
tagged with: java
possible better answer: http://stackoverflow.com/a/27533546
has answer: http://stackoverflow.com/a/27533546
downvote count: 1
type: Question
answer count: 2
tagged with: android-source
score: 0
tagged with: android

http://stackoverflow.com/a/27577916
score: 1
has comment: http://stackoverflow.com/comment/43587048
answers question: http://stackoverflow.com/q/27577680
type: Answer
has comment: http://stackoverflow.com/comment/43585367
has body: There are many encryption/decryption algorithms such as Data Encryption Standards (DES), Playfair, etc., etc. You may use those. And if you like, make your own algorithm. I once made a messenger app and I made my own algorithm for encryption/decryption. You may also choose to have a symmetric or asymmetric key algorithm... Keep working, messengers have a nice scope.. :)
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43583520

http://stackoverflow.com/comment/43583440
comment on: http://stackoverflow.com/q/27579433
score: 0
type: Comment
type: QuestionComment
has text: i need to start counting from 0 to 'N', but counting will start only if 507 is reached and it will stop to count if 504 is reached. so it will give me a result of 3, but im cunfused about this. thanks.

http://stackoverflow.com/a/27503902
downvote count: 0
score: 1
has body: You setted element to null and then tried to add something to it. You cannot add anything to it as it IS null! Instead, try this: List&lt;WebElement&gt; element=new ArrayList&lt;WebElement&gt;(); ... As you can see, I initialized the object before using it, so it no longer should be null.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43438004
answers question: http://stackoverflow.com/q/27503823
type: Answer
accepted answer of: http://stackoverflow.com/q/27503823
has comment: http://stackoverflow.com/comment/43437947

http://stackoverflow.com/a/27577353
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27577315
has body: I think You haven't got the right android packages installed. Make sure your API is set to the correct one (As in not android wear). Just click on you SDK manager and install the correct api. including all the extras. cheers !

http://stackoverflow.com/comment/43512590
type: QuestionComment
has text: Not in Console view.. It gives popup. while starting tomcat, Notepad window automatically opening and with popup.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27539846

http://stackoverflow.com/comment/62557247
type: AnswerComment
type: Comment
has text: For followers, this does produce a "smaller" string than converting a long to 8 bytes then base64 encoding the 8 bytes. However, it's also "a different format" than normal base64 encoding, as it were, so a generic base64 decoder probably won't be able to read it FWIW.
comment on: http://stackoverflow.com/a/27559865
score: 1

http://stackoverflow.com/q/27522728
favorite count: 0
has answer: http://stackoverflow.com/a/27523454
type: AnsweredQuestion
has title: Unable to compile the GWT module while trying to use javax.annotation.Nullable?
accepted answer: http://stackoverflow.com/a/27523454
type: Question
tagged with: gwt
upvote count: 5
tagged with: java
score: 5
answer count: 1
downvote count: 0
has body: I would like to use the javax.annotation.Nullable annotation in my GWT project. I would like to know which module has to be inherited into my gwt.xml file inorder to use that annotation. The google guava jar internally uses the Nullable annotation and If I use that Jar in my project it is able to compile. Please help me what package has to be inherited inorder to use the javax.annotation.Nullable annotation? I have been searching on net for long time, but still unable to figure out which package has to be inherited. Any suggestions would be appretiated.

http://stackoverflow.com/comment/43392233
type: QuestionComment
comment on: http://stackoverflow.com/q/27478888
has text: @MikeKobit just to for the record, OP did not say he don't want to use locks, OP said i could not use locks, maybe a bad code design caused that.
score: 0
type: Comment

http://stackoverflow.com/comment/43551504
type: Comment
type: QuestionComment
has text: Not related to the answer, but you should not use RelativeLayout that often.
comment on: http://stackoverflow.com/q/27498900
score: 0

http://stackoverflow.com/a/27568751
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27568112
has body: I did so: <?xml version="1.0" encoding="utf-8"?> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:text="@string/title_app" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#FFFFFF" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="2dip" android:paddingTop="6dip" android:textColor="#43bd00" android:textSize="16sp" android:textStyle="bold" /> <TextView android:id="@+id/qtde" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="2dip" android:textColor="#acacac" /> I did not get the result we wanted, looked like this: looked like this and I want something like this: something like this

http://stackoverflow.com/comment/43526151
comment on: http://stackoverflow.com/q/27549671
type: Comment
type: QuestionComment
score: 0
has text: @Dima -- I know that it is waiting on the <clinit> lock, because I constructed the code so that it would. The above program will deadlock forever if you run it -- try it yourself. Is your point that it's not using a `java.util.concurrent.locks`? If so -- that's right, but not very helpful.

http://stackoverflow.com/q/27573607
has answer: http://stackoverflow.com/a/27573657
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/43572922
downvote count: 2
score: 6
has body: I've been staring at the screen the last 5 minutes and can't seem to figure out what I'm doing wrong: class Example { private final Set&lt;String&gt; values; public Example(String... values) { values = new HashSet&lt;String&gt;(Arrays.asList(values)); } } I'm surprised why the String[] cannot be converted to List&lt;String&gt; to initialize the HashSet&lt;String&gt; with it. I'm getting the build error: incompatible types: java.util.HashSet&lt;java.lang.String&gt; cannot be converted to java.lang.String[] What's wrong with my assignment?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43573279
tagged with: java
possible better answer: http://stackoverflow.com/a/27573771
has answer: http://stackoverflow.com/a/27573856
has title: Cannot create Set from String array
type: Question
has comment: http://stackoverflow.com/comment/43573000
has comment: http://stackoverflow.com/comment/43572852
has comment: http://stackoverflow.com/comment/43572888
accepted answer: http://stackoverflow.com/a/27573657
has comment: http://stackoverflow.com/comment/43572722
has comment: http://stackoverflow.com/comment/43572680
has answer: http://stackoverflow.com/a/27573771
answer count: 4
has answer: http://stackoverflow.com/a/27573808

http://stackoverflow.com/q/27486119
tagged with: java
possible better answer: http://stackoverflow.com/a/27487848
has body: What are the options to index large data from Oracle DB to elastic search cluster? Requirement is to index 300Million records one time into multiple indexes and also incremental updates having around approximate 1 Million changes every day. I have tried JDBC plugin for elasticsearch river/feeder, both seems to be running inside or require locally running elastic search instance. Please let me know if there is any better option for running elastic search indexer as a standalone job (probably java based). Any suggestions will be very helpful. Thanks.
has answer: http://stackoverflow.com/a/27487848
tagged with: elasticsearch-plugin
score: 9
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27515459
tagged with: relational-database
tagged with: oracle-database
tagged with: elasticsearch
has title: what is the better way to index data from Oracle/relational tables into elastic search?
accepted answer: http://stackoverflow.com/a/27515459
type: AnsweredQuestion
upvote count: 9

http://stackoverflow.com/comment/43572500
type: QuestionComment
has text: Just a note that while [HandlerThread](http://developer.android.com/reference/android/os/HandlerThread.html) doesn't solve your problem, it does do all the boilerplate thread+looper stuff for you.
comment on: http://stackoverflow.com/q/27573315
score: 0
type: Comment

http://stackoverflow.com/comment/43576479
has text: There is another post related to this: http://stackoverflow.com/questions/13501836/possible-java-compiler-bug-program-does-not-compile-with-some-compilers and http://stackoverflow.com/questions/5201687/forward-reference-of-type-parameter-in-java-generics Apparently, it was fixed in JDK 1.7
type: Comment
comment on: http://stackoverflow.com/a/27575369
type: AnswerComment
score: 2

http://stackoverflow.com/q/27639439
has body: I have an ArrayList of arrays and i changed "5" to " 12 6" Then I concatenated "3" with " 12 6". [2,4,6] [1,3,5] => [2,4,6] [1,3, 12 6] => [2,4,6] [1,3 12 6, 12 6] Now i want to remove " 12 6" and my arraylist to become [2,4,6] [1,3 12 6] Then i want to make [1,3 12 6] to [1,3,12,6] And my list look like [2,4,6] [1,3,12,6] I have no idea if it's possible and how to do it(maybe there is another way). I have to delete one number and add two numbers List&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;(); String [] arr1 = {"2","4","6"}; String [] arr2 = {"1","3","5"}; list.add(arr1); list.add(arr2); for (String[] ss : list) { //System.out.println(Arrays.toString(ss)); for ( i = 0; i &lt; ss.length; i++) { if (ss[i] == "5") { System.out.println("Yes"); ss[i] = " 12 6"; ss[i-1] = ss[i-1] + String.valueOf(ss[i]); } } System.out.println(Arrays.toString(ss)); }
tagged with: arraylist
score: 0
answer count: 1
tagged with: arrays
tagged with: string
has comment: http://stackoverflow.com/comment/43697791
has comment: http://stackoverflow.com/comment/43698258
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27639500
has comment: http://stackoverflow.com/comment/43697852
has title: ArrayList of array delete element and split method
type: Question

http://stackoverflow.com/comment/43541707
comment on: http://stackoverflow.com/a/27557760
type: AnswerComment
score: 0
type: Comment
has text: maybe but in terms of semantics, checked also happen at runtime... right? Or maybe their catchable ability makes them actually... cought... which means they actually *don't* get through at runtime.

http://stackoverflow.com/comment/43626563
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27602038
has text: make your connection scrollable and reset to first your resultset2 on each iteration.

http://stackoverflow.com/q/27613613
has comment: http://stackoverflow.com/comment/43649816
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27616893
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43668312
has answer: http://stackoverflow.com/a/27613932
downvote count: 0
has comment: http://stackoverflow.com/comment/43649653
score: 4
answer count: 3
has comment: http://stackoverflow.com/comment/43655461
has title: Deserializing json array in Spring MVC controller
favorite count: 0
has comment: http://stackoverflow.com/comment/43649689
type: UnansweredQuestion
has body: I am sending a list of json object and trying to deserialize it in my Spring controller. But all the time I am getting error of 'Bad request' and results into a status code of 415. However, my json array is a valid one. json is - { "users": [ { "userName": "john", "email": "john@gmail.com", "user_id": "u223344" }, { "userName": "Smith", "email": "smith@gmail.com", "user_id": "u223345" } ] } Ajax call is as follows - $.ajax({ url: $("#addNewUser").attr("action"), data: JSON.stringify({users : dataToSend}), dataType: 'json', type: "POST", beforeSend: function(xhr) { xhr.setRequestHeader("Accept", "application/json"); xhr.setRequestHeader("Content-Type", "application/json"); }, success: function(data){ alert('success= ' + data); }, error:function(data,status,er) { alert("error: "+ data.responseText +" status: "+status+" er:"+er); } }); Wrapper classes are as follows. User and UserWrapper class - public class User { private String email; private String userName; private String user_id; //getters and setters } public class UserWrapper { private List&lt;User&gt; userList; //getter and setter } And finally the spring MVC controller is - @RequestMapping(value="/user/add", method=RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void createTeamMember(@RequestBody UserWrapper userWrapper) { try{ for(User user : userWrapper.getUserList()){ System.out.println(user.getEmail()); } }catch(Exception ex){ ex.printStackTrace(); } } I've added dependency for jackson-core and jackson-mapper in pom.xml. And I am using Spring 4.0.3. Any help is appreciated.
tagged with: spring
has answer: http://stackoverflow.com/a/27613918
has comment: http://stackoverflow.com/comment/43655415
tagged with: spring-mvc

http://stackoverflow.com/comment/43484827
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27528072
has text: You have other errors too, e.g. since the `<HBox>` in your child.fxml file is being placed in a `BorderPane`, you can't set `AnchorPane` properties on it. The answer just gives the reasons for the error you posted.

http://stackoverflow.com/q/27621062
tagged with: apk
tagged with: parse-platform
has title: Push notify doesn't arrive
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/27621517
has comment: http://stackoverflow.com/comment/43662843
tagged with: java
has comment: http://stackoverflow.com/comment/43662756
has body: I build an android app composed by a web view, in parse.com i've got my device registered but when i send a push notification in "pushes sent" there is 0 pushes. this is my Mainactivity: import com.party.bparty.MainActivity; import com.parse.Parse; import com.parse.ParseInstallation; import com.parse.ParsePush; import com.parse.ParseQuery; import com.parse.PushService; public class MainActivity extends ActionBarActivity { private WebView mWebView; private String url = "http://www.bestparty.altervista.org"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //attivo parse per le notifiche Parse.initialize(this,"zJxpd9798Ns6A9rzUDpe78ElRY0I99ES3LD6nDQV","kmAmA1iTbC32BTE9ERtzNOoHXbJchhIn6tyPXKMi"); PushService.setDefaultPushCallback(this, MainActivity.class); ParseInstallation.getCurrentInstallation().saveInBackground(); //... //...initializing and loading the contentview and the webview } //options menu omitted } this is my MycustomReceiver public class MyCustomReceiver extends BroadcastReceiver { private static final String TAG = "MyCustomReceiver"; @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) Log.d(TAG, "Receiver intent null"); else { String action = intent.getAction(); Log.d(TAG, "got action " + action ); if (action.equals("com.party.bparty.UPDATE_STATUS")) { String channel = intent.getExtras().getString("com.parse.Channel"); JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data")); Log.d(TAG, "got action " + action + " on channel " + channel + " with:"); Iterator itr = json.keys(); while (itr.hasNext()) { String key = (String) itr.next(); if (key.equals("customdata")) { Intent pupInt = new Intent(context, ShowPopUp.class); pupInt.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK ); context.getApplicationContext().startActivity(pupInt); } Log.d(TAG, "..." + key + " => " + json.getString(key)); } } } } catch (JSONException e) { Log.d(TAG, "JSONException: " + e…
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43663089
has comment: http://stackoverflow.com/comment/43663421
tagged with: android

http://stackoverflow.com/q/27565172
has body: I am parsing xml from web service, i want to use xml values as a arraylist eElement.getElementsByTagName(Lyr_NAME) values are Traffic , Satellite , Hybrid , Satellite 2 eElement.getElementsByTagName(Lyr_URL) values are url1 , url2 , url3, url4 Lyr_LAYER_TYPE and Lyr_FIELD has 4 elements List&lt;String&gt; LayerNames = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; nl.getLength(); i++) { Node nNode = nl.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; LayerNames.add(0, eElement.getElementsByTagName(Lyr_NAME).item(0).getTextContent()); LayerNames.add(1,eElement.getElementsByTagName(Lyr_URL).item(0).getTextContent()); LayerNames.add(2,eElement.getElementsByTagName(Lyr_LAYER_TYPE).item(0).getTextContent()); LayerNames.add(3,eElement.getElementsByTagName(Lyr_FIELD).item(0).getTextContent()); } } Layer values are coming rapidly. But when i use get to access elements in arraylist it always return Lyr_NAME elements, then when i write LayerNames[0] Android Studio didn't resolve type. My log is; Log.e("Array List Result",LayerNames.get(0)); My question is how can i access to Lyr_URL , Lyr_TYPE or Lyr_FIELD ;? Thanks in advance
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27565288
type: Question
has answer: http://stackoverflow.com/a/27565288
has answer: http://stackoverflow.com/a/27565263
accepted answer: http://stackoverflow.com/a/27565263
has answer: http://stackoverflow.com/a/27565355
tagged with: arraylist
answer count: 3
has title: How can i access list elements in arraylist
upvote count: 1
downvote count: 0
favorite count: 0
tagged with: android

http://stackoverflow.com/q/27540734
score: 3
has title: Is it possible to preview which class files will Java compiler generate?
downvote count: 0
has answer: http://stackoverflow.com/a/27540873
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43509624
has comment: http://stackoverflow.com/comment/43508994
has comment: http://stackoverflow.com/comment/43509537
has body: Is there an option for javac, say --dry-run, that will instruct the compiler not to do the actual compilation, but to parse the source file(s) and list which .class files (including package path) will be generated? Consider this example: $ cat example.java package whatever.example; class First {} class Second {} $ javac -d . example.java $ find . . ./example.java ./whatever ./whatever/example ./whatever/example/First.class ./whatever/example/Second.class The source file was compiled into two .class files and, as the -d option was specified, package structure was generated. I would like to know such information before compilation. Something like this: $ javac --dry-run -d . example.java ./whatever/example/First.class ./whatever/example/Second.class Alternatively, if there is no such an option for javac, is there any third-party utility that can do such a thing?
upvote count: 3
answer count: 1
favorite count: 0
tagged with: javac
type: UnansweredQuestion
tagged with: package
has comment: http://stackoverflow.com/comment/43511809
has comment: http://stackoverflow.com/comment/62369628
has comment: http://stackoverflow.com/comment/43510842

http://stackoverflow.com/comment/43529462
comment on: http://stackoverflow.com/q/27551276
type: Comment
type: QuestionComment
has text: "specified cells" - can you get those at runtime then add the listener there? I'm don't know the Grid from GTX, maybe there is a way to waddle trough it's rows? Sorry for being not so helpful
score: 0

http://stackoverflow.com/q/27516425
type: Question
has answer: http://stackoverflow.com/a/50364143
score: 5
answer count: 3
accepted answer: http://stackoverflow.com/a/27516657
tagged with: session
upvote count: 5
tagged with: java
tagged with: servlets
possible better answer: http://stackoverflow.com/a/27516451
tagged with: httpsession
has answer: http://stackoverflow.com/a/27516451
has body: I have three simple HttpServlet classes in my JSP project, "LoginServlet", "LogoutServlet" and "ProfileServlet". LoginServlet: log in user by setting "name" attribute to session LogoutServlet: log out user and invalidate session ProfileServlet: display user welcome info if user has logged in The last two servlets are as below that I reckon are problematic. @SuppressWarnings("serial") public class LogoutServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); HttpSession session=request.getSession(false); session.invalidate(); request.getRequestDispatcher("link.jsp").include(request, response); out.print("You are successfully logged out!"); out.close(); } } And @SuppressWarnings("serial") public class ProfileServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); request.getRequestDispatcher("link.jsp").include(request, response); HttpSession session = request.getSession(false); if (session != null) { String name = (String) session.getAttribute("name"); out.print("Hello, " + name + " Welcome to Profile"); } else { out.print("Please login first"); request.getRequestDispatcher("login.html").include(request, response); } out.close(); } } And the link.jsp: <% HttpSession nsession = request.getSession(false); if(nsession == null) { %> Login <% } else { %> Logout <% } %> Profile The problem is while user is logged in, when the "Logout" link is clicked and "LogoutServlet" is called, session is not correctly invalidated and ProfileServlet still prints out "Hello, null Welcome to Profile" instead of redirecting to the "login.html" page because the session is still NOT null. As a result of it, "Login" link is not shown on the "link.jsp" page. Thi…
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5515729
downvote count: 0
tagged with: jsp
has title: JSP Servlet session invalidate() does not make session null
favorite count: 0
has answer: http://stackoverflow.com/a/27516657

http://stackoverflow.com/comment/43653385
comment on: http://stackoverflow.com/q/27615889
score: 0
type: Comment
type: QuestionComment
has text: Does your specified maven version is correct?

javafx
tags question: http://stackoverflow.com/q/27612113
tags question: http://stackoverflow.com/q/27475902
type: Tag
tags question: http://stackoverflow.com/q/27613987
tags question: http://stackoverflow.com/q/27528005
tags question: http://stackoverflow.com/q/27546875
tags question: http://stackoverflow.com/q/27530403
tags question: http://stackoverflow.com/q/27515754
tags question: http://stackoverflow.com/q/27477135
tags question: http://stackoverflow.com/q/27595096
tags question: http://stackoverflow.com/q/27546389
tags question: http://stackoverflow.com/q/27499450
tag name: javafx
tags question: http://stackoverflow.com/q/27556536
tags question: http://stackoverflow.com/q/27576115
tags question: http://stackoverflow.com/q/27566017
tags question: http://stackoverflow.com/q/27537776
tags question: http://stackoverflow.com/q/27585668
tags question: http://stackoverflow.com/q/27580503
tags question: http://stackoverflow.com/q/27630194
tags question: http://stackoverflow.com/q/27514309
tags question: http://stackoverflow.com/q/27603400
tags question: http://stackoverflow.com/q/27485588
tags question: http://stackoverflow.com/q/27481773
tags question: http://stackoverflow.com/q/27561765
tags question: http://stackoverflow.com/q/27626181
tags question: http://stackoverflow.com/q/27556503
tags question: http://stackoverflow.com/q/27609387
tags question: http://stackoverflow.com/q/27485617
tags question: http://stackoverflow.com/q/27613679
tags question: http://stackoverflow.com/q/27619720
tags question: http://stackoverflow.com/q/27519336
tags question: http://stackoverflow.com/q/27604232
tags question: http://stackoverflow.com/q/27587572
tags question: http://stackoverflow.com/q/27553484
tags question: http://stackoverflow.com/q/27508999
tags question: http://stackoverflow.com/q/27539547
tags question: http://stackoverflow.com/q/27535087
tags question: http://stackoverflow.com/q/27502479
tags question: http://stackoverflow.com/q/27514969
tags question: http://stackoverflow.com/q/27494048
tags question: http://stackoverflow.com/q/27591475
tags question: http://stackoverflow.com/q/27593097
tags question: http://stackoverflow.com/q/27620195
tags question: http://stackoverflow.com/q/27563541

http://stackoverflow.com/comment/43677794
has text: as i said it's a Java question (and not related to Scala) - for example see http://stackoverflow.com/questions/4437715/why-is-system-out-println-so-slow
comment on: http://stackoverflow.com/q/27628373
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27555951
accepted answer of: http://stackoverflow.com/q/27555912
answers question: http://stackoverflow.com/q/27555912
type: Answer
upvote count: 4
has body: From the specification A nested enum type is implicitly static. It is permitted for the declaration of a nested enum type to redundantly specify the static modifier. Regardless, a type is not a member of an instance. It is (possibly) a member of a type. As the specification says, a field access expression takes the following form FieldAccess: Primary. Identifier super . Identifier TypeName . super . Identifier We care about the first case, with a Primary expression. You have to access the enum constant through its type name, through the name of its enclosing type. You say I could just use Class1.EnumExample, but I'm trying to avoid using the class' name in here for convenience and type-safety, There's not much more type safe than using the type name in source code. A Class instance and a type name are two completely different things. The type java.lang.Class is a type like any other (String, List, ExecutorService, etc.). It has its fields and methods. If you have a value of type Class, you can use it to access those members. With a type name, you can declare variables, you can declare type arguments, create new instances (with new), and invoke static methods.
downvote count: 0
type: AcceptedAnswer
score: 4

http://stackoverflow.com/comment/43576918
type: QuestionComment
comment on: http://stackoverflow.com/q/27574173
score: 0
type: Comment
has text: I would like to solve it without using 3rd party programs.

http://stackoverflow.com/comment/43608421
has text: This sounds like a school assignment it - so here is a general way to do it: - Create a new array of the type you need of length `myLinkedList.size()` - Use a `for` loop to iterate the array - Assign to the array elements using `.get(i)`
comment on: http://stackoverflow.com/q/27592360
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27583414
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43622975
has comment: http://stackoverflow.com/comment/43593145
favorite count: 0
tagged with: android-asynctask
has body: I have an activity in which when on its onCreate() state will executes a BackgroundTask (AsyncTask) that will return some data to the activity when its finished executing. When the data is received the activity adds a listFragment to itself through a Fragmenttransaction. The data received will be passed to the ListFragment for its adapter usage. The issue is while the background task is running and then the screen orientation changes, the moment when the onPostExecute passes a data back to the activity and the activity tries to add the ListFragment the application crashes with the below error. java-lang-illegalstateexception-can-not-perform-this-action-after-onsaveinstance Then i tried using .commitAllowingStateLoss(); with this i receive the error below Activiy has been Destroyed Please how else can i handle this flow process such that the screen orientation change doesn't crash the application. Note that without a change in the screen orientation everything works perfect. It only gets worse when there is a screen orientation change between when the activity is waiting for the background task to execute completely with its response data.
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has title: Activity has been destroyed (Fragment transaction commit + AsyncTask)
tagged with: android-fragments
score: 1
tagged with: java

http://stackoverflow.com/comment/43673333
score: 0
comment on: http://stackoverflow.com/q/27622499
has text: Is there *actually* one JSON object per line? If so, that would make things pretty simple - just read a line at a time and parse each line as JSON... If some objects cover multiple lines (or if there are some lines with multiple objects) then obviously that doesn't work.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43479723
comment on: http://stackoverflow.com/q/27525585
type: QuestionComment
type: Comment
score: 2
has text: You didnt set content-type as html... Juts remove tags and retry it would work.

http://stackoverflow.com/comment/43424352
type: Comment
has text: @justmscs Right, 0.45 is actually parsed into the nearest binary floating-point quantity, 0.450000000000000011102230246251565404236316680908203125. So with `0.45 * i`, when `i == 40` (the end of the OP's loop), the skew will be multiplied by 40. With the `45 * i / 100.0` approach, the `45 * i` part is exact, so you will always have the minimum skew each time (which happens in the `/ 100.0` part).
type: AnswerComment
comment on: http://stackoverflow.com/a/27496232
score: 0

http://stackoverflow.com/comment/43571218
score: 0
type: QuestionComment
has text: 14/12/19 19:44:06 ERROR tool.ImportTool: Imported Failed: column not found: \`Column 0\`
type: Comment
comment on: http://stackoverflow.com/q/27572527

http://stackoverflow.com/a/27590374
answers question: http://stackoverflow.com/q/27590313
score: 1
has comment: http://stackoverflow.com/comment/43605187
has comment: http://stackoverflow.com/comment/43604849
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43604648
downvote count: 0
has body: You can create a 2d boolean array, so only two values are allowed (true or false): boolean[][] matrix = new boolean[rows][columns]; Or use a 2d short array that allow more of 2 values, but you can put on it the value 0 and 1: short[][] matrix = new short[rows][columns]; Or use byte object: byte[][] matrix = new byte[rows][columns];
has comment: http://stackoverflow.com/comment/43605042
has comment: http://stackoverflow.com/comment/43604555

http://stackoverflow.com/q/27603173
has comment: http://stackoverflow.com/comment/43630033
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27603925
has body: I have a maven driven project (currently we use maven 3.0.5) We've come to conclusion that we have to develop our custom maven plugin that does some processing over our resources + running validations on them (this involves some unique logic, so we can't use existing maven plugins) Examples of what should be done there are: Validate the resources added to the module. If its an XML, check that it adheres the schema, check that there is no duplication between these XMLs (according to some logic) and so forth. For example if I have XML: <person> john <person> I want to make sure that there is no other XML with the same name. If its a JSON based resource, than check that it does custom logic based validations. Its done mainly because there are too much people (the project is very big) changing these XMLs so we would like to check the stuff in compile time at least whatever we can check. Prepare a custom distribution out of these XMLs (for example we create ZIP of ZIPs, each inner zip archive contains some group of those XMLs) Generate some metadata based on the information found in these XMLs and add it to the inner/outer zip Now, I would like to build the maven plugin together with the build of the project. These validations can kind of change along with the logic. For example if I create new type of XML resources I can develop new kinds of validations that go beyond the validation against the schema. And then I want these validations running each build. As far as I understand, in gradle there is a buildSrc directory for this kind of things, however in Maven I couldn't find something like that. So my question is how we can do this in maven? Thanks a lot in advance and have a nice day
type: UnansweredQuestion
tagged with: maven
tagged with: build
tagged with: java
type: Question
has title: Maven plugin build

http://stackoverflow.com/comment/43451019
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27509321
type: Comment
has text: You can use a decision step to choose which one to execute at runtime.

http://stackoverflow.com/comment/43515228
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27544196
has text: `notify` outside a synchronized block produces an `IllegalMonitorStateException`...
type: Comment

http://stackoverflow.com/a/27553876
downvote count: 0
type: Answer
upvote count: 1
has body: I can't say for certain that this is the answer to my question because I have not received any feedback from DocuSign, but after two full days of scouring documentation, blogs, StackOverflow, and more I thought I finally had a working solution. I followed most of the steps posted at How can I use certificate authentication with HttpsURLConnection? and was able to connect and send a document for signature. That felt great! But then I tried the original java program referenced at the top of my post above, and now it worked, just like it did last week (but not the first few days of this week). So none of the work I did on SSL, importing certificates to my keystore, etc., was relevant or meaningful. I suppose it's naive of me to think this, but I've got to assume that somebody at DocuSign changed something last week, and then changed it back today. If I am wrong on that assumption and somebody at DocuSign can set me straight, that would be really wonderful. Better late than never. But until something changes, it appears my problem is "solved".
score: 1
answers question: http://stackoverflow.com/q/27490976

http://stackoverflow.com/a/27510375
type: Answer
answers question: http://stackoverflow.com/q/27510357
score: 1
upvote count: 1
downvote count: 0
has body: length is a field of an array that is not being calculated if you call myArray.length, instead it is being set when you create the array. So no, it's not more efficient to save it to a variable before starting the for() loop.

http://stackoverflow.com/comment/81731761
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27527568
has text: Got same problem when i gave new Size(0,0), resolved it by making it only positive numbers
type: AnswerComment

http://stackoverflow.com/q/27509890
accepted answer: http://stackoverflow.com/a/27510568
possible better answer: http://stackoverflow.com/a/27510588
has comment: http://stackoverflow.com/comment/43450103
has comment: http://stackoverflow.com/comment/43450155
has title: For loop for printing letters
tagged with: java
upvote count: 4
has comment: http://stackoverflow.com/comment/43450257
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27510568
downvote count: 0
has body: public class LetterPrint { int totalLines; int consecLines; int timesPrintedinLine; int linesPrinted; char currentChar; LetterPrint(int totalLines, int consecLines){ this.totalLines = totalLines; this.consecLines = consecLines; } void beginPrinting(){ for(timesPrintedinLine = 0; linesPrinted&lt;=totalLines; timesPrintedinLine++) { Print(); } } public char correctChar(){ if(timesPrintedinLine/(consecLines*4) == 1) return currentChar = 'A'; else return currentChar = 'B'; } void Print(){ if (timesPrintedinLine%5 !=0) System.out.print(correctChar()); else{ System.out.println(); linesPrinted = timesPrintedinLine/4; } } } Can anyone help me see why, when created with "LetterPrint letterPrinter = new LetterPrint(6,1);" this object is printing BBBA AABB BBBB BBBB BBBB BBBB rather than AAAA BBBB AAAA BBBB AAAA BBBB I appreciate anyone who can clear this up for me.
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27510591
has comment: http://stackoverflow.com/comment/43449986
has comment: http://stackoverflow.com/comment/43450144
has comment: http://stackoverflow.com/comment/43450021
has answer: http://stackoverflow.com/a/27510714
score: 4
has answer: http://stackoverflow.com/a/27510588

http://stackoverflow.com/q/27552948
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/43532310
tagged with: java
type: Question
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27553175
has body: These are the instructions for the assignment: In this task, you add four more methods to the APRectangle class and you define a static method that generates a string reporting the defining characteristics of a rectangle. The first three methods — getTopRight, getBottomLeft, and getBottomRight — together with the accessor method getTopLeft return the APPoint objects that represent the four corners of the rectangle. As you define the three new methods, bear in mind that locations in a Java graphics window are described relative to the window's top left corner. So the further a location is to the right in a graphics window, the greater its x-coordinate. And — unexpectedly — the lower down a location is in a graphics window, the greater its y-coordinate. This means that the bottom corners of a rectangle will have greater y-coordinates than the top corners. The fourth method, shrink, takes a single argument, the double d, and changes the width and the height of the rectangle to d% of their former values. So, for example, if the shrink method of an APRectangle r is called on the double 62.5, then r's width and height will be changed to 0.625 of their former values. Finally, the static method printAPRectangle is such that, when its argument is the APRectangle whose top left corner is the APPoint with coordinate (-5.0,3.6), whose width is 7.5, and whose height is 6.3, it returns the string "[APRectangle (-5.0,3.6) 7.5,6.3]" As you define this method, pay close attention to the location of spaces. You will probably find it useful to call upon the printAPPoint static method as well as all three of the accessor methods of the APRectangle class. The code I currently have is: public class APRectangle { private APPoint myTopLeft; private double myWidth; private double myHeight; public APRectangle( APPoint topLeft, double width, double height ) { // Code for the body of this constructor is hidden } /* * Code for the accessor methods getTopLeft, getWidth, and getHeight and * the m…
downvote count: 3
score: -3
has title: Simple Objects Issue
has answer: http://stackoverflow.com/a/27553175

http://stackoverflow.com/comment/43522234
has text: Yes I've tried that before. And the result was anything inside the scroll pane was rendered properly, but everything else was black :(
type: QuestionComment
comment on: http://stackoverflow.com/q/27539112
score: 0
type: Comment

http://stackoverflow.com/a/27590961
accepted answer of: http://stackoverflow.com/q/27590623
has body: You can get an instance of Hibernate Session via EntityManager. @Autowired private EntityManagerFactory emf; public void foo(){ EntityManager em = emf.createEntityManager(); Session session = em.unwrap(Session.class); LobCreator lob = getLobCreator(session); ... }
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27590623
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/43471587
type: QuestionComment
type: Comment
has text: did you try attrib filename +s +h you have used a wrong format see my post
score: 0
comment on: http://stackoverflow.com/q/27520747

textview
tags question: http://stackoverflow.com/q/27495927
tags question: http://stackoverflow.com/q/27483428
tag name: textview
type: Tag
tags question: http://stackoverflow.com/q/27505807
tags question: http://stackoverflow.com/q/27491414
tags question: http://stackoverflow.com/q/27630484

http://stackoverflow.com/comment/43412856
type: QuestionComment
has text: the view source shows :
comment on: http://stackoverflow.com/q/27488949
score: 0
type: Comment

http://stackoverflow.com/comment/43397381
type: Comment
score: 2
has text: Can you post the code of `Contest`, and how you instantiate it (the code which calls `createContest()`). Are there any self-refernces?
comment on: http://stackoverflow.com/q/27482355
type: QuestionComment

embeddable
type: Tag
tag name: embeddable
tags question: http://stackoverflow.com/q/27552445

http://stackoverflow.com/q/27570356
tagged with: java
upvote count: 1
answer count: 1
has title: Android Studio: Can't run tutorial app because of HAXM
has body: I start to learn Android Development using Android Studio, so when I apply what is in the Run app page (android 5.0): https://developer.android.com/training/basics/firstapp/running-app.html I get C:\Users\?!?!\AppData\Local\Android\sdk\tools\emulator.exe -avd Nexus_5_API_21_x86 -netspeed full -netdelay none emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX kernel module is not installed! I searched here and I found that I should install: Intel x86 Emulator Accelerator(HAXM installer), I download it but the problem is that my CPU does not support intel Virtualization Technology. so how can I run apps without it. Please Help I'm STACK. thanks
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27570387
score: 1
favorite count: 0
type: Question
tagged with: android
tagged with: android-studio
has comment: http://stackoverflow.com/comment/53141916
accepted answer: http://stackoverflow.com/a/27570387

http://stackoverflow.com/q/27531817
tagged with: object
type: AnsweredQuestion
has title: Simple Objects and Constructor Issue
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43492146
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/43492140
favorite count: 0
has answer: http://stackoverflow.com/a/27531868
tagged with: visibility
tagged with: symbols
has body: These are the instructions for the assignment: In this task, you add four more methods to the APRectangle class and you define a static method that generates a string reporting the defining characteristics of a rectangle. The first three methods — getTopRight, getBottomLeft, and getBottomRight — together with the accessor method getTopLeft return the APPoint objects that represent the four corners of the rectangle. As you define the three new methods, bear in mind that locations in a Java graphics window are described relative to the window's top left corner. So the further a location is to the right in a graphics window, the greater its x-coordinate. And — unexpectedly — the lower down a location is in a graphics window, the greater its y-coordinate. This means that the bottom corners of a rectangle will have greater y-coordinates than the top corners. The fourth method, shrink, takes a single argument, the double d, and changes the width and the height of the rectangle to d% of their former values. So, for example, if the shrink method of an APRectangle r is called on the double 62.5, then r's width and height will be changed to 0.625 of their former values. Finally, the static method printAPRectangle is such that, when its argument is the APRectangle whose top left corner is the APPoint with coordinate (-5.0,3.6), whose width is 7.5, and whose height is 6.3, it returns the string "[APRectangle (-5.0,3.6) 7.5,6.3]" As you define this method, pay close attention to the location of spaces. You will probably find it useful to call upon the printAPPoint static method as well as all three of the accessor methods of the APRectangle class. The code I currently have is: public class APRectangle { private APPoint myTopLeft; private double myWidth; private double myHeight; public APRectangle( APPoint topLeft, double width, double height ) { // Code for the body of this constructor is hidden } /* * Code for the accessor methods getTopLeft, getWidth, and getHeight and * the m…
answer count: 1
accepted answer: http://stackoverflow.com/a/27531868
downvote count: 1

http://stackoverflow.com/comment/43496057
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27530299
has text: @heyya99 Also check something like [Dozer](http://dozer.sourceforge.net/) for deep mapping.

http://stackoverflow.com/a/27495645
upvote count: 2
answers question: http://stackoverflow.com/q/27495624
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43423131
has body: I can't initialize the data in a two-dimensional array because the number of cells can be changed according to the input of the user. Why not declare the array as a non-static field in the class, but simply initialize it only after getting user input? Myself I'd extend DefaultTableModel and use the constructor that allows a row count as one of the parameters: public DefaultTableModel(Object[] columnNames, int rowCount)
accepted answer of: http://stackoverflow.com/q/27495624

http://stackoverflow.com/comment/99515665
comment on: http://stackoverflow.com/a/51965253
type: AnswerComment
has text: Why do you call `System.gc()` in the process? It's completely useless in this context, and only causes noise.
score: 4
type: Comment

http://stackoverflow.com/comment/43496049
comment on: http://stackoverflow.com/a/27533410
score: 1
type: AnswerComment
has text: Thanks for the tip. Just added: DecimalFormat df = new DecimalFormat(".0"); and it works great!
type: Comment

http://stackoverflow.com/a/29708857
type: Answer
has body: The posted solution did not work for me: public static void bind(Binder binder, String flagName, Object value) { Key&lt;Object&gt; key = Key.get((Class) value.getClass(), new FlagImpl(flagName)); binder.bind(key).toInstance(value); } This would bind everything to the java.lang.Class object. However, this worked: Class impl = ... Class intrf = ... binder.bind(intrf).to(impl);
score: 0
answers question: http://stackoverflow.com/q/27625476

http://stackoverflow.com/q/27580444
has comment: http://stackoverflow.com/comment/43585975
has comment: http://stackoverflow.com/comment/43586145
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43586192
type: Question
has comment: http://stackoverflow.com/comment/43585816
linked to: http://stackoverflow.com/q/18369252
accepted answer: http://stackoverflow.com/a/27583296
has title: Inserting values from JTable to MySQL
has comment: http://stackoverflow.com/comment/43607337
has comment: http://stackoverflow.com/comment/43586333
has comment: http://stackoverflow.com/comment/43585697
has answer: http://stackoverflow.com/a/27583296
has body: I am new here and need your help ... I'm just a beginner so bear with me for any stupidity in the code. I have made a project on railway management system and want to insert values from text fields and java table to MySQL database. How can I get rid of this error? "column index out of range,3>1 " Here's the code I wrote: try{ Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/railway","root","ridhi"); st =con.createStatement(); String sourcee =(String) cb1.getSelectedItem(); String desti =(String) cb2.getSelectedItem(); String art =(String) cb3.getSelectedItem(); String tic= tick.getText(); String rdate=frm.getText(); String rdatde=to.getText(); String rdagte=bp.getText(); String rdagtge=ru.getText(); String ddate=date.getText(); String pnr=l1.getText(); String q="INSERT INTO pnr values("+l1.getText()+","+cb1.getSelectedItem()+","+"'"+cb2.getSelectedItem()+"'"+","+"'"+frm.getText()+"'"+","+"'"+to.getText()+"'"+","+"'"+date.getText()+"'"+","+"'"+cb3.getSelectedItem()+"'"+","+"'"+ru.getText()+"'"+","+"'"+bp.getText()+"'"+","+tick.getText()+");"; st.executeUpdate(q); while(rs.next()){ model.getRow(new Object[]{ rs.getInt(11),rs.getString(12),rs.getInt(13), rs.getString(14), rs.getString(15), rs.getString(16) } ); } } catch(Exception e){ JOptionPane.showMessageDialog(null,e.getMessage()); } error: java.sql.SQLException: Column count doesn't match value count at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1564) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:…
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43585677
favorite count: 0
has comment: http://stackoverflow.com/comment/43585491
type: AnsweredQuestion

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/27544766
tags question: http://stackoverflow.com/q/27543081
tags question: http://stackoverflow.com/q/27496849
type: Tag
tags question: http://stackoverflow.com/q/27561735
tags question: http://stackoverflow.com/q/27493043
tags question: http://stackoverflow.com/q/27637375

http://stackoverflow.com/comment/43448165
type: QuestionComment
has text: When I try to compile Derived.java or Protection.java, it shows error. Cannot find symbol error
comment on: http://stackoverflow.com/q/27508886
score: 0
type: Comment

http://stackoverflow.com/comment/43638242
score: 0
type: Comment
has text: Right, that's what we need, isn't it? The left side means neither a digit nor a plus sign in the beginning of the line.
type: AnswerComment
comment on: http://stackoverflow.com/a/27608010

http://stackoverflow.com/q/27515732
type: UnansweredQuestion
tagged with: amazon-emr
has title: When running a custom Jar in Amazon EMR where is my jar run from?
has answer: http://stackoverflow.com/a/27582946
tagged with: java
type: Question
has body: All, I am packaging my custom jar with all its dependencies, one of these conflicts with another jar on the EMR instance, so I want to add a step to set my classpath to the directory containing my custom jar, but to do that I need to know where that jar will reside on the various nodes and if there are any env vars that I can use to make these changes, if someone knows of a better way to resolve the root problem other than building against the same version of the jars on the EMR as that is not possible that would also be welcome input. Thank you,
score: 0
answer count: 1
tagged with: amazon-web-services

http://stackoverflow.com/comment/43557560
score: 0
comment on: http://stackoverflow.com/a/27563173
type: Comment
has text: is hibernate creats a default EMFactory or it creates without any factory classes.
type: AnswerComment

http://stackoverflow.com/a/30210316
type: Answer
answers question: http://stackoverflow.com/q/27507392
upvote count: 1
has body: you can use type casting in getter , setter methods and use String for you property datatype . @Column(length=1 ) private String string; public Boolean getString() { return Boolean.valueOf(string) ; } public void setString(Boolean string) { this.string = (string) ? "1" : "0"; }
score: 1
downvote count: 0

http://stackoverflow.com/comment/43590479
has text: @Tom thanks.I just added next level of code. Can u have a look .Basically the recursive call
score: 0
comment on: http://stackoverflow.com/q/27582765
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/44943630
type: Comment
type: QuestionComment
has text: We had one of our developers spill blood, sweat and tears creating a Rajawali + Vuforia wrapper that means you can load any model file Rajawali can use (OBJ or FBX typically). If we release it, I'll come back and let you know!
comment on: http://stackoverflow.com/q/27484102
score: 0

http://stackoverflow.com/comment/125095028
type: AnswerComment
comment on: http://stackoverflow.com/a/41777625
type: Comment
has text: THis should be the top answer. Using libphonenumber library is way better than regex. Especially if you need to validate international numbers. https://javalibs.com/artifact/com.googlecode.libphonenumber/libphonenumber.
score: 0

http://stackoverflow.com/q/27570571
has comment: http://stackoverflow.com/comment/43566930
accepted answer: http://stackoverflow.com/a/28163448
has body: I'm using MVC to organise an Maths Game application that has multiple classes that are the following: MathsGame.java: Main class. Currently holds CardLayout which screen classes are contained in and runs the application along with other controller-like actions. DiffScreen.java: Implements components and contains methods for use on the difficulty selection screen. Is extended from MigJPanel and is essentially a mix of a Model/View. GameScreen.java: Implements components and contains methods for use on the game screen. Is extended from MigJPanel and is essentially a mix of a Model/View. EndGameScreen.java: Implements components and contains methods for use on the end game screen. Is extended from MigJPanel and is essentially a mix of a Model/View. MigJPanel.java: Extends JPanel and sets layout to MigLayout and adds a matte border. ScreenInterface.java: Is implemented by DiffScreen, GameScreen, and EndGameScreen and contains final variables and an enum. I've watched some tutorials and read up on MVC, but a lot of the resources I've found on it deal with very basic programs; having one model, one view, one controller, and a main class. I have an idea of how I must go about refactoring my program to work with MVC, but I'm unsure about a couple of things. Am I right in saying that from what classes I have above, I should split DiffScreen, GameScreen, and EndGameScreen into Model and View classes for each? Additionally, would it be better to create one Controller class or—as I've seen suggested—not bother and instead combine it with my Main MathsGame class? An approach I was suggested to use in a previous question here whereby I could implement a Controller interface seems useful too, but I'm not exactly sure if/how that would work with my new code. Would it be helpful/needed for a project this small to split the Model, View, and Controller classes into their own sub-packages and keep MathsGame in the main package? Further Clarification: I'm essentially wondering if having…
has comment: http://stackoverflow.com/comment/43566777
linked to: http://stackoverflow.com/q/27555410
has comment: http://stackoverflow.com/comment/43567153
tagged with: model-view-controller
type: AnsweredQuestion
score: 1
tagged with: java
has title: Is this a good approach for using MVC for multiple views?
upvote count: 1
tagged with: swing
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/43566730
type: Question
has comment: http://stackoverflow.com/comment/43567077
possible better answer: http://stackoverflow.com/a/28163202
has answer: http://stackoverflow.com/a/28163202
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/28163448
favorite count: 0
linked to: http://stackoverflow.com/q/3530065

http://stackoverflow.com/a/27604700
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27596904
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43650068
has body: Assuming that \ followed by any character except for line terminator specifies the character immediately following it. You can use the following regex to match all instances of key-value pairs: "([a-zA-Z0-9]+):\"((?:[^\\\\\"]|\\\\.)*+)\"" Add \\s* before and after : if you want to allow free spacing. This is what the regex engine sees: ([a-zA-Z0-9]+):"((?:[^\\"]|\\.)*+)" The quantifier * is made possessive *+, since the 2 branches [^\\"] and \\. are mutual exclusive (no string can be matched by both at the same time). It also avoids StackOverflowError in the Oracle's implementation of Pattern class. Use the regex above in a Matcher loop: Pattern keyValuePattern = Pattern.compile("([a-zA-Z0-9]+):\"((?:[^\\\\\"]|\\\\.)*+)\""); Matcher matcher = keyValuePattern.matcher(inputString); while (matcher.find()) { String key = matcher.group(1); // Process the escape sequences in the value string String value = matcher.group(2).replaceAll("\\\\(.)", "$1"); // ... } In general case, depending on the complexity of the escape sequences (e.g. \n, \uhhhh, \xhh, \0), you might want to write a separate function to parse them. However, with the assumption above, the one-liner suffices. Note that this solution doesn't care about the separators, though. And it will skip on invalid input to the nearest match. In the example of invalid input below, the solution above will skip abc:" at the beginning and happily match xyz:"text text" amd more:"pair" as key-value pairs: abc:"xyz:"text text", more:"pair" If this behavior is not desirable, there is a solution, but the string containing all the key-value pairs must be isolated first, instead of being part of a bigger string that doesn't have anything to do with key-value pairs: "(?:^|(?!^)\\G,)([a-zA-Z0-9]+):\"((?:[^\\\\\"]|\\\\.)*+)\"" Free-spacing version: "(?:^\s*|(?!^)\\G\s*,\s*)([a-zA-Z0-9]+)\s*:\s*\"((?:[^\\\\\"]|\\\\.)*+)\""
answers question: http://stackoverflow.com/q/27596904
upvote count: 1

http://stackoverflow.com/q/27602539
tagged with: java
linked to: http://stackoverflow.com/q/8675302
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/43657743
has comment: http://stackoverflow.com/comment/43656743
tagged with: mockito
linked to: http://stackoverflow.com/q/27605211
has title: How do you add PowerMock to your project?
has comment: http://stackoverflow.com/comment/43627408
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/43635851
has comment: http://stackoverflow.com/comment/43657547
answer count: 1
has comment: http://stackoverflow.com/comment/43656594
has comment: http://stackoverflow.com/comment/43657396
favorite count: 0
has comment: http://stackoverflow.com/comment/43657671
has comment: http://stackoverflow.com/comment/44255295
tagged with: powermock
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43627531
has comment: http://stackoverflow.com/comment/43658132
has comment: http://stackoverflow.com/comment/43657453
has comment: http://stackoverflow.com/comment/43657208
has comment: http://stackoverflow.com/comment/44255900
has body: I am using mockito in my project and then found i could not use mockito for static classes and so have been told to download and use powermock. i download from here https://code.google.com/p/powermock/wiki/Downloads, this file specifically. PowerMock 1.6.0 with Mockito and JUnit including dependencies Do i just need to import the JARs from this into my project library? or is there more to it?
has answer: http://stackoverflow.com/a/27602663
has comment: http://stackoverflow.com/comment/43657103

http://stackoverflow.com/q/27624848
type: Question
has answer: http://stackoverflow.com/a/27624899
linked to: http://stackoverflow.com/q/1200621
tagged with: java
has answer: http://stackoverflow.com/a/27627516
downvote count: 3
has body: Anyone can tell me in the below array intialization have any difference. String[] emptyName = new String[]{"hi","hello","what"}; String[] emptyName={"hi","hello","what"}; String emptyName[] = new String[]{"hi","hello","what"}; String emptyName[] = new String[]{new String("hi"),new String("hello"),new String("what")}; Thanks
answer count: 5
has comment: http://stackoverflow.com/comment/43670265
has answer: http://stackoverflow.com/a/27625378
upvote count: 5
tagged with: arrays
has answer: http://stackoverflow.com/a/27624894
accepted answer: http://stackoverflow.com/a/27624899
linked to: http://stackoverflow.com/q/4706814
score: 2
type: AnsweredQuestion
has title: different type of Array declaration
duplicate of: http://stackoverflow.com/q/4706814
possible better answer: http://stackoverflow.com/a/27624905
favorite count: 0
has answer: http://stackoverflow.com/a/27624905

http://stackoverflow.com/comment/43409142
comment on: http://stackoverflow.com/a/27487905
has text: Found the mistake:`it was indeed the list splitting. I splitted the wrong line...^^ Thanks for your help though, Bloom. How can I give you reputation or anything in return? I'm kinda new to this forum, too. :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27609026
favorite count: 0
possible better answer: http://stackoverflow.com/a/27609111
has comment: http://stackoverflow.com/comment/43640308
type: Question
has answer: http://stackoverflow.com/a/27609111
tagged with: android
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/27609065
has title: NullPointerException when creating object
has body: I have this class with its constructor as defined below. The issue is when I try to create an object of it I get java.lang.NullPointerException. public class someClass extends Activity { public static String sharedPreferencesFileName = "myShared"; public SharedPreferences sharedPreferences = null; public someClass() { this.sharedPreferences = getSharedPreferences(sharedPreferencesFileName,0); } I am calling this from another class someClass someObj = new someClass();
tagged with: java
accepted answer: http://stackoverflow.com/a/27609065
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43640277
downvote count: 0

http://stackoverflow.com/a/27522406
score: 0
has comment: http://stackoverflow.com/comment/43495490
accepted answer of: http://stackoverflow.com/q/27522131
has comment: http://stackoverflow.com/comment/43478037
answers question: http://stackoverflow.com/q/27522131
type: AcceptedAnswer
type: Answer
has body: A postfix expression is parsed from left to right - don't look at postfixExpr.length()-1 before you are there. Do not create and handle a root node in any special way. It will be top of the stack after the parse. Here's an error: node.operand = postfixExpr.charAt(i); This must be stored in node.operator. This is how I would implement it: public interface Entry { int evaluate(); } public class Value implements Entry { private int value; public Value( int value ){ this.value = value; } public int evaluate(){ return value; } } public class Operation implements Entry { private char operator; private Entry left; private Entry right; public Operation( char operator, Entry left, Entry right ){ this.operator = operator; this.left = left; this.right = right; } public int evaluate(){ int l = left.evaluate(); int r = right.evaluate(); switch(operator){ case '+': return l + r; case '-': return l - r; case '*': return l * r; case '/': return l / r; } throw new IllegalStateException( "operator " + operator ); } } public class Parser { private Stack&lt;Entry&gt; stack = new Stack&lt;&gt;(); Pattern pat = Pattern.compile( "[-+*/]" ); Scanner scanner; public void parse( String ex ){ scanner = new Scanner( ex ); while( scanner.hasNext() ){ while( scanner.hasNextInt() ){ stack.push( new Value( scanner.nextInt() ) ); } while( scanner.hasNext( pat ) ){ char op = scanner.next( pat ).charAt( 0 ); Entry right = stack.pop(); Entry left = stack.pop(); stack.push( new Operation( op, left, right ) ); } } } public Entry get(){ return stack.pop(); } } There is absolutely no error handling, so think about adding that.

http://stackoverflow.com/comment/43566800
comment on: http://stackoverflow.com/q/27570061
has text: All recursive logic can be unravelled into sequential. Indeed they are - by compilers implementing a stack! But I read what you said as doing something that looks like 'backtracking'. When you look 'next to' a 2 you will need to look around it (above,below,left,right) and then 3 of above,below,left & right of that and so on.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27510939
type: AcceptedAnswer
downvote count: 0
has body: You can use a simple regex like this: !!!(.*?)!!! And then grab the capturing group content Working demo Match information MATCH 1 1. [10-13] `guy` MATCH 2 1. [31-35] `cats` You can use something like this java code: import java.util.regex.Matcher; import java.util.regex.Pattern; public class RegexMatches { public static void main( String args[] ){ // String to be scanned to find the pattern. String line = "I am a !!!guy!!! but I like !!!cats!!! better than dogs."; String pattern = "!!!(.*?)!!!"; // Create a Pattern object Pattern r = Pattern.compile(pattern); // Now create matcher object. Matcher m = r.matcher(line); while (m.find( )) { //--&gt; If you want a array do the logic you want with m.group(1) System.out.println("Found value: " + m.group(1) ); } } }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27510538
accepted answer of: http://stackoverflow.com/q/27510538
has comment: http://stackoverflow.com/comment/43453870

http://stackoverflow.com/q/27554200
downvote count: 2
has title: Why can I not declare a temporary variable in a boolean expression in Java?
tagged with: java
has answer: http://stackoverflow.com/a/27554247
has comment: http://stackoverflow.com/comment/43534926
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27554246
score: 0
tagged with: java-7
favorite count: 0
has body: I was trying to implement something like Guava's nullToEmpty without making two calls to a method. My original call is: return ((getElement(locator) != null) ? getElement(locator).getText() : StringUtils.EMPTY; which I tried to shorten to: return ((Element element = getElement(locator)) != null) ? element.getText() : StringUtils.EMPTY; But I get Element cannot be resolved to a variable, element cannot be resolved, and Syntax error on token "element", delete this token. This works: Element element; return ((element = getElement(locator)) != null) ? element.getText() : StringUtils.EMPTY; What's wrong with declaring and assigning at the same time in an expression?
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43535397

http://stackoverflow.com/comment/43682929
comment on: http://stackoverflow.com/q/27623815
type: Comment
type: QuestionComment
has text: So you're asking us to port code for you? That's not a question. There are plenty of people who will do that for very little money. If you mean you want the C# equivalent, then IceManMind's answer is what you want.
score: 0

http://stackoverflow.com/a/27502177
downvote count: 0
answers question: http://stackoverflow.com/q/27501678
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27501678
has body: First create a class (i.e. NumberFormat.java) and please put following methods in NumberFormat.java class: public static String priceWithDecimal (Double price) { DecimalFormat formatter = new DecimalFormat("###,###,###.00"); return formatter.format(price); } public static String priceWithoutDecimal (Double price) { DecimalFormat formatter = new DecimalFormat("###,###,###.##"); return formatter.format(price); } Now, in your jsp use code like this: &lt;td width = "8.33%"&gt; &lt;%=salDettaglio.getTotImponibile().toString() != null ? NumberFormat.priceWithDecimal(Double.parseDouble(salDettaglio.getTotImponibile().toString())) : "" %&gt; &lt;/td&gt; This solution will work for you.
type: AcceptedAnswer

jsr356
tag name: jsr356
type: Tag
tags question: http://stackoverflow.com/q/27499800

http://stackoverflow.com/q/27543026
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27598435
score: -1
tagged with: eclipse
upvote count: 0
answer count: 1
has body: As far as I understand people who hate tabs hate it, because it is used sometimes for formatting comments and so on. I would never do such thing. I think if I want to have formatted comments, I should use Javadoc. I am personally sick from having spaces for indentation (so at the start of the lines). It is harder to edit the lines, slower to indent and so on. Is there any way to format the code in a way that for indentation TABs are used, but for the rest of the lines all TABs are replaced with spaces? Then the both the TAB haters and me would be happy. So I want to enable TABs in my formatter for line indentation only. Is it possible?
favorite count: 0
tagged with: code-formatting
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27598435
tagged with: java
has title: Is there an eclipse formatter which allows tab on line starting but spaces only after?

http://stackoverflow.com/comment/43673379
type: QuestionComment
has text: `null` or filled with the object
comment on: http://stackoverflow.com/q/27626355
score: 0
type: Comment

http://stackoverflow.com/comment/43526986
type: QuestionComment
type: Comment
has text: Why would it be synchronized? You call this method at object initialization stage; when it is called it is not yet shared
score: 1
comment on: http://stackoverflow.com/q/27550357

http://stackoverflow.com/q/27632993
has comment: http://stackoverflow.com/comment/43685954
has comment: http://stackoverflow.com/comment/43685866
score: 0
answer count: 3
has title: possible i can let my user to name the text file themself?
has body: normally we write the file writer command with provide the file path and also the name of the text file for user. example: create a assignment text file FileWriter writer = new FileWriter(".......\assignment"); but is it possible that let my user to name the text file them self? because my program need let lecturer enter bibliographic details about the key reading for an assignment, so lecturer can name the text file by the name with assignment.
has answer: http://stackoverflow.com/a/27633178
possible better answer: http://stackoverflow.com/a/27633102
has comment: http://stackoverflow.com/comment/43685780
accepted answer: http://stackoverflow.com/a/27633286
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27633286
type: Question
has answer: http://stackoverflow.com/a/27633102

http://stackoverflow.com/q/27618377
has comment: http://stackoverflow.com/comment/43657759
score: 0
has answer: http://stackoverflow.com/a/27618445
has answer: http://stackoverflow.com/a/27618635
tagged with: regex
answer count: 4
linked to: http://stackoverflow.com/q/27439931
has body: From Wiki, ? => Matches the preceding element zero or one time. For example, ab?c matches only "ac" or "abc". | => The choice (also known as alternation or set union) operator matches either the expression before or the expression after the operator. For example, abc|def matches "abc" or "def". Here is the code tried; String yuStr = "-7.00, 10.00, 0.00, -212.000"; //Using ? System.out.println(yuStr.replaceAll("-?(\\d+)\\.\\d+", "$1")); //Using | System.out.println(yuStr.replaceAll("-|(\\d+)\\.\\d+", "$1")); However, both of two ways will give the same output 7, 10, 0, 212 Is my assumption right, according to Wiki doc above, in second way with ?, it is choice between expression before operator - and expression after operator (\\d+) ? My question is, why the second way (with |) is working the same way like first one (with ?) ?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27618445
tagged with: java
has answer: http://stackoverflow.com/a/27618458
type: Question
has title: Difference between ? or | in regular expression
has answer: http://stackoverflow.com/a/27619192
accepted answer: http://stackoverflow.com/a/27619192

http://stackoverflow.com/q/27546053
tagged with: fileinputstream
answer count: 1
has title: Multiple Operations with FileInputStream
accepted answer: http://stackoverflow.com/a/27546162
score: 0
has body: I have a Java class to read a file and set some data to a class. I have a class FileMetadata.java public class FileMetadata implements Serializable { private String location; private Double size; private String content; private List&lt;String&gt; lines; private String md5Digest; //parameterized constructor //getters and setters } After reading the file, I want to set the values in this class. This is my method to read the file. FileUtil.java public static void readFile(File file) throws IOException { FileInputStream fis = null; List&lt;String&gt; fileLines = new ArrayList&lt;String&gt;(); try { fis = new FileInputStream(file); StringBuilder sb = new StringBuilder(); StringBuilder sbLine = new StringBuilder(); int ch; while ((ch = fis.read()) != -1) { String line = "" + (char) ch; sb.append(line); if(line.matches("(\r|\n)")) { fileLines.add(sbLine.toString()); sbLine.setLength(0); } else { sbLine.append(line); } } String md5 = DigestUtils.md5Hex(fis); System.out.println(md5); System.out.println(sb.toString()); System.out.println(getFileSizeInKB(file)); for(String str : fileLines) { System.out.println(str); } } finally { if (fis != null) { fis.close(); } } } But the list is not coming up properly as it is adding an empty string after each line, because the file next line is "\r\n". The second time it is adding empty StringBuilder so the list is getting extra empty string after each line. I could try checking the length of it before adding to List. But if the file contains an empty line, I want to add to the list.
type: Question
has answer: http://stackoverflow.com/a/27546162
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43525023

http://stackoverflow.com/comment/43386662
type: QuestionComment
type: Comment
has text: Did you sign your jar?
comment on: http://stackoverflow.com/q/27476204
score: 0

http://stackoverflow.com/comment/43400201
has text: Notice the part _"The application classes are packaged in WEB-INF/classes or WEB-INF/lib"_. If your jar is added as a dependency correctly to your webapp, it should end up in the WEB-INF/lib. Just tested with EAP and works fine.
type: AnswerComment
comment on: http://stackoverflow.com/a/27482203
type: Comment
score: 1

http://stackoverflow.com/a/27495080
type: Answer
answers question: http://stackoverflow.com/q/27495028
accepted answer of: http://stackoverflow.com/q/27495028
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
has body: Move the fields up to the base class and initialize them through a constructor: public abstract class MessageField { public final int fieldId; public final String tag; protected MessageField(int fieldId, String tag) { this.fieldId = fieldId; this.tag = tag; } public int getFieldId() { return fieldId; } public String getTag() { return tag; } } public class TypeOne extends MessageField { public String fieldValue; //freely settable/gettable public TypeOne() { super(1, "-&gt;"); } } // etc. Since you contemplate having accessor methods, I'd suggest making fieldId and tag private.

http://stackoverflow.com/comment/43461960
type: AnswerComment
score: 0
has text: but I want to limit the execution time of just some commands not the test as a whole.
type: Comment
comment on: http://stackoverflow.com/a/27508443

http://stackoverflow.com/comment/43418526
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27492484
type: Comment
has text: No, I tried this one too. It's fixed now also. I meant to add this to the list of bugs I'd validated as fixed. I've updated the question. Good call though, thanks for the input.

http://stackoverflow.com/comment/43504575
type: QuestionComment
has text: You need to decide if `IPView` *is a* `HBox` (inheritance: `public class IPView extends HBox`) or if `IPView` *has a* `HBox` (aggregation: `HBox hbox`). Right now you have both, and you add the buttons to the aggregated `HBox`, but you add the `IPView` itself (which contains no buttons) to the `GridPane`.
comment on: http://stackoverflow.com/q/27537776
score: 0
type: Comment

http://stackoverflow.com/comment/43630273
type: QuestionComment
has text: Could you ensure that your application is well redeployed ?
type: Comment
comment on: http://stackoverflow.com/q/27603571
score: 0

http://stackoverflow.com/q/27495239
answer count: 1
has answer: http://stackoverflow.com/a/27495760
favorite count: 0
tagged with: android
tagged with: android-asynctask
downvote count: 0
has body: Hello I have this code in my GCMIntenBaseIntenService @Override protected void onMessage(Context context, Intent intent) { AsyncTask taskDoStuff= new AsyncTask (context); taskDoStuff.execute(); } my AsyncTask is looking like: public class AsyncTask extends AsyncTask&lt;String,String,String&gt; { Context mContext; public AsyncTask(Context mContext) { this.mContext = mContext; } when I call my asynctask from my main ACTIVITY directly it works - AsyncTask runs and does its job... But when I try to call asynctask from GCMBaseIntentService it does not does it job - surely because of wrong context... How can I solve that? used: http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/ as basic EDIT: I did some change, now it works in the background , but app crashes: In my MainActivity i set public static Context getAppContext() { return MainActivity.mContext; } in onCreate: MainActivity.mContext = MainActivity.this; in gcm onMessag() AsyncTask taskDoStuff = new AsyncTask(MainActivity.getAppContext()); taskDoStuff.execute();
has comment: http://stackoverflow.com/comment/43446372
type: Question
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43446508
tagged with: java
has title: Calling asynctask from GCMBaseIntentService?
accepted answer: http://stackoverflow.com/a/27495760
upvote count: 2

http://stackoverflow.com/q/27591239
accepted answer: http://stackoverflow.com/a/27594580
type: AnsweredQuestion
tagged with: java
has title: Exporting Message Board Subscriptions to Excel
type: Question
has body: Original Liferay Forum Post: https://www.liferay.com/community/forums/-/message_boards/message/46931970 I'm looking for a simple way to export the data stored in the Message Boards Subscription Manager to an Excel spreadsheet using Liferay 6.2EE. I need a list of each category &amp; thread that each user is subscribed to. As far as I know, this isn't out of the box functionality. The dynamic data list portlet has this as a standard action. Perhaps it's possible to transfer the list of subscribers there. Any ideas?
has answer: http://stackoverflow.com/a/27594580
tagged with: liferay
score: 0
answer count: 1

http://stackoverflow.com/comment/43386164
score: 0
comment on: http://stackoverflow.com/q/27475706
has text: Does this actually display anything? You are missing an important call to `glEnd ()`. You are also setting the vertex normal ***after*** each triangle, that does not make a lot of sense. I would move each call to `glNormal3i(...);` so that it comes immediately after `glColor4f(...);`.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43585040
score: 0
type: QuestionComment
type: Comment
has text: @Tom The brackets are redundant, but it works. Try it.
comment on: http://stackoverflow.com/q/27579783

http://stackoverflow.com/q/27588056
has title: How to sort a List<int[]> in GWT? fails with custom Comparator
type: Question
has body: I have a List in GWT and I wish to sort it but GWT complains at runtime that it cannot be done. List&lt;int[]&gt; tuples = new LinkedList&lt;int[]&gt;(); tuples.sort(new TupleComparator()); class TupleComparator implements Comparator&lt;int[]&gt; { @Override public int compare(int[] o1, int[] o2) { int i = 0; int l = o1.length; while (i &lt; l &amp;&amp; o1[i] == o2[i]) { i++; } return (i == l ? 0 : o1[i] - o2[i]); } } [ERROR] [testgwtlistofint] - Line 116: The method sort(TupleComparator) is undefined for the type List&lt;int[]&gt;
has comment: http://stackoverflow.com/comment/43600880
has answer: http://stackoverflow.com/a/27588319
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43600713
accepted answer: http://stackoverflow.com/a/27588319
favorite count: 0
upvote count: 1
tagged with: gwt
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/27483321
tagged with: android
has body: I have an ArrayList of custom class Task public class Task { String name,desc; Date date; Context context; public Task(String name, String desc, Date date, Context context) { this.name = name; this.desc = desc; this.date = date; this.context = context; } } I want to save it in SharedPreferences.. I read that can be done by converting it to Set.. But I don't know how to do this.. Is there a way to do this? Or any other way to store data rather than SharedPreferences? Thanks :) EDIT: String s = prefs.getString("tasks", null); if (tasks.size() == 0 &amp;&amp; s != null) { tasks = new Gson().fromJson(s, listOfObjects); Toast.makeText(MainActivity.this, "Got Tasks: " + tasks, Toast.LENGTH_LONG) .show(); } protected void onPause() { super.onPause(); Editor editPrefs = prefs.edit(); Gson gson = new Gson(); String s = null; if(tasks.size() &gt; 0) { s = gson.toJson(tasks, Task.class); Toast.makeText(MainActivity.this, "Tasks: " + s, Toast.LENGTH_LONG) .show(); } editPrefs.putString("tasks", s); editPrefs.commit();
has answer: http://stackoverflow.com/a/27483473
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27483723
has answer: http://stackoverflow.com/a/27483434
has answer: http://stackoverflow.com/a/27483533
has answer: http://stackoverflow.com/a/27483463
type: Question
upvote count: 5
tagged with: java
tagged with: sharedpreferences
has answer: http://stackoverflow.com/a/40972270
has title: Store ArrayList<CustomClass> into SharedPreferences
answer count: 8
possible better answer: http://stackoverflow.com/a/27483422
score: 5
has answer: http://stackoverflow.com/a/27483422
downvote count: 0
accepted answer: http://stackoverflow.com/a/27483463
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/27484678

http://stackoverflow.com/comment/43610321
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27590506
has text: @AndyDufresne - no , this didn't work. hmm , not sure

http://stackoverflow.com/comment/43599019
type: Comment
comment on: http://stackoverflow.com/q/27585843
score: 0
has text: I'll have to add it to the logged data to see. Again, I can't seem to reproduce the problem..
type: QuestionComment

http://stackoverflow.com/q/27565594
score: 0
has title: catch PacketTooBigException() block not works in Hibernate
type: UnansweredQuestion
has body: My requirement is to store an image array in db. While storing that image array, Hibernate throws an exception GenericJDBCException &amp; lot of stacktrace &amp; then Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large. My requirement is to increase packet query size of db when I encounter PacketTooBigException. So I had taken two catch blocks of catch(PacketTooBigException e){...} and catch (Exception e){..}. But Hibernate never throws PacketTooBigException directly as like in JDBC. Hibernate first throws GenericJDBCException and then Caused by: com.mysql.jdbc.PacketTooBigException:. To overcome the scenario, in catch block I had written if(e.getCause().getClass() == PacketTooBigException.class){..my job..}. 1) Am I going in right way? 2) Or anybody can suggest me the better approach so that I can directly catch PacketTooBigException. Thanks for your time.
tagged with: java
tagged with: hibernate
tagged with: database
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/27565945
answer count: 1

http://stackoverflow.com/comment/43440961
type: QuestionComment
comment on: http://stackoverflow.com/q/27505502
type: Comment
score: 1
has text: See https://en.wikipedia.org/wiki/Java_class_file

http://stackoverflow.com/q/27479374
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27537508
upvote count: 1
answer count: 1
has body: I have a servlet, i want to passing some value from that servlet to an applet. The flow is somekind like this an applet calling a servlet servlet gave some values to the applet applet retrieve a value from the servlet. this is my applet code : public void start() { URL url = new URL(getCodeBase(), getParameter("URL")); System.out.println("opening url : " + url); URLConnection con = url.openConnection(); con.setDoInput(true); DataInputStream obIn = new DataInputStream(con.getInputStream()); System.out.println("dataInputStream : " + obIn); System.out.println("servlet Values : " + obIn.readInt()); } the URL value it takes from the applet.html and this is my servlet code : public void service(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException { DataOutputStream dos = new DataOutputStream(res.getOutputStream()); dos.writeInt(100); dos.close(); } the result that i found in the java console was, something like this dataInputStream : java.io.DataInputStream@9abc69 servlet Values : 1010792557 and i'm already wrote the servlet name in web.xml like this MyApplet /MyApplet this thing got me to a stressed, how come the applet cannot recieve the values from the servlet?? is there anything wrong with my code? or is that something config that i'm missing? right now im using Spring, jsf and tomcat 7.0.20 Thanks a lot for your help. Regards Albert.
type: UnansweredQuestion
tagged with: servlets
tagged with: communication
has title: passing some value from servlet to applet via dataInputStream
downvote count: 0
has comment: http://stackoverflow.com/comment/43434784
score: 1
tagged with: applet
favorite count: 0

http://stackoverflow.com/q/27516612
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27537443
linked to: http://stackoverflow.com/q/21570476
linked to: http://stackoverflow.com/q/19543209
type: Question
has title: How to limit Jersey 2 connections
answer count: 1
tagged with: jersey-2.0
has body: I am using code that is similar to the code in this question. A copy of the code form the question is with properties commented out, as I have mine commented out. import javax.ws.rs.client.Client; public static void main(String[] args) { Client client = ClientBuilder.newClient(); //client.property(ClientProperties.CONNECT_TIMEOUT, 1000); //client.property(ClientProperties.READ_TIMEOUT, 1000); WebTarget target = client.target("http://1.2.3.4:8080"); target = target.queryParam("paramname", "paramvalue"); target = target.queryParam("paramname2", "paramvalue2"); try { String responseMsg; for (int i = 0; i &lt; 50; i++) responseMsg = target.request(MediaType.APPLICATION_XML).get(); System.out.println("responseMsg: " + responseMsg); } catch (ProcessingException pe) { pe.printStackTrace(); } } I modified the original code slightly by adding in a for-loop. The idea is that Jersey only generates one connection, not 50. The problem that I have is that the daemon with which I communicate reports that I create a new connection with each call. How can I have just one connection and then use that for each communication transaction? At worst, I would like to close the connection, but that seems silly. There is a lot of overhead to creating a connection (on the daemon if nothing else and closing it). The daemon reports "connection allowed" on the terminal window (CENTOS 7, but does not matter). I run the client usually off of my Windows 7 desktop. I am using Java 8 with Eclipse Luna. What happens quite frequently is that the daemon will say "maximum number of connections reached" and the proceed to do not nice things.
type: UnansweredQuestion
tagged with: connection

http://stackoverflow.com/comment/43463588
type: Comment
comment on: http://stackoverflow.com/q/27516719
has text: You'd need some kind of reference to wait for. Such as a Thread, a Future, or the possibility to install a callback. If the library does not expose that, it'll be hard... Maybe something you can poll every X seconds?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43635915
has text: I don understand Your question. Can You extend Your question?
comment on: http://stackoverflow.com/q/27606769
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27612183
accepted answer: http://stackoverflow.com/a/27612803
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43646936
tagged with: imgscalr
has comment: http://stackoverflow.com/comment/43647754
has comment: http://stackoverflow.com/comment/43647419
has comment: http://stackoverflow.com/comment/43646837
tagged with: image
has comment: http://stackoverflow.com/comment/43646950
score: 0
has answer: http://stackoverflow.com/a/27612803
answer count: 1
has title: Scale Image, then save to DB (Blob)
has body: I have just started using the imgScalr Image Scaling library. I can get the code to scale the images (I'm pretty sure this works). BufferedImage fullImage = Scalr.resize((BufferedImage) ImageIO.read(imageStream), fullImageSize); BufferedImage thumbImage = Scalr.resize(fullImage, thumbImageSize); Backstory This is used in a tomcat6 webapp. I pass the image onto a servlet, and read it into an InputStream called "imageStream". Before resizing/scaling the image, what I was doing was taking that InputStream and saving it to the DB (Oracle11+) Blob field using a PreparedStatement, like so: PreparedStatement st = con.prepareStatement(SQL); st.setBlob(1, imageStream); This was working fine as I could save it no problem and retrieve it with no problems. The Issue The issue is now that I'm scaling the image(s) they are being converted to a BufferedImage which I can't save directly to the DB using my PreparedStatement. Instead, what I'm trying to do is convert the BufferedImage to a ByteArrayOutputStream which then gets read into an InputStream, see code below: BufferedImage fullImage = Scalr.resize((BufferedImage) ImageIO.read(imageStream), fullImageSize); BufferedImage thumbImage = Scalr.resize(fullImage, thumbImageSize); ByteArrayOutputStream fullImageArray = new ByteArrayOutputStream(); ByteArrayOutputStream thumbImageArray = new ByteArrayOutputStream(); ImageIO.write(fullImage, imageMimeType, fullImageArray); ImageIO.write(thumbImage, imageMimeType, thumbImageArray); InputStream fullImageStream = new ByteArrayInputStream(fullImageArray.toByteArray()); InputStream thumbImageStream = new ByteArrayInputStream(thumbImageArray.toByteArray()); // DB INITIALISATION STUFF PreparedStatement st = con.prepareStatement(SQL); st.setBlob(1, fullImageStream); st.setBlob(2, thumbImageStream); Error Details When I execute the statement, I get a java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into. Which I know that it clearly means that I'm trying to inser…
has comment: http://stackoverflow.com/comment/43647132
tagged with: jdbc

http://stackoverflow.com/q/27520374
tagged with: internet-explorer
has answer: http://stackoverflow.com/a/27553610
score: 0
has comment: http://stackoverflow.com/comment/43471832
has answer: http://stackoverflow.com/a/27550831
answer count: 4
tagged with: testng
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43470587
has body: While I am executing testcases (Selenium WebDriver + Java) on Internet explorer i am getting exception "unhandledAlertException" and testcases getting failed while it's working fine with Chrome and Firefox browser. Also having issue like: sometimes it click on element and respond accordingly and sometimes its clicked but did not respond with same code. Here is some code from where it was throwing "unhandledAlertException" protected void clickOnElement(WebElement element) { if(isElementPresent(element)) { if(getBrowserName().equalsIgnoreCase("internet explorer")){ element.sendKeys(Keys.ENTER); wait(2000); System.out.println("In IE clicked on element"); }else{ element.click(); } implicitWait(Integer.parseInt(ConfigParser.getProperty("common_wait_timeout"))); } } unhandledAlertException is now resolved by removing implicit wait from code. but sometimes unresponsiveness of elements in IE is still persist. How can overcome from such issues with IE
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/27559956
has comment: http://stackoverflow.com/comment/43480851
tagged with: java
has title: selenium testcase failing with IE browser while it's working fine with chrome and firefox
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/27521228

http://stackoverflow.com/comment/43590392
score: 0
type: AnswerComment
has text: As for roll your own, I use amazon more so my workflow would be use AMI/CloudFormation/Chef to launch hosts with hdfs installed and mounted. And then mount the the hdfs location into my docker containers using the -v switch. i.e. Externalizing the shared fs part
type: Comment
comment on: http://stackoverflow.com/a/27581318

http://stackoverflow.com/a/27570028
has comment: http://stackoverflow.com/comment/43565899
answers question: http://stackoverflow.com/q/27570012
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43565970
has comment: http://stackoverflow.com/comment/43565853
upvote count: 10
has comment: http://stackoverflow.com/comment/43566147
type: Answer
has body: Better to move your initialization code to some method (init()) which you will call from constructor, as well from every other place where you need it. Constructors shouldn't be considered as being like any other method. Their purpose is to create new instances of the class, so calling one from that object's method can't result in changing the caller's instance variables.
downvote count: 0
has comment: http://stackoverflow.com/comment/43565773
has comment: http://stackoverflow.com/comment/43565476
score: 10
has comment: http://stackoverflow.com/comment/43565836
accepted answer of: http://stackoverflow.com/q/27570012
has comment: http://stackoverflow.com/comment/43566189

http://stackoverflow.com/q/27596300
favorite count: 0
has body: In Java ,I use Bouncy Castle encrypt data using padding: Cipher cipher = Cipher.getInstance("RSA/ECB/NOPADDING"); The Base64 encoded result is : AAAAAAAAAAAAAAAAA.....H6hBDxOrCI0K8fd13vOYtsKdo4SI3VZTa3... Ant it won't change every time. And in C++, I use OpenSSL library to encrypt data : RSA_public_encrypt(rsa_len, (unsigned char *)str, (unsigned char*)p_en, p_rsa, RSA_NO_PADDING); The Base64 encoded result is : bxeeBPfFRJsLOzJLMS/qGKtDe1zPw8H491QsE+uuRRay6/ep69fqv386j8... And it will change every time I run code. I read Wiki and know RSA encryption is a deterministic encryption algorithm. So the result of java is reasonable and my question is: Is "AAAAAAAA..." padding is correct for no padding of java? What has openssl done in C++ code to cause the result seems to have padding and time varying? Update I found that my java code is correct. And When calling RSA_private_encrypt with RSA_NO_PADDING, the input must have the same size as the RSA key modulus. .After I fill my input to 256 bytes , openssl can decrypt the java encrypt result. So, the question become to: What has openssl done to fill the input to reach the required length? Update At last, I don't have much time to research the OAEP in openssl.And the server use this unsafe way due to history problem. So I fill my input with byte 0.Just like: This is input //&lt;-----following many ASCII 0 char to reach 256 bytes length But this will cause the output be the same. Any other code should prevent this in either server and client.
tagged with: bouncycastle
tagged with: encryption
has comment: http://stackoverflow.com/comment/43617064
tagged with: c++
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27596735
tagged with: java
accepted answer: http://stackoverflow.com/a/27596735
linked to: http://stackoverflow.com/q/17110217
type: Question
has title: RSA_NO_PADDING is different between Java and C++?
answer count: 1
tagged with: openssl
upvote count: 3

http://stackoverflow.com/comment/43657205
has text: I don't think this link answers my question
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27617543
score: 0

http://stackoverflow.com/a/27628191
score: 0
has body: Why do you need instance variables at all? It seems none of your member methods make use of the instance variables. Hence the methods could be defined as static instead, and you don't even need to instantiate the class in the first place.
type: Answer
answers question: http://stackoverflow.com/q/27627748
has comment: http://stackoverflow.com/comment/43677322

http://stackoverflow.com/a/27521076
score: 0
type: Answer
has body: In Eclipse right click on the project and expand Build Path-->Configure Build path. Select Libraries-->Click on Add External Libraries and select the lib that you want to import. Hope this works.
answers question: http://stackoverflow.com/q/27517188

http://stackoverflow.com/comment/111478346
comment on: http://stackoverflow.com/a/27549948
has text: Thanks. Link is broken but it appears to have moved to https://dzone.com/articles/java-8-automatic-memoization
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43394358
comment on: http://stackoverflow.com/a/27480463
type: Comment
type: AnswerComment
score: 1
has text: *"...or alternatively having one IO thread for reading and another IO thread for writing - for that would even better..."* No, that still causes thrashing, yanking the heads from place to place.

http://stackoverflow.com/a/27617271
type: Answer
has comment: http://stackoverflow.com/comment/43656193
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27612423
has body: Headless mode is actually what is recommended for running JMeter Load Test. What is your scenario? If it's for 432000 requests during 12 hours which stands for 10 requests per second only, than it looks like that your configuration is not very correct and you need to "tell" JMeter to hold the load at 10 requests per second rate using Constant Throughput Timer. If you're looking to create 432000 of active concurrent threads you need to consider Distributed Testing, however I don't think that you really need so many concurrent threads.
downvote count: 0

http://stackoverflow.com/comment/43409989
has text: See the code again, you might be using array as well and a reason for for loop.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27489185

http://stackoverflow.com/comment/43441586
type: QuestionComment
comment on: http://stackoverflow.com/q/27500578
has text: No matter how much you optimize, you'd eventually run the risk of running out of memory if enough users run simultaneously. I'm not running this as a cloud service(yet), so i try to reduce overhead and risk where i can. Hope you see where i'm coming from.
score: 0
type: Comment

http://stackoverflow.com/comment/43520883
comment on: http://stackoverflow.com/q/27547292
type: QuestionComment
type: Comment
has text: XStream will be useful
score: 0

http://stackoverflow.com/q/27513645
has comment: http://stackoverflow.com/comment/43457622
favorite count: 0
has answer: http://stackoverflow.com/a/27513697
duplicate of: http://stackoverflow.com/q/85190
has comment: http://stackoverflow.com/comment/43457590
has comment: http://stackoverflow.com/comment/43457605
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27513696
has answer: http://stackoverflow.com/a/27513700
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43457670
tagged with: java
score: -3
downvote count: 4
answer count: 3
has title: Display the value of Varargs
linked to: http://stackoverflow.com/q/85190
has body: In the Java Programming when we pass the all arguments from the varargs then how can i dispaly that argument value.. For example i saw a program something like this : class var{ static void dis (int...num) { System.out.println ("Number of Arguments = " + num.length); for (int x : num) System.out.println(x + " "); } public static void main (String args[]) { dis(); dis(1, 2, 4, 6, 8, 10); dis(12, 14, 16, 18, 20); } } In the above program what action is performing by for(int x : num) .

http://stackoverflow.com/comment/43690883
has text: @ChiefTwoPencils: Just saw... I have corrected this. Is it clear now how I mean this?
comment on: http://stackoverflow.com/a/27635860
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43570987
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27571178
score: 0
has text: The `configure` method that gets the `AuthenticationManagerBuilder` doesn't help here, because that only allows to configure one single `AuthenticationManager`. But what I need is a second one that has another `UserDetailsService` configured. -- I'll update my question and post the configuration code I have so far.

http://stackoverflow.com/comment/43690040
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27602619
has text: how to get sum of column values at the bottom
score: 0

http://stackoverflow.com/comment/43595717
has text: It seems that you "try to get the value" in a fragment attached to (perhaps) another activity. Move the retrieving snippet from the `onCreateView` method to `onActivityCreated` or somewhere where you have the intent of the parent activity for sure. You can also pass it to the Fragment's constructor, and save there in its arguments for later processing.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27585607

http://stackoverflow.com/q/27627894
has title: Deadlock in Uploading file of gz compression with multiple parts from hfds to s3
answer count: 0
type: Question
tagged with: amazon-s3
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/43707237
has comment: http://stackoverflow.com/comment/43676711
has body: I have a job that outputs many files to hfds. The files are .gz compression But there are files with 2-3 blocks I'm using the following code to upload the files from hdfs to s3 FileSystem fileSystem = fileSystem = FileSystem.get(config); Path srcHdfsDirPath = new Path(sourcePath); Path[] paths = FileUtil.stat2Paths(fileSystem.listStatus(srcHdfsDirPath, new OutputFilesFilter())); for (Path srcPath : paths) { InputStream in = fileSystem.open(srcPath); try { uploadFileToAmazon(srcPath.getName(), in, fileSystem.getFileStatus(srcPath).getLen(), destinationPath + "/" + srcPath.getName(), s3Client); }finally { in.close(); } } --------- protected void uploadFileToAmazon(InputStream source, long length, String amazonPath, AmazonS3Client s3Client) throws UploadFailed { List&lt;PartETag&gt; partETags = new ArrayList&lt;PartETag&gt;(); InitiateMultipartUploadRequest initRequest = new InitiateMultipartUploadRequest( bucketName, amazonPath); InitiateMultipartUploadResult initResponse = s3Client.initiateMultipartUpload(initRequest); // Step 2: Upload parts. long filePosition = 0; for (int i = 1; filePosition &lt; length; i++) { // Last part can be less than 5 MB. Adjust part size. long currentPartSize = Math.min(partSize, (length - filePosition)); // Create request to upload a part. UploadPartRequest uploadRequest = new UploadPartRequest() .withBucketName(bucketName).withKey(amazonPath) .withUploadId(initResponse.getUploadId()).withPartNumber(i) .withFileOffset(filePosition) .withInputStream(source) .withPartSize(currentPartSize); logger.info("upload part {}", i); boolean anotherPass; int attempts = 0; do { anotherPass = false; // assume everythings ok try { // Upload part and add response to our list. partETags.add(s3Client.uploadPart(uploadRequest).getPartETag()); } catch (Exception e) { anotherPass = true; // repeat attempts++; } }while (anotherPass &amp;&amp; attempts &lt; maxLoadAttempts); if (attempts == maxLoadAttempts){ throw new UploadFailed("failed to upload data to amaz…
type: UnansweredQuestion

http://stackoverflow.com/q/27544051
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27898027
has comment: http://stackoverflow.com/comment/43568059
tagged with: connection
tagged with: jetty
has body: I want to build an embedded Java WebSocket Server using Jetty. I am using Jetty 9.2.6. My Client is a HTML javascript client. With Google Chrome(39, WebSocket Version 13) I can establish a connection and send data bidirectional. When i use Firefox (34, WebSocket Version 13), the connection closes directly after the connection is established. In my SocketListenerClass the onWebSocketConnect event is called, immediately the onWebSocketClose event is called. I tried 3 versions for my Socket. Implementing the WebSocketListener, extends the WebSocketAdapter and using Annotations. Everywhere the same. I get the close reason number 1005 (CLOSE_NO_STATUS) but sometimes 1001. Here is my code: Server: import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; public static void main(String[] args) { Server server = new Server(80); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); context.addServlet(new ServletHolder(new MyServlet()), "/*"); try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } } Servlet: import javax.servlet.annotation.WebServlet; import org.eclipse.jetty.websocket.servlet.WebSocketServlet; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; @SuppressWarnings("serial") @WebServlet(name = "MyEcho WebSocket Servlet", urlPatterns = { "/egal" }) public class MyServlet extends WebSocketServlet { @Override public void configure(WebSocketServletFactory factory) { factory.register(MyEchoSocketWithListener.class); } } Socket: import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.WebSocketListener; public class MyEchoSocketWithListener implements WebSocketListener { private Session outbound; public void onWebSocketClose(int statusCode, String reason) { this.outbound = null; System.out.println("Session has been c…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43618460
has answer: http://stackoverflow.com/a/27898027
type: Question
possible better answer: http://stackoverflow.com/a/27625873
has comment: http://stackoverflow.com/comment/43568113
has title: Jetty 9.2.x Websocket Server connection automatically closed after connect when using Firefox, not with Chrome
has answer: http://stackoverflow.com/a/27625873
tagged with: websocket

http://stackoverflow.com/a/29914921
type: Answer
score: 4
upvote count: 4
has body: There is a good tutorial by mkyong which provides you examples on how to configure your web service application with or without resteasy.scan. Based on your question your web.xml is empty? That would mean resteasy.scan is set to false as per documentation: resteasy.scan - Default value: false - Automatically scan WEB-INF/lib jars and WEB-INF/classes directory for both @Provider and JAX-RS resource classes (@Path, @GET, @POST etc..) and register them I usually set resteasy.scan to false and register my resources manually, because sometimes my WEB-INF/lib jars were containing providers/resources and they broke my application. Here is the configuration I am using: web.xml <?xml version="1.0" encoding="UTF-8"?> My application name resteasy.scan false resteasy-servlet org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application com.foo.bar.Configuration resteasy-servlet /* Configuration.java package com.foo.bar; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; public class Configuration extends Application { public Configuration() { } @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<Class<?>>(); classes.add(EntryPoint.class); return classes; } }
downvote count: 0
answers question: http://stackoverflow.com/q/27513491

http://stackoverflow.com/a/27552954
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27530617
answers question: http://stackoverflow.com/q/27530617
has body: Solved it using the following regex (public)(\s)([a-zA-Z0-9]?)(\s)([a-zA-Z0-9]?); in Checkstyle
upvote count: 1

http://stackoverflow.com/q/27535958
has comment: http://stackoverflow.com/comment/43500859
has comment: http://stackoverflow.com/comment/43501276
tagged with: input
has title: showInputDialog makes "if" work wrong
has comment: http://stackoverflow.com/comment/43500503
tagged with: joptionpane
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27536146
type: Question
has comment: http://stackoverflow.com/comment/43500571
has comment: http://stackoverflow.com/comment/43500961
has comment: http://stackoverflow.com/comment/43500913
has body: I'm making simple version of Minesweeper and have a problem with this part of code: if ((uncover == 0) &amp;&amp; inGame) { inGame = false; long elapsedTime = (System.currentTimeMillis() - start)/1000; JOptionPane.showInputDialog(null, "Congrats, you won! \n Your result is " + elapsedTime + " sec. Please, enter your name: "); statusbar.setText("Game won"); } else if (!inGame) statusbar.setText("Game lost"); So here is the thing: if game is won, it shows input dialog, but status bar is still changing to "Game lost". And if I remove or comment this JOptionPane.showInputDialog(null, "Congrats, you won! \n Your result is " + elapsedTime + " sec. Please, enter your name: "); everything works just fine. What's the problem with that?
has comment: http://stackoverflow.com/comment/43500964
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43500726
favorite count: 0
has comment: http://stackoverflow.com/comment/43500740
type: UnansweredQuestion

http://stackoverflow.com/a/27492772
has comment: http://stackoverflow.com/comment/43440862
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27481124
has comment: http://stackoverflow.com/comment/43417119
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27481124
has body: In EventMain's onCreate() method, setContentView() is being called after the call to the super.onCreate() method. This is causing the DrawerLayout set in the base class, NavigationDrawer, to be replaced, effectively removing the Drawer. To prevent this, we ensure the DrawerLayout has the standard container FrameLayout for main content, and inflate EventMain's layout into that. The base Activity's layout, main.xml: &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;FrameLayout android:id="@+id/event_frame" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; ... &lt;/android.support.v4.widget.DrawerLayout&gt; And in the Activity subclass, EventMain: @Override public void onCreate(Bundle savedInstanceState) { ... super.onCreate(savedInstanceState); ViewGroup content = (ViewGroup) findViewById(R.id.event_frame); getLayoutInflater().inflate(R.layout.event_main, content, true); ... }
has comment: http://stackoverflow.com/comment/43441605

http://stackoverflow.com/a/27562858
has body: Rename field $F{First_name} to $F{firstName} in JRXML Change your getter and setter methods to correspond. Like: String firstName; public String getFirstName() { return firstName; } public void setFirstName(String First_name) { this.firstName= First_name; } Jasper looks for the corresponding getter that respects java convensions.
upvote count: 12
accepted answer of: http://stackoverflow.com/q/27559804
answers question: http://stackoverflow.com/q/27559804
has comment: http://stackoverflow.com/comment/43555484
has comment: http://stackoverflow.com/comment/43553979
score: 12
has comment: http://stackoverflow.com/comment/43783855
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/84854018
downvote count: 0
has comment: http://stackoverflow.com/comment/43561118
type: Answer

http://stackoverflow.com/a/27564645
has body: First things first: Are you sure, there are no dependency conflicts in your project? If not, [as per your comments] You can try one more thing, extract the jar and place the extracted files within your code [I know it's the worst solution to do] but just for the sake of getting close to know what exactly is wrong. Also, as you have mentioned that class is marked as package level visibility so you can not really use it outside the package.
answers question: http://stackoverflow.com/q/27563625
type: Answer
accepted answer of: http://stackoverflow.com/q/27563625
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/27483494
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/43516936
has comment: http://stackoverflow.com/comment/53715765
tagged with: java-7
favorite count: 0
has title: Java 7, try-with-resources: can i omit creating Connection and PreparedStatement?
has comment: http://stackoverflow.com/comment/53716808
accepted answer: http://stackoverflow.com/a/32960328
possible better answer: http://stackoverflow.com/a/27483636
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43399438
has body: Case A: try (Connection con = DriverManager.getConnection(myConnectionURL); PreparedStatement ps = con.prepareStatement("SELECT * FROM table"); ResultSet rs = ps.executeQuery()) { processResults(rs); } catch (SQLException e) { e.printStackTrace(); } Case B: try (ResultSet rs = DriverManager.getConnection(myConnectionURL) .prepareStatement("SELECT * FROM table") .executeQuery()) { processResults(rs); } catch (SQLException e) { e.printStackTrace(); } In the case A con, ps and rs will be closed automatically. What about case B? In the case B the variables con and ps don't create as it was in case A. My question: are the both cases completely identical? Is there any problems in case B?
score: 1
downvote count: 2
tagged with: autocloseable
has answer: http://stackoverflow.com/a/27483636
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/32960328
tagged with: java

http://stackoverflow.com/q/27481350
downvote count: 0
has answer: http://stackoverflow.com/a/44418974
has body: I see that logging levels using jdk logging are localized, running this example: package com.stackoverflow.tests.logging; import java.util.Locale; import java.util.logging.Logger; public class TestLogging { public static void doLog(Locale l) { Locale.setDefault(l); Logger logger = Logger.getLogger(TestLogging.class.getName()); final String msg = "Hello logging world"; logger.severe(msg); logger.info(msg); logger.config(msg); logger.fine(msg); logger.finer(msg); logger.finest(msg); } public static void main(String args[]) { doLog(Locale.ITALY); // doLog(Locale.UK); // doLog(Locale.FRANCE); } } Ouput for italian (using default logger configuration hence only severe and info levels are logged) dic 15, 2014 10:48:43 AM com.stackoverflow.tests.logging.TestLogging doLog Grave: Hello logging world dic 15, 2014 10:48:43 AM com.stackoverflow.tests.logging.TestLogging doLog Informazioni: Hello logging world I would like to set up custom localized message for logging levels instead of the one provided by default. How can I do that Using JDK logging directly (I see Logger.getLogger can take a ResourceBundle but I did not manage to make it work, and also I dont know what is expected to be in this file) Using SLF4 facade (I guess that would imply tweaking LoggerFactory.getLogger function of SLF4J which is the one I'm using to obtain the loggers)
favorite count: 0
tagged with: logging
type: AnsweredQuestion
tagged with: java
tagged with: localization
possible better answer: http://stackoverflow.com/a/44418974
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27482028
has title: Changing logging levels localized name with jdk logging/slf4j
accepted answer: http://stackoverflow.com/a/27482028
answer count: 2
score: 4
tagged with: slf4j

http://stackoverflow.com/comment/43487985
comment on: http://stackoverflow.com/a/27505461
has text: I'm trying to do it right now :) But just having a look at what you said, it looks like it will work.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27638679
has comment: http://stackoverflow.com/comment/43696281
type: Answer
has comment: http://stackoverflow.com/comment/43696625
has comment: http://stackoverflow.com/comment/43696647
answers question: http://stackoverflow.com/q/27638310
has body: Help me please to understand which code blocks of myobject are made available only for the tread called the method Method1. I think you have synchronization backwards. No other thread can execute the block inside of Class1#Method1() unless it is holding the myobject "lock". The actual methods of myClass are unaffected. Any methods from any threads can invoke methods of myobject if they have a reference to it. (Since the methods in myClass are also synchronized, they may also block but that is a separate issue.) For that reason, it is important to always make the object you are locking on private and not publish the reference by returning it in any public method.
has comment: http://stackoverflow.com/comment/43696271
score: 0

http://stackoverflow.com/a/27573322
has comment: http://stackoverflow.com/comment/43573023
has comment: http://stackoverflow.com/comment/43572401
has comment: http://stackoverflow.com/comment/43573087
upvote count: 0
has comment: http://stackoverflow.com/comment/43573050
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/43573287
has comment: http://stackoverflow.com/comment/43572767
has body: From the Java Language Specification 3.10.5. String Literals (pay attention to the part in bold): A string literal consists of zero or more characters enclosed in double quotes. Characters may be represented by escape sequences (§3.10.6) - one escape sequence for characters in the range U+0000 to U+FFFF, two escape sequences for the UTF-16 surrogate code units of characters in the range U+010000 to U+10FFFF. See §3.10.6 for the definition of EscapeSequence. A string literal is always of type String (§4.3.3). Every "character" in a Java String can be a UTF-16 value. Meaning a String of length 15 can be up to 30 bytes. Perhaps you are thinking that in Java, a character will map to a byte (a 8-bit value). But it is not. So, instead one would opt to use a byte[] array for encoding instead. In fact, in real life, that is what we do when we want to encode things into 8-bit values (primitive bytes as understood in, say, C's unsigned char.) But then, let's do some math. By definition, a UUID is a 128-bit value. 128-bit value is a sequence of 16 bytes (128 = 16 * 8.) So, there is no way in hell that you can universally encode a UUID into 15 bytes. UUID version 1 through 3 might contain redundant or repetitive values that could be compressed or ignored (assuming the reader can properly discern what those "dropped" values are.) But once you use UUID v4 and v5, forget it. Those are pretty much a sequence of random values, pretty much uncompressable in the general case. Basic arithmetic then tell us that we should not try to do that :)
has comment: http://stackoverflow.com/comment/43574088
answers question: http://stackoverflow.com/q/27572410
has comment: http://stackoverflow.com/comment/43573068
score: -1
has comment: http://stackoverflow.com/comment/43572543

ssh
tags question: http://stackoverflow.com/q/27545194
tags question: http://stackoverflow.com/q/27486713
tags question: http://stackoverflow.com/q/27581900
tags question: http://stackoverflow.com/q/27500075
tags question: http://stackoverflow.com/q/27562381
tags question: http://stackoverflow.com/q/27507940
tags question: http://stackoverflow.com/q/27480126
type: Tag
tags question: http://stackoverflow.com/q/27500371
tag name: ssh

http://stackoverflow.com/comment/43429791
comment on: http://stackoverflow.com/q/27499522
type: Comment
type: QuestionComment
has text: @5gon12eder: Is `int` to `float` a lossless conversion?
score: 0

http://stackoverflow.com/comment/44566019
comment on: http://stackoverflow.com/a/28094675
type: AnswerComment
score: 0
type: Comment
has text: On my machine, `MyClass` is really just a POJO, which is wired as a Bean in my Spring configuration (via annotations or XML config).

http://stackoverflow.com/a/27604122
has comment: http://stackoverflow.com/comment/43630599
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43630593
score: 0
has body: Why is theEquation being changed? theEquation does not contain an array, it contains a reference to an array. When you do solveArrayX( theEquation , v ) you're passing this reference to the solveArrayX method which changes the array. See lines 120 and 121: public String solveArrayX(String[] tA, double d){ ... tA[i] = tA[i+2]; tA[i+2] = ""; ... } If you want to avoid this, you can use Arrays.copyOf(theEquation, theEquation.length) as argument to the method.
accepted answer of: http://stackoverflow.com/q/27603982
answers question: http://stackoverflow.com/q/27603982
has comment: http://stackoverflow.com/comment/43630699
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43633847
has comment: http://stackoverflow.com/comment/43630734
has comment: http://stackoverflow.com/comment/43634222
has comment: http://stackoverflow.com/comment/43631075

http://stackoverflow.com/comment/43532715
type: QuestionComment
comment on: http://stackoverflow.com/q/27535191
has text: I took a look at the link you gave, but still not be able to understand why the Full GC operation does not clean the memory but causes an increase in the occupied memory.
score: 0
type: Comment

http://stackoverflow.com/comment/43648806
comment on: http://stackoverflow.com/q/27613041
type: QuestionComment
has text: At the beginning, I used a scanner but the result is wrong. Just like the code :
type: Comment
score: 0

http://stackoverflow.com/comment/43483745
type: QuestionComment
has text: i'd usually use [nodatime](http://nodatime.org/), but could you step through it and see the creation, and what it brings?
score: 0
comment on: http://stackoverflow.com/q/27527578
type: Comment

http://stackoverflow.com/q/27595894
score: 0
has answer: http://stackoverflow.com/a/27595934
answer count: 1
tagged with: depth-first-search
tagged with: tree
has body: I am writing a recursive call to see if two nodes (n &amp; m) are contained within a subtree in a binary tree. Here is the function: public static boolean containsNodes(int n, int m, TreeNode node, int count){ if(node == null) return false; if( count == 2) return true; if(node.getData() == m || node.getData() == n){ count++; } return containsNodes(n, m, node.getLeft(), count) || containsNodes(n, m, node.getRight(), count); } It looks likes count is never getting updated in later calls even though the condition node.getData() == m || node.getData() == n is true'. Why is this so?
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43615720
type: Question
has title: Java Recursion Count Parameter
tagged with: recursion
tagged with: algorithm

http://stackoverflow.com/comment/43559833
type: Comment
comment on: http://stackoverflow.com/q/27564988
type: QuestionComment
score: 0
has text: Please mark either of the response(s) as answer which has helped you. Thanks.. :)

http://stackoverflow.com/q/27511062
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27511080
accepted answer: http://stackoverflow.com/a/27511080
answer count: 1
downvote count: 0
has title: Error executing Junit from ubuntu Terminal
tagged with: junit
has body: I am trying to run Junit test from ubuntu terminal. My junit-4.10.jar and the package(grand.big.small) that contains the code are in the src folder. I am able to compile and run my application using the following command from the src folder javac grand/big/small/Main.java java -cp . grand/big/small/Main But cannot compile and run the junit test which reside in the same package(grand.big.small) I am running the following command to execute them javac -cp . :.junit-4.10.jar grand/big/small/MainTest.java I am getting the following error: javac: invalid flag: :.junit-4.10.jar Usage: javac &lt;options&gt; &lt;source files&gt; I am new to this, could anyone please tell me where I am going wrong.
favorite count: 0
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/27573220
tagged with: java
has title: Debug/Run Applet in NetBeans
has comment: http://stackoverflow.com/comment/43572167
has answer: http://stackoverflow.com/a/27573297
has comment: http://stackoverflow.com/comment/43572842
has body: How can I debug or run a class that extends java.applet.Applet? I am able to run the applet from the command line with appletviewer. appletviewer runapp.html Here is what class looks like: import java.awt.Graphics; import java.applet.Applet; public class FancyApplet extends Applet { @Override public void paint(Graphics g) { g.drawString("Hello World!", 20, 20); } } Here is what the HTML file looks like A Fancy Applet How do I have to organize those files within my project and what settings do I have to use to debug the Applet in NetBeans? The thread Running a java applet from netbeans? did not help unfortunately. I did what was suggested, but get a message telling me that the main class was not found. What I took from it though was that in my case the HTML file is not even needed? But just because I am curious is it still possible or recommended to use it?
has comment: http://stackoverflow.com/comment/43572931
score: 2
accepted answer: http://stackoverflow.com/a/27573297
downvote count: 0
tagged with: applet
linked to: http://stackoverflow.com/q/7054382
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43572970
favorite count: 0
tagged with: netbeans
upvote count: 2
answer count: 1

types
tags question: http://stackoverflow.com/q/27568901
tags question: http://stackoverflow.com/q/27597480
tags question: http://stackoverflow.com/q/27598481
type: Tag
tag name: types
tags question: http://stackoverflow.com/q/27492318
tags question: http://stackoverflow.com/q/27522447
tags question: http://stackoverflow.com/q/27525066
tags question: http://stackoverflow.com/q/27518037

http://stackoverflow.com/comment/43604190
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27590106
type: AnswerComment
has text: Should I name the constant as I would with a constant int/string with UPPER_CASE? Is using a static block a good idea to populate it?

http://stackoverflow.com/comment/43462235
has text: Server Port: 80 Document Path: path Document Length: 268 bytes Concurrency Level: 200 Time taken for tests: 42.895 seconds Complete requests: 100000 Failed requests: 469 (Connect: 0, Receive: 0, Length: 469, Exceptions: 0) Write errors: 0 Total transferred: 41838339 bytes HTML transferred: 26824989 bytes Requests per second: 2331.28 [#/sec] (mean) Time per request: 85.790 [ms] (mean) Time per request: 0.429 [ms] (mean, across all concurrent requests) Transfer rate: 952.51 [Kbytes/sec] received
comment on: http://stackoverflow.com/q/27515525
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43493541
comment on: http://stackoverflow.com/q/27532532
type: Comment
type: QuestionComment
has text: Declaring `value` in `B` is hiding the `value` in `A`. You need to make a constructor for `B` and set `value=1` there.
score: 2

http://stackoverflow.com/q/27523861
tagged with: java
has answer: http://stackoverflow.com/a/27525178
has comment: http://stackoverflow.com/comment/43476902
has title: FATAL EXCEPTION: main java.lang.RuntimeException: got asked about an unknown fragment
type: AnsweredQuestion
tagged with: android-viewpager
has comment: http://stackoverflow.com/comment/43476541
type: Question
has comment: http://stackoverflow.com/comment/43477624
accepted answer: http://stackoverflow.com/a/27525178
tagged with: android
has comment: http://stackoverflow.com/comment/43477449
has body: I have a view pager and 3 fragment . my app work good with 2 of them but when i add the third fragment its return this error : 12-17 14:11:30.969: ERROR/AndroidRuntime(7350): FATAL EXCEPTION: main java.lang.RuntimeException: got asked about an unknown fragment a part of my code is like this : if (position == 0) { if (mContactList == null) mContactList = new ContactListFragment(); return mContactList; } else if (position == 1) { if (mContact == null) mContact= new ContactFragment(); // my third fragment return mContact ; } else { int positionMod = position - 2; mCursor.moveToPosition(positionMod); long contactChatId = mCursor.getLong(ChatView.CONTACT_ID_COLUMN); String contactName = mCursor.getString(ChatView.USERNAME_COLUMN); long providerId = mCursor.getLong(ChatView.PROVIDER_COLUMN); return ChatViewFragment.newInstance(contactChatId, contactName, providerId); }
score: 0
answer count: 1
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43477825

http://stackoverflow.com/q/27584800
has title: how do i read a specific line in a text file in java?
has body: I have a code that needs to read lines from a 95 line text file and put each one in a string variable quickly. However, it won't be in a linear order and it will have to read each one individually. How would i do this in as efficient and compact manner possible?
tagged with: java
has comment: http://stackoverflow.com/comment/43594104
type: Question
has answer: http://stackoverflow.com/a/27584871
has comment: http://stackoverflow.com/comment/43595588
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/43594185
has answer: http://stackoverflow.com/a/27584868
favorite count: 0
has answer: http://stackoverflow.com/a/27584827
downvote count: 5
type: UnansweredQuestion
score: -3

http://stackoverflow.com/q/27583855
tagged with: tiles
tagged with: knapsack-problem
has comment: http://stackoverflow.com/comment/43592223
has title: Knapsack variation, Java
has body: i have this assigment which is a variation of a knapsack problem. I have a board (Knapstack type, which inner variable is int[][] knapsack) and an array of tiles(with size of nXm, not all of them with the same size). I need to write a function which returns true if i can place all the tiles within the knapsack board (without rotating them). For example: if the tiles dimensions are: and the board size is 4X4, a possible solution is: this is the code i have thus far: public boolean insertIntoKnapsack(Tile[] tiles) { boolean ans = false; ans=solution(this.knapsack,tiles,0,0,0); return ans; } public boolean solution(int[][] knapsack, Tile[] tiles,int i,int j, int k) { boolean ans=false; int a; int b=0; if(j&gt;=knapsack.length || k&gt;=knapsack[0].length || i&gt;=tiles.length) return ans; if(j&lt;knapsack.length &amp;&amp; k&lt;knapsack[0].length &amp;&amp; i==tiles.length) { ans=isValid(knapsack,tiles); return ans; } for(a=0; knapsack.length-(j+a)&gt;0 &amp;&amp; a&lt;tiles[i].getN(); a++) { for(b=0; knapsack[0].length-(k+b)&gt;0 &amp;&amp; b&lt;tiles[i].getM(); b++) { if(knapsack[j+a][k+b]==0) knapsack[j+a][k+b]=i+1; } } return ans= solution(knapsack,tiles,i+1,j+a,k) || solution(knapsack,tiles,i+1,j,k+b) || solution(knapsack,tiles,i+1,j+a,k+b); } the knapsack class is defined as: public class Knapsack { // Holds the current state of the Knapsack private int[][] knapsack; public Knapsack(int n, int m) { if(n&lt;=0 || m&lt;=0) System.out.println("Bad Input"); else { int knapsack[][] = new int[n][m]; } } the function isValid: public boolean isValid(int[][] knapsack,Tile[] tiles) { boolean ans=true; for(int i=0;i&lt;tiles.length; i++) { int count=0; for(int j=0; j&lt;knapsack.length;j++) { for(int k=0; k&lt;knapsack[0].length; k++) { if(knapsack[j][k]==i) count=count+1; } } if(count != tiles[i].getN() * tiles[i].getM()) ans=false; } return ans; } a tile is defined as: public class Tile { private int n; private int m; /* * Construct a Tile of size nXm */ public Tile(int n,…
has comment: http://stackoverflow.com/comment/43592382
answer count: 0
type: UnansweredQuestion
tagged with: recursion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/a/27581984
type: Answer
has comment: http://stackoverflow.com/comment/43588251
score: 7
has body: public/protected/private have nothing to do with static. static means a member (be it a data member or a method) belongs to the class, and not to a specific instance. public/protected/private just control what other classes can access these members, be it instance members or static members.
upvote count: 7
accepted answer of: http://stackoverflow.com/q/27581948
answers question: http://stackoverflow.com/q/27581948
has comment: http://stackoverflow.com/comment/43589481
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/123622087
comment on: http://stackoverflow.com/a/27615246
has text: @morgwai Those are 10 item lists. There are only 3 layers of abstractions here: Spring Logical Transaction, Hibernate logical transaction, and the Hibernate connection provider mechanism.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/43573471
has text: The canonical answer to this question is as follows: *With the cooperation of the code, you can interrupt it using any method it supports. Without the cooperation of the code, no method of interrupting it is assured of being safe. However, isolating the code to its own process generally makes it safe to terminate the process context so long as the code doesn't manipulate sensitive resources outside its process context.*" Such "sensitive resources" can include shared memory, server processes, physical objects, network connections, and so on.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27564963
score: 1

http://stackoverflow.com/a/27566987
has comment: http://stackoverflow.com/comment/43558926
has comment: http://stackoverflow.com/comment/43559720
score: 0
has comment: http://stackoverflow.com/comment/43558930
answers question: http://stackoverflow.com/q/27566970
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27566970
type: Answer
has body: you have this: View mLinearLayout = (View) inflater.inflate(R.layout.statusbar_fragment, container, false); Switch s = (Switch) getActivity().findViewById(R.id.swt1); change it to: View mLinearLayout = (View) inflater.inflate(R.layout.statusbar_fragment, container, false); Switch s = (Switch) mLinearLayout .findViewById(R.id.swt1);

http://stackoverflow.com/comment/43439358
type: Comment
comment on: http://stackoverflow.com/a/27504597
has text: As per `SELECT stockqty FROM STOCKS WHERE stockid = :id` am assuming you have id handy i am expecting it to be at request/session level.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43522058
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27547908
has text: `k < ranks.length` for second loop
score: 0

http://stackoverflow.com/q/27608694
possible better answer: http://stackoverflow.com/a/42340310
has title: Jersey/JAX-RS Client throwing 400 Bad Request
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/27608854
has comment: http://stackoverflow.com/comment/43639778
type: Question
answer count: 2
tagged with: jersey
has answer: http://stackoverflow.com/a/27608854
upvote count: 1
tagged with: jax-rs
favorite count: 0
has answer: http://stackoverflow.com/a/42340310
has body: I have a RESTful Java web service that I built using Jersey. The client for it defines a resource with the following method: @Override public String saveWidget(Widget widget) { return webResource.path("user").type(MediaType.APPLICATION_JSON).entity(widget).post(String.class, Widget.class); } Then, a driver using this client: public class Driver { public static void main(String[] args) { WidgetClient client; WidgetClientBuilder builder = new WidgetClientBuilder(); client = builder.withUri("http://localhost:8080/myapi").build(); Widget w = getSomehow(); String widgetUri = client.getWidgetResource().saveWidget(w); System.out.println("Widget was saved URI was returned: " + widgetUri); } } When I run this I get: Exception in thread "main" com.sun.jersey.api.client.UniformInterfaceException: POST http://localhost:8080/myapi/widget returned a response status of 400 Bad Request at com.sun.jersey.api.client.WebResource.handle(WebResource.java:688) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) at com.my.myapi.WidgetResource.saveWidget(WidgetResource.java:27) at com.my.myapi.Driver.main(Driver.java:32) I know the service endpoint is valid because I can hit it from another (non-Java) web client without issues. This means that either my Widget instance is malformed or that there is something with my Java client method (saveWidget). I ruled out my w Widget being bad by serializing it into JSON, and then copying it into my non-Java web client and POSTing to the same endpoint (no issues arose). So this tells me I have the client method configured wrong. Any ideas?
type: AnsweredQuestion

http://stackoverflow.com/comment/43644555
type: Comment
type: QuestionComment
has text: You should probably save people the pain of searching your code and just tell us what you've accomplished and still need help with.
score: 0
comment on: http://stackoverflow.com/q/27611084

http://stackoverflow.com/comment/43534970
type: Comment
comment on: http://stackoverflow.com/a/27554305
score: 0
type: AnswerComment
has text: LinkedList is faster only and only if you are using #delete operation. Try it yourself and look the implementation of LinkedList to know why.

http://stackoverflow.com/comment/43431352
score: 0
type: Comment
has text: Yeah.. I second you on that. Infact after the departure of XP even IE7 support is not required.
comment on: http://stackoverflow.com/a/27500387
type: AnswerComment

http://stackoverflow.com/q/27551944
linked to: http://stackoverflow.com/q/5943712
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has title: google-play-services_lib Android on Eclipse infinite launching
has comment: http://stackoverflow.com/comment/43530146
has comment: http://stackoverflow.com/comment/43530554
tagged with: java
has body: I have a problem using google-play-services_lib on Android. I followed this tutorial. Getting the Google Maps Android API v2 to import it on eclipse, but when I add in my project reference Google Play services library and I try to run it on my Nexus 5, Eclipse starts an infinite launching and I must kill it. I update all in SDK manager. What could be the problem?
tagged with: eclipse
downvote count: 1
type: Question
tagged with: google-maps
tagged with: google-play-services
has answer: http://stackoverflow.com/a/27575511
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43531419

http://stackoverflow.com/a/27609099
type: AcceptedAnswer
has body: You code is not loading the page, as this is ajax and form is not getting submitted, so you response will come in back in js function only. It will update your form but not navigate the page. You need to redirect page in client side depending on response. window.location.href
accepted answer of: http://stackoverflow.com/q/27608439
type: Answer
answers question: http://stackoverflow.com/q/27608439
downvote count: 0
has comment: http://stackoverflow.com/comment/43642148
score: 1
has comment: http://stackoverflow.com/comment/43650737
has comment: http://stackoverflow.com/comment/43650718
upvote count: 1

http://stackoverflow.com/comment/43681433
has text: Because the objects have the same hash but aren’t the same pointer?
type: QuestionComment
comment on: http://stackoverflow.com/q/27630442
score: 3
type: Comment

http://stackoverflow.com/a/27561316
has comment: http://stackoverflow.com/comment/43548570
has comment: http://stackoverflow.com/comment/43548666
has comment: http://stackoverflow.com/comment/43548449
answers question: http://stackoverflow.com/q/27561269
downvote count: 0
has body: In java, local variable must be initialized. Replace : String kata; int key; With String kata = null; int key = 0;
has comment: http://stackoverflow.com/comment/43548759
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/43497208
comment on: http://stackoverflow.com/a/27533783
score: 0
type: Comment
has text: @PoojaGupta You can use StringBuilder to re-write your query, see my answer for more details
type: AnswerComment

http://stackoverflow.com/comment/43484537
score: 3
comment on: http://stackoverflow.com/q/27527976
type: Comment
type: QuestionComment
has text: Forget about the code for a second. Do you know how to write a `do-while` loop?

http://stackoverflow.com/a/27475965
score: 23
answers question: http://stackoverflow.com/q/27475957
has comment: http://stackoverflow.com/comment/43386255
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27475957
type: Answer
has comment: http://stackoverflow.com/comment/43386261
upvote count: 23
has body: Because String is an Object, but Object is not a String, just like every orange is a fruit, but not every fruit is an orange. String is a class that extends Object, so you can simply write: Object obj = "string"; But Object does not extend String, so: String str = new Object(); won't compile. Though, if you have an Object, and it is a String, you can do something that is called type casting or simply casting: String str = (String) myObject; But it might throw a ClassCastException if myObject is not originally type of String Here, you can find more information on Object Casting in Java: http://www.javabeginner.com/learn-java/java-object-typecasting

http://stackoverflow.com/a/27537197
has body: The problem is here: .option(ChannelOption.IP_MULTICAST_IF, NetUtil.LOOPBACK_IF) This tells UDP to only send membership reports to the localhost, so the other hosts don't know that this host is a member. Just remove it.
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27536989
answers question: http://stackoverflow.com/q/27536989
type: Answer
upvote count: 1

http://stackoverflow.com/a/27620661
accepted answer of: http://stackoverflow.com/q/27620400
answers question: http://stackoverflow.com/q/27620400
has comment: http://stackoverflow.com/comment/43662766
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/43662158
has comment: http://stackoverflow.com/comment/43662255
has body: From the javadoc Create an expression for substring extraction. Extracts a substring of given length starting at the specified position. First position is 1. Try doing cb.substring(c.&lt;String&gt;get("projDesc"), 1, 10); I think you're forgetting to select the Expression&lt;E&gt; Try cq.select(cb.substring(c.&lt;String&gt;get("projDesc"), 1, 10)) It will return List&lt;String&gt; if you need to Return the Emp you can use the cb.construct(Emp.class, e.get("prop1"), e.get("prop2"), cb.substring(c.&lt;String&gt;get("projDesc"), 1, 10)));
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43662133
upvote count: 7
type: Answer

http://stackoverflow.com/a/27629544
score: 1
has body: Jackson does not support JAXBElement, as it is very much XML-specific and is difficult to make work with other formats: Jackson JAXB support is focused on using information from annotations to make things work, but goal is not to be a full JAXB implementation. As such your best bet is to do what @lexicore suggests and try to avoid use of JAXBElement.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27543072
upvote count: 1

http://stackoverflow.com/comment/140188156
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27624502
type: Comment
has text: No longer works, setupDecompWorkspace is deprecated

http://stackoverflow.com/comment/43524871
has text: please add the output and the error you get.
comment on: http://stackoverflow.com/q/27549176
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43527723
comment on: http://stackoverflow.com/q/27550765
has text: Is this homework? Whether it's legal depends on the Java version, and odd behaviour may come from missing `break` statements.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/27609840
has comment: http://stackoverflow.com/comment/43642105
has body: I am trying to open a pdf file in my java code. The pdf (named "test.pdf") is saved in packageA. The class (ClassB) trying to open the file is in packageB. I am using the following code: try { File pdfFile = new File(ClassB.class.getResource("/packageA/test.pdf").getPath()); if (pdfFile.exists()) { if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(pdfFile); } } else { //error } catch (Exception e) { //error } This works when I run it in eclipse but when I export the program as an executable jar it doesnt work. I get a file not found. I did some research and tried using the following which also didnt work outside eclipse: ClassLoader cl = this.getClass().getClassLoader(); File pdfFile = new File(cl.getResource("packageA/test.pdf").getFile());
linked to: http://stackoverflow.com/q/2308188
type: Question
type: AnsweredQuestion
has title: Opening a file in a different package in Java program
tagged with: package
answer count: 1
has answer: http://stackoverflow.com/a/27609986
linked to: http://stackoverflow.com/q/20389255
has comment: http://stackoverflow.com/comment/43642351
score: 0
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/27609986

http://stackoverflow.com/q/27626276
possible better answer: http://stackoverflow.com/a/27626310
type: Question
has comment: http://stackoverflow.com/comment/43673047
tagged with: stringbuilder
has title: StringBuilder in Java
duplicate of: http://stackoverflow.com/q/8730127
score: -2
downvote count: 5
has body: Quick question: public class AppendStringBuilder { public static void main(String args[]){ StringBuilder sb1 = new StringBuilder(); sb1.append("java"); sb1.append(new Person("Oracle")); System.out.println(sb1); } } package hello; public class Person { String name; Person(String str){ name = str; } } OUTPUT: javahello.Person@2c538cc2 Reason behind this? Does not print JavaOracle
answer count: 3
has answer: http://stackoverflow.com/a/27626310
favorite count: 0
linked to: http://stackoverflow.com/q/8730127
accepted answer: http://stackoverflow.com/a/27626299
has answer: http://stackoverflow.com/a/27626324
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27626299

http://stackoverflow.com/comment/43628340
comment on: http://stackoverflow.com/a/27590705
type: Comment
type: AnswerComment
has text: Thanks for your response. Similarly is there any way to sort in Java 1.6 or 1.7
score: 0

http://stackoverflow.com/comment/43556450
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27565120
score: 1
has text: you put weaker access modifier in your sub class did you check that

executorservice
type: Tag
tags question: http://stackoverflow.com/q/27570122
tags question: http://stackoverflow.com/q/27492495
tags question: http://stackoverflow.com/q/27532330
tag name: executorservice
tags question: http://stackoverflow.com/q/27552868
tags question: http://stackoverflow.com/q/27502911
tags question: http://stackoverflow.com/q/27501365
tags question: http://stackoverflow.com/q/27486163
tags question: http://stackoverflow.com/q/27519301

http://stackoverflow.com/comment/43542315
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27557729
has text: I see. But how would I manipulate the GUI in the Service? I thought it wasn't possible to manipulate the GUI in a Service.
score: 0

http://stackoverflow.com/comment/43472174
type: QuestionComment
type: Comment
has text: What do you mean by: "bind the model list through ajax call" and what do you mean by "I am unable" -- what happend instead (what do you expect to be happend)?
comment on: http://stackoverflow.com/q/27521333
score: 0

sorting
tags question: http://stackoverflow.com/q/27482217
tags question: http://stackoverflow.com/q/27476676
tags question: http://stackoverflow.com/q/27635757
tags question: http://stackoverflow.com/q/27476955
tags question: http://stackoverflow.com/q/27599674
tags question: http://stackoverflow.com/q/27560009
tags question: http://stackoverflow.com/q/27497005
tags question: http://stackoverflow.com/q/27512011
tags question: http://stackoverflow.com/q/27577191
tags question: http://stackoverflow.com/q/27556104
tags question: http://stackoverflow.com/q/27535224
type: Tag
tags question: http://stackoverflow.com/q/27507268
tags question: http://stackoverflow.com/q/27619657
tags question: http://stackoverflow.com/q/27577267
tags question: http://stackoverflow.com/q/27575067
tags question: http://stackoverflow.com/q/27507175
tags question: http://stackoverflow.com/q/27639792
tags question: http://stackoverflow.com/q/27634428
tags question: http://stackoverflow.com/q/27517092
tags question: http://stackoverflow.com/q/27638418
tag name: sorting
tags question: http://stackoverflow.com/q/27626148
tags question: http://stackoverflow.com/q/27639753
tags question: http://stackoverflow.com/q/27517097
tags question: http://stackoverflow.com/q/27497441
tags question: http://stackoverflow.com/q/27536786

http://stackoverflow.com/q/27604485
tagged with: wsdl
favorite count: 0
type: UnansweredQuestion
tagged with: android-ksoap2
has answer: http://stackoverflow.com/a/27984792
score: 2
tagged with: java
type: Question
upvote count: 2
has title: How to pass user defined class to wsdl in android using k2soap?
downvote count: 0
answer count: 1
has body: I want to send 3 parameters to wsdl.Third parameter is array of BusStop Object.For busstops parameter I create "busStop" class.The service I used at below: To pass this parameters I use this code below: try { SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); SoapObject request = new SoapObject(NAMESPACE, METHOD); busStop busStop = new busStop(); busStop.busStopId=99999; busStop.latitude=40.8f; busStop.longitude=29.3f; busStop.name="yeni"; busStop.parentBusStopId=1; busStop.soundFile=null; busStop.stopType="1"; busStop.validityStartDate="25.12.2014"; busStop.validtyEndDate="30.12.2014"; PropertyInfo pi = new PropertyInfo(); pi.setName("busStop"); pi.setValue(busStop); pi.setType(busStop.getClass()); request.addProperty("id", "004"); request.addProperty("user", "ABC"); //request.addProperty("busstops",busstops); request.addProperty(pi); MarshalFloat md = new MarshalFloat(); md.register(envelope); MarshalByte md2 = new MarshalByte(); md2.register(envelope); envelope.dotNet = true; envelope.setOutputSoapObject(request); Log.i("lolo",envelope.bodyOut.toString()); HttpTransportSE transport = new HttpTransportSE(URL); try { transport.call(NAMESPACE + SOAP_ACTION_PREFIX + METHOD, envelope); } catch (IOException e) { e.printStackTrace(); resp = e.getMessage(); } catch (XmlPullParserException e) { e.printStackTrace(); } //bodyIn is the body object received with this envelope if (envelope.bodyIn != null) { //getProperty() Returns a specific property at a certain index. SoapObject resultSOAP = (SoapObject) ((SoapObject) envelope.bodyIn) .getProperty(0); resp=resultSOAP.toString(); } } catch (Exception e) { e.printStackTrace(); resp = e.getMessage(); } return resp.toString(); } I get this error: Response{return=anyType{resultCode=100; resultDefinition=Unable to resolve 'jdbc.dbnull'. Resolved 'jdbc'; }; } I also try parameter like this: request.addProperty("busStopId",busStop.busStopId); request.addProperty("latitude",busStop.latitude); ...…
tagged with: android

http://stackoverflow.com/comment/43699289
has text: 5 minutes and i can accept :) ok, why in onResume()?
type: AnswerComment
comment on: http://stackoverflow.com/a/27640283
type: Comment
score: 0

http://stackoverflow.com/comment/43486583
type: AnswerComment
score: 0
type: Comment
has text: That is next topic, once classes and instances are understood :)
comment on: http://stackoverflow.com/a/27528989

http://stackoverflow.com/a/27541084
downvote count: 0
answers question: http://stackoverflow.com/q/27540989
has body: You are actually modifying the collections, while iterating. this.connections.remove(receiverConnection); this.connections.add(senderConnection); Use an Iterator and call remove(): Iterator&lt;String&gt; iter = connections.iterator(); while (iter.hasNext()) { if (someCondition) iter.remove(); } Use Iterator remove method instead of ArrayList
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43509972
has comment: http://stackoverflow.com/comment/43509706
has comment: http://stackoverflow.com/comment/43509849

geography
type: Tag
tag name: geography
tags question: http://stackoverflow.com/q/27599673

http://stackoverflow.com/a/27632392
type: Answer
has body: Consider using Maps to store key value pair rather than arrays:- HashMap&lt;String,String&gt; jsonMap = new HashMap&lt;String,String&gt;(); jsonMap.put("Name",(String) jsonObject.get("Name")); jsonMap.put("ShowTime",(String) jsonObject.get("ShowTime")); jsonMap.put("Total",(String) jsonObject.get("Total"));
score: 0
answers question: http://stackoverflow.com/q/27632323

http://stackoverflow.com/q/27512212
score: 4
has comment: http://stackoverflow.com/comment/43454854
has answer: http://stackoverflow.com/a/27512412
favorite count: 0
has comment: http://stackoverflow.com/comment/43454883
possible better answer: http://stackoverflow.com/a/27512337
has answer: http://stackoverflow.com/a/27512337
upvote count: 4
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43454780
tagged with: constructor
downvote count: 0
has answer: http://stackoverflow.com/a/27512398
accepted answer: http://stackoverflow.com/a/27512398
type: Question
has body: My question is, when we declare a java class with data members we normally initialize them using constructors(With an exception to static members). But the data members can also be initialized directly without calling the constructor. public class Box { public int height = 0; public int width = 0; } When this is possible, why do we need a default constructor? like this public Box(){ height = 0; width = 0; } The memory for an object is created when it is instantiated. But if memory for data members are allocated while creating objects then how is it possible to initialize data members at the beginning of the class?
has comment: http://stackoverflow.com/comment/43454832
tagged with: java
has title: Why do we need default constructor when we can initialize data members in java?
has answer: http://stackoverflow.com/a/27513956

http://stackoverflow.com/q/27477821
has title: hql query to get last 1 month records
favorite count: 0
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27477980
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/8636806
tagged with: hql
type: Question
tagged with: hibernate
has body: I need to fetch records of last month using hql earlier i used to fetch records using sql query but now i need to fetch records of 1 month span.for example today's date is 15-Dec-2014 I want to get records between 15-Nov-2014 to 14-Dec-2014 records. Here is Mysql query: SELECT fds.EXISTED_PRODUCT_ID,fds.Product_Name,fds.PRODUCT_CREATED_DATE FROM F_PRODUCT_DATA_STATISTICS fds where fds.CREATED_TS BETWEEN SUBDATE(CURDATE(), INTERVAL 1 MONTH) AND NOW() Frankly, I don't have any idea about how to write above query in HQl. Can anyone please help me.
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27477980

http://stackoverflow.com/a/27501630
score: 0
answers question: http://stackoverflow.com/q/27501432
type: Answer
has body: All your threads are doing the same: for (int i = 1; i &lt;= 101; i++) { System.out.println("Employee ID : " + i); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } They all just print the numbers 1 to 100 because they all have their own for-loop and own variable. You need to add a variable which all threads access, print and increment. This variable has to be synchronized in order to avoid race conditions.

http://stackoverflow.com/comment/43452790
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27511146
type: AnswerComment
has text: How do I program in ending condition [Esc]? User would not be able to enter word "Exit", because I use s.nextInt() and if I change that to s.next() I would need to check the input (whether it's an integer or not) in all of my ifs.

http://stackoverflow.com/a/27554708
has body: Basicially, you need calculate the angel between the start point and end point, something like... angle = -Math.toDegrees(Math.atan2(startX - endX, startY - endY)) + 180; As an example: Rotating a triangle around a point java Java make a directed line and make it move mouse motion listener only in one direction Java: Move image towards mouse position To track the mouse, use a MouseListener and MouseMotionListerner Take a look at: How to write a MouseListener How to write a MouseMotionListener
answers question: http://stackoverflow.com/q/27554412
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/43561928
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27567989
type: Comment
has text: Specifically your checkValidity method is modifying the data it is supposed to be checking, so no matter what values come in in your color array, it gets switched to either [false, false, false, false, false] or [false, false, false, false, true] - it never generates a correct sequence. Without knowing what it is you're actually trying to do I won't be able to offer more help

http://stackoverflow.com/comment/43435815
type: AnswerComment
has text: i have edited my code. Now im using OPCPackage pkg = OPCPackage.open(file); XSSFWorkbook workbook = new XSSFWorkbook(pkg); now im getting different error org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Fail to save: an error occurs while saving the package : Zip File is closed
comment on: http://stackoverflow.com/a/27485263
type: Comment
score: 0

http://stackoverflow.com/comment/43632335
score: 0
has text: Generally behaviour of generic classes are the same for any given generic type so its okay to test it for only one type.
type: Comment
comment on: http://stackoverflow.com/q/27605109
type: QuestionComment

http://stackoverflow.com/comment/43657691
comment on: http://stackoverflow.com/a/27608646
has text: @FrankWittich: Yeah, your code should works. I'm glad your problem is solved :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27480535
linked to: http://stackoverflow.com/q/16561633
has body: So I had an existing vaadin project and I decided to import in Reindeer styles to see how they look. I compiled my theme &amp; widget set &amp; I decided they weren't for me. So I removed the css import I had added and recompiled my theme &amp; widgetset. However the styles were still there. I have recompiled again &amp; again, tried a maven clean package install on the command line, refeshed the project, tried a maven update no luck. I have also tried deleting the server and creating it again. Had anyone had this problem before? Any suggestions? (Using vaadin 7.1.2 with eclipse luna)
answer count: 1
has title: Vaadin still referencing old theme?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27481011
tagged with: css
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27481011
score: 1
tagged with: java
tagged with: vaadin
upvote count: 1
type: Question

http://stackoverflow.com/comment/43477786
type: QuestionComment
comment on: http://stackoverflow.com/q/27524394
has text: Nope the ArrayList is modified only of a single thread.
score: 0
type: Comment

http://stackoverflow.com/a/27531273
score: 4
has body: My favorite "join" pattern is this: StringBuilder builder = new StringBuilder(); String separator = ""; for (int i = 0; i &lt; Common.testFields.size(); i++) { builder.append(separator) .append(" ") .append(Common.testFields.get(i)) .append(" ") .append(Common.dataTypes.get(i)); separator = ",\n"; } String ddl = builder.append("\n").toString(); No special case "if last" or "if first" necessary.
accepted answer of: http://stackoverflow.com/q/27530383
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/27530383
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27598491
tagged with: spring
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/27598675
tagged with: java
has answer: http://stackoverflow.com/a/27598675
upvote count: 1
tagged with: eclipse
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/27599381
has answer: http://stackoverflow.com/a/76047510
answer count: 3
tagged with: junit
downvote count: 0
accepted answer: http://stackoverflow.com/a/27599381
favorite count: 0
has body: We use Gradle for the dependency management and for the deployment of the application. Our application is a regular Java application with a public main() method. Eclipse allows the starting of the application directly over a context menu (without Gradle). However Eclipse adds the test classes to the class path. Since we use Spring configuration annotations for the test classes and for the actual applications we get conflicts. E.g. the database connection is instantiated twice Which leads to startup errors. Is there a way to tell Eclipse to exclude the test classes to be added to the class path? I know there is a gradle plugin 'applications', which allows the compilation and starting of the application. However we need to run multiple applications in parallel, which leads to lock issues with the gradle plugin. Edit: I was unclear: The issue is that the project (libs.core) on which the actual project (applications.core) depends on has test classes which are included. The test classes of the actual project are not included in the Java class path. For all projects we have the following structure: Java Classes: src/main/java/ Test Classes: src/test/java The .classpath file of the 'libs.core' project file contains the following: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;classpath&gt; &lt;classpathentry kind="output" path=".eclipse-classes"/&gt; &lt;classpathentry kind="src" path="src/main/java"/&gt; &lt;classpathentry kind="src" path="src/main/resources"/&gt; &lt;classpathentry kind="src" path="src/test/java"/&gt; &lt;classpathentry kind="src" path="src/test/resources"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/&gt; &lt;classpathentry sourcepath="[path to gradle cache]commons-logging-1.1.3-sources.jar" kind="lib" path="[path to gradle cache]commons-logging-1.1.3.jar" exported="true"/&gt; [other dependencies] &lt;/classpath&gt; The .classpath file of the 'applications.core' project file contains the following: &…
has title: Conflict with test classes with regular application

http://stackoverflow.com/q/27488538
tagged with: java
has comment: http://stackoverflow.com/comment/43413843
tagged with: image
has comment: http://stackoverflow.com/comment/43450363
upvote count: 1
has answer: http://stackoverflow.com/a/64252509
has title: How to change uploaded image from text/x-genric to image/x-genric
has body: I have successfully uploaded an image from my android application to a server folder using php web service but the image is stored in a text/x-genric Type instead of image/x-genric. I uploaded the image from my app to the server using OkhttpClient. Also the stored image at the server doesn't bear its original image name. Please guys how can i fix these two issues. My upload code is shown below, thanks. upload code: public class HttpUploader2 extends AsyncTask&lt;String, Void, Integer&gt; { private static final MediaType MEDIA_TYPE = MediaType.parse("image/*"); private final OkHttpClient client = new OkHttpClient(); public HttpUploader2(){ } @Override protected Integer doInBackground(String... imgPath) { Response response = null; for (String path: imgPath){ RequestBody requestBody = new MultipartBuilder() .type(MultipartBuilder.FORM) .addFormDataPart("name", "Profile Pic") .addFormDataPart("filename", "name", RequestBody .create(MEDIA_TYPE, new File(path))) .build(); Request request = new Request.Builder() .url(Const.IMAGE_UPLOAD_URL) .post(requestBody) .build(); try { response = client.newCall(request).execute(); Log.e("Path: ", path); Log.e("Body: ", ""+response.body().string()); Log.e("Code: ", ""+response.code()); if (!response.isSuccessful()){ return response.code(); }else { return response.code(); } } catch (IOException e) { e.printStackTrace(); } } return response.code(); }
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/27511048
tagged with: android
has answer: http://stackoverflow.com/a/27511048
tagged with: php
tagged with: okhttp
has comment: http://stackoverflow.com/comment/43410774
has comment: http://stackoverflow.com/comment/43450886
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43412888
has comment: http://stackoverflow.com/comment/43409187
has comment: http://stackoverflow.com/comment/43410894
has answer: http://stackoverflow.com/a/27488757
accepted answer: http://stackoverflow.com/a/27488757
type: Question
has comment: http://stackoverflow.com/comment/43433418
score: 1

http://stackoverflow.com/q/27508133
accepted answer: http://stackoverflow.com/a/27508997
score: 17
tagged with: concurrency
upvote count: 17
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27508382
has title: Spring Controller start processing after response is sent
has comment: http://stackoverflow.com/comment/43446419
has answer: http://stackoverflow.com/a/27508997
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27508839
has body: I am using a Spring MVC controller and want to start the execution of a task in a new thread. However the task should not start immediately but only after the response has been sent to the client. The sequence - in strict temporal order: request return new ResponseEntity ... / client receives HTTP status 200 OK. processing of the task begins. How do I achieve this? I wanted to use Spring's async abstraction by calling a method annotated with @Async, but it does not guarantee that the new thread waits for the response to be sent first.
possible better answer: http://stackoverflow.com/a/49571426
has answer: http://stackoverflow.com/a/49571426
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43509733
has text: That question was sorta answered but yes you can find all my code there. It's a little updated though on here
comment on: http://stackoverflow.com/q/27541011
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43572489
comment on: http://stackoverflow.com/a/27573354
type: Comment
has text: ok because my professor will be looking at this and I want him to be able to run the program with it being able to access the file on his system.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43386837
has text: I've used them but most of the class doesn't know about those, I doubt it's easier to use something that you have to learn first.
comment on: http://stackoverflow.com/a/27475502
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43642433
type: Comment
comment on: http://stackoverflow.com/a/27596019
type: AnswerComment
has text: for best results use `<T extends Comparable<? super T>>`
score: 0

http://stackoverflow.com/q/27591687
has comment: http://stackoverflow.com/comment/43607297
has comment: http://stackoverflow.com/comment/43607408
has comment: http://stackoverflow.com/comment/43607247
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27591712
has body: Am having problems with development in android as all my lines of code in all the files in the src folder where am placing my java files have errors on them. I do not know where the problem is coming from! First had problems where 'R' was underlined in red. then after Ctrl+Shift+O, I exited my eclipse and on opening it, that's what I saw on my java files
score: 0
has answer: http://stackoverflow.com/a/27591752
answer count: 2
has title: All my lines of code in my 'src' folder have errors in Eclipse
has comment: http://stackoverflow.com/comment/43607083
has comment: http://stackoverflow.com/comment/43607119
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/comment/43484076
type: QuestionComment
comment on: http://stackoverflow.com/q/27527572
score: 1
has text: Line 10 of your Test_Dynamic_Stack test class: System.out.println("Mystack2: tos = " + mystack2.tos); should be System.out.println("Mystack2: tos = " + mystack1.tos);
type: Comment

http://stackoverflow.com/q/27628512
has title: Returning file directory from ArrayList, cannot find symbol?
tagged with: java
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43677845
score: -2
has answer: http://stackoverflow.com/a/27628551
answer count: 1
favorite count: 0
has body: ok im writing a music player and im returning the path of the file in the arraylist and i get a cannot find symbol error when i call it in the main method. what can i do to fix this? This is the method import java.io.*; import java.net.*; import java.lang.*; import java.util.*; import javazoom.jl.player.*; import org.apache.commons.io.IOUtils; public class Songs{ public String getSongPath(int t) { File song1 = new File("C:\\Users\\hunter\\Desktop\\code\\StreamAudio\\src\\Posed.mp3"); File song2 = new File("C:\\Users\\hunter\\Desktop\\code\\StreamAudio\\src\\Walk.mp3"); File song3 = new File("C:\\Users\\hunter\\Desktop\\code\\StreamAudio\\src\\Swimming.mp3"); ArrayList&lt;File&gt; files = new ArrayList&lt;&gt;(); files.add(song1); files.add(song2); files.add(song3); File song = files.get(t); String path = song.getPath(); return path; } } and this is the main import java.io.*; import java.net.*; import java.lang.*; import java.util.*; import javazoom.jl.player.*; import org.apache.commons.io.IOUtils; public class StreamAudio { public static void main(String[] args) throws Exception { Scanner key = new Scanner(System.in); int port = 7645; DatagramSocket socket = new DatagramSocket(); DatagramPacket dp; try { System.out.println("What song would you like?\n1, 2, or 3"); int choose = key.nextInt(); String path = getSongPath(choose); File song = new File(path); FileInputStream fis = new FileInputStream(song); BufferedInputStream bis = new BufferedInputStream(fis); try { Player player = new Player(bis); player.play(); byte[] bytes = IOUtils.toByteArray(bis); dp = new DatagramPacket(bytes, bytes.length); socket.send(dp); }catch(Exception e){} }catch(Exception e){} } } please halp
type: UnansweredQuestion

http://stackoverflow.com/q/27584751
has answer: http://stackoverflow.com/a/27584783
has title: HttpURLConnection, openConnection and setRequestMethod("GET"
score: 0
answer count: 1
tagged with: httpurlconnection
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I am currently trying to understand the logic behind each of the code below. Please let me know if I am correct and answer my confusions. urlConnection = (HttpURLConnection) url.openConnection(); //connection object is created. However, do not understand //"manipulate parameters that affect the connection to the remote resource." urlConnection.setRequestMethod("GET"); //set the method for the URL request. Not sure what that means! //there are other strings that could be used, but not sure what each means, //and couldn't the Java documentations didn't seem to have explanations either urlConnection.connect(); //the actual connection the the remote object is made

http://stackoverflow.com/comment/43534225
type: Comment
comment on: http://stackoverflow.com/a/27550566
has text: @SaadAttieh Perhaps you could offer a remove method in your Strategy.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43445156
type: Comment
type: QuestionComment
has text: Why use such lowlevel primitives when java.util.concurrent has plenty of tools you can use?
score: 2
comment on: http://stackoverflow.com/q/27507503

http://stackoverflow.com/a/28393270
has body: Add \wrappers\jsp\kendo-taglib\kendo-taglib-[version].jar to project's /WebContent/WEB-INF/lib folder.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27583528
accepted answer of: http://stackoverflow.com/q/27583528

http://stackoverflow.com/comment/43424151
type: Comment
comment on: http://stackoverflow.com/a/27496248
score: 1
type: AnswerComment
has text: For the case of decreasing by 1 each time, your solution is fine. For the OP's other example of decreasing by 0.45 each time (a number that does not exist in binary floating point, only in approximation), the error will accumulate each iteration and after enough iterations, the number will be quite skewed. :-) (This is why I posted the `45 * i / 100.0` solution.)

http://stackoverflow.com/q/27536380
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/27536391
has answer: http://stackoverflow.com/a/74841545
has comment: http://stackoverflow.com/comment/44810527
answer count: 3
possible better answer: http://stackoverflow.com/a/52976082
tagged with: playframework
has answer: http://stackoverflow.com/a/52976082
downvote count: 0
favorite count: 0
has body: I deploy Play applications in distributed environments, backed by a remote MySQL database. Specifically, the applications are hosted on heroku, and the database is on Amazon RDS (though this really applies to any remote database connection). Since the database isn't just on localhost, I'd prefer that the remote MySQL connection is made through SSL for security. Given a CA certificate to trust, how can I configure a Play application to connect to the MySQL server through SSL, only if the host certificate can be verified? Assume this as the current database configuration: db.default.driver=com.mysql.jdbc.Driver db.default.url="jdbc:mysql://url.to.database/test_db" db.default.user=root db.default.password="...."
has answer: http://stackoverflow.com/a/27536391
type: AnsweredQuestion
tagged with: scala
tagged with: amazon-rds
upvote count: 21
type: Question
has title: How to connect to a remote MySQL database via SSL using Play Framework?
score: 21

http://stackoverflow.com/a/27495379
upvote count: 7
has body: You need to add &lt;context:annotation-config/&gt; in your spring xml, rather than instantiating the AutowiredAnnotationBeanPostProcessor, as that does not handle @Qualifier annotations. Or, if you really want to control everything that gets instantiated in your context, have a look at the actual candidate resolver for @Qualifier.
answers question: http://stackoverflow.com/q/27494819
accepted answer of: http://stackoverflow.com/q/27494819
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/comment/43447078
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27492281
type: AnswerComment
has text: Okay. Then I think that means you expect the values of the computed fields to be text within the DXL for the Body item. The only thing I can think of that would prevent that is hide-when checkbook settings or formulas on the paragraphs containing the computed fields. Do you have any plain text in the same paragraphs, and does it appear in the DXL as expected?

http://stackoverflow.com/q/27552883
has comment: http://stackoverflow.com/comment/43531982
has answer: http://stackoverflow.com/a/27567295
tagged with: java
has comment: http://stackoverflow.com/comment/43531995
type: Question
has body: Why class named saved directly with .class extension without compiling is not get executed by JVM. Is there any kind of Metadata or something else is attached to .class file so then only JVM recognised as valid .class file ? Please Help me to clarify Thanks in advance
favorite count: 0
accepted answer: http://stackoverflow.com/a/27567295
answer count: 3
score: -5
has title: executing .class file without compiling
has comment: http://stackoverflow.com/comment/43532003
downvote count: 6
linked to: http://stackoverflow.com/q/2203248
has answer: http://stackoverflow.com/a/27552947
has answer: http://stackoverflow.com/a/27552932
has comment: http://stackoverflow.com/comment/43532073
upvote count: 1
possible better answer: http://stackoverflow.com/a/27552947
type: AnsweredQuestion

http://stackoverflow.com/comment/43642191
type: QuestionComment
type: Comment
has text: Using the application context constructor with parent parameter/s allows to combine several application contexts together, just as <import resource="..."> does for XML based configuration or the @Import for annotation based configuration. In your case you probably would have parent = new AnnotationConfigApplicationContext(DataAccessConfiguration.class) and then ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml", parent); , where in Beans.xml you would have your DAO beans definitions. Sorry, I linked the one-parameter constructor in my previous comment.
score: 0
comment on: http://stackoverflow.com/q/27608928

http://stackoverflow.com/q/27482032
has body: I have to upgrade my code for a multi tenant environment. I am planning to do the same using Hibernate filters.But I dont want my application code to change for passing the tenant Id in each method. I want some way to get the tenant id directly in dao via session or some other thing.
tagged with: java
tagged with: hibernate
type: Question
score: 0
tagged with: ejb
tagged with: jpa
has title: Pass a Value from EJB to JPA using session
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/43433866
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43405622
has comment: http://stackoverflow.com/comment/43426313
has comment: http://stackoverflow.com/comment/43433852

http://stackoverflow.com/comment/43539890
type: AnswerComment
comment on: http://stackoverflow.com/a/27554759
score: 0
type: Comment
has text: Thanks SLaks. +1. Is there a way to calculate exact overhead of String v/s char? Just curious.

http://stackoverflow.com/q/27574035
score: 1
tagged with: java
type: Question
has title: Android App Using Sherlock No Resource Identifier
tagged with: actionbarsherlock
downvote count: 0
has comment: http://stackoverflow.com/comment/43576302
has body: Hi so this is my first time making an android app and I am trying to use Sherlock Themes. When I imported everything per the instructions from Sherlock and after watching videos for importing Sherlock into the Android Studio build.gradle. I am finding an error that I am unable to fix. I will link the error below. error: Error:(4) No resource identifier found for attribute 'showAsAction' in package 'test.test.test.unmfinder30' Android Studio claims error is here app:showAsAction="never": &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderInCategory="100" app:showAsAction="never" /&gt; &lt;/menu&gt; I also have an cannot resolve symbol "R" which I am unable to deal with as well in my MainActivity.java. import android.os.Bundle; import com.actionbarsherlock.app.SherlockActivity; public class MainActivity extends SherlockActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } Please help me make the first hurdle in my noviceness for programming Android apps in Android Studio. Thank you!
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43574530
upvote count: 1

http://stackoverflow.com/q/27517097
tagged with: java
has body: Hey guys I'm having trouble figuring out how to sort my HashMap and I wanted to see if you guys could figure it out. I've broke up my code into the designated area as it is a pretty long code. I've also marked where I'm having the issue. import java.io.IOException; import java.util.*; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class MeleeItOnYou { public static void main(String[] args) throws StringIndexOutOfBoundsException, InputMismatchException { String ret = "Y", cont = "N"; Process exitCode; int c, o; // c = character and o = option boolean Yes, No; Yes = (ret.charAt(0) == 'y' || ret.charAt(0) == 'Y'); No = (cont.charAt(0) == 'n' || cont.charAt(0) == 'N'); Scanner keyIn = new Scanner(System.in); do { System.out.println("\nChoose an option"); System.out.println("1: Character matchups"); System.out.println("2: Notable Players for Each Character"); System.out.println("3: Frame Data"); System.out.println("4: Character Specific Matchup Guide"); System.out.println("5: Personal Power Ranking System"); o = keyIn.nextInt(); if (o == 5) { double RD, t, old, x; String tournament, player; int a, number_of_players, place; place = 0; try { File file = new File("data.txt"); FileOutputStream is = new FileOutputStream(file); OutputStreamWriter osw = new OutputStreamWriter(is); Writer w = new BufferedWriter(osw); ArrayList&lt;player&gt; players = new ArrayList&lt;player&gt; (); ArrayList&lt;placeDisplay&gt; placeVar = new ArrayList&lt;placeDisplay&gt;(); System.out.println("1:Add a tournament \t2:View Existing"); a = keyIn.nextInt(); if (a == 1) { System.out.println("\nEnter tournament name"); tournament = keyIn.next(); w.write("Tournament Results"); w.write("\n-----------------"); w.write("\n" + tournament + ": Tournament Name"); w.close(); System.out.println(…
downvote count: 1
has comment: http://stackoverflow.com/comment/43465335
duplicate of: http://stackoverflow.com/q/109383
tagged with: hashmap
type: UnansweredQuestion
tagged with: sorting
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43464248
has comment: http://stackoverflow.com/comment/43464846
score: 2
answer count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43464232
type: Question
has comment: http://stackoverflow.com/comment/43464396
has comment: http://stackoverflow.com/comment/43464783
has comment: http://stackoverflow.com/comment/43464876
has comment: http://stackoverflow.com/comment/43464807
has title: Sorting HashMap with User Input Arraylists
linked to: http://stackoverflow.com/q/109383
upvote count: 3

http://stackoverflow.com/comment/43483400
comment on: http://stackoverflow.com/q/27527265
type: QuestionComment
type: Comment
has text: @Codor interesting. I get [three warnings](http://i.imgur.com/cIhDmru.png), maybe you have disabled some that are usually enabled or the other way around...
score: 0

http://stackoverflow.com/q/27547536
tagged with: jasper-reports
score: 1
tagged with: java
downvote count: 0
has title: How to define correctly the column break in jasperreport
has body: I have a fully dynamic report, and all columns generate by it are dynamic. By this i want to set a maximun value of columns per page. I searched for, and i found the COLUMN_BREAK element,but all the things that I do don't return the expected result. I try using PrintWhenExpression propertie,but don't work correctly. If anyone can explain me what i have to do. Thanks!!!
favorite count: 0
type: UnansweredQuestion
answer count: 0
upvote count: 1
type: Question

performance
tags question: http://stackoverflow.com/q/27475827
tags question: http://stackoverflow.com/q/27599934
tags question: http://stackoverflow.com/q/27517102
tags question: http://stackoverflow.com/q/27603425
tags question: http://stackoverflow.com/q/27633698
tags question: http://stackoverflow.com/q/27563427
tags question: http://stackoverflow.com/q/27628373
tags question: http://stackoverflow.com/q/27565818
tags question: http://stackoverflow.com/q/27610012
tags question: http://stackoverflow.com/q/27489314
tags question: http://stackoverflow.com/q/27563731
tags question: http://stackoverflow.com/q/27625161
tags question: http://stackoverflow.com/q/27533065
tags question: http://stackoverflow.com/q/27541283
tags question: http://stackoverflow.com/q/27594439
tags question: http://stackoverflow.com/q/27609732
tags question: http://stackoverflow.com/q/27526979
tags question: http://stackoverflow.com/q/27580144
tags question: http://stackoverflow.com/q/27503002
tags question: http://stackoverflow.com/q/27582486
tags question: http://stackoverflow.com/q/27614799
tags question: http://stackoverflow.com/q/27579104
tag name: performance
tags question: http://stackoverflow.com/q/27483350
tags question: http://stackoverflow.com/q/27588663
tags question: http://stackoverflow.com/q/27510357
type: Tag
tags question: http://stackoverflow.com/q/27577193
tags question: http://stackoverflow.com/q/27500677
tags question: http://stackoverflow.com/q/27525369
tags question: http://stackoverflow.com/q/27497468

http://stackoverflow.com/q/27494461
upvote count: 2
answer count: 2
tagged with: jackson-modules
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson update part of object
type: Question
has answer: http://stackoverflow.com/a/27714661
has body: This is what I am trying to do. lets say I have 2 json inputs. First {"testArr":[{"name":"name1"},{"name":"name2"}]} Second {"testArr":[{"name":"name1Changed"}]} And I have classes class test{ public String name; } class runner{ public ArrayList&lt;test&gt; testArr; public String firstJson; public String secondJson; public void runProj(){ ObjectMapper mapper = new ObjectMapper(); //This one is correct works just fine testArr = mapper.readValue(firstJson, ITBTeam.class); //Now I want to update just value of first element of array and //tryed to use this function but this one will trim my array mapper.readerForUpdating(testArr).readValue(secondJson); } } So after this one I am getting {"testArr":[{"name":"name1Changed"}]} where I want to get {"testArr":[{"name":"name1Changed"},{"name":"name2"}]} Please let me know if I am missing something from Jackson or there are no such functionality and I would need to write my own. Since there are no straight conversation to do what i wanted here is what i wrote for json nodes to do the same thing. Two functions to merger/overwrite nodes and merge/overwriteArray. This works by passing 2 json Nodes hope that will help if anyone are looking for similar things public static JsonNode mergeNode(JsonNode mainNode, JsonNode updateNode) { Iterator&lt;String&gt; fieldNames = updateNode.fieldNames(); while (fieldNames.hasNext()) { String fieldName = fieldNames.next(); JsonNode jsonNode = mainNode.get(fieldName); // if field exists and is an embedded object if (null != jsonNode &amp;&amp; (jsonNode.isObject())) { mergeNode(jsonNode, updateNode.get(fieldName)); // if field exists and is an embedded array } else if (null != jsonNode &amp;&amp; (jsonNode.isArray())) { mergeArray(jsonNode, updateNode.get(fieldName)); } else { // Overwrite field node ((ObjectNode) mainNode).set(fieldName, updateNode.get(fieldName)); } } return mainNode; } public static void mergeArray(JsonNode mainNode, JsonNode updateNode) { //Loops over array and adds items if…
tagged with: jackson
has answer: http://stackoverflow.com/a/31245003
has comment: http://stackoverflow.com/comment/43420918

http://stackoverflow.com/comment/43598924
comment on: http://stackoverflow.com/a/27587121
has text: @pbabcdefp: In the absence of this logic in `equals()`, you can either just mark `getString()` as `synchronized`, or else mark `string` as `volatile` and use double-checked locking in `getString()`: `public String getString() { if (string == null) { synchronized(this) { if (string == null) { string = OtherClass.expensiveCalculation(number); } } } return string; }`. (The former approach is simpler, and may perform better if these objects are rarely shared across threads; the latter approach will perform better if these objects are frequently shared across threads, by reducing locking.)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27499655
has answer: http://stackoverflow.com/a/27500556
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27499762
tagged with: http-headers
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/4904803
score: 5
favorite count: 0
tagged with: http-accept-language
has body: I actually tested these two formats and my server is okay with both. Since Http header fields is saying "en-US" is the format and my Local java class is returning "en_US", I'm little bit confused to get which of them to use! My partial code is like this: // set accepted language List&lt;String&gt; acceptedLanguages = null; final Locale defaultLocale = Locale.getDefault(); // en if (defaultLocale != null) { final String defaultLang = defaultLocale.toString(); // en_US if (!TextUtils.isEmpty(defaultLang)) { acceptedLanguages = new ArrayList&lt;String&gt;(); acceptedLanguages.add(defaultLang); // Always add en as fallback if applicable if (!HttpClient.DEFAULT_ACCEPTED_LANGUAGE_COUNTRY.equals(defaultLang)) { acceptedLanguages.add(HttpClient.DEFAULT_ACCEPTED_LANGUAGE_COUNTRY); } } } String header = HttpClient.getAcceptLanguageHeader(acceptedLanguages); // like: cz_CH;q=1.0, en_US;q=0.9 this.mHttpGetRequest.addHeader(HttpHeaders.ACCEPT_LANGUAGE, header); getAcceptLanguageHeader() method adds en_US;q=0.9to the string if user's device language in not en_US. Any idea would be appreciated. Thanks.
tagged with: android
has answer: http://stackoverflow.com/a/27499762
accepted answer: http://stackoverflow.com/a/27500556
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/4632885
has title: Which format of "en_US" and "en-US" should be used in Http header request as Accept-Language?

http://stackoverflow.com/comment/93940623
type: Comment
comment on: http://stackoverflow.com/q/27501819
score: 0
has text: Did you found a solution? I would like to add certificate to postman for test can you help me plese
type: QuestionComment

http://stackoverflow.com/q/27529244
answer count: 2
has body: Requirement : I have 4 servers : A,B,C,D. They all connect to data provider, get the data and persist it into mongodb for N mins. So that if, next time, same request arrives to another server, it takes data from mongodb only instead of making a call to data provider. |A| |B| |data provider| |C| |D| But if, |data provider| response slow, there is a possibility that 2 different requests for same resource arrive to A, B. I want one request waiting until the response of first request is received. I am using queue for this which is fine for single server. But now I need need distributed cache due to multiple servers. Implementation : After reading few articles over the net, I got to know that Distributed Cache in Java can be implemented using ehcache RMI replication. But I have few doubts before going ahead with ehchache. (Although there are more solutions like JCS etc, I decided to pick ehcache on the basis other answers on StackOverflow) Doubts What if one of the servers gets down? Does ehcache handles this automatically?
has title: Distributed Cache in Java using ehcache RMI
tagged with: ehcache
has answer: http://stackoverflow.com/a/27536084
type: UnansweredQuestion
tagged with: spring
tagged with: java
has answer: http://stackoverflow.com/a/27542908
type: Question
tagged with: mongodb
score: 0

http://stackoverflow.com/comment/43562756
comment on: http://stackoverflow.com/q/27568767
type: Comment
type: QuestionComment
has text: Once you reach a breakpoint you can just step through, isn't that enough?
score: 0

http://stackoverflow.com/comment/43678077
type: Comment
comment on: http://stackoverflow.com/a/27628612
score: 0
type: AnswerComment
has text: Not only that, but there is no `.setReuseAddress(true)` either

http://stackoverflow.com/a/27565551
upvote count: 0
has body: In java code Remove ( ' ) and test . IN ( DT-ASUTOP , DT-AVMAH4 , DT-BAGTOP , DT-BNDTOP , DT-DIGTOP , DT-FATTUT , DT-GORGPRF )");
score: -1
answers question: http://stackoverflow.com/q/27565360
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43556299

http://stackoverflow.com/a/27611847
has comment: http://stackoverflow.com/comment/43648369
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27611249
downvote count: 0
has comment: http://stackoverflow.com/comment/43649611
has body: Assuming that the diagnostic information is not too big I would consider SQS. If you have different classes of data, you can push the different types to different queues. You can then consume the messages in the queue(s) either from servers running in EC2 or on your own servers. SQS will deliver each message at least once, but you have to be ready for a given message to be delivered multiple times. Duplicates do happen occasionally. If your payloads are large, you will want to drop them in S3. If you have to go this route, you might want to use SQS as well: create a file in S3 and push a message to SQS with the S3 filename so you make sure all the payloads get processed. I would imagine that you will push the data packets into SQS and then have a separate process that will consume the messages and insert into a database or other store in a format that supports whatever reporting/aggregation requirements you might have. The queue provides scalable flow control so you size the message consumption/processing for your average data rate, even though your data production rate will likely vary greatly during the day. SQS only holds messages for a maximum of 14 days, so you must have some other process that will consume the messages and do some long-term storage.
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43646731
answers question: http://stackoverflow.com/q/27611249

jetty-9
tag name: jetty-9
tags question: http://stackoverflow.com/q/27584107
type: Tag
tags question: http://stackoverflow.com/q/27574308
tags question: http://stackoverflow.com/q/27532192

http://stackoverflow.com/q/27591822
has title: Exiting a Java method completely
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27592209
type: Question
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/43607454
answer count: 2
has body: My method checkConnection() calls setPort() within a TimeLimiter which exits the call method within 3 seconds if the method isn't finished. This works great and there is an exception of com.google.common.util.concurrent.UncheckedTimeoutException when the time limit is exceeded. However even after this exception is thrown setPort still runs and once completed, code within my try statement opening the port runs however once it gets to Thread.sleep(100) an InterruptedException is thrown then the method exits. However this leaves me with an open port which causes problems. Is there a way once the time limit is exceeded that all code within the call() method will stop? public static String checkConnection(final String comPort) { final String port = comPort; String result = null; TimeLimiter limiter = new SimpleTimeLimiter(); try { result = limiter.callWithTimeout(new Callable&lt;String&gt;() { public String call() { // Try to set serial port String setPort = setPort(comPort); // Check for any exceptions if(setPort.contains("jssc.SerialPortException")) { if(setPort.contains("Port busy")) { return "Error: The port appears to be busy"; } else { return "Error: Can't connect to port"; } } try { // Port can't be accessed twice at the same time synchronized(portLock) { // Open port if not already opened if(!serialPort.isOpened()) serialPort.openPort(); // Sleep while response is being sent Thread.sleep(300); // Check for response buffer = serialPort.readBytes(6);//Read 6 bytes from serial port serialPort.closePort(); } // Parse response as string response = new String(buffer); } catch (SerialPortException | InterruptedException e) { System.out.println("Serial:: ping() :: Exception while pinging Noteu : " + e); return "Error"; } return response; } }, 3, TimeUnit.SECONDS, false); } catch (Exception e) { System.out.println("Serial:: checkConnection() :: Exception while calling ping : " + e); } } public static String setPort(String port) { synchronized(portLock) { try { System.out.…
tagged with: time-limiting
has comment: http://stackoverflow.com/comment/43607934
has answer: http://stackoverflow.com/a/27591955

http://stackoverflow.com/a/51511614
has body: Somewhat late, but after looking into this if you provide your own Client Bean the LoadBalancerFeignClient wont get built and used, and the Feign open tracing autoconfig will still work. @Bean public Client feignClient() { return new Client.Default(null, null); }
type: Answer
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/27620338
upvote count: 7

http://stackoverflow.com/a/27546968
has body: Is it really a Class&lt;?&gt; object do you have as a parameter or do you have an instance of a MyClass-extending class ? If the latter you could use the following code: public &lt;E extends MyClass&gt; String getClassTag(E myClass) { return myClass.TAG; } If only can provide a Class&lt;?&gt; object the following code maybe works, but you have to access the field via Reflection (which is much more complicated ;) ) public &lt;E extends MyClass&gt; String getClassTag(Class&lt;E&gt; myClass) { ... myClass.getField("TAG"); ... }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43520349
answers question: http://stackoverflow.com/q/27543799

http://stackoverflow.com/comment/43592952
has text: Change when it is used *where*?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27556163

http://stackoverflow.com/q/27604235
answer count: 1
has body: Multiple instances of my multi-threaded(approx 10 threads) application is running on different machines(approx 10 machines). So overall 100 threads of this application are active simultaneously. Each of these threads produce 4 output sets, each set containing 1k-5k rows. Each of these sets is pushed to a single Mysql machine , same db, same table(insert or update operation). So there are 4 tables consuming 4 sets produced by each thread. I am using mybatis as ORM. These threads may consume a lot of time in writing output to DB than processing the requests. How can I optimize the database writes in this case? 1. Use batch processing of mybatis 2. Write data to files which will be picked up by single consumer thread &amp; written into DB? 3. Write each data set to different files &amp; use 4 consumer threads to pick data from same set that must be pushed to same table, so locking is minimized? Please suggest other better ways if possible?
type: UnansweredQuestion
tagged with: multithreading
tagged with: parallel-processing
has title: Concurrent multithreaded Bulk data inserts/updates to Mysql
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/27604388
type: Question
tagged with: mybatis
score: 0

http://stackoverflow.com/q/27576642
has comment: http://stackoverflow.com/comment/43578660
has answer: http://stackoverflow.com/a/27576672
tagged with: mouselistener
tagged with: swing
has title: variable when called in the same scope produces multiple values java
tagged with: jbutton
type: Question
has comment: http://stackoverflow.com/comment/43578662
tagged with: java
upvote count: 2
answer count: 3
possible better answer: http://stackoverflow.com/a/27576672
downvote count: 0
has answer: http://stackoverflow.com/a/27579477
favorite count: 0
has body: In a Java Swing desktop app. I have a number of smaller classes, all of which are made use of in an overarching App Class. One of such smaller classes is a JPanel that represents my login page. I've added a mouselistener to the login button on this page, that goes thus: Public class loginPage extends JPanel{ String username; boolean capturedName=false; JTextField nameField; ... loginButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { username = nameField.getText(); capturedName=true; //for redundant checking of mouse click event System.out.println(username); //error checking System.out.println(capturedName); //error checking } }); } In a separate display class that represents my JFrame, I make the login page an attribute of said class and I instantiate this display class in my app class, after adding the login page to it. I am trying to capture the login page username attr in the App class and pass it to other methods. But when I run the code, and click on the login button, the value in the textbox isn't captured. To error check, I tried the ff: //Set login page GUI up while(display.loginPage.username==null){ //this is initially true if (display.loginPage.capturedName){ //boolean to check if button has been clicked display.loginPage.username=display.loginPage.nameField.getText(); //intentional redundancy String username=display.loginPage.username; System.out.print(username); //pass username to other methods } } When I run the code, enter a name on the username textfield, and click login, the typed name and a true value for the capturedName boolean are both printed, but the if (display.loginPage.capturedName) condition is never fulfilled. Also when I add in print display.loginPage.username, I get a null value . What could be the reason for this discrepancy between the same values?
has answer: http://stackoverflow.com/a/27576677
accepted answer: http://stackoverflow.com/a/27576677
linked to: http://stackoverflow.com/q/26517856
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/43534589
comment on: http://stackoverflow.com/a/27552566
type: Comment
has text: Thanks, but the list is not empty--see revised question.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43683545
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27630971
has text: Open the jar (zip format) with 7zip/WinZip or whatever, and check that the file is there: _case-sensitive_, in the package folder. It might be that you need to place the file not under /src/(main/)java but /src/main/resources/com/noteu/ or so.
score: 0

http://stackoverflow.com/q/27562351
tagged with: reflection
linked to: http://stackoverflow.com/q/22866925
linked to: http://stackoverflow.com/q/227486
tagged with: java
has answer: http://stackoverflow.com/a/27562749
has answer: http://stackoverflow.com/a/27563150
type: Question
has body: Assuming I have an object and I took it fields: Field[] fields = obj.getFields(); Now I'm iterating through each one and would like to print their members if it's some kind of class, otherwise just use field.get(obj) in case it's a string, int or anything that this command will print its value, not just the reference pointer. How can I detect it?
has title: Determine if a field is a type I created, using reflection
has answer: http://stackoverflow.com/a/27562537
score: 0
has comment: http://stackoverflow.com/comment/43550571
has comment: http://stackoverflow.com/comment/43550377
has answer: http://stackoverflow.com/a/27562454
has comment: http://stackoverflow.com/comment/43550437
has answer: http://stackoverflow.com/a/27562770
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43550448

http://stackoverflow.com/q/27570721
downvote count: 1
type: Question
score: 5
has answer: http://stackoverflow.com/a/27571004
duplicate of: http://stackoverflow.com/q/1522994
tagged with: http://stackoverflow.com/tag/c
answer count: 3
has body: This a legacy system so please don't tell me what I'm trying to do is wrong. It has to be this way. I have a byte array where date is put in a sequential manner. This is fine until I want to store a value above 255. To do this I need to use 2 bytes as a 16 bit value. So I need to convert an int into two chars and then the two chars back into an int. One program is in C and the other in Java and they communicate through a byte array. This seems to me like a problem that should have been fixed a long time ago so I'm wondering if there is a function for doing this in the Java and C libraries. If not, is there an easy way of making the conversion?
has title: How to break an int into two chars
has comment: http://stackoverflow.com/comment/43572114
favorite count: 0
has comment: http://stackoverflow.com/comment/43566807
linked to: http://stackoverflow.com/q/1522994
has answer: http://stackoverflow.com/a/27570828
type: UnansweredQuestion
upvote count: 6
tagged with: java
has answer: http://stackoverflow.com/a/27571039

http://stackoverflow.com/comment/43414415
score: 0
has text: Possible duplicate of http://stackoverflow.com/questions/46898/iterate-over-each-entry-in-a-map
comment on: http://stackoverflow.com/q/27490347
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27634823
tagged with: java
has title: Could not bind proxy receiver to the RMI registry
answer count: 2
has body: I am trying to connect to matlab from java file and do some operations. Some times it is working fine but sometimes while trying to connect to matlab from java I am getting an error. The code which I use for connecting to matlab is MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder() .setMatlabLocation("/usr/local/MATLAB/R2014a/bin/matlab") .build(); MatlabProxyFactory factory = new MatlabProxyFactory(options); //Create a proxy, which we will use to control MATLAB MatlabProxy proxy = factory.getProxy(); proxy.eval("addpath SourceCode/Hipc/"); String executeThis = "run_BVD(" + upload2Bean.getUserImage2FileName() + ",1);"; proxy.eval(executeThis); proxy.exit(); proxy.disconnect(); //Disconnect the proxy from MATLAB Error is matlabcontrol.MatlabConnectionException: Could not bind proxy receiver to the RMI registry at matlabcontrol.RemoteMatlabProxyFactory.requestProxy(RemoteMatlabProxyFactory.java:104) at matlabcontrol.RemoteMatlabProxyFactory.getProxy(RemoteMatlabProxyFactory.java:144) at matlabcontrol.MatlabProxyFactory.getProxy(MatlabProxyFactory.java:81) at com.Daos.Upload2Dao.upload(Upload2Dao.java:43) at com.ActionClasses.Upload2Action.execute(Upload2Action.java:94) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.…
score: 0
has answer: http://stackoverflow.com/a/34320465
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43135722
tagged with: matlab
type: Question

http://stackoverflow.com/a/27547165
type: Answer
answers question: http://stackoverflow.com/q/27542593
has comment: http://stackoverflow.com/comment/43547229
has body: Looking on maven central (http://search.maven.org/#search|gav|1|g%3A%22org.apache.tiles%22%20AND%20a%3A%22tiles-api%22) I can't find tiles-api in version 2.2. Actually this is true of all the tiles dependencies. Try changing to use 2.2.0 (or 2.2.1 or 2.2.2) instead: &lt;properties&gt; ... &lt;tiles.version&gt;2.2.0&lt;/tiles.version&gt; &lt;/properties&gt;
score: 0

http://stackoverflow.com/q/27573623
has title: Delete AM/PM labels TimePickerDialog
type: UnansweredQuestion
has body: I want delete AM/PM labels and add 00 to hour. I read about custom timePicker but I don't find solution.
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27573725
score: 0
answer count: 1
tagged with: android

http://stackoverflow.com/q/27508174
has title: How can I fix this method that convert Number in String to show the correct number of decimal digits?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27508512
has body: I have the following problem. I am using this method to convert a Number (as a BigDecimal) to a formatted string: /** * @param n il Number da formattare * @param thou_sep separator for hundreds * @param dec_sep separator for decimal digits * @param number of decimal digits to show * @return a string representing the number * @author Andrea Nobili */ public static String getFormattedNumber(Number n, String thou_sep, String dec_sep, Integer decimalDigits) { if (n == null) return ""; double value = n.doubleValue(); if (decimalDigits != null &amp;&amp; decimalDigits &lt; 0) throw new IllegalArgumentException("[" + decimalDigits + " &lt; 0]"); DecimalFormatSymbols s = new DecimalFormatSymbols(); if (thou_sep != null &amp;&amp; thou_sep.length() &gt; 0) { s.setGroupingSeparator(thou_sep.charAt(0)); } if (dec_sep != null &amp;&amp; dec_sep.length() &gt; 0) { s.setDecimalSeparator(dec_sep.charAt(0)); } DecimalFormat f = new DecimalFormat(); f.setDecimalFormatSymbols(s); if (thou_sep == null || thou_sep.length() == 0) { f.setGroupingUsed(false); } if (decimalDigits != null) { f.setMaximumFractionDigits(decimalDigits); } f.setMaximumIntegerDigits(Integer.MAX_VALUE); String formattedNumber = f.format(value); return ("-0".equals(formattedNumber)) ? "0" : formattedNumber; } For example if I call something like: utilityClass.getFormattedNumber(57.4567, null, ",", 2) I obtain the string 57,45 Ok, this work fine. My problem is that if I try to perform it with a number having not decimal digits (for example passing the value 57 it return the String 57. I want that in this case it return the string 57.00 (because I have specified that I want 2 decimal digits in the input parameter of this method) How can I fix this issue and obtain the correct number of decimal digits?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27508512
tagged with: java
accepted answer: http://stackoverflow.com/a/27508324
has answer: http://stackoverflow.com/a/27508345
has comment: http://stackoverflow.com/comment/43447292
type: Question
tagged with: decimal
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/27508324

http://stackoverflow.com/comment/43529560
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27551338
score: 0
has text: @brso05 Yes, I did run both codes, they're resulting in `StackOverflowError`.

http://stackoverflow.com/comment/43653462
comment on: http://stackoverflow.com/q/27615889
type: Comment
has text: I think to define maven plugin way is : true org.apache.maven.plugins maven-compiler-plugin You have used something diff.
type: QuestionComment
score: 0

http://stackoverflow.com/a/27605900
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27605778
has body: Your servlet is a class like any other, and I would follow the same practises as for your other classes. e.g. com.x.y.ShoppingCartServlet, or similar. You may subdivide your packages to separate business logic from the deployment/container mechansim (e.g. com.x.y.servlets.ShoppingCart), but again, that's no different to how packages are generally used within Java. Your full package name will have to be specified in your deployment descriptor.
score: 3
upvote count: 3
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27605778

http://stackoverflow.com/a/41534701
downvote count: 1
has comment: http://stackoverflow.com/comment/70277778
upvote count: 0
score: -1
has body: here is my code for your answer #include&lt;stack&gt; #include&lt;iostream&gt; using namespace std; bool high(char a,char b) { if(b==' ') return true; else if(a==b) return false; else if(a=='/') return true; else if(a=='*'&amp;&amp;b!='/') return true; else if(b=='/') return false; else if(a!='/'&amp;&amp;b=='*') return false; else if(b=='-') return true; else if(a=='-'&amp;&amp;b!='(') return false; else if(b=='(') return true; else if(a=='(') return true; else if(a==')') return false; } main() { int k=0; string s; stack&lt;char&gt;s1; s1.push(' '); char ch; while(cin&gt;&gt;ch) { if(ch=='(') { k=1; s1.push(ch);} else if(ch&gt;47&amp;&amp;ch&lt;58) s.push_back(ch); else if(high(ch,s1.top())) s1.push(ch); else if(!high(ch,s1.top())&amp;&amp;ch!=')') { while(!s1.empty()&amp;&amp;!high(ch,s1.top())) { s.push_back(s1.top()); s1.pop(); } s1.push(ch);} else if(ch==')') { while(!s1.empty()&amp;&amp;s1.top()!='(') { s.push_back(s1.top()); s1.pop(); } s1.pop(); k=0; } } while(!s1.empty()) { s.push_back(s1.top());s1.pop(); } cout&lt;&lt;s; }
answers question: http://stackoverflow.com/q/27511334
type: Answer
has comment: http://stackoverflow.com/comment/70274857

http://stackoverflow.com/comment/43671714
type: Comment
comment on: http://stackoverflow.com/a/27625410
has text: @user3198603 It will only be invoked if your handler method has appropriate model attributes/command object parameters.
type: AnswerComment
score: 0

quick-search
tag name: quick-search
type: Tag
tags question: http://stackoverflow.com/q/27517786

http://stackoverflow.com/comment/43630875
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27603813
has text: Note that there is *no line-for-line equivalent* in Java. This code uses lifetimes, a feature that Java doesn't need because it is a garbage-collected language.
type: Comment

http://stackoverflow.com/comment/43637409
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27607655
score: 0
has text: Your Logcat is too small. Indeed I see a `NullPointerException`, but I don't see its trace, which is the sole purpose of the stacktrace. Post it fully please.

http://stackoverflow.com/comment/43567060
comment on: http://stackoverflow.com/q/27570122
type: QuestionComment
type: Comment
has text: I have added a code example, which demonstrates this effect.
score: 0

http://stackoverflow.com/comment/43625341
has text: I ll give a try with TIntIntHashMap. But, array as "hashmap" - No, bcoz keys are not in sequence :(
comment on: http://stackoverflow.com/a/27601131
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27595096
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
tagged with: tableview
has answer: http://stackoverflow.com/a/27611988
accepted answer: http://stackoverflow.com/a/27611988
answer count: 1
has title: Snapshot entire TableView
favorite count: 0
has body: I am currently trying to create an image from a TableView using snapshot, and the snapshot is only grabbing the tableview that is visible on the screen. I've tried messing with the SnapshotPreferencesviewport, but that didn't help. Any suggestions or workarounds would be appreciated. EDIT: I have now also tried creating a new pane of the same width and height of the TableView, adding the TableView, and taking a snapshot of that, but it ends up blank. I've continued to play around with this. Creating a new pane and adding it to a scene gives me all the columns of the TableView, but not all the rows. Code to take the snapshot is below. WritableImage image = null; //Get the node TableView&lt;ObservableList&lt;ObjectProperty&lt;Item&gt;&gt;&gt;pattern = mainApp.getPVController().getPattern(); //Create rectangle to define viewport Rectangle2D rect = new Rectangle2D(0, 0, pattern.getWidth(), pattern.getHeight()); //Define snapshot parameters SnapshotParameters params = new SnapshotParameters(); params.setViewport(rect); //Take the snapshot image = pattern.snapshot(params, image);
score: 2
downvote count: 0
tagged with: javafx

http://stackoverflow.com/comment/43466955
comment on: http://stackoverflow.com/a/27518514
score: 0
type: AnswerComment
has text: But, I could only change the world in to present, past, future. How to convert to continuous form, like "going"
type: Comment

http://stackoverflow.com/a/27621463
has comment: http://stackoverflow.com/comment/43664729
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43664613
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/27621178
score: 8
accepted answer of: http://stackoverflow.com/q/27621178
has body: IDocument is in the org.eclipse.text plugin so you must add this to your plugin's dependencies list. Note: You can also add the org.eclipse.jface.text plugin to the dependencies list as that will include the org.eclipse.text plugin.

http://stackoverflow.com/comment/43485343
has text: you are right, i hastily wrote the code. modified it, altough i don't like using break. alternative is to assign the string and then compare it with "done" inside the while; answer by other user has this example, won't post the same :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27528331

http://stackoverflow.com/comment/43536268
score: 0
type: AnswerComment
has text: @SLaks My understanding was that each line was a `String[]`, which each index in the string being a one-character String object.
type: Comment
comment on: http://stackoverflow.com/a/27554759

http://stackoverflow.com/comment/43406055
score: 0
type: Comment
type: QuestionComment
has text: @gtgaxiola: https://projecteuler.net/problem=12
comment on: http://stackoverflow.com/q/27486750

http://stackoverflow.com/q/27514969
has body: I wrote a class that is responsible for holding a canvas and its graphicsContext2d object. But when I want to add that canvas object to the scene, it doesn't work. Why isn't this code working like the out-commented code? The object is just stored somewhere else, or what am I missing? //EDIT2: Problem was that tab1.getHeight() return 0.0... //EDIT: Well this works, but why?? I am just creating the object outside CanvasScreen instead of in it... @FXML public void initialize() { Canvas canvas = new Canvas(500, 500); CanvasScreen screen = new CanvasScreen(canvas, tab1.getHeight(), tab1.getWidth()); screen.getContext().setStroke(Color.BLUE); screen.getContext().setLineWidth(5); screen.getContext().strokeLine(40, 10, 10, 40); tab1.getChildren().add(screen.getCanvas()); } //OLD: @FXML public void initialize() { CanvasScreen screen = new CanvasScreen(tab1.getHeight(), tab1.getWidth()); screen.getContext().setStroke(Color.BLUE); screen.getContext().setLineWidth(5); screen.getContext().strokeLine(40, 10, 10, 40); // Canvas canvas = new Canvas(500, 500); // canvas.getGraphicsContext2D().setStroke(Color.BLUE); // canvas.getGraphicsContext2D().setLineWidth(5); // canvas.getGraphicsContext2D().strokeLine(40, 10, 10, 40); tab1.getChildren().add(screen.getCanvas()); }
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/43461313
type: Question
tagged with: canvas
has comment: http://stackoverflow.com/comment/43461247
has title: storing canvas in an object?
upvote count: 1

http://stackoverflow.com/q/27559318
upvote count: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/27354019
has comment: http://stackoverflow.com/comment/43544915
tagged with: jersey
has title: POJO Object not converting to JSON Object
tagged with: http://stackoverflow.com/tag/json
has body: Im trying to write a REST service that will take a binary data and return JSON OBject. REST Service: public class FileUpload { @POST @Path("/upload") @Consumes(MediaType.APPLICATION_OCTET_STREAM) @Produces(MediaType.APPLICATION_JSON) public Result uploadFile(InputStream uploadedInputStream) { String uploadedFileLocation = "c://tomcatupload/" + filename; // save it writeToFile(uploadedInputStream, uploadedFileLocation); String output = "File uploaded to : " + uploadedFileLocation; //return Response.status(200).entity(output).build(); Result result = new Result("status","success"); return result; } } RESULT OBject import javax.xml.bind.annotation.XmlRootElement; public class Result { private String Status; private String result; public Result(){ } public Result(String status, String result){ this.Status = status; this.result = result; } public String getStatus() { return Status; } public void setStatus(String status) { Status = status; } public String getResult() { return result; } public void setResult(String result) { this.result = result; } @Override public String toString(){ return new StringBuffer("result : ").append(this.result).toString(); } } public class FileUploadClient { public static void main(String[] args) throws JSONException{ Client client = Client.create(); WebResource webResource = client .resource("http://localhost:8080/RESTFileAttachmentService/rest/file/upload"); String fileName = "C:/test.txt"; InputStream fileInStream = null; try { fileInStream = new FileInputStream(fileName); } catch (FileNotFoundException e) { System.out.println("File not found exception"); // TODO Auto-generated catch block e.printStackTrace(); } //String sContentDisposition = "attachment; filename=\"" + fileName.getName()+"\""; //WebResource fileResource = a_client.resource(a_sUrl); System.out.println("Webservice is being called = " + fileInStream); ClientResponse response = webResource.type(MediaType.APPLICATION_OCTET_STREAM).accept("application/json") .post(ClientResponse.…
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43544747
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27559400

http://stackoverflow.com/a/27566728
answers question: http://stackoverflow.com/q/27566031
has body: This problem is caused because Criteria.list() returns a raw List. As a result, you are able to write code that causes a ClassCastException. With a properly typed list, the compiler would prevent this. As explained in the other answer, the text [B cannot be cast to [Ljava.lang.Object means that a byte[] is being cast to an Object[], which is not allowed. This means that your list contains byte[] objects and you should declare it as such: List&lt;byte[]&gt; list = criteria.list(); In addition, the contents of your for-loop now look incorrect: listBytes.add((byte[]) item[0]); Since item is now a byte[], it's not correct to cast a byte to a byte[]. Perhaps you need to remove the array index [0].
type: Answer
score: 0

http://stackoverflow.com/comment/52208160
type: QuestionComment
comment on: http://stackoverflow.com/q/27629373
has text: I am also having the same error but I am implementing OAuth2 using three apps Authorize, resource and client server all are running on different ports it is ending up on the same URL as yours.
score: 0
type: Comment

http://stackoverflow.com/q/27494179
has comment: http://stackoverflow.com/comment/43420825
answer count: 1
tagged with: android
tagged with: android-activity
tagged with: android-studio
type: UnansweredQuestion
tagged with: android-layout
linked to: http://stackoverflow.com/q/18551756
tagged with: java
has title: Why doesn't creating a new Android application project in Android studio come in with default activity and layout?
has body: I am using Android Studio 1.0. When I created a new project, I was prompted with this dialog I specified the activity name and the layout name. However after I imported the project, as told so from Android studio no main activity, no layouts on a new project, this is all I see Does anyone know where i can find the main layout and java file for main activity. I don't even see a layout folder under res. The Manifest is empty as well; it doesn't contain any activities.
has answer: http://stackoverflow.com/a/27494563
type: Question
score: 0

http://stackoverflow.com/comment/43937406
comment on: http://stackoverflow.com/a/27692816
type: Comment
has text: I debugged the validator and the validations with groups - First or Second assigned are not executed. Do you know why is this happening? If I remove the groups then all the validations are fired.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43697852
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27639439
has text: I don't have an answer to your question, but I'd strongly advise using `List`s instead of arrays. As the answer from DCS_Kurtis_IT_Manager indicates, `List`s are much more flexible than arrays. Also, I don't know why you want to represent integers as `String`s. In short, replace `List<String[]>` with `List<List<Integer>>` and you will find this much easier.

http://stackoverflow.com/q/27531249
has title: Handling all Java Exceptions in one catch block
has comment: http://stackoverflow.com/comment/43491032
has comment: http://stackoverflow.com/comment/43491089
answer count: 5
tagged with: exception
has answer: http://stackoverflow.com/a/27531472
has comment: http://stackoverflow.com/comment/43491138
has answer: http://stackoverflow.com/a/27531463
has comment: http://stackoverflow.com/comment/60367053
has comment: http://stackoverflow.com/comment/43491144
has comment: http://stackoverflow.com/comment/43491167
linked to: http://stackoverflow.com/q/2679330
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27531472
has body: When I try to write this code : catch (Exception | OutOfMemoryError| NumberFormatException| SQLException| IOException e){ } I get the error: "The exception NumberFormatException is already caught by the alternative Exception" I understand it great and from first thinking it's make sense because Exception is the general one. but when I write this code: catch (Exception | OutOfMemoryError e){ } It works without any problems so now I start to get confused why don't I get the previous error. Is OutOfMemmoryError will catch things that Exception won't catch? If I Want to make catch that will include all of exceptions and errors possible what should i write? I just understood that this: catch (Exception e){ } won't catch for me all the exceptions and errors so what will do it?
tagged with: java
tagged with: error-handling
has answer: http://stackoverflow.com/a/27531377
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/27531306
linked to: http://stackoverflow.com/q/1075895
has comment: http://stackoverflow.com/comment/43491228
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43491051
has answer: http://stackoverflow.com/a/27531306
score: 0
has answer: http://stackoverflow.com/a/27531501
has comment: http://stackoverflow.com/comment/43491233

http://stackoverflow.com/a/27578806
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27573337
answers question: http://stackoverflow.com/q/27573337
score: 0
has body: Solution was cleaned - webapps folder at Tomcat. I deleted old webapps which were deployed. And now it works fine. It has some strange impact on my current application.

http://stackoverflow.com/q/27556027
tagged with: listener
has comment: http://stackoverflow.com/comment/43566513
type: UnansweredQuestion
upvote count: 1
has body: I have a fairly complicated program that I have setup. In that program is a preferences window. One of the preferences is the server that the program is connected to. When the user changes that server, or adds another, the program needs to "restart" (dispose of and recreate the main_window class). However I am lost on the best practices of how to do this. Here is the basic scenario in a stacked approach: main Overall class, used for starting. Creates the main window class. main_window JFrame that displays the data to the user prefs JFrame that has many user settable options Server_Editor_Dialog_Box JFrame that when the user hits OK, must restart the program Anyways, My question is how do I notify main that something happened in ServerEditorDialogBox, and the program needs to restart. Should I throw an exception? Should I have a listener chain SEDB->prefs->main_window->main? Or should I do something entirely different?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27556280
type: Question
has answer: http://stackoverflow.com/a/27556121
has answer: http://stackoverflow.com/a/27570310
has title: How to handle event several layers deep, Java
downvote count: 0
favorite count: 0
answer count: 3
tagged with: exception

http://stackoverflow.com/comment/43555538
type: Comment
has text: @OliverCharlesworth [says otherwise...](http://stackoverflow.com/questions/14132285/java-methods-override-vs-abstract#comment19566511_14132285) It may just dependent on the version of Java. This may not work in version 1.5.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27565120

http://stackoverflow.com/a/27500713
has body: As far as I've always been concerned, or seen in practice, you get that error when a referenced class can't be found at runtime That's correct, but not because it just isn't there. Usually it means that the class in the file isn't the class that should have been in the file, because either its name or its package disagrees with the class name as suggested by the filename and the directoy it's in.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27498993

http://stackoverflow.com/q/27614344
type: UnansweredQuestion
tagged with: ubuntu
has answer: http://stackoverflow.com/a/27615504
has comment: http://stackoverflow.com/comment/43651147
has comment: http://stackoverflow.com/comment/43651183
has comment: http://stackoverflow.com/comment/43650676
tagged with: linux
type: Question
has title: How to make java application packge installable on Linux
answer count: 2
has comment: http://stackoverflow.com/comment/43651414
has answer: http://stackoverflow.com/a/27614446
has comment: http://stackoverflow.com/comment/43650984
has body: I have a java application .exe file which runs on windows. But i want to run the same application on Linux. How can i change that .exe file in rpm,debian package or change that java application in rpm package. Please help me out.
score: 0
tagged with: java
tagged with: fedora
has comment: http://stackoverflow.com/comment/43650674
has comment: http://stackoverflow.com/comment/43650996

http://stackoverflow.com/comment/43654173
type: Comment
type: QuestionComment
has text: tried both suggestions and none of the worked. Thanks anyways :)
comment on: http://stackoverflow.com/q/27616085
score: 0

http://stackoverflow.com/comment/43502483
type: QuestionComment
has text: I'd look at using a binary-sort-insertion. This means that each insertion is only `O(logn)` as opposed to `O(nlogn)` (on average).
comment on: http://stackoverflow.com/q/27536786
score: 0
type: Comment

http://stackoverflow.com/a/27657972
type: Answer
has comment: http://stackoverflow.com/comment/43807169
has body: I don't understand why you want to specify more than one alias in the crypto.properties file. To be more clear, this alias refers to the private key used to encrypt messages sent by the application (or decrypt them), not the certificates/public keys trusted by the application, and it's normal to have only one private key per application. The only case that could explain your need is if your application have one certificate + private key per environment, I think. In that case, you can have one crypto.properties file per environment, with only one alias specified in each of them, and the same keystore for all environments, or one crypto.properties with a common alias for all environments, and one keystore per environment. I hope my explanation is understandable. Please, don't hesitate to ask me for clarifications if you need or if I misunderstood your intentions ^^. Have a good day. Edit The crypto.properties file concerns only our service, and only our service. It's used to set the certificate and the associated private key needed to encrypt and/or sign messages it sends. In order to authenticate the clients signatures, you have to configure a truststore at server-side. Maybe the CXF samples projects can help you to configure our own service : http://cxf.apache.org/docs/sample-projects.html. I don't know if you use CXF or another framework, but I think the approach should be very similar. I can't be more precise if I don't know which authentication protocol you use in your implementation.
answers question: http://stackoverflow.com/q/27635522
accepted answer of: http://stackoverflow.com/q/27635522
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43795527
score: 0
has comment: http://stackoverflow.com/comment/43798026
has comment: http://stackoverflow.com/comment/43797828
has comment: http://stackoverflow.com/comment/43782078

http://stackoverflow.com/comment/43471370
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27510548
type: AnswerComment
has text: What does emp.toString() print, Did you try using convertValue(), if not please try that.

http://stackoverflow.com/comment/43549076
score: 0
type: AnswerComment
has text: Yes. Just as there is one single instance of Bar.class in the system, there is a single instance of `NUM` too.
type: Comment
comment on: http://stackoverflow.com/a/27561583

http://stackoverflow.com/comment/49254699
type: AnswerComment
type: Comment
has text: How come the main thread is inside the makeItSo()? Shouldn't the new Thread i.e. Thread-0, be the thread in which makeItSo() is executed (because .makeItSo() is called on the new Starter())?
comment on: http://stackoverflow.com/a/27545613
score: 0

http://stackoverflow.com/comment/43662323
has text: You are shure that class not found referes to java.class and not to another class used in java.class ?
comment on: http://stackoverflow.com/q/27620632
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27491205
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27486227
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43430720
type: Answer
score: 2
downvote count: 0
has body: The question would be what do you want the MQTT client to receive on the Advisory topic as the message body. The advisories generally include much of the information as message properties however those cannot be mapped to MQTT as MQTT messages don't have properties. The body of the Connection advisory is a copy of the ConnectionInfo object that was used to create the connection. On the MQTT side there is not much you could do with that as all you would receive would be the serialized bytes of that object which you wouldn't be able to do anything with.
has comment: http://stackoverflow.com/comment/43436544
answers question: http://stackoverflow.com/q/27486227

http://stackoverflow.com/q/27590506
upvote count: 1
has comment: http://stackoverflow.com/comment/43610321
type: Question
has answer: http://stackoverflow.com/a/27590858
has comment: http://stackoverflow.com/comment/43604887
accepted answer: http://stackoverflow.com/a/27590858
answer count: 1
downvote count: 0
score: 1
tagged with: log4j
favorite count: 0
type: AnsweredQuestion
has body: I have a simple log4j HelloWorld program.. import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class HelloWorldLog4J { private static final Logger logger = LogManager.getLogger("HelloWorld"); public static void main(String[] args) { System.out.println("pre_loggerDOTinfo"); logger.info("Hello, World!mmm"); System.out.println("post_loggerDOTinfo"); } } Here is my properties file, which I put in the same directory : # Root logger option log4j.rootLogger=INFO, file # Direct log messages to a log file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=C:\Users\adel\Desktop\Misc_Stuff\Java_Code\logging.log log4j.appender.file.MaxFileSize=1MB log4j.appender.file.MaxBackupIndex=1 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n But for some reason, I do not find a logging file being created in the same directory. I was thinking that after I run the program, it creates the file logging.log
has title: Need understanding of how log4j appender works
tagged with: java

http://stackoverflow.com/q/27605362
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/27606136
tagged with: java
possible better answer: http://stackoverflow.com/a/36381052
has answer: http://stackoverflow.com/a/36381052
tagged with: mongodb
answer count: 2
tagged with: mongodb-java
tagged with: find
downvote count: 0
has body: I have question regarding MongoDB search query. I have two parameters on which I have to search either "text" or "username" and some more parameters also there. So the SQL query would be like this: select * from tbl where place='pune' and (gender='male' or type='life') and (text='hi' or username='hi') How would it be in MongoDB? Right now I am able to search with just one parameter: DBObject query = new BasicDBObject(); BasicDBList dbl = new BasicDBList(); if (cmodel.getGender() != null) { if ("male".equals(cmodel.getGender().toLowerCase())) { dbl.add(new BasicDBObject(CrushModel.COLUMN_GENDER, "male")); } else if ("female".equals(cmodel.getGender().toLowerCase())) { dbl.add(new BasicDBObject(CrushModel.COLUMN_GENDER, "female")); } else { dbl.add(new BasicDBObject(CrushModel.COLUMN_TYPE, "crush")); } dbl.add(new BasicDBObject(CrushModel.COLUMN_TYPE, "life")); query.put("$or", dbl); } query.put("text", new BasicDBObject("$regex", String.format(".*((?i)%s).*", searchText))); query.put(CrushModel.COLUMN_PLACE, new ObjectId(cmodel.getPlace().toString())); DBCursor cursor = collection.find(query); db.test.find( { $and : [ {gender : 'male' }, { place :'pune'},{$or:[{text:/abc0/},{userName:/abc0/}, {type : 'life' }]}] } ) this is not working the way i want it. there is one more field in table name "type" , for ex. if gender is male/female for which type is "normal" then i also want to show the type "life" here It is only showing me the either or result like the entries of all gender:male or only the entries of type "life", I want to show both of them. Its working db.test.find( { $and : [ { place : 'pune'},{$or:[{text:/hi u r looking awesome 10/},{userName:/hi u r looking awesome 10/}]},{$or:[{gender : 'male' },{type:'life'}]}] } ) thanks @Disposer
favorite count: 0
accepted answer: http://stackoverflow.com/a/27606136
has title: mongodb nested search query in java
tagged with: mongodb-query

http://stackoverflow.com/q/27602942
duplicate of: http://stackoverflow.com/q/2223386
has comment: http://stackoverflow.com/comment/43628089
tagged with: java
has comment: http://stackoverflow.com/comment/43628178
has answer: http://stackoverflow.com/a/27602957
downvote count: 1
type: Question
tagged with: overriding
score: -1
tagged with: inheritance
has title: overriding a static method defined inside a static nested class
has body: I have a old code which is like this- Public class ABC{ . . . Public static class InnerClass{ Public static method do something(){ } } } I want to override do something() method in the implemented class. What's the optimized way to do this?
upvote count: 0
has comment: http://stackoverflow.com/comment/43628175
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2223386
type: UnansweredQuestion

http://stackoverflow.com/q/27523920
has answer: http://stackoverflow.com/a/27524353
answer count: 2
linked to: http://stackoverflow.com/q/7201509
linked to: http://stackoverflow.com/q/20592523
score: 0
has answer: http://stackoverflow.com/a/27525137
tagged with: paintcomponent
type: UnansweredQuestion
has body: I have a problem in my code. I tried to do the game snake but i stopped at the continuous movement into an ActionMap of the drawpanel. I tried to use drawPanel.repaint in a loop but it show me only when it arrived at the end, but i want that all the movement give in the ActionMap. How i can do it? Or anyone have another solution for doing this? DrawPanel drawPanel = new DrawPanel(); public Snake(){ InputMap inputMap = drawPanel.getInputMap();//JPanel.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = drawPanel.getActionMap(); inputMap.put(KeyStroke.getKeyStroke("RIGHT"), "rightAction"); actionMap.put("rightAction", rightAction); inputMap.put(KeyStroke.getKeyStroke("LEFT"), "leftAction"); actionMap.put("leftAction", leftAction); inputMap.put(KeyStroke.getKeyStroke("UP"), "upAction"); actionMap.put("upAction", upAction); inputMap.put(KeyStroke.getKeyStroke("DOWN"), "downAction"); actionMap.put("downAction", downAction); add(drawPanel); pack(); setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); } private class DrawPanel extends JPanel { protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.GRAY); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.GREEN); g.fillRect(x, y, 10, 10); } public Dimension getPreferredSize() { return new Dimension(400, 400); } } Action downAction = new AbstractAction(){ public void actionPerformed(ActionEvent e) { while (y&lt;390) { y +=+10; drawPanel.repaint(); } /* if (y&lt;390) y +=+10; else y = 390; drawPanel.repaint(); */ } }; Action upAction = new AbstractAction(){ public void actionPerformed(ActionEvent e) { if (y&gt;0) y -=10; else y = 0; drawPanel.repaint(); } }; Action leftAction = new AbstractAction(){ public void actionPerformed(ActionEvent e) { if (x&gt;0) x -=10; else x = 0; drawPanel.repaint(); } }; Action rightAction = new AbstractAction(){ public void actionPerformed(ActionEvent e) { if (x&lt;390) x +=10; else x = 390; drawPanel.repaint(); } }; public st…
has comment: http://stackoverflow.com/comment/43487508
tagged with: swing
tagged with: key-bindings
tagged with: java
has title: How i do a continuous movement with keystroke into a ActionMap?
type: Question

http://stackoverflow.com/comment/43632546
comment on: http://stackoverflow.com/a/27605195
type: AnswerComment
score: 0
has text: Yes this class does not have the `@XmlRootElement` annotation when it was generated from `jaxB`. So would I wrap it as an instance of a `JaxBElement` then after I call the `setUuid` method?
type: Comment

http://stackoverflow.com/q/27615447
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/43676940
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27635825
tagged with: httpurlconnection
accepted answer: http://stackoverflow.com/a/27635825
favorite count: 0
tagged with: curl
has comment: http://stackoverflow.com/comment/43654510
has title: Curl works but Jsoup gives 405 error for Spotify API
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am able to curl this url to get the access token for Spotify Web API using the below call from command line: curl -H "Authorization: Basic &lt;Base64 client_id:client_secret&gt;" -d grant_type=client_credentials https://accounts.spotify.com/api/token And I get a response with the api_token. But when I try to do this in java through Jsoup, I get a 405 error: Map&lt;String, String&gt; data = Maps.newHashMap(); data.put("grant_type", "client_credentials"); String clientCred = new String( Base64.encodeBase64((CLIENT_ID + ":" + CLIENT_SECRET).getBytes())); String url = "https://accounts.spotify.com/api/token"; Document doc = Jsoup.connect(URIUtil.encodeQuery(url)) .header("Accept-Language", "en") .header("Authorization", "Basic " + clientCred) .header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8") .data(data) .ignoreHttpErrors(true) .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9" + ",*/*;q=0.8") .get(); Am I doing something wrong in setting the request parameters? I tried a simple HttpURLConnection too, with the same request parameters, and that also fails with the same 405 error.

bndtools
tags question: http://stackoverflow.com/q/27637414
tag name: bndtools
type: Tag

http://stackoverflow.com/q/27488778
has comment: http://stackoverflow.com/comment/43409304
has comment: http://stackoverflow.com/comment/43409258
favorite count: 0
has answer: http://stackoverflow.com/a/27489050
tagged with: multidimensional-array
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/43409229
has answer: http://stackoverflow.com/a/27489088
has body: I have a * delimited file containing counts from a log file by day. I need to create an 'Overall Counts' file using this data however I cannot quite figure it out. my file is laid out like this: 01/11/2014*0123*0*3*0*1 01/11/2014*4567*1*1*2*4 02/11/2014*0123*1*2*1*0 02/11/2014*4567*5*3*2*1 This is just a sample. However, the logic will be the same... I need to add up the values and get an output like this: 0123*1*5*1*1 4567*6*4*4*5 I'm currently iterating through the file line by line using a BufferedReader: while((strLine = br.readLine()) != null) ... In the file containing the daily data, the codes i'm interested in (0123, 4567) are always in the same position so I can either substring them: String code = strLine.subString(11, 15); or split the line on the *: String[] line = strLine.split("\\*"); String code = line[1]; But here is where I get stuck... I need to go through the file looking for the 'code' and adding it to a count, what is the best way to achieve this? I tried with a 2D Array but couldnt quite get my head around it.
tagged with: java
downvote count: 3
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/43409138
has title: Java - How do I add up values in a file?
has comment: http://stackoverflow.com/comment/43409434
answer count: 2
has comment: http://stackoverflow.com/comment/43409273
upvote count: 0
has comment: http://stackoverflow.com/comment/43409334

http://stackoverflow.com/a/27589824
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27589763
type: Answer
has comment: http://stackoverflow.com/comment/64121241
answers question: http://stackoverflow.com/q/27589763
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/43603667
has comment: http://stackoverflow.com/comment/43603620
has body: Change: pan1.setLayout(new BoxLayout(pan1,BoxLayout.X_AXIS)); To something like: pan1.setLayout(new FlowLayout(FlowLayout.CENTER)); ..And the same with the rest of the box layouts.
type: AcceptedAnswer

http://stackoverflow.com/a/27558961
type: Answer
answers question: http://stackoverflow.com/q/27558756
score: 0
accepted answer of: http://stackoverflow.com/q/27558756
type: AcceptedAnswer
has body: as per your comments, you are using JLabel for displaying the data. to show multi-line text in JLabel just wrap your text in tag like: JLabel label = new JLabel(" your long text here .... "); example: String theReadLineFromTextFile = ....; theReadLineFromTextFile = " "+theReadLineFromTextFile+" "; JLabel label = new JLabel(theReadLineFromTextFile); //or JLabel label = new JLabel(); label.setText(theReadLineFromTextFile);

http://stackoverflow.com/q/27552600
answer count: 2
tagged with: groovy
downvote count: 0
has comment: http://stackoverflow.com/comment/43541497
possible better answer: http://stackoverflow.com/a/30790784
upvote count: 11
favorite count: 0
has title: Using Spock to mock private static final variables in Java
linked to: http://stackoverflow.com/q/3301635
has body: I'm trying to write some Spock tests with Groovy to test some Java code (specifically a servlet Filter). I have some private static and private static final variables that I would like to mock, but I can't determine if there is a way to do this. I know metaClass is available for methods, is there anything similar for variables? For instance, I have: public class MyFilter implements Filter { private static WebResource RESOURCE; private static final String CACHE_KEY = "key-to-be-used-for-cache"; ... actual methods, etc ... } I've tried using Mock(MyFilter), as well as using Java reflection to change the value (based on this question and answer Change private static final field using Java reflection). I would like to do this without adding something like Mockito or other frameworks, if that's possible, just use plain Groovy and Spock. Thanks for any ideas! UPDATE 1 At least for private static variables I did get the following to work: Field field = MyFilter.class.getDeclaredField("CACHE_KEY") field.setAccessible(true) field.set(null, "new-key-value") But I still haven't been able to get around the final aspect. UPDATE 2 Thanks to Xv. I can now set this with the following: Field field = MyFilter.class.getDeclaredField("CACHE_KEY") field.setAccessible(true) Field modifiersField = Field.class.getDeclaredField("modifiers") modifiersField.setAccessible(true); modifiersField.setInt(field, field.getModifiers() &amp; ~Modifier.FINAL); field.set(null, "new-key-value")
score: 11
has comment: http://stackoverflow.com/comment/46966901
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/30790784
has comment: http://stackoverflow.com/comment/46970118
has answer: http://stackoverflow.com/a/33822216
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/43531879
accepted answer: http://stackoverflow.com/a/33822216
type: Question
has comment: http://stackoverflow.com/comment/43531572
tagged with: spock
linked to: http://stackoverflow.com/q/25022453
linked to: http://stackoverflow.com/q/15824315

http://stackoverflow.com/comment/43480339
type: QuestionComment
score: 3
has text: Unclear; and ultimately, choosing this or that solution depends on your needs.
comment on: http://stackoverflow.com/q/27525849
type: Comment

http://stackoverflow.com/q/27581005
has answer: http://stackoverflow.com/a/27581456
downvote count: 1
has title: Android XML internal storage
type: Question
has comment: http://stackoverflow.com/comment/43589807
has comment: http://stackoverflow.com/comment/43588618
tagged with: open-closed-principle
has comment: http://stackoverflow.com/comment/43590045
has comment: http://stackoverflow.com/comment/43587973
has comment: http://stackoverflow.com/comment/43590447
has comment: http://stackoverflow.com/comment/43586781
has comment: http://stackoverflow.com/comment/43589090
accepted answer: http://stackoverflow.com/a/27581456
answer count: 1
has body: I am trying to save some data using XML in android to save into the devices internal storage. I want to be sure the app is written by the open/closed and single responsibility -principle. (So i could easly switch between methods of storage) -domain |---db |---|---appReader |---|---|---AppReader.java |---|---|---XMLAppReader.java |---|---appWriter |---|---|---AppWriter.java |---|---|---XMLAppWriter.java |---DBFacade.java |---DBFacadeImpl.java -MainActivity.java This is my current structure,... The problem i am facing now, is that in every tutorial about android and xml they use the function openFileOutput(filename,Context.Mode_Append) I guess this is a function from Activity superclass ? How would i have to initialise my FileOutputStream and still keep my open/closed and single responsibility principle intact ? Should i pass an Activity instance to my XMLAppWriter constructor ? Doesn't this undermine the Single responsibility principle ?
has comment: http://stackoverflow.com/comment/43591061
favorite count: 0
has comment: http://stackoverflow.com/comment/43591136
has comment: http://stackoverflow.com/comment/43589289
has comment: http://stackoverflow.com/comment/43590951
tagged with: single-responsibility-principle
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43588434
upvote count: 2
has comment: http://stackoverflow.com/comment/43588355
score: 1
tagged with: java

http://stackoverflow.com/a/27589838
score: 2
has body: You determine if it is in the first interval, and then all other intervals depends on the upper limit. So you can make it even shorter: String greeting = null; if(hours&gt;=1 &amp;&amp; hours&lt;=11){ greeting = "Good Morning"; } else if(hours&lt;=15){ greeting = "Good Afternoon"; } else if(hours&lt;=20){ greeting = "Good Evening"; } else if(hours&lt;=24){ greeting = "Good Night"; } Toast.makeText(this, greeting, Toast.LENGTH_SHORT).show();
has comment: http://stackoverflow.com/comment/43604074
has comment: http://stackoverflow.com/comment/43603971
has comment: http://stackoverflow.com/comment/43604136
answers question: http://stackoverflow.com/q/27589701
downvote count: 0
has comment: http://stackoverflow.com/comment/43604214
has comment: http://stackoverflow.com/comment/43603935
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43624231
score: 0
has text: I did what you said and it still dont work. After i click below all objects in JList, the last element is selected.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27599789

http://stackoverflow.com/comment/43512523
type: QuestionComment
comment on: http://stackoverflow.com/q/27542333
has text: But you do the same thing? you create 500 different insert statement. that's not a bulk insert
score: 0
type: Comment

http://stackoverflow.com/comment/43448643
type: QuestionComment
comment on: http://stackoverflow.com/q/27509205
score: 0
type: Comment
has text: @SemihEker i see why you have done that. although it is not a case of should they be written. i need to do them so i need a solutiob

http://stackoverflow.com/comment/43581817
has text: I had the closing brace for the if statement. I was only showing a fragment of the code I programmed myself. I'm sorry for any confusions.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27578443
type: Comment

http://stackoverflow.com/comment/43392199
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27479471
type: Comment
has text: This won't work if prefix contains digits like `k000111js22/12/2011 kjdflk`

http://stackoverflow.com/comment/43469263
type: Comment
comment on: http://stackoverflow.com/q/27519851
has text: Yes. In fact, Java has a [`Stack`](http://docs.oracle.com/javase/7/docs/api/java/util/Stack.html). What have you tried?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/43608387
type: QuestionComment
type: Comment
has text: @Gagravarr also ttried this..FileInputStream fis = new FileInputStream("D:\\msh.jpg"); imagePara.createRun().addPicture(fis, Document.PICTURE_TYPE_JPEG, "msh.jpg", 400, 129); imaheparagraphs[0]=imagePara;
score: 0
comment on: http://stackoverflow.com/q/27583478

http://stackoverflow.com/q/27482645
tagged with: spring
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/43447160
has comment: http://stackoverflow.com/comment/43397802
has comment: http://stackoverflow.com/comment/43398051
tagged with: java
has comment: http://stackoverflow.com/comment/43402557
type: Question
has title: Implement a singelton in Spring
has body: I am trying to implement a Singelton of a database I have created based on Spring injections/ This is my original class: package SingeltonDBVersion1; public class SingeltonDB { private static DBconnImpl db = null; private static SingeltonDB singalDb = null; private SingeltonDB(String username, String password) { db = new DBconnImpl(); } public synchronized static SingeltonDB getInstance(String username, String password) throws Exception { if (db != null) { return singalDb; } System.out.println("The database is now open"); singalDb = new SingeltonDB(username, password); db.connect(username, password); System.out.println("The database was connected"); return singalDb; } public void create(String tableName) throws Exception { db.create(tableName); } public User query(String tableName, int userID) throws Exception { if (db == null) { System.out.println("Error: the database is not open"); return null; } return (db.query(tableName, userID)); } public void update(String tableName, User user) throws Exception { if (db == null) { System.out.println("Error: the database is not open"); return; } db.update(tableName, user); } } When I convert it to spring I tried this way: package SingeltonDBVersion2; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SingeltonDB { private static DBconnImpl db = null; private static SingeltonDB singalDb = null; private SingeltonDB(String username, String password) { ApplicationContext db1 = new ClassPathXmlApplicationContext("spring.xml"); db = (DBconnImpl) db1.getBean("MyDBconnImpl"); } public synchronized static SingeltonDB getInstance(String username, String password) throws Exception { if (db != null) { return singalDb; } System.out.println("The database is now open"); singalDb = new SingeltonDB(username, password); db.connect(username, password); System.out.println("The database was connected"); return singalDb; } public void create(String tableName…
score: 0
has comment: http://stackoverflow.com/comment/43397983
has comment: http://stackoverflow.com/comment/43436168
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27506830
has answer: http://stackoverflow.com/a/27507128
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28022930
tagged with: playframework-2.3
tagged with: java
type: Question
answer count: 2
tagged with: playframework
accepted answer: http://stackoverflow.com/a/28022930
has title: How to bind data from request into existing object? Multiple steps form
score: 0
has body: in my method I have let's say UserDetails object which has some defined value like id, phone etc. User changing only one value through form, it's email. Is the way how I could use method userDetailsForm.bindFromRequest(new String[]{"email"}).get() to not 'loose' previous values? The above example give me new userDetail object with only defined email field. Of course I know that I can use DynamicForm class, or just userDetailsForm.bindFromRequest().get().getEmail() but it would be helpfull to have method which does all this binding in one line. =========EDIT DynamicForm dynamicForm = Form.form().bindFromRequest(); String email = dynamicForm.get("email"); isn't that what I'm looking for. =========EDIT====================================== In other words, I want to divide my form to 3 steps, but after every step I am doing update on DB. So for example when I am POSTing step2 I have object with values from previous step: User [userId=8, createdById=12, name=null, active=false, country=EN] so now when I am doing: static Form&lt;User&gt; userForm = Form.form(User.class); User user = User.find(8); User user2 = (User) userForm.fill(user).bindFromRequest("name").get(); I am geting new object with empty fields: User [userId=0, createdById=0, name="value from step 2", active=false, country=null] I will be very greatfull for any advise.
possible better answer: http://stackoverflow.com/a/27507128

http://stackoverflow.com/comment/43495096
comment on: http://stackoverflow.com/q/27533335
score: 4
type: Comment
type: QuestionComment
has text: Array indices start at 0, not 1.

http://stackoverflow.com/a/27579483
has body: Try setting the response, not the request protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setAttribute("message", "hello"); }
type: Answer
has comment: http://stackoverflow.com/comment/43583546
has comment: http://stackoverflow.com/comment/43587431
answers question: http://stackoverflow.com/q/27579458
score: 0

http://stackoverflow.com/q/27507668
linked to: http://stackoverflow.com/q/14525982
upvote count: 2
has comment: http://stackoverflow.com/comment/43445649
has answer: http://stackoverflow.com/a/27523285
type: Question
accepted answer: http://stackoverflow.com/a/27523285
tagged with: java
tagged with: post
has comment: http://stackoverflow.com/comment/43471998
score: 2
answer count: 1
has comment: http://stackoverflow.com/comment/43471639
downvote count: 0
has comment: http://stackoverflow.com/comment/43475486
favorite count: 0
tagged with: google-app-engine
has title: App engine application/json payload reading in java appengine
has comment: http://stackoverflow.com/comment/43474555
type: AnsweredQuestion
has body: How can I read the String / byte array that is the payload POSTed to a GAE java app? Is there a simple way to get those bytes without using Jackson / jersey or similar libraries? Angular side uses something like: $http({ method : 'POST', url : 'http://APPID.appspot.com/api/get-reference-locales-for', data : { 'param' : value, 'param2' : value2 }) Java side has protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { ... I expected that there would be a simple way to get the string {'param':1,'param':2} from the req object but I can seem to find it.

http://stackoverflow.com/q/27591676
type: Question
score: -1
tagged with: image
has title: Sending an image through socket as byte array in Java
upvote count: 0
has comment: http://stackoverflow.com/comment/43614782
answer count: 1
has body: I know this has been asked in a few different ways, but I've been working on this for 2 days with no avail. My code is failing in that the receiving side throws EOF exceptions constantly. Can someone point me in the right direction? Receiving side: class ReceiveThread extends Thread { ReceiveThread() { } @Override public void run() { System.out.println("Receive Thread Start"); DataInputStream in; try { } catch (Exception e) { return; } try { in = new DataInputStream(connection.getInputStream()); while (true) { if (!connection.isConnected()) { System.out.println("Connection not connected"); break; } try { int len = in.readInt(); byte[] data = new byte[len]; System.out.println("Image size: " + len); if (len &gt; 0) { in.readFully(data, 0, len); BufferedImage bi = ImageIO.read(new ByteArrayInputStream(data)); panel.updateImage(bi); panel.repaint(); } in.close(); } catch (Exception e) { } pause(100); } } catch (Exception e) { } } public void pause(long time) { try { Thread.sleep(time); } catch (Exception e) { } } } Sending side: class UpdateScreenThread extends Thread { Robot robot; public UpdateScreenThread() { try { robot = new Robot(); System.out.println("Update Thread Created"); } catch (Exception e) { } } @Override public void run() { System.out.println("Update Thread Running"); Settings.isSharing = true; Dimension screenSize; screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle screenRectangle = new Rectangle(screenSize); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out; try { out = new DataOutputStream(s.getOutputStream()); } catch (Exception e) { return; } while (s.isConnected()) { //System.out.println("test"); BufferedImage bi = robot.createScreenCapture(screenRectangle); try { ImageIO.write(bi, "PNG", baos); baos.flush(); byte[] bytes = baos.toByteArray(); out.flush(); out.writeInt(bytes.length); out.flush(); out.write(bytes); System.out.println("Image sent"); } catch (Exception e) { } pause(500); } try { out.close(…
favorite count: 0
tagged with: byte
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/27592229
tagged with: java
tagged with: stream
downvote count: 1

http://stackoverflow.com/q/27623206
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43667115
has comment: http://stackoverflow.com/comment/43666989
type: Question
has answer: http://stackoverflow.com/a/27623991
has title: Some listeners not firing
answer count: 1
downvote count: 0
favorite count: 0
tagged with: listener
accepted answer: http://stackoverflow.com/a/27623991
tagged with: android
upvote count: 1
type: AnsweredQuestion
has body: I am integrating an Android ad SDK that implements a number of listeners. Some of these listeners are not firing within my app. For example onAdLoaded will fire, but onAdDisplayed will not. This works perfectly fine in the sample app that's provided with the SDK, which leads to thinking it's an issue with integration. However, I can't find anything that's causing this snag. It's absolutely bizarre behaviour that I've never come across before. I know I'm grasping at straws over here, but hypothetically speaking what could be the causes for some listeners not registering while others are? How can I debug this? Here's some code: ad = new InterstitialAd(lastActivity, placementId); ad.setAdListener(new InterstitialAdListener() { //doesn't fire @Override public void onInterstitialDisplayed(Ad ad) { Log.e(TAG, "INTERSTITIAL DISPLAYED"); Toast.makeText(lastActivity, "onInterstitialDisplayed", Toast.LENGTH_SHORT).show(); } //doesn't fire @Override public void onInterstitialDismissed(Ad ad) { Log.e(TAG, "INTERSTITIAL DISMISSED"); Toast.makeText(lastActivity, "onInterstitialDismissed", Toast.LENGTH_SHORT).show(); } @Override public void onError(Ad ad, AdError adError) { Log.e(TAG, "ERROR! " + adError.getErrorMessage()); Toast.makeText(lastActivity, "onError", Toast.LENGTH_SHORT).show(); } @Override public void onAdLoaded(Ad ad) { Log.e(TAG, "AD LOADED!"); AdAdapter.this.ad.show(); Toast.makeText(lastActivity, "onAdLoaded", Toast.LENGTH_SHORT).show(); } //doesn't fire @Override public void onAdClicked(Ad ad) { Log.e(TAG, "AD CLICKED!"); Toast.makeText(lastActivity, "onAdClicked", Toast.LENGTH_SHORT).show(); } }); ad.loadAd();

http://stackoverflow.com/comment/43448664
score: 0
type: Comment
has text: Brilliant, thanks Dave. That's answered my question
comment on: http://stackoverflow.com/a/27509159
type: AnswerComment

http://stackoverflow.com/q/27508021
type: Question
has comment: http://stackoverflow.com/comment/43446643
has comment: http://stackoverflow.com/comment/43446248
has answer: http://stackoverflow.com/a/27508456
has title: Java overriding parent equals method
answer count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/27508456
favorite count: 0
has comment: http://stackoverflow.com/comment/43446191
type: AnsweredQuestion
has body: I have two classes Person and Teacher. In the Person class I check if the two objects passed in are equal using the compareTo method. In the Teacher class, the problem I'm working on states that I need to override the equals method in Person. In this equals method, the only way it would return true is if it's equal in both the equals method in Person and Teacher. My question is, when I check in the Teacher's equals method, do I just call super.equals(other) in order to check if the two objects are equal by the parent class or is there something else I need to do? Person: public class Person implements Comparable&lt;Person&gt; { public boolean equals(Object other) { try { return this.compareTo(other) == 0; }catch(Exception e) { return false; } } } Teacher public class Teacher extends Person { private String facultyID; @Override public boolean equals(Object other) { boolean personEquals = super.equals(other); try { Teacher teach1 = (Teacher)other; boolean idEquals = this.facultyID.equals(teach1.facultyID); if(idEquals &amp;&amp; personEquals) return true; return false; }catch(Exception e) { return false; } } }
has comment: http://stackoverflow.com/comment/43446361
has comment: http://stackoverflow.com/comment/43446409
tagged with: java
upvote count: 1

http://stackoverflow.com/a/27507564
has body: You should make your class generic to avoid warnings/errors. Maybe this small class that I wrote will help you out: import java.util.ArrayList; import java.util.List; /** * Creates a List of Lists of the given type * @param &lt;T&gt; - The type of the table elements */ public class Table &lt;T&gt; { private final List&lt;List&lt;T&gt;&gt; data; public Table(int rows, int cells) { data = new ArrayList&lt;List&lt;T&gt;&gt;(rows); for(int i=0; i&lt;rows; i++) { data.add(new ArrayList&lt;T&gt;(cells)); } } public static void main(String[] args) { //create a table of strings Table&lt;String&gt; table = new Table&lt;String&gt;(10, 10); //do something with table } } If you want the table to contain various elements, create it like that: Table&lt;Object&gt; table = new Table&lt;Object&gt;(10, 10); This should only serve to demonstrate generics, I'm not claiming this is the best way to create a table. Also, I'm skipping the implementation of other methods you will surely need (such as accessors for the table elements, etc).
type: Answer
answers question: http://stackoverflow.com/q/27507266
score: 0

http://stackoverflow.com/q/27633292
score: 0
has answer: http://stackoverflow.com/a/27633969
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43686961
has title: How can I delete exactly node in JTree?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43686396
tagged with: java
tagged with: mysql
tagged with: swing
has body: I have a tree like this: -root -grandParent1 -parent1 -child1 .... -grandParent2 -parent1 -child1 .... How can I delete exactly grandParent1-parent1-child1 in database? At first, I distinguish child name with parent, but if parent have same name is problem.
has comment: http://stackoverflow.com/comment/43686370
type: Question
tagged with: treenode
accepted answer: http://stackoverflow.com/a/27633969
tagged with: jtree

http://stackoverflow.com/a/27522850
has comment: http://stackoverflow.com/comment/52237102
has body: There are three things that you need to do to format the date as yyyy-MM-dd: Add a dependency on com.fasterxml.jackson.datatype:jackson-datatype-joda. Judging by the output you're getting at the moment, I think you may already have this dependency. Configure Jackson not to format dates as timestamps by adding spring.jackson.serialization.write-dates-as-timestamps: false to your application.properties file. Annotate the LocalDataTime field or getter method with @JsonFormat(pattern="yyyy-MM-dd") Note: You'll need to use Spring Boot 1.2 for step 2 to work.
downvote count: 2
upvote count: 40
accepted answer of: http://stackoverflow.com/q/27516499
has comment: http://stackoverflow.com/comment/72538412
answers question: http://stackoverflow.com/q/27516499
has comment: http://stackoverflow.com/comment/43550169
type: AcceptedAnswer
score: 38
type: Answer

http://stackoverflow.com/q/27529494
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/27531339
has body: I'm generating java classes from wsdl using cxf / jaxb and the configuration &lt;jaxb:globalBindings generateElementProperty="false"&gt;, which gives me the advantage to directly get the elements by getters and setters from the xml, not having to instantiate a JAXBElement explicit every time. One element I want to access is autogenrated as @XmlSeeAlso. Problem: the autogenerated class does not contain any getter for this class! How can I at all receive the properties inside there if there's no getter created?? @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Fare", propOrder = { "some", "props" }) @XmlSeeAlso({ AnySubType.class }) @Generated public class AutoGeneratedClass { //there is no getAnySubType() method! //only getters for some, props etc. } Where as: @Generated public class AnySubType extends AutoGeneratedClass {
has comment: http://stackoverflow.com/comment/43496148
has comment: http://stackoverflow.com/comment/43487895
type: AnsweredQuestion
tagged with: cxf
tagged with: java
tagged with: jaxb
type: Question
has title: How to get elements from autogenerated @XmlSeeAlso?
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43488164
has answer: http://stackoverflow.com/a/27531339
has comment: http://stackoverflow.com/comment/43488025

http://stackoverflow.com/a/27613442
downvote count: 0
answers question: http://stackoverflow.com/q/27613419
has body: Because, you didn't create a file, you created a File. File represents a virtual/abstract filename. It doesn't need to actually exist on the disk. While there is a few ways to do this, the simplest might be to use File#createNewFile, just make sure you check the return value, as it's not gurenteed to work File file = new File("textfile.txt"); System.out.println("Exists: " + f.exists()); if (!file.exists()) { if (!file.createNewFile()) { System.out.println("Sorry, could not create " + file); } else { System.out.println("Create file " + file + " successfully"); } }
has comment: http://stackoverflow.com/comment/43649067
has comment: http://stackoverflow.com/comment/43649265
has comment: http://stackoverflow.com/comment/43649436
has comment: http://stackoverflow.com/comment/43649247
has comment: http://stackoverflow.com/comment/43649234
type: Answer
has comment: http://stackoverflow.com/comment/43649135
accepted answer of: http://stackoverflow.com/q/27613419
score: 5
has comment: http://stackoverflow.com/comment/43649466
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/q/27475827
has comment: http://stackoverflow.com/comment/43386328
score: 0
tagged with: android
has body: I'm working on an app for root users, that frequently reads system files in /sys/devices/system/cpu... I have two main questions, i'm using RandomAccessFile to read, then call seek(0) and leave the stream open for the next call. Is RandomAccessFile the correct class to use for this? or is there something better? question 2, I have 8 instances of RandomAccessFile opened to read files in a seperate thread (for quad core device, 4 for cpuN/online to tell if core is online, then 1 for each cpuN/cpufreq/scaling_cur_freq = 8). These files are read every 1000 ms, so I figured leaving them open is better than opening and closing 8 file streams every second. Is this bad practice or bad for memory hogging?
has comment: http://stackoverflow.com/comment/43386026
answer count: 0
type: UnansweredQuestion
tagged with: file
tagged with: performance
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43386363
has title: Android/java bad practice to leave multiple file streams open?

http://stackoverflow.com/comment/43582422
type: Comment
comment on: http://stackoverflow.com/q/27578503
score: 1
has text: possible duplicate of [Getting Conflicting URI templates errors when trying to add resource class](http://stackoverflow.com/questions/12065001/getting-conflicting-uri-templates-errors-when-trying-to-add-resource-class)
type: QuestionComment

http://stackoverflow.com/a/27568094
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27566949
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27566949
has body: You need the Eclipse Gradle tooling, which adds lots of Gradle-related functionality. Most importantly, it manages your Eclipse project build path to match the build.gradle dependencies.

http://stackoverflow.com/comment/43677709
type: AnswerComment
has text: @TheDDestroyer12, you would override the Display class, since this is the class that contains the custom code and therefore knows what the proper size of the component should be.
comment on: http://stackoverflow.com/a/27624647
type: Comment
score: 0

http://stackoverflow.com/q/27505713
tagged with: android
accepted answer: http://stackoverflow.com/a/27506339
upvote count: 0
has comment: http://stackoverflow.com/comment/43441529
has answer: http://stackoverflow.com/a/27506339
downvote count: 1
linked to: http://stackoverflow.com/q/16509969
type: AnsweredQuestion
has title: Media player not working properly
tagged with: java
score: -1
type: Question
has body: I am making and app in which you press buttons to play sounds.It seems to work at first but after the 5-6 press it stops playing sounds. Here is my code public class MainActivity extends ActionBarActivity { private ImageButton pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9, pad10, pad11, pad12; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pad1 = (ImageButton) findViewById(R.id.pad1); pad2 = (ImageButton) findViewById(R.id.pad2); pad3 = (ImageButton) findViewById(R.id.pad3); pad4 = (ImageButton) findViewById(R.id.pad4); pad5 = (ImageButton) findViewById(R.id.pad5); pad6 = (ImageButton) findViewById(R.id.pad6); pad7 = (ImageButton) findViewById(R.id.pad7); pad8 = (ImageButton) findViewById(R.id.pad8); pad9 = (ImageButton) findViewById(R.id.pad9); pad10 = (ImageButton) findViewById(R.id.pad10); pad11 = (ImageButton) findViewById(R.id.pad11); pad12 = (ImageButton) findViewById(R.id.pad12); } @Override public boolean onCreateOptionsMenu(Menu menu) { return true; } public void onPad1Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p1); mp.start(); } public void onPad2Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p2); mp.start(); } public void onPad3Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p3); mp.start(); } public void onPad4Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p4); mp.start(); } public void onPad5Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p5); mp.start(); } public void onPad6Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p6); mp.start(); } public void onPad7Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p7); mp.start(); } public void onPad8Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p8); mp.start(); } public void onPad9Click(View view) { MediaPlayer mp = MediaPlayer.create(this, R.raw.p9); mp.s…
answer count: 1
has comment: http://stackoverflow.com/comment/43442316
favorite count: 0

http://stackoverflow.com/a/27575380
type: Answer
answers question: http://stackoverflow.com/q/27495570
upvote count: 5
score: 5
downvote count: 0
has body: Even if they are in the same package, you can't use EditNameDialogListener directly as it's an inner interface. You have 2 choices here : -> Use EditNameDialogListener fully qualified name, i.e AddFriendDialogFragment.EditNameDialogListener public class HomeActivity extends Activity implements AddFriendDialogFragment.EditNameDialogListener -> Import explicitly EditNameDialogListener import tutorial.com.example.jerryhou.dialogactionbartutorial.AddFriendDialogFragment.EditNameDialogListener public class HomeActivity extends Activity implements EditNameDialogListener

http://stackoverflow.com/comment/43526803
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27549969
type: QuestionComment
has text: @mbomb007 There are no exceptions, just seemingly random unexpected results. Will edit and post entire class, give me a second

http://stackoverflow.com/comment/43583043
type: Comment
type: QuestionComment
has text: @BoristheSpider What if the marked objects was statying at `S0`, and the survivors were moved from `Eden` to `S0`, what would we lose in that case?
score: 0
comment on: http://stackoverflow.com/q/27579185

http://stackoverflow.com/comment/43478735
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27523290
has text: @GPRathour that is a nice bit of trivia, but it is of course incredibly poor to have such connection details hardcoded to begin with.
type: Comment

http://stackoverflow.com/comment/43696858
type: Comment
type: QuestionComment
has text: With your current example, that is not the output I get for `path`.
score: 0
comment on: http://stackoverflow.com/q/27638981

http://stackoverflow.com/a/27569797
has body: Create a list and keep adding the numbers into List. You should do something like: List&lt;Integer&gt; numberList = new ArrayList&lt;Integer&gt;(); do { str = br.readLine(); int number = Integer.parseInt(str); } while(number != 0); And then use for loop to do count like: int negativeNumberSum = 0; int positiveNumberSum = 0; int positiveNumberCounts = 0; for (int i =0; i&lt;numberList.size(); i++) { if (numberList.get(i) &gt;= 0) { positiveNumberSum += numberList.get(i); positiveNumberCounts ++; } else { negativeNumberSum += numberList.get(i); } } //print average of positive as positiveNumberSum /(double) positiveNumberCounts if positiveNumberCounts != 0 //print average of positive as negativeNumberSum / (double)(numberList.size() - positiveNumberCounts) same if (numberList.size() - positiveNumberCounts) != 0 //print positive count as positiveNumberSum and same for negative. //
answers question: http://stackoverflow.com/q/27569655
score: 0
type: Answer

http://stackoverflow.com/q/27572594
score: 0
possible better answer: http://stackoverflow.com/a/27572654
has title: Java 8: Reflection Field.get() try-catch error
has answer: http://stackoverflow.com/a/27572674
accepted answer: http://stackoverflow.com/a/27572674
has answer: http://stackoverflow.com/a/27572654
tagged with: java-8
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has body: Issue I am receiving an error in Eclipse stating that I have an unhandled exception with my call to Field.get(Object). When I wrap the code in the recommended try-catch, the error persists. I assume that I have to wrap the parameter, in the get() method, with a try-catch. Is this possible? Error Unhandled exception type IllegalAccessException Line in question: return list.stream().map(e -&gt; fieldType.cast(f.get(e))).collect(Collectors.toList()); Code Main.java import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { List&lt;Entity&gt; entities = Arrays.asList( new Item(0, "Apple"), new Item(1, "Banana"), new Item(2, "Grape"), new Item(3, "Orange") ); List&lt;Long&gt; ids = null; try { ids = pluck("id", Long.class, entities, Entity.class, true); } catch (Exception e) { e.printStackTrace(); } System.out.println(ids); } public static &lt;E extends Entity&gt; List&lt;Long&gt; pluckIds(List&lt;E&gt; list) { return list.stream().map(e -&gt; e.getId()).collect(Collectors.toList()); } public static &lt;T,F&gt; List&lt;F&gt; pluck(String fieldName, Class&lt;F&gt; fieldType, List&lt;T&gt; list, Class&lt;T&gt; listType, boolean useLambda) throws NoSuchFieldException, IllegalAccessException, IllegalArgumentException { Field f = listType.getDeclaredField(fieldName); f.setAccessible(true); if (useLambda) { return list.stream().map(e -&gt; fieldType.cast(f.get(e))).collect(Collectors.toList()); } else { List&lt;F&gt; result = new ArrayList&lt;F&gt;(); for (T element : list) { result.add(fieldType.cast(f.get(element))); } return result; } } } Item.java public class Item extends Entity { private String name; public Item(long id, String name) { super(id); this.setName(name); } public String getName() { return name; } public void setName(String name) { this.name = name; } } Entity.java public abstract class Entity { private long id; publ…
type: Question
tagged with: try-catch
answer count: 2

http://stackoverflow.com/a/27623977
answers question: http://stackoverflow.com/q/27623815
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: User agent isn't a C# or Java thing. Its a string that is sent along with a web request that identifies the machine, OS and browser of the originating requester. This is a web standards thing, not a programming thing. If you are trying to duplicate that Java code into C#, what you are probably looking for is the HttpWebRequest and HttpWebResponse classes. You can set the user agent of the HttpWebRequest using the UserAgent property. Your Java code will look like this in C#: using System; using System.Net; using System.IO; using System.Text; public class Program { public static void Main() { string data = ""; string s = "http://www.example.com"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(s); request.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30\""; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { if (response.StatusCode == HttpStatusCode.OK) { using (Stream receiveStream = response.GetResponseStream()) { using (StreamReader readStream = new StreamReader(receiveStream)) { data = readStream.ReadToEnd(); } } } } Console.WriteLine(data); } }

http://stackoverflow.com/comment/43467301
type: AnswerComment
comment on: http://stackoverflow.com/a/27518605
type: Comment
has text: Okay, what part of your original question asked for that? No offense, we're not your code monkeys...
score: 3

http://stackoverflow.com/comment/43448028
comment on: http://stackoverflow.com/q/27508854
score: 0
type: QuestionComment
has text: [see this](http://opensourceforgeeks.blogspot.in/2014/07/how-to-permanently-set-path-on-linux.html) might help.
type: Comment

http://stackoverflow.com/comment/43577313
comment on: http://stackoverflow.com/q/27575878
type: Comment
type: QuestionComment
has text: Wait, you were correct! Blend had been deactivated for this render region. Please submit your comment as an answer!
score: 0

http://stackoverflow.com/q/27537064
tagged with: java
tagged with: jaxb
linked to: http://stackoverflow.com/q/18308043
has comment: http://stackoverflow.com/comment/43502457
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/62411650
accepted answer: http://stackoverflow.com/a/27545616
has comment: http://stackoverflow.com/comment/43503325
answer count: 1
has answer: http://stackoverflow.com/a/27545616
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: xsd enumeration start with number underscore
has body: using jaxb to generate java POJO sources from xsd definition. while defining simpleType:String, enumeration, if the value starts with an underscore or a number, the corresponding Enum class is not generated. how can i use a pattern or setting to allow generation of such enums. &lt;xsd:simpleType name="TrailerType"&gt; &lt;xsd:restriction base="xsd:string"&gt; &lt;xsd:enumeration value="_20FT"/&gt; &lt;xsd:enumeration value="OTHR"/&gt; &lt;/xsd:restriction&gt; to make this work i had to add a manual explicit binding as &lt;jxb:bindings schemaLocation="common/v1/CommonTypes.xsd" node="//xs:simpleType[@name='TrailerType']/xs:restriction/xs:enumeration[@value='_20FT']"&gt; &lt;jxb:typesafeEnumMember name="_20FT"/&gt; &lt;/jxb:bindings&gt; now this works and enum with value _20FT is generated, but if i have many such enums, i will need to add many explicit bindings. am sure there is a simpler more generic way to handle such enum names. please help.
tagged with: xsd
has comment: http://stackoverflow.com/comment/43507235
type: AnsweredQuestion
score: 2
tagged with: enums
has comment: http://stackoverflow.com/comment/43502828
downvote count: 0

http://stackoverflow.com/comment/43604057
comment on: http://stackoverflow.com/a/27589658
score: 1
type: AnswerComment
type: Comment
has text: @gstackoverflow If Arrays.sort required an argument whose type is a functional interface with a method whose signature is `Integer methodName (InstanceMethodClass a ,String b, String c)`, your instance `testStr` would be a match.

http://stackoverflow.com/comment/43535043
type: AnswerComment
has text: I don't know Java, but `.get(3)` looks strange since there are only three elements in your array.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27553905

http://stackoverflow.com/comment/73857272
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27544050
type: Comment
has text: Answer doesn't explain value and type of `parser` and is useless without that information.

http://stackoverflow.com/a/27479231
type: AcceptedAnswer
upvote count: 23
has comment: http://stackoverflow.com/comment/43392280
has comment: http://stackoverflow.com/comment/44872393
has body: SpannableString is not String directly. so, you can not cast. but, it can be converted to string. you can convert something to string with concatenating with empty string. pasteData = "" + item.getText();
type: Answer
score: 21
accepted answer of: http://stackoverflow.com/q/27479181
answers question: http://stackoverflow.com/q/27479181
downvote count: 2

http://stackoverflow.com/q/27626221
tagged with: indexof
tagged with: java
tagged with: substring
has answer: http://stackoverflow.com/a/27626329
possible better answer: http://stackoverflow.com/a/27626320
has answer: http://stackoverflow.com/a/27626319
has answer: http://stackoverflow.com/a/27626368
has answer: http://stackoverflow.com/a/27626320
downvote count: 0
tagged with: string
score: 1
has title: How do you rebuild a string using StringBuilder?
favorite count: 0
has body: Im trying to rebuild a string using StringBuilder. I'm a little unsure of which method to use to get the "'," inserted back into the same place. In the code below I'm using the "insert(int dstOffset, CharSequence s, int start, int end)" method. My code doesn't contain any errors however it doesn't run properly. Please note I will also be escaping characters (i.e., =) in the string but I havent written that part of the code yet. Currently I'm trying to learn how to split the string and then rebuild it. Thanks public class StringTestProgram { public static void main(String[] args) { String relativeDN = "cn=abc,dn=xyz,ou=abc/def"; String[] stringData = relativeDN.split(","); for (String stringoutput : stringData) { System.out.print(stringoutput); StringBuilder sb = new StringBuilder(stringoutput); CharSequence charAdded = ","; sb.insert(6,charAdded,0,12); System.out.print(sb.toString()); } } } Revised code public class StringTestProgram { public static void main(String[] args) { String relativeDN = "cn=abc,dn=xyz,ou=abc/def"; System.out.println(relativeDN); //Split String String[] stringData = relativeDN.split(","); { StringBuilder sb = new StringBuilder(); CharSequence charAdded = ","; // loop thru each element of the array for (int place = 0; place &lt; stringData.length; place++) { System.out.println(stringData[place]); { int eq = relativeDN.indexOf('='); String sub = relativeDN.substring(0, eq); System.out.println(sub); } // append element to the StringBuilder sb.append(stringData[place]); // avoids adding an extra ',' at the end if (place &lt; stringData.length - 1) // if not at the last element, add the ',' character sb.append(charAdded); } System.out.print(sb.toString()); } } } Im new to stackoverflow and I'm not sure if its ok to ask this question in this thread or if I should create a seperate thread for this question. If possible please advise. The code above now splits the string at the "," character. It also rebuilds the string back to its original state. I…
answer count: 5
has comment: http://stackoverflow.com/comment/43674421
has answer: http://stackoverflow.com/a/27626406
type: AnsweredQuestion
upvote count: 1
type: Question
tagged with: stringbuilder
accepted answer: http://stackoverflow.com/a/27626406

http://stackoverflow.com/comment/43643187
comment on: http://stackoverflow.com/q/27610366
score: 0
type: Comment
type: QuestionComment
has text: Please, add some code, so we could better understand your problem.

for-loop
tags question: http://stackoverflow.com/q/27558605
tags question: http://stackoverflow.com/q/27607421
tags question: http://stackoverflow.com/q/27612302
tags question: http://stackoverflow.com/q/27530383
tags question: http://stackoverflow.com/q/27535132
tags question: http://stackoverflow.com/q/27517803
tags question: http://stackoverflow.com/q/27625388
tags question: http://stackoverflow.com/q/27634409
tags question: http://stackoverflow.com/q/27498021
tag name: for-loop
tags question: http://stackoverflow.com/q/27632511
tags question: http://stackoverflow.com/q/27516929
tags question: http://stackoverflow.com/q/27513288
tags question: http://stackoverflow.com/q/27503872
tags question: http://stackoverflow.com/q/27629394
tags question: http://stackoverflow.com/q/27599674
tags question: http://stackoverflow.com/q/27582743
tags question: http://stackoverflow.com/q/27537899
type: Tag
tags question: http://stackoverflow.com/q/27570061
tags question: http://stackoverflow.com/q/27555796
tags question: http://stackoverflow.com/q/27494132
tags question: http://stackoverflow.com/q/27482662
tags question: http://stackoverflow.com/q/27587309

http://stackoverflow.com/a/27540272
has body: Don't use URL for that. And don't use File. This is 2014, we have java.nio.file. Use this instead, it will give an immediate, correct result: final URL url = Paths.get(home, "dict").toUri().toURL(); The scheme associated with the default filesystem is always file. Also, why a URL and not a URI? And note that your code wouldn't work on Windows (you can't have a backslash in the path component of a URI). edit: it also appears that the manual you use gets many things wrong; for one, it assumes a Unix system! And one problem you have is that the WNHOME environment variable is not set on your system; as a result, you get a path which is your current directory, plus null, plus "dict". Change your code to this: final String wnhome = System.getenv("WNHOME"); if (wnhome == null) throw new IllegalStateException("WNHOME environment variable is not set"); final URL url = Paths.get(wnhome, dict).toUri().toURL(); Normally you will see an exception... It is up to you to set the WNHOME environment variable here.
has comment: http://stackoverflow.com/comment/43509026
has comment: http://stackoverflow.com/comment/43509074
has comment: http://stackoverflow.com/comment/43509151
has comment: http://stackoverflow.com/comment/43509625
type: Answer
has comment: http://stackoverflow.com/comment/43509727
has comment: http://stackoverflow.com/comment/43509778
has comment: http://stackoverflow.com/comment/43509229
upvote count: 1
answers question: http://stackoverflow.com/q/27540090
score: 1
has comment: http://stackoverflow.com/comment/43547302
downvote count: 0
has comment: http://stackoverflow.com/comment/43509284

http://stackoverflow.com/comment/43565969
comment on: http://stackoverflow.com/q/27569874
score: 0
type: Comment
type: QuestionComment
has text: So a sensible alternative would be `knockOneDownAndNextRound()` ? Assuming the round only ever advances (and must always advance) when a bottle is knocked.

http://stackoverflow.com/q/27551247
tagged with: java
has answer: http://stackoverflow.com/a/27551295
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/43528754
answer count: 2
accepted answer: http://stackoverflow.com/a/27551295
tagged with: jdbc
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43537171
upvote count: 2
tagged with: resultset
possible better answer: http://stackoverflow.com/a/27551557
has title: alternative to jdbc resultset rs.next()
has comment: http://stackoverflow.com/comment/43528644
has answer: http://stackoverflow.com/a/27551557
type: AnsweredQuestion
score: 2
has body: I have a first resultset within which I have to iterate through userids and for each userid, I have to perform several select count(*)'s all of which return single valued outputs. If you haven't understood what I said, please follow the pseudo code below: ResultSet rs = stmt.executeQuery("select userid from tablename"); while(rs.next()){ String userid = rs.getString("userId"); ResultSet rs1 = stmt.executeQuery("select count(*) as cnt1 from xxx.... where userId = "+userId); if(rs1.next()) String count1 = rs1.getString("cnt1"); rs1.close(); ResultSet rs2 = stmt.executeQuery("select count(*) as cnt2..."); if(rs2.next()) String count2 = rs2.getString("cnt2"); rs2.close(); .... rs10.close(); Since this is inefficient, I was hoping to get past Resultset each time by writing some sort of direct query to retrieve each different count like String cnt1 = stmt.executeQuery("select count(*) as noE from useractiontable where curr_action='edit'" + " and userId = " + userId).getString("noE"); I know something like this cannot be done without using rs.next() each time. Is prepare statement the way to go? Is there another way? Appreciate any pointers in this regard.

http://stackoverflow.com/comment/43502840
type: Comment
has text: It has to do with the fact that the labels and the fields panels are been given half of the available space each for the container they are in, which is EXACTLY how `GridLayout` works...
type: AnswerComment
comment on: http://stackoverflow.com/a/27537143
score: 0

http://stackoverflow.com/a/27584100
downvote count: 0
has comment: http://stackoverflow.com/comment/43593781
has body: In initializeVariables() you are using getActivity().findViewById(R.id.foo) instead of using the Fragment's root view, that's probably the reason that you don't get a matching case in the switch statement. Try: getView().findViewById(R.id.foo);
type: Answer
has comment: http://stackoverflow.com/comment/43592730
upvote count: 1
answers question: http://stackoverflow.com/q/27584029
score: 1
accepted answer of: http://stackoverflow.com/q/27584029
type: AcceptedAnswer

http://stackoverflow.com/a/47072945
downvote count: 1
has comment: http://stackoverflow.com/comment/81101613
has comment: http://stackoverflow.com/comment/81098148
has body: https://gist.github.com/mreynolds/603526 public String convertResultSetToJson(ResultSet resultSet) throws SQLException { Joiner commaJoiner = Joiner.on(", \n"); StringBuilder builder = new StringBuilder(); builder.append("{ \"results\": [ "); List&lt;String&gt; results = new ArrayList&lt;String&gt;(); while (resultSet.next()) { List&lt;String&gt; resultBits = new ArrayList&lt;String&gt;(); ResultSetMetaData metaData = resultSet.getMetaData(); for (int i = 1; i &lt;= metaData.getColumnCount(); i++) { StringBuilder resultBit = new StringBuilder(); String columnName = metaData.getColumnName(i); resultBit.append("\"").append(columnName).append("\": \"").append(resultSet.getString(i)).append("\""); resultBits.add(resultBit.toString()); } results.add(" { " + commaJoiner.join(resultBits) + " } "); } builder.append(commaJoiner.join(results)); builder.append("] }"); return builder.toString(); }
upvote count: 3
answers question: http://stackoverflow.com/q/27593175
type: Answer
has comment: http://stackoverflow.com/comment/96145681
score: 2

http://stackoverflow.com/comment/43466982
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27518544
has text: @JigarJoshi Its running with mvn exec:java -Dexec.mainClass="com.test.Test", but I want to VM arguments but not by MAVEN_OPTS

http://stackoverflow.com/comment/43664779
comment on: http://stackoverflow.com/q/27622064
score: 0
type: Comment
type: QuestionComment
has text: Can you explain _But it's not what I want right now._? If it's the right tool for the job...

http://stackoverflow.com/a/27537081
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27523186
downvote count: 0
has body: Unfortunately Class really can not express generic types; so if your value type is generic (like Set&lt;String&gt;), you need to pass JavaType instead. And that can be used to construct structured JavaType instances as well.
type: Answer

http://stackoverflow.com/a/27632763
type: Answer
answers question: http://stackoverflow.com/q/27632076
upvote count: 5
has body: You can store your HashMap in your Database by converting it into String using Gson library. This library will convert your object to String and you will get back that object whenever you want it. Link to Download Lib : https://code.google.com/p/google-gson/ Convert Object into String : Gson objGson= new Gson(); String strObject = objGson.toJson(myMarkersHash); Bundle bundle = new Bundle(); bundle.putString("key", strObject); Convert String into Object : Gson gson = new Gson(); Type type = new TypeToken&lt;Model&gt;() {}.getType(); myMarkersHash = gson.fromJson(bundle.getString("key"), type); Check this example as well : http://www.java2blog.com/2013/11/gson-example-read-and-write-json.html
score: 5
downvote count: 0

http://stackoverflow.com/a/27585742
has comment: http://stackoverflow.com/comment/43601336
score: 0
has body: You may have a problem here: tym = (byte) ((tc &amp; 0xC0) &gt;&gt; 6); If tc (which is a byte) is 1100 0100, the mask will give 1100 0000 and right shifting by 6 using the &gt;&gt; operator will give... 1111 1111! Not sure whether this is what you really mean. If what you wanted is 0000 0011 then you must use &gt;&gt;&gt;. The &gt;&gt; operator carries the sign bit.
answers question: http://stackoverflow.com/q/27585433
type: Answer

http://stackoverflow.com/q/27589444
tagged with: plugins
has body: i am trying to build a pentaho DI plugin in Eclipse. I have imported all the necessary jar files into the library. But while coding it, i was facing this error: The type org.pentaho.metastore.api.IMetaStore cannot be resolved. It is indirectly referenced from required .class files I got some reference stuff like : http://forums.pentaho.com/showthread.php?142513-What-s-best-way-to-get-nightly-containing-http-jira-pentaho-com-browse-PDI-6169 http://wiki.pentaho.com/display/COM/The+Pentaho+Metastore But i am not able to clearly understand this issue. Do i need to import some different jar ?? Please kindly help me in this !!! Pentaho DI Version : 5.0.0 - GA OS : 64 Bit Windows
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27604565
tagged with: java
tagged with: eclipse
type: Question
tagged with: pentaho
has title: The type org.pentaho.metastore.api.IMetaStore cannot be resolved
tagged with: kettle
accepted answer: http://stackoverflow.com/a/27604565
score: 0
answer count: 1

http://stackoverflow.com/comment/43528580
type: Comment
has text: I need clarification. You want to "deploy", you mean create a .war file? by having `maven-war-plugin` and `gwt-maven-plugin`, what you mean? You mean that the output from the `gwt-maven-plugin` is not packed by the `maven-war-plugin`? Are you using Eclipse environment with m2e-wtp plugin? I'd run the war and use a ant task (within the maven build) to copy the war to the `/deployments` folder. But I'm confused, your war is being properly packed and you just want it copied to the specific folder or you're also having troubles to compile the GWT application and pack it with the war?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27550399

http://stackoverflow.com/q/27575686
score: 1
has answer: http://stackoverflow.com/a/27576107
has answer: http://stackoverflow.com/a/27577428
favorite count: 0
has comment: http://stackoverflow.com/comment/43577165
type: UnansweredQuestion
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/27576132
has comment: http://stackoverflow.com/comment/43577235
has comment: http://stackoverflow.com/comment/43576998
tagged with: java
has comment: http://stackoverflow.com/comment/43577167
type: Question
downvote count: 0
has title: Android ClassNotFoundException for main activity
tagged with: main-activity
has body: I can't get my app to launch because it can't find my MainActivity, even though I have the proper .java file and I declared in my manifest, as you can see below: &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"&gt; &lt;activity android:name="com.rakeshdas.smsblocker.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; EDIT The logcat is below and it says that it cannot find the class MainActivity: --------- beginning of crash 12-19 19:43:01.184 931-931/com.rakeshdas.smsblocker E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.rakeshdas.smsblocker, PID: 931 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.rakeshdas.smsblocker/com.rakeshdas.smsblocker.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.rakeshdas.smsblocker.MainActivity" on path: DexPathList[[zip file "/data/app/com.rakeshdas.smsblocker-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) at android.app.ActivityThread.access$800(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.rakeshdas.smsblocker.M…
answer count: 3
tagged with: classnotfoundexception

http://stackoverflow.com/q/27553994
has comment: http://stackoverflow.com/comment/43534871
has title: Is there a way to make two classes to use the same generic?
favorite count: 0
has body: This code is illegal because Bar cannot use the generic T since it belongs to Foo, and Bar is static. :( public interface Foo&lt;T&gt; { public interface Bar { public void bar(T t); } void foo(T t, Bar bar); } My question is, is there a reasonable workaround to this problem? I really need Foo and Bar to use the same generic type since Bar is a listener class for Foo and needs to return the same type. Of course I could use two generics (e.g. Bar&lt;P&gt;) and always assign the same type to T and P, but that is funky and error prone. Is there a cleaner solution?
possible better answer: http://stackoverflow.com/a/27554157
tagged with: static
has answer: http://stackoverflow.com/a/27554266
answer count: 3
has comment: http://stackoverflow.com/comment/43534288
has comment: http://stackoverflow.com/comment/43534280
tagged with: generics
score: 2
type: AnsweredQuestion
tagged with: inner-classes
upvote count: 2
has comment: http://stackoverflow.com/comment/43534658
has answer: http://stackoverflow.com/a/27554143
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27554157
has comment: http://stackoverflow.com/comment/43534557
accepted answer: http://stackoverflow.com/a/27554143
downvote count: 0

http://stackoverflow.com/a/27589769
type: AcceptedAnswer
downvote count: 0
has body: You should be doing something like: Calendar c = Calendar.getInstance(); int timeOfDay = c.get(Calendar.HOUR_OF_DAY); if(timeOfDay &gt;= 0 &amp;&amp; timeOfDay &lt; 12){ Toast.makeText(this, "Good Morning", Toast.LENGTH_SHORT).show(); }else if(timeOfDay &gt;= 12 &amp;&amp; timeOfDay &lt; 16){ Toast.makeText(this, "Good Afternoon", Toast.LENGTH_SHORT).show(); }else if(timeOfDay &gt;= 16 &amp;&amp; timeOfDay &lt; 21){ Toast.makeText(this, "Good Evening", Toast.LENGTH_SHORT).show(); }else if(timeOfDay &gt;= 21 &amp;&amp; timeOfDay &lt; 24){ Toast.makeText(this, "Good Night", Toast.LENGTH_SHORT).show(); }
type: Answer
has comment: http://stackoverflow.com/comment/99689965
accepted answer of: http://stackoverflow.com/q/27589701
answers question: http://stackoverflow.com/q/27589701
has comment: http://stackoverflow.com/comment/74945709
has comment: http://stackoverflow.com/comment/43608812
score: 106
has comment: http://stackoverflow.com/comment/77982602
upvote count: 106

http://stackoverflow.com/comment/43581138
type: Comment
comment on: http://stackoverflow.com/q/27578050
type: QuestionComment
has text: @overexchange: Then you have to be more specific as to what directories you are accessing. Accessing the root directory is different from accessing a user directory, is different from accessing a temporary directory, etc.
score: 0

http://stackoverflow.com/a/27483473
answers question: http://stackoverflow.com/q/27483321
type: Answer
has body: SharedPreferences supports a set of strings but that does not solve your problem. If you need to store custom objects you could serialize them to a string and deserialize them again. But that does not work with your context variable - which I would not store anyway because it is by design temporary. What you can also do is to have your class implement serializable, write it to a file and then store the path to that file in your preferences.
score: 0

http://stackoverflow.com/comment/43468759
score: 1
has text: If I do not include serverSocket.close() in the server-side code and want to kill the process explicitly from outside, how do I do it in Eclipse IDE? If I select the tab, that contains the code for server-side code, it does not show that the code is still running, although it is. Please can you tell me how to stop the server-side program from running explicitly.
type: AnswerComment
comment on: http://stackoverflow.com/a/27499563
type: Comment

http://stackoverflow.com/comment/43653707
score: 1
has text: You didn't set the charset of the page. No DOCTYPE, no head tag, no meta tag?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27616123

http://stackoverflow.com/comment/43644587
type: Comment
has text: Oh, I've missed mat[i] = rowDiv(mat[i], mat[i][i]);.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27583193

http://stackoverflow.com/comment/43567929
comment on: http://stackoverflow.com/a/27570939
type: Comment
has text: @JimEvans thought it is a direct descendant of a `tr` please correct me what I am missing something.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43442613
type: Comment
has text: If we use session id for track each client,will session terminate automatically after some time ?
comment on: http://stackoverflow.com/a/27485650
score: 0
type: AnswerComment

http://stackoverflow.com/a/27478651
answers question: http://stackoverflow.com/q/27478559
has comment: http://stackoverflow.com/comment/43390923
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27478559
score: 3
has comment: http://stackoverflow.com/comment/43390828
has body: Try this: int startSelection=et.getSelectionStart(); int endSelection=et.getSelectionEnd(); String selectedText = et.getText().substring(startSelection, endSelection); See this question: Android - get selection of text from EditText
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/43528074
has text: The code should be ok, either you didn't register your function properly, or something is missing from jsp page. Check out [this simple tutorial](http://www.noppanit.com/how-to-create-a-custom-function-for-jstl/) and try to find what's missing.
type: Comment
comment on: http://stackoverflow.com/a/27550594
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43687017
comment on: http://stackoverflow.com/q/27621183
score: 0
type: QuestionComment
type: Comment
has text: @greg-449 Just compared the code, In 3.x hideView method was called in workbenchpage on view close but in Compat application HidePart method of PartServiceImpl is getting called instead of WorkBenchPage hidePart. This is the reason in my openion isSaveOnCloseNeeded() method is not getting called in my views. Am i doing anything wrong here?

http://stackoverflow.com/q/27544145
score: 4
tagged with: xamarin-studio
tagged with: c#
type: AnsweredQuestion
has body: I am trying to receive SMS in my app. I've got a BroadcastReceiver class in my project and I am receiving a runtime error: System.InvalidCastException: Cannot cast from source type to destination type. at at (wrapper castclass) object._castclass_with_cache (object,intptr,intptr) <IL 0x0002c, 0x00080> at at Android.Runtime.JNIEnv.CopyArray<Java.Lang.Object> (intptr,Java.Lang.Object[]) <0x002a3> at at Android.Runtime.JNIEnv.GetArray<Java.Lang.Object> (intptr) <0x0021f> at Messages.SMSBroadcastReceiver.OnReceive (Android.Content.Context,Android.Content.Intent) [0x0005f] in c:\Users\Jase\Documents\Projects\Messages\Messages\SMSBroadcastReceiver.cs:36 at Android.Content.BroadcastReceiver.n_OnReceive_Landroid_content_Context_Landroid_content_Intent (intptr,intptr,intptr,intptr) [0x00019] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Content.BroadcastReceiver.cs:334 at at (wrapper dynamic-method) object.145a0c82-0de6-4c2c-90a0-3654436a06c3 (intptr,intptr,intptr,intptr) <IL 0x0001d, 0x0004b> Here's the code that I'm using: using System; using System.Text; using Android.App; using Android.OS; using Android.Content; using Android.Runtime; using Android.Util; using Android.Widget; using Android.Telephony; using Environment = System.Environment; namespace Messages { [BroadcastReceiver(Enabled = true, Label = "SMS Receiver")] [IntentFilter(new[] { "android.provider.Telephony.SMS_RECEIVED" })] public class SMSBroadcastReceiver : BroadcastReceiver { private const string Tag = "SMSBroadcastReceiver"; private const string IntentAction = "android.provider.Telephony.SMS_RECEIVED"; public override void OnReceive(Context context, Intent intent) { Log.Info(Tag, "Intent: " + intent.Action); if (intent.Action != IntentAction) return; var bundle = intent.Extras; if (bundle == null) return; var pdus = bundle.Get("pdus"); // ********** This is the error line at runtime **************** v…
accepted answer: http://stackoverflow.com/a/27896081
tagged with: java
tagged with: xamarin.android
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/44177384
possible better answer: http://stackoverflow.com/a/28233553
downvote count: 0
has answer: http://stackoverflow.com/a/28233553
has title: Cannot cast from source type to destination type (JNIEnv.GetArray<Java.Lang.Object>(pudis.Handle);)
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/27896081
has answer: http://stackoverflow.com/a/29370983
favorite count: 0

http://stackoverflow.com/q/27537703
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27538217
has body: i'm trying to create stand-alone webserver to programmatically search torrent file (ex. from torrentz.eu) and put on download. I'm totally getting mad by download single torrent file, it seems server response is different using browser or java. this is the script: connection = (HttpURLConnection)url.openConnection(); connection.setRequestProperty("Cookie", cookies); System.setProperty("http.agent", ""); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); connection.setRequestMethod("GET"); connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); connection.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); connection.setRequestProperty("Connection", "keep-alive"); connection.setRequestProperty("Content-Language", "en-US"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setConnectTimeout(22000); connection.setReadTimeout(12000); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); connection.connect(); respCode = connection.getResponseCode(); if(respCode != 200){ // do something.. return false; } ByteArrayOutputStream list = new ByteArrayOutputStream(); stream = connection.getInputStream(); byte[] buffer = new byte[512]; int c; while ((c = stream.read(buffer)) != -1) { if(c &gt; 0){ list.write(buffer, 0, c); } } list.flush(); stream.close(); this code is good for html, image file, ecc.. but it's impossible to get .torrent files, they are corrupted: example: UBUNTU torrent, https://torcache.net/torrent/B415C913643E5FF49FE37D304BBB5E6E11AD5101/[katproxy.com]ubuntu.14.10.desktop.64bit.iso.torrent size of .torrent file downloaded by browser: 44920 byte size of .torrent file downloaded by java: 44795 byte 135 byte are missing! just why??
has comment: http://stackoverflow.com/comment/43503996
type: Question
downvote count: 0
tagged with: url
has title: HTTPUrlConnection and .torrent file
answer count: 1
tagged with: httpurlconnection
has answer: http://stackoverflow.com/a/27538217
favorite count: 0
tagged with: download
upvote count: 1
tagged with: http

http://stackoverflow.com/a/27552069
upvote count: 26
type: AcceptedAnswer
downvote count: 1
type: Answer
score: 25
has comment: http://stackoverflow.com/comment/71070494
accepted answer of: http://stackoverflow.com/q/27550376
has body: First of all you don't need to override Jackson2ObjectMapperBuilder to add custom deserializer. This approach should be used when you can't add @JsonDeserialize annotation. You should use @JsonDeserialize or override Jackson2ObjectMapperBuilder. What is missed is the @RequestBody annotation: @RestController public class JacksonCustomDesRestEndpoint { @RequestMapping(value = "/role", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Object createRole(@RequestBody Role role) { return role; } } @JsonDeserialize(using = RoleDeserializer.class) public class Role { // ...... } public class RoleDeserializer extends JsonDeserializer&lt;Role&gt; { @Override public Role deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // ................. return something; } }
answers question: http://stackoverflow.com/q/27550376

http://stackoverflow.com/a/27499590
answers question: http://stackoverflow.com/q/27498681
score: 0
type: Answer
has body: Scanner scanner = new.scanner(System.in); String abc = scanner.next(); int a = scanner.nextInt(); scanner.close();

http://stackoverflow.com/comment/43649948
score: 1
has text: A guess: URI has several constructors, all of which take only String parameters. All those ctor patterns match your input of a stream of Strings, so it can't choose which one.
comment on: http://stackoverflow.com/q/27613957
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43655741
type: QuestionComment
comment on: http://stackoverflow.com/q/27615542
type: Comment
has text: Did you take a heap dump and analyze it?
score: 0

http://stackoverflow.com/comment/43428566
has text: On second thought, the true should be replaced, but I need more context to improve it further
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27498769
type: Comment

http://stackoverflow.com/a/27581479
type: Answer
has comment: http://stackoverflow.com/comment/43587437
upvote count: 2
score: 2
has body: bm.getConfig() is returning null (which it is documented as being allowed to do). (The problem can't be that bm itself is null, because you check that, and because you wouldn't even get into the copy() function if it was. So you must be passing a null to the function. And it sure isn't true.)
answers question: http://stackoverflow.com/q/27581429
has comment: http://stackoverflow.com/comment/96980634
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27581429

winapi
tags question: http://stackoverflow.com/q/27581734
type: Tag
tag name: winapi

http://stackoverflow.com/q/27585690
tagged with: android-studio
has title: How to use onCreateOptionsMenu() in Activity Which Extended ListActivity
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27585760
tagged with: java
type: Question
score: 5
upvote count: 5
answer count: 1
has body: I have a problem about my android app project. I have a MainActivity which is below: public class MainActivity extends ListActivity { private NotesDataSource datasource; List&lt;NoteItem&gt; notesList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); datasource = new NotesDataSource(this); refreshDisplay(); } private void refreshDisplay() { notesList = datasource.findAll(); ArrayAdapter&lt;NoteItem&gt; adapter = new ArrayAdapter&lt;NoteItem&gt;(this, R.layout.list_item_layout, notesList); setListAdapter(adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } } And Also I have a menu_main.xml: &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity"&gt; &lt;item android:id="@+id/action_create" android:title="@string/action_create" android:orderInCategory="100" app:showAsAction="always|withText" android:icon="@drawable/create_note"/&gt; &lt;/menu&gt; At this point the problem is starting. I have changed my superclass from ActionBarActivity to ListActivity then, when I run my app on my device, I can not see my create icon (and the top menu which include app name). What's wrong? And idea? (Btw I am using Android Studio Ide)
accepted answer: http://stackoverflow.com/a/27585760
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0

http://stackoverflow.com/comment/43411490
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27489256
has text: The function kind of works if you uncomment the commented out lines.
score: 0

http://stackoverflow.com/a/27591253
score: -3
downvote count: 3
has body: Air is Javascript, so you can use XmlHTTPRequest to make requests. I have snipped this out of old production code, you might have to change a line here or there. Original code is here: CommandProxy.js /** * Make a call to a web service * * @param command The name of the command * @param parameters A map of parameters, e.g. { "file": "/myfile.pdf" } * @param (optional) callback, a function with one parameter, that will be given a json object when the result is ready. */ function callWebservice( url, parameters, callback ){ var async = (typeof (callback) == "function"); if( !parameters ) parameters = {}; var paramString = ""; for( var param in parameters ){ paramString += encodeURI( param ) + "=" + encodeURI( parameters[param] ) + "&amp;"; } var req = new XMLHttpRequest(); req.open( "POST", url, async ); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); req.setRequestHeader("Content-length", paramString.length); req.setRequestHeader("Connection", "close"); if( async ){ req.onreadystatechange = function(){ if( req.readystate == 4 &amp;&amp; callback ) { if( req.status == 200 ){ callback( JSON.parse( req.responseText ) ); } else{ callback( { "error" : req.responseText } ); } } }; req.send( paramString ); } else{ req.send( paramString ); var ret = JSON.parse( req.responseText ); return ret; } } On a side note: I made a terrible experience with Adobe Air around five to six years ago. It was slow, error prone, badly documented, not very flexible and it feels "foreign" when run on a desktop. It seems not much has changed. I strongly suggest you google for alternatives, don't take this choice lightly!
upvote count: 0
answers question: http://stackoverflow.com/q/27590248
has comment: http://stackoverflow.com/comment/43606427
has comment: http://stackoverflow.com/comment/43607209
has comment: http://stackoverflow.com/comment/43630054
type: Answer
has comment: http://stackoverflow.com/comment/43639611

http://stackoverflow.com/a/27635839
has body: a and b are declared as static which mean class variables, change static int a;static int b; to int a; int b;
type: Answer
answers question: http://stackoverflow.com/q/27635816
score: 0

http://stackoverflow.com/comment/43518406
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27545605
has text: please share the link of similar question @learningloop
score: 0

http://stackoverflow.com/comment/43525985
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27548387
has text: yes you could if you use static method to refresh the adapter outside of its fragment. but i don't suggest this if your lists are dynamically change. i suggest you in each of your fragment have different menus and has each item do its job within its fragment.
score: 0

http://stackoverflow.com/comment/43510133
type: Comment
has text: hi sir glad to hear your thoughts what do you mean by `second` ? :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27538636

http://stackoverflow.com/comment/43803236
type: Comment
has text: Ok, but what is count - is that should be read? Also, honestly I've changed `long toRead = length;` to `long toRead = length+start;` experimenting, sorry for that, but this shouldn't be work around at all. I will edit code with Your considerations and will soon respond. Thx for help.
type: AnswerComment
comment on: http://stackoverflow.com/a/27694660
score: 0

http://stackoverflow.com/comment/54077922
has text: Thanks for this answer. I actually haven't used Android Studio for quite some time as the project I was working on was unfortunately short-lived.
type: AnswerComment
comment on: http://stackoverflow.com/a/33093414
type: Comment
score: 0

http://stackoverflow.com/q/27583014
has body: When trying to get account balance used api I got an exception: IOException: Server returned HTTP response code: 401 for URL: https://api.pinnaclesports.com/v1/client/balance Here's the code: public void getBalance() throws Exception{ byte[] bytes = "username:password".getBytes("UTF-8"); String encoded = Base64.encodeBase64String(bytes); System.out.println(encoded); URL api = new URL("https://api.pinnaclesports.com/v1/client/balance"); URLConnection apiConnection = api.openConnection(); apiConnection.addRequestProperty("Authorization", "Basic "+encoded); BufferedReader in = new BufferedReader(new InputStreamReader(apiConnection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); }
favorite count: 0
has comment: http://stackoverflow.com/comment/43590472
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27583035
downvote count: 1
tagged with: java
score: -1
type: Question
has title: pinnaclesports api basic auth with java
answer count: 2
tagged with: api
upvote count: 0
has answer: http://stackoverflow.com/a/27583195
has comment: http://stackoverflow.com/comment/43590491
linked to: http://stackoverflow.com/q/4627395

http://stackoverflow.com/q/27514899
has body: I'm trying to get the value from the variable dificultad, which is inside the actionPerformed method to use it in another class. But I really have no clue on how to do it. So I don't know if maybe you could help. jComboBox1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int dificultad; if (jComboBox1.getSelectedItem() == "Facil") { dificultad = 10; System.out.println("Facil"); } else if (jComboBox1.getSelectedItem() == "Intermedio") { dificultad = 8; System.out.println("Intermedio"); } else if (jComboBox1.getSelectedItem() == "Dificil") { dificultad = 4; System.out.println("Dificl"); } else if (jComboBox1.getSelectedItem() == "Extremo") { dificultad = 1; System.out.println("Extremo"); } }
type: Question
has answer: http://stackoverflow.com/a/27515450
possible better answer: http://stackoverflow.com/a/27515100
has answer: http://stackoverflow.com/a/27515100
answer count: 2
tagged with: jcombobox
accepted answer: http://stackoverflow.com/a/27515450
type: AnsweredQuestion
has title: Selecting a value from an actionPerformed method
score: 0
tagged with: java

http://stackoverflow.com/q/27565338
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: I have two db tables: TARGET_TABLE (composite key on USER_ID and TARGET_ID) USER_ID | TICKET_NO | TARGET_USER --------------------------------- A11 | 12345 | A22 A11 | 12346 | A33 A44 | 12347 | A55 USER_DETAILS_TABLE CORP_ID | USER_NAME ------------------ A11 | Steve A22 | Jon A33 | Paul A44 | Dave A55 | James I want to be able to join these tables when I'm using select statements only. For example I would like to do: Select USER_ID, USER_NAME, TICKET_NO FROM TARGET_TABLE INNER JOIN USER_DETAILS ON TARGET_TABLE.USER_ID = USER_DETAILS_TABLE.CORP_ID I can't seem to find the best way to do this. I have looked at the Hibernate examples for mapping but these are examples on how to write to both tables I simply want to get a user name from a table I can't touch! I currently have two separate mappings for each table and run a separate query to get the user name but this doesn't seem like the best way to do it.
tagged with: hql
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27565501
accepted answer: http://stackoverflow.com/a/27565501
has title: Hibernate Join Mapping
tagged with: mapping
tagged with: inner-join

http://stackoverflow.com/q/27592700
downvote count: 3
has comment: http://stackoverflow.com/comment/43609140
has answer: http://stackoverflow.com/a/32691217
tagged with: tostring
linked to: http://stackoverflow.com/q/290884
has answer: http://stackoverflow.com/a/27592742
tagged with: java
type: Question
upvote count: 0
has title: non-Static method toString cannot be referenced from a static context
has answer: http://stackoverflow.com/a/27592774
favorite count: 0
tagged with: static
answer count: 5
has answer: http://stackoverflow.com/a/27592771
has answer: http://stackoverflow.com/a/27592751
has comment: http://stackoverflow.com/comment/43609139
score: -3
has body: I'm trying to create a program that reads user input and stores it and then calculates the area of a polygon. When I try and compile it it gives me one error which is the one about .toString being non static. import java.util.Scanner; class regularpoTest { public static void main(String[] args) { Scanner in = new Scanner(System.in); boolean finished = false; double s; double n; double area; //starts loop to record data do { s =0; n =0; System.out.println("Enter the side length, or anything else to quit: "); s = in.nextDouble(); in.nextLine(); if (in.hasNextDouble()) { System.out.println("Enter number of sides"); n = in.nextDouble(); area = (s*s*n)/(4*Math.tan(Math.PI/n)); } else { finished = true; } } while(!finished); //This prints out the student details System.out.println(regularpo.toString()); } } public class regularpo { private double side; private double numberOf; private double area; public regularpo(double side, double numberOf){ side = 0; numberOf = 0; area = 0; } public double getSide(){ return side; } public double getNumberOf(){ return numberOf; } public String toString(){ return ("area = " + area+ " side length "+side+ " number of sides "+numberOf); } }
has comment: http://stackoverflow.com/comment/43609063
has comment: http://stackoverflow.com/comment/43609071
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43609106
linked to: http://stackoverflow.com/q/3903537

truncate
tags question: http://stackoverflow.com/q/27609595
type: Tag
tag name: truncate

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/27583390

http://stackoverflow.com/comment/43688159
type: QuestionComment
has text: Have you freed the bitmap before switching to next image and have you recycled the image view?
comment on: http://stackoverflow.com/q/27634308
score: 0
type: Comment

http://stackoverflow.com/comment/43638903
comment on: http://stackoverflow.com/q/27608244
score: 0
type: Comment
has text: Does your class have to extend a `LinkedList` or can it just implement a `List`?
type: QuestionComment

http://stackoverflow.com/comment/43500384
type: Comment
comment on: http://stackoverflow.com/a/27535969
score: 0
type: AnswerComment
has text: Yes it does. Thanks. Just wanted to know if anyone has worked with an exception to that rule.

http://stackoverflow.com/comment/43398027
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27482579
has text: Generate via Eclipse or IDEA hashCode and equals methods , they always look that way

http://stackoverflow.com/q/27552317
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22503860
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
has title: How to get list of commit history using Perforce api?
has answer: http://stackoverflow.com/a/27552418
type: UnansweredQuestion
has body: I'm using perforce api for java to get the commit history of a perforce repo. I browsed through the complete set of functions available for the Iserver interface. http://www.perforce.com/perforce/doc.current/manuals/p4java-javadoc/com/perforce/p4java/server/IServer.html Can someone please point me out what functions can I look for? OR Is there is any simpler and better way to handle this? What I want is - 1) Who made the last few (say 5) commits in a branch.
tagged with: perforce
has answer: http://stackoverflow.com/a/27558854
score: 1

http://stackoverflow.com/comment/43678891
type: QuestionComment
has text: @corsiKa In geometry computations there are often two cases we're looking for to choose from two possible answers (e.g. is point to the left or to the right of the line?), and sometimes it introduces the third, degenerate case (point is right on the line), but you only have two available answers, so you have to pseudorandomly choose one of the available answers in that case. The best way I could think of is to take a 1 bit hash of one of the given double values (remember, those are geometry computations, so there are doubles all over the place).
score: 4
comment on: http://stackoverflow.com/q/27625611
type: Comment

http://stackoverflow.com/q/27546313
has title: Flyway database migration to multiple schemas
has comment: http://stackoverflow.com/comment/43556525
tagged with: flyway
answer count: 2
has body: I've set up a migration script for my multi-tenant application. the problem was. it's only generating the scripts for the first tenant/schema I've specified on the parameter. Here's my sql script drop table if exists ADMIN_ACCOUNT cascade; drop table if exists PERSON_NAME cascade; drop table if exists USER_ACCOUNT cascade; create table ADMIN_ACCOUNT ( id int8 not null, created_date timestamp, PASSWORD varchar(255), USERNAME varchar(255), membershipType varchar(255), NAME_ID int8, primary key (id) ); create table PERSON_NAME ( id int8 not null, created_date timestamp, FIRST_NAME varchar(255), LAST_NAME varchar(255), MIDDLE_NAME varchar(255), account_id int8, primary key (id) ); create table USER_ACCOUNT ( id int8 not null, created_date timestamp, PASSWORD varchar(255), USERNAME varchar(255), ROLE varchar(255), TENANT_CODE varchar(255), NAME_ID int8, primary key (id) ); alter table ADMIN_ACCOUNT add constraint FK_fil1krx8k0osj713tg44ia0vu foreign key (NAME_ID) references PERSON_NAME; alter table PERSON_NAME add constraint FK_hc1g7pa0rseytw9o1pcuo0mpw foreign key (account_id) references USER_ACCOUNT; alter table USER_ACCOUNT add constraint FK_ib2pk4at20vxm3onaoro6ry2r foreign key (NAME_ID) references PERSON_NAME; Here's the command I have entered to flyway mvn compile flyway:migrate -Dflyway.schemas=tenant3,tenant4,tenant5 -Dflyway.baselineOnMigrate=true It's only generating the tables for the first tenant which is tenant3. Is this a bug? or am Missing something?
downvote count: 0
favorite count: 0
upvote count: 8
tagged with: migration
score: 8
type: UnansweredQuestion
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/27588444
has answer: http://stackoverflow.com/a/34562715
tagged with: java
tagged with: database

http://stackoverflow.com/comment/43595617
has text: yes, but this doesn't download the image into the toast
comment on: http://stackoverflow.com/a/27585536
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43694957
score: 1
comment on: http://stackoverflow.com/q/27637919
has text: http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43553140
has text: The problem is that I can't even do the input correctly. How do I keep asking the user to give me those numbers(0's and 1's) until the matrix is full.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27563721

http://stackoverflow.com/q/27611617
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27611674
tagged with: java
type: Question
tagged with: clock
score: 0
has body: I am making a Swing application for a clock. I was trying to find the current time, and ended up using System.currentTimeMillis(), but I am still curious as to how to fix this. I get a lot of errors similar to this, so I would like to know how to fix this. Doc: http://docs.oracle.com/javase/8/docs/api/java/time/Clock.html#system-java.time.ZoneId- First, I tried Clock second; second = Clock.tickSeconds(Clock.getZone()); but I get an error non-static method getZone() cannot be referenced from a static context So I tried Clock second; second = Clock.tickSeconds(new Clock.getZone()); but I get this: cannot find symbol symbol: class getZone location: class Clock So how can I edit the code to fix the error?
answer count: 1
has title: using method tickSeconds in Class Clock on Java
accepted answer: http://stackoverflow.com/a/27611674
tagged with: java-8

http://stackoverflow.com/q/27634234
downvote count: 1
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/27634425
has comment: http://stackoverflow.com/comment/43688084
has answer: http://stackoverflow.com/a/27634357
upvote count: 4
has answer: http://stackoverflow.com/a/27634353
linked to: http://stackoverflow.com/q/4040624
type: AnsweredQuestion
favorite count: 0
type: Question
has body: I want to check the Folder Existance before creating the new one. For that which method I need to use : File folder = new File(PATH); there are two method for checking the same 1) folder.getAbsoluteFile().exists() OR 2) folder.exists() Which one to use? Thanks for looking here.
has answer: http://stackoverflow.com/a/27634349
accepted answer: http://stackoverflow.com/a/27634425
score: 3
possible better answer: http://stackoverflow.com/a/27634400
has answer: http://stackoverflow.com/a/27634400
tagged with: file-handling
has title: java : File.getAbsoluteFile().exists() v/s File.exists()
has comment: http://stackoverflow.com/comment/43688070
tagged with: file

http://stackoverflow.com/q/27625604
tagged with: oracle-sqldeveloper
answer count: 0
type: UnansweredQuestion
tagged with: oracle-database
tagged with: openjpa
has comment: http://stackoverflow.com/comment/45598858
tagged with: geronimo
has body: I have a newbie question, so I hope you can help. Currently as ORM tool I am using OpenJPA 2.2.1 . MY CUrrent persistence UNit: <?xml version="1.0" encoding="UTF-8"?> Flea Circus org.apache.openjpa.persistence.PersistenceProviderImpl FleaCircusOracleDS de.carmedialab.db.entities.ApplicationItem de.carmedialab.db.entities.FleaResult de.carmedialab.db.entities.FleaResultType de.carmedialab.db.entities.ItemAttribute de.carmedialab.db.entities.ItemGroup de.carmedialab.db.entities.ItemType de.carmedialab.db.entities.ItemTypeAttribute de.carmedialab.db.entities.ItemTypeOperationAttribute de.carmedialab.db.entities.Operation de.carmedialab.db.entities.OperationAttribute de.carmedialab.db.entities.OperationType de.carmedialab.db.entities.Role de.carmedialab.db.entities.UserAccount de.carmedialab.db.entities.Measurement de.carmedialab.db.entities.MeasurementType de.carmedialab.db.entities.MeasurementAttribute de.carmedialab.db.entities.MeasurementAttributeType de.carmedialab.db.entities.Fleet <property name="openjpa.jdbc.SynchronizeMappings" value="validate" /> <property name="openjpa.Compatibility.CheckDatabaseForCascadePersistToDetachedEntity" value="true" /> <!--<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />--> Flea Circus org.apache.openjpa.persistence.PersistenceProviderImpl FleaCircusOracleDS de.carmedialab.db.entities.ApplicationItem de.carmedialab.db.entities.FleaResult de.carmedialab.db.entities.FleaResultType de.carmedialab.db.entities.ItemAttribute de.carmedialab.db.entities.ItemGroup de.carmedialab.db.entities.ItemType de.carmedialab.db.entities.ItemTypeAttribute de.carmedialab.db.entities.ItemTypeOperationAttribute de.carmedialab.db.entities.Operation de.carmedialab.db.entities.OperationAttribute de.carmedialab.db.entities.OperationType de.carmedialab.db.entities.Role de.carmedialab.db.entities.UserAccount de.carmedialab.db.entities.Measurement de.carmedialab.db.entities.MeasurementType de.carmedialab.db.entities.Me…
tagged with: java
has comment: http://stackoverflow.com/comment/43690109
type: Question
has title: OpenJpa in Apache Geronimo 3.0
score: 0
has comment: http://stackoverflow.com/comment/43675557
has comment: http://stackoverflow.com/comment/43830369
has comment: http://stackoverflow.com/comment/43833946

http://stackoverflow.com/comment/43698994
comment on: http://stackoverflow.com/a/27615845
score: 0
type: AnswerComment
type: Comment
has text: It didn't go beyond the second page. Even when expected result was on the third one.

http://stackoverflow.com/q/27579185
type: UnansweredQuestion
type: Question
has body: As noted in the oracle java GC basic documentation when any minor GC is triggered all object located in S0 sirvivor space (if any) are moved into S1 sirvivor space or vice verca. It seems strange to me, to say the least. To perform the operation the GC waste a JVM resources to moving objects from Si to Sj, i!=j, i,j are from {1, 2}. May I not follow the actual purpose of that operation... Couldn't anyone explain it to me?
has comment: http://stackoverflow.com/comment/43583018
has title: Survivor space changing, why that?
has comment: http://stackoverflow.com/comment/43583080
has comment: http://stackoverflow.com/comment/43583058
score: 0
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/43583043
has answer: http://stackoverflow.com/a/27579496
answer count: 1
has comment: http://stackoverflow.com/comment/43583090
tagged with: java

http://stackoverflow.com/a/27522835
answers question: http://stackoverflow.com/q/27522741
has body: There is no shortcut for converting from int[] to List as Arrays.asList does not deal with boxing and will just create a List which is not what you want. You have to make a utility method. int[] ints = {1, 2, 3}; List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(); for (int index = 0; index &lt; ints.length; index++) { intList.add(ints[index]); }
type: Answer
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/27556863
has body: It seems that an abstract class means the definition of the class is not complete and hence cannot be instantiated. And I saw some simple Java code which has an abstract class with all of the methods defined. Then I was wondering, why do they make it as an abstract class instead of a real class? Are they doing this so we cannot instantiate from this abstract class? Or they are getting other benefits from making an abstract class with everything defined?
possible better answer: http://stackoverflow.com/a/27557015
has answer: http://stackoverflow.com/a/27566746
has title: Are there any reasons to have an abstract class with every method in the class defined?
has answer: http://stackoverflow.com/a/27557015
answer count: 7
upvote count: 33
favorite count: 0
has answer: http://stackoverflow.com/a/27556912
accepted answer: http://stackoverflow.com/a/27556912
has comment: http://stackoverflow.com/comment/43562964
has answer: http://stackoverflow.com/a/27557217
has comment: http://stackoverflow.com/comment/43539902
has comment: http://stackoverflow.com/comment/43549586
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 33
type: Question
has answer: http://stackoverflow.com/a/27557000
has answer: http://stackoverflow.com/a/27556915
tagged with: inheritance
has comment: http://stackoverflow.com/comment/43541903
has answer: http://stackoverflow.com/a/27556920

http://stackoverflow.com/a/27613483
score: 1
upvote count: 1
downvote count: 0
has body: Just index over the length of the string and get the character of the code array at that index... charAt will give you the literal int value which is obviously not what you want. public static void main(String[] args) { // 0123456789 char[] code = {'A', 'B','C','D','E','F','G','H','I','J'}; String orig = "0123456789"; for ( int i=0; i &lt; orig.length(); i++) { System.out.print( code[i] ); } }
type: Answer
answers question: http://stackoverflow.com/q/27613438

http://stackoverflow.com/comment/43395951
has text: Since the WebContent folder is the root of the site, the 2nd link as well as the 4th link should work. Without a deployment descriptor (web.xml), how are you hitting the jsp? Are you forwarding from the servlet to the jsp? in that case, you have your own router logic in some servlet where you should handle the css, js and image files. If your logic in the router is correct, this should work.
type: QuestionComment
comment on: http://stackoverflow.com/q/27480587
score: 0
type: Comment

http://stackoverflow.com/comment/43584733
comment on: http://stackoverflow.com/q/27566339
type: Comment
type: QuestionComment
has text: Table 3 has a Composite Primary Key (table1id + table2id) and has a foreign Key contraint to table1id and table2id
score: 0

http://stackoverflow.com/comment/43470989
score: 1
has text: I don't see that tutorial as enlightening at all. They seem to present a trivial case which, in my opinion isn't even a good one in its own right. The manufacturing process for a bicycle should be quite a bit different than the manufacturing process for a car. You cannot use just any random `Workshop` object to create your bicycle/car object and thus I don't see what has been decoupled.
comment on: http://stackoverflow.com/q/27520434
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27569661
has answer: http://stackoverflow.com/a/41378369
accepted answer: http://stackoverflow.com/a/27569704
has body: Is possible to keep HTTP session between redeploys on WildFly?
upvote count: 11
type: AnsweredQuestion
tagged with: wildfly
has title: Keeping HTTP session between redeploys in WildFly
score: 11
type: Question
tagged with: session
tagged with: java
has answer: http://stackoverflow.com/a/27569704
answer count: 2
has comment: http://stackoverflow.com/comment/43564639
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/41378369

http://stackoverflow.com/comment/43479263
has text: You are misinterpreting the meaning of `getRow()`: it is the **index** in the result set. It has nothing to do with a generated key or row_id.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27525270
score: 0

http://stackoverflow.com/q/27591313
answer count: 1
has title: How to restrict number of characters on a single line?
has comment: http://stackoverflow.com/comment/43621412
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/43618290
has comment: http://stackoverflow.com/comment/43621298
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/43618300
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has body: I am using iText to generate PDFs. In these PDFs, I need to add two Strings on one line. The first String (string1) length is between 1 and 10. The length of the second String (string2) is unknown, but the combined length of string1 and string2 should not exceed 10 characters. How can I add these strings to a single line that is underlined?
has comment: http://stackoverflow.com/comment/43620822
has comment: http://stackoverflow.com/comment/43621181
has answer: http://stackoverflow.com/a/27599695
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/43618329
type: Question

http://stackoverflow.com/q/27565025
has comment: http://stackoverflow.com/comment/43555801
has comment: http://stackoverflow.com/comment/43555903
has comment: http://stackoverflow.com/comment/43555693
has comment: http://stackoverflow.com/comment/43555536
answer count: 0
has comment: http://stackoverflow.com/comment/43556345
has comment: http://stackoverflow.com/comment/43555339
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43555310
has comment: http://stackoverflow.com/comment/43555397
has comment: http://stackoverflow.com/comment/43555354
has body: I'm writing a highScore in a game. The goal of the code is to get a score and after filling in your name, the score is added, then saved in an excel file. Somehow, it keeps repeating and repeating an infinite amout of times. How can i fix this? import java.util.*; // A single score class Score { // has the name of the player String name; // and his/her score int score; // Constructor Score(String name, int score) { this.name = name; this.score = score; } } // ScoreList class manages a list of scores class ScoreList { ArrayList&lt;Score&gt; scores = new ArrayList&lt;Score&gt;(); Table scoreTable; // Constructor ScoreList() { scoreTable = new Table(); scoreTable.addColumn("name"); scoreTable.addColumn("Time"); } // Create a new Score and add it to the scores ArrayList void addScore(String name, int score) { // Add a new score object to the scores ArrayList scores.add(new Score(name, score)); // Sort the scores ArrayList after each score is added sortScores(); } // return amount of scores in scores ArrayList int getScoreCount(){ return scores.size(); } // return the score at iScore Score getScore(int iScore){ return scores.get(iScore); } // Sort the scores ArrayList void sortScores() { Collections.sort(scores, new HSComperator()); } // Save scores to file named "scoreFileName" void save(String scoreFileName) { // Copy scores from ArrayList to table for (Score score : scores) { TableRow row = scoreTable.addRow(); row.setString("name", score.name); row.setInt("Time", score.score); } // save the table to file saveTable(scoreTable, scoreFileName); } // Load scores from file called "scoreFileName" void load(String scoreFileName) { // Load the scores into the Table object scoreTable = loadTable(scoreFileName, "header"); // clear scores ArrayList scores.clear(); // copy scores from table to the scores array for (int iScore=0; iScore&lt;scoreTable.getRowCount(); iScore++) { TableRow row = scoreTable.getRow(iScore); scores.add(new Score(row.getString("name"), row.getInt("Time")…
type: Question
has comment: http://stackoverflow.com/comment/43555306
has comment: http://stackoverflow.com/comment/43555673
has comment: http://stackoverflow.com/comment/43555385
upvote count: 2
has comment: http://stackoverflow.com/comment/43556779
has comment: http://stackoverflow.com/comment/43557137
downvote count: 1
favorite count: 0
has title: Infinite repeating of highscore in processing
type: UnansweredQuestion

http://stackoverflow.com/q/27525308
score: 4
has body: I am trying to start the barcode scanner upon the user pressing a button in the html. However i am recieving an error: Uncaught TypeError: Object [object Object] has no method 'scanBarcode'", source: file:///android_asset/www/index.html (49) Which is being called in javascript with: function scanner(){ Android.scanBarcode(); } Now in the Java file i have the following code, which declares the function withinpublic class JavaScriptInterface Here is my MainActivity.java file: public class MainActivity extends Activity { @SuppressWarnings("deprecation") @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); WebView myWebView = (WebView)findViewById(R.id.webView); myWebView.addJavascriptInterface(new WebAppInterface(this), "Android"); myWebView.setInitialScale(1); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(false); webSettings.setSupportZoom(true); webSettings.setJavaScriptEnabled(true); webSettings.setLoadWithOverviewMode(true); webSettings.setUseWideViewPort(true); //webView.getSettings().setJavaScriptEnabled(true); myWebView.setWebChromeClient(new WebChromeClient()); //myWebView.setWebViewClient(new WebViewClient()); myWebView.loadUrl("file:///android_asset/www/index.html"); } public class JavaScriptInterface { Context mContext; // Instantiate the interface and set the context JavaScriptInterface(Context c) { mContext = c; } // using Javascript to call the finish activity public void closeMyActivity() { finish(); } public void scanBarcode() { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.setPackage("com.google.zxing.client.android"); startActivityForResult(intent, 0); } } //JavascriptInterface public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0)…
answer count: 1
has answer: http://stackoverflow.com/a/27539076
accepted answer: http://stackoverflow.com/a/27539076
favorite count: 0
linked to: http://stackoverflow.com/q/18028666
tagged with: android
has title: Scan Barcode Within WebView Android
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: zxing
tagged with: barcode-scanner
type: Question
tagged with: javascript

http://stackoverflow.com/comment/62695811
type: AnswerComment
has text: In this example can you use use repository B to set attributes belonging to Class A that is extended by Class B? I wanted to use a system like this to update B via a spring-data-rest controller.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27549198

http://stackoverflow.com/q/27528652
has answer: http://stackoverflow.com/a/65903977
has answer: http://stackoverflow.com/a/32405953
has answer: http://stackoverflow.com/a/28381131
upvote count: 44
has answer: http://stackoverflow.com/a/30591874
type: Question
has answer: http://stackoverflow.com/a/28718588
has answer: http://stackoverflow.com/a/33186345
has answer: http://stackoverflow.com/a/28647444
has answer: http://stackoverflow.com/a/33045074
tagged with: windows-8
tagged with: java
has answer: http://stackoverflow.com/a/30224636
score: 44
has answer: http://stackoverflow.com/a/27666759
possible better answer: http://stackoverflow.com/a/28718588
has answer: http://stackoverflow.com/a/31481644
has answer: http://stackoverflow.com/a/35062102
has answer: http://stackoverflow.com/a/61380747
downvote count: 0
has answer: http://stackoverflow.com/a/40949691
answer count: 17
favorite count: 0
has answer: http://stackoverflow.com/a/32431512
has answer: http://stackoverflow.com/a/51254449
accepted answer: http://stackoverflow.com/a/27666759
tagged with: android
has title: tools.jar seems to be not in Android Studio classpath on Windows 8
has answer: http://stackoverflow.com/a/30601543
tagged with: android-studio
type: AnsweredQuestion
has body: I installed Android Studio but it was giving me error that I need to install JDK but JDK was already installed. Then I realized it is asking to install 64bit version of JDK. Anyway I just downloaded latest JDK 64bit version and set the following in Environment Variable but still Android Studio is giving error: Error 'tools.jar' seems to be not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE. Following paths are set in my Windows 8. Path in User Variables E:\Program Files\Java\jdk1.8.0_25\bin JAVA_HOME in System Variables E:\Program Files\Java\jdk1.8.0_25 Path in System Variables E:\Program Files\Java\jdk1.8.0_25\bin 32bit JDK is installed on C drive while 64bit JDK is installed on E drive (as shown above). 32 bit JDK is not being used in any User or System Variables. I have also restarted the PC. How do I fix this issue?

http://stackoverflow.com/a/27540910
downvote count: 0
type: Answer
upvote count: 1
has body: You can look at the source code of the java.lang.Object. The toString method have a return value in String type. You can't have another method which's name is toString but return type is not String. Actually, it's forbidden in Java in any inheritance relationship. When you call the method, the compiler only cares the name and the parameters. So how can it distinguishes the methods of the same name but with the different return type?
score: 1
answers question: http://stackoverflow.com/q/27540688

http://stackoverflow.com/comment/43660368
type: Comment
comment on: http://stackoverflow.com/q/27619217
type: QuestionComment
score: 1
has text: I don't see how "border" can contain anything that's not proper UTF-8. Is this from the XML or XSLT file? What is line 89 in the other file? What file is "////"?

http://stackoverflow.com/q/27515754
has body: I am loading an external image with JavaFX: Image tile = new Image(imageFile.toURI().toURL().toString(),width, height, true,true); You need to supply the width and height. How can I get the image's width and height? Now, I know that the width and height of a PNG image are determined by the bytes from 12 to 20 or something like that, so technically you could open a byte stream and interpret the bytes. However, this seems overkill for the simple task of drawing an image in my JavaFX application. Is there not a way to draw an image with its full size without asking me to supply the dimensions?
tagged with: javafx
type: AnsweredQuestion
tagged with: java
type: Question
has title: Drawing an image using its full size rather than asking me for its dimensions in JavaFX
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27515817
accepted answer: http://stackoverflow.com/a/27515817

http://stackoverflow.com/q/27481137
favorite count: 0
has answer: http://stackoverflow.com/a/27481631
has body: I am absolutely new to Java. I am creating a Servlet and getting the error interface is expected here. Can you please make me understand the problem(s)? I am using IntelliJ 14. My Servlet code is as follows:- package ERPdetector; /** * Created by Sinha on 12/15/14. */ import javax.servlet.http.*; import javax.servlet.*; import java.io.*; public class ErpServlet implements HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType("text/html"); PrintWriter pw=res.getWriter(); String dropdown=req.getParameter("dropdown"); pw.println("You Requested for "+dropdown); pw.close(); } } Thanks in Advance.
has answer: http://stackoverflow.com/a/27481407
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/27481177
tagged with: servlets
possible better answer: http://stackoverflow.com/a/27481407
has answer: http://stackoverflow.com/a/27481521
has title: Java Servlet interface is expected here
downvote count: 0
score: 6
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27481177
upvote count: 6
has answer: http://stackoverflow.com/a/27481220

http://stackoverflow.com/q/27606778
has comment: http://stackoverflow.com/comment/43644271
has answer: http://stackoverflow.com/a/27781761
type: Question
tagged with: annotation-processing
score: 10
downvote count: 0
has title: How to use custom type annotations in Java
answer count: 3
linked to: http://stackoverflow.com/q/22375891
has answer: http://stackoverflow.com/a/27782411
accepted answer: http://stackoverflow.com/a/27781761
tagged with: type-annotation
favorite count: 0
has body: Java 8 has feature called Type annotations (JSR 308). I would like to use it for simple Object to Object mapper framework. I would like define annotation @ExpectedType like this @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @Retention(RetentionPolicy.RUNTIME) public @interface ExpectedType { public Class&lt;?&gt; value(); } And then use it in my code like this: public class SomeServiceImpl() { public @ExpectedType(ObjectA_DTO.class) IObjectA doSomething(@ExpectedType(ObjectA_Entity.class) IObjectA obj) { return (ObjectA_Entity) obj; // it's correct } } IObjectA is an interface implemented by classes ObjectA_DTO and ObjectA_Entity. The service I would like to use this way: // it's correct assert someService.doSomething(new ObjectA_DTO()).getClass() == ObjectA_DTO.class; I would like change call of SomeServiceImpl methods to use Object mapper. It could be achieved by generated code using JSR 269 or by AOP. The problem is I wrote simple annotations processor and it doesn't handle type annotations at all. The source of simple annotations processor looks like this: @SupportedAnnotationTypes("*") @SupportedSourceVersion(SourceVersion.RELEASE_8) public class SimpleAnnotationsProcessor extends AbstractProcessor { public boolean process(Set&lt;? extends TypeElement&gt; annotations, RoundEnvironment roundEnv) { Messager messager = processingEnv.getMessager(); try { for (TypeElement e : annotations) { messager.printMessage(Diagnostic.Kind.NOTE, e.toString()); for (Element elem : roundEnv.getElementsAnnotatedWith(e)) { messager.printMessage(Diagnostic.Kind.NOTE, elem.toString()); } } } catch (Exception e) { e.printStackTrace(); } return true; } } Any ideas how to use or how to access type annotations by SimpleAnnotationsProcessor? Usage of Pluggable Annotation Processing API is not necessary for me I think it would has better performance than Java reflection. Anyway I don't know how to access type annotation via Java Reflection too.
has answer: http://stackoverflow.com/a/27781891
has comment: http://stackoverflow.com/comment/43972713
has comment: http://stackoverflow.com/comment/43920683
tagged with: java-8
possible better answer: http://stackoverflow.com/a/27781891
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43972388
tagged with: java
upvote count: 10

http://stackoverflow.com/comment/43692849
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27636557
type: QuestionComment
has text: It is horrible to read the code for someone who does not understand your language. I'd recommend you to write everything in English and to COMMENT(!!!) the code you have written so far.

http://stackoverflow.com/q/27610851
has body: I have an android app that comminicates with a nodejs server via http. To each request I add a SHA1 checksum that iterates over the key value pairs I'm sending to the server so that it would validate it on arrival. I have tested this and it works okay as long as the values I'm sending are in English. Sending a request that contains a string value in Hebrew for example or that includes an unstandard character (like é, ç or à) will fail the request base on a checksum mismatch. The checksum is calculated first in the andoird client (JAVA) and than in the nodejs server for verification. I eliminated the possibility that this is caused due to the Right To Left nature of the Hebrew language by sending a single letter value, and it still failed. What could cause this? I assume this might be because the encoding of a JAVA string for non standard characters is different from that of nodejs. But how can I solve this? Here is the relevant code from the server side: var shasum = crypto.createHash('sha1'); while (fieldsPointer &lt; allFields.length || filesPointer &lt; allFiles.length) { shasum.update(fieldKey); let fieldKey = allFields[fieldsPointer]; shasum.update(fieldKey); let fieldValue = fields[allFields[fieldsPointer]]; shasum.update(fieldValue); } and the client side: try { MessageDigest md = MessageDigest.getInstance("SHA-1"); for(Entry&lt;String, Object&gt; entry : allParams.entrySet()) { md.update(entry.getKey().getBytes()); if(entry.getValue() instanceof String) { String value = (String) entry.getValue(); md.update(value.getBytes()); } else (...) // some other instance checking for non String values } String checksum = bytesToHex(md.digest()); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
has answer: http://stackoverflow.com/a/27612521
score: 0
tagged with: android
answer count: 1
has title: SHA1 sum on multilanguage strings
has comment: http://stackoverflow.com/comment/43644668
has comment: http://stackoverflow.com/comment/43644350
tagged with: node.js
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43644167
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27612521
tagged with: javascript

http://stackoverflow.com/comment/43414576
has text: did you change just that one line?
comment on: http://stackoverflow.com/a/27489573
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43529685
comment on: http://stackoverflow.com/a/27548184
score: 0
type: AnswerComment
has text: How does your camel route looks like?
type: Comment

http://stackoverflow.com/comment/43642161
score: 0
has text: @MateusViccari I tried to simplify your question. Feel free to rollback my edit if you don't feel that it is what you wanted to ask.
comment on: http://stackoverflow.com/q/27609348
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27506235
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27496079
has body: Regarding your questions: The problem I'm having is trying to figure out how I can pass all the customer's data from the text-fields in the 2nd GUI and transfer them into the JList in the 1st GUI... There are usually two problems in this situation -- How to get the information held by the fields of add new customer dialog window (and yes, this should be a dialog window of some form, either a JDialog or a JOptionPane) into the parent window object, and How to be notified exactly when this transfer of information should take place, and this is usually the more problematic of the two. Again the first issue is usually easy to solve, since it is nothing more than a specific version of the more general problem of how to pass information between two classes. The most simple way to solve it is to have the parent window class call getter methods in the dialog window class to extract its state. For instance, the dialog window could have public getter methods for the data held in each JTextField, which the calling parent window could call, or the dialog class could have a getCustomer() method within which it gathers all the information held by its input fields, creates a Customer object, and then returns that object. Perhaps a better and more robust way of transferring your data is to structure your program as a Model-View-Control or MVC type program, have your add new customer dialog window update the model when its submit button is pressed, and have the parent main window be notified by the model that its data has been changed, and so it knows that it must update its view of the data. This may be overkill for your program, and so I am not going to push this recommendation at this time, but in the future, when you are creating larger more complex programs, this is really what you will want to be doing since it will more easily allow your program's classes to have high cohesion (code that deals with the same things are close together) and low coupling (code that deals with unl…
answers question: http://stackoverflow.com/q/27496079

http://stackoverflow.com/a/27549829
has comment: http://stackoverflow.com/comment/43526249
has comment: http://stackoverflow.com/comment/43624729
has comment: http://stackoverflow.com/comment/43624054
answers question: http://stackoverflow.com/q/27549348
has comment: http://stackoverflow.com/comment/43623898
score: 0
has body: Change your attribute in &lt;xsd:attribute name="id" type="xsd:int" use="required"/&gt; If you don't use required this attribute could be nillable and in java object only Integer can rapresent this concept. Reference here Since the attribute is optional there is a possibility that it may be nillable which would not be possible using a primitive. The java.lang.Integer is an Object and thus allowed to be null, so it makes sense to generate an &lt;xsd:attribute type="xsd:int" /&gt; as an java.lang.Integer. If you make an attribute be required (use="required"), it will generate as a primitive int. I haven't seen documentation by JAXB that explicitly says this, but that doesn't mean it doesn't exist; perhaps I just missed it.
has comment: http://stackoverflow.com/comment/43526126
type: Answer
has comment: http://stackoverflow.com/comment/43526021

http://stackoverflow.com/q/27536989
tagged with: udp
has body: I'm using Netty for sending and receiving UDP Multicast messages and when I create multiple servers on same node it sometimes stops stop receiving packets from other servers. However even though they don't receive any packet from other servers, they still keep receiving packets that are sent using same multicast server. Here is the server code: multicastAddress = new InetSocketAddress("239.255.27.1", 14878); Bootstrap a = new Bootstrap() .group(group) .channelFactory(() -&gt; new NioDatagramChannel(InternetProtocolFamily.IPv4)) .localAddress(multicastAddress) .option(ChannelOption.IP_MULTICAST_IF, NetUtil.LOOPBACK_IF) .option(ChannelOption.SO_REUSEADDR, true) .handler(new ChannelInitializer&lt;NioDatagramChannel&gt;() { @Override public void initChannel(NioDatagramChannel ch) throws Exception { h.pipeline().addLast(new ChannelInboundHandler() { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { System.out.println(msg); } }); } }); multicastServer = (NioDatagramChannel) a.bind().sync().channel(); multicastServer.joinGroup(multicastAddress, NetUtil.LOOPBACK_IF).sync(); The client periodically sends same ByteBuf: multicastServer.writeAndFlush(new DatagramPacket(Unpooled.copyInt(1), multicastAddress)); When I start a server on a node, it starts receiving packets that are sent from that server. Then, if create the second server on the same node, it usually works and the server receives packets sent from both first and second server. However when I create a few more servers that are bound to same port (I use ChannelOption.SO_REUSEADDR so it should be a problem) sometimes all of the servers stop receiving packets from other servers instead only receive packets that are sent from the same server.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27537197
type: Question
tagged with: netty
tagged with: multicast
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27537197
answer count: 1
tagged with: network-programming
has title: Servers stops receiving UDP Multicast packets when I create multiple servers on same node

http://stackoverflow.com/comment/43467053
type: AnswerComment
score: 0
type: Comment
has text: ok http://stackoverflow.com/questions/23758226/present-participle-form-of-run-is-runing-in-simplenlg solved the -ing problem
comment on: http://stackoverflow.com/a/27518514

http://stackoverflow.com/comment/43687632
score: 1
comment on: http://stackoverflow.com/q/27624985
has text: Yeah I think we should make this easy out of the box, so I logged a ticket: https://issues.apache.org/jira/browse/CAMEL-8176
type: Comment
type: QuestionComment

bytecode-manipulation
type: Tag
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/27634220

http://stackoverflow.com/q/27512459
has comment: http://stackoverflow.com/comment/43455189
tagged with: java
accepted answer: http://stackoverflow.com/a/27518202
has comment: http://stackoverflow.com/comment/43455249
type: Question
has comment: http://stackoverflow.com/comment/43455196
answer count: 2
has answer: http://stackoverflow.com/a/27512839
score: 0
possible better answer: http://stackoverflow.com/a/27512839
has comment: http://stackoverflow.com/comment/43455812
has comment: http://stackoverflow.com/comment/43455209
has answer: http://stackoverflow.com/a/27518202
has body: Can someone please see if there is an error in my code? I have looked for a while, and tried tweaking things but I just can't get it working. while(current != null) { comparisons++; String currentWord = current.getWord(); if(currentWord.equals(word)) { int count = current.getCount(); count++; current.setCount(count); isFound = true; total++; LLNode next = current.getLink(); previous.setLink(next); current.setLink(top); top = current; } else { previous = current; current = current.getLink(); } } Okay so this code runs but doesn't give me an error code. It simply gets stuck in an infinite loop as soon as it finds the word it needs. The entire code is to read the words from hamlet and add them into a linked list. each time a word is already in the list we increment it's counter and move that link to the beginning of the linked list. If I follow it in debug mode, it functions properly for about 12 words or so, then just stops in an infinite loop with the word "i" and increments indefinately. I'm very confused.
has title: Linked List breaks after a few iterations
has comment: http://stackoverflow.com/comment/43455206
type: AnsweredQuestion
tagged with: linked-list

http://stackoverflow.com/comment/43699338
score: 0
comment on: http://stackoverflow.com/a/27581829
type: AnswerComment
type: Comment
has text: @pardhu, read the JOptionPane API. It show you the manual code needed to directly create the option pane and use it in a dialog.

http://stackoverflow.com/comment/43574974
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27574726
has text: Clarify what you mean by "confused on the arguments...". Surely you know what types they are; right?

spring
tags question: http://stackoverflow.com/q/27500119
tags question: http://stackoverflow.com/q/27503174
tags question: http://stackoverflow.com/q/27615001
tags question: http://stackoverflow.com/q/27604654
tags question: http://stackoverflow.com/q/27571396
tags question: http://stackoverflow.com/q/27634030
tags question: http://stackoverflow.com/q/27564351
tags question: http://stackoverflow.com/q/27508577
tags question: http://stackoverflow.com/q/27508521
tags question: http://stackoverflow.com/q/27522222
tags question: http://stackoverflow.com/q/27474897
tags question: http://stackoverflow.com/q/27551868
tags question: http://stackoverflow.com/q/27601462
tags question: http://stackoverflow.com/q/27526666
tags question: http://stackoverflow.com/q/27527495
tags question: http://stackoverflow.com/q/27620052
tags question: http://stackoverflow.com/q/27513802
tags question: http://stackoverflow.com/q/27564389
tags question: http://stackoverflow.com/q/27544456
tags question: http://stackoverflow.com/q/27622064
tags question: http://stackoverflow.com/q/27606769
tags question: http://stackoverflow.com/q/27554480
tags question: http://stackoverflow.com/q/27610931
tags question: http://stackoverflow.com/q/27603571
tags question: http://stackoverflow.com/q/27536535
tags question: http://stackoverflow.com/q/27539610
tags question: http://stackoverflow.com/q/27502466
tags question: http://stackoverflow.com/q/27622658
tags question: http://stackoverflow.com/q/27576524
tags question: http://stackoverflow.com/q/27605340
tags question: http://stackoverflow.com/q/27546730
tags question: http://stackoverflow.com/q/27510656
tags question: http://stackoverflow.com/q/27589845
tags question: http://stackoverflow.com/q/27496052
tags question: http://stackoverflow.com/q/27564929
tags question: http://stackoverflow.com/q/27533132
tags question: http://stackoverflow.com/q/27484328
tags question: http://stackoverflow.com/q/27514451
tags question: http://stackoverflow.com/q/27608928
tags question: http://stackoverflow.com/q/27587363
tags question: http://stackoverflow.com/q/27583632
tags question: http://stackoverflow.com/q/27531800
tags question: http://stackoverflow.com/q/27505394
tags question: http://stackoverflow.com/q/27580502
tags question: http://stackoverflow.com/q/27592407
tags question: http://stackoverflow.com/q/27622236
tags question: http://stackoverflow.com/q/27481261
tags question: http://stackoverflow.com/q/27553056
tags question: http://stackoverflow.com/q/27586463
tags question: http://stackoverflow.com/q/27627666
tags question: http://stackoverflow.com/q/27618195
tags question: http://stackoverflow.com/q/27562391
tags question: http://stackoverflow.com/q/27602358
tags question: http://stackoverflow.com/q/27507862
tags question: http://stackoverflow.com/q/27593560
tags question: http://stackoverflow.com/q/27560541
tags question: http://stackoverflow.com/q/27542762
tags question: http://stackoverflow.com/q/27496314
tags question: http://stackoverflow.com/q/27601677
tags question: http://stackoverflow.com/q/27524416
tags question: http://stackoverflow.com/q/27508315
tags question: http://stackoverflow.com/q/27478138
tags question: http://stackoverflow.com/q/27607238
tags question: http://stackoverflow.com/q/27548562
tags question: http://stackoverflow.com/q/27480354
tags question: http://stackoverflow.com/q/27488471
tags question: http://stackoverflow.com/q/27605293
tags question: http://stackoverflow.com/q/27571656
tags question: http://stackoverflow.com/q/27608439
tags question: http://stackoverflow.com/q/27533956
tags question: http://stackoverflow.com/q/27519927
type: Tag
tags question: http://stackoverflow.com/q/27615912
tags question: http://stackoverflow.com/q/27603431
tags question: http://stackoverflow.com/q/27624921
tags question: http://stackoverflow.com/q/27508675
tags question: http://stackoverflow.com/q/27566606
tags question: http://stackoverflow.com/q/27510849
tags question: http://stackoverflow.com/q/27603141
tags question: http://stackoverflow.com/q/27478924

http://stackoverflow.com/a/55861083
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/27625734
type: Answer
has body: Please check Your project manifest package name and build app in name of package.
downvote count: 1

http://stackoverflow.com/q/27584169
type: UnansweredQuestion
has body: I can't write some characters in my file , any string which has caracter like 'é' 'à' etc.. is written but the mentioned characters are changed into some special characters '@'..., can anyone tell me what's the problem with my code please ? I also want to initially create my file in UTF-16 little endian without bom only little endian, is that the way to do it ? PrintWriter writer = new PrintWriter(file, "UTF-16LE"); @SuppressWarnings("resource") BufferedReader lire = new BufferedReader(new FileReader(file1)); do { String line = lire.readLine(); if (line == null) { break; } //acide folinique Pattern p = Pattern.compile("(.+)"); Matcher m = p.matcher(line); if (m.find()) { byte ptext[] = m.group(1) .getBytes("UTF-16LE"); String line2 = new String(ptext, "UTF-16LE"); String line3 = line2.toLowerCase(); writer.write(line3 + ",.N+subst"); writer.write(System.getProperty("line.separator")); } else { p = Pattern.compile("(.+)\\s.+"); m = p.matcher(line); if (m.find()) { byte ptext[] = m.group(1) .getBytes("UTF-16LE"); String line2 = new String(ptext, "UTF-16LE"); String line3 = line2.toLowerCase(); writer.write(line3 + ",.N+medic"); writer.write(System.getProperty("line.separator")); } } } while (true); writer.close();
has comment: http://stackoverflow.com/comment/43592960
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43595035
tagged with: encoding
has comment: http://stackoverflow.com/comment/43593050
has comment: http://stackoverflow.com/comment/43592915
tagged with: char
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43595078
favorite count: 0
has title: I can't write some characters in my java file (encoding problems)
has answer: http://stackoverflow.com/a/27587802

http://stackoverflow.com/q/27557064
score: -1
tagged with: chess
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43540398
has comment: http://stackoverflow.com/comment/43540659
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43540939
upvote count: 1
has comment: http://stackoverflow.com/comment/43540427
has comment: http://stackoverflow.com/comment/43541958
has comment: http://stackoverflow.com/comment/43540908
type: Question
accepted answer: http://stackoverflow.com/a/27557137
has comment: http://stackoverflow.com/comment/43540552
has comment: http://stackoverflow.com/comment/43540481
has comment: http://stackoverflow.com/comment/43540426
has comment: http://stackoverflow.com/comment/43540461
has comment: http://stackoverflow.com/comment/43540613
has comment: http://stackoverflow.com/comment/43540490
answer count: 1
has body: I have all my other pieces moving without a hitch, but the King is moving and is able to move more than one place at a time which anyone who understands chess understands that is wrong can anyone help? This is my King Code else if(pieceName.contains("King")){ int newY = e.getY()/75; int newX = e.getX()/75; boolean inTheWay = false; int distance = Math.abs(startX-newX); if(((newX &lt; 0) || (newX &gt; 7))||((newY &lt; 0)||(newY &gt; 7))){ validMove = false; } else{ validMove = true; //Check if the move is a diagonal move if(Math.abs(startX-newX)==Math.abs(startY-newY)) { // If there are any pieces along the diagonal in the way the move cannot be made. if((startX-newX &lt; 0)&amp;&amp;(startY-newY &lt; 0)){ for(int i=0; i &lt; distance;i++){ if(piecePresent((initialX+(i*75)), (initialY+(i*75)))){ inTheWay = true; } } } else if((startX-newX &lt; 0)&amp;&amp;(startY-newY &gt; 0)){ for(int i=0; i &lt; distance;i++){ if(piecePresent((initialX+(i*75)), (initialY-(i*75)))){ inTheWay = true; } } } else if((startX-newX &gt; 0)&amp;&amp;(startY-newY &gt; 0)){ for(int i=0; i &lt; distance;i++){ if(piecePresent((initialX-(i*75)), (initialY-(i*75)))){ inTheWay = true; } } } else if((startX-newX &gt; 0)&amp;&amp;(startY-newY &lt; 0)){ for(int i=0; i &lt; distance;i++){ if(piecePresent((initialX-(i*75)), (initialY+(i*75)))){ inTheWay = true; } } } if(inTheWay){ validMove = false; } else{ if(piecePresent(e.getX(), (e.getY()))){ if(pieceName.contains("White")){ if(checkWhiteOponent(e.getX(), e.getY())){ validMove = true; } else{ validMove = false; } } else{ if(checkBlackOponent(e.getX(), e.getY())){ validMove = true; } else{ validMove = false; } } } else{ validMove = true; } } } else if(((Math.abs(startX-newX)!=0)&amp;&amp;(Math.abs(startY-newY) == 0))|| ((Math.abs(startX-newX)==0)&amp;&amp;(Math.abs(newY-startY)!=0))) { if(Math.abs(startX-newX)!=0){ //we have movement along the x axis int xMovement = Math.abs(startX-newX); if(startX-newX &gt; 0){ //movement in the left direction....…
favorite count: 0
has comment: http://stackoverflow.com/comment/43541738
has title: Java Chess King
has answer: http://stackoverflow.com/a/27557137
has comment: http://stackoverflow.com/comment/43540605

http://stackoverflow.com/a/27520593
upvote count: 25
has comment: http://stackoverflow.com/comment/77837912
answers question: http://stackoverflow.com/q/27519399
type: Answer
score: 25
downvote count: 0
has comment: http://stackoverflow.com/comment/43480541
has body: JPA gotcha The reason for setting those to EAGER was because the early JPA 1.0 designers assumed that enforcing JPA implementations to support dynamically initializing Proxies would be a very strong requirement. However, since without Proxies, performance would suffer tremendously, all providers support LAZY associations. Avoid FetchType.EAGER Using the default EAGER fetching strategy for @ManyToOne and @OneToOne associations is a terrible idea as you can easily end up with N+1 query issues. When using Hibernate, once an association is set to FetchType.EAGER, you can no longer fetch it lazily at query time. So, you are always going to fetch that relationship whether the current business use case needs it or not. Use FetchType.LAZY by default So, you are better off using FetchType.LAZY by default for all associations. Unlike FetchType.EAGER, a FetchType.LAZY relationship can be fetched eagerly at query time using a JOIN FETCH clause. The only thing you need to be aware of is that you need to fetch a lazy association in the context of the currently running Persistence Context if you need to access the association after the JPA EntityManager is closed. Otherwise, you are going to get a LazyInitializationException

http://stackoverflow.com/a/27520874
answers question: http://stackoverflow.com/q/27520747
has comment: http://stackoverflow.com/comment/43471076
has comment: http://stackoverflow.com/comment/43471221
has comment: http://stackoverflow.com/comment/43471056
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/43471469
has comment: http://stackoverflow.com/comment/43471374
type: Answer
has body: If you're trying to hide text documents, you can hide them in plain sight using encryption.
score: -1

http://stackoverflow.com/a/27488100
has body: Taking the comment train to a standalone answer: // sets the look and feel to be that of the operating system's try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } I upvoted kiheru, but it seems like you're not setting it at the right time. You need to run this code before the components are displayed - I usually insert this into the original run() method that starts my application, though it varies if I include a splashscreen. Also, in future (especially when talking about GUI code, which can get horrendous) people prefer it if you post runnable code examples, so we can see exactly where you might be getting things wrong :)
has comment: http://stackoverflow.com/comment/43483383
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27486281
has comment: http://stackoverflow.com/comment/43472460
accepted answer of: http://stackoverflow.com/q/27486281
type: Answer

http://stackoverflow.com/q/27614032
has title: want to solve this simple one in java for each loop
has answer: http://stackoverflow.com/a/27614050
has answer: http://stackoverflow.com/a/27614400
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43650039
possible better answer: http://stackoverflow.com/a/27614074
type: Question
has body: for (float f: values) { int a=(int) (f*255); builder.append(' ') .append(a+","); } values is array of float type builder is StringBuilder type on every call I have 3 float values in values array I am trying to append 'a' to builder and ',' here what I am getting is like (255,145,234,) but what I want is like this(255,145,234) I want to omit the last comma your Help is quite helpful to me Thanks.
linked to: http://stackoverflow.com/q/3395286
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/27614050
has answer: http://stackoverflow.com/a/27614074

http://stackoverflow.com/a/27527506
has body: The answer was adding this line of code: locationManager.requestSingleUpdate(locationManager.getBestProvider(c, true), mLocationListener, Looper.myLooper());
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27505198
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27505198
upvote count: 1

http://stackoverflow.com/q/27535132
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27535202
tagged with: bit-shift
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27535202
tagged with: for-loop
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43498744
has title: Can I use a for loop that shifts in 1 new bit each iteration to get some 8-bit number in Java?
favorite count: 0
has body: I am working on implementing an 8-bit adder abstracted with code in Java. This 8-bit adder is built from 8 full adder circuits. For those who don't know what a full adder is, it's a circuit that computes the sum of 2 bits. My intention was to use a for loop to add each corresponding bit of the adders 2, 8-bit inputs, such that a new bit of the 8-bit result is computed each time the for loop iterates. Would it be possible to store the new computed bit of each iteration in a variable holding the 8-bit result using bit shifting? Here's an example to help explain what I am asking. The bold bit would be the one that is shifted into the int holding the result. 0b00001010 + 0b00001011 Initial State Sum: 0 Result: 0b00000000 Carry: 0 First Iteration (addition starting w/ LSB) Sum: 1 Result: 0b00000001 Carry: 0 Second Iteration Sum: 0 Result: 0b00000001 Carry: 1 Third Iteration Sum: 1 Result: 0b00000101 Carry: 0 Fourth Iteration Sum: 0 Result: 0b00000101 Carry: 1 Fifth Iteration Sum: 1 Result: 0b00010101 Carry: 0 Sixth, Seventh, Eigth Iteration Sum: 0, 0, 0 respectively Result: 0b00010101 Carry: 0, 0, 0 respectively
downvote count: 0

http://stackoverflow.com/comment/43598876
type: AnswerComment
type: Comment
has text: Looks like the truth.
comment on: http://stackoverflow.com/a/27587246
score: 0

http://stackoverflow.com/comment/43630793
type: QuestionComment
has text: ??? you are using it: audioTrack.setPlaybackPositionUpdateListener(new ...
comment on: http://stackoverflow.com/q/27602492
score: 0
type: Comment

http://stackoverflow.com/comment/43666514
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27622499
has text: @Jon Skeet: Now I get a StackOverFlowError. I changed the String concatenation to a StringBuffer.append and after this with toString, but it doesn't seem to work.

http://stackoverflow.com/comment/44248324
has text: Many thanks, I need to know the entire path of the JMenu clicked to reached the JMenuItem. Could you please tell me how to travel back up the component hierarchy to retrieve the complete path of the selected JMenuItem?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27533101
type: Comment

http://stackoverflow.com/a/38433595
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27583271
has body: I created an issue in the GitHub but I also managed to workaround the problem. Please refer to https://github.com/gvSIGAssociation/gvnix/issues/28

http://stackoverflow.com/comment/43489765
has text: You are doing your brain a disservice by not attempting. You'd be surprised what you can do when you make a conscious effort. You should look into the `split()` method, but it's far more rewarding to at least make an attempt and then come here to see where you went wrong.
score: 0
comment on: http://stackoverflow.com/q/27530527
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27523162
has title: Compare a string date from xml file with today's date and delete the node from the xml if the date has expired. The string date is in format dd/MM/yy
score: 1
tagged with: java
type: Question
has body: public void BrisiOdXML(List&lt;Nastani&gt; lista) { try { //reading from xml File fXmlFile = new File("/Users/Darko/workspace/Seminarska_1/nastani.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("Nastan"); //today's date // i can't get today's date in dd/MM/yy format without the time Calendar today = Calendar.getInstance(); today.set(Calendar.HOUR_OF_DAY, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.SECOND, 0); today.set(Calendar.MILLISECOND, 0); //searching the list for (int temp = 0; temp &lt; nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; //string date from xml dile in format dd/MM/yy Date datexml = (Date) new SimpleDateFormat("dd/MM/yy").parse(eElement.getElementsByTagName("Datum").item(temp).getTextContent()); //comparing today's date with date from the xml file if (today.after(datexml)) { //removing node nNode.getParentNode().removeChild(nNode); doc.normalize(); prettyPrint(doc); } } } } catch (Exception e) { e.printStackTrace(); } } //printing the new xml file public static final void prettyPrint(Document xml) throws Exception { Transformer tf = TransformerFactory.newInstance().newTransformer(); tf.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); tf.setOutputProperty(OutputKeys.INDENT, "yes"); Writer out = new StringWriter(); tf.transform(new DOMSource(xml), new StreamResult(out)); System.out.println(out.toString()); } } // it suppose to delete the node from the xml file if the date has expired, but when i read the xml list it only displays error messages and shows tho whole list
downvote count: 0
tagged with: date
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27523307
upvote count: 1

http://stackoverflow.com/q/27554808
tagged with: broadcast
accepted answer: http://stackoverflow.com/a/27555762
score: 0
has body: I'm currently working on (an existing) Android app using native c++ code. I want send a broadcast to another Android Java app listening to a BroadcastReceiver. The receiving app is yet working, but I can't figure out how to broadcast data from JNI code either directly or by sending the values to java code and them broadcasting it from Java. I hope my explanaion is clear. Can someone help me on how to accomplish this? Thanks!
tagged with: android
has answer: http://stackoverflow.com/a/27555762
type: AnsweredQuestion
has title: Android jni broadcast to java
tagged with: java-native-interface
tagged with: java
possible better answer: http://stackoverflow.com/a/47602393
type: Question
answer count: 2
tagged with: native
has answer: http://stackoverflow.com/a/47602393

http://stackoverflow.com/comment/43569683
type: Comment
type: QuestionComment
has text: Have you read the [documentation](http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/#multiple-httpsecurity)?
comment on: http://stackoverflow.com/q/27571178
score: 0

http://stackoverflow.com/comment/43688218
type: Comment
comment on: http://stackoverflow.com/a/27624607
score: 0
type: AnswerComment
has text: @MarkRotteveel Nifty!

http://stackoverflow.com/q/27567912
has comment: http://stackoverflow.com/comment/43561101
type: Question
has body: I am using some Enterprise application which requires different java version. One application requires java 1.6 update 15 but another application requires java 1.7 update 55. In my system I cannot use both the application simultaneously.I have to switch between the java versions in control panel frequently in order to access both. So how could I access both the application without these issues.? Thanks in advance.
score: 0
tagged with: java
answer count: 1
has title: How to make an java application compatible with multiple java version
tagged with: compatibility
tagged with: version-control
has answer: http://stackoverflow.com/a/27568333
type: UnansweredQuestion

http://stackoverflow.com/q/27528826
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43486199
score: -2
answer count: 1
has body: First off, I'm pretty green when it comes to java. So, I'm making a rock paper scissors game with 2 classes and an object connecting the two. For some unknown reason, when I use the object, it cannot find the method im pointing to. The error is "cannot find symbol" and is in the first class where it is game.RockPaperScissors(); public class RPSRunner { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); char response; //add in a do while loop after you get the basics up and running out.print("type in your prompt [R,P,S] :: "); String player = keyboard.nextLine(); RockPaperScissors game = new RockPaperScissors(); do { game. **RockPaperScissor **(player); } while (player == r || p || s); } } and public class RockPaperScissors { String playChoice; String compChoice; Random random = new Random(); int rand = 0; public RockPaperScissors() { playChoice = " "; compChoice = " "; } public RockPaperScissors(String player) { setPlayers(player); } public void setPlayers(String player) { playChoice = player; rand = random.nextInt(3); if (rand == 0) { compChoice = "r"; } if (rand == 1) { compChoice = "p"; } if (rand == 2) { compChoice = "s"; } System.out.println("player had " + playChoice); System.out.println("computer had " + compChoice); } public String determineWinner() { String winner = ""; if ((compChoice == "r") &amp;&amp; (playChoice == "p")) ; { winner = "!Player wins &lt;&lt; Paper covers Rock&gt;&gt;!"; } if ((compChoice == "r") &amp;&amp; (playChoice == "s")) ; { winner = "! Computer wins &lt;&lt; Rock breaks Scissors &gt;&gt;!"; } if ((compChoice == "p") &amp;&amp; (playChoice == "r")) ; { winner = "! Computer wins &lt;&lt; Paper covers Rock&gt;&gt;!"; } if ((compChoice == "p") &amp;&amp; (playChoice == "s")) ; { winner = "!Player wins &lt;&lt; Scissors cuts paper &gt;&gt;!"; } if ((compChoice == "s") &amp;&amp; (playChoice == "p")) ; { winner = "! Computer wins &lt;&lt; Scissors cuts paper &gt;&gt;!"; } if ((compChoice == "s") &amp;&amp…
has comment: http://stackoverflow.com/comment/43486585
has answer: http://stackoverflow.com/a/27528952
accepted answer: http://stackoverflow.com/a/27528952
has title: Unknown issue finding symbol in Java code
has comment: http://stackoverflow.com/comment/43486185
favorite count: 0
downvote count: 2
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/27511847
downvote count: 1
type: Question
has body: I am confused alot in java class-paths. Here is a example question and i am failed to understand the correct option. Please look at images below. It states option A is correct where i thought Option C is correct. Can someone explain, why C is not the correct option and A is correct. Thanks.
accepted answer: http://stackoverflow.com/a/27512077
score: 0
answer count: 1
has title: How classpath is working in this example?
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27512077
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/43641577
has text: I'm puking because of `target == "Ocean"` and `Country == "USA"`. **PLEASE**, compare Strings with .equals() !!! *sigh*
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27609389
score: 0

http://stackoverflow.com/q/27634094
type: Question
tagged with: java
tagged with: hadoop
score: 0
linked to: http://stackoverflow.com/q/43157
answer count: 2
accepted answer: http://stackoverflow.com/a/27634624
possible better answer: http://stackoverflow.com/a/27634743
has comment: http://stackoverflow.com/comment/43689606
has body: i am newbie to hadoop, and trying to upload and download files to hdfs via. Java code. which should behave as Data Uploading: hadoop fs -put or -copyFromLocal filename directoryName and Data Downloading hadoop fs -get or -copyToLocal filename directoryName from hdfs. i need this one because datasets contain image, audio, video etc file. above command works fine with all type of data, if i try using Java i/o reader code , it is working fine for text files , but not for images, video. docx etc.. pls any help here. Edited Here: public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Configuration conf=new Configuration(); FileSystem fs = FileSystem.get(conf); Path path=new Path("data"); Path file=new Path(path,"screenshots.png"); BufferedImage image = ImageIO.read(new File("/home/hduser/Desktop/screenshots.png")); if (!fs.exists(path)) throw new IOException("Output not found!"); ImageIO.write(image, "png", fs.open(path)); } As asked i have edited here code that i am using to upload image file to hdfs. here ImageIO.write is not accepting arguement fs.open(path) , because is asking for file, but i have to give path here as to read and to write to hdfs we need to give path only. Actually i am in need of a method to upload and download file from hdfs using code for all type of data, so i should not write code and use plugins for all type of file.
has title: How to upload and download file to hdfs using Java code
has answer: http://stackoverflow.com/a/27634624
has comment: http://stackoverflow.com/comment/43687856
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27634743

http://stackoverflow.com/q/27578349
has comment: http://stackoverflow.com/comment/43581570
score: 0
has body: im trying to get text from edit text and check if it is True or False and if not display an error message correcttxt=correctans.getText().toString(); if ((!correcttxt.equals("True")) || (!correcttxt.equals("False"))){ AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AdminAdd4.this); alertBuilder.setTitle("Invalid"); alertBuilder.setMessage("The correct answer should be True or False."); alertBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertBuilder.create().show(); } else { //confirmation to add exercise AlertDialog.Builder alertBuilder=new AlertDialog.Builder(AdminAdd4.this); alertBuilder.setTitle("Add Exercise"); alertBuilder.setMessage("Are you sure you want to add this exercise?"); alertBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); new CreateNewexercise().execute(); } }); alertBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); alertBuilder.create().show(); } but this will always display the error message even when the text is True or False i don't know why ? can someone help please ? thank you :)
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/43581493
type: UnansweredQuestion
type: Question
tagged with: java
has title: checking edittext text always return false

http://stackoverflow.com/a/27567842
downvote count: 1
answers question: http://stackoverflow.com/q/27567356
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/43562509
has body: Check if MANIFEST.MF file inside generated jar contains SplashScreen-Image entry, if not try to correct your existing manifest file inside your project and don't forget to add end of line to it. From Oracle Modifying a Manifest File : Warning: The text file from which you are creating the manifest must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.
accepted answer of: http://stackoverflow.com/q/27567356
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27504715
favorite count: 0
has body: I found the following excerpt in a Java Textbook: "I've seen examples that don't use a separate Runnable Implementation, but Instead Just make a subclass of Thread and override the Thread's runO method. That way,you call the Thread's no-arg constructor when you make the new thread; Thread t = new Thread(); //no Runnable" Shouldn't the last line be Thread t = new &lt;Some class that extends Thread class and over rides its run method&gt;(); Am I correct? Could somebody provide sample code that illustrates the above excerpt?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43439473
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43439597
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27504752
has answer: http://stackoverflow.com/a/27504766
downvote count: 0
has comment: http://stackoverflow.com/comment/43439465
has title: How to run threads without using Runnable implementations?
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27504809

http://stackoverflow.com/q/27583800
has comment: http://stackoverflow.com/comment/43592229
tagged with: paintcomponent
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/43592317
possible better answer: http://stackoverflow.com/a/27584038
has comment: http://stackoverflow.com/comment/43592369
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43592093
downvote count: 1
has answer: http://stackoverflow.com/a/27584038
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27584343
has comment: http://stackoverflow.com/comment/43592356
tagged with: jpanel
has body: I'm developing a Java Game. I'm stuck at a point,where I need to restart the whole game again after GameOver. Here is the skeleton of my program: package projectflappy; import java.awt.*; public final class TheGame extends JFrame implements MouseListener{ JPanel jp; //declaration of the varibles int x_width = 500; int y_height = 500; int count = 5 ; Ellipse2D Ball; int x_ball; int y_ball; int cord_xup1,cord_xdown1; int cord_xup2,cord_xdown2; int cord_xup3,cord_xdown3; int cord_xup4,cord_xdown4; int cord_xup5,cord_xdown5; Boolean flag = true; RoundRectangle2D up1,down1,up2,down2,up3,down3,up4,down4; Font font = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,40); Font font1 = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,20); Font font3 = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,20); float das[] = {10.0f}; BasicStroke color = new BasicStroke(10,BasicStroke.CAP_ROUND,BasicStroke.JOIN_BEVEL,20.0f,das,0.0f); GradientPaint gp2 = new GradientPaint(20, 0, Color.DARK_GRAY, 0, 10, Color.GRAY, true); GradientPaint gp3 = new GradientPaint(30, 0, Color.BLACK, 0, 20, Color.GREEN, true); Toolkit kit = Toolkit.getDefaultToolkit(); //Getting the "background.jpg" image we have in the folder Image background = kit.getImage("D:\\College\\Programs\\ProjectFLAPPY\\src\\projectflappy\\1.png"); JLabel a = new JLabel("Get Ready ! Click to Start."); JLabel retry = new JLabel(new ImageIcon("D:\\College\\Programs\\ProjectFLAPPY\\src\\projectflappy\\unnamed.png")); int score = 0; //constructor public TheGame() throws IOException { super("Simple Drawing"); setSize(x_width, y_height); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); jp = new DrawingPanel(); add(jp); addMouseListener(this); } ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { update(); repaint(); } }; Timer t = new Timer(50,action); public void init() { x_ball = 30; y_ball = 200; cord_xup1 = 175; cord_xdown1 = 175; cord_xup2 = 320; c…
has comment: http://stackoverflow.com/comment/43620305
type: Question
has comment: http://stackoverflow.com/comment/43592411
answer count: 2
score: 0
has title: Adding JPanel after removing it from JFrame
accepted answer: http://stackoverflow.com/a/27584343
has comment: http://stackoverflow.com/comment/43596624
has comment: http://stackoverflow.com/comment/43592501
has comment: http://stackoverflow.com/comment/43620777

http://stackoverflow.com/a/57695681
answers question: http://stackoverflow.com/q/27583623
has body: Look's like no, cause creating chunks means reducing stream, and reduce means termination. If you need to maintain stream nature and process chunks without collecting all data before here is my code (does not work for parallel streams): private static &lt;T&gt; BinaryOperator&lt;List&lt;T&gt;&gt; processChunks(Consumer&lt;List&lt;T&gt;&gt; consumer, int chunkSize) { return (data, element) -&gt; { if (data.size() &lt; chunkSize) { data.addAll(element); return data; } else { consumer.accept(data); return element; // in fact it's new data list } }; } private static &lt;T&gt; Function&lt;T, List&lt;T&gt;&gt; createList(int chunkSize) { AtomicInteger limiter = new AtomicInteger(0); return element -&gt; { limiter.incrementAndGet(); if (limiter.get() == 1) { ArrayList&lt;T&gt; list = new ArrayList&lt;&gt;(chunkSize); list.add(element); return list; } else if (limiter.get() == chunkSize) { limiter.set(0); } return Collections.singletonList(element); }; } and how to use Consumer&lt;List&lt;Integer&gt;&gt; chunkProcessor = (list) -&gt; list.forEach(System.out::println); int chunkSize = 3; Stream.generate(StrTokenizer::getInt).limit(13) .map(createList(chunkSize)) .reduce(processChunks(chunkProcessor, chunkSize)) .ifPresent(chunkProcessor); static Integer i = 0; static Integer getInt() { System.out.println("next"); return i++; } it will print next next next next 0 1 2 next next next 3 4 5 next next next 6 7 8 next next next 9 10 11 12 the idea behind is to create lists in a map operation with 'pattern' [1,,],[2],[3],[4,,]... and merge (+process) that with reduce. [1,2,3],[4,5,6],... and don't forget to process the last 'trimmed' chunk with .ifPresent(chunkProcessor);
upvote count: 4
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/q/27602492
has comment: http://stackoverflow.com/comment/43628037
linked to: http://stackoverflow.com/q/27541201
has comment: http://stackoverflow.com/comment/43630419
tagged with: audio
has comment: http://stackoverflow.com/comment/43628021
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43630148
linked to: http://stackoverflow.com/q/7642704
has comment: http://stackoverflow.com/comment/43627894
has comment: http://stackoverflow.com/comment/43627904
has comment: http://stackoverflow.com/comment/43630922
type: Question
has comment: http://stackoverflow.com/comment/43629326
has comment: http://stackoverflow.com/comment/43630939
has comment: http://stackoverflow.com/comment/43629427
linked to: http://stackoverflow.com/q/3643338
upvote count: 1
answer count: 1
has body: This is the code I am using: void playSound(){ final AudioTrack audioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, generatedSnd.length, AudioTrack.MODE_STATIC); // audioTrack.setNotificationMarkerPosition(generatedSnd.length/2); audioTrack.setNotificationMarkerPosition(1); audioTrack.setPlaybackPositionUpdateListener(new AudioTrack.OnPlaybackPositionUpdateListener() { @Override public void onPeriodicNotification(AudioTrack track) { // nothing to do } @Override public void onMarkerReached(AudioTrack track) { // Log.d(LOG_TAG, "Audio track end of file reached..."); // messageHandler.sendMessage(messageHandler.obtainMessage(PLAYBACK_END_REACHED)); Log.d("MY LOG", "Audio track end of file reached..."); bitPatternValTextView.setText("End of play"); } }); audioTrack.write(generatedSnd, 0, generatedSnd.length); audioTrack.play(); } The playSound() function is defined inside public class InSituActivity extends ActionBarActivity{...} My assumption was that when the playback of the AudioTrack reached the Nth audio sample (each N being a short or 2 bytes) then audioTrack.setNotificationMarkerPosition(N); would cause onMarkerReached(AudioTrack track) to be called. However as shown in my example code I have tried both generatedSnd.length/2 (generatedSnd[] is an array of bytes that contains the audio samples I want to play) as well as using small constant values such 1, 10 or 20, and onMarkerReached() does not seem to get called in any of those situations. What is wrong here and how do I fix it? I want to be able to play another sound when the current AudioTrack finishes playback. The playSound() function itself will be called in a thread (seperate from the UI thread). Here is where I got the code from: How to tell when AudioTrack object has finished playing? Other references: AudioTrack: how to detect end of sound? Confusion about Thread life and AudioTrack in android java
has answer: http://stackoverflow.com/a/42852432
has comment: http://stackoverflow.com/comment/43630084
favorite count: 0
tagged with: audiotrack
has comment: http://stackoverflow.com/comment/43630793
has comment: http://stackoverflow.com/comment/43628001
tagged with: android
has comment: http://stackoverflow.com/comment/43628714
has comment: http://stackoverflow.com/comment/43627720
downvote count: 0
type: UnansweredQuestion
has title: End of playback detection in AudioTrack is not working

http://stackoverflow.com/q/27497890
tagged with: android-drawable
has answer: http://stackoverflow.com/a/27498070
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43427116
has comment: http://stackoverflow.com/comment/43427137
has comment: http://stackoverflow.com/comment/43427144
score: 0
has comment: http://stackoverflow.com/comment/43427147
tagged with: sdk
answer count: 1
has body: I am trying to paste a few images to drawable-hdpi folder of eclipse, directly by ctrl-c and ctrl-v. So far it was working. But now suddenly eclipse is giving an error cannot paste the clipboard contents into the selected elements I tried pasting directly into my project folder. I also tried cleaning the project and closing the eclipse. It still gives the same error. Error is not only with the current project but with the other projects too. Cannot paste the images in any project's drawable folder. Can somebody tell me what the problem is? Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/43427226
accepted answer: http://stackoverflow.com/a/27498070
tagged with: android
upvote count: 1
has title: Android: Cannot paste images to drawable-hdpi folder in eclipse
type: AnsweredQuestion

http://stackoverflow.com/q/27499013
has comment: http://stackoverflow.com/comment/43429015
answer count: 1
has comment: http://stackoverflow.com/comment/43428992
has comment: http://stackoverflow.com/comment/43428970
has comment: http://stackoverflow.com/comment/43428943
has comment: http://stackoverflow.com/comment/43429080
has comment: http://stackoverflow.com/comment/43429166
type: UnansweredQuestion
has title: values keep looping
tagged with: foreach
has body: This is what I did. I want to get the stockid, stock name and stockprice under each . But unfortunately, it keeps on looping. What I means is that, it suppose to only have S0001 XXX 19.90 but instead it is having S0001 ABC 19.90, S0002 ABC 19.90, S0003 ABC 19.90, S0004 ABC 19.90. Then it will go back to S0001 and ABC will change to the next value in my database. This means that my stockname loop 4 times while my stockprice loop 12 times. <sql:setDataSource url="jdbc:derby://localhost:1527/healthdb;user=nbuser;password=nbuser" driver="org.apache.derby.jdbc.ClientDriver" var="Derbydata"/> <sql:query sql=" SELECT stockid FROM STOCKS" dataSource="${Derbydata}" var="STOCKS" /> <sql:query sql=" SELECT stockname FROM STOCKS" dataSource="${Derbydata}" var="STOCKS1" /> <sql:query sql=" SELECT stockprice FROM STOCKS" dataSource="${Derbydata}" var="STOCKS2" /> Stock ID Stock Name Stock Price <c:forEach var="row3" items ="${STOCKS2.rowsByIndex}"> <c:forEach var="row2" items ="${STOCKS1.rowsByIndex}"> <c:forEach var="row1" items="${STOCKS.rowsByIndex}"> <c:out value="${row1[0]}"/> <c:out value="${row2[0]}"/> <c:out value="${row3[0]}"/>
tagged with: java
has answer: http://stackoverflow.com/a/27499199
type: Question
tagged with: database
tagged with: jsp
score: 0
tagged with: sql

http://stackoverflow.com/q/27574537
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
has title: spring mvc requestmapping dynamic url
tagged with: spring-mvc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27574695
tagged with: java
score: 4
has body: How do I change my request mapping for dynamic urls? URLs might look like this: http://zz.zz.zz.com:8080/webapp/p1/q9/e3/test?Id=2&amp;maxrows=5 http://zz.zz.zz.com:8080/webapp/a1/b2/c3/test?Id=2&amp;maxrows=5 http://zz.zz.zz.com:8080/webapp/x1/y2/z3/test?Id=2&amp;maxrows=5 Here's the working controller syntax when the url is in this format: http://zz.zz.zz.com:8080/webapp/test?Id=2&amp;maxrows=5 @RequestMapping(value = "/test", method = RequestMethod.GET) public @ResponseBody void test( @RequestParam(value = "Id", required = true) String Id, @RequestParam(value = "maxrows", required = true) int maxrows ) throws Exception { System.out.println("Id: " + Id + " maxrows: " + maxrows); }
type: Question
upvote count: 4
tagged with: controller

http://stackoverflow.com/comment/43606427
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27591253
type: AnswerComment
has text: AIR is not Javascript. There is a way to build an AIR app using either HTML/Javascript or Actionscript, but IME the more typical way is Actionscript.

http://stackoverflow.com/comment/43549684
has text: Thanks... nice to know.... so I wouldn't have to spend more time on it for now, and resort to defining record type (ugh). Thanks!
type: Comment
comment on: http://stackoverflow.com/a/27562054
type: AnswerComment
score: 0

http://stackoverflow.com/a/31463613
has body: We went with aspectj. Not the best solution, but the only option we got.
type: Answer
has comment: http://stackoverflow.com/comment/136357045
answers question: http://stackoverflow.com/q/27487979
score: 0

http://stackoverflow.com/q/27525125
tagged with: spring-social
downvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
answer count: 0
upvote count: 3
has body: I tried to integrate spring security and spring social. The problem is when I try to create account for him in my system. I would like to avoid creating user with id "anonymousUser". For expected behaviour when I analyzed code from spring-social-security I expected to call method JdbcUsersConnectionRepository.findUserIdsWithConnection(Connection connection) for creating user and entry in the system. But when I run my code I find out this is not true. Before this action is calling implementation of SocialConfigurer.getUserId(). Great... If we have anonymous user it will be cached... But anyway getUserId is called before anything so authorization doesn't work. So I wrote my own implementation to this thing: @Configuration @EnableSocial public class SocialConfig implements SocialConfigurer { @Autowired private DataSource dataSource; @Autowired private CustomerService customerService; @Autowired private CustomerProviderRepository customerProviderRepository; @Autowired private PasswordEncoder passwordEncoder; @Override public void addConnectionFactories(ConnectionFactoryConfigurer connectionFactoryConfigurer, Environment environment) { } @Override public UserIdSource getUserIdSource() { return () -&gt; { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null || authentication.getName().equals("anonymousUser")) { throw new IllegalStateException("Unable to get a ConnectionRepository: no user signed in"); } return authentication.getName(); }; } @Override public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) { JdbcUsersConnectionRepository repository = new JdbcUsersConnectionRepository(dataSource, connectionFactoryLocator, Encryptors.noOpText()); repository.setConnectionSignUp(new SocialConnectionSignUpService(customerService, customerProviderRepository, passwordEncoder)); return repository; } } Implementation of SocialCOnnectionSignUpService public class So…
type: Question
score: 3
tagged with: java
has title: Spring social and security integration (vs anonymouse user)

http://stackoverflow.com/comment/76850180
comment on: http://stackoverflow.com/a/27571696
score: 0
type: AnswerComment
has text: @PoweredByRice post edited accordingly. Thanks for the hint !
type: Comment

http://stackoverflow.com/a/27601600
score: 0
answers question: http://stackoverflow.com/q/27600820
type: Answer
has body: Check your versions. As you can see in documentation for Java 5, schema attribute doesn't exist. But, in documentation for Java 6 it is there. It's just the matter of what you use / what you need.

http://stackoverflow.com/q/27609818
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43642134
score: 1
has comment: http://stackoverflow.com/comment/43642056
tagged with: java
has title: HTML tag regex doesen't work
possible better answer: http://stackoverflow.com/a/27609939
accepted answer: http://stackoverflow.com/a/27609946
type: Question
has body: Why this code doesen't return "" ? What regex should I use to replace all tags from a html file? x = x.replaceAll("<.*>", " current community "); Thanks!
has answer: http://stackoverflow.com/a/27609939
has comment: http://stackoverflow.com/comment/43641927
downvote count: 0
has comment: http://stackoverflow.com/comment/43641919
linked to: http://stackoverflow.com/q/1732348
answer count: 3
has comment: http://stackoverflow.com/comment/43642114
favorite count: 0
has answer: http://stackoverflow.com/a/27610204
has answer: http://stackoverflow.com/a/27609946
has comment: http://stackoverflow.com/comment/43641992
upvote count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/43641961
has comment: http://stackoverflow.com/comment/43642014

http://stackoverflow.com/a/37461258
upvote count: 3
has comment: http://stackoverflow.com/comment/72005959
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27547773
has comment: http://stackoverflow.com/comment/62448899
has comment: http://stackoverflow.com/comment/62461691
has body: This is where the wonderful "Marker" feature of SLF4J/Logback comes in very handy. Say you want to log to the console all warnings/errors, as well as anything that's a special "Status" message. You can have a class do logging like this: public class MyClass { private static final Marker status = MarkerFactory.getMarker("STATUS"); private static final Logger logger = LoggerFactory.getLogger(MyClass.class); public void doSomething() { logger.info(status, "Beginning"); logger.info("Regular info log"); logger.warn("Warning"); logger.info(status, "Done"); } } Then, in logback.xml, you filter to show all warnings and messages marked "STATUS": STATUS ACCEPT NEUTRAL WARN ${pattern} Basically, you have the logger's level be DEBUG so that everything goes to the appender, and then in the appender do further filtering to get the exact lines you're looking for. If you are trying to have more different logging levels for different classes it can get a bit trickier, but Logback gives a lot of flexibility with filters (and you can even make your own filters if needed) which lets one handle pretty much anything needed.

http://stackoverflow.com/comment/43555147
type: AnswerComment
has text: This is just what i needed. As you said, maybe i will have problems in the future due to lack of visibility, probably in test cases i believe, but for that i can always use reflection to get class reference. Thanks!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27564614

http://stackoverflow.com/comment/43399353
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27479510
type: AnswerComment
has text: Thanks.. that was awesome.. i still need one me help.. can u help me modify a php script to speak latest version of php n mysqli.. cos i learned with latest versions.. And i cant modify if i dont speak the older versions of php.. thanks in advance

http://stackoverflow.com/comment/43494960
type: Comment
comment on: http://stackoverflow.com/a/27532786
has text: single / pool executor isnt a problem ..if u see the foreach:loop where i spawn the individual file tasks .i want executor to be synchronized in a way that it should wait till the first executor job has ended .
score: 0
type: AnswerComment

http://stackoverflow.com/a/27493952
accepted answer of: http://stackoverflow.com/q/27493903
score: 2
answers question: http://stackoverflow.com/q/27493903
upvote count: 3
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43419539
has body: First, as written, to call getAverage and standardDeviation from main, they must be declared static, because you're in a static context in main. Second, pass the int[] you declared called arrlist to these methods. You don't pass the return type; you pass the input. mean = getAverage(arrlist); System.out.println(mean); System.out.println(standardDeviation(arrlist, mean));
type: Answer

http://stackoverflow.com/q/27540240
tagged with: java
type: Question
score: 0
tagged with: encoding
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27540803
accepted answer: http://stackoverflow.com/a/27540803
favorite count: 0
has body: I am trying to write Word doc (as an XML ) to the response using Spring 4 I set the setContentType to be utf-8 response, The source xml is encoded in UTF-8 But some of the UTF-8 characters are getting as gibberish What am I doing wrong? @RequestMapping(method = RequestMethod.GET, params="action=downloadDocument" ) public @ResponseBody void getDocumentForStudent(@RequestParam("student_id")String student_id, HttpServletResponse response) { try { response.setContentType("application/msword;charset=utf-8"); response.setHeader("Content-encoding","UTF-8"); response.setHeader("Content-disposition", "attachment;filename=Document" + student_id +".doc"); // document path here InputStream is = new FileInputStream(document); BufferedReader rdr = new BufferedReader(new InputStreamReader(is)); String buf = null; PrintWriter output = response.getWriter(); Set&lt;String&gt; keySet = replaceTokens.keySet(); while ((buf = rdr.readLine()) != null) { for (String key : keySet) { buf = buf.replace(key, tokens.get(key)); } output.print(buf); } response.flushBuffer(); rdr.close(); } catch (IOException ex) { logger.error("Error writing file to output stream. ", ex); throw new RuntimeException("IO Error reading or writing file to output stream!",ex); } }
tagged with: utf-8
tagged with: spring
has title: Spring write to UTF-8 response encoding issues
type: AnsweredQuestion

http://stackoverflow.com/comment/43613468
type: QuestionComment
has text: i tried without -1 it give this error **Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(String.java:694) at exam2Programing2_28_12_2010.Question4.main(Question4.java:19)**
comment on: http://stackoverflow.com/q/27594811
score: 0
type: Comment

http://stackoverflow.com/q/27591043
has body: I am doing classic Producer-Consumer problem in Java using low level synchronization and wait() and notify(). I know there are better implementations using structures from java.util.concurrent package but my problem revolves around low level implementation: private static ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); static Object obj = new Object(); public static void producer() throws InterruptedException { synchronized (obj) { while (true) { if (list.size() == 10) { System.out.println("Queue full.. Waiting to Add"); obj.wait(); } else { int value = new Random().nextInt(100); if (value &lt;= 10) { Thread.sleep(200); System.out.println("The element added was : " + value); list.add(value); obj.notify(); } } } } } public static void consumer() throws InterruptedException { synchronized (obj) { while (true) { Thread.sleep(500); if (list.size() == 0) { System.out.println("Queue is empty...Waiting to remove"); obj.wait(); } else { System.out.println("The element removed was : " + list.remove(0)); obj.notify(); } } } } There are 2 threads in the program, 1 each for producer and consumer specifically. The code works just fine. The only issue is that producer goes on to produce messages until the maximum at once (until size is 10 for the list), and consumer consumes all 10 at once. How can I make producer and consumer work at the same time? This is the sample output: The element added was : 4 The element added was : 0 The element added was : 0 The element added was : 4 The element added was : 3 The element added was : 1 The element added was : 10 The element added was : 10 The element added was : 3 The element added was : 9 Queue full.. Waiting to Add The element removed was : 4 The element removed was : 0 The element removed was : 0 The element removed was : 4 The element removed was : 3 The element removed was : 1 The element removed was : 10 The element removed was : 10 The element removed was : 3 The element removed was : 9 Queue is empty...Waiting to…
has answer: http://stackoverflow.com/a/45631730
type: Question
has title: Producer Consumer Program using wait() and notify() in Java
has answer: http://stackoverflow.com/a/27591677
tagged with: producer-consumer
has comment: http://stackoverflow.com/comment/43605876
upvote count: 3
has comment: http://stackoverflow.com/comment/43606116
downvote count: 1
has comment: http://stackoverflow.com/comment/43605895
possible better answer: http://stackoverflow.com/a/42456249
has comment: http://stackoverflow.com/comment/43605861
has answer: http://stackoverflow.com/a/52460682
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/42456249
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43605936
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/43606050
tagged with: java
accepted answer: http://stackoverflow.com/a/27591677

http://stackoverflow.com/comment/43788522
comment on: http://stackoverflow.com/q/27577772
has text: @mmlooloo for now i am just printing a sample text in my logcat using Log.e("fragment","name"); in my oncreateView()
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/27557376
has answer: http://stackoverflow.com/a/29249067
has comment: http://stackoverflow.com/comment/43541095
has comment: http://stackoverflow.com/comment/43596118
type: UnansweredQuestion
has body: Right now in my Java online class, I am on a GUI unit and I need to run applets from HTML files. After making an HTML file with an applet, when I opened it in my browser (Chrome) it wouldn't run because of the security settings. What should I do?
type: Question
has comment: http://stackoverflow.com/comment/43541024
has comment: http://stackoverflow.com/comment/43541068
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/43540969
has title: Can't run applets in browser
answer count: 1
tagged with: applet
tagged with: security
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/43528483
type: AnswerComment
comment on: http://stackoverflow.com/a/27549984
score: 0
type: Comment
has text: Appreciate, after i done i will post my updated code

http://stackoverflow.com/comment/43648847
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27613041
type: QuestionComment
has text: result is not your input . Besides can't input with the rules in code.

http://stackoverflow.com/q/27485594
score: 0
has answer: http://stackoverflow.com/a/27485650
answer count: 1
has title: how to use same instance of client for multiple message in Java Nio
has comment: http://stackoverflow.com/comment/43498972
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: client-server
has body: I am using Java Nio for Client server communication below are the code of client as well as server. server: public class BufferChannelExample { private static String clientChannel = "clientChannel"; private static String serverChannel = "serverChannel"; private static String channelType = "channelType"; private static Selector selector = null; static BufferChannelExample bufferChannelExample = null; static int port1 = 1114; //static String localhost1 = "192.168.1.35"; static String localhost1 = "192.168.1.88"; ByteBuffer buffer; static String msgFromClient = ""; static MsgSaver msgSaver; public static void main(String[] args) { // readFileChannel(); //msgSaver = new MsgSaver(); bufferChannelExample = new BufferChannelExample(); serverSocketExample(); } public static void writeToChannels() { if(selector == null) return; if(!selector.isOpen()) return; Set multipleKeys = selector.keys(); System.out.println("multipleKeys.size() : "+multipleKeys.size()); for (int i = 0; i &lt; multipleKeys.size(); i++) { System.out.println("multipleKeys: "+multipleKeys.toString()); } MulticastSocket multicastSocket = null; try { multicastSocket = new MulticastSocket(port1); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Iterator&lt;SelectionKey&gt; mkIterator = multipleKeys.iterator(); while (mkIterator.hasNext()) { SelectionKey sKey = mkIterator.next(); // System.out.println("mk rAddr : "+((SocketChannel)sKey.channel()).getRemoteAddress().toString()); // if(sKey == key){ // if((sKey.readyOps() &amp; SelectionKey.OP_ACCEPT) != SelectionKey.OP_ACCEPT){ if(((Map&lt;?, ?&gt;) sKey.attachment()).get(channelType).equals( clientChannel)){ System.out.println("isWritable() --- &gt; "+sKey.isWritable()); System.out.println("RemoteSocketAddress : "+((SocketChannel)sKey.channel()).socket().getRemoteSocketAddress()); // write something to the new created client CharBuffer buffer; if(msgFromClient.equalsIgnoreCase("")) { buffer = CharBuffer.wrap("Hello client ne…
tagged with: nio

http://stackoverflow.com/a/48163045
has comment: http://stackoverflow.com/comment/110249488
answers question: http://stackoverflow.com/q/27602598
has body: In addition to the other answer: If possible, you should instead mock the interface, meaning create the mock like this: SampleInterface mockedClass = mock(SampleInterface.class); // not mock(MockedClass)
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/27504562
type: Answer
has body: The following code works fine , however i don't want to use any deprecated apis. ... ... String timeInterval = "18:01"; Date date = simpleDateFormat.parse(timeInterval); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, date.getHours()); calendar.set(Calendar.MINUTE, date.getMinutes()); date = calendar.getTime(); System.out.println(date); ... ...
answers question: http://stackoverflow.com/q/27502519
has comment: http://stackoverflow.com/comment/43439783
accepted answer of: http://stackoverflow.com/q/27502519
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43426114
type: AnswerComment
comment on: http://stackoverflow.com/a/27494589
type: Comment
has text: So soon i'll update this with some more information but the long and short of it is that updates I make to the PATH and JAVA_HOME variables don't seem to be matching the variables listed in the shell via the $ env command. The PATH variable looks correct when I pull it up through the cmd prompt or in the control panel, but its different in bash, much longer. Like I said I will post more specific information soon.
score: 0

http://stackoverflow.com/comment/43506000
type: AnswerComment
type: Comment
has text: Yeah I got it working the, problem were the onetoOne mapping. Actually it was manytomany. That restricted the result.
comment on: http://stackoverflow.com/a/27524924
score: 0

http://stackoverflow.com/comment/43596737
score: 0
type: AnswerComment
type: Comment
has text: @Horstus I suspected that might be the case, which is why I specifically addressed it - the majority of Java memory leaks I've encountered are from Big Collections Full Of Everything
comment on: http://stackoverflow.com/a/27577855

oracle-database
tags question: http://stackoverflow.com/q/27618587
tags question: http://stackoverflow.com/q/27583258
tags question: http://stackoverflow.com/q/27522632
tags question: http://stackoverflow.com/q/27525356
tags question: http://stackoverflow.com/q/27616476
tags question: http://stackoverflow.com/q/27507392
tag name: oracle-database
tags question: http://stackoverflow.com/q/27565718
tags question: http://stackoverflow.com/q/27566339
tags question: http://stackoverflow.com/q/27500480
tags question: http://stackoverflow.com/q/27507016
tags question: http://stackoverflow.com/q/27565360
tags question: http://stackoverflow.com/q/27560969
tags question: http://stackoverflow.com/q/27569406
tags question: http://stackoverflow.com/q/27533517
type: Tag
tags question: http://stackoverflow.com/q/27507268
tags question: http://stackoverflow.com/q/27578541
tags question: http://stackoverflow.com/q/27604172
tags question: http://stackoverflow.com/q/27626160
tags question: http://stackoverflow.com/q/27523351
tags question: http://stackoverflow.com/q/27567150
tags question: http://stackoverflow.com/q/27483622
tags question: http://stackoverflow.com/q/27560775
tags question: http://stackoverflow.com/q/27617887
tags question: http://stackoverflow.com/q/27559446
tags question: http://stackoverflow.com/q/27585953
tags question: http://stackoverflow.com/q/27606109
tags question: http://stackoverflow.com/q/27625604
tags question: http://stackoverflow.com/q/27498624
tags question: http://stackoverflow.com/q/27485046
tags question: http://stackoverflow.com/q/27508713
tags question: http://stackoverflow.com/q/27618710
tags question: http://stackoverflow.com/q/27486119
tags question: http://stackoverflow.com/q/27504186
tags question: http://stackoverflow.com/q/27519932

http://stackoverflow.com/a/27522685
score: 1
answers question: http://stackoverflow.com/q/27522514
has body: If your kit object is javax.swing.text.html.HTMLEditorKit, you must use javax.swing.text.html package. If not you should read java documentation and find out your program need. Below link will also help you. Creating an HTMLDocument from a String of HTML (in Java)
accepted answer of: http://stackoverflow.com/q/27522514
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/69861492
score: 0
type: AnswerComment
has text: Does the activation of the new filter, requires to modifiy also the webapp ?
comment on: http://stackoverflow.com/a/30455120
type: Comment

http://stackoverflow.com/a/27490068
answers question: http://stackoverflow.com/q/27489980
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43411740
upvote count: 1
has body: A good option is to use date format as follows: SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy"); Date date = sdf1.parse(datetime); String year = sdf2.format(date);
score: 1

http://stackoverflow.com/a/27548129
has body: You can create an array of cardPlayers and cardComputers. For instance try this below int numPlayers = 14; int [] cardPlayer = new int[numPlayers]; int [] cardComputer = new int[numPlayers]; for (int i = 0; i &lt; numPlayers; i++) { System.out.println("Player Card " + i + ": " + cardPlayer[i]); cardComputer[i] = rn.nextInt(7) + 1; System.out.println("Computer Card " + "i" + cardComputer[i]); System.out.println(""); } This will make your code more readable and reduce lines in total
accepted answer of: http://stackoverflow.com/q/27548009
type: Answer
answers question: http://stackoverflow.com/q/27548009
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/43672218
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27625814
has text: @jamesFog: Yes, you're right. My bad!
score: 0

http://stackoverflow.com/a/27571104
has comment: http://stackoverflow.com/comment/43570980
has comment: http://stackoverflow.com/comment/43570727
type: Answer
answers question: http://stackoverflow.com/q/27570061
has comment: http://stackoverflow.com/comment/43567847
has comment: http://stackoverflow.com/comment/43571202
has comment: http://stackoverflow.com/comment/43570923
has comment: http://stackoverflow.com/comment/43570191
has comment: http://stackoverflow.com/comment/43570817
has comment: http://stackoverflow.com/comment/43567967
has comment: http://stackoverflow.com/comment/43567806
has comment: http://stackoverflow.com/comment/43572235
has body: Are you searching for this: import java.util.Scanner; class Blocks { public static void removeBlock(char[][] matrix, int posX, int posY) { if(0 &lt;= posX &amp;&amp; posX &lt; matrix.length &amp;&amp; 0 &lt;= posY &amp;&amp; posY &lt; matrix[posX].length) { if(matrix[posX][posY] == '0') { return; } matrix[posX][posY] = '0'; } else { return; } removeBlock(matrix, posX - 1, posY); removeBlock(matrix, posX + 1, posY); removeBlock(matrix, posX, posY - 1); removeBlock(matrix, posX, posY + 1); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); // read in char[][] matrix = new char[sc.nextInt()][sc.nextInt()]; for(int a = 0; a &lt; matrix.length; a++) { matrix[a] = sc.next().toCharArray(); } // calculate number of blocks int nrBlocks = 0; for(int i = 0; i &lt; matrix.length; i++) { for(int j = 0; j &lt; matrix[i].length; j++) { if(matrix[i][j] == '1') { // we have found a block, so increment number of blocks nrBlocks += 1; // remove any 1's of the block from the array, so that they each block is not counted multiple times removeBlock(matrix, i, j); } } } System.out.println(nrBlocks); } }
has comment: http://stackoverflow.com/comment/43567766
score: 0
has comment: http://stackoverflow.com/comment/43582991
has comment: http://stackoverflow.com/comment/43567993
has comment: http://stackoverflow.com/comment/43567830

http://stackoverflow.com/a/79222736
score: 0
answers question: http://stackoverflow.com/q/27475111
type: Answer
has body: I usually use ConfigObject for this. It does deep merge along other goodies. a= [ "a" : "1", "animals" : ["cat" : "blue"] ] b= [ "b" : 2, "animals" : ["dog" : "red"] ] result = (HashMap)new ConfigObject(a).merge(((ConfigObject)b))

http://stackoverflow.com/q/27546730
answer count: 3
accepted answer: http://stackoverflow.com/a/27549226
downvote count: 0
favorite count: 0
tagged with: spring
type: AnsweredQuestion
tagged with: activemq-classic
has answer: http://stackoverflow.com/a/66408533
tagged with: java
has answer: http://stackoverflow.com/a/27549226
score: 9
type: Question
has body: I have a Spring web application which will send and listen on a standalone ActiveMQ. When I start the web application, it shows: 20:12:52.684 [localhost-startStop-1] ERROR o.a.activemq.broker.BrokerService - Temporary Store limit is 51200 mb, whilst the temporary data directory: /root/activemq-data/localhost/tmp_storage only has 29021 mb of usable space I googled and read many articles, they all refer to configure broker and systemusage to limit the temp store size. However, I do not how to do this in Spring configuration. Below is my configuration XML. <property name="brokerURL" value="${jms.broker_url}" /> <property name="targetConnectionFactory" ref="connectionFactory" /> <property name="sessionCacheSize" value="10" /> <constructor-arg value="q.recv" /> <constructor-arg value="q.send" /> <constructor-arg value="q.notify" /> <property name="connectionFactory" ref="cachingConnectionFactory" /> <property name="jmsTemplate" ref="jmsTemplate" /> <property name="sendQueue" ref="sendQueue" /> <property name="recvQueue" ref="recvQueue" /> <property name="notifyQueue" ref="sendQueue" /> <property name="connectionFactory" ref="connectionFactory" /> <property name="destination" ref="recvQueue" /> <property name="messageListener" ref="recvBatchImplMessageListener" /> <property name="concurrentConsumers" value="5" /> <property name="maxConcurrentConsumers" value="10" /> Please help me out of here, THANKS!
has answer: http://stackoverflow.com/a/31402472
has title: Startup error of embedded ActiveMQ: Temporary Store limit is 51200 mb
upvote count: 9
possible better answer: http://stackoverflow.com/a/31402472
linked to: http://stackoverflow.com/q/66408421

http://stackoverflow.com/comment/43490931
comment on: http://stackoverflow.com/q/27529208
score: 0
type: QuestionComment
has text: In addition, you might want to show us the code you have so far.
type: Comment

http://stackoverflow.com/comment/43677699
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27628251
has text: now I have this: private static final String filePath = ".\\data.json"; BufferedReader br; Gson gson = new Gson(); Click click = gson.fromJson(br, Click.class); System.out.println(click); but it still says my json file has a wrong startingobject and ending object

http://stackoverflow.com/q/27564408
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27564883
answer count: 2
has comment: http://stackoverflow.com/comment/43554215
tagged with: nio
has answer: http://stackoverflow.com/a/27564712
has title: Iterate over certain subpaths in Path in Java
downvote count: 0
favorite count: 0
has body: I am working with code which makes use of java.nio.file.Path. I have a path like /tmp/something/first/second/third/last which I see only as {parent.dir}/first/second/third/{path.end} In this example /tmp/something or {parent.dir} is a path which can be different during runtime and which is irrelevant for me. The same applies for the last element in the path {path.end} What I would need is to iterate over elements between {parent.dir} and {path.end}. Basically to test each element in the path if it exists and if it is a file or a directory or something else (it doesn't matter). I am therefore looking for some elegant/simple and proper way to iterate over instance of Pathwhere I can access paths like these: /tmp /tmp/something/ /tmp/something/first ... /tmp/something/first/second/third/last ideally in this case without the first 2 and the last iteration. I am looking for a good solution using Path and java.nio and not the old way. I know I can achieve this using old io API but I am interested in the proper way of using nio.

http://stackoverflow.com/a/27546181
answers question: http://stackoverflow.com/q/27545634
has comment: http://stackoverflow.com/comment/43519532
downvote count: 0
has body: Seems U don't understand how String and Collections work. List&lt;String&gt; list1 = new ArrayList&lt;&gt;(); List&lt;String&gt; list2 = new ArrayList&lt;&gt;(); list1.add("a"); list1.add("b"); // #way1 - would not work list2.add("a b c"); list2.removeAll(list1); // #way2 - would work list2.add("a"); list2.add("b"); list2.add("c"); list2.removeAll(list1); // #way3 - would work as well String text = "a b c"; String[] parts = text.split("\\s+"); for (String part: parts) { list2.add(part); } list2.removeAll(list1); Why? String is a set of chars, List is a set of Objects (in our example - String Objects). When U try #way1, the list2 looks for the equal object it already has. "a b c" not equals to "a", or "b". So it is not working as U expected. Try #way2 and debug it, and learn the Java Core first.
has comment: http://stackoverflow.com/comment/43520189
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43520013

http://stackoverflow.com/q/27638934
upvote count: 3
has body: i am using this filter to save log about request and response time: import play.api.Logger import play.api.mvc._ import scala.concurrent.Future import play.api.libs.concurrent.Execution.Implicits.defaultContext object LoggingFilter extends Filter { def apply(nextFilter: (RequestHeader) =&gt; Future[SimpleResult]) (requestHeader: RequestHeader): Future[SimpleResult] = { val startTime = System.currentTimeMillis nextFilter(requestHeader).map { result =&gt; val endTime = System.currentTimeMillis val requestTime = endTime - startTime Logger.info(s"${requestHeader.method} ${requestHeader.uri} " + s"took ${requestTime}ms and returned ${result.header.status}") result.withHeaders("Request-Time" -&gt; requestTime.toString) } } } however i need to save the request body in the log. i know that this can be done using Scala action composition but i cant figure out how to get this done. any help??
tagged with: java
has answer: http://stackoverflow.com/a/27639153
type: Question
has title: log request body using scala http filter
tagged with: filter
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
tagged with: scala
type: UnansweredQuestion
score: 3

http://stackoverflow.com/comment/43695332
comment on: http://stackoverflow.com/a/27638147
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your help. The javax.jms resides on my local repository on the Jenkins box. Why is it not picking it up? Can i debug the maven command to see where it is looking?

http://stackoverflow.com/a/58209654
has body: Better late than ever. What you're looking for is this: MultiPart content = response.readEntity(MultiPart.class); This will cause the Jersey framework to parse out the content and give you a MultiPart object through which you can iterate over the parts.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27633603

http://stackoverflow.com/q/27519399
duplicate of: http://stackoverflow.com/q/26601032
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
has answer: http://stackoverflow.com/a/27519519
has answer: http://stackoverflow.com/a/59392448
upvote count: 24
type: Question
has title: Why does JPA use FetchType EAGER by default for the @ManyToOne relationship
score: 24
answer count: 3
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/27520593
favorite count: 0
linked to: http://stackoverflow.com/q/1444227
tagged with: hibernate-mapping
has body: I came to notice that the default FetchType for the @ManyToOne mapping is EAGER in JPA and Hibernate, whereas for the @OneToMany mapping, the default FetchType is LAZY. What is the specific reason behind this?

http://stackoverflow.com/comment/43607817
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27592044
has text: Error is NullPointerException?

http://stackoverflow.com/comment/43462559
type: AnswerComment
comment on: http://stackoverflow.com/a/27515797
score: 0
type: Comment
has text: This is currently the only answer that explicitly answers the question.

http://stackoverflow.com/q/27528430
has title: Application running using os.exec doesn't load java libraries properly
favorite count: 0
tagged with: go
has body: I would really appreciate if you helped me. I'm rewriting a simple Minecraft launcher from Java to Go. Everything is good, in exception of one thing. I have a start function which executes using os.Exec this command: java -Xincgc -Xmx1024M -Djava.library.path="/minecraft/bin/natives/" -cp "/minecraft/bin/*" -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true net.minecraft.launchwrapper.Launch --username user --session session --version 1.6.4 --gameDir "/minecraft" --assetsDir "/minecraft" --tweakClass cpw.mods.fml.common.launcher.FMLTweaker Everything is fine running this through bash or cmd, but when executed with Go function it returns the following: Could not find or load main class net.minecraft.launchwrapper.Launch I think os.exec(Command) cannot properly interpet this part of command: -cp "/minecraft/bin/*" Maybe that's because I quoted string "/minecraft/bin/*" with strconv.Quote() function or because of asterisk. I really don't know what's heppening. Ah, btw, the command os.exec has run is correct, though (I read it in stdout with fmt for debugging purposes). program: func start(login string, session string, ram string) { //start game app := "java" arg0 := "-Xincgc" arg1 := "-Xmx" + ram + "M" arg2 := "-Djava.library.path=" + strconv.Quote(filepath.FromSlash(client+"bin/natives/")) arg3 := "-cp" arg4 := strconv.Quote(filepath.FromSlash(client + "bin/*")) arg5 := "-Dfml.ignoreInvalidMinecraftCertificates=true" arg6 := "-Dfml.ignorePatchDiscrepancies=true" arg7 := "net.minecraft.launchwrapper.Launch" arg8 := "--username" //arg9 is login arg10 := "--session" //arg11 is session arg12 := "--version 1.6.4" arg13 := "--gameDir" arg14 := strconv.Quote(filepath.FromSlash(client)) arg15 := "--assetsDir" arg16 := strconv.Quote(filepath.FromSlash(client + "assets")) arg17 := "--tweakClass cpw.mods.fml.common.launcher.FMLTweaker" cmd := exec.Command(app, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, login, arg10, session, arg12, arg13…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43485655
downvote count: 0
linked to: http://stackoverflow.com/q/26473674
has comment: http://stackoverflow.com/comment/43485784
type: Question
has answer: http://stackoverflow.com/a/27528721
has comment: http://stackoverflow.com/comment/43486452
linked to: http://stackoverflow.com/q/7845130
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43485597
has comment: http://stackoverflow.com/comment/43485910
linked to: http://stackoverflow.com/q/25633077
has comment: http://stackoverflow.com/comment/43485787
has comment: http://stackoverflow.com/comment/43486793
has comment: http://stackoverflow.com/comment/43485946
has comment: http://stackoverflow.com/comment/43486106
upvote count: 1
answer count: 1
tagged with: minecraft

http://stackoverflow.com/a/27550370
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27550230
answers question: http://stackoverflow.com/q/27550230
score: 1
upvote count: 1
has body: I want to collect all items on this array. How can i do that ? while or something else? Iterate through every element in the Array using a for-each: for(Integer i : array){ //Do whatever you want to do } That loop is either called a for-each or advanced for-loop. It will iterate through every Object in your array and returns that object (In your case, Integer i) OR Use a regular for-loop. You probably used it before so it will be easier for you - for(int i = 0; i &lt; array.size(); i++) { Integer item = array.get(i); } To implicitly tackle your code, I will be assuming: You're receiving user input You wish to parse user input to an Integer (Meaning you only want numbers) You want to repeat this loop X number of times. If there's something I'm missing please correct me. ArrayList&lt;Integer&gt; array = new ArrayList&lt;Integer&gt;(); Integer tempInteger; try{ tempInteger = Integer.parseInt(edittext.getText().toString()); }catch(NumberFormatException e){ e.printStackTrace(); } array.add(tempInteger); /* * Once you have your array filled with 'elements' (In your case * with Integer values) you can use the following loop called a * 'for-each' loop to loop through ALL the elements in your list. */ for(Integer i : array){ System.out.println("array["+array.get(i)+"]" + " = " + i); } OR Using a regular for-loop: for(int i = 0; i &lt; array.size() - 1; i++){ Integer myInteger = array.get(i); System.out.println("array["+i+"]" + " = " + myInteger); }

http://stackoverflow.com/comment/43683240
has text: Thanks man, you know what you helped me a lot! I went with your method of the "double sweep" as it where and it works! A perfect outcome. Cheers!!
type: Comment
comment on: http://stackoverflow.com/a/27583193
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43475911
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27523060
has text: Corrected as per yours. But, now throws Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Unknown Source) at java.lang.String.<init>(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at the for loop conditon.
score: 0

http://stackoverflow.com/comment/43672859
comment on: http://stackoverflow.com/q/27624597
has text: The problem is not to close the thread manually, but it's automatic termination on windows then all GUI is closed. I want it in the Linux way: to close it manually on semaphore i.e. variable change, freeing resourses correctly, but it is down as all GUI closed.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27640219
tagged with: android-radiobutton
has comment: http://stackoverflow.com/comment/43699180
accepted answer: http://stackoverflow.com/a/27640283
type: Question
has title: Dialog with radio button save sharedpreferences but not the behaviour
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27640283
tagged with: android
has body: I can set the shared preferences in a AlertDialog with some radio buttons: public void ShowRadioDialog() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); final SharedPreferences.Editor editor = preferences.edit(); SharedPreferences choiceSettings = getSharedPreferences("currentChoice", 0); final int[] currentChoice = {choiceSettings.getInt("currentChoice", 0)}; final CharSequence[] items={"Rosso","Verde","Blu","Giallo","Arancione"}; AlertDialog.Builder builder=new AlertDialog.Builder(this); builder.setTitle("Seleziona un colore"); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(DialogInterface dialog, int which) { if (index == 1) { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.redDark)); toolbar.setBackgroundColor(MainActivity.this.getResources().getColor(R.color.red)); Toast.makeText(MainActivity.this, "Rosso OK", Toast.LENGTH_SHORT).show(); Log.i("Colors", "Rosso Ok"); } } else if (index ==2) { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.green_welcome)); toolbar.setBackgroundColor(MainActivity.this.getResources().getColor(R.color.green)); } } else if (index == 3){ if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(MainActivity.this.getResources().getColor(R.color.primary_dark_blue)); toolbar.setBackgroundColor(MainActivity.this.getResources().getColor(R.color.primary_blue)); } } else if (index == 4){ if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { get…
tagged with: android-alertdialog
has comment: http://stackoverflow.com/comment/43699196
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43699158
tagged with: java
tagged with: sharedpreferences

http://stackoverflow.com/a/27610773
score: 0
has body: Taken off the first search https://www.google.com/search?q=Calendar.getInstance() Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time: Calendar rightNow = Calendar.getInstance();
type: Answer
answers question: http://stackoverflow.com/q/27610732

http://stackoverflow.com/q/27621178
has answer: http://stackoverflow.com/a/27621463
has title: IDocument cannot be resolved to a type
upvote count: 3
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6661382
score: 3
accepted answer: http://stackoverflow.com/a/27621463
tagged with: java
has comment: http://stackoverflow.com/comment/43663176
has comment: http://stackoverflow.com/comment/43663938
has comment: http://stackoverflow.com/comment/43663246
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/43663379
has body: I'm very new to eclipse plugin devalopment and i want to get content from editor using eclipse plugin so i found this answer. But problem is: I get the compile error IDocument cannot be resolved to a type. No quick fix imports available. My Eclipse version is 3.8.2. How can I fix this problem? The code I used (from the linked answer) is this: public String getCurrentEditorContent() { final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getActiveEditor(); if (activeEditor == null) return null; final IDocument doc = (IDocument) activeEditor.getAdapter(IDocument.class); if (doc == null) return null; return doc.get(); } I can't find org.eclipse.jface.text among my dependencies. Here is a snapshot:

http://stackoverflow.com/q/27614322
type: Question
score: 0
answer count: 2
has title: Changing the date
has answer: http://stackoverflow.com/a/27615174
favorite count: 0
has comment: http://stackoverflow.com/comment/43653623
has answer: http://stackoverflow.com/a/27614364
has comment: http://stackoverflow.com/comment/43654237
has body: Basically, I've got a little program that uses date. Date current = new Date(); current.setDate(current.getDay() + time1); When I do this it adds to the day, but say time1 = 30 then the month doesn't change when I print the date out. I hope this makes sense I'm kinda new to this.
has comment: http://stackoverflow.com/comment/43650644
linked to: http://stackoverflow.com/q/2901262
linked to: http://stackoverflow.com/q/1005523
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43650626
tagged with: java
tagged with: date

http://stackoverflow.com/q/27481179
accepted answer: http://stackoverflow.com/a/27481657
has title: Add and name a bookmark jprofiler
tagged with: java
tagged with: analysis
type: Question
has answer: http://stackoverflow.com/a/27481657
tagged with: jprofiler
tagged with: heap-dump
has body: I can see the option to "Add Bookmark" in Jprofiler. I would like to name the bookmark. The bookmark should be in custom format. Example "100LoggedinUsers", "200LoggedinUsers". Looking at the bookmarks, I should be able to make sense as to why the bookmark was created.
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/27580502
score: 3
tagged with: java
answer count: 2
tagged with: http-accept-language
has answer: http://stackoverflow.com/a/27584359
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2204870
tagged with: spring
has answer: http://stackoverflow.com/a/27584181
tagged with: internationalization
tagged with: spring-mvc
has title: Spring MVC: redirect user according to browser language
upvote count: 3
has body: In Spring MVC 4 how can I redirect the user to a localized url according to the browser language (the HTTP header "Accept-Language")? I would that if an user is trying to access the url example.com/some/path it will redirect to de.example.com/some/path if its browser language is "DE" (i.e. the "Accept-Language" header is set to "de"). In the same way, if an user is accessing de.example.com/some/path and its language is EN it should be redirected to example.com/some/path. What is the easiest way to get that?
type: Question

http://stackoverflow.com/a/27588457
accepted answer of: http://stackoverflow.com/q/27588390
type: AcceptedAnswer
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27588390
has body: I cannot tell if there are other errors but most obvious one is that you are using mySurfaceView before you have created it. You should change initialization order to: mySurfaceView = new MySurfaceView(this); setContentView(mySurfaceView); gameLoopThread = new GameLoopThread(mySurfaceView); gameLoopThread.start();

http://stackoverflow.com/q/27523607
has comment: http://stackoverflow.com/comment/43476070
tagged with: android
tagged with: parse-platform
accepted answer: http://stackoverflow.com/a/27524091
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27524091
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm using Parse.com services for an Android application but when I try to get datas from Parse, an error occurs: com.parse.ParseException: corrupted json: org.json.JSONException: No value for code Here is the code I use to get the datas: public void getCategories() { listCategories = new ArrayList&lt;&gt;(); ParseQuery&lt;Category&gt; query = ParseQuery.getQuery(Category.class); query.findInBackground(new FindCallback&lt;Category&gt;() { @Override public void done(List&lt;Category&gt; categories, ParseException e) { if (e == null) { // Clear previously loaded Categories listCategories.clear(); for (Category category : categories) { // Fill the list with retrieved Categories lsistCategories.add(category); } }else { Log.d("Error happened while retrieving data:", e.getMessage()); } } }); } Any idea of what could be the problem?
type: Question
upvote count: 2
has title: Android Parse.com return corrupted json
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27528995
tagged with: rgb
has answer: http://stackoverflow.com/a/27529884
score: 0
tagged with: colors
answer count: 3
possible better answer: http://stackoverflow.com/a/27529219
has title: Getting RGB color from image in Android
has answer: http://stackoverflow.com/a/27529219
tagged with: android
has comment: http://stackoverflow.com/comment/43488040
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43487045
linked to: http://stackoverflow.com/q/5669501
has answer: http://stackoverflow.com/a/27529384
tagged with: java
has body: I'm making a game and in the game I load the map using an image. I check each pixel RGB and depends on that I add objects. This is my code: private void loadLevel() { Bitmap image = Assets.loadLevel(LEVEL); int w = image.getWidth(); int h = image.getHeight(); for (int xx = 0; xx &lt; h; xx++) { for (int yy = 0; yy &lt; w; yy++) { int pixel = image.getPixel(xx, yy); int red = (pixel &gt;&gt; 16) &amp; 0xff; int green = (pixel &gt;&gt; 8) &amp; 0xff; int blue = (pixel) &amp; 0xff; if (red == 100 &amp;&amp; green == 60 &amp;&amp; blue == 0) { // / block Log.d("PlayState","Creating blockss!!!"); addObject(new Block(xx * 32, yy * 32, 0, ObjectId.Block)); } if (red == 100 &amp;&amp; green == 50 &amp;&amp; blue == 0) { // /block 1 addObject(new Block(xx * 32, yy * 32, 1, ObjectId.Block)); } if (red == 100 &amp;&amp; green == 40 &amp;&amp; blue == 0) { // /block 2 addObject(new Block(xx * 32, yy * 32, 2, ObjectId.Block)); } if (red == 100 &amp;&amp; green == 30 &amp;&amp; blue == 0) { // /block 3 addObject(new Block(xx * 32, yy * 32, 3, ObjectId.Block)); } if (red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 255) { // /block 4 addObject(new Block(xx * 32, yy * 32, 4, ObjectId.Block)); } if (red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 245) { // /block 5 addObject(new Block(xx * 32, yy * 32, 7, ObjectId.Block)); } if (red == 0 &amp;&amp; green == 255 &amp;&amp; blue == 33) { // /block up addObject(new Block(xx * 32, yy * 32, 5, ObjectId.Block)); } if (red == 0 &amp;&amp; green == 245 &amp;&amp; blue == 33) { // /block up1 addObject(new Block(xx * 32, yy * 32, 6, ObjectId.Block)); } if (red == 0 &amp;&amp; green == 0 &amp;&amp; blue == 255) { // / player Log.d("PlayState","Creating Playerrr!!!"); addObject(new Player(xx * 32, yy * 32, ObjectId.Player)); } } } } The problem is that for some reason it only adds the Player object,it might be becuase it is the only object that both red &amp; green are 0. When I used exactly the same code to program to windows it wor…
has comment: http://stackoverflow.com/comment/43488258
type: Question
accepted answer: http://stackoverflow.com/a/27529884
has comment: http://stackoverflow.com/comment/43487165

http://stackoverflow.com/comment/43688614
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/27634525
type: Comment
has text: please give more context? where should that happen? in a view? in an editor? all over the rcp? if it is inside a view? what is inside that view? is it a swt canvas? ...

http://stackoverflow.com/q/27502769
upvote count: 1
accepted answer: http://stackoverflow.com/a/27502829
tagged with: eclipse
downvote count: 1
has title: Passing "this" from Java Interface to another Class
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43435706
has answer: http://stackoverflow.com/a/27502829
favorite count: 0
possible better answer: http://stackoverflow.com/a/27502930
tagged with: android
has answer: http://stackoverflow.com/a/27502930
has body: Giving the following class of my android Project : Preview extends SurfaceView implements SurfaceHolder.Callback and A extends Doc I don't really know how to ask and I know that this is not really good but I want that from Preview, I call an abstract method of Doc. In this Doc's method, I have to call a method of the previous Object of Preview. This is an example : From Preview.java : Doc _doc = new A(); private void myMethod() { this._doc.process(this) } From A.java : @Override public void process(Preview p) { p.processA(); } The problem is that I got an error : The method process(Preview) in the type Doc is not applicable for the arguments (new Camera.PreviewCallback(){}) However, I can't change this judging by the fact that I want to call the method from Preview. I tried many thing such as cast etc. None of them works. Thanks for your help ! PS : I am on Eclipse under Windows.
type: AnsweredQuestion
tagged with: oop
tagged with: java

http://stackoverflow.com/q/27509907
answer count: 5
has comment: http://stackoverflow.com/comment/43450110
linked to: http://stackoverflow.com/q/2570273
has answer: http://stackoverflow.com/a/27510241
has comment: http://stackoverflow.com/comment/43450113
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27510946
upvote count: 2
has answer: http://stackoverflow.com/a/27510498
has answer: http://stackoverflow.com/a/27510149
tagged with: java
has comment: http://stackoverflow.com/comment/43450529
type: Question
has answer: http://stackoverflow.com/a/27510415
possible better answer: http://stackoverflow.com/a/27510498
has comment: http://stackoverflow.com/comment/43450298
has body: I am currently trying to take in a text file and read each word in the file into a binary tree the specific error i get is: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space the text file i am reading into the project was given to me by the professor for the assignment so i know this should not be running into any memory problems i have never felt with this type of exception before and don't know where to start please help. here is my code: public class Tester { public static void main(String[] args) throws FileNotFoundException { Tester run = new Tester(); run.it(); } public void it() throws FileNotFoundException { BTree theTree = new BTree(); String str = this.readInFile(); String [] firstWords = this.breakIntoWords(str); String [] finalWords = this.removeNullValues(firstWords); for(int i = 0; i &lt; finalWords.length; i++) { theTree.add(finalWords[i]); } theTree.print(); } public String readInFile() throws FileNotFoundException { String myFile = ""; int numWords = 0; Scanner myScan = new Scanner(new File("Dracula.txt")); while(myScan.hasNext() == true) { myFile += myScan.nextLine() + " "; } return myFile; } public String [] breakIntoWords(String myFile) { String[] words = new String[myFile.length()]; String nextWord = ""; int position = 0; int i = 0; while(myFile.length() &gt; position) { char next = myFile.charAt(position); next = Character.toLowerCase(next); // First trim beginning while (((next &lt; 'a') || (next &gt; 'z')) &amp;&amp; !Character.isDigit(next)) { position++; next = myFile.charAt(position); next = Character.toLowerCase(next); } // Now pull only letters or numbers until we hit a space while(!Character.isWhitespace(next)) { if (Character.isLetterOrDigit(next)) { nextWord += myFile.charAt(position); } position++; next = myFile.charAt(position); } words [i] = nextWord; i++; } return words; } public String[] removeNullValues(String[] myWords) { String[] justMyWords = new String[myWords.length]; for (int i = 0; i &lt; myWords.leng…
has title: I'm getting a Out Of Memory Error: Java heap space Exception
has comment: http://stackoverflow.com/comment/43450412
has comment: http://stackoverflow.com/comment/43450219
has comment: http://stackoverflow.com/comment/43450047
has answer: http://stackoverflow.com/a/27510946
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43450396
has comment: http://stackoverflow.com/comment/43450992
tagged with: out-of-memory

http://stackoverflow.com/comment/67690791
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/28235198
has text: Thankyou so much buddy Your answer helped me a lot I was stucked because of this issue
score: 0

http://stackoverflow.com/a/27636329
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27635372
type: Answer
accepted answer of: http://stackoverflow.com/q/27635372
has body: Try this.... getActivity().runOnUiThread(new Runnable(){ @Override public void run(){ // Do whatever you want } });
upvote count: 5

http://stackoverflow.com/q/27594621
has body: I'm trying to do a custom listview with a favorite option, the thing is that when I add some items to favorite and then scroll down the fav button change order randomly, the other thing that I need help with is that I don't know how to change a favorite imageview when other is clicked (Because You can only have 1 favorite option) This is my custom adapter public class LineasAdapter extends BaseAdapter { Context context; protected List&lt;Lineas&gt; lineas; LayoutInflater inflater; public LineasAdapter(Context context, List&lt;Lineas&gt; lista){ this.context = context; this.inflater = LayoutInflater.from(context); this.lineas = lista; } @Override public int getCount() { return lineas.size(); } @Override public Object getItem(int position) { return lineas.get(position); } @Override public long getItemId(int position) { return 0; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = this.inflater.inflate(R.layout.item_lista, parent, false); holder.numero = (TextView) convertView .findViewById(R.id.number); holder.titulo = (TextView) convertView .findViewById(R.id.titulo); holder.subtitulo = (TextView) convertView .findViewById(R.id.subtitulo); holder.star = (ImageView) convertView .findViewById(R.id.star); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Lineas linea = lineas.get(position); holder.numero.setText(linea.numero_s()); holder.titulo.setText(linea.titulo()); holder.subtitulo.setText(linea.subtitulo()); final SharedPreferences.Editor editor = convertView.getContext().getSharedPreferences("Favorito",0).edit(); final int numero = linea.numero(); final Context c = convertView.getContext(); final ImageView estrella = holder.star; /** this is where I change my fav button and add the number to some sharedpreferences **/ holder.star.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editor.p…
score: -1
tagged with: listview
answer count: 1
downvote count: 1
tagged with: baseadapter
has title: ImageView inside item in listview change's randomly
favorite count: 0
has answer: http://stackoverflow.com/a/27598944
tagged with: android
tagged with: android-adapter
upvote count: 0
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/q/27544242
tagged with: jax-rs
favorite count: 0
tagged with: rest
has title: What does jersey service return if @Produces annotation missing?
upvote count: 4
type: AnsweredQuestion
tagged with: java
has body: I was begun learn jersey for development restful web services. As I noticed in most of the examples uses following annotations: @Consumes defines format of input parameters @Produces defines format of output parameters But in real code I see method which looks like this: @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("/login") public Response login(@FormParam("login") final String username, @FormParam("password") final String password){...} I see that this method uses POST HTTP method. Parameters userName and password will have form according @Consumes(MediaType.APPLICATION_FORM_URLENCODED). and I see URL to execute this method. But I don't understand what this method returns. Which format?
has answer: http://stackoverflow.com/a/27545963
type: Question
accepted answer: http://stackoverflow.com/a/27544469
tagged with: restful-architecture
tagged with: jersey
score: 4
has answer: http://stackoverflow.com/a/27544469
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27545963

http://stackoverflow.com/comment/90353847
type: AnswerComment
type: Comment
has text: gradle run --args='foo --bar'
comment on: http://stackoverflow.com/a/51407975
score: 1

http://stackoverflow.com/q/27552808
upvote count: 1
has title: WGET and HttpClient work but Jsoup doesn't work in java
has body: I am trying to get the html source of a webpage through java code using Jsoup. Below is the code I am using to fetch the page. I am getting a 500 Internal Server Error. String encodedUrl = URIUtil.encodePathQuery(urlToFetch.trim(), "ISO-8859-1"); Response res = Jsoup.connect(encodedUrl) .header("Accept-Language", "en") .userAgent(userAgent) .data(data) .maxBodySize(bodySize) .ignoreHttpErrors(true) .ignoreContentType(true) .timeout(10000) .execute(); However, when I fetch the same page with wget from command line, it works. A simple HttpClient from code also works. // Create an instance of HttpClient. HttpClient client = new HttpClient(); // Create a method instance. GetMethod method = new GetMethod(url); // Provide custom retry handler is necessary method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); try { // Execute the method. int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { System.err.println("Method failed: " + method.getStatusLine()); } // Read the response body. byte[] responseBody = method.getResponseBody(); // Deal with the response. // Use caution: ensure correct character encoding and is not binary data System.out.println(new String(responseBody)); } catch (HttpException e) { System.err.println("Fatal protocol violation: " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { System.err.println("Fatal transport error: " + e.getMessage()); e.printStackTrace(); } finally { // Release the connection. method.releaseConnection(); } Is there anything I would need to change in the parameters for Jsoup.connect() method for it work? This however does not happen for all urls. It is specifically happening for pages from this website: http://xyo.net/iphone-app/instagram-RrkBUFE/
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: jsoup
accepted answer: http://stackoverflow.com/a/27579884
tagged with: wget
downvote count: 0
tagged with: httpclient
has comment: http://stackoverflow.com/comment/43532642
has answer: http://stackoverflow.com/a/27579884
has comment: http://stackoverflow.com/comment/43533127
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43661467
has text: Override the `toString` method in your `Fact` class.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27620371
score: 3

http://stackoverflow.com/comment/43558918
type: AnswerComment
comment on: http://stackoverflow.com/a/27565945
type: Comment
has text: Thank you @Rangalo, yes m doing validation for less than 1mb image file. But internally packet size of query increases to 1196355kb+ for 900kb image. Hence it generates `PacketTooBigException` which I want to catch. Needs your suggestion.
score: 0

http://stackoverflow.com/comment/43607892
has text: Find out why: run your code in a debugger and inspect the key variables as it's running.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27592030

http://stackoverflow.com/comment/44840606
type: AnswerComment
comment on: http://stackoverflow.com/a/28235198
type: Comment
has text: Good insight. Thank you.
score: 0

http://stackoverflow.com/comment/43686796
type: QuestionComment
comment on: http://stackoverflow.com/q/27632758
score: 0
has text: 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 ':p_email' at line 1
type: Comment

tdd
tags question: http://stackoverflow.com/q/27491766
type: Tag
tag name: tdd
tags question: http://stackoverflow.com/q/27509205

http://stackoverflow.com/comment/43613518
score: 0
type: AnswerComment
has text: well, there you go - use an appropriate typing and in your case I guess you have already figured it out. Don't use the wildcard `<?>` unless that is *what you need*.
comment on: http://stackoverflow.com/a/27594695
type: Comment

http://stackoverflow.com/comment/43641116
has text: I get `Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at square.Square.main(Square.java:24) `
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27609368
type: AnswerComment

http://stackoverflow.com/q/27541924
has comment: http://stackoverflow.com/comment/43511744
score: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43511117
answer count: 0
has comment: http://stackoverflow.com/comment/43511110
type: UnansweredQuestion
tagged with: servlet-3.0
has comment: http://stackoverflow.com/comment/43511160
has comment: http://stackoverflow.com/comment/43511149
has comment: http://stackoverflow.com/comment/43516000
type: Question
has title: using arraylist found in servlet to insert into database using preparedstatement
has body: I have error,I am sending and array to servlet there I get parameter values and try to use them to store into mysql database, but two problems, getting parameter values and inserting into database is ok, but what I am getting the first row of the inserted values is unwanted and I don't don't how it happened,the seccond problem is while preparedstatement is inserting values into the database I want to use another preparedstatement that make changes another table. this is jsp page $("#formGenerate").submit(function(event) { // function to process submitted table var a = {}; var tableData = []; // we will store rows' data into this array $("#adminTable") // select table by id .find(".tableRow") // select rows by class .has(":checked") // select only rows with checked checkboxes .each(function() { // for each selected row extract data var tableRow = {}; var jRow = $(this); tableRow[0] = jRow.find('td.customerId').text(); tableRow[1] = jRow.find('td.customerName').text(); tableRow[2] = jRow.find('td.customerType').text(); tableRow[3] = jRow.find('td.customerKWH').text(); tableRow[4] = jRow.find('td.customerFaraq').text(); tableRow[5] = jRow.find('td.customerLacag').text(); tableRow[6] = jRow.find('td.customerTax').text(); tableRow[7] = jRow.find('input.name1').val(); tableRow[8] = $('.bishaa').val(); tableRow[9] = $('.readers').val(); tableData.push(tableRow); }); $.post( "generateKwd", /*url of consuming servlet*/ {tableData: tableData}, /*data*/ function() { alert("Success!"); }, /*function to execute in case of success*/ "json" /* data type */ ); event.preventDefault(); //Prevent sending form by browser location.reload(); } ); ID Bisha Reader Kilowat Entry customer id name group kwh faraq lacag tax kwd <c:forEach var="cust" items="${customerKwh}" varStatus="iter"> ${cust.id} ${cust.name} ${cust.type} ${cust.kwh} </c:forEach> and this is in servlet (userPath.equals("/generateKwd")) { RateDao rate = new RateDao(); Enumeration tableData1 = request.getParameterNames(); wh…
has comment: http://stackoverflow.com/comment/43516722
has comment: http://stackoverflow.com/comment/43511102
has comment: http://stackoverflow.com/comment/43511343

http://stackoverflow.com/comment/43454832
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27512212
has text: The other reason you might need a no-argument constructor is that if `YourClass` has another constructor that takes arguments, a client cannot say `new YourClass()` with no arguments, unless you explicitly add a no-argument constructor.

http://stackoverflow.com/q/27537166
has comment: http://stackoverflow.com/comment/43502732
type: Question
has answer: http://stackoverflow.com/a/27538031
tagged with: android
has comment: http://stackoverflow.com/comment/43502773
score: -2
tagged with: android-activity
downvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/23353173
has comment: http://stackoverflow.com/comment/43502885
has title: Android: Application is crashing On Startup
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27537283
tagged with: crash
upvote count: 0
has body: I am a novice and I'm just creating a simple Android app in which there are 2 buttons that take you to different pages when clicked, which have different functions. However, my app crashes on start-up, simply saying Unfortunately [app name] has stopped and I don't understand As I have barely made any changes to my MainActivity.java, the code seems to be well written, and eclipse displays no errors... Any help, please? I have searched around Stack, but I can't find anything specific to this... Here is my MainActivity.java: package com.example.helper; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /**Called upon when the user clicks the 'Abbreviations' button*/ public void listDefinitions (View view){ Intent intent = new Intent(this, ListDefinitions.class); startActivity(intent); } /**Called upon when the user clicks the 'Assistant' button*/ public void openAssistant (View view){ Intent intent = new Intent(this, Assistant.class); startActivity(intent); } } Here is my activity_main.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_…
favorite count: 0

http://stackoverflow.com/q/27483111
type: Question
has title: SymmetricDS: Transporting row from a node to another
has body: As you could see in this other question, I'm using SymmetricDS to synchronize a structure of tables. After solving the problem of the linked question, I've found another issue, in the same structure: The red rectangles show which tables need synchronize, and the green arrow show the column where we can identify which SymmetricDS instance will synchronize. Let's suppose I've created a new Funcionario row linked with specified by Empresa through Cadastro, so the created Funcionario is pushed to a specific node, as expected. However, I've noticed that I linked this Funcionario with the wrong Empresa, so I changed the Cadastro - Empresa relationship. What should happen in this case is: the Funcionario will be deleted in the node it was pushed before, and this same Funcionario will be pushed to another node, correctly related to the new Cadastro-Empresa relationship. How can I do it using SymmetricDS?
tagged with: database
tagged with: symmetricds
downvote count: 0
linked to: http://stackoverflow.com/q/25612547
tagged with: synchronization
favorite count: 0
type: UnansweredQuestion
score: 2
tagged with: data-synchronization
answer count: 0
upvote count: 2
tagged with: java

docusignapi
tags question: http://stackoverflow.com/q/27495604
tags question: http://stackoverflow.com/q/27514519
tags question: http://stackoverflow.com/q/27490976
tag name: docusignapi
type: Tag

http://stackoverflow.com/q/27638664
type: AnsweredQuestion
tagged with: apache-poi
downvote count: 0
score: 1
tagged with: java
has title: Retrieve values from excel using poi
has body: I am trying to get the column values for a specific row in a excel using poi methods. I am able to get the values but the problem is I want the values only from second column. public static ArrayList&lt;String&gt; GetBusinessComponentList() throws IOException{ String Tcname = "TC02_AggregateAutoByPassRO_CT"; ArrayList&lt;String&gt; arrayListBusinessFlow ; arrayListBusinessFlow = new ArrayList&lt;String&gt;(); FileInputStream fileInput = new FileInputStream(oFile); wb = new HSSFWorkbook(fileInput); sheet = wb.getSheet("Business Flow"); int rownr = findRow(sheet, Tcname); row = sheet.getRow(rownr); for (Cell cell : row) { String arr = cell.getStringCellValue(); arrayListBusinessFlow.add(arr); } return arrayListBusinessFlow; } private static int findRow(HSSFSheet sheet, String cellContent){ for (Row row : sheet) { for (Cell cell : row) { if (cell.getCellType() == Cell.CELL_TYPE_STRING) { if (cell.getRichStringCellValue().getString().trim().equals(cellContent)) { return row.getRowNum(); } } } } return 0; } } OUTPUT: [TC02_AggregateAutoByPassRO_CT, StrategicUINewBusiness.Login, StrategicUINewBusiness.CustomerSearch, StrategicUINewBusiness.NamedInsured, StrategicUINewBusiness.InsuranceScoreByPass, StrategicUINewBusiness.VehiclePage, StrategicUINewBusiness.DriverPage, StrategicUINewBusiness.ViolationPage, StrategicUINewBusiness.UnderwritingPage, StrategicUINewBusiness.CoveragePage, StrategicUINewBusiness.Portfolio, StrategicUINewBusiness.BillingPage, StrategicUINewBusiness.FinalSalePage, StrategicUINewBusiness.PolicyConfirmation, , , ] But I do not want my test case name when I am getting. Please help me what changes i needed to do. thanks!
possible better answer: http://stackoverflow.com/a/27638793
accepted answer: http://stackoverflow.com/a/27643473
type: Question
has comment: http://stackoverflow.com/comment/43696386
has answer: http://stackoverflow.com/a/27643473
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43696586
favorite count: 0
has comment: http://stackoverflow.com/comment/43698700
has answer: http://stackoverflow.com/a/27638793

http://stackoverflow.com/q/27607961
type: Question
has comment: http://stackoverflow.com/comment/43640112
has title: NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment; With zkoss
downvote count: 0
has comment: http://stackoverflow.com/comment/43638110
has answer: http://stackoverflow.com/a/38850312
favorite count: 0
has comment: http://stackoverflow.com/comment/43638362
answer count: 5
has body: I am facing following error, java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment; at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:81) at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1423) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1413) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:239) a…
has comment: http://stackoverflow.com/comment/43638608
has answer: http://stackoverflow.com/a/30289355
has answer: http://stackoverflow.com/a/27609536
has answer: http://stackoverflow.com/a/49689437
type: UnansweredQuestion
score: 16
tagged with: maven
tagged with: zk
tagged with: spring
linked to: http://stackoverflow.com/q/13642947
upvote count: 16
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/42691569
tagged with: java

http://stackoverflow.com/a/27479237
downvote count: 1
answers question: http://stackoverflow.com/q/27479181
has body: If your Spanned text only containing HTML content then you can convert it using Html.toHtml() String htmlString = Html.toHtml(spannedText);
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/a/27538228
has body: Clearly ScmTelephoneDetailsViewRowImpl is an object, and not a simple value. But what I think you want is a new object, that is identical to the original object (all the fields are the same) but which occupies different memory. Have you tied something like ScmTelephoneDetailsViewRowImpl temp = telphone_accounting_details_9.clone(); copy_set.add(temp); What you really want here is a deep copy. which copies all the fields manually. If your class ScmTelephoneDetailsViewRow is something you can extend or modify directly, then you could override the clone() function that inherits from Object. REVISION: in order to call clone() on your object it will need to implement the "interface" called Cloneable. But there are no methods in that interface. So you just need to add "implements Cloneable" to the class definition. Assuming you control that class. Another problem with the default implementation of clone() is that if your object contains any non-primitive fields, such as an array, than a copy of the pointer to the array will be made, it will not create a "deep" copy where it generates new array space and copies all the array elements too. As I said earlier, you can overcome that if you @Override clone(), or make a new copy command of your own choosing.
has comment: http://stackoverflow.com/comment/43506679
has comment: http://stackoverflow.com/comment/43504798
has comment: http://stackoverflow.com/comment/43505555
score: 0
has comment: http://stackoverflow.com/comment/43505365
answers question: http://stackoverflow.com/q/27538123
type: Answer
has comment: http://stackoverflow.com/comment/43504766

http://stackoverflow.com/a/27514558
accepted answer of: http://stackoverflow.com/q/27514466
upvote count: 2
has body: Use Gradient as the color of the Drawable : <stroke android:width="1dp" android:color="@color/gray_light" /> <gradient android:type="linear" android:centerX="0" android:centerY="1" android:startColor="#bff54a" android:endColor="#88c010" /> <corners android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" android:topLeftRadius="8dp" android:topRightRadius="8dp" /> See Drawable Resources
score: 2
answers question: http://stackoverflow.com/q/27514466
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43462369
type: Answer

http://stackoverflow.com/comment/56638458
score: 0
type: Comment
type: QuestionComment
has text: Hi! I am successfully build the OpenCV with extra modules and created the Jar file for Java, which I tested it was working well, but I did not see any new things in this Jar file, I mean that where the contrib code for Java, this Jar file is almost the same as the Jar file which came whit OpenCV download file. If you understand me the question, please tell me that I did wrong some where in building Jar file Or it is like this? Thank you very much. Note: I have included everything while build Jar file
comment on: http://stackoverflow.com/q/27490363

http://stackoverflow.com/comment/43665969
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27622236
has text: If you have smalller amount of Places (which I suppose is not the case) you could put List of all places as model attribute and display them in a select box, which would bind to a place ID in the backing form object. If you have large amount of Places I guess the best approach would be to create some AJAX autocompletion of the Place based on its name for Example.
score: 0

http://stackoverflow.com/comment/43676345
has text: Why does every car have three of each variable? It looks like you have misunderstood the mechanics of object orientation.
type: Comment
comment on: http://stackoverflow.com/q/27627748
type: QuestionComment
score: 2

http://stackoverflow.com/comment/43453374
has text: This is my favorite answer. That's just another way to implement the Adapter pattern mentioned in other answers, by using the Delegate pattern to implement the adapters themselves. It has quite a bit of overhead in terms of code though, since you need to define the new common interface and two delegating classes. So it's probably only worth it if you have a lot of duplicated code.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27503400
type: AnswerComment

http://stackoverflow.com/comment/43665893
type: Comment
type: QuestionComment
has text: @Flup I have added blocking popup in question.
score: 0
comment on: http://stackoverflow.com/q/27564307

http://stackoverflow.com/q/27526498
has comment: http://stackoverflow.com/comment/43550009
tagged with: selenium
score: -1
has comment: http://stackoverflow.com/comment/43482296
has body: I want to run my Selenium execution using multiple browsers. But I don't want to use Selenium Grid. I have tried with Java multithreading, but it's getting difficult to handle all the threads. Can anyone help me with an easier way, other than Selenium Grid?
has comment: http://stackoverflow.com/comment/43507718
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/43481745
has title: Multiple execution of Selenium without using Selenium Grid
has answer: http://stackoverflow.com/a/27531957
favorite count: 0
has comment: http://stackoverflow.com/comment/43482472
type: UnansweredQuestion
downvote count: 1
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/27550902
tagged with: java

http://stackoverflow.com/a/27571078
has comment: http://stackoverflow.com/comment/44710009
has comment: http://stackoverflow.com/comment/44740834
answers question: http://stackoverflow.com/q/27552743
type: Answer
has comment: http://stackoverflow.com/comment/44832568
upvote count: 5
downvote count: 0
has body: The method FlurryAgent.onStartSession(context, key); is deprecated you need call first the method FlurryAgent.init(context, key); and after FlurryAgent.onStartSession(context);
has comment: http://stackoverflow.com/comment/44751608
has comment: http://stackoverflow.com/comment/44701276
score: 5

http://stackoverflow.com/a/27486655
answers question: http://stackoverflow.com/q/27486621
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: They do the same thing, but the first is easier to read and doesn't require an if statement. x = true; //x is now true if(!x) x = true; //x is true if x wasn't true, if x was true before it is still true

http://stackoverflow.com/comment/43597334
type: QuestionComment
comment on: http://stackoverflow.com/q/27586437
score: 1
has text: What is your `Node` class? Have you tried stepping through with a debugger to see what is wrong?
type: Comment

http://stackoverflow.com/q/27490355
tagged with: java
has comment: http://stackoverflow.com/comment/43412359
type: Question
downvote count: 0
has body: I would like to know how can I write application.properties files. Actually I would like to load the translations from each file, check them if they are well translated and, in case they are missing, I would like to be notified about them and be able to change them. Is there any way to easily access the load the localization files and then write them? I can load them using the classical reader and write them in the same way but it's a lot of work that need to be taken care of if I follow this path.
has title: java write translations in application.properties
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: properties
tagged with: internationalization
score: 1

http://stackoverflow.com/a/27548749
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/43548333
has body: You can't just query for this information. Your Internet speed is determined and controlled by your ISP, not by your network interface or router. So the only way you can get your (current) connection speed is by downloading a file from a close enough location and timing how long it takes to retrieve the file. For example: static final String FILE_URL = "http://www.example.com/speedtest/file.bin"; static final long FILE_SIZE = 5 * 1024 * 8; // 5MB in Kilobits long mStart, mEnd; Context mContext; URL mUrl = new URL(FILE_URL); HttpURLConnection mCon = (HttpURLConnection)mUrl.openConnection(); mCon.setChunkedStreamingMode(0); if(mCon.getResponseCode() == HttpURLConnection.HTTP_OK) { mStart = new Date().getTime(); InputStream input = mCon.getInputStream(); File f = new File(mContext.getDir("temp", Context.MODE_PRIVATE), "file.bin"); FileOutputStream fo = new FileOutputStream(f); int read_len = 0; while((read_len = input.read(buffer)) &gt; 0) { fo.write(buffer, 0, read_len); } fo.close(); mEnd = new Date().getTime(); mCon.disconnect(); return FILE_SIZE / ((mEnd - mStart) / 1000); } This code, when sightly modified (you need mContext to be a valid context) and executed from inside an AsyncTask or a worker thread, will download a remote file and return the speed in which the file was downloaded in Kbps.
accepted answer of: http://stackoverflow.com/q/27543291
upvote count: 4
answers question: http://stackoverflow.com/q/27543291
type: AcceptedAnswer

http://stackoverflow.com/comment/43627155
comment on: http://stackoverflow.com/a/27601593
score: 0
type: Comment
has text: It also works, but still have the same problem with the URL... I need to have "localhost/error" URL.
type: AnswerComment

http://stackoverflow.com/comment/43619478
type: AnswerComment
comment on: http://stackoverflow.com/a/27597887
type: Comment
has text: Copy and paste the exception.
score: 0

http://stackoverflow.com/q/27565266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43556840
has title: How to authenticate and connect to the network drive in java
score: 2
answer count: 0
downvote count: 0
tagged with: java
favorite count: 0
type: Question
has body: Could any one please tell how to authenticate and connect to the network drive(folder) in java in windows system. We tried with following code to connect to the network drive. Process proc = Runtime.getRuntime().exec("cmd.exe /C START net use M: \\127.0.0.1\\sharedNetworkDrive"); But problem with this code is not having any authentication(username and password) for that shared drive (sharedNetworkDrive). Can anyone please guide how to do this.
tagged with: jsp
tagged with: servlets
upvote count: 2
tagged with: jcifs
linked to: http://stackoverflow.com/q/10599999

http://stackoverflow.com/q/27606631
has body: I'm absolutely terrible at programming amd using stackoverflow atm, go easy on me, I'm trying to learn. From reading this code, what would be the proper syntax to use to avoid the NumberFormatExpection? ` package in.parapengu.spork.rotation; import com.google.common.base.Charsets; import in.parapengu.commons.utils.file.TextFile; import in.parapengu.spork.Spork; import in.parapengu.spork.exception.rotation.RotationLoadException; import in.parapengu.spork.map.MapLoader; import in.parapengu.spork.util.Log; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.util.ArrayList; import java.util.List; public class Rotation { private static int MAX_SIZE = 30; private static boolean OVERFLOW = true; private File file; private int index; private List&lt;MapLoader&gt; loaders; private List&lt;RotationSlot&gt; slots; public Rotation(File file, List&lt;MapLoader&gt; loaders, int index) { this.file = file; this.index = index; this.loaders = loaders; this.slots = new ArrayList&lt;&gt;(); if(loaders.size() &gt; MAX_SIZE &amp;&amp; OVERFLOW) { for(MapLoader loader : loaders) { try { slots.add(new RotationSlot(loader)); } catch(Exception ex) { ex.printStackTrace(); } } } else { try { while(slots.size() &lt; MAX_SIZE) { for(int i = 0; i &lt; loaders.size() &amp;&amp; slots.size() &lt; MAX_SIZE; i++) { slots.add(new RotationSlot(loaders.get(i))); } if(slots.size() == 0) { Log.warning("No slots were loaded"); break; } } } catch(Exception ex) { ex.printStackTrace(); } } } public Rotation(File file, List&lt;MapLoader&gt; loaders) { this(file, loaders, 0); } public File getFile() { return file; } public int getIndex() { return index; } public List&lt;RotationSlot&gt; getSlots() { return slots; } public boolean save() { TextFile file; try { file = new TextFile(this.file); } catch(IOException ex) { ex.printStackTrace(); Log.exception(ex); return false; } file.line(index + ""); for(MapLoader loader : loaders) { file.line(loader.getName()); } file.save(); ret…
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43635533
has comment: http://stackoverflow.com/comment/43635440
type: AnsweredQuestion
tagged with: java
downvote count: 2
type: Question
score: -2
has answer: http://stackoverflow.com/a/27606718
accepted answer: http://stackoverflow.com/a/27606718
tagged with: numberformatexception
has comment: http://stackoverflow.com/comment/43635792
has title: What's the proper syntax to use for this NumberFormatException?
has comment: http://stackoverflow.com/comment/43635750

http://stackoverflow.com/comment/43497252
type: QuestionComment
comment on: http://stackoverflow.com/q/27531844
has text: BTW, you should be using TIMESTAMP WITH TIME ZONE, not WITHOUT. Per [post by David E Wheeler](http://justatheory.com/computers/databases/postgresql/use-timestamptz.html) (Postgres expert).
score: 0
type: Comment

http://stackoverflow.com/a/27587644
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27587520
has body: You can show AlertDialog from Service by setting layout type of alert TYPE_SYSTEM_ALERT as: AlertDialog dialog = builder.create(); dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); dialog.show(); and add android.permission.SYSTEM_ALERT_WINDOW permission to AndroidManifest.xml
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27587520
upvote count: 1

http://stackoverflow.com/a/27547509
type: Answer
downvote count: 0
has body: You could probably do it like: class ChessGame class DifficltChessGame extends ChessGame class MediumChessGame extends ChessGame class SimpleChessGame extends ChessGame class ChessGameFactory { public static ChessGame getChessGame(String gameType) { switch(gameType) { //jdk7 case "easy": return new SimpleChessGame(); .... } } } And from your code you could do something like: String[] options={"Easy","Medium", "Hard"};//use enum instead humanInput=... ChessGame game = ChessGameFactory.getChessGame(humanInput);
answers question: http://stackoverflow.com/q/27547384
has comment: http://stackoverflow.com/comment/43521896
score: 1
accepted answer of: http://stackoverflow.com/q/27547384
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/43456569
has text: It goes case by case but sometimes bulk data passing is used to allow flexible parameters that are optional. As such, I mentioned that language's ability to overload methods provides better alternative, sometimes :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27513023

http://stackoverflow.com/comment/43516031
type: QuestionComment
comment on: http://stackoverflow.com/q/27543837
has text: can i get code for decompressing image if quality doesn't matters?
score: 0
type: Comment

http://stackoverflow.com/q/27625377
has answer: http://stackoverflow.com/a/27625410
linked to: http://stackoverflow.com/q/18944627
score: 0
answer count: 1
has body: Spring docs says this about InitBinder Annotation that identifies methods which initialize the WebDataBinder which will be used for populating command and form object arguments of annotated handler methods. What i got from this this method is used for initializing the WebDataBinder which is used to populate model object so that it can be used further in handler method. But i am not sure what does "... of annotated handler methods" mean here?" Update :- i believe it means after going thru Sotirios Delimanolis answer InitBinder Annotation identifies methods which initialize the WebDataBinder which will be used for model object that is further passes to handler method annotated with @RequestMapping
has title: What does InitBinder actually mean here?
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27625410
type: Question

http://stackoverflow.com/a/27485564
accepted answer of: http://stackoverflow.com/q/27484477
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27484477
has comment: http://stackoverflow.com/comment/43425501
has comment: http://stackoverflow.com/comment/43662944
has body: We don't have any method to directly transfer the data between S3 and Azure, We can get the InputStream from Amazon S3 and write them to Azure storage. To get InputStream from S3, use this AWSCredentials awsCredentials = awsCredentials = new BasicAWSCredentials(accessKey, secretKey); AmazonS3Client amazonS3 = new AmazonS3Client(awsCredentials); InputStream is = amazonS3.getObject(bucket, filePath).getObjectContent();
has comment: http://stackoverflow.com/comment/43661608
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43406117

http://stackoverflow.com/a/27488917
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27488715
score: 1
has body: Constructor will be like this public IteratorList(NodePositionList&lt;K&gt; n){ this.npl = n; this.p = (npl.isEmpty()) ? null : npl.first(); }

http://stackoverflow.com/comment/43691375
score: 0
type: Comment
has text: Firebase connections are made using a custom URL like "https://<your-app-name>.firebaseio.com". It's highly unlikely that they block that. I'm able to open that URL in my browser, however, it fails to connect using Android SDK.
comment on: http://stackoverflow.com/a/27635916
type: AnswerComment

http://stackoverflow.com/q/27543360
type: Question
downvote count: 0
has title: "HandshakeCompleteNotify" thread causes program to stall
score: 1
has body: So, I'm running into a strange issue and I'm really stuck. I have a long winded process (loads 10 million + records into salesforce). When I run this process everything goes well until the end. At the end of this process, I wait for confirmation back from salesforce that all records have loaded successfully. Sometimes (not always but most of the time), the program just seems to stall. If I pause the debugger, it doesn't pull up any code lines and I can't use the "step" functions. While its stalling, a thread flashes faster than I can read what it says. I managed to capture it by screen-shooting my desktop as fast as I could. Any advice on how to trouble shoot this? Insight to why this might be happening? I'm a bit out of my comfort zone with this one. Update So it turns out, after a very long time it finally does return as expected. It appears that the thread is doing some sort of work and but maybe isn't getting a fair share of the resources? Still have no idea why it's happening. Maybe it has something to do with a thread.sleep() call I'm making in a loop? This is basically the code in question. It came from this resource put out by salesforce. /** * Wait for a job to complete by polling the Bulk API. * * @param connection * BulkConnection used to check results. * @param job * The job awaiting completion. * @param batchInfoList * List of batches for this job. * @throws AsyncApiException */ private void awaitCompletion(BulkConnection connection, JobInfo job, List&lt;BatchInfo&gt; batchInfoList) throws AsyncApiException { long sleepTime = 0L; Set&lt;String&gt; incomplete = new HashSet&lt;String&gt;(); for (BatchInfo bi : batchInfoList) { incomplete.add(bi.getId()); } while (!incomplete.isEmpty()) { try { Thread.sleep(sleepTime); } catch (InterruptedException e) {} System.out.println("Awaiting results..." + incomplete.size()); sleepTime = 10000L; BatchInfo[] statusList = connection.getBatchInfoList(job.getId()).getBatchInfo(); for (BatchInfo b : statusList) { if (b.g…
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43513964
upvote count: 1
tagged with: freeze
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43514048

http://stackoverflow.com/comment/43530165
has text: @selva So why are you doing `int d2 = twodim[1].length;`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27551946
score: 0

http://stackoverflow.com/comment/43437444
has text: Well obviously you have a base interface or object type, say type "AorB", which has a method definition or implementation. So you define a public interface Functor<T extends AorB>{}. You can multiple bound T to a series of types: <T extends B1 & B2 & B3>
comment on: http://stackoverflow.com/a/27503615
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/135703485
score: 0
comment on: http://stackoverflow.com/q/27542627
has text: Validate the length of `credentials`. Surely it can’t be larger than, say, one megabyte, right? If it is, throw an exception and/or return HTTP 400 Bad Request.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27567582
score: 3
has comment: http://stackoverflow.com/comment/43560476
answers question: http://stackoverflow.com/q/27567511
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43560730
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27567511
type: Answer
has body: Java EE is a set of specifications and APIs that define the standards which form Java EE. As such Java EE is not a superset of Java SE which defines the language and standard libraries, but just is built on top of it. Additionally, besides the APIs there is no SDK as such. Just choose an implementation (most people use an application server like Glassfish, JBoss/Wildfly, Websphere etc.) and use that. If you just want to download the API jars, check the various respositories on the net, e.g. Maven Central etc. The most basic API jar would be javaee-api-7.0.jar. There are a couple of other jars but which you need to reference in your application depends on what you need and which Java EE implementation/provider you use.
upvote count: 3

http://stackoverflow.com/comment/43524659
has text: I need that user choose position of crop. The strange thing is that saved image has correct size, but relative Bitmap inside my code has a different size
comment on: http://stackoverflow.com/q/27549019
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27492013
answer count: 3
has title: Can't public static on a final
has comment: http://stackoverflow.com/comment/43415745
favorite count: 0
possible better answer: http://stackoverflow.com/a/27492148
has answer: http://stackoverflow.com/a/27492148
type: AnsweredQuestion
has body: I am sure there's a super simple explanation and it'll make me feel stupid, but I just can't figure it out. Pastebin , line 18: public static boolean loadTextures() { try { final Texture STONE = loadPNG("main\\textures\\stone.png"); // This line here I can't do public static final... } catch (IOException e) { return false; } return true; } I would like STONE to be public static final, but eclipse says only final is a legal modifier. How would I go about declaring a public static final variable?
has comment: http://stackoverflow.com/comment/43415563
tagged with: java
has comment: http://stackoverflow.com/comment/43415835
upvote count: 1
has answer: http://stackoverflow.com/a/27492054
downvote count: 1
has answer: http://stackoverflow.com/a/27492078
type: Question
accepted answer: http://stackoverflow.com/a/27492054
tagged with: access-modifiers
score: 0

http://stackoverflow.com/comment/43613796
has text: @user1383163 Is the space considered a delimiter or part of the numeric value? While we're at it does the value before the delimiters only consist of digits or other text?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27594970
type: Comment

http://stackoverflow.com/comment/43549087
comment on: http://stackoverflow.com/q/27531634
score: 0
type: Comment
has text: I can tell you from my experience the HAL serializer is kinda hacked in there and doesn't play nice with spring boot at all. We remove the built in one and register our own based on the built in one. What specifically is the built in one doing wrong with links?
type: QuestionComment

http://stackoverflow.com/q/27600097
tagged with: portlet
answer count: 1
type: UnansweredQuestion
has title: How exactly mean the portlet configuration inside the portlet.xml file in LifeRay?
tagged with: liferay-6
type: Question
has answer: http://stackoverflow.com/a/27636679
tagged with: java
has body: I am absolutely new in LifeRay portlet development and now I am working on a project that use Struts 2 based portlet and I have many doubts about how a portlet is configured. So for example I have an "Hello World" portlet that have the following configuration inside the portlet.xml file: provaAndrea Prova Andrea org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher viewNamespace /nuovaPortlet defaultViewAction startTestPortlet1 editNamespace /nuovaPortlet defaultEditAction provaAndreaPropertiesShowAction 0 text/html VIEW Prova Andrea </portlet> So can you help me to understand what exactly this file is setting? My doubts are: 1) What exactly is the difference between the title setted into the section and the portlet-name setted at the beginning of the portlet configuration? 2) Then there are some sections. It seems to me that these sets the behavior of my portlet (if it is in view mode or in configuration mode). So I have two couple, the first one is related to the view mode: viewNamespace /nuovaPortlet defaultViewAction startTestPortlet1 and the second one is related to the edit mode: editNamespace /nuovaPortlet defaultEditAction provaAndreaPropertiesShowAction But what exactly mean? For example what exactly represent the viewNamespace and the defaultViewAction ? I think that this is something related to the content of my struts.xml file because inside it I have something like /testPortlet1/testPortlet1.jsp Or is it related to the metodo call inside my controller class? public String startTest() { this.setMessage("Hello World inner !!!"); return SUCCESS; } How exactly work?
tagged with: struts2
score: 0
tagged with: liferay

http://stackoverflow.com/q/27629015
has comment: http://stackoverflow.com/comment/43751740
has comment: http://stackoverflow.com/comment/43749807
tagged with: jgroups
tagged with: java
type: Question
has title: sharing state between threads using LocalChannel in Netty 4
has comment: http://stackoverflow.com/comment/43753036
has body: I'm building a POC with Netty 4, just a basic client/server setup; my question is how to effectively share state across threads within the server process itself, let me explain... Server The server is nothing fancy; standard logic for accepting remote connections using boss and workers event loop groups (code not shown). Where it gets interesting The server supports pluggable modules that provide metrics and group management services. The modules run autonomously as child threads, periodically generating information important for the server to function properly; this is where I'm unsure what to do; how to get info produced from the thread modules to the server process in a "netty" way. Naive Approach Local VM Channel Looking at example LocalEcho, it appears LocalChannel and LocalServerChannel provides VM (in-memory) communication, though I was expecting such channels to be easier to set up, but here goes: //in-memory server EventLoopGroup serverGroup = new DefaultEventLoopGroup(); ServerBootstrap svm = new ServerBootstrap(); svm.group(serverGroup) .channel(LocalServerChannel.class) .handler(new ChannelInitializer&lt;LocalServerChannel&gt;() { @Override public void initChannel(LocalServerChannel ch) throws Exception { ch.pipeline().addLast(new LoggingHandler(LogLevel.INFO)) } }) .childHandler(new ChannelInitializer&lt;LocalChannel&gt;() { @Override public void initChannel(LocalChannel ch) throws Exception { ch.pipeline().addLast( EventsFromModule_Handler()); } }); //start server vm svm.bind(addr).sync(); //in-memory client EventLoopGroup clientGroup = new NioEventLoopGroup(); Bootstrap cvm = new Bootstrap(); cvm.group(clientGroup) .channel(LocalChannel.class) .handler(new ChannelInitializer&lt;LocalChannel&gt;() { @Override public void initChannel(LocalChannel ch) throws Exception { ch.pipeline().addLast( new DefaultModuleHandler()); } }); Connect Modules Here's where I create and fork the modules; first I get a channel from the client vm, passing it to the module.. …
score: 0
has comment: http://stackoverflow.com/comment/43752780
tagged with: channel
answer count: 0
tagged with: multicast
type: UnansweredQuestion
tagged with: netty

http://stackoverflow.com/comment/43790411
type: Comment
type: QuestionComment
has text: @WillemJiang even if Camel decided to downgrade the default logging level to WARNING, wouldn't my above errorHandler overwrite that back to ERROR level? Regardless, I don't even get a WARNING log that the retries were exhausted. And I am not sure if I have enabled transaction support of the amq endpoint...but would that really change anything? I would've thought the errorHandler would control the exhaustion, not the dead letter endpoint. Does it actually even log anything when the retries are exhausted? I have yet to even see what it might say.
comment on: http://stackoverflow.com/q/27639628
score: 0

http://stackoverflow.com/comment/43396458
has text: @adam.kubi it have to be an array or Linked list ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27481850
score: 1

http://stackoverflow.com/q/27589780
tagged with: aspect
tagged with: java
type: Question
tagged with: aspectj
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27602506
has title: Pointcut for a method injected with AspectJ
has body: How can I define a pointcut for a method injected with ApsectJ? I have injected the method as follows and it works properly: public void com.moeActivity.onBackPressed() { super.onBackPressed(); Log.d("ATAG", "BACKK"); } Now am trying to define a pointcut to detect the execution of the injected method but it is not successful, I tried the following: pointcut eventActivity(): execution(* com.moeActivity.onBackPressed(..)); Any help would be appreciated Thanks!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43605067

http://stackoverflow.com/q/27608429
favorite count: 0
has comment: http://stackoverflow.com/comment/43639158
tagged with: android
has title: App crashing when trying to create Dialog
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27608980
has body: I am a novice. My intention is to bring about a dialogue box when the user clicks a button. The dialogue box is supposed to contain an editable text area where the user input some data, and a "Create", and "Cancel" button. I linked the button to my method via XML. However, everytime I run it the app crashes, just saying "(X App) has stopped". TerritoryList.java: /*Called upon when user clicks "Create new territory" button*/ private void creationDialog (View v) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Buisiness Call Creation"); alert.setMessage("Create a new business call"); //EditText view for user input final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton("Create", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int whichButton) { String value = input.getText().toString(); //Do something with the value } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface d, int whichButton) { //Cancelled. Do nothing } }); } } Here is my activity_territory_list.xml (just the Button): &lt;Button android:id="@+id/create_new_call" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/textView1" android:layout_marginTop="67dp" android:text="@string/create_territory" android:onClick="creationDialog" /&gt; I have taken the advice of @323go, and here is what I THINK is the correct LogCat: 12-22 19:02:11.582: E/AndroidRuntime(2138): FATAL EXCEPTION: main 12-22 19:02:11.582: E/AndroidRuntime(2138): Process: com.example.buninessterritory1, PID: 2138 12-22 19:02:11.582: E/AndroidRuntime(2138): java.lang.IllegalStateException: Could not find a method creationDialog(View) in the activity class com.example.buninessterritory1.TerritoryList for onClick handler on view class android.widget.Button with id 'create_new_call' 12-22 19:02:11.582: E/AndroidRun…
downvote count: 1
has comment: http://stackoverflow.com/comment/43639200
type: Question
linked to: http://stackoverflow.com/q/5618664
tagged with: dialog
score: -1
linked to: http://stackoverflow.com/q/27537166
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43639111
has comment: http://stackoverflow.com/comment/43639165
has answer: http://stackoverflow.com/a/27608980
has comment: http://stackoverflow.com/comment/43639078

http://stackoverflow.com/a/27634533
type: Answer
has body: The most useful way authorize your url pattern see this Security for Spring Restful Web Services
score: 0
answers question: http://stackoverflow.com/q/27634383

log4j2
tags question: http://stackoverflow.com/q/27508336
tags question: http://stackoverflow.com/q/27604923
tags question: http://stackoverflow.com/q/27562221
tags question: http://stackoverflow.com/q/27495516
tags question: http://stackoverflow.com/q/27502536
tags question: http://stackoverflow.com/q/27507450
tag name: log4j2
type: Tag
tags question: http://stackoverflow.com/q/27570355

timer
tag name: timer
tags question: http://stackoverflow.com/q/27502519
tags question: http://stackoverflow.com/q/27554075
tags question: http://stackoverflow.com/q/27563517
tags question: http://stackoverflow.com/q/27615255
tags question: http://stackoverflow.com/q/27569859
type: Tag
tags question: http://stackoverflow.com/q/27555582
tags question: http://stackoverflow.com/q/27558574
tags question: http://stackoverflow.com/q/27591407
tags question: http://stackoverflow.com/q/27555157
tags question: http://stackoverflow.com/q/27487489
tags question: http://stackoverflow.com/q/27485449
tags question: http://stackoverflow.com/q/27630003
tags question: http://stackoverflow.com/q/27628106

http://stackoverflow.com/comment/43474453
type: Comment
has text: Another question please: Where you are redirecting to PurchaseCheckOut.java?
comment on: http://stackoverflow.com/q/27487468
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43552856
type: Comment
comment on: http://stackoverflow.com/a/27561734
has text: @manivasagam I have changed your logic of appending commas, after that you don't need to remove commas. Check it out.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43494565
has text: I believe _some_ buffer is outright required, because of the way character encoding works: if you receive the first half of a surrogate pair, you have to buffer that until you receive its second half.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27532645
score: 1

model-view-controller
tags question: http://stackoverflow.com/q/27570571
tag name: model-view-controller
tags question: http://stackoverflow.com/q/27584832
tags question: http://stackoverflow.com/q/27519927
tags question: http://stackoverflow.com/q/27632001
tags question: http://stackoverflow.com/q/27627666
tags question: http://stackoverflow.com/q/27530800
type: Tag
tags question: http://stackoverflow.com/q/27566724
tags question: http://stackoverflow.com/q/27630956
tags question: http://stackoverflow.com/q/27549773
tags question: http://stackoverflow.com/q/27518403

http://stackoverflow.com/comment/43556185
type: Comment
type: AnswerComment
has text: see i posted the picture above
score: 0
comment on: http://stackoverflow.com/a/27565446

http://stackoverflow.com/comment/43537716
score: 1
comment on: http://stackoverflow.com/q/27555410
type: Comment
type: QuestionComment
has text: You could also use interfaces to maintain common functionality if required, so if the `MathsGame` really only wants to deal with a certain amount of the information/functionality, you can use an interface that all the other screens use which will simplify the process, as the `MathsGame` only needs to know about the class that implement the interface and not EVERY thing else that might be going on...as a suggestion...

http://stackoverflow.com/q/27500351
type: Question
has title: Java mailto Illegal character colon?
has body: im trying to send an email with an attachment, but it keeps saying: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Illegal character in opaque part at index 64: mailto:recipient@mailserver.com?subject=ThePDFFile&amp;attachment=C:\Users\Rascal\AppData\Local\Temp\FreelancerList-16-12-2014_09-227568200505392670736.doc Java Code: Desktop desktop = Desktop.getDesktop(); String message = "mailto:recipient@mailserver.com?subject=ThePDFFile&amp;attachment=\""+path; URLEncoder.encode(message, "UTF-8"); URI uri = URI.create(message); desktop.mail(uri); Should be the colon right? But why???
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/43431209
accepted answer: http://stackoverflow.com/a/27500391
answer count: 1
downvote count: 1
tagged with: mailto
favorite count: 0
has comment: http://stackoverflow.com/comment/43431269
has comment: http://stackoverflow.com/comment/43431237
has answer: http://stackoverflow.com/a/27500391
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43431498

http://stackoverflow.com/q/27587962
accepted answer: http://stackoverflow.com/a/27588007
linked to: http://stackoverflow.com/q/510632
has comment: http://stackoverflow.com/comment/43600063
type: Question
has answer: http://stackoverflow.com/a/27588007
has comment: http://stackoverflow.com/comment/43601113
upvote count: 2
score: 0
downvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/27588467
has body: I have query about usage of Collections.synchronizedMap(Map m) over Hashtable. We know that both will return a container where all methods are synchronized, so I don't see performance gain in any case. Then why we have utility method(Collections.synchronizedMap) when Hashtable suffice the requirement. Clarification with code will be helpful.
favorite count: 0
has answer: http://stackoverflow.com/a/27588467
type: AnsweredQuestion
has title: Collections.synchronizedMap(Map m) over Hashtable
tagged with: java
has comment: http://stackoverflow.com/comment/43600939

http://stackoverflow.com/a/27608314
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/114830682
downvote count: 0
has comment: http://stackoverflow.com/comment/43638863
has comment: http://stackoverflow.com/comment/43639386
type: Answer
has comment: http://stackoverflow.com/comment/114854808
has body: You can use this regex: (([&quot;']).*?\2|(?:[^\\ ]+\\\s+)+[^\\ ]+|\S+) RegEx Demo In Java: Pattern regex = Pattern.compile ( &quot;(([\&quot;']).*?\\2|(?:[^\\\\ ]+\\\\\\s+)+[^\\\\ ]+|\\S+)&quot; ); Explanation: This regex works on alternation: First match ([\&quot;']).*?\\2 to match any quoted (double or single) strings. Then match (?:[^\\ ]+\\\s+)+[^\\ ]+ to match any string with escaped spaces. Finally Use \S+ to match any word with no spaces.
has comment: http://stackoverflow.com/comment/43868051
upvote count: 3
has comment: http://stackoverflow.com/comment/43856266
has comment: http://stackoverflow.com/comment/43639266
score: 3
accepted answer of: http://stackoverflow.com/q/27608196
has comment: http://stackoverflow.com/comment/43865629
has comment: http://stackoverflow.com/comment/114830711
answers question: http://stackoverflow.com/q/27608196
has comment: http://stackoverflow.com/comment/114854756

http://stackoverflow.com/comment/44546407
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27620276
has text: can anyone please look into it and help me in the same.
score: 0

http://stackoverflow.com/q/27542629
tagged with: sockets
score: -3
has answer: http://stackoverflow.com/a/27542787
has comment: http://stackoverflow.com/comment/43512481
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43512358
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/43540267
has comment: http://stackoverflow.com/comment/43512555
downvote count: 3
has body: Hi I'm trying to run simple server-client game. Server is in C, client in java (it's school project I can't change that). My client is Windows 7 64bit and server is running on the Virtualbox (Debian 32bit) I'm using bridged connection via WiFi. I'm trying to just simply accept new connection and create new thread for it using TCP and sockets. When I compare if client_socket is > 0 it's alright and client is connected. But when I put some code in the if block (commented part in code bellow) socket is -1 and it can't connect (it doesn't even reach the code). It doesn't matter what code it is even if it is int x = 0 it will still not work. It seems like only printf() is OK. Thanks for any kind of response. perror() prints "Invalid argument". Here is my code for C server: #include &lt;stdio.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;sys/un.h&gt; #include &lt;unistd.h&gt; #include &lt;netinet/in.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #include &lt;pthread.h&gt; void *serve_request(void *arg){ printf("Thread is running.\n"); } int start_server (void){ int server_socket; int client_socket; int return_value; char cbuf; int *th_socket; struct sockaddr_in server_addr; struct sockaddr_in client_addr; socklen_t client_addr_len; pthread_t thread_id;; server_socket = socket(AF_INET, SOCK_STREAM, 0); if (server_socket &lt; 0) return -1; memset(&amp;server_addr, 0, sizeof(struct sockaddr_in)); server_addr.sin_family = AF_INET; server_addr.sin_port = htons(10001); server_addr.sin_addr.s_addr = INADDR_ANY; return_value = bind(server_socket, (struct sockaddr *)&amp;server_addr, sizeof(struct sockaddr_in)); if (return_value == 0) printf("Bind OK\n"); else{ printf("Bind Error\n"); return -1; } return_value = listen(server_socket, 5); if (return_value == 0) printf("Listen OK\n"); else{ printf("Listen Error\n"); return -1; } while(1){ client_socket = accept(server_socket, (struct sockaddr *)&amp;client_addr, &amp;client_addr_len); print…
has comment: http://stackoverflow.com/comment/43512430
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/43512374
answer count: 1
accepted answer: http://stackoverflow.com/a/27542787
has comment: http://stackoverflow.com/comment/43512909
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/43610882
has title: TCP server in C, Socket still negative
has comment: http://stackoverflow.com/comment/43512351
favorite count: 0
has comment: http://stackoverflow.com/comment/43513085
has comment: http://stackoverflow.com/comment/43512716

http://stackoverflow.com/a/27635825
has comment: http://stackoverflow.com/comment/43703802
answers question: http://stackoverflow.com/q/27615447
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43711495
type: Answer
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27615447
has body: When you use -d flag in curl you are actually sending a POST. If you make a POST with Jsoup It will work. But Jsoup will complain with a org.jsoup.UnsupportedMimeTypeException because server will respond with Content-Type: application/json. Then you have to add an .ignoreContentType(true) and you are done. The code would be: Document doc = Jsoup.connect(url) .header("Accept-Language", "en") .header("Authorization", "Basic " + clientCred) .header("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8") .data(data) .ignoreHttpErrors(true) .ignoreContentType(true) .header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9"+ ",*/*;q=0.8") .post(); Bytheway, I'm getting a {"error":"invalid_client"} because I don't have a key, but I think you'll be fine. I hope it will help.

http://stackoverflow.com/q/27483428
has answer: http://stackoverflow.com/a/27483626
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27483738
has body: Is it possible to stop getting negative numbers in TextView in android by writing a code in java. I tried this int up = 0; TextView textview; if (allowNagativeNumbers == false) { if ( up &lt; 0 ) { up = 0; textview.setText(0); } } but it still allows negative numbers. I am not sure if this code is right but by this code I mean everytime the value for up / text in textview is less then 0 e.g. -1 then change the value of up to 0 and make the textview text 0.
has comment: http://stackoverflow.com/comment/43399432
score: 0
has answer: http://stackoverflow.com/a/27483586
upvote count: 1
downvote count: 1
tagged with: textview
has comment: http://stackoverflow.com/comment/43399364
favorite count: 0
has comment: http://stackoverflow.com/comment/43399254
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27483607
has comment: http://stackoverflow.com/comment/43399305
answer count: 4
has comment: http://stackoverflow.com/comment/43399235
tagged with: negative-number
has title: Prevent negative numbers in Textview android - Code

http://stackoverflow.com/q/27587672
has body: First time with Java 8 and I encountered this bug. Anyone encountered this too? Bug is marked as resolved however I'm not sure why I'm getting it. I also excuted the listed sample code in the bug and did get UOE. Here's my environment: OS in VM x64 $ cat /etc/lsb-release DISTRIB_ID="elementary OS" DISTRIB_RELEASE=0.2.1 DISTRIB_CODENAME=luna DISTRIB_DESCRIPTION="elementary OS Luna" JDK $ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) $ javac -version javac 1.8.0_25 Here's my test package test; import org.junit.Test; import java.lang.reflect.Method; import java.util.Arrays; import java.util.List; public class RemoveIfTest { static interface I { // i want to remove this public void a(); public String b(); } @Test(expected = UnsupportedOperationException.class) public void test() { List&lt;Method&gt; methods = Arrays.asList(I.class.getMethods()); // what we have methods.forEach(m -&gt; System.out.println(m)); // output: public abstract void test.RemoveIfTest$I.a() // public abstract java.lang.String test.RemoveIfTest$I.b() // old way for (Method method : methods) { if (method.getReturnType().equals(Void.TYPE)) { System.out.println("Remove this &gt; " + method); } } // output: Remove this &gt; public abstract void test.RemoveIfTest$I.a() // got UOE methods.removeIf(m -&gt; m.getReturnType().equals(Void.TYPE)); } } And here's a screenshot of the evaluated line The highlighted line is where it died
type: Question
has answer: http://stackoverflow.com/a/27587810
has title: Encountered in Java 8 - JDK-8023339 : j.u.Arrays.asList().removeIf() is "lazy" in throwing java.lang.UnsupportedOperationException
score: 0
has comment: http://stackoverflow.com/comment/43599541
answer count: 3
upvote count: 1
tagged with: lambda
has comment: http://stackoverflow.com/comment/43599483
tagged with: java-8
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27587891
has answer: http://stackoverflow.com/a/38674234
has comment: http://stackoverflow.com/comment/43634609
has comment: http://stackoverflow.com/comment/43599557
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/43599567

http://stackoverflow.com/comment/43665257
comment on: http://stackoverflow.com/q/27622064
type: Comment
type: QuestionComment
score: 0
has text: @Sotirios Delimanolis my app is little messy right now and I'm afraid to get confused with dependencies all around the code. It's not religious and I love Autowired, but right now I'd prefer to concentrate beans in one config file and manage dependencies by hands. Also I wonder if it's possible at all.

http://stackoverflow.com/q/27604811
accepted answer: http://stackoverflow.com/a/27613455
has body: We have recently migrated to SQL server 2014 with JAVA 5 on one machine and JAVA 6 on another (this is a requirement). When I try to connect to database I get follwoing exception. org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: ( com.microsoft.sqlserver.jdbc.SQLServerException: The server version is not supported. The target server must be SQL Server 2000 or later. ) at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:168) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:508) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207) Following is the configuration: OS: Windows server 2012 SQL server 2014 JAVA version: JDK5u11 and JDK6u24 Jar file: sqljdbc.jar for JDK5 and sqljdbc4.jar for JDK6
downvote count: 0
possible better answer: http://stackoverflow.com/a/28937749
linked to: http://stackoverflow.com/q/28022701
has answer: http://stackoverflow.com/a/28937749
favorite count: 0
tagged with: sql-server
linked to: http://stackoverflow.com/q/1483732
tagged with: sql
tagged with: sql-server-2014
tagged with: jdbc
upvote count: 3
has answer: http://stackoverflow.com/a/27613455
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43632382
type: Question
has title: JDBC driver for SQL server 2014
answer count: 2

http://stackoverflow.com/comment/43470197
type: Comment
comment on: http://stackoverflow.com/q/27520321
type: QuestionComment
score: 2
has text: possible duplicate of [Adding days to a date in Java](http://stackoverflow.com/questions/12087419/adding-days-to-a-date-in-java)

http://stackoverflow.com/a/27565342
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27564958
upvote count: 1
score: 1
has body: This may help: String jsonStr = "[" + "\"foo\"," + " [" + " \"foot mercato\"," + " \"football\"," + " \"foot center\"," + " \"foorzik\"," + " \"footao\"" + " ]" + "]"; Gson gson = new Gson(); ArrayList&lt;Object&gt; dest = new ArrayList&lt;Object&gt;(); dest = gson.fromJson(jsonStr, dest.getClass()); for (Object e : dest) { System.out.println("T:" + e.getClass().getCanonicalName()); if (e instanceof String) { System.out.println(e); } else if (e instanceof ArrayList) { for (String ele : (ArrayList&lt;String&gt;) e) { System.out.println(ele); } } } Will generate: T:java.lang.String foo T:java.util.ArrayList foot mercato football foot center foorzik footao

http://stackoverflow.com/comment/54565981
has text: I agree with you, It is just a simple solution which can help just in simple cases.
type: Comment
comment on: http://stackoverflow.com/a/33373685
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43601501
comment on: http://stackoverflow.com/q/27588663
has text: I tried what I already said, re-read my question, and people out there please down vote for a reason.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27512347
tagged with: infinite-loop
upvote count: 0
has comment: http://stackoverflow.com/comment/43455791
has comment: http://stackoverflow.com/comment/43456461
has comment: http://stackoverflow.com/comment/43456493
has body: I am currently taking a text file and reading it into a string. I am then breaking the string up into words and adding each word onto a binary tree. for some reason I cannot get to the end of my string without getting this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 867183 at java.lang.String.charAt(String.java:686) at Tester.breakIntoWords(Tester.java:71) at Tester.it(Tester.java:21) at Tester.main(Tester.java:11) Tester Class (has method breakIntoWords) public class Tester { public static void main(String[] args) throws FileNotFoundException { Tester run = new Tester(); run.it(); } public void it() throws FileNotFoundException { BTree theTree = new BTree(); String str = this.readInFile(); this.breakIntoWords(str, theTree); theTree.print(); } public String readInFile() throws FileNotFoundException { String myFile = ""; Scanner myScan = new Scanner(new File("Dracula.txt")); while(myScan.hasNext() == true) { myFile += myScan.nextLine() + " "; } return myFile; } public void breakIntoWords(String myFile, BTree theTree) { String nextWord = ""; int position = 0; char next = myFile.charAt(position); next = Character.toLowerCase(next); // First trim beginning while (((next &lt; 'a') || (next &gt; 'z')) &amp;&amp; !Character.isDigit(next)) { position++; next = myFile.charAt(position); next = Character.toLowerCase(next); } while(myFile.length() &gt; position) { // Now pull only letters or numbers until we hit a space if(Character.isWhitespace(next)){ position++; next = myFile.charAt(position); next = Character.toLowerCase(next); } while(!Character.isWhitespace(next)) { if (Character.isLetterOrDigit(next)) { nextWord += myFile.charAt(position); } position++; next = myFile.charAt(position); } theTree.add(nextWord); nextWord = ""; } } } BTree Class public class BTree { private BTNode root; private int nodeCount; public boolean add(String word){ BTNode myNode = new BTNode(word); if(root == null){ root = myNode; nodeCoun…
tagged with: binary-tree
has title: String Index Out Of Bounds Exception: String index out of range
has comment: http://stackoverflow.com/comment/43455062
favorite count: 0
has answer: http://stackoverflow.com/a/27513017
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43455131
downvote count: 1
has answer: http://stackoverflow.com/a/27512986
has comment: http://stackoverflow.com/comment/43456049
tagged with: java
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43456678

http://stackoverflow.com/comment/69006387
comment on: http://stackoverflow.com/a/27598164
type: Comment
has text: @AxelH Except for the middles of financial calculations where fractional cents can exist, money is always discrete. You would use one integer type to store the data. So $5.34 would be stored as 534. The dollar portion is val/100 in integer math, and the cents are val%100 in integer math, where % refers to the remainder operation. For money with more places past the decimal it should still be stored as integral because it's discrete. Even if it isn't discrete, often you'll want to back off to a discrete storage most of the time because it's precise so you won't lose money to rounding errors.
score: 9
type: AnswerComment

http://stackoverflow.com/comment/43585975
type: Comment
type: QuestionComment
has text: The error it gives you. The whole thing. When it spits back at you, copy/paste all of it, not just the first line. Try adding "e.printStackTrace()" to the catch block, and giving us everything that appears.
comment on: http://stackoverflow.com/q/27580444
score: 0

http://stackoverflow.com/comment/43482309
type: QuestionComment
comment on: http://stackoverflow.com/q/27524301
has text: Yes, but where are these methods in java?
score: 0
type: Comment

http://stackoverflow.com/q/27496598
has comment: http://stackoverflow.com/comment/43441229
has title: Input an image from some saved location on computer
score: 0
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/43439007
type: Question
has body: I have a draw function public void drawBoard(Graphics g) { int height = this.getHeight(); int width = this.getWidth(); int dx = width / 7; int dy = height / 6; for (int x = 0, row = 0; x &lt;= width &amp;&amp; row &lt; gameboard.length; row++, x += dx) { for (int col = 0, y = 0; y &lt;= height&amp;&amp; col &lt; gameboard[0].length; y += dy, col++) { if (gameboard[row][col] == 0) { g.setColor(Color.GRAY); g.fillOval(y, x, dy, dx); } else if (gameboard[row][col] == 1) { g.setColor(Color.RED); g.fillOval(y, x, dy, dx); } else if(gameboard[row][col] == 1){ g.setColor(Color.BLACK); g.fillOval(y, x, dy, dx); } else if(gameboard[row][col]==3){ }else if(gameboard[row][col]==4){ }else if(gameboard[row][col]==5){ }else if(gameboard[row][col]==6){ }else if(gameboard[row][col]==7){ }else if(gameboard[row][col]==8){ }else if(gameboard[row][col]==9){ } } } } However for when gameboard[row][col]=3,4,...9 I want it to change that slot into a picture downloaded from the web. How do I do that? I would prefer to do it without a URL definition and simply a get Document like thing in html where I have the photos saved in a file
answer count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/27509282
type: UnansweredQuestion

http://stackoverflow.com/comment/43391847
type: Comment
type: QuestionComment
has text: *Clearly* the file *does* exist. ***Obviously.***
comment on: http://stackoverflow.com/q/27479011
score: 1

http://stackoverflow.com/comment/43470560
type: Comment
score: 1
has text: @InsideFootball You need to verify the data types of all the parameters you are passing. It certainly means String is needed and you are passing an int. And I doubt if it is regarding the `bankAccount.getTransactions().size()` parameter as `size()` is supposed to give you int value but in your constructor you need `String transactionType` String value. You will have to change the types as per your need. And a hint to convert int value to String you can use `String.valueOf();`
type: AnswerComment
comment on: http://stackoverflow.com/a/27520312

http://stackoverflow.com/a/27602266
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27602066
has body: This would produce the output you want. The part next to the Logical OR | operator will matches the [-+*/$£] symbols from the remaining sub-string. Pattern pattern = Pattern.compile("\\d+(?:\\.\\d+)?(\\s\\d+(?:\\.\\d+)?)*\\s*[-+*/$£]|[-+*/$£]"); String input = "4.0 5.0 2.0 / + 7.0 - 11.0 34.0 2.0 / 3.0 / 1.0 * +"; Matcher matcher = pattern.matcher(input); ArrayList&lt;String&gt; output = new ArrayList&lt;String&gt;(); while (matcher.find()) { output.add(matcher.group()); } for (String s: output) { System.out.println(s); } Output: 4.0 5.0 2.0 / + 7.0 - 11.0 34.0 2.0 / 3.0 / 1.0 * +
answers question: http://stackoverflow.com/q/27602066

http://stackoverflow.com/comment/43437581
has text: @bigdestroyer Well I have tried right click Libraries->Add JAR/Folder and selected folder with JARs but it doesn't work anyway.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27503611
score: 0

http://stackoverflow.com/comment/43426349
type: Comment
type: QuestionComment
score: 0
has text: It can be done by reflection but same kind of feature be achieved by using Map.
comment on: http://stackoverflow.com/q/27497450

http://stackoverflow.com/comment/43537522
type: QuestionComment
score: 0
has text: Another solution might be to allow the model to actually do it's job and instead of reading the data directly from the changing `ArrayList`, which might cause race conditions between the `ArrayList` and the UI, use a `DefaultTableModel` and simply call `setValueAt` (or if empty, `addRow`), making sure you synchronise the updates between what ever is updating the `ArrayList` and the Event Dispatching Thread
comment on: http://stackoverflow.com/q/27555582
type: Comment

http://stackoverflow.com/q/27509205
possible better answer: http://stackoverflow.com/a/27509743
type: Question
has title: How do you do unit tests for getters and setters?
has comment: http://stackoverflow.com/comment/43448365
has body: I am new to tdd and the mockito web framework. Basically this is the getter method in the class: public Long getDeviceManufactureId() { return deviceManufacturerId; } How would I write a unit test? so far I am thinking this: dem is the name of the class @Test public void testGetDeviceManufactureIdreturnsDeviceManufactureId() { assertEquals("Richard", dem.getDeviceManufactureId()); }
has comment: http://stackoverflow.com/comment/43448610
tagged with: tdd
score: 0
has answer: http://stackoverflow.com/a/27509528
answer count: 2
accepted answer: http://stackoverflow.com/a/27509528
has comment: http://stackoverflow.com/comment/43457961
has comment: http://stackoverflow.com/comment/43448921
has comment: http://stackoverflow.com/comment/43448718
has comment: http://stackoverflow.com/comment/43457941
has answer: http://stackoverflow.com/a/27509743
has comment: http://stackoverflow.com/comment/43448447
has comment: http://stackoverflow.com/comment/43449231
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43448643
tagged with: java
linked to: http://stackoverflow.com/q/6197370
tagged with: unit-testing

http://stackoverflow.com/a/27538809
answers question: http://stackoverflow.com/q/27538706
has body: For example, if you're reading a file , and some IO error occurs, you're unlikely to recover from the error, so re-throwing the error to the top and consequently terminating the application isn't a bad course of action. On the other hand, if you're anticipating recoverable errors then you should absolutely catch and handle the errors. For example, you may have users entering data in a form. If they enter data incorrectly, your input processing code may throw an exception (e.g. NumberFormatException when parsing a malformed number string). Your code should catch these exceptions and return an error the user, prompting for correct input. When catching an exception and throwing RuntimeException instead, it is important to set the original exception as a cause for the RuntimeException. i.e. throw new RuntimeException(originalException).
upvote count: 5
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/90471854
type: Answer

http://stackoverflow.com/comment/43618694
has text: Why you were converting itr.next() with toString()? Do you want to do something specific here? If not, then null check on itr.next() (returns Object) would be sufficient to make a proper condition.
comment on: http://stackoverflow.com/a/27580968
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/27557760
answers question: http://stackoverflow.com/q/27557669
has comment: http://stackoverflow.com/comment/43541707
has body: The terminology isn't really the issue here, it has to do with the specific way these errors/exceptions occur, and how they are recovered from. From the JLS section 11.2: Of the unchecked exception classes, error classes are exempted because they can occur at many points in the program and recovery from them is difficult or impossible. A program declaring such exceptions would be cluttered, pointlessly. Sophisticated programs may yet wish to catch and attempt to recover from some of these conditions. Of the unchecked exception classes, run-time exception classes are exempted because, in the judgment of the designers of the Java programming language, having to declare such exceptions would not aid significantly in establishing the correctness of programs. Many of the operations and constructs of the Java programming language can result in exceptions at run time. The information available to a Java compiler, and the level of analysis a compiler performs, are usually not sufficient to establish that such run-time exceptions cannot occur, even though this may be obvious to the programmer. Requiring such exception classes to be declared would simply be an irritation to programmers. For example, certain code might implement a circular data structure that, by construction, can never involve null references; the programmer can then be certain that a NullPointerException cannot occur, but it would be difficult for a Java compiler to prove it. The theorem-proving technology that is needed to establish such global properties of data structures is beyond the scope of this specification. This provides such explanation as to why certain exceptions are termed "Runtime" and some are not. Checked exceptions can be enforced by the compiler, which requires the programmer completely eliminate or otherwise prevent unwanted execution.
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43541824
score: 2

http://stackoverflow.com/a/27507274
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/63435655
answers question: http://stackoverflow.com/q/27506442
downvote count: 0
has body: AFAIK Codenvy SDK does not support console app, only web-apps. To support different types of applications in the SDK docker can be used. But I don't know how to use it in SDK. By the way you can use hosted version of Codenvy which support console apps (will be started in the docker.) You should not configure docker to use it, but custom receipts are supported too. Here is console hello world app created in my workspace with Codenvy wizard. This URL is factory - feature that allow to share projects easily. To copy this project to your workspace click "Persist" button on the top of IDE. Or create your own with a project wizard.

http://stackoverflow.com/comment/43450982
comment on: http://stackoverflow.com/a/27510240
type: Comment
has text: I do not have resources or main folder under src. I've used eclipse and I know that there is like that: src/main/java src/main/resources However, in idea under src i have only my packages.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43579066
type: QuestionComment
comment on: http://stackoverflow.com/q/27576901
score: 3
has text: its very logical ..if someone can understand
type: Comment

http://stackoverflow.com/comment/43460249
comment on: http://stackoverflow.com/a/27513735
type: Comment
type: AnswerComment
has text: @saboehnke, I apologize for my oversight. Please take a look at my edit.
score: 0

http://stackoverflow.com/comment/43525415
type: QuestionComment
comment on: http://stackoverflow.com/q/27536835
score: 1
has text: A ResultSet in JSP is similar to a Recordset in Classic ASP
type: Comment

http://stackoverflow.com/comment/43633723
has text: Is the reason for asking this question related to mixing up a Gaussian Blur and a Gaussian Distribution? The whole point of a Gaussian Distribution *is* to contain "all values" (with a peak around 0, as already said in the answers)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27604251
score: 1

http://stackoverflow.com/a/27627178
has body: It is likely the text fields are getting precedence on the key event notification, meaning your key binding isn't getting notified until after the text field has been updated Generally speaking, you really don't want to monitor key strokes/events on text components, as it does not take into consideration the use case where the user pastes text into field If you want to filter content going into textField you should use a DocumentFilter See Implementing a DocumentFilter
answers question: http://stackoverflow.com/q/27626596
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43686514
score: 2
has comment: http://stackoverflow.com/comment/43690585
upvote count: 2

http://stackoverflow.com/q/27579143
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43582916
type: AnsweredQuestion
has title: java.lang.NullPointerException with a game
tagged with: oop
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27579196
accepted answer: http://stackoverflow.com/a/27579196
score: 0
answer count: 1
has body: i have been trying to a cards game with java but some how it keeps falling. this game an odd number of players and each of them has a queue of cards the first player that is card queue is empty wins. every time i compile it keep giving me java.lang.NullPointerException error. thank you for helping. package cardgame; import unit4.collectionsLib.Queue;//importing the queue public class Main { public static boolean checkIsEmpty(Queue&lt;Player&gt; p){ boolean is=false; p.insert(null); while(p.head()!=null){ if(p.head().getC().isEmpty()){ is=false; p.insert(p.remove()); } } p.remove(); return is; } public static int whoWin(Queue&lt;Player&gt; p){ p.insert(null); while(p.head()!=null){ if(p.head().getC().isEmpty()){ return p.head().getIndex(); } } return 0; } public static void main(String[] args) { Queue&lt;Player&gt; players = new Queue(); //queue of players for(int i=0;i&lt;5;i++){ players.insert(new Player()); } boolean isOver=false; while(!isOver) //the game is over when one player finished his cards { Player p = players.remove(); if(p.getC().head().greater(players.head().getC().head())==1){ p.getC().remove(); players.insert(p); players.insert(players.remove()); } else if(p.getC().head().greater(players.head().getC().head())==2){ players.head().getC().remove(); players.insert(p); players.insert(players.remove()); } else{ players.head().getC().remove(); p.getC().remove(); players.insert(p); players.insert(players.remove()); } if(checkIsEmpty(players)){ isOver=true; System.out.println("the winner in this game is player number :"+whoWin(players)); } } } } package cardgame; import unit4.collectionsLib.Queue; public class Player { static int autonum=1; private Queue&lt;Card&gt; c; private int index; public Player() { for(int i=0;i&lt;7;i++){ c.insert(new Card());} this.index=autonum; autonum++; } /** * @return the c */ public Queue&lt;Card&gt; getC() { return c; } /** * @param c the c to set */ public void setC(Queue&lt;Card&gt; c) { this.c = c; } public int getIndex(){ …

http://stackoverflow.com/q/27480587
has body: I'm building a dynamic web project using JSP and Servlets with Tomcat 7.0 in Eclipse. Everything works fine when I have the CSS-code inside the JSP-file, but when I'm moving it into a seperate file, I can't get the JSP-file to find the CSS-file. My file strucuture look like this: MyProject -src -build -lib -WebContent --MyJsp.jsp --MyCss.css --META-INF --WEB-INF This is what I've tried: &lt;link rel = "stylesheet" type ="text/css" href = "/MyCss.css"/&gt; &lt;link rel = "stylesheet" type ="text/css" href = "MyCss.css"/&gt; &lt;link rel = "stylesheet" type ="text/css" href = "/MyProject/WebContent/MyCss.css"/&gt; &lt;link rel = "stylesheet" type ="text/css" href = "${pageContext.request.contextPath}/MyCss.css"/&gt; Literally nothing works. The JSP-pages doesn't find the CSS-file. (I'm not using a web.xml and the first that is loaded is a servlet, if that has someting to do with it). I know that other threads about this issue exists, but none of the answers works for me. Hank
has answer: http://stackoverflow.com/a/27480898
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/43395951
has title: Can't link CSS-file to JSP
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27480989
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43394824
type: UnansweredQuestion
upvote count: 1
tagged with: css
has comment: http://stackoverflow.com/comment/43394246
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27480691
has answer: http://stackoverflow.com/a/27480762

http://stackoverflow.com/comment/43678126
comment on: http://stackoverflow.com/q/27627288
has text: Please add the information to your question by using the `edit` button, and delete it from the comments. The comments are not a good place for code or output, and SO prefers we keep them short.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/27580203
score: 0
answers question: http://stackoverflow.com/q/27578986
type: Answer
has comment: http://stackoverflow.com/comment/43600534
has body: You should use the Google Custom Search JSON/Atom API The JSON/Atom Custom Search API lets you develop websites and applications to retrieve and display search results from Google Custom Search programmatically. With this API, you can use RESTful requests to get either web search or image search results in JSON or Atom format. You can find an alternative way here: Google Search by Image API? using TinEye API

http://stackoverflow.com/q/27490381
type: AnsweredQuestion
tagged with: interrupted-exception
has answer: http://stackoverflow.com/a/27490635
tagged with: java
accepted answer: http://stackoverflow.com/a/27490635
tagged with: multithreading
linked to: http://stackoverflow.com/q/2787094
type: Question
upvote count: 12
score: 12
has body: I am bit confused with the behaviour of thread.isInterrupted in the program below. public class ThreadPractice { public static void main(String args[]) throws InterruptedException { Thread t = new Thread(new Runnable() { @Override public void run() { try { System.out.println("Starting thread..." + Thread.currentThread().getName()); Thread.sleep(10000); System.out.println("Waking up"); }catch(InterruptedException e){ System.out.println("Thread is interrupted!!!"); Thread.currentThread().interrupt(); } } }); t.start(); Thread.sleep(2000); t.interrupt(); //System.out.println(!t.isInterrupted()); while(!t.isInterrupted()){ System.out.println("Current thread not interrupted!!!"); } } } When executing the above program as such, it prints, Starting thread...Thread-0 Thread is interrupted!!! But when I uncomment the System.out statement to print the interrupt status, it runs into an infinite loop printing "Current thread not interrupted" I am not able to figure out exactly what difference System.out statement makes.
answer count: 1
downvote count: 0
favorite count: 0
has title: Different behaviour when calling thread.isInterrupted and printing the result

http://stackoverflow.com/comment/43407791
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27483437
type: Comment
has text: Thanks for great explanation! However, I didn't understand how to make antlr fail-fast? Really, I need an exception if input is mismatched, only exception without trying to ignore errors. How could I implement this?

http://stackoverflow.com/comment/43433585
score: 0
type: AnswerComment
has text: Check the number of elements that you insert into the stack. It seems that you are doing more `s.pop()` than `s.push()`.
type: Comment
comment on: http://stackoverflow.com/a/27501494

http://stackoverflow.com/q/27566561
type: UnansweredQuestion
has body: I am working on Hotel reservation project, I made two tables Hotel and RoomType, Table RoomType has different types of rooms, now I am registering the hotel in hotel table and every hotel have different type of rooms so for that hotel I am trying to insert number of different type of rooms it has, into the separate table room using hotel_id as a foreign key. But My code is not working for inserting the number of different room types that hotel have, In the following java code first I register the hotel, if it is successful insert information of hotel in to hotel then for that hotel I am trying to insert number of different number type of room type into table RoomType, But it is not successful, I am getting error on browser as followes You are successfully registered ...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 'where hotel_id='16'' at line 1 **Hotel Table** CREATE TABLE hotel ( hotel_id varchar(100) NOT NULL, name varchar(100) NOT NULL, city varchar(100) NOT NULL, address text NOT NULL, Locality tinytext NOT NULL, PRIMARY KEY (hotel_id) ) **RoomType Table** CREATE TABLE roomtype ( hotel_id varchar(100) NOT NULL, roomtype1 varchar(100) UNIQUE, roomtype2 varchar(100) UNIQUE, roomtype3 varchar(100) UNIQUE, roomtype4 varchar(100) UNIQUE, FOREIGN KEY (hotel_id) REFERENCES hotel (hotel_id) ) Javacode try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotelres","root","1234"); PreparedStatement ps=con.prepareStatement("insert into hotel(hotel_id,name,city,address,Locality ) values('"+hotel_id+"','"+name+"','"+city+"','"+address+"','"+locality+"')"); //PreparedStatement ps=con.prepareStatement("insert into registeruser(Name, Password) values('"+n+"','"+p+"')"); int i=ps.executeUpdate(); if(i&gt;0){ out.print("You are successfully registered ..."); ps=con.prepa…
has answer: http://stackoverflow.com/a/27566695
score: 0
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/27566629
has title: How to insert value into table for given condition using Java servlet?
tagged with: servlets
type: Question
answer count: 2

http://stackoverflow.com/comment/43620457
comment on: http://stackoverflow.com/a/27526779
type: Comment
score: 0
type: AnswerComment
has text: That fixed it. Removed "select *" from query and it is working fine. Thanks.

http://stackoverflow.com/comment/43687102
score: 0
comment on: http://stackoverflow.com/q/27633700
type: Comment
type: QuestionComment
has text: Please wait a second pasting log cat error

http://stackoverflow.com/comment/43501005
type: Comment
type: QuestionComment
has text: I just tried this answer. Now the program compiles but when I click on the desired menu tab, nothing happens! :(
comment on: http://stackoverflow.com/q/27532351
score: 0

http://stackoverflow.com/q/27613854
score: -1
type: Question
has body: Can anyone explain to me how this nums.length-2 works so that you would be able to use i+1 and i+2 in the loop public boolean array123(int[] nums) { for (int i=0; i &lt; nums.length-2; i++) { if (nums[i]==1 &amp;&amp; nums[i+1]==2 &amp;&amp; nums[i+2]==3) return true; } return false; }
has title: Out of bounds in array loop
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/27613927
has comment: http://stackoverflow.com/comment/43649839
answer count: 3
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43649719
downvote count: 1
has answer: http://stackoverflow.com/a/27614012
has answer: http://stackoverflow.com/a/27613968
tagged with: java

http://stackoverflow.com/a/27559714
upvote count: 1
type: AcceptedAnswer
has body: Please refer to Formatting Numeric Print Output Try System.out.format(" %-10s%-10.2f%10.2f%n")
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27559683
score: 1
answers question: http://stackoverflow.com/q/27559683
has comment: http://stackoverflow.com/comment/43545896

http://stackoverflow.com/q/27558890
tagged with: object
tagged with: libgdx
has body: I'm trying to get an array of objects to render into a gamescreen. I've looked around and found some similar questions asked by others, but I can't seem to apply the answers they've gotten to my program. The problem seems to occur in the nested for-loops. In trying to solve this issue, I've gotten Java NullPointerExceptions at the first line within those for loops. package com.frfanizz.agility; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL30; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class GameScreen implements Screen { AgilityGame game; OrthographicCamera camera; SpriteBatch batch; Hero hero; Spark[] sparkArray; int totalSparks; public GameScreen(AgilityGame game) { this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(true, 1920, 1080); batch = new SpriteBatch(); hero = new Hero(60,540); //Variables to set spark array int screenX = 1400; int screenY = 1200; int numOfRow = 11; int numOfCol = 8; float spacingRow = screenY/(numOfRow + 1); float spacingCol = screenX/(numOfCol + 1); int totalSparks = numOfRow*numOfCol; //Spark array Spark[] sparkArray = new Spark[totalSparks]; //setting bounds for sparks int index = 0; for (int i=0;i&lt;numOfCol;i++) { for (int j=0; j&lt;numOfRow;j++) { //sparkArray[index] = new Spark(); sparkArray[index].bounds.x = (float) (60 + spacingCol + ((i)*spacingCol)); sparkArray[index].bounds.y = (float) (spacingRow + ((j-0.5)*spacingRow)); index++; } } } @Override public void render(float delta) { Gdx.gl.glClearColor(1F, 1F, 1F, 1F); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); camera.update(); generalUpdate(); batch.setProjectionMatrix(camera.combined); batch.begin(); //Rendering code batch.draw(Assets.spriteBackground, 0, 0); batch.draw(hero.image,hero.bounds.x,hero.bounds.y); for (int i=0; i&lt;totalSparks; i++) { batch.draw(sparkArray[i].image,sparkArray[i].bounds.x,spark…
has title: Java - array of objects not storing values (scope?)
has answer: http://stackoverflow.com/a/27558914
score: 0
linked to: http://stackoverflow.com/q/7015683
tagged with: arrays
answer count: 1
linked to: http://stackoverflow.com/q/2100991
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26840640
tagged with: java
type: Question

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/27498020
tags question: http://stackoverflow.com/q/27630630
tags question: http://stackoverflow.com/q/27581963
tags question: http://stackoverflow.com/q/27491829
tags question: http://stackoverflow.com/q/27540916
tags question: http://stackoverflow.com/q/27554370
tags question: http://stackoverflow.com/q/27523162
tags question: http://stackoverflow.com/q/27528698
tags question: http://stackoverflow.com/q/27522329
type: Tag
tags question: http://stackoverflow.com/q/27550151
tags question: http://stackoverflow.com/q/27614981
tags question: http://stackoverflow.com/q/27482645
tags question: http://stackoverflow.com/q/27605000
tags question: http://stackoverflow.com/q/27537064
tags question: http://stackoverflow.com/q/27539425
tags question: http://stackoverflow.com/q/27574035
tags question: http://stackoverflow.com/q/27597545
tags question: http://stackoverflow.com/q/27595913
tags question: http://stackoverflow.com/q/27524697
tags question: http://stackoverflow.com/q/27498008
tags question: http://stackoverflow.com/q/27612537
tags question: http://stackoverflow.com/q/27614324
tags question: http://stackoverflow.com/q/27562194
tags question: http://stackoverflow.com/q/27559503
tags question: http://stackoverflow.com/q/27521871
tags question: http://stackoverflow.com/q/27569619
tags question: http://stackoverflow.com/q/27622016
tags question: http://stackoverflow.com/q/27532991
tags question: http://stackoverflow.com/q/27520515
tags question: http://stackoverflow.com/q/27589833
tags question: http://stackoverflow.com/q/27578517
tags question: http://stackoverflow.com/q/27523276
tags question: http://stackoverflow.com/q/27567550
tags question: http://stackoverflow.com/q/27605152
tags question: http://stackoverflow.com/q/27550595
tags question: http://stackoverflow.com/q/27550036
tags question: http://stackoverflow.com/q/27561332
tags question: http://stackoverflow.com/q/27585690
tags question: http://stackoverflow.com/q/27531356
tags question: http://stackoverflow.com/q/27563936
tags question: http://stackoverflow.com/q/27624483
tags question: http://stackoverflow.com/q/27577315
tags question: http://stackoverflow.com/q/27480913
tags question: http://stackoverflow.com/q/27504774
tags question: http://stackoverflow.com/q/27528148
tags question: http://stackoverflow.com/q/27562427
tags question: http://stackoverflow.com/q/27501148
tags question: http://stackoverflow.com/q/27615597
tags question: http://stackoverflow.com/q/27513487
tags question: http://stackoverflow.com/q/27589439
tags question: http://stackoverflow.com/q/27503155
tags question: http://stackoverflow.com/q/27506381
tags question: http://stackoverflow.com/q/27514571
tags question: http://stackoverflow.com/q/27568112
tags question: http://stackoverflow.com/q/27526417
tags question: http://stackoverflow.com/q/27543072
tags question: http://stackoverflow.com/q/27581005
tags question: http://stackoverflow.com/q/27478308
tag name: xml
tags question: http://stackoverflow.com/q/27547292
tags question: http://stackoverflow.com/q/27507814
tags question: http://stackoverflow.com/q/27494302
tags question: http://stackoverflow.com/q/27639987
tags question: http://stackoverflow.com/q/27534512
tags question: http://stackoverflow.com/q/27613952
tags question: http://stackoverflow.com/q/27600622
tags question: http://stackoverflow.com/q/27629575
tags question: http://stackoverflow.com/q/27586365
tags question: http://stackoverflow.com/q/27510881
tags question: http://stackoverflow.com/q/27562766
tags question: http://stackoverflow.com/q/27619217
tags question: http://stackoverflow.com/q/27529494
tags question: http://stackoverflow.com/q/27501806
tags question: http://stackoverflow.com/q/27601491
tags question: http://stackoverflow.com/q/27585719
tags question: http://stackoverflow.com/q/27524048
tags question: http://stackoverflow.com/q/27568002
tags question: http://stackoverflow.com/q/27522445
tags question: http://stackoverflow.com/q/27494775

http://stackoverflow.com/comment/43679890
type: AnswerComment
has text: i am not able to do it be cause the website say that i am only able to post once every 90 minutes
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27629433

http://stackoverflow.com/comment/43570330
score: 0
type: QuestionComment
has text: why do you have a `break;`, then?
type: Comment
comment on: http://stackoverflow.com/q/27572128

http://stackoverflow.com/q/27615310
has comment: http://stackoverflow.com/comment/43653026
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43652757
has comment: http://stackoverflow.com/comment/43652372
favorite count: 0
has body: So am trying to use runOnUiThread() to update my LogUI (found in my apps MainActivity) which is a TextView. The issue is am trying to update the TextView using runOnUiThread() from another class by getting the strings to be made on the View. Here is details of my code to elaborate my issue: private LoggingClass getLogs; getLogs.AddtoLogUI(String.format("Established on port: %d", obj)); Then the LoggingClass code: public class LoggingClass { private MainActivity updateUI; private String stringValue; public void AddtoLogUI(final String format) { this.stringValue = format; updateUI.runOnUiThread(new Runnable(){ @Override public void run() { MainActivity.log_this(stringValue); } }); } } The method MainActivity.log_this() code is like this: public static void log_this(final String msg){ if(editable.toString().split("\n").length &gt;=50) { editable.delete(0, editable.toString().indexOf("\n")); } Runnable runnable = new Runnable(){ @Override public void run() { editable.append(msg); editable.append("\n"); } }; LogView.post(runnable); } PS: LogView is a TextView. The NullpointerException is thrown when am trying to get the Strings using the getLogs.AddtoLogUI() method. Any suggestions? Additional Info as regards the object: `Object obj[] = new Object[1]; obj[0] = Integer.valueOf(Port);`
has title: NullPointerException using runOnUiThread()
type: Question
tagged with: android
score: -1
has answer: http://stackoverflow.com/a/27615424
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43652279
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/27639312
has comment: http://stackoverflow.com/comment/43652321
linked to: http://stackoverflow.com/q/218384

http://stackoverflow.com/comment/80298464
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27566183
type: Comment
has text: FYI, the button you want looks like a physical pushpin. It's not related to "Pinned Mode" which you would see if you click on the tab in the tab bar in e.g. Run or Debug tabs on the bottom.

http://stackoverflow.com/comment/43489982
comment on: http://stackoverflow.com/q/27530529
has text: It is probably a permissions problem database user. See http://dev.mysql.com/doc/refman/5.6/en/access-denied.html
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43590648
has text: http://stackoverflow.com/questions/5662685/point-of-byte-and-short-in-java-ive-read-the-other-questions/
type: QuestionComment
comment on: http://stackoverflow.com/q/27582233
score: 0
type: Comment

http://stackoverflow.com/comment/43409304
type: Comment
type: QuestionComment
has text: Does the result have to be in java? It is a two-liner in awk...
comment on: http://stackoverflow.com/q/27488778
score: 0

http://stackoverflow.com/a/27489188
upvote count: 1
has body: You are reading again value from scanner inside if block. Use number instead if (number &lt; 0) { negativeList[i] = number; } if (number % 2 == 0) { evenList[i] = number; } else { oddList[i] = number; }
has comment: http://stackoverflow.com/comment/43411275
has comment: http://stackoverflow.com/comment/43410493
type: Answer
answers question: http://stackoverflow.com/q/27489167
downvote count: 0
score: 1

http://stackoverflow.com/q/27487042
has body: Is it possible to make processing overwrite recorded files? For example, code records ten audio files then when its reaches ten (rec9.wav) it overwrites the first recording (rec0.wav) with new audio and so on. Code below, any help is appreciated, thank you! import ddf.minim.*; Minim minim; AudioInput in; AudioRecorder recorder; AudioPlayer player; int prevTime; int delay = 10000; int recID = -1; //what to have a maximum of 10 ID's int playID = 0; boolean isRec = false; void setup(){ size(512, 200); minim = new Minim(this); in = minim.getLineIn(Minim.STEREO, 512); prevTime = millis(); } void draw(){ if (millis() - prevTime &gt; delay){ prevTime = millis(); if(!isRec){ if(recorder != null &amp;&amp; recorder.isRecording()) recorder.endRecord(); else{ recID++; recorder = minim.createRecorder(in, "rec"+recID+".wav", true); recorder.beginRecord(); } isRec = true; println("RECORDING"); }else{ if(recorder != null) { recorder.endRecord(); recorder.save(); println("Done saving " + recID); player = minim.loadFile("rec"+recID+".wav", 2048); player.play(); } isRec = false; println("SAVING REC " + recID); } } }
accepted answer: http://stackoverflow.com/a/27487110
type: Question
tagged with: processing
tagged with: java
has answer: http://stackoverflow.com/a/27487110
score: 0
has title: Processing - Overwrite audio
answer count: 1
tagged with: minim
tagged with: audio
type: AnsweredQuestion
tagged with: overwrite

http://stackoverflow.com/a/27481521
downvote count: 0
answers question: http://stackoverflow.com/q/27481137
type: Answer
upvote count: 1
has body: HTTPServlet isn't an interface. Please follow this example to get your servlet working. If you want to use your own implementation of HTTPServlet class, then please create a replica of the original abstract class i.e. implement intefaces Servlet and ServletConfig as well as extend GenericServlet. If you want to use SipServlet, you got to implement the same interfaces as in the SipServlet class.
score: 1

http://stackoverflow.com/q/27614030
has body: I need some help in working with a VisualForce File Upload dialog. It works perfectly fine with Selenium IDE, but when I try to make it work with WebDriver, well, the driver can't even locate the elements, let alone work with them. Here's the HTML code of the file uploader that I'm trying to test: File * Here's my Selenium IDE code that types a path to a file into the file uploader (it works great): type id=files C:\Users\filefolder\file.rtf Here's my Selenium WebDriver code (doesn't work): try{ driver.findElement(By.id("files")).sendKeys("C:\\Users\\filefolder\\file.rtf"); } catch(Exception e){ verificationErrors.append("Could not work with file input; "+e.toString()); } When I run it, here's the output: java.lang.AssertionError: Could not work with file input; org.openqa.selenium.NoSuchElementException: no such element Please let me know if you need any more details in order to answer this. Thanks a lot for your help here!!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43672433
has answer: http://stackoverflow.com/a/27626130
tagged with: java
tagged with: selenium
tagged with: file
has comment: http://stackoverflow.com/comment/43650091
type: Question
tagged with: upload
score: 0
has comment: http://stackoverflow.com/comment/43650075
tagged with: visualforce
answer count: 1
has title: Struggling with File Upload in a VisualForce Page using Selenium WebDriver (ChromeDriver 2.12)

http://stackoverflow.com/a/27538680
accepted answer of: http://stackoverflow.com/q/27482342
has comment: http://stackoverflow.com/comment/43861761
has body: For your Universe system, connectivity from Java is most easily done with UniObjects for Java. UOJ is a free class library. Connections are not pooled unless you get a special pooling license. Rocket Software offers classes: http://www.rocketsoftware.com/u2-training-u2100-java-application-development-using-uniobjects The most recent developer's guide is here: http://docs.rocketsoftware.com/nxt/gateway.dll/RKBnew20/u2%20clients%20and%20apis/jul2014/u2clients_uniobjectsjavadevguide_vjul2014.pdf Some FOSS examples are here: http://www.pickwiki.com/cgi-bin/wiki.pl?JavaSource (Based on these exchanges, I'm removing the JNI tag from the original query as this is not related to JNI. JNI is an option if you want to call from Universe out using a bridge from BASIC to Java. The question here is about inbound connectivity, and for that there's an API.)
has comment: http://stackoverflow.com/comment/43853651
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44005066
answers question: http://stackoverflow.com/q/27482342
type: Answer

http://stackoverflow.com/comment/43639547
type: AnswerComment
type: Comment
has text: for example, you can write date time in you document, and then sort documents in the view by date time. If you give me the sample of documents I will explain you better
comment on: http://stackoverflow.com/a/27605560
score: 0

http://stackoverflow.com/q/27580177
tagged with: imageicon
has comment: http://stackoverflow.com/comment/43598293
favorite count: 0
has answer: http://stackoverflow.com/a/27580708
tagged with: jframe
has title: Insert a GIF image into JFrame and make it visible and invisible on demand
has answer: http://stackoverflow.com/a/27581829
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/27580708
type: AnsweredQuestion
tagged with: paint
tagged with: java
has comment: http://stackoverflow.com/comment/43599711
has body: In my application I am extracting data from a project DB. When I do that I want to signal to user that data extraction is in progress. I want to achieve this by making my current frame view.getFrame2() invisible and making view.getFrame3() visible. Frame 3 will have GIF image with frame titled as "Extraction is in progress". I am able to achieve my target but I am not able to view the image in the frame. It's blank. Below is the code snippet I am using; one class is used for view, another one for controller and yet another one for the model. I also have a main class to initialize all the M-V-C classes. I don't want to complicate the code by creating more classes. View My View class:- /** View**/ package mvc.views; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import javax.swing.*; public class View { JFrame frame2, frame3; JPanel panel3; Toolkit tk; Image icon; Color background; public View() { /** processing image view **/ frame3 =new JFrame(); frame3.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame3.setTitle( "Extraction in process...." ); try { icon = new ImageIcon("C:\\Users\\pc033k\\Desktop\\gears_animated.gif").getImage(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } panel3 = new JPanel(); background = Color.white; panel3.setOpaque(true); frame3.setContentPane(panel3);; frame3.setBounds(100, 100, 400, 400); frame3.setLocationRelativeTo(null); frame3.setVisible(false); /** End of processing image view **/ } public void paint (Graphics g) { panel3.paint(g); panel3.setBackground(background); g.drawImage(icon,100,100,500,500,null); } } /** End of View**/ Controller /** Start Controller**/ package mvc.controllers; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io…
downvote count: 1
has comment: http://stackoverflow.com/comment/43585509
type: Question
linked to: http://stackoverflow.com/q/9554636
accepted answer: http://stackoverflow.com/a/27581829
score: 0
answer count: 2

http://stackoverflow.com/comment/43385866
score: 0
type: Comment
has text: @ScottHunter in my opinion i thought that it i designed a good solution but thought that may be there can be some trick which i don't know and that's why thought to ask it here
type: QuestionComment
comment on: http://stackoverflow.com/q/27475712

http://stackoverflow.com/comment/43693517
comment on: http://stackoverflow.com/a/27637330
score: 0
type: Comment
has text: "SELECT bairro_id FROM cliente" does not return any NULL value
type: AnswerComment

http://stackoverflow.com/comment/43498388
type: Comment
comment on: http://stackoverflow.com/a/27533948
score: 0
type: AnswerComment
has text: also is the stacktrace virgin or did you edit the ip address in the exception report. if the ST is "clean", then the ip address of the mysql host is not set properly in your jboss instance configuration ('xx.xx.xx.xx' rather than '123.45.67.89')

http://stackoverflow.com/comment/43550176
type: QuestionComment
has text: You can simply clip the area of second and add the two canvas on your root.
comment on: http://stackoverflow.com/q/27561765
score: 0
type: Comment

http://stackoverflow.com/comment/43614213
type: QuestionComment
has text: Unfortunately the same effect. I see exactly the same exception. Actually, it was just an example '12345'. In the code I pass to the 'createKey' method a long variable. I verified it a few times. Here the exact code lines: Profile p = em.find(Profile.class, KeyFactory.createKey(Profile.class.getSimpleName(), input.profile)); Where input object is: public class RequestGameResult { public long profile; //... other data fields }
score: 0
comment on: http://stackoverflow.com/q/27591734
type: Comment

http://stackoverflow.com/comment/43552767
score: 2
type: AnswerComment
has text: also you forgot about `break;` in each case
type: Comment
comment on: http://stackoverflow.com/a/27563576

http://stackoverflow.com/comment/43605715
score: 2
comment on: http://stackoverflow.com/a/27590899
type: Comment
has text: @wassgren Shorter: `int[] arr = IntStream.rangeClosed(1, num).toArray();`
type: AnswerComment

http://stackoverflow.com/a/27594611
answers question: http://stackoverflow.com/q/27587293
has body: The problem ended up being that my vertex shader's out variable name didn't match the fragment shader's in variable name (doh). The code posted above is 100% correct in case anyone sees this in the future.
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27587293

http://stackoverflow.com/comment/43585219
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27580435
has text: actually the string should be a least 1 char
type: Comment

http://stackoverflow.com/q/27501552
accepted answer: http://stackoverflow.com/a/27687567
has comment: http://stackoverflow.com/comment/43433777
has title: Number of Users Join At Time Case Scenarios?
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/27687567
tagged with: java
has body: I need to know about same action perform at time by different users case scenarios. For Ex : One room is there.Users continuously joins into room and leaves the room at time.and one more case is no of users try to join same room at time. How to handle above example cases in java like synchronization or any else.Please suggest me best case to handle this? I did one sample.Please see the below sample code once : public class Sample{ private ArrayList&lt;String&gt; players = new ArrayList&lt;String&gt;(); public synchronized void joinRoom(String name) { players.add(name); //Do something } public synchronized void leaveRoom(String name) { for(String uName : players){ if(uName.equals(name)) { players.remove(uName);//Here is there any possibility to get concurrent modification exception.if gets how to solve } } //Do something } } But i didn't know that cases handle like using above sample code or not.Please suggest me which one is best to handle this cases? Thanks in Advance.
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27586365
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43597263
downvote count: 0
tagged with: development-environment
has body: Here is my code: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.SEND_SMS"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> The error is shown at the start of activity tag. I changed the android:theme in the application to fullscreen then the error was generated, I did undo the changes i-e change the them to the previous theme that is shown in the code but it's still giving the error. What is causing the error, and how can I fix it?
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: error parsing xml not well-formed (invalid token) in my manifest.xml

http://stackoverflow.com/comment/43464370
type: Comment
has text: Thank you for your fast response. But I am a bit confused about your answer. Say the new class will have separate methods to create a table, select a row, display content, delete..., Shall I get a connection from the pool in each method call and close the connection by the end of the method? Also creating statements and closing them in each method?
type: AnswerComment
comment on: http://stackoverflow.com/a/27515164
score: 0

jexcelapi
tags question: http://stackoverflow.com/q/27522141
tag name: jexcelapi
tags question: http://stackoverflow.com/q/27565037
type: Tag

http://stackoverflow.com/comment/43490995
comment on: http://stackoverflow.com/q/27530383
score: 0
type: QuestionComment
type: Comment
has text: Thank you all for the help. My suspicions were confirmed. I did however convert to `StringBuilder`s instead of `Strings` just in case.

http://stackoverflow.com/a/27579477
answers question: http://stackoverflow.com/q/27576642
type: Answer
score: 0
has body: Turns out as @MadProgrammer suggested, that I was creating two different loginPage objects in my display class. It's curious, however, that the mouselistener on the login page GUI that was visible actually listened for, and returned expected results of the better defined login page object (which was invisible).

http://stackoverflow.com/comment/43460665
score: 0
type: Comment
type: QuestionComment
has text: This is a difficult problem. Whole books have been written on this stuff. I'd say it's way too broad to be answered well on Stack Overflow (although I'm sure some people will try).
comment on: http://stackoverflow.com/q/27515020

http://stackoverflow.com/comment/43397211
comment on: http://stackoverflow.com/a/27482330
has text: This isnt the source of the problems. I ran the example on IdeOne and posted the link, just in case anyone would like to see :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/40376732
has body: You should only encode the payload (which should already be done bei Gson itself) not the whole JSon tree. ESAPI.encoder().encodeForJavaScript is designed to encode params or function arguments for JavaScript-Methods/Functions.
answers question: http://stackoverflow.com/q/27560667
type: Answer
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/80807855

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/27629194
tags question: http://stackoverflow.com/q/27614968
tags question: http://stackoverflow.com/q/27525968
tags question: http://stackoverflow.com/q/27531590
tags question: http://stackoverflow.com/q/27520459
tags question: http://stackoverflow.com/q/27608694
tags question: http://stackoverflow.com/q/27528139
tags question: http://stackoverflow.com/q/27572831
tags question: http://stackoverflow.com/q/27599903
tags question: http://stackoverflow.com/q/27495841
tags question: http://stackoverflow.com/q/27479391
tags question: http://stackoverflow.com/q/27628096
tags question: http://stackoverflow.com/q/27490347
tags question: http://stackoverflow.com/q/27479110
tags question: http://stackoverflow.com/q/27497753
tags question: http://stackoverflow.com/q/27481592
tags question: http://stackoverflow.com/q/27523292
tags question: http://stackoverflow.com/q/27543633
tags question: http://stackoverflow.com/q/27607170
tags question: http://stackoverflow.com/q/27635928
tags question: http://stackoverflow.com/q/27608341
tags question: http://stackoverflow.com/q/27542498
tags question: http://stackoverflow.com/q/27475332
tags question: http://stackoverflow.com/q/27489033
tags question: http://stackoverflow.com/q/27629216
tags question: http://stackoverflow.com/q/27475722
tags question: http://stackoverflow.com/q/27574311
tags question: http://stackoverflow.com/q/27559040
tags question: http://stackoverflow.com/q/27578967
tags question: http://stackoverflow.com/q/27558929
tags question: http://stackoverflow.com/q/27567835
tags question: http://stackoverflow.com/q/27492342
tags question: http://stackoverflow.com/q/27593175
tags question: http://stackoverflow.com/q/27607581
type: Tag
tags question: http://stackoverflow.com/q/27573871
tags question: http://stackoverflow.com/q/27640101
tags question: http://stackoverflow.com/q/27523607
tags question: http://stackoverflow.com/q/27624985
tags question: http://stackoverflow.com/q/27577937
tags question: http://stackoverflow.com/q/27639844
tags question: http://stackoverflow.com/q/27482835
tags question: http://stackoverflow.com/q/27536551
tags question: http://stackoverflow.com/q/27560822
tags question: http://stackoverflow.com/q/27517576
tags question: http://stackoverflow.com/q/27482047
tags question: http://stackoverflow.com/q/27525029
tags question: http://stackoverflow.com/q/27487159
tags question: http://stackoverflow.com/q/27495393
tags question: http://stackoverflow.com/q/27474897
tags question: http://stackoverflow.com/q/27578395
tags question: http://stackoverflow.com/q/27559543
tags question: http://stackoverflow.com/q/27570273
tags question: http://stackoverflow.com/q/27574528
tags question: http://stackoverflow.com/q/27577701
tags question: http://stackoverflow.com/q/27612377
tags question: http://stackoverflow.com/q/27523276
tags question: http://stackoverflow.com/q/27532206
tags question: http://stackoverflow.com/q/27499650
tags question: http://stackoverflow.com/q/27571656
tags question: http://stackoverflow.com/q/27494911
tags question: http://stackoverflow.com/q/27515525
tags question: http://stackoverflow.com/q/27622499
tags question: http://stackoverflow.com/q/27494461
tag name: json
tags question: http://stackoverflow.com/q/27568317
tags question: http://stackoverflow.com/q/27595981
tags question: http://stackoverflow.com/q/27628943
tags question: http://stackoverflow.com/q/27520033
tags question: http://stackoverflow.com/q/27620058
tags question: http://stackoverflow.com/q/27528148
tags question: http://stackoverflow.com/q/27553154
tags question: http://stackoverflow.com/q/27599674
tags question: http://stackoverflow.com/q/27523186
tags question: http://stackoverflow.com/q/27616438
tags question: http://stackoverflow.com/q/27555378
tags question: http://stackoverflow.com/q/27613613
tags question: http://stackoverflow.com/q/27577922
tags question: http://stackoverflow.com/q/27543072
tags question: http://stackoverflow.com/q/27560039

http://stackoverflow.com/comment/43463517
type: Comment
comment on: http://stackoverflow.com/a/27516686
score: 0
type: AnswerComment
has text: Thanks, only problem is '2 Sam' is meant to be captured together.

http://stackoverflow.com/a/27567174
upvote count: 0
type: Answer
has body: Have you check that MainPage.jsp is present in WEB-INF/pages/ folder. change public class AppConfig extends WebMvcConfigurerAdapter Change Bean as : @Bean public ViewResolver getInternalResourceViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/pages/"); resolver.setSuffix(".jsp"); return resolver; } May this will help you
downvote count: 1
answers question: http://stackoverflow.com/q/27566967
has comment: http://stackoverflow.com/comment/43559673
score: -1
has comment: http://stackoverflow.com/comment/72684002

http://stackoverflow.com/comment/43465539
comment on: http://stackoverflow.com/a/27491199
score: 0
has text: I don't buy it. "You might argue that the method can return Collection<? extends Result> however, that would alter the interface IFace." You _should_ either alter the interface, and forbid the the caller of the method from adding non-`ResultImpl`s to that list, or you should accept the cost of the copy.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43517117
type: Comment
has text: I don't think there is any compliance issue here. Where are you getting this error? In your JSP compilation or the `common` class?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27545136

http://stackoverflow.com/q/27489796
has title: How to check whether a button is clicked?
tagged with: forms
tagged with: arraylist
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27491759
tagged with: submit
tagged with: jsp
has answer: http://stackoverflow.com/a/27489985
has body: &lt;form action ="PurchaseCheckOut" method="POST" &gt; &lt;input type = submit name="checkout" class ="button" value="Check Out"&gt; &lt;% if(request.getParameter("checkout") != null) list1.clear(); %&gt; &lt;/form&gt; I'm using a ArrayList for list1. So, when I click on the check out button, it will clear all the things in list1. How can I do that ? This is how I do it but it doesn't seems to work. EDIT : Still not working &lt;form action ="PurchaseCheckOut" method="POST" &gt; &lt;input type = submit name="checkout" class ="button" value="Check Out" onClick="clearList()"&gt; &lt;/form&gt; &lt;%! public void clearList() { list1.removeAll(list1); } %&gt;
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/27570689
has body: I have a 2-node cluster(hadoop 2.6.0) with a master(as salve) and 1 slave in etc/hadoop/salve on the master machine. After calling start-yarn.sh jps shows :~$ jps 11821 SecondaryNameNode 11114 NameNode 12037 ResourceManager 11432 DataNode 12674 Jps 12363 NodeManager and within a minute the NodeManager is gone with an BindException: Address already in use in the log file(pasted below). The port 8040 is open and used by ResoureManager. log file on master 2014-12-19 17:21:25,185 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Stopping NodeManager metrics system... 2014-12-19 17:21:25,186 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NodeManager metrics system stopped. 2014-12-19 17:21:25,186 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NodeManager metrics system shutdown complete. 2014-12-19 17:21:25,186 FATAL org.apache.hadoop.yarn.server.nodemanager.NodeManager: Error starting NodeManager org.apache.hadoop.yarn.exceptions.YarnRuntimeException: java.net.BindException: Problem binding to [0.0.0.0:8040] java.net.BindException: Address already in use; For more details see: http://wiki.apache.org/hadoop/BindException at org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl.getServer(RpcServerFactoryPBImpl.java:139) at org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC.getServer(HadoopYarnProtoRPC.java:65) at org.apache.hadoop.yarn.ipc.YarnRPC.getServer(YarnRPC.java:54) at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.createServer(ResourceLocalizationService.java:356) at org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.serviceStart(ResourceLocalizationService.java:334) at org.apache.hadoop.service.AbstractService.start(AbstractService.java:193) at org.apache.hadoop.service.CompositeService.serviceStart(CompositeService.java:120) at org.apache.hadoop.yarn.server.nodemanager.containermanager.ContainerManagerImpl.serviceStart(ContainerManagerImp…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43591305
upvote count: 2
tagged with: hadoop-yarn
has comment: http://stackoverflow.com/comment/43566967
has answer: http://stackoverflow.com/a/27570773
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hadoop
downvote count: 0
accepted answer: http://stackoverflow.com/a/27570773
has title: On master node: binding to port 8040 java.net.BindException

http://stackoverflow.com/a/27522299
downvote count: 0
has body: Did you try running it by using the command line function? java -jar &lt;path to my .jar&gt;
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27522264
has comment: http://stackoverflow.com/comment/43508572

http://stackoverflow.com/q/27606560
has answer: http://stackoverflow.com/a/46567187
has comment: http://stackoverflow.com/comment/44695875
has comment: http://stackoverflow.com/comment/43672612
has comment: http://stackoverflow.com/comment/43648223
has title: java.lang.ArrayIndexOutOfBoundsException in android.os.AsyncTask while using Collections.sort
has body: I am dealing with an Android application that has many async operations taking place all at once. As such, I am running into a lot of IndexOutOfBoundsExceptions and ConcurrentModificationExceptions in the app. Most of them are solved by synchronizing methods or ensuring UI operations run on the main UI thread, however this one has me stumped. In my code I am using an AsyncTask to pull new objects from a local database and refresh the list of objects being displayed in BaseAdapter. The list of items to be displayed is constantly changing and my refresh method may be called from multiple threads. The problematic code is pasted below. The getChat() call returns a list messages which is the part that may constantly change. To avoid any complications with this, I am creating a new copy of the list before I sort/display the objects using Lists.newLinkedList(). protected CurrentChat doInBackground(final Connection... params) { final Chat newChat = params[0].getChat(conversationID); final List&lt;Message&gt; newMessageList = Lists.newLinkedList(newChat.getMessages().values()); Collections.sort(newMessageList, messageSorter); return new CurrentChat(newChat, newMessageList, newChat.getParticipants().size() &gt; 2); } For reference, the sorter I am using is: private final Comparator&lt;Message&gt; messageSorter = new Comparator&lt;Message&gt;() { @Override public int compare(final Message lhs, final Message rhs) { if(lhs.getSentDateTime() != null &amp;&amp; rhs.getSentDateTime() != null) { return lhs.getSentDateTime().compareTo(rhs.getSentDateTime()); } else if(lhs.getSentDateTime() == null &amp; rhs.getSentDateTime() == null) { return 0; } else if(lhs.getSentDateTime() == null) { return 1; } else { return -1; } } }; The exception that I get is an IndexOutOfBoundsException that occurs within the Collections.sort() call: 12-17 15:14:40.951 2270-2332/com.chat.android.communication E/AndroidRuntime? FATAL EXCEPTION: AsyncTask #1 java.lang.RuntimeException: An error occured while …
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43635435
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43636842
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question

http://stackoverflow.com/a/27635811
has comment: http://stackoverflow.com/comment/43691425
has comment: http://stackoverflow.com/comment/43699993
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27635352
downvote count: 1
has body: You also have to put it in your Manifest like this: <activity YOUR ACTIVITY 1 /> <activity YOUR ACTIVITY 2 /> And then try swapping these following lines Parse.enableLocalDatastore(this); Parse.initialize(this, "key", "key"); like this: Parse.initialize(this, "key", "key"); Parse.enableLocalDatastore(this);
score: 1
has comment: http://stackoverflow.com/comment/43700240
has comment: http://stackoverflow.com/comment/43690930

http://stackoverflow.com/q/27483207
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/27483313
tagged with: intellij-idea
answer count: 1
has title: How to specify the compile order for a multi-module project in Intellij Idea?
downvote count: 0
tagged with: ide
tagged with: multi-module
has body: I have a multi-module project with test dependencies between modules. Layout: main-module - has SpecialsTableQueryBuilderTest that depends on AbstractTestHelper from the generic-search module generic-search - has AbstractTestHelper The problem: is that when I run "Make project" the SpecialsTableQueryBuilderTest class it complains that it "cannot find symbol, symbol: class AbstractTestHelper". I tried in the modules settings, for the main-module, dependencies tab to move the generic-search module up, but it didn't help. Another thing I tried on the same dependencies tab, it was to add the folder output for test-classes ("/target/test-classes")from the generic-search module as dependencie What can I do so my project setup to see the AbstractTestHelper class?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27483313

constructor
tags question: http://stackoverflow.com/q/27576300
tags question: http://stackoverflow.com/q/27514459
tags question: http://stackoverflow.com/q/27629536
tags question: http://stackoverflow.com/q/27616547
tags question: http://stackoverflow.com/q/27535380
tags question: http://stackoverflow.com/q/27618252
tags question: http://stackoverflow.com/q/27584245
tag name: constructor
tags question: http://stackoverflow.com/q/27570012
tags question: http://stackoverflow.com/q/27545324
tags question: http://stackoverflow.com/q/27551338
type: Tag
tags question: http://stackoverflow.com/q/27521246
tags question: http://stackoverflow.com/q/27580465
tags question: http://stackoverflow.com/q/27610274
tags question: http://stackoverflow.com/q/27629824
tags question: http://stackoverflow.com/q/27586725
tags question: http://stackoverflow.com/q/27512212

http://stackoverflow.com/a/27528288
accepted answer of: http://stackoverflow.com/q/27525019
downvote count: 0
has comment: http://stackoverflow.com/comment/43535296
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27525019
has body: Instead of using vectors to fill your table, you can use a more sophisticated table model implementation that allows you to work directly with File objects as rows in your table. I'm talking about either DataObjectTableModel or Rob Camick's RowTableModel. So, let's say you have the table model implementation solved and each row in your table is a File object. Now, I wouldn't make any cell editable and let the table just display files info, considering: There are many factors that can go wrong (i.e: invalid or existent file name) It's not a TableModel responsibility to reflect the update in the HD. It can be done using TableModelListener but the events are fired once the model has changed, so if you have troubles updating the file name in the HD then you have to revert the table model's changes. Not so easy though. In order to re-name a file, I'd attach a MouseListener to the table and show a pop up dialog to let the user input the new file name. Finally use the File API to rename the file and update the table model reflecting these changes. Snippet final DataObjectTableModel&lt;File&gt; model = new DataObjectTableModel&lt;File&gt;(header) { // Override getValueAt() and getColumnClass() here }; final JTable table = new JTable(model); table.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() &gt;= 2 &amp;&amp; !e.isPopupTrigger()) { int selectedRow = table.rowAtPoint(e.getPoint()); if (selectedRow != -1) { String newName = JOptionPane.showInputDialog ( null , "Please input the new name" , "Rename file" , JOptionPane.INFORMATION_MESSAGE ); if (newName != null) { int modelIndex = table.convertRowIndexToModel(selectedRow); File file = model.getDataObject(modelIndex); // Maybe this part should be done // using a SwingWorker to avoid blocking the EDT String newPath = file.getParent() + File.separator + newName; File newFile = new File(newPath); if (file.renameTo(newFile)) { model.deleteDataObject(modelIndex); // re…
type: Answer

http://stackoverflow.com/q/27579015
has title: Getting out of memory error when restarting WildFly on OpenShift
possible better answer: http://stackoverflow.com/a/27881203
has body: I have a issue with WildFly AS on OpenShift. When i try to deploy WAR on server i keep getting following exception. 2014-12-20 04:31:33,072 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-7) JBAS010406: Registered connection factory java:/JmsXA 2014-12-20 04:31:33,444 ERROR [org.hornetq.core.client] (Thread-0 (HornetQ-client-global-threads-32821528)) HQ214017: Caught unexpected Throwable: java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) [rt.jar:1.8.0_05] at java.lang.Thread.start(Thread.java:714) [rt.jar:1.8.0_05] at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950) [rt.jar:1.8.0_05] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1368) [rt.jar:1.8.0_05] at org.hornetq.core.client.impl.ClientSessionFactoryImpl$Channel0Handler.notifyTopologyChange(ClientSessionFactoryImpl.java:1618) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.client.impl.ClientSessionFactoryImpl$Channel0Handler.handlePacket(ClientSessionFactoryImpl.java:1609) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:641) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:556) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:532) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1712) [hornetq-core-client-2.4.5.Final.jar:] at org.hornetq.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:165) [hornetq-server-2.4.5.Final.jar:] at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:104) [hornetq-core-client-2.4.5.Final.jar:] at java.util.concurrent.Thr…
score: 2
upvote count: 2
tagged with: wildfly
tagged with: openshift
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27582851
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27881203
accepted answer: http://stackoverflow.com/a/27582851

batch-file
tags question: http://stackoverflow.com/q/27622383
tag name: batch-file
type: Tag
tags question: http://stackoverflow.com/q/27487313
tags question: http://stackoverflow.com/q/27638305
tags question: http://stackoverflow.com/q/27574640
tags question: http://stackoverflow.com/q/27496448
tags question: http://stackoverflow.com/q/27547874
tags question: http://stackoverflow.com/q/27533115
tags question: http://stackoverflow.com/q/27530317

http://stackoverflow.com/a/29343425
has body: JMapper can help you, it exposes the RelationalJMapper class that permits to apply many to one e and one to many relations, for more info go to wiki page
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27522314

http://stackoverflow.com/q/27511980
answer count: 3
has answer: http://stackoverflow.com/a/27512579
has body: Hey guys I am doing a question where I have to find a point in a Matrix A of N x M rows such that the sum of rows above the point is equal to the sum of row Consider this example /** * A[0][0] = 2 A[0][1] = 7 A[0][2] = 5 * A[1][0] = 3 A[1][1] = 1 A[1][2] = 1 * A[2][0] = 2 A[2][1] = 1 A[2][2] = -7 * A[3][0] = 0 A[3][1] = 2 A[3][2] = 1 * A[4][0] = 1 A[4][1] = 6 A[4][2] = 8 * @param matrix * @return */ In this example the if we look at the point A[1][1], it can be said that the row above (sum = 14) is equal to the sum of rows below the point. Can anyone help me on this? I have so far gotten this far. But I know this is a sucky approach. public int solution(int[][] matrix) { int rows = matrix[0].length; int columns = matrix.length; int sumabove = 0; int sumbelow = 0; for( int i = 1; i &lt; rows; i++ ) { for (int j = 0; j &lt; columns; j++) { sumabove += matrix[i - 1][j]; sumbelow += matrix[i + 1][j]; } } return 0; }
has answer: http://stackoverflow.com/a/27512488
has comment: http://stackoverflow.com/comment/43454362
has comment: http://stackoverflow.com/comment/43454386
tagged with: multidimensional-array
has title: Calculate sum of rows above and below a point, and also sum of columns left and right a point
has answer: http://stackoverflow.com/a/27513961
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/43454273
has comment: http://stackoverflow.com/comment/43454571
tagged with: java
score: 0

http://stackoverflow.com/q/27482172
tagged with: java
answer count: 2
tagged with: api
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27482589
tagged with: clojure
upvote count: 3
type: UnansweredQuestion
has body: I've been experimenting with clojure.java.api introduced in Clojure 1.6.0, as I'd like to import some Clojure functionality into my java project. Unfortunately, it is not behaving as I'd expect when I invoke the conditional functions and and or from Java. IFn and = Clojure.var("clojure.core", "and"); IFn or = Clojure.var("clojure.core", "or"); -- equivalent to (and true false) in clojure and.invoke(true,false); --&gt; returns true rather than false??? -- equivalent to (or true false) in clojure or.invoke(true,false); --&gt; returns null rather than true??? -- equivalent to (and true true) in clojure and.invoke(true,true); --&gt; returns true as expected -- equivalent to (or true true) in clojure or.invoke(true,true); --&gt; returns null rather than true??? I can't believe this is a bug, so I suspect I'm missing something fairly fundamental relating to the API. Whatever the cause, it has left me rather confused. If anyone can offer an explanation I'd be very grateful. Thanks, Matt.
has title: Unexpected behaviour from clojure.java.api.Clojure
type: Question
has answer: http://stackoverflow.com/a/27482346
score: 3
tagged with: conditional-statements

http://stackoverflow.com/comment/43543454
score: 1
type: QuestionComment
type: Comment
has text: Not sure if that will work. If the Robot.class file does not exist when the JVM is launched, it may not be picked up later.
comment on: http://stackoverflow.com/q/27558594

http://stackoverflow.com/a/27553777
has comment: http://stackoverflow.com/comment/43536983
accepted answer of: http://stackoverflow.com/q/27549742
has comment: http://stackoverflow.com/comment/43535288
answers question: http://stackoverflow.com/q/27549742
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43536905
type: Answer
has comment: http://stackoverflow.com/comment/43535681
has body: I am not sure from your edit of what you are exactly doing, but it seems you're not using HashMap as you would need to. You might try something like this: Bitmap bitmap = myMarkersHash.get(marker.getId()); markerIcon.setBitmap(bitmap); You should also create a local bitmap before adding it to the HashMap: @Override public void onMapLongClick(LatLng point) { thePoint=point; Marker marker = googleMap.addMarker(new MarkerOptions() .position(thePoint)); markerId = marker.getId(); Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File imagesFolder = new File(Environment.getExternalStorageDirectory(), "My Castle"); imagesFolder.mkdirs(); image = new File(imagesFolder.getPath(), "Mycastle_" + timeStamp + ".jpg"); fileUri = Uri.fromFile(image); imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult(imageIntent, TAKE_PICTURE); } Then when you set your bitmap: public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == TAKE_PICTURE &amp;&amp; resultCode == RESULT_OK) { try { GetImageThumbnail getImageThumbnail = new GetImageThumbnail(); Bitmap bitmap = getImageThumbnail.getThumbnail(fileUri, this); myMarkersHash.put(markerId, bitmap ); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } Therefore, you need to store your markerId somewhere to be able to get it in onActivityResult
score: 0
has comment: http://stackoverflow.com/comment/43536784
has comment: http://stackoverflow.com/comment/43551261

http://stackoverflow.com/q/27622833
answer count: 1
tagged with: classloader
accepted answer: http://stackoverflow.com/a/27626440
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/27626440
tagged with: classpath
has body: We have a standalone java-application. This application has lots of functionality, but most customers does only use a small bit of this functionality. We want to distribute the application with just the "normal" minimum of third-party jar-files. In the eclipse project all external jar-files are in the class path. So no reflection is used to instanciate classes. So when a user are going to use a more advanced function, eg taking webcamera pictures, we will then download all the javacv jar files and then somehow add these to the classpath/classloader before calling our class that takes a picture. Is this possible? I allready have a working solution for a very small module that downloads some jar-files on the fly and adds them in a custom classloader, but I then have to painfully instanciate every class and call every method by reflection. Eg: URLClassLoader loader = new URLClassLoader(urls,w.getClass().getClassLoader()); Class grabberClass = Class.forName("org.bytedeco.javacv.FrameGrabber",true,loader); Object grabber = grabberClass.getMethod("createDefault", int.class).invoke(null, 0); grabberClass.getMethod("start", null).invoke(grabber, null); //And so on... This is not what we want. All our source code is just fine, and I don't want to obfuscate it by turning it into reflection-calls. But how may I use my old code and still be able to add the jar-files at runtime?
type: Question
score: 0
has title: Downloading and adding jar files to classpath at runtime without reflection

http://stackoverflow.com/comment/43665681
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27622350
type: AnswerComment
has text: it worked when i used yellow as a color but when the color is grey it returns FFFFFFFF and when the color is white it also returns FFFFFFFF so how do i know if the color is grey or white?

http://stackoverflow.com/comment/43516291
score: 0
type: AnswerComment
type: Comment
has text: The method getTableCells() is undefined for the type XWPFTableRow
comment on: http://stackoverflow.com/a/27542530

http://stackoverflow.com/comment/43612989
type: AnswerComment
score: 0
type: Comment
has text: @TJamesBoone - agreed. I just removed it to make the code *shorter*. `hashCode` is described [here](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()).
comment on: http://stackoverflow.com/a/27594561

http://stackoverflow.com/comment/43662911
score: 0
type: Comment
type: QuestionComment
has text: It would still be interesting to me **why** it's **always** 0.
comment on: http://stackoverflow.com/q/27621017

http://stackoverflow.com/q/27622016
tagged with: soap
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: web-services
has title: org.apache.xml.security.c14n.CanonicalizationException: Element listFunctions has a relative namespace: xmlns="xxx_xxx_listFunctions"
tagged with: java
has body: I am new to Axis2 and webservices. I have a axis2 web services. Things run fine when ws-security is turned off. When ws-security is turned on, I get the following exception in the server log. I debugged the service class method is not called. Attached are two service.xmls used. The client invoking the webservice get the followoing soap fault - unexpected EOF in prolog I get the following java exception in tomcat : org.apache.xml.security.c14n.CanonicalizationException: Element listFunctions has a relative namespace: xmlns="test_vish_listFunctions" at org.apache.xml.security.c14n.implementations.Canonicalizer20010315.handleAttributesSubtree(Unknown Source) at org.apache.xml.security.c14n.implementations.CanonicalizerBase.canonicalizeSubTree(Unknown Source) at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(Unknown Source) at org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(Unknown Source) at org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Unknown Source) at org.apache.xml.security.utils.XMLUtils.outputDOM(Unknown Source) Following is the server.xml when ws-security is off and things works This service is to get the list functions <schema schemaNamespace="test_listFunctions"/> vish.web.ws.service.ListFunctionsService <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> <module ref="soapmonitor"/> The following the services.xml when ws-security is turned on Service description for test_vish_listRoutines <schema schemaNamespace="test_vish_listRoutines"/> test.web.ws.service.ListRoutinesService true <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> <module ref="soapmonitor"/> <module ref="rampart" /> UsernameToken test.web.ws.control.PWCBHandler
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27792846
answer count: 1

http://stackoverflow.com/comment/43504647
type: Comment
has text: `string.replaceAll("(.)\\1", "$1 $1")`
comment on: http://stackoverflow.com/q/27537937
score: 0
type: QuestionComment

http://stackoverflow.com/q/27547171
possible better answer: http://stackoverflow.com/a/27547537
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27547537
tagged with: java
downvote count: 5
has answer: http://stackoverflow.com/a/27547361
upvote count: 42
type: Question
score: 37
tagged with: lombok
favorite count: 0
has title: How can I specify a one-argument constructor using Lombok?
answer count: 3
accepted answer: http://stackoverflow.com/a/27547361
has answer: http://stackoverflow.com/a/60510129
has body: Using Lombok, is it possible to specify a one-argument constructor? My intention is to use Lombok annotations to create a constructor such as the one below. class MyClass { private String param; private Integer count; public MyClass(String param) { this.param = param; } }
has comment: http://stackoverflow.com/comment/43520668

http://stackoverflow.com/a/27593646
score: 0
answers question: http://stackoverflow.com/q/27593587
type: Answer
has body: Replace exec("attrib +h " + src.getPath() to exec("attrib -h " + src.getPath()). This will make attribute from hidden to visible. +r : Used to set the file attribute as read-only. -r : Used to clear the read-only file attribute. +a : Used to set the file attribute as archive. -a : Used to clear the archive file attribute. +s : Used to set the file attribute as a system file. -s : Used to clear the system file attribute. +h : Used to make the file attribute as hidden not visible to the user. -h : Used to clear the hidden file attribute.

http://stackoverflow.com/comment/43440812
type: Comment
has text: Have you tried researching a bit? http://stackoverflow.com/questions/23277062/cant-run-weka-explorer-on-ubuntu-14-04
type: QuestionComment
comment on: http://stackoverflow.com/q/27505372
score: 0

http://stackoverflow.com/a/27532488
downvote count: 0
type: Answer
has body: angulrjs controller: yourAppName.controller('myController' , [$http , $scope , function($http , $scope) { var paramValue = []; paramValue['par'] = $scope.someValue; $http.get('rest/getdata' , {params : paramValue}).success(function(data) { $scope.myData = data; }).error(function(data) { console.log('error occured'); }); }]); spring controller: @RequestMapping(value ="/getdata",method = RequestMethod.GET , params = "par") public @ResponseBody List&lt;Profissoes&gt; getProfissoes(@RequestMapping("par") long value) { System.out.println("Value "+value); // use it further the way u want }
score: 1
answers question: http://stackoverflow.com/q/27532046
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27532046
type: AcceptedAnswer

http://stackoverflow.com/q/27507371
score: 0
has comment: http://stackoverflow.com/comment/43540293
type: UnansweredQuestion
tagged with: garbage-collection
answer count: 0
has comment: http://stackoverflow.com/comment/43492307
tagged with: java
tagged with: memory
type: Question
has title: Verbose GC Logging in relation to max memory
has body: I have some memory related issues in my application. Question is how is PSYoungGen and PSOldGen related to maximum memory of Java application? My application has 3072MB set. And following is a heap stats from verbose GC logs: Heap PSYoungGen total 165184K, used 110272K [0xfffffd7ec8010000, 0xfffffd7ed49b0000, 0xfffffd7fc8010000) eden space 153344K, 71% used [0xfffffd7ec8010000,0xfffffd7ecebc0040,0xfffffd7ed15d0000) from space 11840K, 0% used [0xfffffd7ed15d0000,0xfffffd7ed15d0000,0xfffffd7ed2160000) to space 26560K, 0% used [0xfffffd7ed2fc0000,0xfffffd7ed2fc0000,0xfffffd7ed49b0000) PSOldGen total 2175552K, used 1820513K [0xfffffd7bc8010000, 0xfffffd7c4cca0000, 0xfffffd7ec8010000) object space 2175552K, 83% used [0xfffffd7bc8010000,0xfffffd7c371e8598,0xfffffd7c4cca0000) PSPermGen total 131072K, used 52898K [0xfffffd7bc0010000, 0xfffffd7bc8010000, 0xfffffd7bc8010000) object space 131072K, 40% used [0xfffffd7bc0010000,0xfffffd7bc33b8898,0xfffffd7bc8010000) How are totals related to my 3GB max heap space? When added its still less then my 3GB (2340736)
has comment: http://stackoverflow.com/comment/43445651
has comment: http://stackoverflow.com/comment/43526091

list
type: Tag
tags question: http://stackoverflow.com/q/27506381
tags question: http://stackoverflow.com/q/27507266
tags question: http://stackoverflow.com/q/27515626
tags question: http://stackoverflow.com/q/27523649
tags question: http://stackoverflow.com/q/27522428
tags question: http://stackoverflow.com/q/27592360
tags question: http://stackoverflow.com/q/27591565
tags question: http://stackoverflow.com/q/27626148
tags question: http://stackoverflow.com/q/27580144
tags question: http://stackoverflow.com/q/27497109
tag name: list
tags question: http://stackoverflow.com/q/27557922
tags question: http://stackoverflow.com/q/27560286
tags question: http://stackoverflow.com/q/27485794
tags question: http://stackoverflow.com/q/27586826
tags question: http://stackoverflow.com/q/27622895
tags question: http://stackoverflow.com/q/27569964
tags question: http://stackoverflow.com/q/27598860
tags question: http://stackoverflow.com/q/27638842

http://stackoverflow.com/comment/43608940
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27586267
has text: @assylias I went through the formal specification and could not find a similar indication as I thought that I had found in the JSR-133 cookbook.
type: AnswerComment

http://stackoverflow.com/comment/43643239
score: 0
type: Comment
has text: I made a little example which might highlight the difference between lambda expression and method reference: http://pastebin.com/4W0ivi7U
type: AnswerComment
comment on: http://stackoverflow.com/a/27610337

http://stackoverflow.com/comment/43442706
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27505191
has text: @ScottSummers - If this satisfies your question, please tick it as the correct answer. And also, welcome to StackOverflow
score: 0

http://stackoverflow.com/a/27554190
has body: Looking at your code in gitHub you have 2 methods: //Set the coordinates for this GameObject public void setCoordinates(int x, int y){ this.coordinates.x = x; this.coordinates.y = y; } public void setCoordinates(Coordinate coordinates){ this.coordinates = coordinates; } If you ever use the 2nd one, then you are sharing the same instance of Coordinates so changing one will change the other The solution is to copy the values instead public void setCoordinates(Coordinate coordinates){ this.coordinates.x = coordinates.x; this.coordinates.y = coordinates.y; }
accepted answer of: http://stackoverflow.com/q/27554016
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43590393
type: Answer
score: 5
answers question: http://stackoverflow.com/q/27554016

http://stackoverflow.com/a/27546242
answers question: http://stackoverflow.com/q/27545947
has comment: http://stackoverflow.com/comment/43598320
type: Answer
upvote count: 1
score: 1
has body: This isn't a code-based solution and probably won't be of much help, since it requires each user to install a file locally, but just in case... You can add fallback fonts in a special directory within the JRE installation. From the Java documentation: Users can add a physical font as a fallback font to logical fonts used in Java 2D rendering by installing it in the lib/fonts/fallback directory within the JRE.
has comment: http://stackoverflow.com/comment/43588307
downvote count: 0
has comment: http://stackoverflow.com/comment/43557491
has comment: http://stackoverflow.com/comment/43563603

http://stackoverflow.com/q/27540322
answer count: 1
tagged with: database
has body: I'm trying to use the AWS API for DynamoDB from Java. For some Scan operations, I want to use filters like this: (NAME BEGINS_WITH "Joe") AND ((SALARY &lt; 100) OR (AGE > 60)) that is, combining and nesting the AND/OR boolean operators. Nonetheless, I have only find how to pass with which operator to evaluate the list of ScanFilters, but not how to combine them to build a more complicated expression. So, how to do this kind of expressions? Ideally, it would be something like this: ScanSpec scanSpec = new ScanSpec() .withMyNiceExpression("(NAME BEGINS_WITH \"Joe\") AND ((SALARY &lt; 100) OR (AGE &gt; 60))"); Thanks. P.S.: the model of the table is unknown to me and dynamic. That's why I have to use the API in such way.
score: 0
accepted answer: http://stackoverflow.com/a/27546906
has title: How to evaluate this expression through the Java AWS SDK?
tagged with: amazon-dynamodb
tagged with: nosql
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27546906
type: Question

http://stackoverflow.com/comment/43451218
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/67035/discussion-between-mike-milla-and-meettitan).
comment on: http://stackoverflow.com/a/27510260
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43488017
type: Comment
type: QuestionComment
score: 1
has text: The GCM suites are only available in TLS 1.2 not 1.0.
comment on: http://stackoverflow.com/q/27520572

http://stackoverflow.com/comment/43429364
score: 0
has text: See also the [File Browser GUI](http://codereview.stackexchange.com/q/4446/7784).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27498954

http://stackoverflow.com/a/27480989
has comment: http://stackoverflow.com/comment/43395198
upvote count: 2
type: Answer
score: 2
has body: Create a new folder under WebContent as css and add your css file and then try the below code in jsp. &lt;link rel="stylesheet" href="css/yourfile.css" type="text/css" /&gt; You can add firebug plugin in firefox and try to load the jsp file, which will help you in debugging,like whether the css file is loaded.Hope this helps.
downvote count: 0
answers question: http://stackoverflow.com/q/27480587

http://stackoverflow.com/comment/43401841
has text: As far as I know, most forum scripts invoke single sql query to receive every row of such view (name, replies count, last reply date, etc.) or even single query to get all rows metadata. There is no need to store redundand data and manage consistency. SQL is really eficient, especially to read, so You should't be worry about multiple "SELECT" operations.
comment on: http://stackoverflow.com/a/27482270
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27630319
answers question: http://stackoverflow.com/q/27630305
upvote count: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Why is it that when the button is pressed the application will freeze for a couple seconds then have everything posted on at once. You're doing slow reading on the Swing event thread, tying up the the thread and preventing it from doing its jobs including drawing to the GUI and interacting with the user. Is their a way so you see everything posting dynamically and seeing itbeing posted one by one. That is how the code is written. Yes, use a background thread, most easily obtained by using a SwingWorker. Read Concurrency in Swing. You would likely want to use a generic SwingWorker, specifically SwingWorker&lt;Void, String&gt; and use it's publish/process method pair to push the Strings out into your text component as each line is read. Edit: I now see that both of the links that you placed in your question already mentioned this solution which makes me wonder why you asked this question.
has comment: http://stackoverflow.com/comment/43681290
has comment: http://stackoverflow.com/comment/43681242
score: 5
accepted answer of: http://stackoverflow.com/q/27630305

http://stackoverflow.com/q/27589454
has body: I am stuck at an issue, I don't know if its possible or not. I need to call a HTML page, but the page has some content being loaded via Javascript too and I need to get that also. Is this some how possible ? Currently I have used plain: new URL(url).openConnection() and it's not returning that. Any Help ? Thanks
type: AnsweredQuestion
tagged with: java
type: Question
has title: Call HTML page with javascript content
score: 0
has answer: http://stackoverflow.com/a/27589500
accepted answer: http://stackoverflow.com/a/27589500
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/q/27637877
has comment: http://stackoverflow.com/comment/43695291
score: 4
type: Question
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43694811
has title: Maven error: package does not exist
has comment: http://stackoverflow.com/comment/43694712
linked to: http://stackoverflow.com/q/6334323
tagged with: jenkins
type: UnansweredQuestion
tagged with: maven
has body: I am able build my java project on my local machine, it builds successfully using maven. However, when I build it on a Jenkins machine, i get a compile error: package javax.jms does not exist What does this mean? Where is it looking for javax.jms? In local m2 repo, classpath? I had to make the following changes to my pom.xml to get it to work on Linux: a) Explicitly stated maven-site-plugin version to 2.1. org.apache.maven.plugins maven-site-plugin 2.1 b) Changed maven-surefire-plugin version from 2.4.3 to 2.18.1 maven-surefire-plugin 2.18.1 c) Added the following dependencies : commons-io commons-io 1.4 commons-cli commons-cli 1.2 com.xx.yyy jms 1.1 com.xx.yyy orm 3.1.0.5 org.springframework.ldap spring-ldap-core 1.3.0.RELEASE Why do I have to change the pom.xml on Linux. The build works on my Windows 7 machine without changing the pom.xml.
has answer: http://stackoverflow.com/a/27638147
tagged with: java

http://stackoverflow.com/a/33106442
answers question: http://stackoverflow.com/q/27614301
type: Answer
has body: I solved the problem (How to connect multiple database using spring and Hibernate) in this way, I hope it will help :) NOTE: I have added the relevant code, kindly make the dao with the help of impl I used in the below mentioned code. web.xml <?xml version="1.0" encoding="UTF-8"?> MultipleDatabaseConnectivityInSpring index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet 1 org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/dispatcher-servlet.xml dispatcher *.htm 30 persistence.xml <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence in.india.entities.CustomerDetails <exclude-unlisted-classes /> org.hibernate.ejb.HibernatePersistence in.india.entities.CompanyDetails <exclude-unlisted-classes /> dispatcher-servlet <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:task="http://www.springframework.org/schema/task" xmlns:p="http://www.springframework.org/schema/p" 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" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util" default-autowire="byName" 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-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-m…
upvote count: 4
has comment: http://stackoverflow.com/comment/54836625
downvote count: 0
score: 4

http://stackoverflow.com/comment/43696889
comment on: http://stackoverflow.com/q/27638016
score: 0
type: Comment
type: QuestionComment
has text: logcat is attached on link. If listviewTasks or checkedItems are null, then how should i do to make it filled? It still crash even when i din checked anything.

http://stackoverflow.com/q/27495393
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/28235198
accepted answer: http://stackoverflow.com/a/27560768
type: Question
has answer: http://stackoverflow.com/a/27558381
has title: Android ExpandableListView populated twice
has comment: http://stackoverflow.com/comment/43533242
downvote count: 0
has body: I am using an expandable list view to display options and sub options respectively in a menu. The data coming in is correct, but oddly the listview seems to call the getChild and getChildView twice for each data entry and thus it is added to the view twice. It iterates through and then seems to iterate through again. Example: Categories: -Toys -Electronics -Cars -Toys -Electronics -Cars Expected: Categories: -Toys -Electronics -Cars I am really new to Android and Java so I am probably making a rookie mistake. I have stepped through to try and find a point where it would be duplicating the data, but all I could find is that getChild/getChildView is being called twice. Here is the expandableListView adapter class: public class ExpandableListAdapter extends BaseExpandableListAdapter { private Context context; private ArrayList&lt;String&gt; filterHeaderList; // child data in format of header title, child title private HashMap&lt;String, ArrayList&lt;JSONObject&gt;&gt; filterOptionsMap; public ExpandableListAdapter(Context context, ArrayList&lt;String&gt; filterHeaders, HashMap&lt;String, ArrayList&lt;JSONObject&gt;&gt; filterChildListMap) { this.context = context; this.filterHeaderList = filterHeaders; this.filterOptionsMap = filterChildListMap; } @Override public String[] getChild(int groupPosition, int childPosititon) { JSONObject childObject = this.filterOptionsMap.get(this.filterHeaderList.get(groupPosition)).get(childPosititon); if (childObject != null) { Iterator&lt;?&gt; it = childObject.keys(); String key = null; String value = null; if (it.hasNext()) { key = it.next().toString(); try { value = childObject.getString(key); } catch (JSONException e) { e.printStackTrace(); } String[] data = new String[2]; data[0] = key; data[1] = value; return data; } else { return null; } } return null; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, final int childPosition, b…
has answer: http://stackoverflow.com/a/42718614
favorite count: 0
has answer: http://stackoverflow.com/a/27560768
tagged with: android
has answer: http://stackoverflow.com/a/28235198
answer count: 4
tagged with: expandablelistview
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43424434
upvote count: 3

http://stackoverflow.com/comment/43539632
comment on: http://stackoverflow.com/a/27555221
type: Comment
has text: Edited answer post let me know if getElementsByClassName works for you.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27602669
has comment: http://stackoverflow.com/comment/43630036
accepted answer of: http://stackoverflow.com/q/27602445
type: Answer
has body: I'm pretty sure you're just having trouble to configure your maven &lt;site&gt; tag. at the URL from the official documentation it states: url: This is the core of the repository element. It specifies both the location and the transport protocol to be used to transfer a built artifact (and POM file, and checksum data) to the repository. And you're missing your transport protocol on your URL. Therefore the Wagon protocol '' doesn't support directory copying Here is the list of supported protocols, from their site: File HTTP HTTP lightweight FTP SSH/SCP WebDAV So why don't you try specifying a valid URL? &lt;url&gt;file://var/&lt;url&gt; Here are some more examples and a explanation
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27602445

http://stackoverflow.com/comment/43478303
has text: What is sqrt and sq? Are those your own methods?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27524811
type: Comment

http://stackoverflow.com/a/27594727
has body: In both cases you need to remove this attribute: nullable=true When the DB will get a NULL value it will apply the DEFAULT anyway.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27594455

http://stackoverflow.com/a/27554876
type: Answer
has body: An easy way to do this would be the following... First, begin by declaring a thread... Thread myThread Then create a simple method that contains the thread you wish to execute when the button is pressed... private void getPicture() { myThread = new Thread() { public void run() { // Place thread code here... } }; myThread.start(); } Then you can do a simple check when the button is pressed and, if the thread is active, don't call the getPicture method...buttonDownload.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (myThread.isAlive()) { // Thread is alive, do not launch again } else { // Thread is not running so call method... getPicture(); } } });
answers question: http://stackoverflow.com/q/27554499
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27554499

http://stackoverflow.com/comment/43446375
type: AnswerComment
comment on: http://stackoverflow.com/a/27504984
type: Comment
has text: @misco: please check the link which explains all. Good luck with your project!
score: 1

http://stackoverflow.com/comment/43478940
score: 0
has text: not good enough as I have `public Map<String, List<com.w.automation.rtsimulator. ..`
comment on: http://stackoverflow.com/a/27525206
type: AnswerComment
type: Comment

recurrence
tags question: http://stackoverflow.com/q/27515194
type: Tag
tag name: recurrence

http://stackoverflow.com/q/27591348
accepted answer: http://stackoverflow.com/a/27591634
has answer: http://stackoverflow.com/a/27591471
has body: I am making a simple bible reader for a confirmation project, and I have a UI class. The class opens a windows when called by the main class. I just satisfied multiple errors with static keywords, but one thing is left - my prepareGUI method. Should it be declared static? My IDE throws no errors either way. package input; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class UI extends JFrame { private static final long serialVersionUID = 4226151097999382106L; private static JFrame mainFrame; private static JLabel headerLabel; private static JLabel statusLabel; private static JPanel controlPanel; public UI() { prepareGUI(); } private static/* Should that be there? */ void prepareGUI() { mainFrame = new JFrame("Holy Bible"); mainFrame.setSize(700, 500); mainFrame.setLayout(new GridLayout(3, 1)); mainFrame.setLocationRelativeTo(null); mainFrame.getContentPane().setBackground(Color.WHITE); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { System.exit(0); } }); headerLabel = new JLabel("", JLabel.CENTER); statusLabel = new JLabel("", JLabel.CENTER); statusLabel.setSize(350, 100); controlPanel = new JPanel(); controlPanel.setBackground(Color.WHITE); controlPanel.setLayout(new FlowLayout()); mainFrame.add(headerLabel); mainFrame.add(controlPanel); mainFrame.add(statusLabel); headerLabel.setText((String) ReadFile.currentBookData[0]); JLabel label = new JLabel("", JLabel.CENTER); label.setText((String) ReadFile.currentBookData[2]); label.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12)); controlPanel.add(label); mainFrame.setVisible(true); } public void updateText() { headerLabel.setText((String) ReadFile.currentBookData[4]); statusLabel.setText((String) ReadFile.currentBookData[4]); } }
upvote count: 1
answer count: 6
has answer: http://stackoverflow.com/a/27591484
favorite count: 0
has answer: http://stackoverflow.com/a/27591634
tagged with: static
has comment: http://stackoverflow.com/comment/43606524
has answer: http://stackoverflow.com/a/27591550
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43606501
possible better answer: http://stackoverflow.com/a/27591484
has answer: http://stackoverflow.com/a/27591519
type: Question
has title: Should a method called by a constructor be static?
has comment: http://stackoverflow.com/comment/43606569
score: 1
has answer: http://stackoverflow.com/a/27591620
tagged with: java
has comment: http://stackoverflow.com/comment/43606545

http://stackoverflow.com/comment/43676056
has text: Are you inheriting your theme from a AppCompat.NoActionBar theme? Also make sure you are using <android.support.v7.widget.Toolbar> instead of <android.widget.Toolbar>.
type: AnswerComment
comment on: http://stackoverflow.com/a/27627599
score: 0
type: Comment

http://stackoverflow.com/comment/43476663
has text: I am not sure if he needs diagonal matrix. I am not sure if OP needs an 2D array.. i just highlighted what's wrong with OP's code and what he needs to correct it. I would atleast expect a liner if one downvotes so its clear what's wrong with the approach in the answer so one can improve. See OP accepted one which was downvoted which is a shame for downvoter.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27523683
score: 0

http://stackoverflow.com/a/27532699
upvote count: 2
has body: You've answered the question yourself: you have nothing to put into unique pokemon subclasses, so you don't need them. Instead, you could make constructors in a non-abstract pokemon class that create a pokemon object for a specific pokemon. Example: public class Pokemon { private String type; private String health; public Pokemon (String name) { if (name.equals("Pikachu")) { this.type = "electric"; this.health = 80; } else if (name.equals("Charmander")) { this.type = "fire"; this.health = 50; } } // More of your code } The key concept here is that things that have different functionality (aka new types of stats, new game mechanics) require new classes. Things that simply have different values for the functionality you already have (in an abstract class or otherwise) only need new INSTANCES of the class: new objects.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27532582

http://stackoverflow.com/a/27591874
upvote count: 7
has body: You can create an implicit conversion from String to URL and accept only URL (this is what you want anyway). The implicit def might be in the companion class or in a helper class/trait (trait in the cake pattern). Something like this: implicit def `string to url`(s: String) = new URL(s) Usage: import the.helper.Container._ //or implement the Helper trait containing the implicit def val url: URL = "http://google.com" The drawback is, exceptions might arrive from unexpected places (any might require a further import). A less implicit approach would be "adding" a toURL method to String, like this: object Helpers { implicit class String2URL(s: String) { def toURL = new URL(s) } } Usage of this would look like this: import Helpers._ val aUrl = "http://google.com".toURL Comparison to @m-z's answer: you can combine multiple parameters this way without explosion of combination of different parameters, while for that answer it will exponential (though for small exponents, like in this case 1, that is perfectly fine). @m-z's answer is not reusable, if you need another class, you have to create it again. It works on the library side, so the lib users get a nice documentation, guide how to use it, mine would just work with "magic" and/or small user help (like import of the method, toURL conversion method call). I would choose @m-z's solution for small combinations too, especially with the adjustment of Option or Try. But if you need to overload multiple parameters, I think my solution works better. It really depends on your use case. (You can wrap mine with Try too if there might be cases where the passed url is not valid.)
answers question: http://stackoverflow.com/q/27591709
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/a/31685451
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27516738
accepted answer of: http://stackoverflow.com/q/27516738
upvote count: 9
has body: I had the same problem and have used the OP's code as a base to create this solution: final Spinner spinner = (Spinner)fragmentView.findViewById(R.id.spinner); List&lt;Map&lt;String, String&gt;&gt; items = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); Map&lt;String, String&gt; item0 = new HashMap&lt;String, String&gt;(2); item0.put("text", "Browse aisles..."); item0.put("subText", "(Upgrade required)"); items.add(item0); Map&lt;String, String&gt; item1 = new HashMap&lt;String, String&gt;(2); item1.put("text", "Option 1"); item1.put("subText", "(sub text 1)"); items.add(item1); Map&lt;String, String&gt; item2 = new HashMap&lt;String, String&gt;(2); item2.put("text", "Option 2"); item2.put("subText", "(sub text 2)"); items.add(item2); SimpleAdapter adapter = new SimpleAdapter(getActivity(), items, android.R.layout.simple_spinner_item, // This is the layout that will be used for the standard/static part of the spinner. (You can use android.R.layout.simple_list_item_2 if you want the subText to also be shown here.) new String[] {"text", "subText"}, new int[] {android.R.id.text1, android.R.id.text2} ); // This sets the layout that will be used when the dropdown views are shown. I'm using android.R.layout.simple_list_item_2 so the subtext will also be shown. adapter.setDropDownViewResource(android.R.layout.simple_list_item_2); spinner.setAdapter(adapter); You can also substitute android.R.layout.simple_spinner_item and/or android.R.layout.simple_list_item_2 with your own custom views (that would typically reside in your layout folder). This is a much better solution than PhoneGap!! :D
score: 9

http://stackoverflow.com/a/27527376
answers question: http://stackoverflow.com/q/27527265
has comment: http://stackoverflow.com/comment/43484615
score: 20
has comment: http://stackoverflow.com/comment/43485479
has body: Everything works exactly as expected, no bugs here. When you have doubts, the JLS is your savior: JLS - 14.20.2. Execution of try-finally and try-catch-finally: If execution of the try block completes abruptly for any other reason R, then the finally block is executed, and then there is a choice: If the finally block completes normally, then the try statement completes abruptly for reason R. If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and reason R is discarded). It overrides the value in the try block. return inside finally discards all exceptions that can be thrown in try clause.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43485356
has comment: http://stackoverflow.com/comment/43485385
has comment: http://stackoverflow.com/comment/43483327
has comment: http://stackoverflow.com/comment/43484793
upvote count: 20
has comment: http://stackoverflow.com/comment/43483426
has comment: http://stackoverflow.com/comment/43484389
has comment: http://stackoverflow.com/comment/43483453
has comment: http://stackoverflow.com/comment/43485222
type: Answer
has comment: http://stackoverflow.com/comment/43485360
has comment: http://stackoverflow.com/comment/43485543
downvote count: 0
has comment: http://stackoverflow.com/comment/43484588
accepted answer of: http://stackoverflow.com/q/27527265

http://stackoverflow.com/q/27535648
type: Question
has comment: http://stackoverflow.com/comment/43500187
tagged with: hashmap
has comment: http://stackoverflow.com/comment/79372991
has body: I have a HashMap made of two types: String as Keys, which are Player names and Integer as values, which are scores. I am creating a ranking system, and for that, I need to get the two highest values from this HashMap, so the top two players that were put into it. For example: If these were the values of my HashMap: Key Value String1 1 String2 2 String3 3 String4 4 String5 5 I would want a way to only return String4 and String5. I thought that getting the entrySet would be enough, but there's no get method in a Set, so I can't get value 0 (highest) and value 1 (second highest). I also tried using Collections.max(map); And it wouldn't accept a HashMap as an argument And final String[] top = new String[1]; int topInt = 0; map.forEach((s, i) -&gt; {if (i &gt; topInt) top[0] = s;}); But that didn't quite work either, it was way too slow for my performance. How do I obtain both highest values?
downvote count: 5
has comment: http://stackoverflow.com/comment/43499902
upvote count: 1
has comment: http://stackoverflow.com/comment/79373153
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/79373134
has title: How to get the two highest values in a HashMap<String, Integer>
tagged with: java
tagged with: set
has comment: http://stackoverflow.com/comment/43499898
has comment: http://stackoverflow.com/comment/43500945
has answer: http://stackoverflow.com/a/27535836

http://stackoverflow.com/a/27501777
has body: You may want to have a look at the java.util.regex.Matcher#find() method. This question has a solution
score: 0
answers question: http://stackoverflow.com/q/27501438
type: Answer

http://stackoverflow.com/comment/43749807
score: 0
type: QuestionComment
type: Comment
has text: I believe it is a valid approach. As long as the server knows what to do with such "internal" events, you can safely use this approach to generate independent sub modules. You can even manage the shutdown of them through a particular message sent by the sever, or manage specific requests from server to sub modules (so not only in passive way but active way). Some optimization could be done if necessary for instance by sharing the eventLoopGroup between the "network" server bootstrap and the "internal" server side bootstrap (and eventually but not necessary on client side too).
comment on: http://stackoverflow.com/q/27629015

http://stackoverflow.com/q/27588527
has title: how to generate .java file from .form file in netbeans?
tagged with: netbeans
has answer: http://stackoverflow.com/a/27588699
upvote count: 1
tagged with: swing
has body: In my project (in Netbeans IDE) I have made code changes through design-> Customize code. After that I did Clean n build project, so .form file got reflected. But I am not able to see reflect changes in .java file even if name of the both .form &amp; .java files is same. Am I missing anyy step in between? Is there any other way to do the same?
type: Question
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27578470
tagged with: facebook-graph-api
has title: facebook like button shows blank page when clicked
type: UnansweredQuestion
tagged with: facebook
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27692732
answer count: 1
score: 0
tagged with: android
has body: Hi I have been trying to put a facebook like butto on my Android App so that the users will be able to like my facebook page on clicking it. I think i have done everything as directed in the facebook developers page at https://developers.facebook.com/docs/android/like-button/ But on clicking the like button, the app shows a blank white page and then returns to the app again. Here are the codes that I have been using This is the part of the layout used by me: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;ImageView android:layout_width="match_parent" android:layout_height="100dp" android:contentDescription="@string/logo" android:padding="10dp" android:src="@drawable/nrnlogo" /&gt; &lt;com.facebook.widget.LikeView android:id="@+id/like_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5dp" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; The MainActivity.java is as follows. I will have to implement it in the fragment placed in the MainActivity.java public static class HomeFragment extends Fragment{ public static final String ARG_CATEGORY_NUMBER = "category_number"; private UiLifecycleHelper uiHelper; public int currentimageindex = 0; private SwipeRefreshLayout swipeLayout; //private Callback callback; public HomeFragment() { // Empty constructor required for fragment subclasses } @SuppressWarnings("deprecation") @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_home, container, false); //SWIPE TO REFRESH swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_container); //swipeLayout.se…

http://stackoverflow.com/q/27529143
downvote count: 0
has answer: http://stackoverflow.com/a/27531632
favorite count: 0
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/27531632
answer count: 1
has body: I have no idea what am doing wrong anymore, heres how it all looks Notice the last 3 panes are incorrect in terms of alignment yet they use the same code as the first two. Heres the code. import javax.swing.BorderFactory; public class View_RegisterMember extends JDialog { private static final long serialVersionUID = -4610105372782292470L; private JDialog dialog; // Panels private JPanel pdPanel; private JPanel addressPanel; private JPanel cdpanel; private JPanel memDetails; private Border blackline; private JLabel lblTitle; private JLabel lblFirstName; private JLabel lblSurname; private JLabel lblStreetNo; private JLabel lblStreetName; private JLabel lblCity; private JLabel lblPostcode; private JLabel lblPhoneNo; private JLabel lblEmail; private JLabel lblMembershipType; private JLabel lblPrice; private JLabel lblpriceData; private JLabel lblDob; // textfields private JTextField textphoneData; private JTextField textFieldEmailData; @SuppressWarnings("rawtypes") private JComboBox comboBoxTitle; private JTextField textFieldfName; private JTextField textFieldlName; private JTextField textFieldNumber; private JTextField textFieldStreetName; private JTextField textFieldCity; private JTextField textFieldPostCode; private JTextField textFieldDOB; private JComboBox&lt;String&gt; comboBoxMemType; private JButton btnSave; private JPanel bdPanel; private JLabel lblAccountName; private JTextField textFieldAccName; private JLabel labelSortCode; private JTextField textFieldSortCode; private JLabel lblAccNo; private JTextField textFieldAccNo; public View_RegisterMember(final JFrame frame) { dialog = this; blackline = BorderFactory.createLineBorder(Color.black); dialog.setTitle("Member Registration"); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent arg0) { frame.setEnabled(true); } }); GridBagLayout gridBagLayout = new GridBagLayout(); createBagLayouts(gridBagLayout); getContentPane().setLayout(gridBagLayout); createPersonalDetailsPane(); createAddress…
has comment: http://stackoverflow.com/comment/43502221
tagged with: java
tagged with: gridbaglayout
has comment: http://stackoverflow.com/comment/43487937
score: 2
type: AnsweredQuestion
has title: GridBagLayout Uniformity Issue

http://stackoverflow.com/comment/43603040
has text: @ShivankSagar please post logical error
comment on: http://stackoverflow.com/q/27589439
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27621122
tagged with: keyboard
tagged with: android-softkeyboard
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/4451374
has title: Use "OK" key on softkeyboard (numberPassword keyboard) instead of clicking button?
has comment: http://stackoverflow.com/comment/43663337
possible better answer: http://stackoverflow.com/a/27621494
has answer: http://stackoverflow.com/a/27624878
has answer: http://stackoverflow.com/a/27621494
accepted answer: http://stackoverflow.com/a/27624878
type: Question
type: AnsweredQuestion
tagged with: java
has body: I have an EditText which InputType is numberPassword, and a Button"ANYNAME". I'd like to use "OK" key on softkeyboard (numeric keyboard) instead of the Button"ANYNAME" to execute a giving function in my code. How can I realize that?
answer count: 2
has comment: http://stackoverflow.com/comment/43662816

http://stackoverflow.com/comment/43400474
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27484008
has text: OK the problems for post of @chasmo will also be applicable to mine.

http://stackoverflow.com/comment/43677293
comment on: http://stackoverflow.com/a/27627885
type: Comment
score: 0
type: AnswerComment
has text: Thank you! But why in my case the method acts as toString()?

http://stackoverflow.com/q/27507413
type: Question
upvote count: 4
score: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/27513320
accepted answer: http://stackoverflow.com/a/27513320
has body: our spring-boot project looks like the following project |__ build.gradle |__ settings.gradle |__ module_a |__ module_b |__ ... |__ module_a |__ module_b module_a contains only the SpringApplication class and a file application.properties Running ./gradlew build works fine, but the problem is, for every module (about 10) gradle generates a fat jar including all dependencies. We want to only have one far jar (in module a) buildscript { ext { springBootVersion = '1.2.0.RELEASE' springLoadedVersion = '1.2.0.RELEASE' } repositories { // NOTE: You should declare only repositories that you need here mavenCentral() maven { url "http://repo.spring.io/release" } maven { url "http://repo.spring.io/milestone" } maven { url "http://repo.spring.io/snapshot" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.springframework:springloaded:${springLoadedVersion}") } } allprojects { group = "example.group" version = "0.0.1" repositories() { mavenCentral() } } subprojects { apply plugin: "groovy" apply plugin: "eclipse" eclipse { classpath { containers.remove("org.eclipse.jdt.launching.JRE_CONTAINER") containers "org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" } } apply plugin: "idea" apply plugin: "java" apply plugin: "spring-boot" mainClassName = "MainClassName" sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { } } task wrapper(type: Wrapper) { gradleVersion = '2.2' } We tried adding the options jar.enabled = false bootRepackage.enabled = false in the subprojects section, but after that, the project wont comile any longer.
has title: Spring Boot Multi Module Gradle Build - Multiple "Fat Jars"
tagged with: java
tagged with: gradle

http://stackoverflow.com/a/27614364
has body: Use a Calendar to perform date arithmetic and a DateFormat to display the result. Something like, Calendar cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_MONTH, 30); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); System.out.println(df.format(cal.getTime()));
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27614322
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43659902
type: QuestionComment
has text: @HovercraftFullOfEels That GUI is the table of results which we get from http query, Before getting this results from webserver, we have the row count(size = 13) of results, so we want to ask user that, if user is ok with the delay(big number rowcount) caused for querying the results thru dialog(yes/no), On "No", we stop webserver to avoid going very busy ): worker methods are weirdly called in swing event threads, but this is how existing code is):
comment on: http://stackoverflow.com/q/27613915
score: 0
type: Comment

http://stackoverflow.com/comment/43475864
type: QuestionComment
has text: I have added a sample JSON. Thanks.
comment on: http://stackoverflow.com/q/27523186
score: 0
type: Comment

http://stackoverflow.com/q/27484027
has comment: http://stackoverflow.com/comment/43400330
has body: I want to play YouTube-video in one of the fragments (YouTube Android Player API). A class that implements the video fragment looks like this: public class VideoFragment extends YouTubePlayerSupportFragment { private YouTubePlayer activePlayer; public static VideoFragment newInstance(String url) { VideoFragment playerYouTubeFrag = new VideoFragment(); Bundle bundle = new Bundle(); bundle.putString("url", url); playerYouTubeFrag.setArguments(bundle); playerYouTubeFrag.init(); return playerYouTubeFrag; } private void init() { initialize(DeveloperKey.DEVELOPER_KEY, new YouTubePlayer.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player, boolean wasRestored) { activePlayer = player; activePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT); if (!wasRestored) { activePlayer.loadVideo(getArguments().getString("url"), 0); } } @Override public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) { } }); } @Override public void onPause() { activePlayer.pause(); } } Then I replace a FrameLayout in another fragment: public class InfoFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // ... some code ... VideoFragment videoFragment = VideoFragment.newInstance("video_id"); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.videoLayout, videoFragment).commit(); } } It works, but while watching a video screen scrolls up and the video is paused. So, my questions are: Why does the screen scrolling when viewing? If I am not mistaken, the video playback should be in a separate thread because the player initialization retarding the main thread. Is there any nuances that should be considered in this case? Thank you for your answers.
upvote count: 1
tagged with: android-fragments
score: 1
tagged with: java
tagged with: youtube-data-api
has comment: http://stackoverflow.com/comment/43400421
type: Question
tagged with: android-youtube-api
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43400660
has title: Fragment scrolls while watching videos [YouTube API]
tagged with: android
has comment: http://stackoverflow.com/comment/43406426
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27594913
type: Question
accepted answer: http://stackoverflow.com/a/27598464
tagged with: android
has body: I'm experimenting with the Android cardslib and trying to show an image using this tutorial: https://github.com/gabrielemariotti/cardslib/blob/master/doc/THUMBNAIL.md However, it doesn't show the image, just an empty card. My Activity code is: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Create a Card Card card = new Card(this); //Create thumbnail CardThumbnail thumb = new CardThumbnail(this); //Set URL resource thumb.setUrlResource("https://lh5.googleusercontent.com/-N8bz9q4Kz0I/AAAAAAAAAAI/AAAAAAAAAAs/Icl2bQMyK7c/s265-c-k-no/photo.jpg"); //Add thumbnail to a card card.addCardThumbnail(thumb); //Set card in the cardView CardViewNative cardView = (CardViewNative) this.findViewById(R.id.carddemo); cardView.setCard(card); } I have also tried doing this from a local resource, like this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Create a Card Card card = new Card(this); //Create thumbnail CardThumbnail thumb = new CardThumbnail(this); //Set ID resource thumb.setDrawableResource(R.drawable.ic_launcher); //Add thumbnail to a card card.addCardThumbnail(thumb); //Set card in the cardView CardViewNative cardView = (CardViewNative) this.findViewById(R.id.carddemo); cardView.setCard(card); My XML is: &lt;TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;it.gmariotti.cardslib.library.view.CardViewNative android:id="@+id/carddemo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="12dp" android:layout_marginRight="12dp" android:layout_marginTop="12dp"/&gt; &lt;it.gmariotti.cardslib.library.view.CardViewNative card_layout_resourceID="@layout/native_card_thumbnail_layout" android:layout_below="@id/carddemo" android:id="@+id/carddemo_thumb_url" android:layout_width="…
upvote count: 2
tagged with: java
answer count: 1
tagged with: cardslib
has answer: http://stackoverflow.com/a/27598464
score: 2
type: AnsweredQuestion
has title: Cardslib Thumbnail not appearing
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/27482717
tagged with: android
has comment: http://stackoverflow.com/comment/43415578
type: UnansweredQuestion
tagged with: sockets
answer count: 0
tagged with: tcp
tagged with: java
has body: I'm stucking in one problem never experienced before. Application uses native code to create TCP socket and connect to the remote server through Wi-Fi. If server is already down, but I try to connect to it by ip and port(doing by native code) android application freezes. I tried to connect by calling that native method through AsyncTask, Thread no luck. Also by killing thread I could not prevent app freezing. Any suggestion would be kindly appreciated. Thanks in advance
type: Question
has comment: http://stackoverflow.com/comment/43427923
score: 0
has title: Native creation and connection of TCP socket, freezes app when server is not available

http://stackoverflow.com/comment/43387103
type: Comment
type: QuestionComment
has text: See this link: http://stackoverflow.com/a/26830506/4015623 The question and answer I wrote there have code snippets that show how to do this.
comment on: http://stackoverflow.com/q/27475324
score: 1

http://stackoverflow.com/comment/43536482
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27555088
type: AnswerComment
has text: Thank you so much Austin for the comments. I'll spend my time revising it now so I'll how to do it myself now <3

http://stackoverflow.com/q/27573385
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43572288
tagged with: bitmap
type: Question
has body: I use a listview of an object. This object contains different attributes and an image. I get this image by asking the server a jpg image with an http request. I convert this image into a bitmap and I then display it. My application is lagging and slow since I have added the bitmaps. Is there any solution to reduce this lag?
has title: Alternative to bitmap for android application
score: 1
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/43572318
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27573575
tagged with: android
has comment: http://stackoverflow.com/comment/43572283
has comment: http://stackoverflow.com/comment/43572457

http://stackoverflow.com/comment/86784140
has text: can you please add more details about option 2? Like which library to use for "create rule as text then passed to the Drools parser before being added to the list of rules to evaluate."
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27623395

http://stackoverflow.com/comment/43468732
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27518999
has text: @The111 As I said in my previous comment that there could be many reasons for which you required an array of HashMap. Consider the scenario, You are processing elements from different users and you want to keep them based on user profiles (separate from each other). The most memory efficient way is to keep them separate is using array of HashMap.

http://stackoverflow.com/a/27605397
has comment: http://stackoverflow.com/comment/43659170
has comment: http://stackoverflow.com/comment/43653850
has comment: http://stackoverflow.com/comment/43659431
answers question: http://stackoverflow.com/q/27604656
accepted answer of: http://stackoverflow.com/q/27604656
has comment: http://stackoverflow.com/comment/43656732
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43658871
score: 0
has comment: http://stackoverflow.com/comment/43659019
has comment: http://stackoverflow.com/comment/43658014
has comment: http://stackoverflow.com/comment/43659327
has comment: http://stackoverflow.com/comment/43659795
type: Answer
has comment: http://stackoverflow.com/comment/43660416
has comment: http://stackoverflow.com/comment/43659290
has comment: http://stackoverflow.com/comment/43659627
has comment: http://stackoverflow.com/comment/43653720
has comment: http://stackoverflow.com/comment/43658634
has comment: http://stackoverflow.com/comment/43658737
has comment: http://stackoverflow.com/comment/43658041
has body: this code work for me: public class MainActivity extends ActionBarActivity { float x, y; RelativeLayout rl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getActionBar().hide(); rl = (RelativeLayout) findViewById(R.id.root_view); rl.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { // rl.removeView(iv); x = motionEvent.getX(); y = motionEvent.getY(); setImageLocation(x, y); //rl.addView(iv); } return false; } }); } public void setImageLocation(float x, float y) { ImageView newImage; RelativeLayout.LayoutParams newparams; newparams = new RelativeLayout.LayoutParams(20, 20); newparams.setMargins((int) (x-rl.getPaddingLeft()), (int) (y-rl.getPaddingTop()), 0, 0); newImage = new ImageView(this); newImage.setLayoutParams(newparams); newImage.setImageResource(R.drawable.clock); rl.addView(newImage); } } activity_main.xml layout only has one relativeLayout that has full screen size(match parent)

http://stackoverflow.com/comment/43605906
has text: `i == 0` should be `i != 0`
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27591028
type: QuestionComment

http://stackoverflow.com/q/27561501
tagged with: static
has answer: http://stackoverflow.com/a/27561583
has body: Though this question might be asked several time on SO(mostly in form of this vs Bar.class in Synchronized block), but i am not clear about the Synchronization on Static reference/object of a class(3rd example) of this question. Please have a look on below Java examples: Example#1 - synchronized block with this keyword public class Bar implements Runnable { @Override public void run() { objectLock(); } public void objectLock() { synchronized(this) { System.out.println(Thread.currentThread().getName()); System.out.println("synchronized block " + Thread.currentThread().getName()); System.out.println("synchronized block " + Thread.currentThread().getName() + " end"); } } public static void main(String[] args) { Bar b1 = new Bar(); Thread t1 = new Thread(b1); Thread t2 = new Thread(b1); Thread t3 = new Thread(b1); Bar b2 = new Bar(); Thread t4 = new Thread(b2); Thread t5 = new Thread(b2); Thread t6 = new Thread(b2); t1.setName("t1"); t2.setName("t2"); t3.setName("t3"); t4.setName("t4"); t5.setName("t5"); t6.setName("t6"); t1.start(); t2.start(); t3.start(); t4.start(); t5.start(); t6.start(); } } Result : While any thread From t1,t2,t3 acquire lock through synchronized block(say t1 acquire), then t2 and t3 would be in blocked state, but at the same time other threads t4,t5 and t6 are allowed to perform concurrently. Example#2 - synchronized block with Bar.class public class Bar implements Runnable { @Override public void run() { objectLock(); } public void objectLock() { synchronized(Bar.class) { System.out.println(Thread.currentThread().getName()); System.out.println("synchronized block " + Thread.currentThread().getName()); System.out.println("synchronized block " + Thread.currentThread().getName() + " end"); } } public static void main(String[] args) { Bar b1 = new Bar(); Thread t1 = new Thread(b1); Thread t2 = new Thread(b1); Thread t3 = new Thread(b1); Bar b2 = new Bar(); Thread t4 = new Thread(b2); Thread t5 = new Thread(b2); Thread t6 = new Thread(b2); t1.setName…
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
upvote count: 1
downvote count: 1
type: Question
tagged with: concurrency
has title: synchronized block with static reference/object in multi-threading environment
has answer: http://stackoverflow.com/a/27563464
score: 0
has answer: http://stackoverflow.com/a/27562004
answer count: 3
favorite count: 0
tagged with: synchronization

http://stackoverflow.com/q/27617301
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/27619667
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43662213
tagged with: java
has body: I wrote a custom matcher to compare my objects. It all works except for the describeMismatchSafely method. I kept simplyfing and simplyfing, until I got this: public static TypeSafeMatcher&lt;IMyObj &gt; equalTo(final IMyObj expected) { return new TypeSafeMatcher&lt;IMyObj &gt;() { @Override public void describeTo(final Description description) { description.appendText("this value"); } @Override public void describeMismatchSafely(final IMyObj myObj, final Description mismatchDescription) { mismatchDescription.appendText(" the wrong value"); } @Override protected boolean matchesSafely(IMyObj actual) { return false; } } } The method describeTo works just fine, but describeMismatchSafely always prints myObj.toString() instead of the message I want it to: java.lang.AssertionError: Expected: this value got: I googled custom matchers implementations and it seemed everybody was overriding the describeMismatchSafely method and it was working just fine for them. Is there a reason mine should not work?
accepted answer: http://stackoverflow.com/a/27619667
linked to: http://stackoverflow.com/q/3915635
type: Question
has comment: http://stackoverflow.com/comment/43659976
tagged with: hamcrest
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43659750
has title: Hamcrest describeMismatchSafely always printing Object.toString() insted of my implementation
has comment: http://stackoverflow.com/comment/43660681

http://stackoverflow.com/comment/43408820
comment on: http://stackoverflow.com/q/27482089
score: 0
type: Comment
type: QuestionComment
has text: I would add your repo's to your SVN repo list available in eclipse via Subclipse. Check out the projects into your workspace through the repo browser in eclipse. I experience difficulties while mixing tortise and subclipse usage, so try to stick with one.

http://stackoverflow.com/q/27560041
has title: Form Builder - Multiple User Access Issue
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/27559332
has answer: http://stackoverflow.com/a/27701680
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: orbeon
has body: I am facing an issue with form builder while it is accessed by more than one user at a time. There is no issue if only one member accesses it. I am getting the following error dialogue often. ​ The following is the tomcat console output. I am using tomcat 6.0.37. I have explored the http://wiki.orbeon.com/forms/doc/developer-guide/context-and-session-listeners page. It says that "The Orbeon Forms Servlet Context Listener allows configuring one processor to be called when the Servlet context is initialized, and one to be called when the Servlet context is destroyed." We are using orbeon 4.5.30 Community Edition. Is it an issue with Community Edition or will it occur in Professional Edition too? Please guide me on this to configure the Form Builder to be accessed by multiple user at time.
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/43634397
has text: I considered to use the @Primary annotation, however There some cases when I'm not able to determine which implementation can be default. The only place when I'm completely sure what I need is in a class where I injecting an interface. Please have a look at the comments in Test1 and Test2 class. Anyway thanks for the hint.
score: 0
comment on: http://stackoverflow.com/a/27605897
type: Comment
type: AnswerComment

http://stackoverflow.com/a/27515775
answers question: http://stackoverflow.com/q/27515626
has comment: http://stackoverflow.com/comment/43461838
upvote count: 1
has body: You missed quite a few matching/closing brackets in your code. Not sure where you want to place the method possibleMoves(), but the original code posted should work as follows: public class Game { position position = new position(); // the word button has a red mark next to the semicolon protected Component button; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { private Game game; private int idx; public void run() { JFrame frame = new JFrame("Java TTT"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout(3, 3)); game = new Game(); final JButton[] buttons = new JButton[9]; for (int i = 0; i &lt; 9; i++) { idx = i; final JButton button = new JButton(); buttons[i] = button; button.setPreferredSize(new Dimension(100, 100)); button.setBackground(Color.BLACK); button.setOpaque(true); button.setFont(new Font(null, Font.PLAIN, 100)); button.addMouseListener(new MouseListener() { public void mouseReleased(MouseEvent e) {} public void mousePressed(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} @Override public void mouseClicked(MouseEvent e) { button.setText("" + game.position.turn); game.move(idx); if (!game.position.gameEnd()) { int best = game.position.bestMove(); buttons[best].setText("" + game.position.turn); game.move(best); } if (game.position.gameEnd()) { String message = ""; if (game.position.win('x')) { message = "You won! (Mr. Lebron I made the game let you win, I think that deserves an A [Quit to play again])"; } else if (game.position.win('o')) { message = "Computer won! (I think I still deserve an A [Quit to play again])"; } else { message = "It's a tie! (Good try though [Quit to play again])"; } JOptionPane.showMessageDialog(null, message); } } }); frame.add(button); } // realize components frame.pack(); frame.setVisible(true); } } } protected void move(int idx) { // the words position position = position.move(idx); //the following bracke…
has comment: http://stackoverflow.com/comment/43461983
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43619205
type: Comment
type: QuestionComment
has text: @geekchic As per java Doc it may not contain parse able String
comment on: http://stackoverflow.com/q/27597841
score: 0

http://stackoverflow.com/comment/43603159
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27586880
has text: @pbabcdefp - I like the answer I won't like. If the alternative is a horrendous, over-complicated mess, I can live with that.
score: 0

http://stackoverflow.com/a/27626033
answers question: http://stackoverflow.com/q/27625611
upvote count: 33
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43673233
score: 33
has body: This result doesn't surprise me given how floating-point numbers are represented. Let's suppose we had a very short floating-point type with only 4 bits of precision. If we were to generate a random number between 0 and 1, distributed uniformly, there would be 16 possible values: 0.0000 0.0001 0.0010 0.0011 0.0100 ... 0.1110 0.1111 If that's how they looked in the machine, you could test the low-order bit to get a 50/50 distribution. However, IEEE floats are represented as a power of 2 times a mantissa; one field in the float is the power of 2 (plus a fixed offset). The power of 2 is selected so that the "mantissa" part is always a number >= 1.0 and &lt; 2.0. This means that, in effect, the numbers other than 0.0000 would be represented like this: 0.0001 = 2^(-4) x 1.000 0.0010 = 2^(-3) x 1.000 0.0011 = 2^(-3) x 1.100 0.0100 = 2^(-2) x 1.000 ... 0.0111 = 2^(-2) x 1.110 0.1000 = 2^(-1) x 1.000 0.1001 = 2^(-1) x 1.001 ... 0.1110 = 2^(-1) x 1.110 0.1111 = 2^(-1) x 1.111 (The 1 before the binary point is an implied value; for 32- and 64-bit floats, no bit is actually allocated to hold this 1.) But looking at the above should demonstrate why, if you convert the representation to bits and look at the low bit, you will get zero 75% of the time. This is due to all values less than 0.5 (binary 0.1000), which is half the possible values, having their mantissas shifted over, causing 0 to appear in the low bit. The situation is essentially the same when the mantissa has 52 bits (not including the implied 1) as a double does. (Actually, as @sneftel suggested in a comment, we could include more than 16 possible values in the distribution, by generating: 0.0001000 with probability 1/128 0.0001001 with probability 1/128 ... 0.0001111 with probability 1/128 0.001000 with probability 1/64 0.001001 with probability 1/64 ... 0.01111 with probability 1/32 0.1000 with probability 1/16 0.1001 with probability 1/16 ... 0.1110 with probability 1/16 0.1111 with probability 1/16 But I'm not s…

http://stackoverflow.com/q/27613910
type: AnsweredQuestion
tagged with: java
has body: Here's the problem. http://usaco.org/index.php?page=viewproblem2&amp;cpid=487 Here's the solution. http://usaco.org/current/data/sol_marathon_bronze.html I already solved that problem but my code is too slow to pass all the testcases until 100, 000 points, so I read the official solution, but I could not understand the solution, the math part that says: int largestSkip = 0; for(int i = 1; i &lt; n-1; i++) { int noSkipDistance = Math.abs(x[i+1] - x[i]) + Math.abs(x[i] - x[i-1]) + Math.abs(y[i+1] - y[i]) + Math.abs(y[i] - y[i-1]); int skipDistance = Math.abs(x[i+1] - x[i-1]) + Math.abs(y[i+1] - y[i-1]); largestSkip = Math.max(largestSkip, noSkipDistance - skipDistance); } How do they get those formulas?, if I understood well the variable skipDistance goes from 0 - skip 1- 2, 1- skip 2 -3, and so on, the other variables noskipDistance goes from 0 -2, 1 -3 (no skipping) and so on, are there other similar problems? or please if anyone could help me to understand I will be really grateful The best solution that comes to my mind is, but It is too slow import java.io.*; import java.util.*; public class marathon { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader("marathon.in")); PrintWriter pw = new PrintWriter(new File("marathon.out")); int n = Integer.parseInt(br.readLine()); int[][] arr = new int[n][2]; boolean[] flag = new boolean[n]; for(int i = 0; i &lt; n; i++){ String s = br.readLine(); int n1 = Integer.parseInt(s.substring(0 , s.indexOf(" "))); int n2 = Integer.parseInt(s.substring(s.indexOf(" ") +1, s.length())); arr[i][0] = n1; arr[i][1] = n2; } Arrays.fill(flag, true); long min = Long.MAX_VALUE; for(int i = 1; i &lt; (n -1); i++){ flag[i] = false; min = Math.min(min, solve(arr, flag, n)); flag[i] = true; } pw.println(min); pw.close(); } public static long solve(int[][]arr, boolean[] flag, int n){ long min = Long.MAX_VALUE; long sum = 0; List&lt;Integer&gt; listX = new ArrayList&lt;&gt;(); List&lt;In…
type: Question
tagged with: algorithm
tagged with: math
score: 0
has answer: http://stackoverflow.com/a/27617036
answer count: 1
accepted answer: http://stackoverflow.com/a/27617036
has title: Java USACO how to solve/understand the solution to Marathon (bronze december 2014)?

http://stackoverflow.com/comment/43410912
type: Comment
type: QuestionComment
has text: I think the issue will be with the SQL date format. Is the `datetime` a proper datatype you are referring? Try `Date` instead.
comment on: http://stackoverflow.com/q/27489637
score: 0

http://stackoverflow.com/a/27513498
score: 2
has comment: http://stackoverflow.com/comment/43457885
upvote count: 2
has body: You're using the same ComboBoxModel for each JComboBox, but the ComboBoxModel also manages the selected item, so when one combo box updates, all the other combo boxes are updated. You need to create a separate/individualComboBoxModel for each combo box which contains that data you want displayed instead
has comment: http://stackoverflow.com/comment/43457489
answers question: http://stackoverflow.com/q/27513278
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43457471

http://stackoverflow.com/q/27516723
has answer: http://stackoverflow.com/a/27517211
has comment: http://stackoverflow.com/comment/43464062
has title: Java: Is it not possible to use an iterator to iterate a HashMap of objects and change attributes of objects?
has comment: http://stackoverflow.com/comment/43464829
upvote count: 1
has comment: http://stackoverflow.com/comment/43464255
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43464609
tagged with: oop
tagged with: java
accepted answer: http://stackoverflow.com/a/27517211
has comment: http://stackoverflow.com/comment/43464698
has comment: http://stackoverflow.com/comment/43464209
has comment: http://stackoverflow.com/comment/43464219
type: Question
tagged with: iterator
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43463974
has body: I know this may be a very basic question to the experts in here. But I cannot get my head around this. Basically, I have the following depth-first-search instance method. I have an object class Dgraph, which is HashMap&lt;Vertex, ArrayList&lt;Vertex&gt;&gt;. Vertex is just an object class I created and it contains a color attribute and a node attribute. Problem: Basically, I want to change the color of the Vertex object within the iterator statement. But it doesn't work as expected. I was able to change the color attribute of each vertex object within the iterator but when I leave the iterator , the color attribute of each vertex are still null. Note that Vertex objects with same node values are the same object, i.e. consider 5 --&gt; 1 and 1 -- 9, we only have one Vertex object with node equal to 1 here. public void depth_first_search(Dgraph graph){ // for debugging System.out.println("Before iterator"); System.out.println("Graph = " + graph); System.out.println(""); graph.display(); HashMap&lt;Vertex, ArrayList&lt;Vertex&gt;&gt; dag = graph.returnHashMap(graph); for(Map.Entry&lt;Vertex, ArrayList&lt;Vertex&gt;&gt; g_map : dag.entrySet() ){ Vertex u = g_map.getKey(); u.set_color("WHITE"); System.out.println("In iterator --&gt; Vertex u = " + u + " color = " + u.get_color()); } // for debugging System.out.println("*************************"); System.out.println("After iterator"); System.out.println("Graph = " + dag); graph.display(); } } This is the debugging output I got: Before iterator Graph = Dgraph@7852e922 5 : [1, 9] null null 3 : [511596] null 2 : [47646, 47647, 13019, 47648, 47649, 47650, 7700, 47651, 47652] null null null null null null null null null 1 : [1, 2, 5, 6, 7, 3, 8, 4] null null null null null null null null in iterator --&gt; Vertex u = 5 color = WHITE in iterator --&gt; Vertex u = 3 color = WHITE in iterator --&gt; Vertex u = 2 color = WHITE in iterator --&gt; Vertex u = 1 color = WHITE ************************* After iterator Graph = {5=[1, 9]…
has comment: http://stackoverflow.com/comment/43464329

http://stackoverflow.com/q/27584517
score: 0
has body: I have a weird bug I'm hoping someone can help me with. I am using the Google Drive app folder to backup some data from my app. It creates the file and writes my data without and issue, I can sign grab the file from drive at any time and it works fine. However if I uninstall the app when I reinstall it the Google Drive App folder is empty. I'm assuming I'm missing some point of the sync process so it's only caching locally but I can't see what I've done wrong. My code to create and commit the file is below. DriveFile file = ..//Get drive file; file.open(mGoogleApiClient, DriveFile.MODE_WRITE_ONLY, null) .setResultCallback(new ResultCallback&lt;DriveApi.DriveContentsResult&gt;() { @Override public void onResult(DriveApi.DriveContentsResult result) { if (!result.getStatus().isSuccess()) { Log.i(TAG, "Problem opening file, status is " + result.getStatus().toString()); return; } Log.i(TAG, "File opened"); writeFileContents(result.getDriveContents()); } }); private void writeFileContents(final DriveContents contents) { new AsyncTask&lt;Object, Object, Integer&gt;() { @Override protected Integer doInBackground(Object[] params) { try { ParcelFileDescriptor parcelFileDescriptor = contents.getParcelFileDescriptor(); // Overwrite the file. FileOutputStream fileOutputStream = new FileOutputStream(parcelFileDescriptor .getFileDescriptor()); Writer writer = new OutputStreamWriter(fileOutputStream); SyncUtils.writeXml("some xml", writer); writer.close(); fileOutputStream.close(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return; } @Override protected void onPostExecute(final Integer x) { contents.commit(mGoogleApiClient, null).setResultCallback(new ResultCallback&lt;com.google.android.gms.common.api.Status&gt;() { @Override public void onResult(com.google.android.gms.common.api.Status result) { if(result.getStatus().isSuccess()) Log.i(TAG, "Write succeeded"); else Log.i(TAG, "Write failed"); onConnectionCallbacks.onSynced(x); } …
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43605636
tagged with: android
has title: Android - Google Drive API file never syncs
has comment: http://stackoverflow.com/comment/43605142
tagged with: google-drive-api
tagged with: google-drive-android-api
has comment: http://stackoverflow.com/comment/43957393
has comment: http://stackoverflow.com/comment/43593913
type: Question
has answer: http://stackoverflow.com/a/31608131
tagged with: java

http://stackoverflow.com/a/27622141
type: Answer
has body: That's not how an enhanced for works. Use a standard for loop instead: for(int i = 0; i &lt; aList.length; i++){ aList[i] = new A(temp++); } The enhanced for uses an Iterator to loop through every element of the array. And since your array only contains null values, you're getting a NullPointerException.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27622097
downvote count: 0

http://stackoverflow.com/q/27582621
favorite count: 0
tagged with: soap
upvote count: 4
has body: I have a multi player game and I want to keep history of connected players to understand when should game start . I used HttpSession But it can't solve my problem. also I created a static ArrayList of players in webservices but it couldn't solve my poblem . :( Any other idea ? @Resource private WebServiceContext wsContext; @WebMethod public PlayerModel connect(String PlayerName) { PlayerModel playerModel = null; Players players = new Players() ; ArrayList&lt;PlayerModel&gt; playerList = players.getPlayers(); if (playerList.isEmpty()) { System.out.println("from service :No payer yet"); boardModel = new BoardModel(6, 7); session.setAttribute("boardModel", boardModel); boardModel.setPlayer1(PlayerName); playerModel = new PlayerModel(1, PlayerName, boardModel); playerList.add(playerModel) ; } else if (playerList.size() == 1) { boardModel.setPlayer2(PlayerName); playerModel = new PlayerModel(2, PlayerName, boardModel); playerList.add(playerModel) ; } return playerModel; } another approach @Resource private WebServiceContext wsContext; BoardModel boardModel; HttpSession session; @WebMethod public PlayerModel connect(String PlayerName) { MessageContext mc = wsContext.getMessageContext(); session = ((HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST)).getSession(); if (session == null) { System.out.println("from service :No payer yet"); boardModel = new BoardModel(6, 7); session.setAttribute("boardModel", boardModel); boardModel.setPlayer1(PlayerName); playerModel = new PlayerModel(1, PlayerName, boardModel); session.setAttribute("1", playerModel); } else if (session.getAttribute("1" != null) { boardModel.setPlayer2(PlayerName); playerModel = new PlayerModel(2, PlayerName, boardModel); session.setAttribute("2", playerModel); } System.out.println("from service : player" + PlayerName); return playerModel; }
downvote count: 0
type: UnansweredQuestion
tagged with: web-services
type: Question
tagged with: jakarta-ee
has title: keep history of connected clients to a web-service jax-ws
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/27627850
answer count: 1
score: 4

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/27482089

http://stackoverflow.com/q/27485417
has comment: http://stackoverflow.com/comment/43403948
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has title: How Grails create methods at run time Ex obj.setName("Abhay)
type: Question
has answer: http://stackoverflow.com/a/27486525
has body: I want to know how Grails create Dynamic methods , there are alot of methods that are created by Grails Framework at run time , like setters and getters , dynamic finders etc . I know about Reflection in java , but never read anything like that , If there any thing you find then please provide me link
accepted answer: http://stackoverflow.com/a/27486525
tagged with: grails
score: 0
answer count: 1

http://stackoverflow.com/q/27522700
downvote count: 0
favorite count: 0
has body: Error: Main method not found in class volume, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application import java.util.*; class volume { private int x; public float volume(float l) { return (l * l * l); } public float volume(float r, float h) { return (3.14f * r * r * h); } public float volume(float l, float b, float h) { return (l * b * h); } } class main { public static void main(String[] args) { volume a = new volume(); System.out.println("volume of cube=" + a.volume(10)); System.out.println("volume of cylinder=" + a.volume(10, 10)); System.out.println("volume of cuboid=" + a.volume(10, 10, 10)); } }
answer count: 5
has answer: http://stackoverflow.com/a/27522720
has answer: http://stackoverflow.com/a/27522760
tagged with: compiler-errors
type: UnansweredQuestion
upvote count: 1
has title: java compiling error in command prompt
has answer: http://stackoverflow.com/a/27522768
has answer: http://stackoverflow.com/a/37391347
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/45157684
type: Question
has comment: http://stackoverflow.com/comment/43474510

http://stackoverflow.com/q/27636055
has title: Usage StringBuffer and String?
type: Question
has comment: http://stackoverflow.com/comment/43691251
has comment: http://stackoverflow.com/comment/43691292
has answer: http://stackoverflow.com/a/27636181
score: 0
has comment: http://stackoverflow.com/comment/43691236
answer count: 2
has comment: http://stackoverflow.com/comment/43693228
tagged with: string
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27636108
has body: As known String is immutable in Java. I have the following method's body which return String: Partner partner = context.getComponent(ComponentNames.PARTNER_COMPONENT_NAME); String lastAccesDate = partner.getLastAccessDate(); if(lastAccesDate == null) { return ""; } lastAccesDate = new SimpleDateFormat(DATE_PATTERN).format(); //1 return lastAccesDate; The thing is because of string immutability, a new String object will be created at //1, so actually I'll have two String Objects, the first one contains partner.getLastAccessDate();, the second one new SimpleDateFormat(DATE_PATTERN).format();. The overhead is not good, how can I avoid it?
tagged with: java

http://stackoverflow.com/q/27638056
type: Question
has comment: http://stackoverflow.com/comment/43694875
has body: when i try to uninstall my android app and reinstall it again to get the new updated database, the database sometimes does not get updated, i don't know why. Database gets updated after trying a random number of attempts of install/uninstall, Can someone help me with this problem. What I tried is: when uninstalling, first I force stop the application, then I cleared the data and then uninstalled. here is the code that is executed in the MainActivity when the app starts. try { File dbFile = getDatabasePath("MyDatabase.db"); if (!dbFile.exists()) { Log.d(TAG, "Datbase does not exist"); this.copy("MY.db",dbFile.getAbsolutePath()); } } catch (Exception e) { Log.e(TAG, "Error in Copying: "+e.toString()); try { AppLogging(TAG, "Error in copying Database:" + e.toString()); } catch(Exception l) { } } Copy method private void copy(String file, String folder) throws IOException { try { File CheckDirectory; CheckDirectory = new File(folder); String parentPath = CheckDirectory.getParent(); File filedir = new File(parentPath); if (!filedir.exists()) { if (!filedir.mkdirs()) { return; } } InputStream in = this.getApplicationContext().getAssets().open(file); File newfile = new File(folder); OutputStream out = new FileOutputStream(newfile); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) &gt; 0) { out.write(buf, 0, len); } in.close(); out.close(); } catch (Exception e) { Log.e(TAG, "Error in Copy: "+e.toString()); try { AppLogging(TAG, "ERROR In Copy Method (Database) " + e.toString()); } catch(Exception l) { } } }
has comment: http://stackoverflow.com/comment/43694975
tagged with: sqlite
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: uninstallation
tagged with: android
has comment: http://stackoverflow.com/comment/44470538
tagged with: installation
answer count: 0
score: 1
tagged with: java
has title: Android Database Not Always Getting Deleted On Uninstall/Install
upvote count: 1

braintree
tags question: http://stackoverflow.com/q/27598220
type: Tag
tag name: braintree

http://stackoverflow.com/comment/43402387
comment on: http://stackoverflow.com/q/27484118
score: 0
type: Comment
type: QuestionComment
has text: @MadProgrammer got it with the help of your examples. it was the case of me understanding that the panel that i want to lock is being added trough JXlayer to the frame...little confusing at first but great !!!

http://stackoverflow.com/a/27624894
score: 1
type: Answer
has body: Apart from the notation, all the above will act the same code-wise and compilation-wise :-)
upvote count: 1
answers question: http://stackoverflow.com/q/27624848
downvote count: 0

http://stackoverflow.com/a/27498430
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27498404
type: Answer
answers question: http://stackoverflow.com/q/27498404
has body: Yes, it is possible, as long as the scopes of the two variables do not overlap. This will compile and run: public static void main (String[] args) { {int a = 5;} {String a = "5";} } However, the desirability of doing something like the above is highly questionable: the compiler does not care, but the human readers of your program will have harder time understanding what your code means. Readability is a major concern in production software development, so generally people do not write this kind of code.
score: 4

http://stackoverflow.com/a/27528896
type: Answer
answers question: http://stackoverflow.com/q/27528676
has body: This can be done in-place on a single file only if you are sure that the string you are replacing is exactly the same length in bytes as the string that replaces it. Otherwise, you can't add or delete characters in a single file, but you can create a new file. Open the source file for reading. Open the destination file for writing. Read each line in the source file, use replaceAll, and write it to the destination file. Close both files. Alternate method that preserves the key-value semantics: Open the source file for reading. Open the destination file for writing. Split each line in the source file into a key and value pair. If the key equals "content_style", write the key and "dirty" to the destination file. Otherwise write the key and value. Close both files. Finally, delete the old file and rename the new file on top of the old one. If you're going to be doing key-value manipulations often, and you don't want to write out a new file all the time, it might be worth it to use a database. Look for a JDBC driver for SQLite.
accepted answer of: http://stackoverflow.com/q/27528676
score: 0
has comment: http://stackoverflow.com/comment/43486592
type: AcceptedAnswer

http://stackoverflow.com/a/27509891
has comment: http://stackoverflow.com/comment/43482752
score: 1
has comment: http://stackoverflow.com/comment/43488791
has body: These apps rely on Apple´s old JVM and support, which is gone on Yosemite. Sun´s JDK and JRE do not include the same "bridge" code to run these apps so OSX you still ask you to install the old Apple provided JRE so they can be run. Until these apps are made not to rely on Apple´s JRE there is nothing else you can do other than installing the legacy Java support.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27507016
type: Answer
has comment: http://stackoverflow.com/comment/43488703

http://stackoverflow.com/q/27570893
possible better answer: http://stackoverflow.com/a/27570979
has answer: http://stackoverflow.com/a/27570979
has body: I want to develop an android application. When installing the application, I do not want that the application logo added in the "Applications" menu neither in the "Home". I want that my application run as a daemon and configurable from the "settings" and could stop/start it from the "settings" too Is it possible to do that with Android?
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Android system application
type: Question
has answer: http://stackoverflow.com/a/27570947
answer count: 2
linked to: http://stackoverflow.com/q/10428510
accepted answer: http://stackoverflow.com/a/27570947
favorite count: 0
score: 0
tagged with: android

http://stackoverflow.com/q/27501715
has answer: http://stackoverflow.com/a/27521651
answer count: 1
type: UnansweredQuestion
tagged with: wicket
has comment: http://stackoverflow.com/comment/43442501
has title: Wicket: AutoCompleteTextField with "favourites"
linked to: http://stackoverflow.com/q/15480544
score: 0
has body: I need to build an AutoCompleteTextField-like component where the user can mark some options as favourites (when he starts to write, some options show up and each option has a checkbox to mark it as favourite). The user can then check a checkbox outside the AutoCompleteTextField to choose whether only the favourites will be shown or on the contrary all the values no matter if they are favourites or not, will be all shown. I have read Using panels instead of String in Autocompletetextfield and i think it could be done using IAutoCompleteRenderer... Any ideas?
type: Question
tagged with: java

http://stackoverflow.com/a/27602793
answers question: http://stackoverflow.com/q/27602622
has comment: http://stackoverflow.com/comment/43630440
has body: You can use java.text.Normalizer For example : String plain = "č,ľ,ť,ž,ý,á"; plain = Normalizer.normalize(plain, Normalizer.Form.NFD); String clean = plain.replaceAll("[^\\x00-\\x7F]", ""); System.out.println(clean); // Will output c,l,t,z,y,a The first steps replace the character: U+010D LATIN SMALL LETTER C WITH CARON By its "decomposed form": U+0063 LATIN SMALL LETTER C U+030C COMBINING CARON The second step delete all non ascii characters.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43627942
upvote count: 2
has comment: http://stackoverflow.com/comment/43628826

algorithm
tags question: http://stackoverflow.com/q/27584117
tags question: http://stackoverflow.com/q/27510891
tags question: http://stackoverflow.com/q/27613041
tag name: algorithm
tags question: http://stackoverflow.com/q/27475712
tags question: http://stackoverflow.com/q/27579578
tags question: http://stackoverflow.com/q/27506730
tags question: http://stackoverflow.com/q/27518999
tags question: http://stackoverflow.com/q/27634428
tags question: http://stackoverflow.com/q/27583587
tags question: http://stackoverflow.com/q/27481850
tags question: http://stackoverflow.com/q/27586437
tags question: http://stackoverflow.com/q/27630528
tags question: http://stackoverflow.com/q/27587289
tags question: http://stackoverflow.com/q/27496475
tags question: http://stackoverflow.com/q/27562828
tags question: http://stackoverflow.com/q/27583122
tags question: http://stackoverflow.com/q/27591365
tags question: http://stackoverflow.com/q/27610776
tags question: http://stackoverflow.com/q/27635757
type: Tag
tags question: http://stackoverflow.com/q/27587394
tags question: http://stackoverflow.com/q/27585357
tags question: http://stackoverflow.com/q/27551793
tags question: http://stackoverflow.com/q/27595894
tags question: http://stackoverflow.com/q/27624983
tags question: http://stackoverflow.com/q/27527090
tags question: http://stackoverflow.com/q/27600800
tags question: http://stackoverflow.com/q/27583016
tags question: http://stackoverflow.com/q/27604983
tags question: http://stackoverflow.com/q/27601708
tags question: http://stackoverflow.com/q/27573828
tags question: http://stackoverflow.com/q/27480411
tags question: http://stackoverflow.com/q/27613910
tags question: http://stackoverflow.com/q/27611026
tags question: http://stackoverflow.com/q/27593126
tags question: http://stackoverflow.com/q/27573027

http://stackoverflow.com/q/27594042
has comment: http://stackoverflow.com/comment/43611656
tagged with: android
has body: So i have 3 Activites (LauncherActivity>MenuActivity>SelectionActivity). Basically you should always be able to return to the previous activity (exept the LauncherActivity). Everything works fine but when i want to return with the back button from the SelectionActivity to the MenuActivity the View shows just a black screen. But the ontouchlistener still works. The MenuActivity uses a surfaceview, with a thread. Part from the MenuView: public void surfaceCreated(SurfaceHolder holder) { if (menuThread.getState() == Thread.State.NEW) { menuThread.setRunning(true); menuThread.start(); } } Thanks for every kind of response.
answer count: 0
has comment: http://stackoverflow.com/comment/43614877
type: UnansweredQuestion
tagged with: multithreading
has title: View isn't working after pressing the back button
has comment: http://stackoverflow.com/comment/43611628
tagged with: java
has comment: http://stackoverflow.com/comment/43611753
tagged with: eclipse
type: Question
tagged with: surfaceview
score: 0

http://stackoverflow.com/comment/43435106
has text: Note: Sigs. and salutations in questions and answers are noise.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27502456

http://stackoverflow.com/comment/43642587
has text: sure. how that would apply to my case? I mean, I need to "distinct" my array values
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27606986
score: 0

http://stackoverflow.com/a/27559039
type: Answer
has comment: http://stackoverflow.com/comment/43649427
has comment: http://stackoverflow.com/comment/43649379
has comment: http://stackoverflow.com/comment/43644951
score: 2
accepted answer of: http://stackoverflow.com/q/27541201
upvote count: 2
answers question: http://stackoverflow.com/q/27541201
has body: The call to audioTrack.play() does not block. It will begin playback and the run() method of the Thread will return, likely before playback is over. The actual playback of audio is happening in yet another thread internally created, not the one it was called from. You have AudioTrack.setPlaybackPositionUpdateListener() available to receive a callback when playback reaches a point set with AudioTrack.setNotificationMarkerPosition() which will solve your problem.
has comment: http://stackoverflow.com/comment/43626557
has comment: http://stackoverflow.com/comment/43627706
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43607250
type: QuestionComment
type: Comment
has text: "it is very hard to determine when I could delete temporary files" -- put them in `getCacheDir()`. Either delete 24-hour-old ones when your app runs or on some sort of periodic basis.
score: 0
comment on: http://stackoverflow.com/q/27591756

http://stackoverflow.com/q/27596835
tagged with: swt
type: Question
has body: Am newer for SWT.. I have to write a method for displaying progress bar. if i cal the method. i should pass time and bounds as a parameter for the method. package ProgressViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; public class PBMethod { private static Shell shell; public static void Pv7( Shell shell2,final int num,final int xA,final int xB,final int xH,final int xW) { shell=shell2; final ProgressBar bar = new ProgressBar(shell, SWT.NONE); bar.setSize(1500, 1000); shell.setLayout(new GridLayout()); shell.setSize(1500, 1000); final Thread thread = new Thread() { public void run() { for(int i=0; i&lt;=num; i++) { final int value = i; try { Thread.sleep(50); } catch (Exception e){} shell.getDisplay().asyncExec(new Runnable() { public void run() { bar.setBounds(xA,xB,xH,xW); bar.setSelection(value); } }); } shell.getDisplay().syncExec(new Runnable() { public void run() { bar.dispose(); MessageBox dialog1 = new MessageBox(shell, SWT.NONE| SWT.OK| SWT.CANCEL); dialog1.setText("Information"); dialog1.setMessage("Saved Successfully"); dialog1.open(); } }); } }; thread.start(); } } Here this above method is passing bounds and percentage of .. but not the time.. Progress bar should display for 10seconds.. or 15 seconds.. that i should give in parameter only.. But in the code sent the second parameter is used for the percentage of completion of the progress bar. A parameter should be passed for the time the progress viewer is to be displayed, e.g. 10 for 10 seconds. If we want to change it to 15, there should be a change in the parameter value only.. Help would appreciate!!!
has answer: http://stackoverflow.com/a/27598529
accepted answer: http://stackoverflow.com/a/27598529
has title: How to display the progress bar for 15 seconds in swt
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/27583407
type: Answer
upvote count: 14
answers question: http://stackoverflow.com/q/27582233
score: 14
has body: Because the Java Language Specification says so. Section 5.6.1 defines unary numeric promotion for evaulation of certain operators, and it says: If the operand is of compile-time type byte, short, or char, it is promoted to a value of type int by a widening primitive conversion (§5.1.2). Section 5.6.2 on evaluation of binary numeric operators ('binary' meaning operators that have two operands, like '+') says something similar: If either operand is of type double, the other is converted to double. Otherwise, if either operand is of type float, the other is converted to float. Otherwise, if either operand is of type long, the other is converted to long. Otherwise, both operands are converted to type int. Why was it defined this way? A major reason is that at the time of design of the Java language and Java virtual machine, 32-bit was the standard word size of computers, where there is no performance advantage to doing basic arithmetic with smaller types. The Java virtual machine was designed to take advantage of this, by using 32-bit as the int size, and then providing dedicated instructions in the Java bytecode for arithmetic with ints, longs, floats, and doubles, but not with any of the smaller numeric types (byte, short, and char). Eliminating the smaller types makes the bytecode simpler, and lets the complete instruction set, with room for future expansion, still fit the opcode in a single byte. Similarly, the JVM was designed with a bias towards easy implementation on 32-bit systems, in the layout of data in classes and in the stack, where 64-bit types (doubles and longs) take two slots and all other types (32-bit or smaller) take one slot. So, the smaller types were generally treated as second-class citizens in the design of Java, converted to ints at various steps, because that simplified some things. The smaller types are still important because they take less memory when packed together (e.g., in arrays), but they do not help when evaluating expressions.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27582233

http://stackoverflow.com/q/27474897
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43384246
tagged with: serialization
has body: I'm building a Restful Web Application with Spring and Hibernate. For serialization I'm using the Jackson library (version 2.x). The problem I'm facing is the following: I have a users, items and ratings, they look something like the following: public class Item { ... @OneToMany(targetEntity = Rating.class, mappedBy = "rating", orphanRemoval = true) @Cascade(CascadeType.SAVE_UPDATE) private Set&lt;Rating&gt; rating = new HashSet&lt;&gt;(); ... } public class Rating { ... @ManyToOne(targetEntity = User.class, optional = false) @JoinColumn(name="user_id") @JsonIdentityReference(alwaysAsId = true) private User user; @ManyToOne(targetEntity = Item.class, optional = false) @JoinColumn(name="item_id") @JsonIdentityReference(alwaysAsId = true) private Item item; ... } public class User { ... @OneToMany(targetEntity = Rating.class, mappedBy = "user", fetch = FetchType.LAZY, orphanRemoval = true) @JsonIdentityReference(alwaysAsId = true) @Cascade(CascadeType.SAVE_UPDATE) private List&lt;Rating&gt; ratings = new ArrayList&lt;Rating&gt;(); ... } Now if i try to save a new rating for an item by a specific user is use a method that does something like this: if(formerVoting != null) { //Previously fetched from the DB item.removeUserRating(formerVoting); } Rating newRating = new Rating(); //Create new Rating newRating.setRating(rating); newRating.setItem(item); newRating.setUser(user); user.addRating(newRating); stop.addRating(newRating); userDao.update(user); stopDao.update(stop); return stop; This bit does also work, but when Jackson tries to serialize the ResponseEntity I return from my controller it just freezes. I verified that the mehtod returns and tweaked the cascades but nothing helps. Does anyone know what I do wrong? BR, wastl EDIT: I finally figured out what the problem was: I used a custom serializer for a field of item and it threw an exception. Apperently Jackson did not propergate this exception properly and the server just did not return anything.
score: 0
has comment: http://stackoverflow.com/comment/43384389
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27475043
has title: Jackson MessageSerializer freezes but application does not crash

http://stackoverflow.com/a/27549637
type: Answer
has comment: http://stackoverflow.com/comment/43528776
downvote count: 2
upvote count: 1
answers question: http://stackoverflow.com/q/27549183
has comment: http://stackoverflow.com/comment/43527339
score: -1
has comment: http://stackoverflow.com/comment/43525986
has comment: http://stackoverflow.com/comment/43529248
has comment: http://stackoverflow.com/comment/43527813
has body: If there are a large number of processes or you use the same sequence often you could implement the processing as a sequence using an enum. public enum Engine { A { @Override void doIt(Object to) { // Do what you need to do. } }, B { @Override void doIt(Object to) { // Do what you need to do. } }, C { @Override void doIt(Object to) { // Do what you need to do. } }; abstract void doIt(Object to); public void go(Object to) { for (Engine e : Engine.values()) { e.doIt(to); } } } This can be enhanced in many ways (which is why I like it). You can encode alternative orders of execution in an Iterable. You can add, remove and reorder the processes in just one place. The names of the enum can be greatly simplified. And many more.

http://stackoverflow.com/a/27566395
upvote count: 2
type: Answer
downvote count: 1
has body: there is no replacement for new, even Class.forName("XYZ").newInstance() HAS to work exactly like new, the only difference being that you're hardcoding the full class (or even package...class) hence actually achieve the opposite of what you're trying to do, with new the instance may be dynamically resolved and/or even injected. If you inject an instance of interface A you may very well get a bean of class B which implements A - thats in fact more dynamic and complements factory patterns very well. Thats hardly possible if your classname is hardcoded, at least in my humble opinion.
answers question: http://stackoverflow.com/q/27565611
score: 1
has comment: http://stackoverflow.com/comment/43558946

http://stackoverflow.com/a/27527172
has body: Suppose you have a requirement to load configuration from xml file. John 18 And you want to load it into Configuration object: public class Test { private String name; private int age; public void setName(String name,int age) { this.name = name; this.age = age; } public void display() { System.out.println("Name: "+name); System.out.println("Age: "+age); } } you have to do is: FileReader fileReader = new FileReader("test.xml"); // load your xml file XStream xstream = new XStream(); // init XStream // define root alias so XStream knows which element and which class are equivalent xstream.alias("test", Test.class); Test test = (Test) xstream.fromXML(fileReader);` that’s all !
score: 3
has comment: http://stackoverflow.com/comment/43486407
accepted answer of: http://stackoverflow.com/q/27526417
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27526417
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43506218

spring-data
tags question: http://stackoverflow.com/q/27640140
tags question: http://stackoverflow.com/q/27567351
tags question: http://stackoverflow.com/q/27636084
tags question: http://stackoverflow.com/q/27543771
tags question: http://stackoverflow.com/q/27491799
tags question: http://stackoverflow.com/q/27567634
tags question: http://stackoverflow.com/q/27502137
type: Tag
tags question: http://stackoverflow.com/q/27626825
tags question: http://stackoverflow.com/q/27582568
tag name: spring-data
tags question: http://stackoverflow.com/q/27633793
tags question: http://stackoverflow.com/q/27545276

http://stackoverflow.com/comment/43496690
has text: Not sure if this helps you: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/Activity.java#L1160 Have you ever got the chance to debug such a crash? Or does it only happen in non-debug mode? :)
comment on: http://stackoverflow.com/q/27534003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27540688
tagged with: java
type: UnansweredQuestion
has title: Override toString method in Java
answer count: 4
downvote count: 0
has body: public class Curiosity { public void toString()//error because of this specific method name { System.out.println("method is successfully implemented"); } } How can i use a method of the same name "toString()" if i want to ? Do I have to give its return type as String if not what should i do to change its return type like suppose if i want to use a void return type for toString does java allow that ?
score: 1
tagged with: object-to-string
favorite count: 0
has answer: http://stackoverflow.com/a/27540723
type: Question
has comment: http://stackoverflow.com/comment/43508902
has answer: http://stackoverflow.com/a/27540910
has answer: http://stackoverflow.com/a/27540843
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/27540707
upvote count: 1
tagged with: tostring
has comment: http://stackoverflow.com/comment/43508937

http://stackoverflow.com/comment/43659233
comment on: http://stackoverflow.com/a/27608320
score: 0
type: Comment
has text: try this and tell me what happenes `newparams.setMargins((int) x-30, (int) y-30, 0, 0);`
type: AnswerComment

http://stackoverflow.com/a/27606554
downvote count: 0
answers question: http://stackoverflow.com/q/27605329
type: Answer
score: 1
has body: If you simply wish to share a collection between the parent thread and the child threads you can declare a variable and pass it to the child thread. So, how do you pass it to the child thread? Well, you either create a Runnable or some other executable piece that holds your object like in the example below (the Runnable can be executed in another thread). public class MyRunnable implements Runnable { private final Queue&lt;String&gt; sharedQueue; public MyRunnable(Queue&lt;String&gt; sharedQueue) { this.sharedQueue = sharedQueue; } public void run() { // do stuff with sharedQueue here } } And to start a thread: final Queue&lt;String&gt; q = new ConcurrentLinkedQueue&lt;&gt;(); new Thread(new MyRunnable(q)).start(); The other alternative is to use anonymous inner classes (or lambdas) like in the example below that simply starts a bunch of futures and shares the data to the Queue (which likely is a good candidate for sharing data): // Shared data final Queue&lt;String&gt; q = new ConcurrentLinkedQueue&lt;&gt;(); // Declare some threads (you can skip this part and instead use the ForkJoinPool) // which is the default thread pool for CompletableFuture ExecutorService executorService = Executors.newFixedThreadPool(3); // Create tasks, complete all of them CompletableFuture&lt;Void&gt; future = CompletableFuture.allOf( CompletableFuture.runAsync(() -&gt; q.offer(Thread.currentThread().getName()), executorService), CompletableFuture.runAsync(() -&gt; q.offer(Thread.currentThread().getName()), executorService), CompletableFuture.runAsync(() -&gt; q.offer(Thread.currentThread().getName()), executorService), CompletableFuture.runAsync(() -&gt; q.offer(Thread.currentThread().getName()), executorService), CompletableFuture.runAsync(() -&gt; q.offer(Thread.currentThread().getName()), executorService) ); // Wait for the threads to complete future.get(); // Print the result q.forEach(System.out::println);
upvote count: 1

http://stackoverflow.com/comment/43685653
type: Comment
has text: this answer is helpful to me.
comment on: http://stackoverflow.com/a/27624571
score: 0
type: AnswerComment

http://stackoverflow.com/q/27577984
has comment: http://stackoverflow.com/comment/43580925
tagged with: java
has title: Splitting string based on delimiter
type: Question
has body: A string is taken as input which is in the form of 23,4,555,67 via deadline nd another input is key yo search the element linearly ?my question is how can we recognize the elements from string separated by comma
has answer: http://stackoverflow.com/a/27578004
has comment: http://stackoverflow.com/comment/43580861
has answer: http://stackoverflow.com/a/27577998
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27578077
type: UnansweredQuestion

http://stackoverflow.com/a/27586462
answers question: http://stackoverflow.com/q/27586447
has body: This looks dangerous to me: the use of a side affect of a public method of Object to set an object's state. This will break if you subclass this class, and then override the subclass's equals method, a common thing to do. Just don't do this.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43597514
score: 3
has comment: http://stackoverflow.com/comment/43597399
has comment: http://stackoverflow.com/comment/43597496
downvote count: 1

http://stackoverflow.com/q/27600476
has comment: http://stackoverflow.com/comment/43623818
score: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/43623795
favorite count: 0
has answer: http://stackoverflow.com/a/27600582
upvote count: 1
linked to: http://stackoverflow.com/q/27602066
has title: Pattern not providing expected output
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43623834
accepted answer: http://stackoverflow.com/a/27600582
duplicate of: http://stackoverflow.com/q/27602066
tagged with: java
has body: I have the following code: Pattern pattern = Pattern.compile("\\d*\\s*[-\\+\\*/\\$£]"); String input = "3 3 * 4 + 2 /"; Matcher matcher = pattern.matcher(input); List&lt;String&gt; output = new ArrayList&lt;&gt;(); while (matcher.find()) { output.add(matcher.group()); } for(String s : output){ System.out.println(s); } I would very much like the output in my list to be the following: 3 3 * 4 + 2 / Alas my actual output is: 3 * 4 + 2 / I am sure there is a regex wizard out there who can show me the issue :)
has comment: http://stackoverflow.com/comment/43624889
has comment: http://stackoverflow.com/comment/43623759
type: Question
answer count: 1
downvote count: 0

linux
tags question: http://stackoverflow.com/q/27532995
tags question: http://stackoverflow.com/q/27500075
tags question: http://stackoverflow.com/q/27573347
tags question: http://stackoverflow.com/q/27616076
tags question: http://stackoverflow.com/q/27534162
tags question: http://stackoverflow.com/q/27507940
tags question: http://stackoverflow.com/q/27488114
tags question: http://stackoverflow.com/q/27633014
tags question: http://stackoverflow.com/q/27489314
tags question: http://stackoverflow.com/q/27505372
tags question: http://stackoverflow.com/q/27565417
tags question: http://stackoverflow.com/q/27558600
tags question: http://stackoverflow.com/q/27548406
type: Tag
tags question: http://stackoverflow.com/q/27571620
tags question: http://stackoverflow.com/q/27527028
tags question: http://stackoverflow.com/q/27601536
tags question: http://stackoverflow.com/q/27634125
tag name: linux
tags question: http://stackoverflow.com/q/27552694
tags question: http://stackoverflow.com/q/27503222
tags question: http://stackoverflow.com/q/27499983
tags question: http://stackoverflow.com/q/27624597
tags question: http://stackoverflow.com/q/27614344
tags question: http://stackoverflow.com/q/27637327
tags question: http://stackoverflow.com/q/27589379
tags question: http://stackoverflow.com/q/27494592
tags question: http://stackoverflow.com/q/27549259
tags question: http://stackoverflow.com/q/27481953
tags question: http://stackoverflow.com/q/27482804
tags question: http://stackoverflow.com/q/27633335

http://stackoverflow.com/a/27607204
has comment: http://stackoverflow.com/comment/43636748
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43636726
has body: Here: for (int i = 1; i &lt;= days; i++) { You initialize the array like this: int[] mosquitos = new int[days]; So you can access to elements between 0 and days - 1. You're accessing to element mosquitos[days] inside the for loop, which is the cause of the problem, specifically here: mosquitos[i] = mosquitos[i-1] * children; //^ here ^ bites += mosquitos[i]; // ^ here ^ Change it to for (int i = 1; i &lt; days; i++) { Or even better, to this: for (int i = 1; i &lt; mosquitos.length; i++) {
answers question: http://stackoverflow.com/q/27607188
downvote count: 0

http://stackoverflow.com/a/27636059
has body: There is nothing wrong with your code. Did you try to overwrite the file or did you write out to a new file? foo.xml "" "select id, name from employee" XmlUnquoteExample.java import java.io.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.*; import org.xml.sax.SAXException; public class XmlUnquoteExample { public static void main(String[] args) { Document doc; try { doc = readXmlFile("resources/foo.xml"); System.out.println(" "); printDocument(doc, System.out); removeQuotes(doc); System.out.println(" "); printDocument(doc, System.out); } catch (Exception e) { e.printStackTrace(); } } public static Document readXmlFile(String filename) throws ParserConfigurationException, SAXException, IOException { InputStream is; DocumentBuilderFactory factory; DocumentBuilder builder; is = ClassLoader.getSystemResourceAsStream(filename); factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); return builder.parse(new ByteArrayInputStream(toByteArray(is, 16384))); } public static byte[] toByteArray(InputStream is, int bufferSize) throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int nRead; byte[] data = new byte[bufferSize]; while ((nRead = is.read(data, 0, data.length)) != -1) { buffer.write(data, 0, nRead); } buffer.flush(); return buffer.toByteArray(); } public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException { TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.setOutputProperty( "{http://xml.apache.org/xslt}ind…
score: 0
answers question: http://stackoverflow.com/q/27634705
type: Answer

http://stackoverflow.com/comment/43641924
has text: @PascalCuoq At least I claim that I already checked all of them. The most relevant one is http://stackoverflow.com/questions/21463018/elliptic-curve-addition-in-jacobian-coordinates?rq=1
type: QuestionComment
comment on: http://stackoverflow.com/q/27609720
score: 0
type: Comment

http://stackoverflow.com/comment/43644070
type: QuestionComment
comment on: http://stackoverflow.com/q/27593719
has text: @MadProgrammer ok, so i will use the OS library, but even then i see only simple code of creating window from your width, height and title. how can i "draw" my own window, without using one that already made for me?
score: 0
type: Comment

http://stackoverflow.com/a/59052762
has body: postgres cannot access the server configuration file "C:/Windows/system32/pgsql/data/postgresql.conf": No such file or directory This looks like your working directory is C:\Windows\system32 and you are running postgres there and it looks for data/postgresql.conf. Try changing the working directory or specifying -D C:\path\to\my\data.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27566859

http://stackoverflow.com/comment/43509016
type: QuestionComment
comment on: http://stackoverflow.com/q/27539425
score: 1
has text: Why wouldn't it work? You should only put the empty string into `tempBinding` if the tag you're starting is ` `. If you do that, then the actual logic is exactly what you have now.
type: Comment

http://stackoverflow.com/q/27577727
type: Question
has body: So i was reading the book and the author says " The static members aren't involved in runtime polymorphism. You can't override the static members in a derived class, but you can redefine them." What is that mean? Can you give me a example for this also? Thank you.
tagged with: static-methods
score: 0
has answer: http://stackoverflow.com/a/27577747
has answer: http://stackoverflow.com/a/27577754
tagged with: static
possible better answer: http://stackoverflow.com/a/27577754
answer count: 4
has answer: http://stackoverflow.com/a/27577732
has title: Redefine static members in a derived class. Java
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27577852
accepted answer: http://stackoverflow.com/a/27577732

http://stackoverflow.com/a/27570089
has comment: http://stackoverflow.com/comment/43566012
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27570001
answers question: http://stackoverflow.com/q/27570001
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43565901
has body: Check if you have a crazy_tip_calc.xml in res/menu folder. After this, try a project>clean
type: Answer

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/27489413
tags question: http://stackoverflow.com/q/27559518

http://stackoverflow.com/q/27630714
tagged with: android
type: UnansweredQuestion
score: 1
has body: I've been searching the internet and can't seem to find any examples showing how to create a file inside an existing folder on the internal storage. For example, i've got a folder called "unzipped" and a filed called "unzipme.txt". I want to unzip/write the file into this folder /data/data/au.com.BLA.MYAPP/files/unzipped/
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/5017292
type: Question
has answer: http://stackoverflow.com/a/27631438
has title: Create file inside folder on internal storage
answer count: 1
downvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/5017292

http://stackoverflow.com/a/27493838
score: 2
has comment: http://stackoverflow.com/comment/43907644
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27493785
has body: If the client/Server communication does not use SSL then, yes it is possible to sniff the sessionID. This should be the case with any framework that does not leverage any kind of client-server communication encryption. It is also possible for the client to get redirected to another web application. This is part of a XSS attack(Cross site scripting). There are two types of XSS. Stored and reflected. You can find more details here Cross Site scripting
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27493785
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43466667
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27518302
type: AnswerComment
has text: Thank you very much! I have changed it to frame. and my code works ! Also, I have learnt so much I am really appreciate!

http://stackoverflow.com/comment/44701276
has text: Do I need to Initialise Furry in my all activities? as I am using FlurryAgent.onStartSession(context, key); on my each Activity of my Application?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27571078

http://stackoverflow.com/q/27519439
has answer: http://stackoverflow.com/a/27519894
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43468570
score: -3
has comment: http://stackoverflow.com/comment/43468542
tagged with: swing
has title: How to add a JPanel button for boolean values?
tagged with: java
downvote count: 3
tagged with: jpanel
has comment: http://stackoverflow.com/comment/43469009
has body: I am new to swing, I have a method which returns values in true or false (boolean) format. I need to display a flag using JPanel which displays true or false values. How can I do this?
type: Question
upvote count: 0
answer count: 1
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/43469073

http://stackoverflow.com/comment/43532547
score: 1
has text: The `Guid` class might not exist but of course GUIDs exist. GUIDs are not a C#, or even .Net construct. http://stackoverflow.com/questions/2982748/create-a-guid-in-java
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27553114

http://stackoverflow.com/a/27628058
score: 0
has comment: http://stackoverflow.com/comment/43714623
type: Answer
has body: You need to understand what Realm.runWithDefault() does; it calls the run() method of your Runnable, synchronously, and when that run() returns, the calling code continues. The key is that you have the call to Realm.runWithDefault() in a main method, so when runWithDefault() returns it continues in your main() which ends and thus terminates your process. In your Runnable you're executing the typical SWT event loop (readAndDispatch()) which keeps the Runnable going while the Shell is not disposed, but as soon as you close the Shell the SWT loop exits, which ends your run() method (which in turn returns control back to main() as described above). I'm not sure why this would work differently on Linux because IIRC these rules are the same on any JVM. In any case, if you want your process to continue after the SWT shell has closed, you need to add some logic to do that; basically coordinate between the two threads you have.
answers question: http://stackoverflow.com/q/27624597
has comment: http://stackoverflow.com/comment/43732540

http://stackoverflow.com/comment/43535449
score: 0
has text: Is `FullHouse` a concrete instance of that class? If it's not a concrete instance (variable) and you are trying to call `setTab(...)` method directly on the class name, then you have the reason why you are getting that message.
comment on: http://stackoverflow.com/q/27554478
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43433530
type: AnswerComment
comment on: http://stackoverflow.com/a/27501485
type: Comment
has text: No wrapper as you see
score: 0

http://stackoverflow.com/comment/43481369
has text: The default hostname is the internal ip seperated by - instead of . Don't understand your problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27526363

http://stackoverflow.com/comment/43604836
type: Comment
has text: ok this works but im not too sure how would u mind explaining the "%02d:%02d" bit to me
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27590436

http://stackoverflow.com/q/27504114
score: 1
has comment: http://stackoverflow.com/comment/43440953
upvote count: 1
has answer: http://stackoverflow.com/a/27506115
answer count: 1
tagged with: java
tagged with: twitter
has comment: http://stackoverflow.com/comment/43438540
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has body: I have problem with my source code for twitter request. Response that is returned from twitter is blank String. Can you advice where can be problem? I have registered my app normally on dev.twitter.com. It is called Reach Count. This code is brought from this tutorial: http://www.coderslexicon.com/demo-of-twitter-application-only-oauth-authentication-using-java/ package count_reach_twitter; //import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import javax.net.ssl.HttpsURLConnection; import org.apache.commons.codec.binary.Base64; import org.json.JSONArray; import org.json.JSONObject; /** * * @author Martin */ public class TwitterCall { // Encodes the consumer key and secret to create the basic authorization key private static String encodeKeys(String consumerKey, String consumerSecret) { try { String encodedConsumerKey = URLEncoder.encode(consumerKey, "UTF-8"); String encodedConsumerSecret = URLEncoder.encode(consumerSecret, "UTF-8"); String fullKey = encodedConsumerKey + ":" + encodedConsumerSecret; byte[] encodedBytes = Base64.encodeBase64(fullKey.getBytes()); return new String(encodedBytes); } catch (UnsupportedEncodingException e) { return new String(); } } // Writes a request to a connection private static boolean writeRequest(HttpsURLConnection connection, String textBody) { try { BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream())); wr.write(textBody); wr.flush(); wr.close(); return true; } catch (IOException e) { return false; } } // Reads a response for a given connection and returns it as a string. private static String readResponse(HttpsURLConnection connection) { try { StringBuilder str = new StringBuilder(); Buffered…
has title: Twitter call request

http://stackoverflow.com/a/27577651
score: 1
has body: you can not implement psd file into android layout file. You have to take different images from psd from your designer and you can set them according to the design. for example if in psd background is some picture, you should use that picture file as background in your root element. you should ask your designer for separate images from psd file.... Hope this helps :)
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27577289
answers question: http://stackoverflow.com/q/27577289
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43429213
comment on: http://stackoverflow.com/q/27498213
type: Comment
type: QuestionComment
has text: Your code looks ok. Maybe your smtp server changes the values? If you know how to do it, try sending a mail manually using telnet, and check what happens.
score: 0

http://stackoverflow.com/a/27629574
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/27629536
has body: I assumed that since I named the new StringBuilder/StringBuffer object the same name, it would override the value of the previously initialized sNumber variable No, if you name the StringBuilder the same name as the field, it will hide the field. (The only way to access the field would then be through this.sNumber.) You can solve it without a temporary variable as follows: sNumber = new StringBuilder(num).reverse().toString(); (You say in your question that this does not work, but it should. Just make sure you don't declare sNumber as a local variable in the constructor. If it still doesn't work, you need to include the error message in your question.)
answers question: http://stackoverflow.com/q/27629536

pre-commit-hook
tag name: pre-commit-hook
type: Tag
tags question: http://stackoverflow.com/q/27615842

http://stackoverflow.com/a/34643482
type: Answer
upvote count: 11
score: 11
has body: Take a look at the ignore_unavailable option, which is part of the multi index syntax. This has been available since at least version 1.3 and allows you to ignore missing or closed indexes when performing searches (among other multi index operations). It is exposed in the Java API by IndicesOptions. Browsing through the source code, I found there is a setIndicesOptions() method on the SearchRequestBuilder used in the example. You need to pass it an instance of IndicesOptions. There are various static factory methods on the IndicesOptions class for building an instance with your specific desired options. You would probably benefit from using the more convenient lenientExpandOpen() factory method (or the deprecated version, lenient(), depending on your version) which sets ignore_unavailable=true,allow_no_indices=true, and expand_wildcards=open. Here is a modified version of the example query which should provide the behavior you are looking for: SearchRequestBuilder builder = elasticsearchClient.getClient().prepareSearch(indices) .setQuery(Query.buildQueryFrom(term1, term2)) .addAggregation(AggregationBuilders.terms('term') .field('field') .shardSize(shardSize) .size(size) .minDocCount(minCount)) .setIndicesOptions(IndicesOptions.lenientExpandOpen());
downvote count: 0
answers question: http://stackoverflow.com/q/27482465

http://stackoverflow.com/comment/43696647
type: Comment
has text: Like @Timothy-Wright, I too recommend you read Java Concurrency In Practice
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27638679

http://stackoverflow.com/q/27532169
has answer: http://stackoverflow.com/a/27532609
tagged with: serialization
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/43492893
tagged with: java
linked to: http://stackoverflow.com/q/11102645
type: Question
has comment: http://stackoverflow.com/comment/43493154
has body: I am developing an application in Java, where I have some classes, like Person and Company. All these classes have some instances e.g. public class Person{ private String firstName; private String lastName; private String mail; //more code.. } So in some point I create an Object type of Person, which I want to save it for future use. I am new to this, so I have this question. Should I use Object serialization or should I save it in XML format? I realize that an XML format has its advantages that's why I am asking (If I want to save it in XML format, I use XMLEncoderclass right?) Which one should I use?
has title: Save an object to XML format or with serialization?
answer count: 1

http://stackoverflow.com/comment/43595428
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27585433
score: 0
has text: What's the data type of `obraz`?

http://stackoverflow.com/q/27602193
downvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27602302
answer count: 4
has comment: http://stackoverflow.com/comment/43626896
has body: HashMap does not take primitive types for the key and value, but we can still store values of primitive types easily as follows: HashMap h = new HashMap(); h.put(1,1); How is it possible?
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/27602206
type: Question
has answer: http://stackoverflow.com/a/27602235
tagged with: hashmap
has title: HashMap can store only object key and value
has comment: http://stackoverflow.com/comment/43626824
linked to: http://stackoverflow.com/q/2770321
has answer: http://stackoverflow.com/a/27602226
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43626840

http://stackoverflow.com/comment/43578016
has text: Why do you need 2 loops?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27576300
type: Comment

http://stackoverflow.com/a/27483723
type: Answer
has body: You should be able to pass it in using putParcelableArrayList(). should work
score: 0
answers question: http://stackoverflow.com/q/27483321

http://stackoverflow.com/q/27609569
has answer: http://stackoverflow.com/a/34597164
linked to: http://stackoverflow.com/q/30653012
linked to: http://stackoverflow.com/q/10326460
has answer: http://stackoverflow.com/a/27614403
has answer: http://stackoverflow.com/a/42020869
has body: I want to create an employee information in the system by uploading an image along with employee data. I am able to do it with different rest calls using jersey. But I want to achieve in one rest call. I provide below the structure. Please help me how to do in this regard. @POST @Path("/upload2") @Consumes({MediaType.MULTIPART_FORM_DATA,MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response uploadFileWithData( @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition contentDispositionHeader, Employee emp) { //..... business login } Whenever I am trying to do, I get error in Chrome postman. The simple structure of my Employee json is given below. { "Name": "John", "Age": 23, "Email": "john@gmail.com", "Adrs": { "DoorNo": "12-A", "Street": "Street-11", "City": "Bangalore", "Country": "Karnataka" } } However I can do it by making two different call, but I want to achieve in one rest call so that I can receive the file as well as the actual data of the employee. Request you to help in this regard.
tagged with: java
upvote count: 76
has answer: http://stackoverflow.com/a/38473948
linked to: http://stackoverflow.com/q/45625925
has answer: http://stackoverflow.com/a/33198867
type: Question
tagged with: jersey
score: 76
tagged with: multipartform-data
downvote count: 0
tagged with: jax-rs
answer count: 6
tagged with: postman
has title: File upload along with other object in Jersey restful web service
has answer: http://stackoverflow.com/a/63857730
linked to: http://stackoverflow.com/q/43178754
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27590628
score: 1
answers question: http://stackoverflow.com/q/27590435
upvote count: 1
type: Answer
has body: You'll first have to check on the basis of Unit and then on the basis of Value in the overridden compareTo(). See here the implementation of sorting on the basis of lastname and then firstname:http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html
downvote count: 0

http://stackoverflow.com/comment/43484367
has text: Does the way I generate the jar matters ?? I have META_INF file in jar generated, which contains mentions the main class. So is that not expecting the class name in the jar command
comment on: http://stackoverflow.com/a/27511975
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43648543
comment on: http://stackoverflow.com/a/27612529
type: AnswerComment
score: 0
type: Comment
has text: While that behavior could be added, I don't think it would actually do anything. Whenever you "update" the `b` field of an `A` object, you're constructing a *new* `B` object, who will of course have an up to date `a` field.

http://stackoverflow.com/a/29830140
type: Answer
has body: I was having a similar issue and just got it working. My private key and cert were stored in a .pem file, so I first needed to put them in to a format that Windows would use. I did that with the following command: openssl pkcs12 -inkey mycertandkey.pem -in mycert.crt -export -out mycertandkey.pfx I did this in linux but it should work in Windows as well, if you have openssl installed. Run certmgr.msc in Windows. Right-click the 'Personal' folder and select 'All tasks' -> 'Import...' and choose the .pfx file. Enter the passphrase and import it in to the 'Personal' folder. Once that's done, you'll need to close your running Chrome windows. Then open Postman in a new window. When you attempt to connect to the URL, this time it should ask to confirm the use of the client cert. Once confirmed, you should be able to make calls to the URL from then on.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27501819
answers question: http://stackoverflow.com/q/27501819
has comment: http://stackoverflow.com/comment/61530365
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/47810281
score: 3

http://stackoverflow.com/comment/43664276
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27620195
has text: Can you post your javascript file
type: Comment

http://stackoverflow.com/a/27515897
type: Answer
has body: You shouldn't try and maintain the state of the object with the UI, per se. Rather the UI should visualise the state of the underlying logic of the game (or model). This allows you to modify the model, change the rules, add/remove elements (think adding new monsters or loot for example), without need to physically modify the UI or how it visualise this state (to a large degree). The idea is, the Player attributes should be maintain with an class of it's own, which is managed by the model. The UI would then be used to visualise the state the model. When clicked the Tile would notify the "controller". The controller would request stateful information from the games "model" and based on this information the "controller" would change the state of the button(s) to meet the requirements of the "model" This would simply require the "controller" to update the button(s) information (text/icons) without needing to change the physical buttons. This separates the responsibilities into defined layers and reduces the coupling of the code, so one or more layers can change, but the overall structure doesn't break down or need to be heavily modified to handle these changes. The model is responsible for maintaining the virtual state of the game, for managing the interactions between the individual game objects (combat etc). The UI is responsible for providing a visualisation of the model for the user and the controller is used to manage the interaction between the take, taking user input and pass it to the model, monitoring changes to the model's state and telling the UI when it needs to update. The Model–view–controller paradigm is a common approach used in GUI development across different lanuguages. Take a look at Model–view–controller for more details.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43462945
has comment: http://stackoverflow.com/comment/43462091
has comment: http://stackoverflow.com/comment/43462285
has comment: http://stackoverflow.com/comment/43462958
has comment: http://stackoverflow.com/comment/43462684
has comment: http://stackoverflow.com/comment/43462554
has comment: http://stackoverflow.com/comment/43462943
upvote count: 2
has comment: http://stackoverflow.com/comment/43462667
has comment: http://stackoverflow.com/comment/43462629
has comment: http://stackoverflow.com/comment/43462874
has comment: http://stackoverflow.com/comment/43462444
has comment: http://stackoverflow.com/comment/43462755
answers question: http://stackoverflow.com/q/27515747

http://stackoverflow.com/comment/43551266
comment on: http://stackoverflow.com/q/27562766
type: QuestionComment
has text: What happens if you access your URL through `curl`or a web browser? Do you get the xml file?
score: 0
type: Comment

http://stackoverflow.com/comment/43597062
has text: Currently code is using acceptOnceAuditTrailSelector to filter processed file in DB. Because would like to process same filename if there is any error. Can show how to implement this FileSystemPersistentAcceptOnceFileListFilter?
comment on: http://stackoverflow.com/a/27582381
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27476823
tagged with: java
linked to: http://stackoverflow.com/q/6845231
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/27478529
favorite count: 0
has answer: http://stackoverflow.com/a/27478529
has body: I created a folder called "res" in which I put all the sound files and picture files that my application uses. I added the folder to my project as a library so using "/filename.whatever" as the filepath works when I run the project in netbeans. However, when I try to clean and build it says: Not copying library path\res , it's a directory. How do I get netbeans to put the folder in the jar so that it still works with the same filepath?
has title: Adding folders to jars
type: AnsweredQuestion
tagged with: netbeans
downvote count: 0
type: Question
score: 1

http://stackoverflow.com/comment/43683283
type: AnswerComment
comment on: http://stackoverflow.com/a/27631395
type: Comment
score: 2
has text: Actually in Java the normal way is to create a `LinkedList` without nodes. The class `LinkedList` will take care of the nodes for itself internally.

http://stackoverflow.com/q/27616438
has comment: http://stackoverflow.com/comment/43654307
has comment: http://stackoverflow.com/comment/43658141
has comment: http://stackoverflow.com/comment/43654649
has comment: http://stackoverflow.com/comment/43658283
has comment: http://stackoverflow.com/comment/43654897
tagged with: sqlite
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43657834
has comment: http://stackoverflow.com/comment/43654922
has body: i'm a new bie in android and java i want to save a table from sql server(external database) to sqlite(internal database). 1. my json is not getting stored and every record is same like this "com.example.db_client.DeptTable@b3e4e9e0" when i opens the db file in sqlite browser. I don't understand what is this. when i run my app i sometimes get this exception and sometimes i don't. FATAL EXCEPTION: main Process: com.example.db_client, PID: 1697 java.lang.IllegalArgumentException: Activity DeptActivity does not have a parent activity name specified. (Did you forget to add the android.support.PARENT_ACTIVITY element in your manifest?) I really need help please look into my problem. thanks in advance. code of database helper class public class SqliteDB { public static final String KEY_ID = "no"; public static final String KEY_NAME = "name"; private static final String TAG = "DBAdapter"; private static final String DATABASE_NAME = "SQLiteDB"; private static final String TABLE_NAME = "Department"; private static final int DATABASE_VERSION = 2; private static final String CREATE_TABLE = "create table departmentList (id INTEGER PRIMARY KEY, name TEXT);"; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public SqliteDB(Context ctx) { this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { try { db.execSQL(CREATE_TABLE); } catch (SQLException e) { e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS sample"); onCreate(db); } } //---open SQLite DB--- public SqliteDB open() throws SQLException { db = DBHelper.getWritableDat…
tagged with: android
has comment: http://stackoverflow.com/comment/43654730
has comment: http://stackoverflow.com/comment/43654303
has answer: http://stackoverflow.com/a/27616877
has title: android: saving json to sqlite
has comment: http://stackoverflow.com/comment/43655113
score: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27616877
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43658011
has comment: http://stackoverflow.com/comment/43658206
type: Question
upvote count: 4

http://stackoverflow.com/q/27601232
has comment: http://stackoverflow.com/comment/43625006
linked to: http://stackoverflow.com/q/6098472
score: 0
linked to: http://stackoverflow.com/q/8406025
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java
tagged with: itext
has body: URL stringfile = getXsl("test.xml"); File originFile = new File(stringfile.getFile()); String xml = null; ByteArrayOutputStream pdfStream = null; try { FileInputStream fis = new FileInputStream(originFile); int length = fis.available(); byte[] readData = new byte[length]; fis.read(readData); xml = (new String(readData)).trim(); fis.close(); xml = xml.substring(xml.lastIndexOf("&lt;HttpCommandList&gt;")+17, xml.lastIndexOf("&lt;/HttpCommandList&gt;")); String[] splitxml = xml.split("&lt;/HttpCommand&gt;"); for (int i = 0; i &lt; splitxml.length; i++) { tmpxml = splitxml[i].trim() + "&lt;/HttpCommand&gt;"; System.out.println("splitxml:" +tmpxml); pdfStream = new ByteArrayOutputStream(); pdf = new com.lowagie.text.Document(); PdfWriter.getInstance(pdf, pdfStream); pdf.open(); URL xslToUse = getXsl("test.xsl"); // Here am using some utility class to transform // generate the XML needed by iText to generate the PDF using MessageBuffer contents String iTextXml = XmlUtil.transformXml(tmpxml.toString(), xslToUse).trim(); // generate the PDF document by parsing the specified XML file XmlParser.parse(pdf, new ByteArrayInputStream(iTextXml.getBytes())); } For the above code, during the XmlParser am getting java.net.malformedURL exception : no protocol Am trying to generate the pdf document by parsing the specified xml file.
upvote count: 1
has comment: http://stackoverflow.com/comment/43625952
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27601327
has title: java.net.malformedURL exception

http://stackoverflow.com/q/27637478
has body: I am trying to achieve a Excel like functionality in a TableViewer to draw a rectangle in a highlighted cell. Below is the code snippet doing this work, but it is not working completely as only left and top edges are getting drawn and I am not able to understand why the bottom and right edges are getting missed! Code snippet : private void markFocusedCell(Event event, ViewerCell cell) { GC gc = event.gc; event.gc.setAlpha(200); event.gc.setForeground(event.display.getSystemColor(SWT.COLOR_RED)); Rectangle rect = cell.getBounds(); gc.drawRectangle(rect.x, rect.y, rect.width, rect.height); event.gc.setForeground(event.display.getSystemColor(SWT.COLOR_BLACK)); event.detail &amp;= ~SWT.SELECTED; } Output
type: Question
has answer: http://stackoverflow.com/a/27638089
accepted answer: http://stackoverflow.com/a/27638089
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/27638081
tagged with: eclipse-rcp
has title: JFace TableViewer draw a rectangle on cell like Excel
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/29500597
tagged with: swt
tagged with: jface
possible better answer: http://stackoverflow.com/a/27638081
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27522563
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/27522845
accepted answer: http://stackoverflow.com/a/27522845
answer count: 5
has title: Why StringJoiner when we already have StringBuilder?
tagged with: java-8
has answer: http://stackoverflow.com/a/27522673
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/50988970
tagged with: java
has answer: http://stackoverflow.com/a/27522724
type: Question
tagged with: stringbuilder
score: 76
has answer: http://stackoverflow.com/a/27522648
has comment: http://stackoverflow.com/comment/43479271
upvote count: 77
has body: I recently encountered with a Java 8 class StringJoiner which adds the String using the delimiters and adds prefix and suffix to it, but I can't understand the need of this class as it also uses StringBuilder at the backend and also performs very simple operation of appending the Strings. Am I missing something by not actually understanding the real purpose of this class?
possible better answer: http://stackoverflow.com/a/27522648
downvote count: 1

http://stackoverflow.com/comment/43672562
type: QuestionComment
has text: @AlanHay i have pasted the House.java class.
score: 0
comment on: http://stackoverflow.com/q/27625686
type: Comment

http://stackoverflow.com/a/27554321
answers question: http://stackoverflow.com/q/27549742
score: 0
has body: I think you are creating a new imagesFolder every time. You can try to do something like: File imagesFolder = new(File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "My Castle"); if (!imagesFolder.exists()) { if (!imagesFolder.mkdirs()) { Log.e(TAG, "Fail to create directory."); return null; } } And this: file = new File(imageFolder.getPath() + File.seperator + "IMG_" + timestamp + ".jpg"); Also, you can output the list of Marker ID from your hashmap, see if the number of marker ids matched.
type: Answer

http://stackoverflow.com/q/27598941
has title: Using Handler with Postdelayed to update Notification
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27599075
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27598996
type: Question
linked to: http://stackoverflow.com/q/3875184
has body: Am trying yo use a TimerTask() with a Handler() associated with a postDelayed to update my notification running the method task every 1sec but I seem to be hitting a wall implementing it properly from the looks of things. Here is a sample from my code: Timer timer = new Timer(); TimerTask task = new TimerTask(){ @Override public void run() { updateNotificationUi(); } }; timer.scheduleAtFixedRate(task, 0, 1000); } Then updateNotificationUi() method code: private void updateNotificationUi() { new Handler().postDelayed(new Runnable(){ @Override public void run() { if(isRunning) { mNotificationBuilder.setContentTitle("Text").setContentText("This value here updates every 1 sec").setSmallIcon(R.drawable.ic_launcher); mNotifyManager.notify(notificationID, mNotificationBuilder.build()); } } }, 1000); } The error I get when running my app is 12-22 07:37:20.556: E/AndroidRuntime(6555): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() Any suggestions on how to fix this issue?
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27598999
favorite count: 0
accepted answer: http://stackoverflow.com/a/27599075
tagged with: android
upvote count: 1
possible better answer: http://stackoverflow.com/a/27598996

http://stackoverflow.com/comment/43610573
comment on: http://stackoverflow.com/a/27593350
has text: thank you, this the one that I was searching for, bad that I havn't noticed it by myself(
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27539370
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27539334
answers question: http://stackoverflow.com/q/27539334
has body: You need to include jar file for the same class. Download from here

http://stackoverflow.com/comment/43459677
type: Comment
has text: Thanks for your guys' reply. My web service take the person json converting to person class, as the input of the checkIfGoodName, and there are several static methods are called and update the person message member variables. Other request will create different person object due to their json input and passed to the checkIfGoodName. Thus, can I say that, there is not shared object be accessed by multiple thread by the same time, thus there is not thread safety issue for my code ?
comment on: http://stackoverflow.com/a/27496900
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43638412
comment on: http://stackoverflow.com/a/27600607
type: Comment
score: 1
has text: The join() version is smarter than the sleep() version. There are very few legitimate reasons to call sleep(). In particular, there is no synchronization bug that can be fixed by adding a sleep() call. If you think you fixed a bug by calling sleep(), what you actually did was make the bug much less likely (maybe much, much, much less likely) to happen during testing. But the bug still is there, and if and when it ever _does_ bite, it probably will be in the field, at a customer site, long after everyone has forgotten that it existed, and very hard to find/explain.
type: AnswerComment

http://stackoverflow.com/a/27506666
accepted answer of: http://stackoverflow.com/q/27506515
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27506515
has comment: http://stackoverflow.com/comment/43443501
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43443779
has comment: http://stackoverflow.com/comment/43444189
has body: the IN statement in SQL cannot accept a wild card character. You would have to add a OR to your query to get it to work... select * from RC_Recall t INNER JOIN RC_RECALLSTORE s ON t.ID = s.RECALLID where t.creationdate &gt;= ?1 AND t.enddate &lt;= ?2 AND t.id LIKE ?3 AND ('%' = ?4 OR t.afdeling IN (?4)) AND ('%' = ?5 OR s.storeid IN (?5)) ORDER BY ID DESC If you're using parameter position to pass parameters, you'll probably have to change it to AND ('%' = ?4 OR t.afdeling IN (?5)) AND ('%' = ?6 OR s.storeid IN (?7)) Hope that helps

http://stackoverflow.com/comment/43504177
type: QuestionComment
comment on: http://stackoverflow.com/q/27537906
score: 0
type: Comment
has text: Oops, thanks! I'll correct that. The issue with the path persists though, it's probably unrelated

http://stackoverflow.com/a/27527045
has comment: http://stackoverflow.com/comment/43483099
has body: Instead of building your own operator, try using Math.pow() (and add the mod part).
has comment: http://stackoverflow.com/comment/43482711
has comment: http://stackoverflow.com/comment/43482857
answers question: http://stackoverflow.com/q/27526979
has comment: http://stackoverflow.com/comment/43482887
type: Answer
has comment: http://stackoverflow.com/comment/43482988
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43482861
has comment: http://stackoverflow.com/comment/43483242
has comment: http://stackoverflow.com/comment/43482773
score: 0

http://stackoverflow.com/comment/43581693
has text: Please clean up the formatting of the code. Also clearly state the expected behavior and the actual behavior.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27578443

http://stackoverflow.com/comment/78175268
type: Comment
comment on: http://stackoverflow.com/a/27623513
has text: Thanks, I just came back to this problem and remembered posting about it, this is great thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/a/36736715
downvote count: 0
answers question: http://stackoverflow.com/q/27577922
score: 3
upvote count: 3
type: Answer
has body: You can pass your json Input as a POST request along with authorization header in this way public static JSONObject getHttpConn(String json){ JSONObject jsonObject=null; try { HttpPost httpPost=new HttpPost("http://google.com/"); org.apache.http.client.HttpClient client = HttpClientBuilder.create().build(); StringEntity stringEntity=new StringEntity("d="+json); httpPost.addHeader("content-type", "application/x-www-form-urlencoded"); String authorization="test:test@123"; String encodedAuth = "Basic " + Base64.encode(authorization.getBytes()); httpPost.addHeader("Authorization", security.get("Authorization")); httpPost.setEntity(stringEntity); HttpResponse reponse=client.execute(httpPost); InputStream inputStream=reponse.getEntity().getContent(); String jsonResponse=IOUtils.toString(inputStream); jsonObject=JSONObject.fromObject(jsonResponse); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return jsonObject; } This Method will return a json response.In same way you can use GET method

http://stackoverflow.com/comment/43417846
comment on: http://stackoverflow.com/a/27480221
has text: The scheme will always be a HTTP one, so like I said, look for "http" or "https".
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27510357
has answer: http://stackoverflow.com/a/27510375
favorite count: 0
has answer: http://stackoverflow.com/a/27510431
answer count: 3
tagged with: javac
has answer: http://stackoverflow.com/a/27510396
accepted answer: http://stackoverflow.com/a/27510396
possible better answer: http://stackoverflow.com/a/27510431
has comment: http://stackoverflow.com/comment/43451060
downvote count: 0
score: 6
has title: Is there a difference in runtime efficiency if I evaluate the size of the array outside the loop?
type: AnsweredQuestion
tagged with: performance
tagged with: java
upvote count: 6
type: Question
has body: The traditional way to iterate over an (integer, in this example) array of elements is the following: int[] array = {5, 10, 15}; for(int i = 0; i &lt; array.length; i++) [ //do something with array[i] } However, does this mean that after each iteration 'array.length' is re-evaluated? Would it not be more efficient to do this? : int[] array = {5, 10, 15}; int noOfElements = array.length; for(int i = 0; i &lt; noOfElements; i++) { //do something with array[i] } In this way, (to my understanding) the program only has to calculate it once and then look up the value of 'noOfElements' variable. Note: I am aware of the enhanced for-loop, but it cannot be used when you want to use the variable that is being incremented ('i' in this example) to achieve other things within the for-loop. I'm suspecting that this is actually a question of whether the Java compiler has the capability of realising that 'array.length' doesn't change and actually reusing that value after calculating it once. So my question is: Is there a difference in runtime efficiency of the first block of code I wrote and the second one? What I gather from the replies below, is that when an array is instantiated (is that the right word?) an instance variable called length is created and it is equal to the number of elements in the array. What this means is that the statement array.length has nothing to do with calculation; it is only referencing the instance variable. Thanks for the input guys!
tagged with: arrays

http://stackoverflow.com/a/66137622
has body: Primitive data types are types that don't have a method. Whereas strings have method e.g. toupper, lowercase etc. In intellij you can check is there is a method or not. this is showing the methods for the (int) which shows no methods(it is primitive This image is showing the (String) which shows methods (it is not primitive)
score: 0
answers question: http://stackoverflow.com/q/27510494
type: Answer

http://stackoverflow.com/q/27635310
downvote count: 0
has comment: http://stackoverflow.com/comment/43690450
tagged with: aop
has answer: http://stackoverflow.com/a/27636249
duplicate of: http://stackoverflow.com/q/13564627
tagged with: spring-aop
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/27636204
has title: Spring Aspect not working when called by method of the same class
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has body: I have a aspect defined (in a spring project) which is supposed to be called after a method is executed. class Crap { public void blah(){ //Do Something here } public void blah_internal(){ blah(); //Do Something else here } } class MyAspect { @After("execution(* Crap.blah(..))") public void doSomething(JoinPoint joinPoint) { System.out.println("Coming into the aspect"); //Some logic here } } Now if I call Crap.blah method normally, then the aspect works new Crap().blah(); //Prints "Coming into the aspect" But if I call the method using another method, it doesn't work new Crap().blah_internal(); //Prints nothing What is going wrong here?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43690006
tagged with: aspectj
has comment: http://stackoverflow.com/comment/43691476
linked to: http://stackoverflow.com/q/13564627

radix
tags question: http://stackoverflow.com/q/27561458
tag name: radix
type: Tag

http://stackoverflow.com/q/27590307
favorite count: 0
has answer: http://stackoverflow.com/a/27590898
has title: Java prog piped and returned immediately
has comment: http://stackoverflow.com/comment/43604822
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43604820
tagged with: java
accepted answer: http://stackoverflow.com/a/27590898
type: Question
tagged with: pipe
score: 4
has comment: http://stackoverflow.com/comment/43604675
upvote count: 4
has body: I have a Java program that prints to stdout. If the output is piped to, say, head the shell doesn't return immediately after head has done its job, instead it waits for the Java program to complete all its work. So my question is: How can I write the Java program so that the shell returns immediately, just like cat ... | head? This is an example for what I mean: Here the shell returns immediately as head takes no time to print the first ten line, no matter how big bigfile.txt is: time cat bigfile.txt | head ... real 0m0.079s user 0m0.001s sys 0m0.006s Here instead the first ten lines are quickly printed but the shell doesn't return until all the file is processed: time java -jar DummyReader.jar bigfile.txt | head ... real 0m18.720s user 0m16.936s sys 0m2.212s DummyReader.jar is as simple as I could make it: import java.io.*; public class DummyReader { public static void main(String[] args) throws IOException { BufferedReader br= new BufferedReader(new FileReader(new File(args[0]))); String line; while((line= br.readLine()) != null){ System.out.println(line); } br.close(); System.exit(0); } } My settings: java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-10M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) On MacOS 10.6.8
has comment: http://stackoverflow.com/comment/43604546
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43606446
tagged with: shell
has comment: http://stackoverflow.com/comment/43605251

class
tags question: http://stackoverflow.com/q/27602710
tags question: http://stackoverflow.com/q/27487901
tags question: http://stackoverflow.com/q/27551097
tags question: http://stackoverflow.com/q/27543799
tags question: http://stackoverflow.com/q/27629536
tags question: http://stackoverflow.com/q/27620632
tags question: http://stackoverflow.com/q/27494298
tags question: http://stackoverflow.com/q/27535304
tags question: http://stackoverflow.com/q/27524959
tags question: http://stackoverflow.com/q/27576039
tags question: http://stackoverflow.com/q/27492318
tags question: http://stackoverflow.com/q/27516929
tags question: http://stackoverflow.com/q/27547384
tags question: http://stackoverflow.com/q/27505502
tags question: http://stackoverflow.com/q/27526525
tags question: http://stackoverflow.com/q/27494316
tags question: http://stackoverflow.com/q/27503990
tags question: http://stackoverflow.com/q/27591852
tags question: http://stackoverflow.com/q/27608536
tags question: http://stackoverflow.com/q/27506206
tags question: http://stackoverflow.com/q/27522514
tags question: http://stackoverflow.com/q/27573849
tags question: http://stackoverflow.com/q/27497720
tags question: http://stackoverflow.com/q/27494305
type: Tag
tags question: http://stackoverflow.com/q/27581595
tags question: http://stackoverflow.com/q/27614006
tags question: http://stackoverflow.com/q/27638593
tags question: http://stackoverflow.com/q/27603527
tags question: http://stackoverflow.com/q/27593743
tags question: http://stackoverflow.com/q/27584245
tags question: http://stackoverflow.com/q/27635637
tag name: class
tags question: http://stackoverflow.com/q/27495049
tags question: http://stackoverflow.com/q/27590593
tags question: http://stackoverflow.com/q/27567697

http://stackoverflow.com/comment/43433432
type: Comment
comment on: http://stackoverflow.com/a/27500391
type: AnswerComment
has text: I suggest you experiment with hard-coded URIs then, so you can control all the encoding yourself. I'd start with *just* the subject, and ignore the attachment. It may be that you need to encode each *value* separately rather than the whole query, too...
score: 0

http://stackoverflow.com/comment/80760727
type: AnswerComment
comment on: http://stackoverflow.com/a/27561106
type: Comment
score: 1
has text: -Dhazelcast.health.monitoring.threshold.memory.percentage=whatever

http://stackoverflow.com/comment/43657231
comment on: http://stackoverflow.com/q/27617573
score: 0
type: Comment
type: QuestionComment
has text: By removing the switch statement from the "=" operator did the job. That's for possible future reference :)

http://stackoverflow.com/comment/43465790
type: QuestionComment
has text: wow...That's all I can say.. thanks guys! have a good night!
score: 0
comment on: http://stackoverflow.com/q/27517803
type: Comment

http://stackoverflow.com/comment/43453420
has text: I wanted to abstract away my goals from the problem in question (as I felt it would just bloat down the question), but, if you feel like it's helpful info, I'm making a virtual keyboard. The pop up that appears when you select a text field is actually a button that can be pressed to display a virtual keyboard. However, I want the text field to maintain focus, because physical keyboards should still be allowed to type in there.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27511335

on-the-fly
type: Tag
tags question: http://stackoverflow.com/q/27503046
tag name: on-the-fly

http://stackoverflow.com/a/27555633
accepted answer of: http://stackoverflow.com/q/27554432
answers question: http://stackoverflow.com/q/27554432
type: Answer
upvote count: 1
score: 1
has body: In the interface, you could get the controller through a getter: public interface Player { default void giveUp() { Controller controller = getController(); controller.click(new Rectangle(704, 545, 64, 18)); controller.delay(0.1); controller.click(new Rectangle(704, 545, 64, 18)); } default void play() { giveUp(); } default Controller getController() { return Controller.getInstance(); } } Then, the implementation class also uses the getter: public class StartupPlayer implements Player { public void play(){ Controller controller = getController(); controller.click(60, 278); controller.delay(0.5); controller.type("KevinBot"); controller.delay(0.5); controller.click(400, 463); } } This way, it's easier to change the decision that it's a singleton later on. Also, if you'll be calling lots of controller methods in succession, you might consider making it a fluent interface, and renaming the getter simply to controller (I think it makes it more fluent as well), you'd have: public interface Player { default void giveUp() { controller(). click(new Rectangle(704, 545, 64, 18)). delay(0.1). click(new Rectangle(704, 545, 64, 18)); } default void play() { giveUp(); } default Controller controller() { return Controller.getInstance(); } } public class StartupPlayer implements Player { public void play(){ controller(). click(60, 278). delay(0.5). type("KevinBot"). delay(0.5). click(400, 463); } } This cuts down on the verbosity even further... And, if the default implementation you provide in the interface for play is really meant to be overridden every time, you should consider keeping it abstract. The method giveUp would still be available for implementing classes to use.
has comment: http://stackoverflow.com/comment/43545100
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27550766
tagged with: eclipse
type: Question
score: 0
upvote count: 1
downvote count: 1
has title: What is eclipse using to determine that it can or can't build a maven project?
has body: What tool or file is eclipse using to determine that it can or can't build a project? The project is imported to Eclipse Luna as a Maven project, and Eclipse has the Maven Plugin and some m2e connectors; it seems to be happily pulling jars into the maven repo. Coming from a Visual Studio background, and somewhat new to the Eclipse paradigm, my understanding is that the purpose of the pom.xml file is to define the build process and dependencies, and that maven is the agent which produces said dependencies, but not the actual compiler which is still javac. Does Eclipse hve another project file somewhere? The specific issue triggering my question is this: I'm using Java Oracle JDK 1.7 (mandated by customer). I am including a lib (theParent) which has its own dependencies (theGrandParents), Hadoop among other things. That version of Hadoop pulled in as a grandparent dependency requires some jdk1.6 tools (the GreatGrandParents). Becase Java 1.6 is not on the build path (using 1.7!), and the dependency chain actually specifies a version, Eclipse is refusing to build the project. I'm about 95% certain I'm not using any functionality of any of the ancestors which would cause it to actually load those modules. At least in a sanity check test, Maven will build-and-run the project as is without exceptions. This is true through eclipse (Maven -> RunAs -> Maven Build) and the command line. So: What does Eclipse Luna use to build a Maven project, if not Maven? Does Java play nicely with itself? What is the risk from pulling in the older tools to satisfy the dependency?
has comment: http://stackoverflow.com/comment/43528034
answer count: 0
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/43528875
tagged with: java
favorite count: 0

http://stackoverflow.com/comment/43464702
type: QuestionComment
has text: Do you want two TextViews on just the dropdown list, or on the Spinner itself, too?
score: 0
comment on: http://stackoverflow.com/q/27516738
type: Comment

http://stackoverflow.com/a/27508807
type: Answer
answers question: http://stackoverflow.com/q/27508119
score: 0
has body: First of all, the System.out.println() in your main class only prints a new line. This method takes a string argument (or no argument as above) and prints the string followed by a new line, this way you don't have to manually enter the new line escape code (\n I believe) every time you print a new line. System.out.print() does the same thing but it doesn't make the new line. In the sample output, the System.out.println() from main.java is the blank line in between "A new dog has been created!" and "An animal sleeps..." Everything else is printed in the methods, ex: System.out.println("A dog eats..."); Try replacing System.out.println("A dog eats..."); with System.out.print("A dog eats...\n"); It should have the same output if \n is indeed the correct escape for a new line. Notice I changed "println" to just "print" and added \n to the end of the string. The reason why nothing happens when you run anything but your main class is because main(String[] args) is the initializing method. This is what is being looked for when your program runs. Think of it as the ignition to your code - with no ignition, where does the computer put the key to start the program? You can probably change this in your settings, but I wouldn't worry about that for now I think you should try to understand these concepts before moving to inheritance, as they involve the basic flow of your code and how your output is produced.

http://stackoverflow.com/q/27564307
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/43827387
has comment: http://stackoverflow.com/comment/43663370
score: 5
has title: Avoid security level blocking without adding url in exception site list
downvote count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/43619584
favorite count: 0
has answer: http://stackoverflow.com/a/27623987
tagged with: security
has comment: http://stackoverflow.com/comment/43668007
has answer: http://stackoverflow.com/a/27615911
answer count: 4
has comment: http://stackoverflow.com/comment/43767900
has body: I have created Java signed applet, it runs perfectly if I set my Java(JRE 8) security level high and add my site url in exception site list. But if we do not add site url in exception site list, java security exception comes as explained here : add url in exception site list I have created a signed applet using a third part certificate. Here is my manifest file after creating signed applet: Is there any option available to avoid these security blocking popups by adding some changes in manifest file while creating signed applet, or any script, java code to avoid these popups without adding site url in exception site list? Or is it really mandatory from Java that we must need to add site url in exception site list to avoid such blocking error. Basically is there any option available to add our url in exception site list through manifest file or any Java code ? Is it mandatory if I want to sign my applet using signed certificate then it must be a code signing certificate? wildcard or ssl certificate will not work? As I am getting self signed applet block issue though I have signed my applet with wildcard certificate.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43665893
has comment: http://stackoverflow.com/comment/43596073
has answer: http://stackoverflow.com/a/33414000
has answer: http://stackoverflow.com/a/27574197
tagged with: signed-applet
type: Question

http://stackoverflow.com/a/27611412
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
has body: You just need to create the graph before attempting to use it to inject any objects. You don't necessarily have to do it in your ServletContextListener, although that's a reasonable candidate. Once the graph is initialized, you can use it to self-inject your Cloud Endpoints (through field injection).
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27600245
has comment: http://stackoverflow.com/comment/56939623
has comment: http://stackoverflow.com/comment/56889886
answers question: http://stackoverflow.com/q/27600245

http://stackoverflow.com/q/27483102
tagged with: apache
has title: What's the best way to save PowerPoint slides as images
has comment: http://stackoverflow.com/comment/43466806
upvote count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/43466283
answer count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43400886
linked to: http://stackoverflow.com/q/3814304
has body: I'm trying to find a way to copy the whole slide, and paste it with the formatting of 'as an image' to a blank slide, using POI's APIs. The reason why I'm trying to do this is because I want to save each slide as an image. The POI's Slide.draw() API by itself does not do a very good job of saving the slides' contents to images. For example it cannot draw the following two types of objects: Tables created on PowerPoint Charts pasted from Excel Is there any way to 'copy' and 'paste with formatting (as an image)' via POI, just like you do these two operations on MS PowerPoint running on a Windows, in order to save the slides as they are? Since Slide.draw() works just fine with images, once I paste all the objects as a single flat image onto a slide (using POI), I'll be good to go. Or if there is a better way to save the slides contents as intact as possible, could you please let me know? The license which comes along with the method needs to be Apache license or otherwise something more permissive. Also, I read the following post: Programmatically extracting slides as images from a PowerPoint presentation (.PPT) unoconv is GPL-licensed, so it is not an option for us. JODConverter is LGPL-licensed; I'm not sure if it's acceptable so I will talk to my boss and check. Then I ran the POI as a command line tool, as suggested by Michael, but I ended up getting the same problem (tables and pasted Excel charts do not show up in the saved images.) Thanks.

http://stackoverflow.com/comment/43551964
has text: Sorry, Client is a selfmade interface i used to offer status access and management for the whole client. Things like isRunning() stop() start() and so on.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27544926

http://stackoverflow.com/comment/43552839
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27563469
type: Comment
has text: Nice going... Guava covers every angle :)

http://stackoverflow.com/q/27590058
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/27590991
tagged with: hashset
has body: I have a method which is used for converting a map of objects into human readable key-value pairs. To do this I need some characters such as quotes, spaces and backslash that by default will be interpreted as control characters and need escaping if used in the key or value. As there will not be any duplicates and I need a fast lookup I have assumed that a set would be the best option but as (to my knowelege) you cannot lock a set it may be accidentally changed. Is it at good idea to have a HashSet as a constant, is there a way to make it immutable, is it a good idea to follow the constant naming convention with it (UPPER_CASE) and how would you place initial values in it?
has title: Use a HashSet as a constant
favorite count: 0
tagged with: constants
has answer: http://stackoverflow.com/a/27590991
has answer: http://stackoverflow.com/a/27590106
accepted answer: http://stackoverflow.com/a/27590106

http://stackoverflow.com/q/27511335
has title: Maintaining Focus While Not On Top Java
tagged with: java
has comment: http://stackoverflow.com/comment/43453420
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27511410
tagged with: awt
tagged with: focus
has body: I'm looking to do something which may be impossible; in Java (1.6 running on Windows 7, since this is platform-dependent), I want to have a window appear over another window, but not steal focus from the triggering component. In the example attached below, I'd like to be able to be able to click on the text field, have the new pop up appear in front, but maintain focus on the text field. What I instead notice is that I get the panel to the front, but do not get focus on the text field again. I'm primarily wondering if this is possible (normally the front Window has focus in Windows, so I'm leaning towards probably not). If not, but someone has opinions on a good workaround, I'm open ears. Example: public class PopUpExample { // Global toolkit listener. enum PopUp { INSTANCE; private PopUpWindow m_popUp; private JTextComponent m_textComponent; public void initialize(PopUpWindow p) { m_popUp = p; Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() { public void eventDispatched(AWTEvent e) { // Ensure event is a focus gain event. if (( e instanceof FocusEvent ) &amp;&amp; ((FocusEvent)e).getID()==FocusEvent.FOCUS_GAINED) { // If it is on a text field, make the pop up appear, but maintain focus on the text field if ( (e.getSource() instanceof JTextComponent) ) { m_textComponent = (JTextComponent)e.getSource(); // FIXME Code below here should set the button on top, yet leave the text field with focus. m_popUp.setAlwaysOnTop( true ); m_popUp.setFocusable( false ); m_popUp.setVisible( true ); m_textComponent.requestFocus(); // end FIXME } // Otherwise, make the pop up disappear (if it isn't the pop up itself). else if (((JComponent)e.getSource()).getRootPane().getComponent(0) instanceof PopUpWindow) { m_popUp.setVisible( false ); } } } }, AWTEvent.FOCUS_EVENT_MASK); } } // Pop up window that isn't focusable class PopUpWindow extends JFrame { public PopUpWindow() { super(); BorderLayout layout = new BorderLayout(); this.setLayout( layout ); this.setMinim…
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43452796
accepted answer: http://stackoverflow.com/a/27511410
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43453493
score: 2

http://stackoverflow.com/q/27609348
linked to: http://stackoverflow.com/q/33052917
has comment: http://stackoverflow.com/comment/43641144
upvote count: 10
has comment: http://stackoverflow.com/comment/121203030
possible better answer: http://stackoverflow.com/a/27613982
favorite count: 0
has answer: http://stackoverflow.com/a/27610337
accepted answer: http://stackoverflow.com/a/27610337
has comment: http://stackoverflow.com/comment/43641151
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has body: Consider following class: class Foo&lt;T&gt; { void handle(T t) { System.out.println("handling " + t); } public static void main(String[] args) { List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); list.add(1); list.add(2); Foo&lt;Integer&gt; f = new Foo&lt;&gt;(); list.forEach(f::handle); // compiles fine //list.forEach(obj -&gt; f.handle(obj));// compilation error f = new Foo&lt;&gt;(); // reassign f } } Why do I get compilation error for obj -&gt; f.handle(obj), but not for f::handle?
has comment: http://stackoverflow.com/comment/43641361
tagged with: method-reference
tagged with: java
has answer: http://stackoverflow.com/a/27613982
downvote count: 1
score: 9
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43642161
has comment: http://stackoverflow.com/comment/43641077
tagged with: closures
duplicate of: http://stackoverflow.com/q/33052917
has title: Why lambda expressions in Java 8 requires variables used inside it to use "final" modifier, but not when using method reference?

http://stackoverflow.com/comment/43535502
has text: All of them; you'll get the actual `String[]` {"Ejava", "Cat", "Dog", "Lion", "Tiger"}. What you do with it, is up to you.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27535964
type: AnswerComment

http://stackoverflow.com/comment/115021827
comment on: http://stackoverflow.com/q/27578886
score: 0
type: Comment
type: QuestionComment
has text: This library has many more issues.

http://stackoverflow.com/a/27517856
has comment: http://stackoverflow.com/comment/43506441
score: 2
has comment: http://stackoverflow.com/comment/43506584
answers question: http://stackoverflow.com/q/27517786
has body: You can use shortcut key: Shift+Shift. You have to press double shift button
upvote count: 3
downvote count: 1
type: Answer

http://stackoverflow.com/comment/43588823
comment on: http://stackoverflow.com/q/27582167
score: 0
type: Comment
type: QuestionComment
has text: give response from the url back to ajax and also update the code what you tried with `$.ajax` call..

http://stackoverflow.com/comment/43384511
has text: @Verhaeren I was hoping it wasn't that issue. I currently don't see which one is breaking the others. In theory they should all make the car go perfectly in a square
comment on: http://stackoverflow.com/q/27475010
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43584492
has text: Please format your code and ask relevant questions.
comment on: http://stackoverflow.com/q/27580004
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43546424
type: AnswerComment
has text: Yes, that's right, and Murphy's law says it will happen when the code is in production :-).
type: Comment
comment on: http://stackoverflow.com/a/27560099
score: 1

http://stackoverflow.com/comment/83559868
type: AnswerComment
has text: When would the call to this function happen and why?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40201721

http://stackoverflow.com/a/27521517
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27521333
answers question: http://stackoverflow.com/q/27521333
type: Answer
downvote count: 0
has body: What I would do is separate the table in another jsp. yourTable.jsp like this <spring:message code="label.examination.subjects"/> <spring:message code="label.exam.Date"/> <spring:message code="label.exam.maxmarks"/> <c:forEach items="${examination.examinationSubjects}" var="examinationSubject" varStatus="status"> <c:out value="${examinationSubject.subjects.name}" /> <c:out value="${examinationSubject.date}" /> <c:out value="${examinationSubject.maxMarks}" /> </c:forEach> Then you include this jsp in your main mapge inside a div <c:jsp include="yourTable.jsp/> Then in your select you have to add a listener and when something has change you need to make a JQuery load lo reload the table rendering the table from the controller again with all the changes that you want $('#yourTable').load("url of your controller where you will render yourTable.jsp"); And in the controller you will render yourTable.jsp and you will add in the ModelAndView object the examinationSubject
score: 1
upvote count: 1

http://stackoverflow.com/q/27623554
tagged with: jar
has title: .jar file doesnt open when double clicking and also not with command prompt
has comment: http://stackoverflow.com/comment/43668385
has comment: http://stackoverflow.com/comment/43668803
has comment: http://stackoverflow.com/comment/43667711
has comment: http://stackoverflow.com/comment/43668539
has comment: http://stackoverflow.com/comment/43668128
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43668176
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43667643
has comment: http://stackoverflow.com/comment/43667601
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43668143
type: Question
has answer: http://stackoverflow.com/a/27623640
has body: since yesterday i am not able to acces any .jar file on my laptop , i've tried re-installing java jre and also tried the enviroment JAVA_HOME but that also does not work. any tips/solutions for me ?
upvote count: 0
score: -2

http://stackoverflow.com/a/27482872
has body: google-api-services http://mavenrepo.google-api-java-client.googlecode.com/hg google-api-services http://google-api-client-libraries.appspot.com/mavenrepo You have defined two repositories with the same ID, delete one of them or change its ID.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43398945
answers question: http://stackoverflow.com/q/27482776

http://stackoverflow.com/a/27610793
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27610732
has body: Yes, you can use Calendar.before() and Calendar.after(). Like So: if(Calendar.getInstance().before(myEvent)){ // do before stuff } else if(Calendar.getInstance().after(myEvent)) { // do after } else { // do right now }

http://stackoverflow.com/q/27614723
tagged with: hive
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43651488
tagged with: java
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/37118567
score: 2
downvote count: 0
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43651311
has title: Hive2 & JDBC - Required field 'serverProtocolVersion' is unset
favorite count: 0
accepted answer: http://stackoverflow.com/a/37118567
upvote count: 2
has comment: http://stackoverflow.com/comment/43651317
has body: I am trying to connect to hive using Driver org.apache.hive.jdbc.HiveDriver private static String driverName = "org.apache.hive.jdbc.HiveDriver"; public void (String query)throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(1); } Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "", ""); Statement stmt = con.createStatement(); String tableName = "testHiveTable"; stmt.executeQuery("drop table " + tableName); ResultSet res = stmt.executeQuery("create table " + tableName + " as "+query); Getting the following error java.sql.SQLException: Could not establish connection to jdbc:hive2://localhost:10000/default: Required field 'serverProtocolVersion' is unset! Struct:TOpenSessionResp(status:TStatus(statusCode:SUCCESS_STATUS), serverProtocolVersion:null, sessionHandle:TSessionHandle(sessionId:THandleIdentifier(guid:4A D8 C1 6F 82 54 49 05 80 77 24 7D A2 3A 1D 9A, secret:21 9B BF EA 37 B6 49 60 BE 5F D2 13 98 E3 17 0B)), configuration:{})

http://stackoverflow.com/comment/43416853
score: 0
type: AnswerComment
has text: That depends on the exact implementation of the `ExecutorService`, but probably what it does is just add the task to a queue, which is not an operation that takes a lot of time, so it's not expected that the EDT would hang on that.
comment on: http://stackoverflow.com/a/27492565
type: Comment

http://stackoverflow.com/a/27500835
has comment: http://stackoverflow.com/comment/121083576
has body: If you are using Spring Boot 2.4.0 or later, you can disable the static resource handling by setting spring.web.resources.add-mappings=false in your application.properties file. In earlier versions of Spring Boot, the property is spring.resources.add-mappings. With that out of the way, are you sure that it will resolve your problem? Spring Security runs as a filter before the static resource handling and I doubt that disabling the resource handling will help. Perhaps it'll make it easier to identify the underlying problem, though.
type: AcceptedAnswer
downvote count: 0
score: 23
has comment: http://stackoverflow.com/comment/85819197
type: Answer
accepted answer of: http://stackoverflow.com/q/27496262
answers question: http://stackoverflow.com/q/27496262
upvote count: 23

http://stackoverflow.com/a/27582526
answers question: http://stackoverflow.com/q/27576150
has body: I have found the answer for my problem. In order to draw an image and a shape, one can use a pixmap. It is possible to first create a pixmap on which you draw a rectangle. Then, you create another pixmap on which you draw the image. Both pixmap then can be combined by drawing one pixmap onto the other. This is the code I use to build an image containing a rectangle indicating the actual health level and drawing the indicator image on top of it. private Image getHealthIndicatorImage() { Image indicatorImage = new Image(); Pixmap healthIndicator = new Pixmap(AssetLoader.healthIndicatorV); Pixmap healthLevel = new Pixmap(healthIndicator.getWidth(), healthIndicator.getHeight(), Format.RGBA8888); healthLevel.setColor(Config.InstrumentPanel.healthInstrumentColor1); healthLevel.fillRectangle(0, 0, 50, 50); healthLevel.drawPixmap(healthIndicator, 0, 0); indicatorImage.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(healthLevel)))); indicatorImage.setScaling(Scaling.fit); return indicatorImage; }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27576150

http://stackoverflow.com/comment/43574325
has text: Any non-primitive variable can hold the value null. as in `Integer myInt=null;`
comment on: http://stackoverflow.com/q/27574405
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27533105
answer count: 2
tagged with: weblogic
score: 5
downvote count: 0
has body: We recently upgraded JDeveloper from 12.1.2 to 12.3. Application logging has messed up since then. App works but the log is filled up with below messages. Any help on this is highly appreciated. &lt;Dec 17, 2014 2:06:37 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:39 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:39 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:39 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:39 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:40 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParameterValues from a multipart value of a ServletRequest.&gt; &lt;Dec 17, 2014 2:06:40 PM EST&gt; &lt;Warning&gt; &lt;HTTP&gt; &lt;BEA-101394&gt; &lt;The exception "The request content-type is not a multipart/form-data" occurred when processing getParameter or getParamet…
has comment: http://stackoverflow.com/comment/44691760
favorite count: 0
has comment: http://stackoverflow.com/comment/43539702
upvote count: 5
has title: Application logging in weblogic 12c messed up after upgrading Jdeveloper from 12.1.2 to 12.1.3
has answer: http://stackoverflow.com/a/27600182
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43502621
has comment: http://stackoverflow.com/comment/43496249
tagged with: logging
tagged with: jdeveloper
has comment: http://stackoverflow.com/comment/43499161
tagged with: java
has answer: http://stackoverflow.com/a/33561840
has comment: http://stackoverflow.com/comment/43667255
type: Question

http://stackoverflow.com/comment/43546512
score: 0
has text: @immibis Oops I missed that so it is definitely wrong.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27560117

http://stackoverflow.com/a/27627508
has comment: http://stackoverflow.com/comment/43677319
type: Answer
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27627349
has body: The Apache Commons Math class SimpleRegression does it all. You use addData() to input the x and y values. You use getSlope() and getIntercept() to get the equation of the regression line. You use getR() to get the correlation coefficient. It couldn't be easier!
answers question: http://stackoverflow.com/q/27627349

http://stackoverflow.com/comment/43393500
type: QuestionComment
score: 0
has text: this code looks fine. Are you showing us the real picture?
comment on: http://stackoverflow.com/q/27480181
type: Comment

http://stackoverflow.com/a/27507671
has body: Use a while loop that continues as long as your input does not equal your desired keyword. while(!(inData = stdin.nextLine()).equals("myKeyword")) { //Your code here }
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27507632
answers question: http://stackoverflow.com/q/27507632

http://stackoverflow.com/a/27588474
answers question: http://stackoverflow.com/q/27588448
type: Answer
has body: generalArray is a reference type, its initial value is null, that's what the JLS 4.12.5. Initial Values of Variables states: For all reference types (§4.3), the default value is null. ReferenceType: ClassOrInterfaceType TypeVariable ArrayType To initialize it, you should use the new keyword and call the constructor that matches your needs.
score: 0

http://stackoverflow.com/comment/43561152
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27567985
has text: Please follow the Java naming conventions and don't start variable names with capital letters. Name your variables `ace`, `acevalue`, and `value`-
type: QuestionComment

http://stackoverflow.com/a/27586229
has body: The problem is that you are using the class of the class, which isn't what you want. if you used the correct type for the result of the getDeclaredClasses() call, it would have been more obvious: for(Class&lt;?&gt; c : Network.class.getDeclaredClasses()) { kryo.register(c); } (btw, you are already using reflection -> getDeclaredClasses()).
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27557810
answers question: http://stackoverflow.com/q/27557810

http://stackoverflow.com/q/27595110
answer count: 3
has title: Why nothing gets printed after while loop?
has body: I am writing a simple bank application. In my program I have used a while loop. In case a user enters wrong input it will re-prompt to enter again. Now the problem is I am not able to write any system.out.print statement after the loop. It always shows error (says: unreachable statement), and eventually the line doesn't get printed out. HOW CAN I FIX THIS? [The reason I need to use system.out.print because I want to print all the info the user has input.] The program I am working on: package bankapplication; import java.util.Scanner; public class BankApplication { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("WELCOME TO OUR BANK!\n\nPlease give all the inofrmation correctly."); System.out.println("Enter your name: "); String name = input.nextLine(); System.out.println(""); System.out.println("Enter your SSN: "); String ssn = input.next(); System.out.println(""); System.out.println("Enter your Address: "); String address = input.next(); System.out.println(""); System.out.println("Enter your telephone nr: "); String teleNum = input.next(); System.out.println(""); while (true) { System.out.println("Choose an account number for you (Between 5 and 10 positive numbers): "); int accNum = input.nextInt(); System.out.println(""); if (accNum &lt; 0 &amp;&amp; accNum &gt; 10 &amp;&amp; accNum &lt; 6) { System.out.println("Invalid choise!"); } else { System.exit(0); } } System.out.println("Congratulation! Your new account has been created!"); System.out.println("The following is your account info:\n"); System.out.println("name: " + name + "SSN: " + ssn + "Address: " + address + "Tele. Num: " + teleNum + "Acc num: " + accNum); } }
possible better answer: http://stackoverflow.com/a/27595128
tagged with: println
has comment: http://stackoverflow.com/comment/43613933
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/27595121
accepted answer: http://stackoverflow.com/a/27595121
has answer: http://stackoverflow.com/a/27595166
has answer: http://stackoverflow.com/a/27595128
score: 0
tagged with: while-loop

http://stackoverflow.com/a/27593821
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43611270
answers question: http://stackoverflow.com/q/27593736
has comment: http://stackoverflow.com/comment/43611249
type: Answer
accepted answer of: http://stackoverflow.com/q/27593736
has body: This will find registered apps to open a file otherwise it will throw error. So also write how to handle those errors. if (Desktop.isDesktopSupported()) { try { File myFile = new File("path"); Desktop.getDesktop().open(myFile); } catch (IOException ex) { } }
has comment: http://stackoverflow.com/comment/43611409
score: 0

http://stackoverflow.com/q/27633653
tagged with: jax-ws
has title: com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: No WS-Security header found
type: Question
tagged with: ssl
has comment: http://stackoverflow.com/comment/43700416
score: 0
has body: I study on a web service client which consumes a web service on a remote server over SSL. First of all,I'm new in web services,I created basic web services before which works on localhost.Such a complex business,I need help WSDL file,KeyStore file and TrustStore file were given to me.I work with a computer which can access web service endpoint Which I have done for this web service creation; I generated java classes with wsimport tool from wsdl file Then I created a Dynamic Web Project in Eclipse and import these java classes I copy keystore,truststore and wsdl files in a directory of project In a class' main method I write the code below. I get below exception during runtime in the code line which calls web service method com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: No WS- Security header found exception The code I try to access web service below: Code My_Service service=new My_Service(); MyServicePort servicePort=service.getServicePort(); BindingProvider bp = (BindingProvider)servicePort; // In case of 1-Way SSL, only the Truststore is necessary TrustManagerFactory tmf= TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init((KeyStore)null); TrustManager[] trustMgr= tmf.getTrustManagers(); KeyStore trustStore = KeyStore.getInstance("JKS"); FileInputStream truststoreFile = new FileInputStream("truststore.jks"); trustStore.load(truststoreFile, "truststore_password".toCharArray()); truststoreFile.close(); tmf.init(trustStore); // In case of 2-Way SSL, keystore and truststore are necessary KeyManagerFactory kmf= KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init((KeyStore)null,null); KeyManager[] keyMgr = kmf.getKeyManagers(); KeyStore keyStore = KeyStore.getInstance("JKS"); FileInputStream keystoreFile = new FileInputStream("keystore.jks"); keyStore.load(keystoreFile, "keystore_password".toCharArray()); keystoreFile.close(); kmf.init(keyStore, "keystore_password".toCh…
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has comment: http://stackoverflow.com/comment/43700210
has comment: http://stackoverflow.com/comment/43700278
answer count: 0
tagged with: java

http://stackoverflow.com/comment/43641077
type: Comment
type: QuestionComment
score: 5
has text: Um, both versions _should_ work without the `final` modifier. (It still has to be effectively final, though.)
comment on: http://stackoverflow.com/q/27609348

http://stackoverflow.com/q/27576737
has answer: http://stackoverflow.com/a/27577599
has title: onTouchListener in adapter ListView make onItemClickListener not running
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43578927
score: 1
accepted answer: http://stackoverflow.com/a/27577599
tagged with: java
has body: I creating custom adapter for my list view. In getView method, I set onTouchListener for LinearLayout in my custom adapter. For some reason, onItemClickListener in my listview can't run because of this. This is my code for my custom adapter TransactionAdapter method: public class TransactionAdapter extends BaseAdapter { private LayoutInflater inflater; private ArrayList&lt;CTransaction&gt; transactions; public TransactionAdapter(Context context, ArrayList&lt;CTransaction&gt; transactions){ inflater = LayoutInflater.from(context); this.transactions = transactions; } @Override public int getCount() { return transactions.size(); } @Override public Object getItem(int position) { return transactions.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { final View view = convertView = inflater.inflate(R.layout.detail_transaction, parent, false); LinearLayout llBackground = (LinearLayout)convertView.findViewById(R.id.llBackground); llBackground.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: v.setBackground(view.getResources().getDrawable(R.drawable.border_clicked)); break; case MotionEvent.ACTION_UP: v.setBackground(view.getResources().getDrawable(R.drawable.border)); v.performClick(); break; case MotionEvent.ACTION_CANCEL: v.setBackground(view.getResources().getDrawable(R.drawable.border)); break; } //Tried to use this but not working view.onTouchEvent(event); return true; } }); return convertView; } } And this is my setAdapter and onItemClickListener for ListView: lvTransaction = (ListView)findViewById(R.id.lvTransaction); TransactionAdapter adapter = new TransactionAdapter(this, transactions); lvTransaction.setAdapter(adapter); lvTransaction.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(Ada…
has comment: http://stackoverflow.com/comment/43579320
has comment: http://stackoverflow.com/comment/43579282
has comment: http://stackoverflow.com/comment/43579004
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-listview
tagged with: custom-adapter
tagged with: android

http://stackoverflow.com/comment/43589247
comment on: http://stackoverflow.com/q/27579458
score: 0
type: Comment
type: QuestionComment
has text: I want this page every time load, title set from sent message from class

http://stackoverflow.com/comment/43509941
comment on: http://stackoverflow.com/q/27541011
score: 0
type: QuestionComment
has text: Have you run your code? Because I have done it and I obtain the following output : `Rick Grimes rescued {}pts! Rick Grimes rescued {Carl=100}pts!` It's almost what you are expecting.
type: Comment

http://stackoverflow.com/a/27623839
has body: The SimpleJobBuilder provides facilities for configuring a split via java config. Below is an example taken from the FlowJobBuilderTests (https://github.com/spring-projects/spring-batch/blob/master/spring-batch-core/src/test/java/org/springframework/batch/core/job/builder/FlowJobBuilderTests.java). Obviously you'll want to break this up a bit, but it should illustrate the general idea. // Create each flow Flow flow = new FlowBuilder&lt;Flow&gt;("subflow").from(step1).end(); // Create the job SimpleJobBuilder builder = new JobBuilder("flow").repository(jobRepository).start(step2); // Create split providing an async task executor so the flows are executed in parallel builder.split(new SimpleAsyncTaskExecutor()).add(flow).end(); // Build the job and execute it builder.preventRestart().build().execute(execution);
has comment: http://stackoverflow.com/comment/43686838
type: Answer
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/27616300
has comment: http://stackoverflow.com/comment/43673701
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27616300

http://stackoverflow.com/a/27559213
score: 8
has comment: http://stackoverflow.com/comment/129273120
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27559190
answers question: http://stackoverflow.com/q/27559190
has body: Here's the line of code in question: parent.setScreen(equalnum.valueOf(totalnum)); You're calling the static method valueOf on an instance of a String object (equalnum). You should call it on the class itself instead. parent.setScreen(String.valueOf(totalnum));
upvote count: 8
type: Answer

http://stackoverflow.com/comment/43582729
type: Comment
has text: Thanks for the suggestion Alan, unfortunately I don't think flying saucer offers everything I want it to do. The pdf I'm generating is a combination of the parsed html and some more info I add programmatically, all gathered from a json object.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27570928

http://stackoverflow.com/comment/43673300
type: QuestionComment
type: Comment
score: 4
comment on: http://stackoverflow.com/q/27625293
has text: *"Also, this question is very hard to search for because of the operators.."* Why not search for 'Java operators'? You will get a list of operators and these operators are listed.

http://stackoverflow.com/q/27539626
type: Question
has comment: http://stackoverflow.com/comment/43507116
linked to: http://stackoverflow.com/q/27528976
has comment: http://stackoverflow.com/comment/43507051
has comment: http://stackoverflow.com/comment/43507274
tagged with: java
tagged with: jpa
downvote count: 0
score: 1
tagged with: toplink
has body: I am trying to set default values for entity attributes so that if values are null in database, it would display default values. My entity relationships are as follows @Entity @Table(name = "EMP") public class Emp implements Serializable { @Id @Column(name = "empno", nullable = false) private String empNo; @JsonBackReference("proj") @ManyToOne @JoinColumn(name = "PROJECT_ID", referencedColumnName = "PROJECT_ID") private Project project; public Project getProject() { return Project; } public void setProject(Project project) { this.project = project; // this.project = project == null ? &lt;notSure&gt; : project; // not sure what to give default value } @Entity @Table(name = "PROJECTS") public class Project implements Serializable { @Id @Column(name="PROJECT_ID", nullable = false) private Long projectId = 0L; // default value @Column(name = "PROJECT_NAME" , nullable = true) private String projectName = "-"; // default value @JsonManagedReference("proj") @OneToMany(mappedBy = "project") private List&lt;Emp&gt; empList; public Long getProjectId() { return projectId; } public void setProjectId(Long projectId) { // this.projectId = projectId; this.projectId = projectId == null ? 0L : projectId; } public String ProjectName() { return projectName; } I am not sure what to give default value for this this.project = project == null ? &lt;notSure&gt; : project; Although default values are set for projectId and projectName, when I execute, I still see project attributes as null. What could be the reason for this and how could I set default values for project attributes? Generated values [{"empNo":"12690","empName":"SCOTT","project":null}] There are values exist for empNo and empName, however for project.projectId and projectName, there are values exist in database table and hence I set the default value. Expected output as per default values set for projectId and projectName [{"empNo":"12690","empName":"SCOTT","project":{"projectId":0,"projectName":"-"}}]
favorite count: 0
has comment: http://stackoverflow.com/comment/43507763
has comment: http://stackoverflow.com/comment/43507601
answer count: 0
has title: Default values for JPA entity attributes
type: UnansweredQuestion
tagged with: orm
upvote count: 1

http://stackoverflow.com/q/27583912
tagged with: java
tagged with: file
type: Question
has answer: http://stackoverflow.com/a/27584105
tagged with: jsp
has comment: http://stackoverflow.com/comment/43592348
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/24589484
accepted answer: http://stackoverflow.com/a/27584105
has body: This my index.jsp page code[this question like this read and display a local text file in jsp page: &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%&gt; &lt;%@page import="java.io.*"%&gt; &lt;%@page import="java.net.URL"%&gt; &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;!--When I use this line has conflict error --&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;title&gt; &lt;% String jspPath = "C:\\Users\\Farshid\\workspace\\STPT\\WebContent\\file\\title.txt"; BufferedReader reader = new BufferedReader(new FileReader(jspPath)); //BufferedReader br = new InputStreamReader(new FileInputStream(txtFilePath)); StringBuilder sb = new StringBuilder(); String line; line = reader.readLine(); out.println(sb.toString()); System.out.println(sb.toString()); %&gt; &lt;/title&gt; Notice: My IDE is eclipse and my web server is Tomcat7.0. But this codes haven't any output,why?
type: AnsweredQuestion
has title: Read and display a local text file in jsp page has Error

http://stackoverflow.com/q/27607655
favorite count: 0
has answer: http://stackoverflow.com/a/27607741
has comment: http://stackoverflow.com/comment/43637546
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43637409
has title: android NullPointer Exception error Custom List View
has comment: http://stackoverflow.com/comment/43638858
has answer: http://stackoverflow.com/a/27607785
tagged with: java
has comment: http://stackoverflow.com/comment/43639422
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43637510
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43637843
has comment: http://stackoverflow.com/comment/43642449
answer count: 2
upvote count: 0
has body: Im pretty new to android, so by referring to tutorials i came with an application. Im trying to query data from DB and display it in a custom list view. But its throwing me a NUllPointer Exception and im not able to debug it, Pls help me out. Posting the code snippets. MainActivity.java public class MainActivity extends Activity implements OnClickListener { Button add, delete; ListView lv; DataHandler enter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_main); add = (Button) findViewById(R.id.btn_add); delete = (Button) findViewById(R.id.btn_delete); add.setOnClickListener(this); //opening DB enter.open(); showList(); enter.close(); } private void showList() { // TODO Auto-generated method stub ArrayList&lt;MenuListItems&gt; MenuList = new ArrayList&lt;MenuListItems&gt;(); // MenuList.clear(); Cursor c1 = enter.getAllRows(); if (c1 != null) { if (c1.moveToFirst()) { do { MenuListItems menuListItems = new MenuListItems(); menuListItems.setSlno(c1.getString(c1.getColumnIndex("_id"))); menuListItems.setTitle(c1.getString(c1.getColumnIndex("title"))); menuListItems.setNote(c1.getString(c1.getColumnIndex("note"))); menuListItems.setPhone(c1.getString(c1.getColumnIndex("phone_number"))); MenuList.add(menuListItems); } while (c1.moveToNext()); } } c1.close(); MenuListAdapter menuListAdapter = new MenuListAdapter(MainActivity.this, MenuList); lv.setAdapter(menuListAdapter); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.btn_add : Intent next = new Intent("com.testing.callreminder.ADDITEM"); startActivity(next); break; } }} List Adapter class (custom ) public class MenuListAdapter extends BaseAdapter { Context c; ArrayList&lt;MenuListItems&gt; menuList; public MenuListAdapter(Context context, ArrayList&lt;MenuListItems&gt; list){ c=context; menuList=list; } @Override public int ge…

http://stackoverflow.com/q/27623929
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/27624038
type: AnsweredQuestion
has title: JMS ObjectMessage classpath
upvote count: 2
score: 1
downvote count: 1
type: Question
tagged with: jakarta-ee
has body: I'm trying to create a simple example with Java EE JMS. If i try to receive an ObjectMessage, i need to have exactly the same path (packagename) as the other project, which sends the ObjectMessage. For example i have in my sender project a class called Person in the packege "org.queue.sender" and exactly the same class in my receiver project in the package "org.queue.receiver". As already said, if i try to get the objectmessage i get the following Exception: java.lang.ClassNotFoundException: org.queue.sender.Person If i create a new package in my receiver project named org.queue.sender and transfer the class Peron there, then it run. but i think i couldn't be the really solution. Is there a better solution?
tagged with: java
accepted answer: http://stackoverflow.com/a/27624038
answer count: 1

http://stackoverflow.com/comment/43649916
type: Comment
type: QuestionComment
has text: subclasses Banana will be the first elements in Arraylist and then to the others.That's how I need to sort it (Sorry , I'm not a native English speaker so u may find hard to understand.)
comment on: http://stackoverflow.com/q/27613841
score: 0

http://stackoverflow.com/a/27549198
has body: I used the solution also described in this post from Netgloo's blog. The idea is to create a generic repository class like the following: @NoRepositoryBean public interface ABaseRepository&lt;T extends A&gt; extends CrudRepository&lt;T, Long&gt; { // All methods in this repository will be available in the ARepository, // in the BRepository and in the CRepository. // ... } then I can write the three repositories in this way: @Transactional public interface ARepository extends ABaseRepository&lt;A&gt; { /* ... */ } @Transactional public interface BRepository extends ABaseRepository&lt;B&gt; { /* ... */ } @Transactional public interface CRepository extends ABaseRepository&lt;C&gt; { /* ... */ } Moreover, to obtain a read-only repository for ARepository I can define the ABaseRepository as read-only: @NoRepositoryBean public interface ABaseRepository&lt;T&gt; extends Repository&lt;T, Long&gt; { T findOne(Long id); Iterable&lt;T&gt; findAll(); Iterable&lt;T&gt; findAll(Sort sort); Page&lt;T&gt; findAll(Pageable pageable); } and from BRepository extend also the Spring Data JPA's CrudRepository to achieve a read/write repository: @Transactional public interface BRepository extends ABaseRepository&lt;B&gt;, CrudRepository&lt;B, Long&gt; { /* ... */ }
has comment: http://stackoverflow.com/comment/62718256
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/105777461
type: Answer
has comment: http://stackoverflow.com/comment/62695811
answers question: http://stackoverflow.com/q/27543771
has comment: http://stackoverflow.com/comment/62716374
score: 65
upvote count: 65
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27543771

http://stackoverflow.com/comment/43554324
type: QuestionComment
type: Comment
has text: Could you provide errors message?
score: 0
comment on: http://stackoverflow.com/q/27564457

http://stackoverflow.com/comment/66969037
score: 0
has text: A useful explanation of the llx, lly, urx, and ury parameters is here: http://stackoverflow.com/questions/30748651/how-should-i-interpret-the-coordinates-of-a-rectangle-in-pdf
type: Comment
comment on: http://stackoverflow.com/a/27571297
type: AnswerComment

kryo
tags question: http://stackoverflow.com/q/27613704
tags question: http://stackoverflow.com/q/27621968
type: Tag
tag name: kryo

http://stackoverflow.com/comment/43529407
has text: im executing its not giving any error as well as writing nothing to the file
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27550268
score: 0

http://stackoverflow.com/comment/43516722
has text: I would not accept ID from the client application. On insert I would generate these myself.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27541924

http://stackoverflow.com/q/27541999
has answer: http://stackoverflow.com/a/28407939
has body: I would like to be able to have a generic adapter that works for any ListFragment,so that I can send it any type of viewholder and it will just load the list. This is what I have so far and there a good few errors. I was originally want an adapter just for a friends list but now I want to be able to reuse the adapter for future projects. I come from a c++ background so templates in this are a little different. If you guys could show me whats to do be done in the actual ListFragment it would make my year import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import java.util.ArrayList; public class FriendsAdapter&lt;T&gt; extends ArrayAdapter&lt;T&gt; { private ArrayList&lt;T&gt; objects; private final LayoutInflater inflater; private int resources; private T viewHolder; private int currPosition; public FriendsAdapter(Context context, ArrayList&lt;T&gt; objects, int resources, AdapterCommand&lt;T&gt; listener, T viewholder) { super(context, R.layout.friends_fragment); inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return objects.size(); } @Override public T getItem(int position) { return objects.get(position); } @Override public long getItemId(int position) { return 0; } public int getPosition() { return this.currPosition; } @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; T viewHolder; currPosition = position; if (rowView == null) { // alternate layouts if (position % 2 == 0) { rowView = inflater.inflate(R.layout.friends_fragment_even, null); } else { rowView = inflater.inflate(R.layout.friends_fragment_odd, null); } rowView = inflater.inflate(resources, parent, false); viewHolder = new T(); rowView.setTag(viewHolder); } else { viewHolder = (T) rowView.getTag(); } T object = getItem(position); return rowView; } /* public void N…
type: UnansweredQuestion
tagged with: android
tagged with: android-adapter
has title: generic viewholder type for a ListFragment adapter
tagged with: java
type: Question
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43511223
score: 0
answer count: 1
tagged with: generics

http://stackoverflow.com/q/27505141
has answer: http://stackoverflow.com/a/27820156
accepted answer: http://stackoverflow.com/a/27570905
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/27570905
has title: IntelliJ IDEA is unable to kill my Dropwizard Server
answer count: 2
upvote count: 1
tagged with: intellij-idea
downvote count: 0
possible better answer: http://stackoverflow.com/a/27820156
favorite count: 0
has comment: http://stackoverflow.com/comment/43442299
tagged with: dropwizard
has comment: http://stackoverflow.com/comment/43442843
has body: I have a project that is developed using Dropwizard and Gradle. When I want to start the server, I can simply run it inside IntelliJ IDEA with gradle run as runconfiguration. Doing so starts my server and I can interact with it as expected, even debugging with IntelliJ is no problem. But using the "Stop" or "Rerun" buttons don't seem to kill the previously started server. Instead, if I rerun the server I get the following exception: 13:45:48: Executing external task 'run'... :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE Connected to the target VM, address: '127.0.0.1:61376', transport: 'socket' :run INFO [2014-12-16 12:46:01,393] io.dropwizard.server.ServerFactory: Starting my-project Disconnected from the target VM, address: '127.0.0.1:61376', transport: 'socket' WARN [2014-12-16 12:46:01,552] org.eclipse.jetty.util.component.AbstractLifeCycle: FAILED org.eclipse.jetty.server.Server@7a6359b0: java.lang.RuntimeException: java.net.BindException: Address already in use So it seems like some other program keeps the address I want to use. When I then run ps aux I can see that my server is still running and that it responds to requests. Only if I kill it via terminal, or when I exit IntelliJ IDEA the server gets killed. As this is not so nice for development I'm searching for some guidance here.

http://stackoverflow.com/q/27570819
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43567378
type: Question
answer count: 2
downvote count: 0
tagged with: baseadapter
tagged with: searchview
has comment: http://stackoverflow.com/comment/43567175
has answer: http://stackoverflow.com/a/27570875
tagged with: nullpointerexception
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/27570916
has body: I'm trying to implement a search functionality in my app, it works partially, when it cannot find an item the application crashes and gives me the following error: 12-19 14:35:44.019 29694-29694/W/System.err﹕ at br.com.adapter.DespesaViewAdapter.getCount(DespesaViewAdapter.java:75) 12-19 14:35:44.020 29694-29694/W/System.err﹕ at br.com.representemais.DespesaActivity$1.onQueryTextChange(DespesaActivity.java:241) the above lines is: 75: return despesa.size(); 241: lv.setAdapter(ad); This is my entire code: public class DespesaViewAdapter extends BaseAdapter { private Repositorio mRepositorio; private SearchView.OnQueryTextListener query; private Runnable frag; private DespesaActivity desp; private static LayoutInflater inflater=null; private List&lt;DespesasDaViagemModel&gt; despesa = new ArrayList&lt;DespesasDaViagemModel&gt;(); public DespesaViewAdapter(Context context, Runnable fragmentDespesa, List&lt;DespesasDaViagemModel&gt; despesas) { this.inflater = LayoutInflater.from( context ); this.despesa = despesas; mRepositorio = new Repositorio(context); frag = fragmentDespesa; } public DespesaViewAdapter(Context contextx, SearchView.OnQueryTextListener onQueryTextListener, List&lt;DespesasDaViagemModel&gt; despesa) { this.inflater = LayoutInflater.from( contextx ); this.despesa = despesa; query = onQueryTextListener; } public int getCount() { return despesa.size(); } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { View vi=convertView; ViewHolder holder; if(convertView == null){ vi = inflater.inflate(R.layout.despesa_activity, null); holder=new ViewHolder(); holder.id = (TextView)vi.findViewById(R.id.despesaId); holder.data = (TextView)vi.findViewById(R.id.dataDespesa); holder.categoria = (TextView)vi.findViewById(R.id.despesaCategoria); holder.valor = (TextView)vi.findViewById(R.id.valorDespesa); View corCategoria = (View) vi.findV…
has answer: http://stackoverflow.com/a/27570916
upvote count: 1
accepted answer: http://stackoverflow.com/a/27570875
type: AnsweredQuestion
has title: java.lang.NullPointerException getCount on searchview android

http://stackoverflow.com/comment/43491358
type: Comment
comment on: http://stackoverflow.com/a/27531377
type: AnswerComment
has text: Yes i understood that but still i can't understand how to create catch block that will catch all error or exception my program will get
score: 0

http://stackoverflow.com/comment/43692573
has text: @Eran: I've edited my answer with a *possible* scenario, but I don't think it's actually implemented, and certainly it doesn't apply to the example you gave.
type: AnswerComment
comment on: http://stackoverflow.com/a/27636774
type: Comment
score: 1

http://stackoverflow.com/a/43116557
answers question: http://stackoverflow.com/q/27510849
type: Answer
accepted answer of: http://stackoverflow.com/q/27510849
downvote count: 1
upvote count: 0
type: AcceptedAnswer
score: -1
has body: Since this question keeps getting views I thought I'd post a follow-up to it. The problem appears to be with the line roleHierarchy.setHierarchy("ROLE_ADMIN &gt; ROLE_USER &gt; ROLE_DEFAULT"); I don't remember why I wrote the hierarchy like that but it's not correct. The API for that method handles the same situation thusly: Role hierarchy: ROLE_A > ROLE_B and ROLE_B > ROLE_C. Directly assigned authority: ROLE_A. Reachable authorities: ROLE_A, ROLE_B, ROLE_C. Eventually it became clear that a hierarchical model didn't fit our roles so we instead implemented a finer-grained set of authorities mapped to roles, as mentioned in the Spring Security Reference: For more complex requirements you may wish to define a logical mapping between the specific access-rights your application requires and the roles that are assigned to users, translating between the two when loading the user information.

http://stackoverflow.com/comment/43461974
type: QuestionComment
comment on: http://stackoverflow.com/q/27513887
has text: Yes, does StackOverFlow provide somewhere I can share the code?
score: 0
type: Comment

semaphore
type: Tag
tags question: http://stackoverflow.com/q/27624776
tag name: semaphore

http://stackoverflow.com/comment/43613428
comment on: http://stackoverflow.com/a/27594718
type: Comment
has text: I think I understand the class variable case now. How about the Map cases? The Parameter in a map is mixed, some are Long and some are Float and others. Then it is the right place for wildcard? I don't want to make Class A or Class B a generic type.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27616693
has body: You should look into your Account class. You probably declared the properties to be static, which means all Account instances would have the same properties. Remove the static keyword.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27616651
downvote count: 0

http://stackoverflow.com/q/27505536
accepted answer: http://stackoverflow.com/a/27506460
type: Question
tagged with: hikaricp
answer count: 1
downvote count: 0
score: 18
favorite count: 0
has comment: http://stackoverflow.com/comment/43442014
has title: HikariCP too many connections
has comment: http://stackoverflow.com/comment/43441932
has comment: http://stackoverflow.com/comment/43442430
has comment: http://stackoverflow.com/comment/43441821
has answer: http://stackoverflow.com/a/27506460
has comment: http://stackoverflow.com/comment/43442253
has body: i have a Java Servlet and i want to use connection pooling together with jdbc (Database: mysql). So here is what i'm doing: (This class is public final class DBConnector) private static final HikariDataSource dataSource = new HikariDataSource(); private static final HikariDataSource dataSource2 = new HikariDataSource(); private static final HikariDataSource dataSource3 = new HikariDataSource(); static { dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/contentdb"); dataSource.setUsername("root2"); dataSource.setPassword("password"); dataSource.setMaximumPoolSize(400); dataSource.setMinimumIdle(5); dataSource.setLeakDetectionThreshold(15000); dataSource.setConnectionTestQuery("SELECT 1"); dataSource.setConnectionTimeout(1000); dataSource2.setDriverClassName("com.mysql.jdbc.Driver"); dataSource2.setJdbcUrl("jdbc:mysql://localhost:3306/userdb"); dataSource2.setUsername("root"); dataSource2.setPassword("password"); dataSource2.setMaximumPoolSize(300); dataSource2.setMinimumIdle(5); dataSource2.setLeakDetectionThreshold(15000); dataSource2.setConnectionTestQuery("SELECT 1"); dataSource2.setConnectionTimeout(1000); dataSource3.setDriverClassName("com.mysql.jdbc.Driver"); dataSource3.setJdbcUrl("jdbc:mysql://localhost:3306/analysedb"); dataSource3.setUsername("root2"); dataSource3.setPassword("password"); dataSource3.setMaximumPoolSize(200); dataSource3.setMinimumIdle(5); dataSource3.setLeakDetectionThreshold(15000); dataSource3.setConnectionTestQuery("SELECT 1"); dataSource3.setConnectionTimeout(1000); } private DBConnector() { // } public static Connection getConnection(int dataBase) throws SQLException { if (dataBase == 0) { return dataSource.getConnection(); } else if (dataBase == 1) { return dataSource2.getConnection(); } else { return dataSource3.getConnection(); } } And when i want to call it: Connection con = null; PreparedStatement query = null; ResultSet result = null; try { con = DBConnector.getConnection(…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43442767
tagged with: mysql
upvote count: 18

http://stackoverflow.com/comment/43386008
comment on: http://stackoverflow.com/q/27475712
score: 0
type: Comment
type: QuestionComment
has text: Just to make sure I understand what you are doing, you are filtering all characters that appear in `s1` out of `s2`, right?

http://stackoverflow.com/q/27477973
has answer: http://stackoverflow.com/a/27478038
type: AnsweredQuestion
has body: In the MANIFEST.MF file found in JARs, the first line is Manifest-Version: 1.0. According to the Java Tutorials, this first line says that "the default manifest conforms to version 1.0 of the manifest specification". So in what cases would the Manifest-Version be anything other than 1.0? Also, what is the manifest specification? Why must the default manifest conform to it? I've seen multiple explanations explaining again that "the default manifest conforms to version 1.0 of the manifest specification" but none explaining what the manifest specification is.
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/27478038
tagged with: manifest
tagged with: manifest.mf
score: 15
upvote count: 15
has title: What is Manifest-Version in MANIFEST.MF?
answer count: 1
tagged with: jar
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/12767886

http://stackoverflow.com/a/27540223
has comment: http://stackoverflow.com/comment/43508738
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27539681
has comment: http://stackoverflow.com/comment/43508722
has body: Using url encoded form type, we need to format the body in specific way. As state here The control names/values are listed in the order they appear in the document. The name is separated from the value by = and name/value pairs are separated from each other by &amp;. So basically, the data should be sent in the form key1=value2&amp;key2=value2, and any special characters should be url encoded. In your case, there are no special characters so we don't need any encoding, just formatting. So you client request might look something more like WebResource resource = client.resource(Main.BASE_URI).path("form"); String username = "user"; String password = "pass"; StringBuilder builder = new StringBuilder(); builder.append("X-Username").append("=").append(username).append("&amp;"); builder.append("X-Password").append("=").append(password); ClientResponse response = resource .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE) .post(ClientResponse.class, builder.toString()); String msg = response.getEntity(String.class); System.out.println(msg); response.close(); On the server side, you need to make sure the resource accepts (@Consumes) MediaType.APPLICATION_FORM_URLENCODED type data also, and has @FormParam annotations to extract the values (we can also us a MultivalueMap, but for easier access, we can use the annotation`. So your resource class might look something like @Path("/form") public class FormResource { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response doForm(@FormParam("X-Username") String username, @FormParam("X-Password") String password) { return Response.ok("Good job " + username + "!").build(); } } This should work fine, given all your other infrastructure parts are working. Note: If you do have any special characters you need to encode, you can simple make use of java.net.URLEncoder and use encode(String part, String encType)
type: Answer
has comment: http://stackoverflow.com/comment/43508744
upvote count: 1
has comment: http://stackoverflow.com/comment/43508664
has comment: http://stackoverflow.com/comment/43509090
has comment: http://stackoverflow.com/comment/43508761
has comment: http://stackoverflow.com/comment/43508639
has comment: http://stackoverflow.com/comment/43508726

http://stackoverflow.com/q/27508327
has body: I have found many posts on here about using Spring to externalize the Hibernate settings so it's not in the hibernate.cfg.xml config file. However, my question revolves around having a development environment that uses Eclipse and then deploying the generated WAR file out on a separate server. I am currently using Eclipse Luna and deploying my Spring MVC web application to a local install of Tomcat 8. The hibernate.cfg.xml file currently resides in the resources folder. When I deploy it locally, it works great. However, the config uses my personal login credentials, which isn't good to have on the server for everyone to see. What I need is to figure out a design to have the application work locally and when I deploy on the server. I was thinking about creating a folder called conf and placing the hibernate.cfg.xml file in here and through the Eclipse classpath (Debug As configuration...) define it as a folder. That should allow the local version to still read in the proper files and work. But I am stuck on how to setup the server side of this. Since we just drop in the WAR file, it will auto deploy. I can use a PropertyPlaceholderConfigurer, but that will throw errors on my local copy. The only other thing I can think of is to create a process where I create the folder for the application, unpack the WAR file into this folder each time minus the conf folder. And only update the conf folder on the server. Is this a good design or is there a better way? I appreciate all the help and guidance on this!
type: Question
has answer: http://stackoverflow.com/a/27509024
tagged with: configuration
answer count: 2
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/5303671
possible better answer: http://stackoverflow.com/a/27509024
tagged with: spring-mvc
has title: Design for Hibernate external config for app server and local Eclipse
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27511568
accepted answer: http://stackoverflow.com/a/27511568
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27585390
upvote count: 6
has comment: http://stackoverflow.com/comment/43595668
score: 6
has body: It's equivalent to least = Math.min(least, k); or if (!(least &lt; k)) { least = k } See also: the Java documentation on the ternary operator (scroll to the "The Conditional Operators" section).
answers question: http://stackoverflow.com/q/27585357
downvote count: 0
type: Answer

http://stackoverflow.com/a/27633129
score: 1
answers question: http://stackoverflow.com/q/27631237
upvote count: 1
has body: Synchronizing between threads is easy, but between JVMs is extremely hard, especially if you need to support multiple platforms. I would suggest centralising the update code using one of the following methods, both of which "contract out" the data update task: Publish a trivial REST API from a single process that knows how to do the update task, and serialize the requests. Use a relational database to hold the counts, and make sure the client code correctly rolls back transactions when they don't succeed. Probably not what you wanted to hear, but either method will work well.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43597118
type: Comment
comment on: http://stackoverflow.com/a/27575621
has text: @JimN - When I say the JLS permits it, it is probably better to say that the JLS does not specify what should happen. In the absence of a specified behaviour, the compiler could do anything ... including code transformations that seem unintuitive.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/88059582
comment on: http://stackoverflow.com/a/42020869
type: AnswerComment
score: 0
type: Comment
has text: You don't need to manually create the boundary. You can just use `multipartEntity.getMediaType()`. I originally was using `MediaType.MULTIPART_FORM_DATA` which did not add the boundary. But when you use the `getMediaType()` method of the `MutliPart`, it _will_ have the boundary.

http://stackoverflow.com/comment/43698026
type: Comment
has text: I have A1= null; A2 = {14} A3 = {16} A4 = {4} A5 = {10,5,13} ... A10 And B1 = {14, 5, 16} B2 = {4,10} B3 = {13, 15} B4 = {3, 12} B5 = {11, 6} ... B10 And i need 9 lists L1 = B1; L1 = {14,5,16} for i=2; i<=n-1; i++ replace Ai with Bi example: i=2 A2 = 14 => L2 = {4,10,5,16} Here is a small part of the algorithm of locating a point in a PSLG(Planar straight-line graph) Slab Method: Plane Sweep
score: 0
comment on: http://stackoverflow.com/a/27639500
type: AnswerComment

http://stackoverflow.com/a/27560127
upvote count: 3
has body: The reason that making the add() method synchronised is important is that this line: this.count += value; Is not an atomic action. It a really compiles as this (or similar): long c = count; c = c + value; count = c; Which should be pretty obviously not threadsafe.
answers question: http://stackoverflow.com/q/27560051
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/comment/43627287
comment on: http://stackoverflow.com/q/27602405
has text: Similar to [this SO](http://stackoverflow.com/questions/26299343/is-springmvc-works-on-single-thread-model-or-multithread-model)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27620372
score: 0
downvote count: 2
answer count: 1
favorite count: 0
tagged with: android
has title: Any one tell text based sms using SMSManager in android
type: AnsweredQuestion
has body: This is my code using SendSMS sendSMS = new SendSMS(); sendSMS.sendSMS("mobileNumber", "message", context); public void sendSMS(String phoneNumber, String message,final Context context) { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(DELIVERED), 0); //---when the SMS has been sent--- context. registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(context, "SMS sent", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_GENERIC_FAILURE: Toast.makeText(context, "Generic failure", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NO_SERVICE: Toast.makeText(context, "No service", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_NULL_PDU: Toast.makeText(context, "Null PDU", Toast.LENGTH_SHORT).show(); break; case SmsManager.RESULT_ERROR_RADIO_OFF: Toast.makeText(context, "Radio off", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(SENT)); //---when the SMS has been delivered--- context. registerReceiver(new BroadcastReceiver(){ @Override public void onReceive(Context arg0, Intent arg1) { switch (getResultCode()) { case Activity.RESULT_OK: Toast.makeText(context, "SMS delivered", Toast.LENGTH_SHORT).show(); break; case Activity.RESULT_CANCELED: Toast.makeText(context, "SMS not delivered", Toast.LENGTH_SHORT).show(); break; } } }, new IntentFilter(DELIVERED)); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI); }
type: Question
has comment: http://stackoverflow.com/comment/43662018
tagged with: java
has answer: http://stackoverflow.com/a/27620732
accepted answer: http://stackoverflow.com/a/27620732
has comment: http://stackoverflow.com/comment/43686467
upvote count: 2

http://stackoverflow.com/a/27508979
type: Answer
has comment: http://stackoverflow.com/comment/43448920
has body: You said yourself mycb doesn't actually become null. That's great. if (mycb != null &amp;&amp; mycb.getValue() == true) This throws a NullPointerException because Java tries to cast the result of mycb.getValue() to a boolean. But because mycb.getValue() returns null, it throws a NullPointerException. Change it to: if (mycb.getValue() != null &amp;&amp; mycb.getValue() == true) Or something similar
answers question: http://stackoverflow.com/q/27504787
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/27504787

http://stackoverflow.com/a/27579348
score: 0
answers question: http://stackoverflow.com/q/27579236
type: Answer
has body: Because the suspendFlag will be accessed from multiple threads, so the access to the suspendFlag must be sychronized, which means only one thread can access it at given moment.

http://stackoverflow.com/a/27510096
type: Answer
has body: if you know Timezone date1.setTime(date1.getTime()+/-(3600000*hours)) to convert, if date1 time is GMT to go to GMT+2 hours must be 2 and sing must be +
has comment: http://stackoverflow.com/comment/43450335
score: 0
answers question: http://stackoverflow.com/q/27509817

http://stackoverflow.com/comment/43474001
comment on: http://stackoverflow.com/q/27507004
has text: The `readLine()` *will* block until a line is available to be read, or end of stream or an exception occurs. What's the problem with that exactly?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27517758
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
has title: Wildfly 8.1 ClassNotFound org.apache.http.conn.ClientConnectionManager
answer count: 1
tagged with: java
tagged with: wildfly
has answer: http://stackoverflow.com/a/27517951
has body: I'm having a heck of a time getting a pooling connection manager to work for Resteasy clients. Deploying on Wildfly 8.1. import org.apache.http.client.HttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; ... PoolingClientConnectionManager cm = new PoolingClientConnectionManager(); cm.setMaxTotal(200); cm.setDefaultMaxPerRoute(20); HttpClient httpClient = new DefaultHttpClient(cm); ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); ResteasyClient resteasyClient = new ResteasyClientBuilder().httpEngine(engine).build(); I'm getting the error: 19:04:59,355 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "ESM2.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"ESM2.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"ESM2.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"ESM2.war\" Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.xxx.esm2.server.webservices.rest.arcgis.ClientBean with ClassLoader ModuleClassLoader for Module \"deployment.ESM2.war:main\" from Service Module Loader Caused by: java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ClientConnectionManager from [Module \"deployment.ESM2.war:main\" from Service Module Loader]"}} here is the entry from the POM: org.apache.httpcomponents httpclient 4.2.1 provided The jar is already in the Wildfly modules directory, hence the provided scope. How do I properly add and configure a …
tagged with: httpclient
accepted answer: http://stackoverflow.com/a/27517951
score: 2
tagged with: classnotfoundexception
type: AnsweredQuestion

http://stackoverflow.com/a/27593609
has comment: http://stackoverflow.com/comment/43718473
score: 1
answers question: http://stackoverflow.com/q/27495318
downvote count: 0
has comment: http://stackoverflow.com/comment/43707976
has comment: http://stackoverflow.com/comment/43718270
type: Answer
has comment: http://stackoverflow.com/comment/43730571
has comment: http://stackoverflow.com/comment/43720887
has comment: http://stackoverflow.com/comment/43708006
upvote count: 1
has body: edit: the problem is you are not capturing the move set, the whole 4 deep move set, ie the lowest move set going 4 deep for every piece on the board and then deciding which one to use for that first move of the lowest cost set, you are only finding the very lowest move, which in some cases can be the 2nd, 3rd, or 4th move. if that move is returned there is no possible way to actually complete the move since you do not capture the preceding moves of the board. private static final int INF = Integer.MAX_VALUE; private static final int DEPTH = 4; private Move[] best4depthmove = new Move[DEPTH]; private int[] score4deep = new int[DEPTH]; public static final Move getMove(Move previous) { for(int x = 0; x &lt; DEPTH; x++) { best4depthmove[x] = null; score4deep[x] = 0; } negamax(previous, 0); return best4depthmove[0]; } private static final negamax(Move move, int depth) { int newscore = 0; if(depth &lt; DEPTH) { List&lt;Move&gt; moves = Engine.getMoves(move); for(Move m : moves) { newscore = MoveEvaluators.evaluate(m); if(newscore &gt; score4deep[depth]) { score4deep[depth] = newscore; best4depthmove[depth] = m; } negamax(m, depth+1); } } } This is all I could figure out and it should recursively go through every single possible move. hell this could probably work for any depth as long as you have the memory capacity to handle the recursive calls.

http://stackoverflow.com/q/27555663
has title: Java: Can I use Redis db to create Priority queues and the priority is set according to the value of the key in the data set
upvote count: 3
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27565044
tagged with: java
tagged with: queue
possible better answer: http://stackoverflow.com/a/39179508
has body: I am new to Redis. I want to use priority queues in Redis via Java client. I will have a set of key value pairs. And use this as a priority queue. The data set contains keys and its corresponding values. example [a:1,b:1,c:1]. The value field will represent the number of times the key is present in the data set. If another key "a" is inserted into the data set, then it becomes [a:2,b:1,c:1]. Here comes the priority. The most of keys present in the set will be of highest priority, in the example its [a], and it should be at the top of the queue. So when I pop the queue, the element with highest priority should pop out. Also if the data set looks like this [a:2,b:2,c:2], then I want to pick the random one to pop out of the queue. Since my data set will be of key, value pair I want to use Redis[you may suggest a better one].
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/39179508
has comment: http://stackoverflow.com/comment/43544684
downvote count: 0
has comment: http://stackoverflow.com/comment/43537865
favorite count: 0
accepted answer: http://stackoverflow.com/a/27565044
tagged with: redis
has comment: http://stackoverflow.com/comment/43537715

http://stackoverflow.com/comment/96311611
score: 0
type: Comment
comment on: http://stackoverflow.com/a/51048713
type: AnswerComment
has text: Hi. I am not sure how to implement the formation of the consent strings: if I use the Readme instructions, I still have to assign: cmpId, cmpVersion, consentScreenID, maxVendorId, etc. Do you actually have the values of these variables, or even better, the consent strings, for Flurry ads? Can you send me a copy? Thanks

http://stackoverflow.com/comment/43432932
score: 0
has text: are you sure you got a numeric text in that cell? I recommend surrounding with try catch and see the values.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27501205

http://stackoverflow.com/comment/43437723
has text: Can you add the code snippet please ?
comment on: http://stackoverflow.com/q/27503823
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27558665
has comment: http://stackoverflow.com/comment/43543801
answers question: http://stackoverflow.com/q/27558608
score: -1
has comment: http://stackoverflow.com/comment/43543852
downvote count: 1
type: Answer
has body: In your intent you din't specified which class it should go. In your Add_Income method: Intent intent = new Intent(this, &lt;Put your destination class&gt;.class); intent.putExtra("X", Double.toString(IAmount)); setResult(RESULT_OK, intent); startActivity(intent); finish();
upvote count: 0
has comment: http://stackoverflow.com/comment/43543775

http://stackoverflow.com/a/27559143
score: 0
answers question: http://stackoverflow.com/q/27551868
has body: Fortunately I was pointed in the correct direction by the comments - it was actually two different problems at the same time. The post action was being handled by my login controller, not spring security. So, I deleted the post method. Additionally, the post was not being called correctly or passed the correct parameters - so I changed the action to th:action="@{/j_spring_security_check}" and the inputs to j_username and j_password. Thanks @PatrickLC and @M.Deinum.
type: Answer

http://stackoverflow.com/q/27626744
downvote count: 1
has body: I have code that schedules one-time tasks to execute and does this over and over. It looks something like this. public static void main(String[] args) { while(true) { .... TimerTask closeTask = new CloseTask(cli); Timer timer = new Timer(true); timer.schedule(closeTask, (long) (iPeriod * 60 * 1000)); ... } } public class CloseTask extends TimerTask { Client client; CloseTask(Client in_client) { client = in_client; } public void run() { try { for(int iRetries = 0; state == OPEN; iRetries++) { logger.log_trade_line_grablock( "Thread " + Thread.currentThread().getId() + ": About to send message", true, true, true, true, true); client.send_mesg("close"); logger.log_trade_line_grablock( "Waiting 5 seconds before retrying ", true, true, true, true, true); Thread.sleep(5000); } } catch (Exception e) { e.printStackTrace(); } } } The intent of the run() method in the CloseTask class is to loop until the state variable changes from OPEN state to something else. However, intermittently the timer threads simply disappear, while state still equals OPEN, which I know by printing out all the thread ID's of the currently running threads every 5 minutes. So my questions: 1) The only explanation I can think of is that the CloseTask object is throwing uncaught exceptions. Is that correct? 2) If 1) is correct why isn't my try catch block catching these exceptions? 3) If 1) is correct is there a way to catch these exception that slip through uncaught? Thanks for any insight into this issue.
has title: Why are Java Timer threads disappearing?
favorite count: 0
has comment: http://stackoverflow.com/comment/43674076
has answer: http://stackoverflow.com/a/27626848
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43674146
has comment: http://stackoverflow.com/comment/43674097
score: 2
tagged with: multithreading
tagged with: timertask
type: Question
has comment: http://stackoverflow.com/comment/43674116
has comment: http://stackoverflow.com/comment/43674071
tagged with: java
has answer: http://stackoverflow.com/a/27627055
upvote count: 3
answer count: 2

http://stackoverflow.com/a/27513829
answers question: http://stackoverflow.com/q/27513282
score: 0
type: Answer
has body: I use this code in my current project, hope it's works for you too Map&lt;String, String&gt; kvPairs = new HashMap&lt;String, String&gt;(); kvPairs.put("regid", reg); HttpClient httpclient = this.getNewHttpClient(); HttpPost httppost = new HttpPost("http://bubbledev.com.br/gcm/getdevice.php"); if (kvPairs != null &amp;&amp; kvPairs.isEmpty() == false) { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(kvPairs.size()); String k, v; Iterator&lt;String&gt; itKeys = kvPairs.keySet().iterator(); while (itKeys.hasNext()) { k = itKeys.next(); v = kvPairs.get(k); nameValuePairs.add(new BasicNameValuePair(k, v)); } httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); } HttpResponse response; response = httpclient.execute(httppost); String responseString = EntityUtils.toString(response.getEntity()); Also need this method in your class public static HttpClient getNewHttpClient() { try { KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); SSLSocketFactory sf = new RecorridoSSL(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(params, HTTP.UTF_8); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https", sf, 443)); ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry); return new DefaultHttpClient(ccm, params); } catch (Exception e) { return new DefaultHttpClient(); } } hope I don't forgot anything, other way tell me

http://stackoverflow.com/comment/92156011
comment on: http://stackoverflow.com/a/27539967
has text: I know `WebApplicationContext` is a subtype of `ApplicationContext`. However I want to know what exactly `ContextLoaderListener` creates, `ApplicationContext` or `WebApplicationContext`. If it creates `ApplicationContext` instance, its definitely not equivalent to `WebApplicationContext`, as former does not provide functionality of later. Is it like, precisely talking, `ContextLoaderListener` creates `WebApplicationContext` which also provides functionalities of `ApplicationContext`, being subtype of it? [continued...]
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/27550960
answers question: http://stackoverflow.com/q/27549864
type: Answer
has comment: http://stackoverflow.com/comment/103402159
score: 8
has body: You can memoize any function with Java 8's MethodHandles and lambdas if you're willing to give up type safety on the parameters: public interface MemoizedFunction&lt;V&gt; { V call(Object... args); } private static class ArgList { public Object[] args; @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ArgList)) { return false; } ArgList argList = (ArgList) o; // Probably incorrect - comparing Object[] arrays with Arrays.equals return Arrays.equals(args, argList.args); } @Override public int hashCode() { return args != null ? Arrays.hashCode(args) : 0; } } public static &lt;V&gt; MemoizedFunction&lt;V&gt; memoizeFunction(Class&lt;? super V&gt; returnType, Method method) throws IllegalAccessException { final Map&lt;ArgList, V&gt; memoizedCalls = new HashMap&lt;&gt;(); MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodHandle methodHandle = lookup.unreflect(method) .asSpreader(Object[].class, method.getParameterCount()); return args -&gt; { ArgList argList = new ArgList(); argList.args = args; return memoizedCalls.computeIfAbsent(argList, argList2 -&gt; { try { //noinspection unchecked return (V) methodHandle.invoke(args); } catch (Throwable throwable) { throw new RuntimeException(throwable); } }); }; } Working Example This creates a variable-arity lambda that encloses the function and is almost as fast as calling the function directly (i.e., no reflection happens inside of call(Object...args)) after the lambda is constructed since we're using MethodHandle.invoke() instead of Method.invoke(). You can still do this without lambdas (replace with anonymous classes) and MethodHandles (replace with Method.invoke), but there will be performance penalties that make this less attractive for performance-conscious code.
has comment: http://stackoverflow.com/comment/103566265
downvote count: 0
has comment: http://stackoverflow.com/comment/87176904
has comment: http://stackoverflow.com/comment/87298878
upvote count: 8

http://stackoverflow.com/comment/43499373
comment on: http://stackoverflow.com/q/27534697
score: 0
type: Comment
has text: I also tried setting an .expireAfterWrite(10, TimeUnit.MINUTES) in the builder and it still was hitting the load method everytime for the same key.
type: QuestionComment

http://stackoverflow.com/comment/43567963
type: Comment
comment on: http://stackoverflow.com/a/27571235
has text: I changed what you wrote in url, add <context:component-scan base-package="your.package.name" /> in applicationContext.xml, not work, same error
type: AnswerComment
score: 0

http://stackoverflow.com/a/27502055
upvote count: 4
has comment: http://stackoverflow.com/comment/43434591
answers question: http://stackoverflow.com/q/27501994
score: 3
has body: You are creating a new OperationClass object every time you enter a number: if (a == 1) { new OperationClass().addPerson(); //Creating a new object } if (a == 2) { new OperationClass().listPerson(); //Creating a new object } if (a == 3) { new OperationClass().deletePerson(); //Creating a new object } if (a == 4) { System.out.println("Thanks for using the program"); } Try calling the methods on the object you already have: if (a == 1) { addPerson(); } if (a == 2) { listPerson(); } if (a == 3) { deletePerson(); } if (a == 4) { System.out.println("Thanks for using the program"); } This will call the methods on the object you create in your main(). edit: As pointed out, this will not quite work since your operation() method is static. I would suggest to either make this method non-static (and therefore an instance method): public void operation() { //Your operation() code } or move operation()s code to a constructor of OperationClass alltogether so that it's code is ran right when you create an object of that class: public OperationClass() { //Your operation() code }
has comment: http://stackoverflow.com/comment/43434639
downvote count: 1
type: Answer

http://stackoverflow.com/a/27534264
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27534179
has body: The simplest answer is usually the best: Use try/catch if it's your program logic > the highest caller. Use throws if it's a supplying method or a library > just one step of many. In the case of a library you might also want to wrap a library specific exception around the one you get. Best is to have a look at the Oracle docu page about Exceptions: http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html
upvote count: 2

http://stackoverflow.com/comment/43655745
type: Comment
has text: Actually, I have problem in accessing the infile.txt. Config file is reading fine. With the code I use, I can edit it even after comiling and creating jar. (Pl correct me, if using config file out, is bad idea).
comment on: http://stackoverflow.com/a/27616649
type: AnswerComment
score: 0

password-encryption
tags question: http://stackoverflow.com/q/27567139
tag name: password-encryption
type: Tag
tags question: http://stackoverflow.com/q/27619284

http://stackoverflow.com/comment/43529975
type: QuestionComment
has text: you do realize the error is nowhere near the code you posted, right?
comment on: http://stackoverflow.com/q/27551843
score: 1
type: Comment

http://stackoverflow.com/q/27547950
has title: Multiple files transfer protocol with "authentication" from Android to Server
has answer: http://stackoverflow.com/a/27567604
has body: I'm a newbie programmer looking for a way to implement a simple file transfer protocol on Android. Problem: Several Android phones need to connect to a server to receive/send a series of XML files saved in internal storage. The server needs to know which phone is requesting a connection so that it can save the files in the correct folder. Possible solution/algorithm: There are various tutorials/examples on how to send a file to a server, but none of them seem to implement some kind of "authentication". Ideally I would like to implement the following (I'll use a metaphor): Phone: Hello. Server: Hi. Who are you and what do you want? [send/receive] Phone A: I'm phone A and I would like to send files. Server: How many files do you want to send, Phone A? Phone A: 6 files, [+extra data like total size or whatever] Server: Alright, you can begin the transfer. Phone A: Transfers... Server: I've succesfully received 6 files, have a good day. [stores the files in a PhoneA folder] Phone A: Bye! [closes connection] I realise this could very likely be made a lot more efficient, but I don't know where to begin... Is it even possible to initiate a connection with a server and interact multiple times while waiting for responses? Question : Could anyone push me in the right direction somehow? Do I write my own protocol or can this be done with standard functionality? What are the best/easiest existing protocols for this kind of implementation? I've found this article interesting but I don't see how it could be used for multiple files with authentication Any help would be much appreciated!
accepted answer: http://stackoverflow.com/a/27549372
answer count: 2
linked to: http://stackoverflow.com/q/4078642
downvote count: 0
possible better answer: http://stackoverflow.com/a/27567604
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/24262851
type: AnsweredQuestion
score: 2
tagged with: network-protocols
upvote count: 2
has answer: http://stackoverflow.com/a/27549372
tagged with: java
type: Question

http://stackoverflow.com/comment/43662059
type: Comment
comment on: http://stackoverflow.com/a/27620554
type: AnswerComment
has text: How can i pass that reference to AsyncTask?
score: 0

http://stackoverflow.com/q/27495618
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27505152
has comment: http://stackoverflow.com/comment/43441061
has body: I have the following java code public class QuestionBuilder { private QuestionBuilder(){} static HashMap&lt;Long,Class&lt;? extends Question&gt;&gt; questionIdMap; static{ questionIdMap = new HashMap(); questionIdMap.put(1L, LicenseNumberQuestion.class); questionIdMap.put(2L, USPQuestion.class); } static Question getQuestion(long questionId) { if(!questionIdMap.containsKey(questionId)) { throw new BusinessProfileInputException("Add an id to question class map entry"); } return questionIdMap.get(questionId).newInstance(); } } and I would like my getQuestion method to return me a new instance of the class that was specified as a value in the map as is intended via my code. Howerver the last line of code does not compile : return questionIdMap.get(questionId).newInstance(); Am I thinking of this wrongly? i.e. is there a better way to approach this?
tagged with: generics
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27495974
accepted answer: http://stackoverflow.com/a/27505152
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27495974
has title: Java instantiate generic hashmap value
has comment: http://stackoverflow.com/comment/43422936

http://stackoverflow.com/a/27510548
has comment: http://stackoverflow.com/comment/43451415
has comment: http://stackoverflow.com/comment/43491306
has comment: http://stackoverflow.com/comment/43473984
score: 1
has comment: http://stackoverflow.com/comment/43463890
upvote count: 1
has comment: http://stackoverflow.com/comment/43451586
answers question: http://stackoverflow.com/q/27510353
has body: Looks like projects is getting serialized out as a map/object, you just need to make it an array of maps or objects. Updated with pseudocode: List&lt;Map&lt;String,String&gt;&gt; rolledupEmps = new ArrayList&lt;Map&lt;String,String&gt;&gt;(); for(Emp emp : emps){ Map&lt;String,String&gt; em = mapper.readValue(emp, HashMap.class); em.put("projectId",em.get("projects")?!=null:em.get("projects").get("projectId"),""); em.put("projectName",em.get("projects")?!=null:em.get("projects").get("projectName"),""); em.remove(""projects""); rolledupEmps.put(em); } return mapper.writeValueAsString(rolledupEmps);
accepted answer of: http://stackoverflow.com/q/27510353
has comment: http://stackoverflow.com/comment/43491854
has comment: http://stackoverflow.com/comment/43471454
has comment: http://stackoverflow.com/comment/43464280
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43491237
has comment: http://stackoverflow.com/comment/43471133
has comment: http://stackoverflow.com/comment/43471370
type: Answer
has comment: http://stackoverflow.com/comment/43451735

http://stackoverflow.com/q/27523290
has comment: http://stackoverflow.com/comment/43475881
has body: I have a simple form to fetch data from user and store to database. This is my simple form: Database Insertion Form Phonebook Surname: Forename: Phone number: And this is DbServlet Servlet: @WebServlet("/DbServlet") public class DbServlet extends HttpServlet { private PreparedStatement ps; private Connection connection; private String URL = "jdbc:mysql://localhost/lib"; @Override public void init() throws ServletException { super.init(); try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(URL, "root", "2323"); } catch (SQLException e) { e.printStackTrace(); System.exit(1); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } } public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException { String surname, forenames, telNum; surname = request.getParameter("Surname"); forenames = request.getParameter("Forenames"); telNum = request.getParameter("PhoneNum"); response.setContentType("text/HTML"); PrintWriter out = response.getWriter(); out.println(" "); out.println(" "); out.println("<TITLE>Servlet + JDBC "); out.println(" "); out.println(" "); String query = "INSERT INTO PhoneNums" + " VALUES('" + surname + "','" + forenames + "','" + telNum + "')"; try { ps = connection.prepareStatement(query); ps.executeUpdate(); JOptionPane.showMessageDialog(null, "Done"); } catch (SQLException sqle) { sqle.printStackTrace(); } out.println(" "); out.println(" "); out.flush(); } @Override public void destroy() { try { connection.close(); } catch (Exception ex) { System.out.println( "Error on closing database!"); ex.printStackTrace(); System.exit(1); } } } When I clicked to submit button in html form, nothing happens, even any exception! MySQL connector jar file is present in the lib folder of Tomcat.
tagged with: java
has comment: http://stackoverflow.com/comment/43475666
has comment: http://stackoverflow.com/comment/43475943
has comment: http://stackoverflow.com/comment/43475665
accepted answer: http://stackoverflow.com/a/27523696
tagged with: servlets
has title: JDBC in servlet
has comment: http://stackoverflow.com/comment/43476496
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/43475688
downvote count: 0
possible better answer: http://stackoverflow.com/a/27523534
favorite count: 0
has answer: http://stackoverflow.com/a/27523534
has comment: http://stackoverflow.com/comment/43475669
type: Question
has comment: http://stackoverflow.com/comment/43475950
upvote count: 2
has answer: http://stackoverflow.com/a/27523696
answer count: 2
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43475888
has comment: http://stackoverflow.com/comment/43476004
has comment: http://stackoverflow.com/comment/43478735

http://stackoverflow.com/a/27483402
downvote count: 0
answers question: http://stackoverflow.com/q/27483228
has comment: http://stackoverflow.com/comment/43399346
has comment: http://stackoverflow.com/comment/43408016
has comment: http://stackoverflow.com/comment/43400041
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43408120
has body: Edit Aparently timers don't always work quite as you'd expect. Please check out the other answer(s) provided in this thread. Original Answer Personally I would use fixed movement by frame instead of variable movement based on how much time passed since the last frame. To implement this you would need a method like update() that updates all the positions and draws the updated view, then call this method periodically using a timer: Timer timer; final int FPS = ... //Number of frames per second final int MS_BETWEEN_UPDATES = 1000/FPS; ActionListener updater = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { update(); } }; void update() { //Update your game here } void startGame() { timer = new Timer(MS_BETWEEN_UPDATES, updater); timer.start(); }
upvote count: 1

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/27475861

chromium-embedded
tags question: http://stackoverflow.com/q/27615378
tag name: chromium-embedded
type: Tag
tags question: http://stackoverflow.com/q/27524240

http://stackoverflow.com/comment/43557262
comment on: http://stackoverflow.com/a/27565983
type: AnswerComment
score: 0
has text: Thanks - this additional variable looks so obvious now... :) Also, thanks for the hint with ternary operator, but when I have width, height and maybe something else based on connectionImage it will be 3x null check, so in this case it will be beter to have if/else or maybe it will be optimized by compiler somehow?
type: Comment

http://stackoverflow.com/q/27595616
has comment: http://stackoverflow.com/comment/43615678
tagged with: java
tagged with: encapsulation
has comment: http://stackoverflow.com/comment/43615242
has comment: http://stackoverflow.com/comment/43617744
has comment: http://stackoverflow.com/comment/43615369
score: 0
has comment: http://stackoverflow.com/comment/43638749
upvote count: 1
has comment: http://stackoverflow.com/comment/43615190
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43615412
has title: Encapsulation - how deeply isolated should the objects be?
has body: I get the general idea of encapsulation in object oriented programming and how it facilitates later code modifications. However I often get confused how far should the isolation of objects go, especially in terms of construction of related objects. My question is how much should two classes of one package know about themselves, both having package visibility, related in a way that one class is to return the other one. For example consider class A and class B, where B is some limited view to A, however not necessarily containing the same type of Collection internally. Consider a practical example, implementing a board game like chess or checkers. Let the board be implemented as a bulk of Paths i.e. a collections of references to Fields that can be a subject of legal movement, from one board edge to the other one. Let Vector be an object that has partial access to that Path, however only to the extent defined by the two Field indexes. Consider subList method analogy. Such Vector is given to the Figure object (e.g. Pawn) that exercises movement and uses that structure to gain information if the movement is possible and to execute movement through methods implementing Figure replacement and Figure captures. To get Vector, Board method is executed that gets appropriate Path and it in turns is to return the Vector. It is the only way to get an Vector object. The question here is how and where should Vector be constructed? There are few scenarios here: Can Path pass whole reference to fields field to Vector constructor or would that be a breach of encapsulation? Should getVector method construct proper container first and just then should it be passed to some dead simple Vector constructor? Or maybe should I put fields to some intermediary Collection not related to any of the two classes' implementations? Here is some code in Java for illustration: class Path { private LinkedList&lt;Field&gt; fields; public Vector getVector(FieldIndex start, FieldIndex end) { /** ... */ } …
answer count: 0
linked to: http://stackoverflow.com/q/26567233
has comment: http://stackoverflow.com/comment/43616337
has comment: http://stackoverflow.com/comment/43615318
downvote count: 1
type: Question

http://stackoverflow.com/q/27625361
type: AnsweredQuestion
tagged with: java
has title: Is it possible to make my android application configurable from setting?
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/27625381
upvote count: 0
answer count: 1
has body: I m developing an android application. I want to make the parameters of my android application configurable from the settings of Android Is it possible to do that? and how I could do it?
has comment: http://stackoverflow.com/comment/43671862
favorite count: 0
tagged with: android
score: -3
accepted answer: http://stackoverflow.com/a/27625381

http://stackoverflow.com/comment/43608812
type: AnswerComment
has text: I would add an `else` case at the bottom to catch any unexpected value ([defensive programming](http://en.m.wikipedia.org/wiki/Defensive_programming)).
type: Comment
comment on: http://stackoverflow.com/a/27589769
score: 3

http://stackoverflow.com/a/36586585
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27615842
has body: Android lint to the rescue: http://developer.android.com/tools/help/lint.html You get this for free in Android Studio builds, but also from the command line via Gradle.
downvote count: 0

http://stackoverflow.com/comment/66707121
type: AnswerComment
comment on: http://stackoverflow.com/a/27603609
type: Comment
has text: @Grammin Thanks for the update. Please add the Elasticsearch version that you used in you comment (this will help others when testing).
score: 0

http://stackoverflow.com/q/27563741
has comment: http://stackoverflow.com/comment/43554125
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27563827
linked to: http://stackoverflow.com/q/15548425
type: AnsweredQuestion
has body: I am now using eclipse luna(earlier used is juno i shifted system and now use this ).Juno provides a cancel button but this is a new envoirnment for me.Inside this i was trying to create emulator.But i cannot..After that i am looking to close it,but no close button (cancel button)found at here.Can anyone please help me how to close it? Any answer will be really helpfull. Advance Thanks
possible better answer: http://stackoverflow.com/a/27564287
has comment: http://stackoverflow.com/comment/43554297
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27564287
tagged with: android-emulator
type: Question
has comment: http://stackoverflow.com/comment/43553040
tagged with: adt
accepted answer: http://stackoverflow.com/a/27563827
tagged with: eclipse
answer count: 2
has title: How to close AVD Manager in eclipse Luna
score: 2

http://stackoverflow.com/a/27493949
type: Answer
has body: Make you methods static, or instantiate an instance of your class and call your methods with the instance. Also, your arguments are incorrect. Since your first method takes an array, and your second appears to take the same array (and the result of the first method call) like HW_PrimitiveArrays arr = new HW_PrimitiveArrays(); mean = arr.getAverage(arrlist); System.out.println(mean); System.out.println(arr.standardDeviation(arrlist, mean));
upvote count: 3
has comment: http://stackoverflow.com/comment/43419813
downvote count: 0
answers question: http://stackoverflow.com/q/27493903
has comment: http://stackoverflow.com/comment/43419919
score: 3
has comment: http://stackoverflow.com/comment/43419902
has comment: http://stackoverflow.com/comment/43419844

http://stackoverflow.com/q/27525356
tagged with: spring-jdbc
tagged with: java
has title: Unexpected IncorrectResultSizeDataAccessException when querying Oracle db
tagged with: jdbctemplate
type: Question
has body: I have following table: create table INTERNATIONALIZATION ( ID number not null unique, LANG char(2) not null, EXT_ID number not null, EXT_COLUMN char(32) not null, EXT_NAME char(32) not null, TRANS_VAL nvarchar2(512) not null ); And following code that aims to retrieve one and only one result from it (I am 100% sure that record exists). public Optional&lt;String&gt; getTranslation(long idSkill, Locale lang, String extColumn, String extName) { try { return Optional.of(jdbcTemplate.queryForObject("select TRANS_VAL from INTERNATIONALIZATION where ext_id = ? and lang = ? and ext_column = ? and ext_name = ?", String.class, idSkill, lang.toLanguageTag(), extColumn, extName)); } catch (IncorrectResultSizeDataAccessException ex) { return Optional.empty(); } } The problem is that when I always get the Optional.empty() as the IncorrectResultSizeDataAccessException is thrown, because no records are found. When I execute this sql query in Oracle SQL Developer, I get the correct result. What is causing this problem? Could it have something to do with nvarchar2 type of desired column?
linked to: http://stackoverflow.com/q/10606229
tagged with: nvarchar
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/27527305
has comment: http://stackoverflow.com/comment/43479701

http://stackoverflow.com/comment/43658650
score: 0
type: AnswerComment
has text: Linear Layout on as parent . than relative layouts as its child with equal height and width. When user clicks on relative layout it adds the imageview in it. Everything is working fine now. Just one thing left On corner of layout the image gets small .
type: Comment
comment on: http://stackoverflow.com/a/27608320

http://stackoverflow.com/q/27586152
type: UnansweredQuestion
tagged with: inheritance
has answer: http://stackoverflow.com/a/27586191
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27586160
has body: This is the (abridged) super class: public class Account { private double bal; //The current balance private int accnum; //The account number public Account(int a) { bal=0.0; accnum=a; } } The subclass: public class SavingsAccount extends Account{ private static final double INTEREST_RATE = 5; // Interest amount for savings account public SavingsAccount(int a) { super(a); } public void addInterest(){ double interest = getBalance()/100*INTEREST_RATE; deposit(interest); } } And the main code: public class AccountMain { public static void main(String[] args) { // Declare Variables Account myAccount = new SavingsAccount(500); // Do stuff myAccount.deposit(1000); System.out.println(myAccount.toString()); ((SavingsAccount) myAccount).addInterest(); System.out.println(myAccount.toString()); } } Why am I having to cast myAccount as a SavingsAccount when it's been declared as a SavingsAccount? Everything I've read implies that by declaring the new object as the subclass should make all the superclass and subclass methods available. I feel that I'm missing something but can't find what.
tagged with: java
score: 0
has title: Subclass object needing to be type cast as the subclass to access subclass methods

http://stackoverflow.com/a/27535798
has comment: http://stackoverflow.com/comment/43500694
type: Answer
accepted answer of: http://stackoverflow.com/q/27534092
score: 1
has body: There seem to be several problems with your DFS algorithm: by creating a new visited list in each recursive call, it always contains only the current node you are only adding nodes to this.path, but never removing nodes that did not lead to the goal you never check whether one of your recursive calls reached the goal, thus adding more nodes to a perfectly good path To fix this, you should remove the current node from this.path at the end of the method, i.e. in case no path has been found. Also, you can just drop the visited array and just check whether the next node is already in the path. That's not quite as fast, but should suffice for your case and make the code less complex. Also, the method should return true or false depending on whether it found a path. Try this (not tested, but should work). public boolean dfsPath(int i) { this.path.add(i); // add current node to path if (i == this.sink) { return true; // if current node is sink, return true // this.path contains nodes from source to sink } for (int j = 0; j &lt; this.edgeCapacities.length; j++) { if (this.edgeCapacities[i][j] != 0 &amp;&amp; ! this.path.contains(j)) { if (dfsPath(j)) { return true; // found a path -&gt; search no further } } } this.path.remove(this.path.size() - 1); // pop last node return false; // no path found } Note that I also moved the sink-check out of the loop. This is purely a matter of taste, but it makes the code a bit simpler, as you don't have to add the sink node separately to the path.
upvote count: 1
answers question: http://stackoverflow.com/q/27534092
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43576998
score: 1
comment on: http://stackoverflow.com/q/27575686
type: Comment
type: QuestionComment
has text: manifest seems OK! If the activity is defined in that package (case sensitive) it should definitely work.

http://stackoverflow.com/comment/43557166
type: Comment
has text: i have added the output i am using
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27565446

http://stackoverflow.com/comment/43396259
type: AnswerComment
comment on: http://stackoverflow.com/a/27480021
type: Comment
score: 0
has text: The *host* 'MUST NOT' do it at all. Nothing to do with Java whatsoever.

http://stackoverflow.com/a/27702855
score: 1
has body: I resolved it finally. The thing is: modify gradle-wrapper.properties to make gradle wrapper use gradle 2.2.1(latest now) distributionUrl=http\://downloads.gradle.org/distributions/gradle-2.2.1-bin.zip sonarRunner plugin version error. configure it in build.gradle: sonarRunner { toolVersion = '2.4' } jacoco { toolVersion = '0.7.2.201409121644' } after configure above. the error info is 'DB connection error' - cannot build connection with sonar default DB. In fact, I use mysql to sonar. so add below configure in build.gradle: sonarRunner { sonarProperties { property "sonar.host.url", "http://localhost:9000" property "sonar.jdbc.url", "jdbc:mysql://localhost:3306/sonar" property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver" property "sonar.jdbc.username", “sonar" property "sonar.jdbc.password", “sonar" } } Why did I spent so long days to fix it? - I am lack of knowledge of Gradle, Gradlew and our multiple project. So it should be easy if I am very familiar with Gradle how to work. reference docs: http://www.gradle.org/docs/current/userguide/sonar_runner_plugin.html http://www.gradle.org/docs/current/userguide/sonar_plugin.html Finally, thanks you read and answer my questions. Thanks very much!
downvote count: 0
answers question: http://stackoverflow.com/q/27598036
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43601636
type: QuestionComment
comment on: http://stackoverflow.com/q/27588764
has text: `System.setOut(null); System.setErr(null);` - for the truly evil developer.
type: Comment
score: 4

http://stackoverflow.com/q/27618195
type: Question
has body: Sorry guys, maybe a silly question. But I need to implement some additional logic for authentication and authorization in my web app and I've not clear in mind where AuthenticationProvider and AuthenticationEntryPoint must be used. Looking for some examples I somethimes find that an AuthenticationEntryPoint is omitted in security:http section. But there are situations where also AuthenticationProvider is omitted (a default instance is provided by the framework?) and only a UserDetailsService implementation is needed. Please, can you clarify some basic concepts?
tagged with: spring-security
has title: Differences between AuthenticationProvider and AuthenticationEntryPoint
answer count: 1
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27620065
tagged with: spring
tagged with: java

http://stackoverflow.com/a/27749390
has body: I think you can't return a value from a procedure call. It's possible set a value in an object like a pojo or a map like your example but, i think if you at the same sql transaction execute a query after the updates like this: SELECT sql%rowcount FROM DUAL; You can get the number of affected rows like a ResultSet.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27618710
has comment: http://stackoverflow.com/comment/43925222
has comment: http://stackoverflow.com/comment/43921462
has comment: http://stackoverflow.com/comment/43973928
upvote count: 1

http://stackoverflow.com/comment/43439005
comment on: http://stackoverflow.com/q/27504491
type: QuestionComment
type: Comment
has text: Don't think you can do it like this. You would either need to use Ajax or do a form resubmission.
score: 0

http://stackoverflow.com/comment/43476224
type: Comment
has text: that won't help...The encoding of the var `query` is ambiguous. I need to have it well encoded in the line `solrSearchService.getSearchResults("http://localhost:8983/solr/GE/ .....` to send a request to another server
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27523657

http://stackoverflow.com/q/27638343
possible better answer: http://stackoverflow.com/a/27638372
has answer: http://stackoverflow.com/a/45559478
has title: How to remove zeros from int array?
accepted answer: http://stackoverflow.com/a/27638716
tagged with: arrays
downvote count: 0
tagged with: int
answer count: 3
has body: This is my array: int[] test= new int[] {1,0,1,0,0,0,0,0,0,0} Now I need to remove all the zeros from this array so it will display like this: Output : {1,1} I tried this code from this link-StackOverFlow but didn't work for me. int j = 0; for (int i = 0; i &lt; test.length; i++) { if (test[i] != 0) test[j++] = test[i]; } int[] newArray = new int[j]; System.arraycopy(test, 0, newArray, 0, j); return newArray; Please help me to solve this.
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43695470
has answer: http://stackoverflow.com/a/27638716
linked to: http://stackoverflow.com/q/8777217
has comment: http://stackoverflow.com/comment/43695821
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43695706
has answer: http://stackoverflow.com/a/27638372
tagged with: java
has comment: http://stackoverflow.com/comment/43695866
has comment: http://stackoverflow.com/comment/43695553
type: Question

http://stackoverflow.com/comment/43640759
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27608928
has text: Just as any other bean... Why would it be different.
score: 0

http://stackoverflow.com/comment/43486572
type: Comment
comment on: http://stackoverflow.com/q/27524636
score: 0
type: QuestionComment
has text: That's strange. I used the exact same configuration as you did, but sadly I still get the same result: "Erlaubt!". Could it have to do something with the Java version I am using? I am using JDK8.

http://stackoverflow.com/q/27612569
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27631013
linked to: http://stackoverflow.com/q/6255106
tagged with: java
type: Question
has title: Adding a selection to the Choice list in the 'paint' method is adding multiple records of the same in the list
has body: I have created an applet with two choice controls. One of the choice control is the OS name and the other is the browser name. I have added the item listeners for both these choice controls, so that we can detect the option selected for each of the choice control. The code adds another OS entry ("Windows 10")in the OS choice control if the browser selected in Firefox. Somehow when I select the browser as firefox , multiple entries of "Windows 10' are added in the OS choice control. Can someone please help me? SingleClick package p1; import java.applet.Applet; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; public class SingleClick implements ItemListener { Applet currentApplet; @Override public void itemStateChanged(ItemEvent arg0) { // TODO Auto-generated method stub this.currentApplet.repaint(); } public void appletLink(Applet test) { this.currentApplet = test; } } OSBrowserSelector package p1; import java.applet.Applet; import java.awt.Button; import java.awt.Checkbox; import java.awt.CheckboxGroup; import java.awt.Choice; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Frame; import java.awt.Graphics; import java.awt.GraphicsEnvironment; import java.awt.Label; import java.awt.List; import java.awt.event.ItemListener; public class OSBrowserSelector extends Applet { Choice os; Choice browser; public void init() { os = new Choice(); browser = new Choice(); // Set size of the applet window this.setSize(500, 500); // Add the operating systems os.add("XP"); os.add("Windows 7"); os.add("Macos"); //Add the browsers browser.add("Chrome"); browser.add("firefox"); browser.add("ie"); //Make the controls visible this.add(os); this.add(browser); // Set the listener for the selection //SingleClick class implements the ItemListener interface SingleClick l = new SingleClick(); l.appletLink(this); // Add the listener os.addItemListener(l); browser.addItemListener(l); } public void start() { } public void paint(Graphic…
has comment: http://stackoverflow.com/comment/43682356
tagged with: awt
score: 0
tagged with: choicefield
answer count: 1
tagged with: applet

http://stackoverflow.com/comment/43517110
comment on: http://stackoverflow.com/a/27544951
has text: How can i compress and decompress png files?can you please tell me where can i get the code or any resources?By using JAI can i get decompressed image of jpeg?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27505502
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/27505560
has comment: http://stackoverflow.com/comment/43468054
answer count: 6
linked to: http://stackoverflow.com/q/2396493
has answer: http://stackoverflow.com/a/27505545
tagged with: class
accepted answer: http://stackoverflow.com/a/27505546
has comment: http://stackoverflow.com/comment/43441341
possible better answer: http://stackoverflow.com/a/27505545
linked to: http://stackoverflow.com/q/3611728
has comment: http://stackoverflow.com/comment/43441349
has answer: http://stackoverflow.com/a/27505722
favorite count: 0
has answer: http://stackoverflow.com/a/27505813
has comment: http://stackoverflow.com/comment/43441137
has comment: http://stackoverflow.com/comment/43441000
upvote count: 2
linked to: http://stackoverflow.com/q/2818239
has answer: http://stackoverflow.com/a/27505917
has body: I have read many sites and then decided to ask this question on stackoverflow, question is pretty basic What is .classpath file? Is this file related to the Java project or Eclipse? Some people think that this file related to Eclipse and some thinks that it is related to project?
has comment: http://stackoverflow.com/comment/43440961
type: AnsweredQuestion
score: -5
has title: .classpath file in Java related to Java or Eclipse
tagged with: java
has comment: http://stackoverflow.com/comment/43440983
has answer: http://stackoverflow.com/a/27505546
tagged with: eclipse

http://stackoverflow.com/q/27626181
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: fullcalendar
type: Question
has answer: http://stackoverflow.com/a/27627264
has title: Making Upcalls from JavaScript to JavaFX
answer count: 1
tagged with: javascript
score: 0
accepted answer: http://stackoverflow.com/a/27627264
tagged with: webview
has body: I'm trying to call a JavaScript function testCheckMate from Java but I get error: Exception in thread "JavaFX Application Thread" netscape.javascript.JSException: SyntaxError: Unexpected EOF The WebView is holding FullCalendar. How do I go about calling JQuery/ Javascript from Java? Thank you all in advance.

http://stackoverflow.com/q/27509585
score: 4
accepted answer: http://stackoverflow.com/a/27513728
upvote count: 4
has title: Spring Batch - skippable exception in a TaskletStep
answer count: 2
possible better answer: http://stackoverflow.com/a/27510000
downvote count: 0
favorite count: 0
tagged with: spring-batch
linked to: http://stackoverflow.com/q/47788407
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27513728
type: Question
has body: I am trying to cause a job not to have BatchStatus.FAILED if a certain exception occurs. The docs talk about using skippable-exception-classes within &lt;chunk&gt;, but how can I do the same within a TaskletStep? The below code does not work: &lt;batch:step id="sendEmailStep"&gt; &lt;batch:tasklet&gt; &lt;bean class="com.myproject.SendEmail" scope="step" autowire="byType"&gt; &lt;batch:skippable-exception-classes&gt; &lt;batch:include class="org.springframework.mail.MailException" /&gt; &lt;/batch:skippable-exception-classes&gt; &lt;/bean&gt; &lt;/batch:tasklet&gt; &lt;/batch:step&gt;
tagged with: java
has answer: http://stackoverflow.com/a/27510000

http://stackoverflow.com/a/27602302
score: 0
has body: As any Java programmer knows, you can't put an int (or other primitive value) into a collection. Collections can only hold object references, so you have to box primitive values into the appropriate wrapper class (which is Integer in the case of int). When you take the object out of the collection, you get the Integer that you put in; if you need an int, you must unbox the Integer using the intValue method. All of this boxing and unboxing is a pain, and clutters up your code. The autoboxing and unboxing feature automates the process, eliminating the pain and the clutter. refer java docs for more details
type: Answer
answers question: http://stackoverflow.com/q/27602193

http://stackoverflow.com/comment/43464436
comment on: http://stackoverflow.com/q/27515572
type: Comment
type: QuestionComment
has text: are you sure lista is not empty?
score: 0

http://stackoverflow.com/comment/43692384
has text: Its working ,But the out put is string type.I need as java.util.date type
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27636661
type: Comment

http://stackoverflow.com/comment/43591548
comment on: http://stackoverflow.com/a/27583043
score: 0
type: AnswerComment
type: Comment
has text: It's pretty common, yes. You get used to it over time. There are also unnecessary parentheses in the original, this would be enough: `return o instanceof SetType && (i == ((SetType)o).i);` Some IDE can simplify expressions automatically for you into this form (for example IntelliJ)

http://stackoverflow.com/comment/43527565
has text: Maybe you're correctly using a **bound parameter** (using the **?** placeholder).
type: Comment
comment on: http://stackoverflow.com/q/27549924
score: 0
type: QuestionComment

dynamic
tags question: http://stackoverflow.com/q/27624989
tag name: dynamic
tags question: http://stackoverflow.com/q/27630305
tags question: http://stackoverflow.com/q/27623592
tags question: http://stackoverflow.com/q/27497758
type: Tag

http://stackoverflow.com/comment/43431852
type: QuestionComment
has text: Side note: `foo` can only be true or false. So your code should be `if (foo) {..} else {...}`.
type: Comment
comment on: http://stackoverflow.com/q/27490799
score: 0

http://stackoverflow.com/a/27563505
has comment: http://stackoverflow.com/comment/43552778
upvote count: 4
answers question: http://stackoverflow.com/q/27563353
downvote count: 0
has comment: http://stackoverflow.com/comment/43552817
type: Answer
has body: Why do this with one regex? Use several tools: private static final Pattern SEMICOLON = Pattern.compile(";"); private static final Pattern GRAYSCALE = Pattern.compile("GRAYSCALE=\\((\\d+\\))"); // Test... final String[] splits = SEMICOLON.split(input); Matcher matcher; boolean found = false; String inParens; int number; for (final String candidate: splits) { matcher = GRAYSCALE.matcher(candidate); if (!matcher.find()) continue; inParens = matcher.group(1); try { number = Integer.parseInt(inParens); break; } catch (NumberFormatException e) { // overflow continue; } } // test "number" here If you use Java 8, here is some lambda abuse (with SEMICOLON and GRAYSCALE defined as above): final Optional&lt;String&gt; opt = SEMICOLON.splitAsStream().map(GRAYSCALE::matcher) .filter(Matcher::find).map(m -&gt; m.group(1)).findFirst(); if (!opt.isPresent()) { // no luck } try { Integer.parseInt(opt.get()); // Found at least an integer } catch (NumberFormatException e) { // overflow }
score: 4

http://stackoverflow.com/comment/43551492
has text: I haven't tried anything so far because I do not know how to start. I can't think of any idead on how to talk to the existing thread from the new acitivity? The thread is still running after I close the first activity isn't it ?
comment on: http://stackoverflow.com/q/27562799
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43525915
type: Comment
score: 1
has text: Look into proxying mechanisms with Java. You can create a proxy of an object which intercepts method calls, storing the return value. If you call the method with the same arguments as a previous invocation, you'd get the same result without having to invoke the underlying method. Spring caching does this for you.
comment on: http://stackoverflow.com/q/27549864
type: QuestionComment

http://stackoverflow.com/a/27488234
answers question: http://stackoverflow.com/q/27487979
has body: Both JVM may use java.net.Socket or java.net.ServerSocket in any way for communication and there is no way to intercept anything here. You may intercept any HTTP traffic if you connect thru a (transparent) proxy. The proxy will intercept anything and you may modify any content.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/79897551
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43416308

http://stackoverflow.com/q/27579881
has title: @Transactional not working giving exception to add @Transactional
type: Question
upvote count: 2
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/27579896
favorite count: 0
tagged with: playframework-2.2
type: UnansweredQuestion
tagged with: annotations
has body: I am using jpa with Play 2.2.1 java .I have a method which finds all the the jobseekers My controller function @Transactional public static Result index() { return ok(views.html.admin.jobseeker.render("Your new application is ready.", Jobseekers.all())); } and model method public static List&lt;Jobseekers&gt; all() { @SuppressWarnings("unchecked") List&lt;Jobseekers&gt; el = JPA.em().createQuery("from Jobseekers order by id").getResultList(); return el; } But i am getting exception [RuntimeException: No EntityManager bound to this thread. Try to annotate your action method with @play.db.jpa.Transactional] I dont know why its giving this error even though I have added @Transactional Can anybody help me?? Thanks
score: 2
downvote count: 0
tagged with: java
tagged with: orm

http://stackoverflow.com/comment/43512618
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27542295
has text: hi there i use that code and add else { System.out.println("no rows affected"); } but still even if i delete a data in the database it still falls on else
type: AnswerComment

http://stackoverflow.com/q/27572410
has comment: http://stackoverflow.com/comment/43572485
downvote count: 0
has answer: http://stackoverflow.com/a/27573322
has body: I've seen several questions around here that are similar but none are quite what I need. For reasons that unfortunately cannot be changed, I need to take a java UUID and store it in a 15 character long string. All of the numerical change of base methods that i have found can only reduce it to at best 22 characters, but I think it should be possible to make it shorter than that. Does anyone know how this might could be done? The shorter the string the better. Thanks!
has comment: http://stackoverflow.com/comment/43570270
has comment: http://stackoverflow.com/comment/43570522
has comment: http://stackoverflow.com/comment/43573320
favorite count: 0
has comment: http://stackoverflow.com/comment/43570845
has comment: http://stackoverflow.com/comment/43573091
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43570689
upvote count: 1
has comment: http://stackoverflow.com/comment/43570289
has answer: http://stackoverflow.com/a/27574562
has comment: http://stackoverflow.com/comment/43572693
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43570889
has comment: http://stackoverflow.com/comment/43572151
has title: Encoding a UUID into a 15 character string in Java
type: Question
answer count: 2

http://stackoverflow.com/comment/43636078
has text: This is not related to web.xml.First try to place the log4j2.xml in the src root itself.If that does not work out, then try to use the code that I gave to instantiate the Logger instance.But, this would differ if you are using a build tool such as Maven or something, but either way the code should work.
comment on: http://stackoverflow.com/a/27606651
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43480592
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27524768
has text: Yes, as said by @Balaji, check your table structure.. Is primary key is defined?

http://stackoverflow.com/q/27502727
tagged with: java
linked to: http://stackoverflow.com/q/12266502
type: Question
duplicate of: http://stackoverflow.com/q/12266502
has title: Destroying the media player when user leaves the screen. (Android Studio- Java)
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I want to stop the background music when user clicks on the exit button and direct to the main screen. What is missing in the code below? public void addListenerOnButton() { final Context context = this; exitButton = (Button) findViewById(R.id.exit); exitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context,Games.class); startActivity(intent); player.stop(); player.release(); } }); }
tagged with: android-studio
score: 2
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/43458897
has text: Is there a specific reason you need to use the LdapContext interface? Do you need the LDAPv3 control functionality or are you just doing some basic lookups? Did a quick test using @Resource injection to get an InitialDirContext and looking up a user works without any issue.
comment on: http://stackoverflow.com/a/27513344
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/27550002
tagged with: rcp
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27550206
type: AnsweredQuestion
tagged with: e4
type: Question
has title: Eclipse E4 - Menu contribution and PersistedState
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/27550206
answer count: 1
has body: I have got ditched in a problem with Menu Contribution and PersistedState. I had no problem before removing the -clearPersistedState flag from the VM args. Now, the app has a weird behaviour, the menu contribution starts to pile up a menu entry every time the code is executed. Here it's the guilty snippet enclosed in a Processor: MDirectMenuItem menuItem = MMenuFactory.INSTANCE.createDirectMenuItem(); menuItem.setLabel("Another Exit"); menuItem.setContributionURI("bundleclass://" + "com.telespazio.optsat.wizard/" + ExitHandlerWithCheck.class.getName()); if (!menu.getChildren().contains(menuItem)) menu.getChildren().add(menuItem);

http://stackoverflow.com/a/27590403
answers question: http://stackoverflow.com/q/27590242
type: Answer
upvote count: 0
has body: Hope below code developed may be useful to you package com.test.testprogramms; /** * * @author bhavikambani * */ public class Matrix { private int nrows; private int ncols; private double[][] data; public Matrix(double[][] dat) { this.data = dat; this.setNrows(dat.length); this.setNcols(dat[0].length); } public Matrix(int nrow, int ncol) { this.setNrows(nrow); this.setNcols(ncol); data = new double[nrow][ncol]; } public int getNcols() { return ncols; } public void setNcols(int ncols) { this.ncols = ncols; } public int getNrows() { return nrows; } public void setNrows(int nrows) { this.nrows = nrows; } public double getValueAt(int i, int j) { return data[i][j]; } public void setValueAt(int i, int j, double valueToBeSet){ data[i][j] = valueToBeSet; } } And below is utility class, package com.test.testprogramms; /** * * @author bhavikambani * */ public class MatrixUtil { public static Matrix transpose(Matrix matrix) { Matrix transposedMatrix = new Matrix(matrix.getNcols(), matrix.getNrows()); for (int i = 0; i &lt; matrix.getNrows(); i++) { for (int j = 0; j &lt; matrix.getNcols(); j++) { transposedMatrix.setValueAt(j, i, matrix.getValueAt(i, j)); } } return transposedMatrix; } }
score: -1
downvote count: 1

http://stackoverflow.com/q/27502730
has comment: http://stackoverflow.com/comment/43520187
type: UnansweredQuestion
has title: Select column in a selected row using selenium web driver
has comment: http://stackoverflow.com/comment/43435753
has comment: http://stackoverflow.com/comment/43435685
tagged with: selenium-webdriver
tagged with: xpath
has comment: http://stackoverflow.com/comment/43435792
tagged with: java
tagged with: selenium
type: Question
has body: I have to select a row in a table where there are multiple rows and in that I have to click on a column link . This column link has the same xpath in all the rows. example: row1 name1 updatelink row2 name2 updatelink row3 name3 updatelink where name is unique. After selecting the particular row i have to click update link. where update link has the same xpath for all rows
has comment: http://stackoverflow.com/comment/43437596
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27503919

http://stackoverflow.com/q/27617336
tagged with: android
tagged with: android-actionbar
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27617385
score: -1
upvote count: 0
answer count: 1
favorite count: 0
has body: I am using android navigation Drawer. created by eclipse. I want to add my ic_launcher on the action bar. as it would normally show. I also set the min API to 14. styles //------------------------------------------------------------------------------------------- here is my manifest <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/CustomActionBarTheme" android:name=".gears.MyApplication"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has title: Android how to add ic_lancher on action bar
type: UnansweredQuestion

http://stackoverflow.com/q/27522559
has answer: http://stackoverflow.com/a/27522878
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: request
has body: I have uploaded my code on server. I am using: String ipAddress1 = FrameworkUtil.getServletRequest().getHeader("Remote_Addr"); System.out.println("Remote_Addr ipAddress===&gt;"+ipAddress1); String ipAddress = FrameworkUtil.getServletRequest().getHeader("HTTP_X_FORWARDED_FOR"); System.out.println("HTTP_X_FORWARDED_FOR ipAddress==&gt;"+ipAddress); if (ipAddress == null) { ipAddress = FrameworkUtil.getServletRequest().getRemoteAddr(); System.out.println(" getRemoteAddr ipAddress=&gt;"+ipAddress); } I am getting: Remote_Addr ipAddress===&gt;null HTTP_X_FORWARDED_FOR ipAddress==&gt;null getRemoteAddr ipAddress=&gt;127.0.0.1 But in google myip give me: 233.233.22.331 What should I do to get it in java ??
type: Question
has comment: http://stackoverflow.com/comment/43479164
has title: How to get ip from request in java?
tagged with: java
tagged with: httprequest
tagged with: ip
has comment: http://stackoverflow.com/comment/43474177
answer count: 3
has answer: http://stackoverflow.com/a/27522705
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43474270
has answer: http://stackoverflow.com/a/27522895

http://stackoverflow.com/a/31420255
type: Answer
has body: When you declare instance variable and do a declaration again as a local variable they are considered are different variables. For your code to work do the following. public class Phone { String phoneNumber = "1234"; void setNumber(){ this.phoneNumber = "4321"; } } public class TestPhone { public static void main(String[] args) { // TODO Auto-generated method stub Phone p1 = new Phone(); p1.setNumber(); System.out.println(p1.phoneNumber); } }
score: 0
answers question: http://stackoverflow.com/q/27583192

service-discovery
tags question: http://stackoverflow.com/q/27478329
tag name: service-discovery
type: Tag

http://stackoverflow.com/comment/43558066
has text: @MarkoTopolnik I want read the field secretString from another thread, but i can't because of synchronization, so i need to add volatile modifier to secretString, and then read, but i don't know how to do
comment on: http://stackoverflow.com/q/27565619
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27604983
has comment: http://stackoverflow.com/comment/43632547
tagged with: ehcache
answer count: 0
has comment: http://stackoverflow.com/comment/43632980
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43653742
has comment: http://stackoverflow.com/comment/43632741
tagged with: algorithm
score: 1
tagged with: java
has body: I'm invoking a web service to populate a cache. There is a limit on the number of requests that can be sent to the server - 15 requests per hour. I want minimise the staleness of the cache for users that are invoking the webservice the most. Below three users access this service : user1 - 10 requests per hour user2 - 5 requests per hour user3 - 20 requests per hour user1 - 29% of requests user2 - 14% of requests user3 - 57% of requests Based on this I plan to run a scheduled task that clears the cache users more frequently for users that are accessing the service a high percentage of times, in the case user3. Are there alternatives to the approach im taking or existing algorithm I could use, perhaps there is an existing framework I could leverage ?
has comment: http://stackoverflow.com/comment/43632813
tagged with: caching
tagged with: optimization
type: Question
has title: Clearing cache based on usage
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43632634

pentaho
tags question: http://stackoverflow.com/q/27589444
tags question: http://stackoverflow.com/q/27619629
tags question: http://stackoverflow.com/q/27634438
tags question: http://stackoverflow.com/q/27546051
tags question: http://stackoverflow.com/q/27569955
type: Tag
tag name: pentaho

http://stackoverflow.com/q/27505478
upvote count: 1
score: 1
tagged with: java
tagged with: hql
has body: When i am using case statement in Hibernate Query with setMaxResults() and setFirstResult() it is showing wrong records. For example, my query is select code, text from dropDownTable where (code like '%meter%' or text like '%meter%') order by case when text like 'meter%' or code like 'meter%' then 0 when text like '%meter' or code like '%meter' then 2 else 1 end Now I am using setMaxResults(fetchSize) and setFirstResult(fetchSize*fetchCount) in Hibernate Query. It is showing same records when fetchCount is more than 1. I am not getting point that when we are setting start index then why it is showing records which are before that index. Please help me out in this. Following is my java code: Query managerQuery = session.createSQLQuery(dynamicQuery); managerQuery.setMaxResults(fetchSize); managerQuery.setFirstResult(fetchSize * fetchCount); returnList = managerQuery.setResultTransformer(insensitiveAliasTransformer).list();
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43442081
has title: case statement in order by clause is not working in HQL
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/27549220
has body: Instead of redirecting from the server, which wouldn't work since you are doing an Asynchronous call using AJAX. What you need to do is redirect from your success method, by sending a value which specifies the error condition you want to redirect for. In the case below, I'm passing a "RedirectURL" as a root member of the returned JSON object. If it exists, then you would redirect. For example... $.ajax({ type : "POST", url: "startapp", data:{ processDateInput: processDate,secretToken:tokenLocal}, dataType: "json", async: true, success: function(result) { var od = JSON.stringify(result); var obj = JSON.parse(od); var i = 0; console.log(od); if(obj.redirectUrl){ window.location(obj.redirectUrl); } } }); You can also do this in the 'fail' method of your call, by throwing an exception from the server. This way, ALL exceptions will redirect to the page you wish. $.ajax({ type : "POST", url: "startapp", data:{ processDateInput: processDate,secretToken:tokenLocal}, dataType: "json", async: true, success: function(result) { var od = JSON.stringify(result); var obj = JSON.parse(od); var i = 0; console.log(od); }, fail: function(ex) { window.location(ExceptionRedirectUrl); //ExceptionRedirectUrl would be a global constant. } });
answers question: http://stackoverflow.com/q/27548844
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27548844
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/27580408
type: Question
downvote count: 0
tagged with: palindrome
has answer: http://stackoverflow.com/a/27580504
accepted answer: http://stackoverflow.com/a/27580504
has answer: http://stackoverflow.com/a/27580501
possible better answer: http://stackoverflow.com/a/27580435
has title: Palindrome with recursion; index out of bound
has answer: http://stackoverflow.com/a/27580449
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43585295
upvote count: 1
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27580435
has body: I'm trying to write a function that checks whether a string variable is a palindrome or not. I can't find the reason this code throws IndexOutOfBoundException. I've tried to use examples so as to follow the result, but I still can't see where the exception is from. public static boolean palindrome(String s) { if (s.charAt(0) == s.charAt(s.length() - 1)) { if (s.length() &gt; 2) { StdOut.print(s.substring(1, s.length() - 2)); palindrome(s.substring(1, s.length() - 2)); } else return true; } return false; }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43585200

http://stackoverflow.com/q/27569448
has answer: http://stackoverflow.com/a/27569700
has body: I'm trying to inject a Spring-managed bean and a string value into a servlet. The servlet is defined in context.xml as following: &lt;bean name="gwtlogging" class="com.somepackage.MyRemoteLogger"&gt; &lt;property name="symbolMapsDirectory" value="/WEB-INF/deploy/gwt/symbolMaps/"/&gt; &lt;property name="serializationPolicyResolver" ref="serializationPolicyResolver"/&gt; &lt;/bean&gt; I came across using this method: @Override public void init(ServletConfig config) throws ServletException { super.init(config); SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext()); } This works, but has some disadvantages: I want to inject beans as defined in context.xml and not per autowiring I need to inject a string value (not a bean), which seems impossible this way Ideally I want that all values defined in xml will be somehow injected into servlet instance.
score: 0
has comment: http://stackoverflow.com/comment/43564479
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43564509
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/43564423
has comment: http://stackoverflow.com/comment/43564271
tagged with: servlets
type: Question
has title: Injecting beans and values (as defined in context.xml) into servlet
has comment: http://stackoverflow.com/comment/43564389
answer count: 1
has comment: http://stackoverflow.com/comment/43564441

http://stackoverflow.com/q/27582568
accepted answer: http://stackoverflow.com/a/27600541
type: AnsweredQuestion
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/27600541
type: Question
tagged with: mongodb
score: 0
has title: script command map to related java code in MongoTemplate
answer count: 1
has body: I have an aggregation command in script console as below, &gt; db.examSessionCol.aggregate( [ { $group : { _id : "$examinationId", avgScore: {$avg: "$score"}, co unt: { $sum: 1 } } } ] ) Here is the result, { "_id" : NumberLong(4), "avgScore" : 81.4, "count" : 5 } { "_id" : NumberLong(1), "avgScore" : 17.2, "count" : 40 } I need to apply it into my java based project, I found there is little documents about usage of aggregation in MongoTemplate, could anyone help me how I can write the related java code with good performance? Following is the return object: public class ExamParticipatedItem { protected int examinationId; protected int count; protected double avgScore; } And the method written by me but doesn't work currently, public List&lt;ExamParticipatedItem&gt; getExamParticipatedItems() { return mongoTemplate.aggregate(Aggregation.newAggregation(ExaminationSession.class, GroupOperationBuilde), ExamParticipatedItem.class, collectionName).getMappedResults();//it's not completed } Thanks in advance.

http://stackoverflow.com/a/27583275
score: 0
has body: in your setNumber method, phone number is local. //try this public class Phone { String phoneNumber = "1234"; void setNumber(){ this.phoneNumber = "4321"; } } public class TestPhone { public static void main(String[] args) { Phone p1 = new Phone(); p1.setNumber(); System.out.println(p1.phoneNumber); } }
type: Answer
answers question: http://stackoverflow.com/q/27583192

http://stackoverflow.com/comment/43555385
type: Comment
type: QuestionComment
has text: Crap, forgot to add some code, im so sorry
comment on: http://stackoverflow.com/q/27565025
score: 0

http://stackoverflow.com/q/27603782
downvote count: 0
has body: I'm using the Java Spring Resttemplate for getting a json via a get request. The JSON I'm getting has instead of special character slike ü ö ä or ß some weird stuff. So I guess somethings wrong with the character encoding. I can't find any help on the internet. The code I'm using for now is: String json = restTemplate.getForObject( overPassStatementPostCode, String.class, params);
tagged with: resttemplate
has answer: http://stackoverflow.com/a/42799663
has answer: http://stackoverflow.com/a/72865219
type: Question
type: AnsweredQuestion
upvote count: 35
has answer: http://stackoverflow.com/a/63314226
has comment: http://stackoverflow.com/comment/43630424
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: character-encoding
has comment: http://stackoverflow.com/comment/43630348
answer count: 6
linked to: http://stackoverflow.com/q/28481118
has answer: http://stackoverflow.com/a/39673751
has title: Java Spring resttemplate character encoding
has comment: http://stackoverflow.com/comment/43786280
possible better answer: http://stackoverflow.com/a/42799663
has comment: http://stackoverflow.com/comment/43630631
has answer: http://stackoverflow.com/a/58535918
favorite count: 0
has comment: http://stackoverflow.com/comment/43785632
score: 35
tagged with: utf-8
has answer: http://stackoverflow.com/a/28742831
accepted answer: http://stackoverflow.com/a/28742831

http://stackoverflow.com/q/27552922
favorite count: 0
tagged with: static
type: Question
has comment: http://stackoverflow.com/comment/43532664
has comment: http://stackoverflow.com/comment/43532357
has comment: http://stackoverflow.com/comment/43532829
has comment: http://stackoverflow.com/comment/43532449
has answer: http://stackoverflow.com/a/27552955
has comment: http://stackoverflow.com/comment/43532114
linked to: http://stackoverflow.com/q/10963601
has title: Why can't I use generics in an inner interface?
answer count: 1
upvote count: 16
has body: I tried to compile the following code: public interface Foo&lt;T&gt; { public interface Bar { public void bar(T t); } void foo(T t); } But I get this error: "Foo.this cannot be referenced from a static context." Specifically, I get it on the "T" in bar(T t). However foo(T t) does not produce the same error. I don't understand why that's a static context and what the error really means.
has comment: http://stackoverflow.com/comment/43532122
tagged with: java
has comment: http://stackoverflow.com/comment/43532220
has comment: http://stackoverflow.com/comment/43532714
accepted answer: http://stackoverflow.com/a/27552955
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43532432
score: 16

http://stackoverflow.com/comment/43478672
has text: why should that curly brace be removed on the changeToString() method? and my get code is supposed to return the value of code for a specific object, how can i fix that?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27524949

http://stackoverflow.com/comment/51233313
has text: Very helpful! but I'd like to add two things: 1. For an accurate representation of waiting, you want to sleep *inside* a thread *inside* walkTo, with the g.yield() immediately after the sleep, and 2. If you don't want the user to access the coroutine library be sure to `g.set("coroutine", LuaValue.NIL);` before the first `g.get("co").call();`.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27631292
score: 1

http://stackoverflow.com/comment/72092197
type: QuestionComment
comment on: http://stackoverflow.com/q/27522131
score: 0
has text: Why? Postfix is a linear notation. You don't need a tree. You can evaluate it left to right, or generate target code directly from it, ...
type: Comment

http://stackoverflow.com/comment/43586963
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27577016
has text: `Class.forName()` is definitely *not* required.

http://stackoverflow.com/a/27595923
accepted answer of: http://stackoverflow.com/q/27595813
has comment: http://stackoverflow.com/comment/43627951
score: 1
answers question: http://stackoverflow.com/q/27595813
has body: After some research I've found a possible reason why your code works for me, but not for you. I'm using Direct 3D to do the rendering and you're using OpenGL. The D3D classes also using this code to create the BufferStrategy: public VolatileImage createBackBuffer(WComponentPeer peer) { Component target = (Component)peer.getTarget(); // it is possible for the component to have size 0x0, adjust it to // be at least 1x1 to avoid IAE int w = Math.max(1, target.getWidth()); int h = Math.max(1, target.getHeight()); return new SunVolatileImage(target, w, h, Boolean.TRUE); } As you can see, it sets the width and height to at least 1 to avoid an IllegalArgumentException. The OpenGL version of that class does not: @Override public VolatileImage createBackBufferImage(Component target, long backBuffer) { return new SunVolatileImage(target, target.getWidth(), target.getHeight(), Boolean.TRUE); } So if you still want to use OpenGl, then you need to bypass the short time, where the size of the Canvas isn't set yet** (i.e. width and height are 0) by yourself: private void render() { if (getWidth() == 0 || getHeight() == 0) { return; } BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { this.createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); } ** It seems that there is a very short time where the Game canvas doesn't "has" his correct size. It size is 0x0 there, but will later be updated to 634x449 (after around 3 iterations of your game loop).
has comment: http://stackoverflow.com/comment/43615845
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43685947
type: Answer
has comment: http://stackoverflow.com/comment/43617795
downvote count: 0

http://stackoverflow.com/q/27562289
has comment: http://stackoverflow.com/comment/43554468
duplicate of: http://stackoverflow.com/q/22525388
score: 7
has comment: http://stackoverflow.com/comment/43550417
favorite count: 0
has title: keytool error: java.io.IOException: toDerInputStream rejects tag type 45
answer count: 0
has body: I have got the error as "keytool error: java.io.IOException: toDerInputStream rejects tag type 45" when I am importing a Self Signed certificate into the certificate file "cacerts" which is available in the jre library. The command am using to import the certificate is "keytool -importkeystore -srckeystore D:\User\KotakTPINSSL.cer -srcstoretype pkcs12 -destkeystore D:\User\certfile\cacerts -deststoretype JKS" I have also gone through the link Push notification - Caused by: java.io.IOException: toDerInputStream rejects tag type 45 but that does not suits with this problem. Can someone tell me the alternative command to import the certificate? or Is there any other thing that I need to do?
type: UnansweredQuestion
tagged with: keystore
tagged with: x509
upvote count: 7
tagged with: java
has comment: http://stackoverflow.com/comment/43550897
tagged with: ssl
type: Question
linked to: http://stackoverflow.com/q/22525388
downvote count: 0

http://stackoverflow.com/comment/43476763
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27523670
has text: I removed the set bounds and I'm playing around with gridLayout, it does not display. What should i use for the parameters? I am currently using: gamePanel1.setLayout(newGridLayout(boardsize,boardsize,boardsize,boardsize));
score: 0

http://stackoverflow.com/q/27607901
has title: invoke gdb to debug java programs
has comment: http://stackoverflow.com/comment/43642226
favorite count: 0
accepted answer: http://stackoverflow.com/a/27608415
has answer: http://stackoverflow.com/a/27608415
tagged with: emacs
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43638401
tagged with: java
has body: i am pretty new to programming, and having some trouble with debugging java programs. I try to use gdb to debug my java program, but no matter how hard i try, it still does not work at all. The error message in the minibuffer of emacs(GUI) is always "No such file or directory , gdb". I am sure that my currrent directory is the the same as the sourcefile and the compiled file(executable file compiled with "javac -g xx.java") . So, my confusion is that: Does the error has something to do with: 1. wrong syntax of invoking gdb (used Meta gdb xx ) 2. what is the executable java file for gdb/ how gdb identify them 3. is it possible that my installation of EMACS is incomplete, as i input the gdb to the command line(Win8 system), NO gdb prompt appears at all(something like(gdb....))
type: Question
score: 0
tagged with: gdb
upvote count: 1
answer count: 1

http://stackoverflow.com/a/59673207
downvote count: 0
has body: My Method: @RequestMapping(value="getPDF", method=RequestMethod.GET) public void generatePDF(int idPredstave, HttpServletResponse response) throws Exception{ Predstava p = pr.findById(idPredstave).get(); List&lt;Uloga&gt; uloge = ur.findByPredstava(p); response.setContentType("text/html"); JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(uloge); InputStream inputStream = this.getClass().getResourceAsStream("/jasperreports/Uloge.jrxml"); JasperReport jasperReport = JasperCompileManager.compileReport(inputStream); Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("nazivPredstave", p.getNaziv()); params.put("trajanje", p.getTrajanje()); params.put("opis", p.getOpis()); params.put("zanr", p.getZanr().getNaziv()); params.put("reziser", p.getReziser().getIme()+" "+p.getReziser().getPrezime()); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); inputStream.close(); response.setContentType("application/x-download"); response.addHeader("Content-disposition", "attachment; filename=Uloge.pdf"); OutputStream out = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint,out); }
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27532446
score: 2

http://stackoverflow.com/comment/43405013
type: QuestionComment
has text: Your description is unclear: want separate context menu per data type? Then see my first comment. Want separate context menu for selected rows? See my second comment. Anyway, SSCCE still missing ...
comment on: http://stackoverflow.com/q/27480403
score: 0
type: Comment

http://stackoverflow.com/a/27584588
downvote count: 0
has body: Compare your System.out.print(sortInput(list[i]) + " "); with public int[] sortInput(String input) You are trying to call it with something else than it expects.
type: Answer
answers question: http://stackoverflow.com/q/27584543
score: 1
upvote count: 1

http://stackoverflow.com/comment/43560064
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27560667
has text: Get a proxy tool, like Firefox's TamperData extension or get a copy of OWASP's ZAP tool, and trap the response from the server and add it here.
score: 0

http://stackoverflow.com/a/34171880
answers question: http://stackoverflow.com/q/27590257
has comment: http://stackoverflow.com/comment/86589130
downvote count: 0
has comment: http://stackoverflow.com/comment/86501563
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/86490324
score: 3
has body: Just happened to see this long forgotten question. Do you mean something like, if you are given a tree: A B C D E F G H I J K L M N O commonAncestor(L,G) = C commonAncestor(H,O) = A commonAncestor(B,H) = B something like that? 2 methods to give (all assume the provided nodes are in the tree): If there are link to parent (i.e. you are pointing from B back to A), then solution is easy, similar to finding intersecting linked list: find depth of Node1 and Node2, assuming the depth is D1 and D2. Find the difference between D1 and D2 (assuming d). Have pointer to Node1 and Node2 (assume p1 and p2). For the node with higher depth, navigate to parent d-th times. At this point, p1 and p2 will have same depth beneath the ancestor. Just have a simple loop to navigate both p1 and p2 to parent, until you hit the node that p1 == p2. If no parent link in node, you can iteratively navigate the tree: currentNode = root; while (true) { if (currentNode == node1 || currentNode == node2 || (currentNode &gt; node1) != (currentNode &gt; node2) ) { break; // current node is the common ancestor, as node1 and node2 // will go to different sub-tree, or we actually // found node1/2 and the other node is its child } else if (currentNode &gt; node1) { currentNode = currentNode.left; } else { // currentNode &lt; node1/2 currentNode = currentNode.right; } } // currentNode will be the answer you want The basic idea is, given it is a binary search tree, if two nodes are both larger / smaller than current node, it will goes to same child tree. So the common ancestor is the node that two values goes to different children, i.e. when one is smaller than current node and the other one is larger.

http://stackoverflow.com/q/27519075
tagged with: ejb
answer count: 1
has body: I'm trying to create EJB 3.2 Stateless Bean Project but still no avail until now. I hope anyone can help me. Here is the EJB Project structure on my eclipse: SLBean.java package com.example.ejbtest; import javax.ejb.Stateless; @Stateless public class SLBean implements SLBeanRemote { public SLBean() { } @Override public String sayHello() { return "Hello World !!!"; } } SLBeanRemote.java package com.example.ejbtest; import javax.ejb.Remote; @Remote public interface SLBeanRemote { public String sayHello(); } jboss-ejb-client.properties endpoint.name=client-endpoint remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.host=localhost remote.connection.default.port=4447 remote.connection.default.username=user1 remote.connection.default.password=password remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false Test.java package com.example.ejbtest; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class Test { public static void main(String[] args) { Context context; try { Properties properties = new Properties(); properties.put(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming"); properties.put("jboss.naming.client.ejb.context", true); context = new InitialContext(properties); String appName = ""; String moduleName = "EJBTest"; String distinctName = ""; String beanName = SLBean.class.getSimpleName(); String viewClassName = SLBeanRemote.class.getName(); String ejbString = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName; System.out.println(ejbString); SLBeanRemote remote = (SLBeanRemote) context.lookup(ejbString); System.out.println(remote.sayHello()); } catch (NamingException e) { e.printStackTrace(); } } } So after I run the EJBTest project on Wildfly Server through Eclipse, I run the Test.java as client program to connect to th…
upvote count: 1
favorite count: 0
tagged with: wildfly
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: How to create EJB 3.2 Stateless Bean Project and Running it on Wildfly 8?
tagged with: jboss
has answer: http://stackoverflow.com/a/27527605
accepted answer: http://stackoverflow.com/a/27527605
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/43669877
has text: I have edited my answer with what I think will work. Is that what you had in mind?
comment on: http://stackoverflow.com/a/27623341
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/27628563
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: jvm
favorite count: 0
accepted answer: http://stackoverflow.com/a/27628612
type: Question
has comment: http://stackoverflow.com/comment/43679761
has comment: http://stackoverflow.com/comment/43679368
tagged with: bind
has title: java.net.BindException: Address already in use: JVM_Bind BUT NO port using it
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27628612
has body: I have java proxy for which I have attached the full code below. I am constantly getting the following error when starting it. java.net.BindException: Address already in use: JVM_Bind I have used tcpview and done searches with netstat but nothing is using the port 9339... My code is as follows: import java.io.*; import java.net.*; public class proxy { public static void main(String[] args) throws IOException { try { String host = "gamea.clashofclans.com"; int remoteport = 9339; ServerSocket s = new ServerSocket(0); int localport = s.getLocalPort(); // Print a start-up message System.out.println("Starting proxy for " + host + ":" + remoteport + " on port " + localport); // And start running the server runServer(host, remoteport, localport); // never returns } catch (Exception e) { System.err.println(e); } } /** * runs a single-threaded proxy server on * the specified local port. It never returns. */ public static void runServer(String host, int remoteport, int localport) throws IOException { // Create a ServerSocket to listen for connections with ServerSocket ss = new ServerSocket(localport); final byte[] request = new byte[2048]; byte[] reply = new byte[4096]; while (true) { Socket client = null, server = null; try { // Wait for a connection on the local port client = ss.accept(); final InputStream streamFromClient = client.getInputStream(); final OutputStream streamToClient = client.getOutputStream(); // Make a connection to the real server. // If we cannot connect to the server, send an error to the // client, disconnect, and continue waiting for connections. try { server = new Socket(host, remoteport); System.out.println("Client connected to server."); } catch (IOException e) { PrintWriter out = new PrintWriter(streamToClient); out.print("Proxy server cannot connect to " + host + ":" + remoteport + ":\n" + e + "\n"); out.flush(); client.close(); continue; } // Get server streams. final InputStream streamFromServer = server.getInputStream(); final OutputStream str…

http://stackoverflow.com/comment/43603942
score: 0
type: AnswerComment
type: Comment
has text: What is the point of a static getter method that gets variable if it returns a constant no matter what variable contains?
comment on: http://stackoverflow.com/a/27589929

http://stackoverflow.com/comment/43552717
comment on: http://stackoverflow.com/q/27563567
has text: (http://stackoverflow.com/a/7626080/2749470) this may help you out
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/43608974
type: AnswerComment
score: 0
type: Comment
has text: oh yeah i've forgotten dialog.setcontentview... Thanks!
comment on: http://stackoverflow.com/a/27592156

http://stackoverflow.com/a/27485362
answers question: http://stackoverflow.com/q/27485177
upvote count: 3
type: Answer
downvote count: 0
has body: Both lines below throw a checked exception and as per Java it must be either handled or must be declared so that callers can decide what should be done. FileOutputStream os = new FileOutputStream("myfile"); os.close(); In this case the first line throws FileNotFoundException where as later throws IOException. As IOException is a parent of FileNotFoundException, we have option to declare just IOException.
score: 3

http://stackoverflow.com/comment/43672764
type: Comment
type: QuestionComment
has text: No, you did everything correct as the ```.classpath``` file will never contain the webapp dir. Why do you need that?
score: 1
comment on: http://stackoverflow.com/q/27511689

http://stackoverflow.com/comment/43486686
comment on: http://stackoverflow.com/q/27527892
score: 0
has text: @Balu check my answer please. I think it does want you want
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27562288
has comment: http://stackoverflow.com/comment/43581591
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/43564662
answer count: 0
tagged with: java
has body: I would like to develop a certain method of an EJB, having a timeout for the execution (passed togheter with the method's parameters), without using transactions. How would you do that?
type: Question
tagged with: jakarta-ee
tagged with: timeout
has title: Execute EJB's method with a timeout
score: 0
has comment: http://stackoverflow.com/comment/43590523
has comment: http://stackoverflow.com/comment/43564090
has comment: http://stackoverflow.com/comment/43583578
type: UnansweredQuestion

eclipse-plugin
tags question: http://stackoverflow.com/q/27566529
tags question: http://stackoverflow.com/q/27492367
tags question: http://stackoverflow.com/q/27564280
tags question: http://stackoverflow.com/q/27562370
tags question: http://stackoverflow.com/q/27637478
tags question: http://stackoverflow.com/q/27564906
type: Tag
tags question: http://stackoverflow.com/q/27498057
tags question: http://stackoverflow.com/q/27561635
tags question: http://stackoverflow.com/q/27528290
tags question: http://stackoverflow.com/q/27527288
tags question: http://stackoverflow.com/q/27619253
tags question: http://stackoverflow.com/q/27530617
tags question: http://stackoverflow.com/q/27598220
tags question: http://stackoverflow.com/q/27520750
tags question: http://stackoverflow.com/q/27621178
tags question: http://stackoverflow.com/q/27480547
tags question: http://stackoverflow.com/q/27593939
tags question: http://stackoverflow.com/q/27633443
tags question: http://stackoverflow.com/q/27540974
tags question: http://stackoverflow.com/q/27523272
tags question: http://stackoverflow.com/q/27621183
tags question: http://stackoverflow.com/q/27601124
tags question: http://stackoverflow.com/q/27608961
tag name: eclipse-plugin

http://stackoverflow.com/a/27518477
answers question: http://stackoverflow.com/q/27518111
type: Answer
has comment: http://stackoverflow.com/comment/43467309
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/43466781
has body: Yes. I have several projects running in Intellij. Intellij does a good job of supporting mixed Java / Scala projects. I am not sure of any other IDE that better supports this. If you are using scala IDE for eclipse, i suggest you to try Intellij. Check the screen shot:

http://stackoverflow.com/q/27533888
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43496229
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27534094
has comment: http://stackoverflow.com/comment/43496497
tagged with: servlets
accepted answer: http://stackoverflow.com/a/27534094
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43496432
tagged with: jsp
has comment: http://stackoverflow.com/comment/43496284
favorite count: 0
has comment: http://stackoverflow.com/comment/43496486
has title: I cannot seem to obtain all data from a set?
has comment: http://stackoverflow.com/comment/43496821
type: AnsweredQuestion
has body: I can't seem to be able to obtain all data that has been inserted into a set and display it appropriately, it displays the selected option in the next page like so: Bean code: public Object getItems() { return chosenLessons.entrySet().toArray(); } public void addLesson(Lesson l) { Lesson i = new Lesson(l); this.chosenLessons.put(l.getId(), i); Controller code: if (action.equals("/lessonTimetable")) { if (request.getParameter("btnSelect") != null) { this.selectedLesson = new LessonSelection(getID); lessons.ID = request.getParameter("lessonID"); lessons.description = request.getParameter("lessonDescription"); lessons.date = request.getParameter("lessonStartDate"); lessons.startTime = request.getParameter("lessonStartTime"); lessons.endTime = request.getParameter("lessonEndTime"); lessons.level = Integer.parseInt(request.getParameter("lessonLevel")); this.selectedLesson.addLesson(lessons); session.setAttribute("lessons", this.selectedLesson.getAll()); //System.out.println(selectedLesson.getItems()); //check for duplicate lessons rd = this.getServletContext().getRequestDispatcher("/LessonSelectionView.jspx"); jstl code: <c:forEach var="getAll" items="${lessons}"> <c:out value="${getAll.value.description}"/> <c:out value="${getAll.value.date}"/> <c:out value="${getAll.value.startTime}"/> <c:out value="${getAll.value.endTime}"/> <c:out value="${getAll.value.level}"/> <c:forEach It displays one element row at a time not entire set which is what I want and when I do system.out.println, it adds and prints out everything that has been selected.
has comment: http://stackoverflow.com/comment/43496422

http://stackoverflow.com/comment/43586118
type: QuestionComment
has text: Firstly welcome to programming. Now seeing that you have the 'proper answer', why don't you include it in your question so that we can help you?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27580590

http://stackoverflow.com/q/27515668
tagged with: eclipselink
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/89827135
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43484708
score: 3
answer count: 0
upvote count: 3
tagged with: java
has title: EclipseLink "cascade = CascadeType.REFRESH" not cascading entityManager.refresh()
type: Question
tagged with: jpa
has body: I have a simple JPA mapping where everything works fine except that refresh is not being cascaded to child entities. Here is my relevant code: @Entity @Table(name = "prospection") public class ProspectionImpl extends AbstractIdentifiedObject&lt;Prospection&gt; implements Prospection { @Id @GeneratedValue @Column(name = "id") private Long id; @OneToMany(targetEntity = ProspectionLocationImpl.class, fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "prospection_id") @JoinFetch(JoinFetchType.OUTER) private Collection&lt;Location&gt; locations = new ArrayList&lt;Location&gt;(); } And my bean ProspectionLocationImpl is as follows: @Entity @Table(name = "prospection_perimetre") public class ProspectionLocationImpl extends AbstractIdentifiedObject&lt;ProspectionLocationImpl&gt; implements Location { @Id @GeneratedValue @Column(name = "id") private Long id; @ManyToOne(targetEntity = CityImpl.class, fetch = FetchType.EAGER, cascade = CascadeType.REFRESH) @JoinColumn(name = "commune_id") @JoinFetch(JoinFetchType.INNER) private City city; } Now for some reason I need to do a refresh on my ProspectionImpl bean, so I do it with : entityManager.refresh(prospection); The result is a refreshed ProspectionImpl bean but the same collection of locations with empty City information (except ID). Now in my test I have a non empty list of Location so I tried to do manually: entityManager.refresh(prospection.getLocations().iterator().next()); And it works fine, my City is now filled with all data from the database. I have the feeling that my "CascadeType.ALL" is not cascading the refresh. I tried cascade = { CascadeType.ALL, CascadeType.REFRESH} to explicitly set REFRESH cascading, but I could not find anything that cascades the REFRESH. Am I doing something wrong? Is there a global EclipseLink setting to unable REFRESH cascading? Thank you for your help.

http://stackoverflow.com/q/27586436
has answer: http://stackoverflow.com/a/27586544
answer count: 2
downvote count: 0
has title: Perform AsyncTask inside Class
accepted answer: http://stackoverflow.com/a/27586544
favorite count: 0
tagged with: android-asynctask
upvote count: 2
has body: I have a method inside of a class called ChopraWisdom.GetQuote() that pulls in some data from the interwebs. To use it I have to use an AsyncTask in my activity. Thats fine and all, but my Activity code now gets cluttered with the AsyncTask code. I was hoping that I could hide the AsyncTask in my Class and then create another method called ChopraWisdom.GetQuoteAsync() But I'm not sure how to pass in "Actions" (I come from a .Net background) in order to handle the various UI updating that needs to take place. In C# I would define the method signature as something like: ChopraWisdom.GetQuoteAsync(Action preExecute, Action postExecute, Action updateProgress) Questions: Does java have something comparable to 'Action'? What is the acceptable pattern for 'wrapping' Async functionality like this in Java? I like clean code, but am I being to picky here? Please provide examples. EDIT - Added Example class public class ChopraWisdom { public string GetQuote() { //...do stuff and return a string } }
tagged with: android
possible better answer: http://stackoverflow.com/a/27595887
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27595887
tagged with: java
type: Question

http://stackoverflow.com/comment/43686204
type: Comment
comment on: http://stackoverflow.com/a/27632766
type: AnswerComment
has text: @Eran your accessing a static field which don't require object of the class to access it.
score: 0

http://stackoverflow.com/q/27482076
has answer: http://stackoverflow.com/a/27482270
tagged with: java
tagged with: hibernate
type: Question
score: 0
tagged with: sql
has title: SQL and Hibernate - repeatedly count table rows
answer count: 1
has body: Suppose I have two tables, eg thread and author, where thread +------+--------+-...-+ | id | author | ... | +------+--------+-...-+ and author +----+-...-+ | id | ... | +----+-...-+ where thread.author has a foreign key on author.id. It's a little part of a forum project. I'm running a Java application that use Hibernate ORM to access the database. So, I basically have 3 layers: Logic layer (Java classes) &lt;--> Data access layer (Hibernate) &lt;--> Database. Now, consider this scenario: I often need to have the number of threads for a lot of user. So, basically I think I have these different solutions: Leave the DB as it is and every time invoke a get on the DB (the Hibernate equivalent of SELECT COUNT(*) FROM thread WHERE author='some_id'). It seems quite inefficient because it access the DB a lot of times. Modify the author table adding a column like threads_number. However, this raise another point: which layer updates this column? A DB trigger (which seems quite unportable between different databases) or the application layer (which is good but at the same time it can lead to inconsistencies)? A (materialized) view. It seems reasonable, but I think I have the same problems of point 2: which layer updates the view and check the consistence? What is the best option?
type: UnansweredQuestion

http://stackoverflow.com/comment/43467768
score: 0
type: Comment
type: QuestionComment
has text: If you are able to copy it. It will work. but mostly, I think almost every website doesn't allow this.
comment on: http://stackoverflow.com/q/27504360

http://stackoverflow.com/q/27541918
has answer: http://stackoverflow.com/a/39433392
type: UnansweredQuestion
has title: Tomcat websocket and java
has answer: http://stackoverflow.com/a/27550995
has comment: http://stackoverflow.com/comment/43528051
score: 1
tagged with: java
downvote count: 3
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43512949
tagged with: websocket
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/68623752
answer count: 3
has comment: http://stackoverflow.com/comment/54640435
has body: Hi guys am getting following error am using Websocket and Tomcat8. java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1092) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textStart(WsRemoteEndpointImplBase.java:1055) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:186) at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37) at com.iri.monitor.webSocket.IRIMonitorSocketServlet.broadcastData(IRIMonitorSocketServlet.java:369) at com.iri.monitor.webSocket.IRIMonitorSocketServlet.access$0(IRIMonitorSocketServlet.java:356) at com.iri.monitor.webSocket.IRIMonitorSocketServlet$5.run(IRIMonitorSocketServlet.java:279)
linked to: http://stackoverflow.com/q/22257079

http://stackoverflow.com/q/27595346
answer count: 3
has body: I have a webpage page called page.jsp, and I only want it to have 2 URLs: /page-url-1 /page-url-2 In the web.xml I wrote: Page page.jsp Page /page-url-1 /page-url-2 But now, it has 3 URLs: /page.jsp <== Not wanted /page-url-1 /page-url-2 Question: How do I remove the JSP's native URL, and assign it custom one(s)?
has answer: http://stackoverflow.com/a/27917580
has comment: http://stackoverflow.com/comment/43615033
type: AnsweredQuestion
tagged with: web.xml
upvote count: 2
type: Question
has title: How to remove JSP's native request URL?
tagged with: java
tagged with: custom-url
has answer: http://stackoverflow.com/a/27916262
score: 2
has comment: http://stackoverflow.com/comment/43614604
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/27918256
favorite count: 0
accepted answer: http://stackoverflow.com/a/27916262
possible better answer: http://stackoverflow.com/a/27917580

http://stackoverflow.com/q/27512307
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27512486
favorite count: 0
has body: The api I'm currently using returns dates (for the sake of this question, dates and datetimes are the same) in the form of "yyyy-MM-dd" and also in the typical ISO8601 format "2012-06-08T12:27:29.000-04:00" How do you "cleanly" set up GSON to handle this? Or would my best approach be to treat dates as strings and output in the specific form needed using some custom getter in my model objects? I'm currently doing the following, but parsing fails whenever I see a "yyyy-MM-dd" field. return new GsonBuilder() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ") .create(); I'm ultimately using this in an Android + Retrofit context in case there are solutions available via that avenue. Edit: Per the suggestion below, I created a custom TypeAdapter. My full solution can be seen (as a gist) here: https://gist.github.com/loeschg/2967da6c2029ca215258.
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27512486
tagged with: gson
tagged with: date
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43454918
has title: In gson/retrofit, is there a built-in way to handle dates of varying formats?
tagged with: retrofit

http://stackoverflow.com/comment/43601042
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27588341
has text: I tried with most possible combinations of config changes:android:configChanges="orientation|keyboardHidden|keyboard|layoutDirection|screenLayout|uiMode|touchscreen|fontScale|navigation" but the same behaviour :(
type: Comment

hashtable
tags question: http://stackoverflow.com/q/27485351
tag name: hashtable
tags question: http://stackoverflow.com/q/27582822
tags question: http://stackoverflow.com/q/27602624
tags question: http://stackoverflow.com/q/27599207
tags question: http://stackoverflow.com/q/27502102
type: Tag
tags question: http://stackoverflow.com/q/27527347
tags question: http://stackoverflow.com/q/27491283

http://stackoverflow.com/comment/43448921
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27509205
has text: note that some coverage tools allows to ignore trivial methods like getters/setters. What is your tool?
score: 0

http://stackoverflow.com/q/27584327
has comment: http://stackoverflow.com/comment/43593194
answer count: 1
has body: I have been working on a program and well i dont know what i can do with an object i retrieved by deserializing a file. Can i say retrievedObject.MethodInClass() will this above edit the retrieved object ? When an object is serialized , does it only store the arguments or does it store the results as well. For example what does it store from the code below int i; int j; int k public setNumber(int i, int j){ // where i is 2 and j is 3 this.i = i this.j = j } k = i+j: does it store k as 5 or as null ?
has title: What information does a serialized object store?
tagged with: deserialization
favorite count: 0
tagged with: serialization
accepted answer: http://stackoverflow.com/a/27584334
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27584334

http://stackoverflow.com/q/27576049
has comment: http://stackoverflow.com/comment/43591837
answer count: 0
tagged with: java
tagged with: jdo
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43593631
has body: I am using App Engine. I'm trying to upgrade from DataNucleus/JDO version v1 to v2. (JDO2.0 to JDO3.0) My code however has following problems under v2 (and works fine in v1) 1/ The result from a query gives a nullPointerException. Query q = pm.newQuery(Company.class, query); List&lt;Company&gt; companies = (List&lt;Company&gt;) q.execute(); // this should return a non-empty list for (Company company: companies) -&gt; NullPointerException 2/ After persisting an object, I get a serialization error : public final class PMF { private static final PersistenceManagerFactory pmfInstance = JDOHelper.getPersistenceManagerFactory("transactions-optional"); private PMF() { pmfInstance.setDetachAllOnCommit(true); } public static PersistenceManagerFactory get() { return pmfInstance; } } Company company = new Company(...); PersistenceManager pm = PMF.get().getPersistenceManager(); try { pm.currentTransaction().begin(); pm.makePersistent(company); pm.currentTransaction().commit(); // because of setDetachAllOnCommit(true), the object should be detached.. } catch (Exception e) { } finally { if (!pm.isClosed()) pm.close(); } After this, serialization of company, sending it to the client gives 'Type 'org.datanucleus.store.types.sco.simple.ArrayList' was not included in the set of types which can be serialized by this SerializationPolicy' I'm not finding anywhere on the internet tips or lessons learned on this migration.
has title: Issues with migratiing from DataNucleus/JDO version v1 to v2
tagged with: datanucleus
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/a/27534094
has comment: http://stackoverflow.com/comment/43498556
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27533888
has body: Every time controller execute you are initializing new LessonSelection(getID) and replacing this.selectedLesson. Then adding one lesson object to selectedLesson. That means all the time session will have only one object. If you want to add new Lessons in to list and persist in session, you need to read previously added LessonSelection object from session using session.getAttribute("lessons") and then add new Lesson Object to the set then put it back in to session again if (action.equals("/lessonTimetable")) { if (request.getParameter("btnSelect") != null) { // This code will make sure lessons are retrieved from session data this.selectedLesson = session.setAttribute("lessons") == null ? new LessonSelection(getID):(LessonSelection)session.getAttribute("lessons") ); //... Do all other operation you are doing this.selectedLesson.addLesson(lessons); session.setAttribute("lessons", this.selectedLesson.getAll()); //System.out.println(selectedLesson.getItems()); //check for duplicate lessons rd = this.getServletContext().getRequestDispatcher("/LessonSelectionView.jspx"); } }
answers question: http://stackoverflow.com/q/27533888
has comment: http://stackoverflow.com/comment/43496648
has comment: http://stackoverflow.com/comment/43497262
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43499031
has comment: http://stackoverflow.com/comment/43496679

http://stackoverflow.com/comment/43483648
comment on: http://stackoverflow.com/a/27492281
type: AnswerComment
has text: What are the hide-when formulas? Sounds like something about them is not working right in the context of your java code. And what, by the way, is that context? Is this agent code running on the server? Standalone code running on a client? Other?
score: 0
type: Comment

http://stackoverflow.com/comment/43692457
type: QuestionComment
has text: @JonSkeet Oh.Sry I had interpreted your answer in a different way. Thank you.
score: 0
comment on: http://stackoverflow.com/q/27635711
type: Comment

http://stackoverflow.com/comment/43662842
comment on: http://stackoverflow.com/q/27621142
has text: Is the answer to [this question](http://stackoverflow.com/questions/16892040/how-can-we-identify-programatically-that-android-device-suports-eap-sim-for-wifi) useful?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/27504948
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27504828
answers question: http://stackoverflow.com/q/27504828
has body: Integer is immutable. The moment you call increment method, You get a new object and reference of count variable gets changed and hence leads to an issue.
has comment: http://stackoverflow.com/comment/43443749
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43461871
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27515747
has text: So the tile should be replaced by a player, if you know what I mean

http://stackoverflow.com/q/27539748
accepted answer: http://stackoverflow.com/a/27539788
tagged with: android-arrayadapter
score: 1
tagged with: java
tagged with: listview
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/27539982
has answer: http://stackoverflow.com/a/27539982
favorite count: 0
has title: Need to Display only one Object in my list view (Only title ) in my case
has answer: http://stackoverflow.com/a/27539788
tagged with: android
has body: I am working with a Listview where I get a Json response which I parse using Gson and the response contains title, body and images. For my list view I need to display on titles I am doing the following: Articles[] testCase = gson.fromJson(Bundlekey, Articles[].class); @SuppressWarnings("rawtypes") ArrayList list = new ArrayList(); ArrayList&lt;Articles&gt; lst = new ArrayList&lt;Articles&gt;(); for (int i = 0; i &lt; testCase.length; i++) { list.add(testCase[i].getTitle()); list.add(testCase[i].getBody()); list.add(testCase[i].getImages()); lst.add(testCase[i]); Log.e("DONE", testCase[i].getTitle().toString()); } final ArrayAdapter&lt;Articles&gt; adapter = new ArrayAdapter&lt;Articles&gt;( activity, android.R.layout.simple_list_item_1, lst); activity.setListAdapter(adapter); I am defining my Articles class as this: import java.io.Serializable; import java.util.List; import com.google.gson.annotations.SerializedName; public class Articles implements Serializable{ private static final long serialVersionUID = 8359220892008313080L; public List&lt;Articles&gt; results; @SerializedName("body") private String body; @SerializedName("title") private String title; @SerializedName("images") private List&lt;Images&gt; images; /*public Articles() { this.body = body; this.title = title; this.images = images; }*/ public String getBody() { return body; } public void setBody(String body) { this.body = body; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List&lt;Images&gt; getImages() { return images ; } public void setImages(List&lt;Images&gt; images) { this.images = images; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("***** Articles *****\n"); sb.append("BODY=" + getBody() + "\n"); sb.append("TITLE=" + getTitle() + "\n"); sb.append("IMAGES=" + getImages() + "\n"); sb.append("*****************************"); return sb.toString(); } } My list is showing with title and body an…
type: AnsweredQuestion
upvote count: 1
type: Question
tagged with: object

single-sign-on
tags question: http://stackoverflow.com/q/27638993
tags question: http://stackoverflow.com/q/27599140
tags question: http://stackoverflow.com/q/27637598
type: Tag
tag name: single-sign-on

http://stackoverflow.com/q/27556506
downvote count: 2
duplicate of: http://stackoverflow.com/q/3052442
has title: String & objects in Java
tagged with: object
tagged with: java
type: Question
answer count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/27556533
has body: String a = "Hello"; String b = new String("Hello World"); Can someone please tell me how many objects are created and elaborate. Thank you.
has comment: http://stackoverflow.com/comment/43539265
linked to: http://stackoverflow.com/q/3052442
upvote count: 2
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/43682287
score: 0
type: Comment
type: QuestionComment
has text: I'd be interested to understand the use case for this. In general this is a recipe for deadlocks because the first in thread is likely to be starved of the semaphore and, therefore, less likely to release other semaphores it holds. Could you comment on why you need this - not doubting there is a reason I'm just curious as to what it is.
comment on: http://stackoverflow.com/q/27624776

http://stackoverflow.com/q/27524942
tagged with: android
answer count: 1
favorite count: 0
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/27526823
has body: I have read similar threads and haven't found an answer which would solve my problem. I am writing an app with 2 different MediaRecorders. One for noise detection and another one for recording. What I want to do is - when the first MediaRecorder detects noise levels above 4.0 (I am using Google's SoundMeter class for detection) it will initiate another MediaRecorder and start recording. If the soundlevels stay below 4.0 for 10 seconds, then stop recording and keep listening. All of this is done in an AsynTask, in an endless while(true) loop, which will be broken, only if a corresponding button is clicked. The detection is working fine, but the IllegalStateException is thrown when start() is called on the recording MediaRecorder. Here is the AsyncTask: private class NoiseDetection extends AsyncTask { double currentSoundInputLevel; @Override protected Object doInBackground(Object[] params) { int i = 0; soundMeter = new SoundMeter(); try { soundMeter.start(); } catch (IOException e) { Log.e("error", e.getMessage()); } while(true){ try { Thread.sleep(1000); } catch (InterruptedException e) { Log.e("error", e.getMessage()); } if(isCancelled()){ soundMeter.stop(); if(currentlyRecording) { soundRecorder.stop(); } break; } currentSoundInputLevel = soundMeter.getAmplitudeEMA(); if(!currentlyRecording &amp;&amp; currentSoundInputLevel &gt; 4.0){ soundRecorder = new SoundRecorder(); try { soundRecorder.start(getFileNameString()); currentlyRecording = true; } catch (IOException e) { Log.e("error", e.getMessage()); } } else if(currentlyRecording &amp;&amp; currentSoundInputLevel &lt; 4.0) { i++; if(i &gt; 10) { soundRecorder.stop(); } } } return null; } } And here is the SoundRecorder: public class SoundRecorder { private MediaRecorder mRecorder = null; public void start(String fileName) throws IOException { if (mRecorder == null) { mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_…
linked to: http://stackoverflow.com/q/16140703
accepted answer: http://stackoverflow.com/a/27526823
type: AnsweredQuestion
tagged with: android-mediarecorder
linked to: http://stackoverflow.com/q/22967716
has comment: http://stackoverflow.com/comment/43478657
tagged with: java
has comment: http://stackoverflow.com/comment/43478653
type: Question
upvote count: 4
tagged with: mediarecorder
downvote count: 0
has comment: http://stackoverflow.com/comment/43478535
score: 4
has comment: http://stackoverflow.com/comment/43478800
has title: MediaRecorder.start() throwing IllegalStateException

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/27481934
tags question: http://stackoverflow.com/q/27544145

ubuntu
tags question: http://stackoverflow.com/q/27484941
tags question: http://stackoverflow.com/q/27545194
tags question: http://stackoverflow.com/q/27519943
tags question: http://stackoverflow.com/q/27614344
tags question: http://stackoverflow.com/q/27560879
tags question: http://stackoverflow.com/q/27494592
tag name: ubuntu
tags question: http://stackoverflow.com/q/27547489
tags question: http://stackoverflow.com/q/27616076
tags question: http://stackoverflow.com/q/27481953
type: Tag
tags question: http://stackoverflow.com/q/27528278

http://stackoverflow.com/q/27589621
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: method-reference
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27589658
accepted answer: http://stackoverflow.com/a/27589658
upvote count: 1
type: Question
has body: I introducing with new features of java 8. I have following class: class InstanceMethodClass { Integer testStr(String str1,String str2) { return str1.compareTo(str2); } } and following invocation: Arrays.sort(new String[]{"1", "3","2"},InstanceMethodClass::testStr ); After it I see following error: java: no suitable method found for sort(java.lang.String[],InstanceMe[...]stStr) method java.util.Arrays.&lt;T&gt;sort(T[],java.util.Comparator&lt;? super T&gt;) is not applicable (cannot infer type-variable(s) T (argument mismatch; invalid method reference cannot find symbol symbol: method testStr(T,T) location: class lambdas.staticReferences.InstanceMethodClass)) method java.util.Arrays.&lt;T&gt;sort(T[],int,int,java.util.Comparator&lt;? super T&gt;) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) Please explain what do I wrong?
possible better answer: http://stackoverflow.com/a/27589774
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27589774
favorite count: 0
has title: instance method reference. no suitable method found for

http://stackoverflow.com/q/27488826
has answer: http://stackoverflow.com/a/31877061
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27489218
possible better answer: http://stackoverflow.com/a/30523114
tagged with: material-design
has answer: http://stackoverflow.com/a/30523114
upvote count: 7
tagged with: android-design-library
type: Question
tagged with: android-snackbar
has answer: http://stackoverflow.com/a/57214208
score: 7
tagged with: java
accepted answer: http://stackoverflow.com/a/27489218
has title: Snackbar with API 21
has body: I'm trying to implement the new Snackbars in my app but I can't. First of all I downloaded the zip file from this SnackBarSampleActivity. I unziped it and then I import it in Eclipse. Now I get an error retrieving parent... for the theme parent in styles.xml. I change it to android:Theme.Light and the error was gone. I right clicked the project and checked isLibrary in Properties/Android, I right clicked my app and in Properties/Android I add the library. Finally I paste the code to show a Snackbar but I get an error because Snackbar cannot be resolved. Please somebody help me! I'm going crazy, what am I doing wrong?
downvote count: 0
has answer: http://stackoverflow.com/a/52640848
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/30155083
tagged with: android

http://stackoverflow.com/comment/43442820
comment on: http://stackoverflow.com/a/27504772
type: AnswerComment
score: 0
has text: I don't understand. Consider providing a more comprehensive data set, and desired result.
type: Comment

http://stackoverflow.com/comment/43589544
comment on: http://stackoverflow.com/q/27571673
score: 0
type: QuestionComment
has text: Thanks for the tip but i managed to do it without needing to use a toggle button, i used a FocusListener to set a boolean variable to determine which textfield is selected and using the boolean variable value(true/false) i edited the appropriate JTextField.
type: Comment

http://stackoverflow.com/a/27482849
has body: This is only valid for Swing, which shares some similarities with Android UI programming but is indeed not the same. A little bit of context The EDT (Event Dispatch Thread) is Swing's thread dedicated to handling UI events (mouse and keyboard input, events on controls, rendering of the UI, etc...). This is an Event Loop model, similar to what is done in Android. The fact that event listeners in Swing are executed on the EDT is the root cause for freezing UIs in Swing applications: developers misunderstanding the threading model often put long-running code in the listeners, which blocks the EDT and thus the GUI. SwingWorker was introduced to better guide developers in separating UI updates from long-running background code. It spawns a dedicated background thread for the I/O processing (or long-running task) in doInBackground and executes UI updates in done and process methods. While these 3 methods guarantee in which thread they'll be executed, all other methods are executed in the current thread. What is meant by the sentence you quoted The whole reason for SwingWorker to exist is to properly initiate a long-running process from the GUI, without blocking the GUI. Often, it will be in reaction to a user's input (e.g. clicking a Button). Since reactions to the user's input (implemented as Listeners) are always executed in the EDT by the Swing framework, unless you happen to call execute or get from another thread explicitly, it will get executed on the EDT. By the way, execute is "fire-and-forget" and is the typical use-case (call it from a listener). get on the other hand blocks, and is not suited to be called from a listener (it would defeat SwingWorker's purpose, call it on your own threads if needed)!
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/27482350
has comment: http://stackoverflow.com/comment/43399932
score: 6
has comment: http://stackoverflow.com/comment/43398673
accepted answer of: http://stackoverflow.com/q/27482350
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27522830
tagged with: java
has answer: http://stackoverflow.com/a/27523086
has comment: http://stackoverflow.com/comment/43474703
has comment: http://stackoverflow.com/comment/43474686
upvote count: 1
answer count: 1
has body: I am using the pointwise mutual information (PMI) association measure to calculate how frequently words co-occure by using word-frequencies obtained from a large corpus. I am calculating PMI via the classical formulae of log(P(X,Y) / (P(X)*P(Y)) and using the contingency table notation with joint- and marginal frequencies I found on http://collocations.de/AM/index.html The results I get are very similar, but not the same. As far as I understood things both methods should result in the exact same result value. I made a little Java-programm (minimal working example) that uses word-frequencies from a corpus using both formulae. I get different results for the two methods. Does someone know why ? public class MutualInformation { public static void main(String[] args) { long N = 1024908267229L; // mutual information = log(P(X,Y) / P(X) * P(Y)) double XandY = (double) 1210738 / N; double X = (double) 67360790 / N; double Y = (double) 1871676 / N; System.out.println(Math.log(XandY / (X * Y)) / Math.log(10)); System.out.println("------"); // contingency table notation as on www.collocations.de long o11 = 1210738; long o12 = 67360790; long o21 = 1871676; long c1 = o11 + o21; long r1 = o11 + o12; double e11 = ((double) r1 * c1 / N); double frac = (double) o11 / e11; System.out.println(Math.log(frac) / Math.log(10)); } }
favorite count: 0
tagged with: frequency
tagged with: associations
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: corpus
type: Question
accepted answer: http://stackoverflow.com/a/27523086
has title: Mutual Information: Calculation example (Java) in contingency table style

http://stackoverflow.com/q/27590978
tagged with: maven
type: Question
score: 3
has title: Using Maven to Install a Java Library
accepted answer: http://stackoverflow.com/a/27591032
has answer: http://stackoverflow.com/a/27591013
has answer: http://stackoverflow.com/a/27591039
tagged with: java
has body: I am new to Maven. Recently I have downloaded and installed Maven successfully on my Windows 8 machine. I am trying to use an API created by Twilio for sending text messages. To use the Twilio API, Twilio requires that you have Maven installed on your machine. On the Twilio website there are setup instructions for the API. I am using NetBeans. After installing Maven I do not know if there is any special integration that I must do to use Maven in NetBeans. Please give me some step by step instructions on what I need to do, that would be very helpful. Or, if anyone knows of a link that gives clear instructions to a new Maven user for API integration with NetBeans, that would be appreciated. Thanks!
possible better answer: http://stackoverflow.com/a/27591013
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27591032
type: AnsweredQuestion
tagged with: netbeans
upvote count: 3

http://stackoverflow.com/a/27524492
has comment: http://stackoverflow.com/comment/59328735
has comment: http://stackoverflow.com/comment/43477666
has comment: http://stackoverflow.com/comment/59318992
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43477850
has body: You are passing a new instance to the forEach method. Every time you do that you create a new object but not one for every loop iteration. Iteration is done inside forEach method using the same 'callback' object instance until it is done with the loop. So the memory used by the loop does not depend on the size of the collection. Isn't this equivalent to the 'old syntax' snippet? Yes. It has slight differences at a very low level but I don't think you should care about them. Lamba expressions use the invokedynamic feature instead of anonymous classes.
upvote count: 5
has comment: http://stackoverflow.com/comment/43477929
answers question: http://stackoverflow.com/q/27524445
downvote count: 4
has comment: http://stackoverflow.com/comment/43477636

http://stackoverflow.com/comment/43572318
type: QuestionComment
comment on: http://stackoverflow.com/q/27573385
score: 0
type: Comment
has text: or is there any simpler way than converting the image into bitmap?

ehcache
tags question: http://stackoverflow.com/q/27481214
tags question: http://stackoverflow.com/q/27604983
tags question: http://stackoverflow.com/q/27478138
tags question: http://stackoverflow.com/q/27547386
tag name: ehcache
type: Tag
tags question: http://stackoverflow.com/q/27529244

http://stackoverflow.com/comment/43593900
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27515974
has text: No I messed up my comment, but that is NOT what I meant. You need to be able to `colonyHutListener.setType(ColonyHutOne.getType());`. `getType()` can be static, because what that says is every instance of `ColonyHutOne` should return the same. That is ok because every instance should return the same type value. What we want though is for `setType()` not to be static, and to achieve that we must call `ColonyHutDrag colonyHutListener = new ColonyHutDrag(getApplicationContext());`, THEN WE SET TYPE LIKE SO: `colonyHutListener.setType(ColonyHutOne.getType());`. Sorry about my typo.

http://stackoverflow.com/a/27609986
has body: As explained in this other Stack Overflow question The URI is not hierarchical occurs because the URI for a resource within a jar file is most likely going to look like something like this: file:/example.jar!/file.txt. You cannot read the entries within a jar (a zip file) like it was a plain old File. Instead get the file bytes as an InputStream InputStream pdf = ClassB.class.getResourceAsStream("packageA/test.pdf"); This should work both in eclipse (which is still reading the files off of the filesytem) and from the executable jar EDIT Since you need to use a File no matter what, the only sure way to get a file is to make a temp file: // Copy file File tmpFile = File.createTempFile(...); tmpFile.deleteOnExit(); try(OutputStream outputStream = new FileOutputStream(tmpFile); InputStream pdf = ClassB.class.getResourceAsStream("packageA/test.pdf"); ){ byte[] buffer = new byte[1024]; int length; while ((length = pdf.read(buffer)) &gt; 0) { outputStream.write(buffer, 0, length); } }//autoClose //now tmpFile is the pdf Desktop.getDesktop().open(tmpFile);
has comment: http://stackoverflow.com/comment/43642331
accepted answer of: http://stackoverflow.com/q/27609840
score: 0
answers question: http://stackoverflow.com/q/27609840
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27549714
type: Answer
has body: you'll not be able to instantiate the Servlet as it's the container concern but you can make : request.getRequestDispatcher("/TARGET_SERVLET").forward(request,response);
answers question: http://stackoverflow.com/q/27546965
score: 0

android-intent
tags question: http://stackoverflow.com/q/27516740
tags question: http://stackoverflow.com/q/27593482
tags question: http://stackoverflow.com/q/27639559
tags question: http://stackoverflow.com/q/27558608
tags question: http://stackoverflow.com/q/27574631
tags question: http://stackoverflow.com/q/27593114
tags question: http://stackoverflow.com/q/27536510
type: Tag
tag name: android-intent
tags question: http://stackoverflow.com/q/27547533
tags question: http://stackoverflow.com/q/27632774
tags question: http://stackoverflow.com/q/27552555
tags question: http://stackoverflow.com/q/27503089

http://stackoverflow.com/q/27530317
score: 2
tagged with: cmd
favorite count: 0
accepted answer: http://stackoverflow.com/a/27531988
has comment: http://stackoverflow.com/comment/43493042
tagged with: windows
has comment: http://stackoverflow.com/comment/43490085
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: close batch file after execution in java
has body: I am trying to create a bat file and running it. Once execution is complete, bat file should close. String cmd = "cmd /c start" + " "+"java -jar batchfilepath"+" "+"\n exit"; Runtime r = Runtime.getRuntime(); Process pr = r.exec(cmd); Issue- I am able to close the bat file but it closes before execution completes. I tried following ways 1.if(p.waitfor()==0) {rt.exec("taskkill /IM cmd.exe");} 2.cmd /c start \wait 3.cmd /k start \wait 4.processBuilder Help me on this.
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27531988
has comment: http://stackoverflow.com/comment/43492254
possible better answer: http://stackoverflow.com/a/47088165
has answer: http://stackoverflow.com/a/47088165
tagged with: batch-file
answer count: 2

http://stackoverflow.com/comment/122708654
score: 2
type: Comment
comment on: http://stackoverflow.com/a/27482059
has text: This is not always the issue, the main reason can be conflicting java/mvn versions.
type: AnswerComment

http://stackoverflow.com/a/27527546
accepted answer of: http://stackoverflow.com/q/27526979
answers question: http://stackoverflow.com/q/27526979
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43483625
upvote count: 2
score: 2
has body: so something like this? using the exponentiation by square and ive used long just in case of overflow due to int * int... int powMod(int z, int s, int t){ long result = 1; //int * int will never exceed the size of a long long multiplicant = z; while(s &gt; 0){ if(s % 2 == 1) { result *= multiplicant; result %= t; // do modulo on each temporary result to keep accuracy } multiplicant *= multiplicant; multiplicant %= t; s /= 2; } return result; }

http://stackoverflow.com/q/27522775
has answer: http://stackoverflow.com/a/29406045
has title: Not implemented by the S3FileSystem FileSystem implementation Hadoop Jar
upvote count: 2
type: UnansweredQuestion
tagged with: solr
tagged with: maven
has body: I have added these build config in my maven pom, as i want Apache Solr Dependencies to be bundled with the Jar. other wise I was getting SolarServerException: ClassNotFound, now i am not getting that exception but a new one shown below (After Pom snippet) maven-assembly-plugin jar-with-dependencies make-assembly package single And this creates two Jar Files one with Dependencies and one simple jar. Jar with Deps, throws this error, Exception in thread "main" java.lang.UnsupportedOperationException: Not implemented by the S3FileSystem FileSystem implementation at org.apache.hadoop.fs.FileSystem.getScheme(FileSystem.java:216) at org.apache.hadoop.fs.FileSystem.loadFileSystems(FileSystem.java:2564) at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:2574) at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2591) at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:91) at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2630) at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2612) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:370) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:169) at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:354) at org.apache.hadoop.fs.Path.getFileSystem(Path.java:296) at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.addInputPath(FileInputFormat.java:518) at com.myproj.core.NewWordCount.main(NewWordCount.java:59) 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.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136) Please help me what did wrong, that now hadoop directly looks for s3FileSystem Implementation. Running it with this command. hadoop jar com.myproj-0.0…
score: 2
tagged with: java
type: Question
tagged with: hadoop
tagged with: hadoop2
downvote count: 0
favorite count: 0
answer count: 1

http://stackoverflow.com/a/27574526
answers question: http://stackoverflow.com/q/27574490
type: Answer
score: 2
upvote count: 2
has body: Yours is a classic Swing threading issue where you perform a long-running task on the Swing event thread. You appear in fact to be doing long-running code in the painting method, something that should absolutely never be done since this will repeatedly perform this task every time a repaint is performed, slowing your painting to a crawl. Suggestions: Do long-running tasks, such as reading files, in a background thread such as provided by a SwingWorker. Do only painting in paint methods, and nothing else. Call the super's paintComponent method in your override to allow the JPanel to do its house-keeping painting. If you are going to be swapping views, use a CardLayout to make it easy and safe to do so. The while (game_running) { loop is doing the same thing -- tying up the Swing event thread, freezing your GUI. Use a Swing Timer instead for this. You've got game logic in your painting method (the paintComponent method), where you're setting the x and y variables. Don't do this, but instead change them in your Swing Timer's code. You never have complete control over whether or if the paintComponent method is called, and so you want to have no program logic, no code that changes fields, within this method. For example: // start method name should start with a lower-case letter public void start() { final Level player = new Level(); frame.add(player); player.repaint(); int fps = 1000 / FRAMES_PER_SEC; // use a field called timer timer = new Timer(fps, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // get this out of the paintComponent method x += dx; y += dy; player.repaint(); } }); timer.start(); } For example: import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import javax.imageio.ImageIO…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27574490

http://stackoverflow.com/comment/43634692
has text: `And there is no problem in the future release of JDK?` - according to the [JLS](http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.8) there _might_ be problems with future JDK releases when using raw rypes and if you'd not use them you'd not need to suppress those warnings.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27605818

http://stackoverflow.com/comment/43396130
type: Comment
comment on: http://stackoverflow.com/q/27481592
score: 0
has text: Well. I think it's pretty simple. Restaurant has ArrayList<Category> categories; Categories has ArrayList<Dish> dishes; Is that what you asked about?
type: QuestionComment

http://stackoverflow.com/comment/43516974
score: 1
type: AnswerComment
has text: Great answer. Link for basic difference between redirect and request forward: http://www.javapractices.com/topic/TopicAction.do?Id=181
type: Comment
comment on: http://stackoverflow.com/a/27545036

http://stackoverflow.com/comment/43611656
type: QuestionComment
has text: isnt this automatically the case when i am in the SelectionActivity and i press the backButton ?
comment on: http://stackoverflow.com/q/27594042
score: 0
type: Comment

http://stackoverflow.com/q/27570052
accepted answer: http://stackoverflow.com/a/27570296
type: AnsweredQuestion
has title: Allocate Big file
score: 6
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43567124
has body: I need allocate file with size near 50 gigabytes, but this code: RandomAccessFile out = new RandomAccessFile("C:\\hello.txt", "rw"); out.setLength(50 * 1024 * 1024 * 1024); // 50 giga-bytes Throws exception: Exception in thread "main" java.io.IOException: Попытка поместить указатель на файл перед началом файла at java.io.RandomAccessFile.setLength(Native Method) at Experiment.main(Experiment.java:8) : Attempting to move the file pointer before the beginning of the file. When I trying allocate 50 megabytes such exception not throws. Free space of disk is much greater then needed file size.
upvote count: 7
has comment: http://stackoverflow.com/comment/43565756
has comment: http://stackoverflow.com/comment/43566063
answer count: 1
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27570296

http://stackoverflow.com/comment/43547828
comment on: http://stackoverflow.com/q/27560822
has text: @jww I checked all those threads before I asked my question. Somehow my problem is still here after trying those solutions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27546514
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27543633
downvote count: 0
score: 1
has body: Use this to convert JSON array to string private String convertStreamToString(InputStream is) { /* * To convert the InputStream to String we use the * BufferedReader.readLine() method. We iterate until the * BufferedReader return null which means there's no more data to * read. Each line will appended to a StringBuilder and returned as * String. */ BufferedReader reader = new BufferedReader( new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); }

http://stackoverflow.com/q/27483947
downvote count: 0
linked to: http://stackoverflow.com/q/20873570
tagged with: dropbox-api
has title: Is there any way to add progress bar for file-upload to dropbox using Java
favorite count: 0
answer count: 0
has body: I was uploading file to dropbox using java. But the problem is how can I add progress bar to file upload to dropbox. I didn't use java script for it. I didn't get any of this in dropbox API. my code is. import com.dropbox.core.*; import java.io.*; import java.util.Locale; public class Main { public static void main(String[] args) throws IOException, DbxException { // Get your app key and secret from the Dropbox developers website. final String APP_KEY = "INSERT_APP_KEY"; final String APP_SECRET = "INSERT_APP_SECRET"; DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET); DbxRequestConfig config = new DbxRequestConfig("JavaTutorial/1.0", Locale.getDefault().toString()); DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo); // Have the user sign in and authorize your app. String authorizeUrl = webAuth.start(); System.out.println("1. Go to: " + authorizeUrl); System.out.println("2. Click \"Allow\" (you might have to log in first)"); System.out.println("3. Copy the authorization code."); String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim(); // This will fail if the user enters an invalid authorization code. DbxAuthFinish authFinish = webAuth.finish(code); String accessToken = authFinish.accessToken; DbxClient client = new DbxClient(config, accessToken); System.out.println("Linked account: " + client.getAccountInfo().displayName); File inputFile = new File("working-draft.txt"); FileInputStream inputStream = new FileInputStream(inputFile); try { DbxEntry.File uploadedFile = client.uploadFile("/magnum-opus.txt", DbxWriteMode.add(), inputFile.length(), inputStream); System.out.println("Uploaded: " + uploadedFile.toString()); } finally { inputStream.close(); } DbxEntry.WithChildren listing = client.getMetadataWithChildren("/"); System.out.println("Files in the root path:"); for (DbxEntry child : listing.children) { System.out.println(" " + child.name + ": " + child.toString()); } FileOutputStream outputStream = new FileO…
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43400185
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43419698
type: Question
has comment: http://stackoverflow.com/comment/43428790

http://stackoverflow.com/a/27512933
type: Answer
has body: Another solution using the page objects you may have: int numberOfLinks = page.getUserLink().size(); NextPage nextPage; for (int i = 0; i &lt; numberOfLinks - 1; i++) { page.getUserLink().get(i).click(); nextPage = new NextPage(); if (nextPage.isInformationFound()) { break; } driver.navigate().back(); page = new Page(); } Make the correspondent adjustments and give it a try ;) Regards.
score: 0
answers question: http://stackoverflow.com/q/27510191

http://stackoverflow.com/q/27501957
has title: Problems with Maven
accepted answer: http://stackoverflow.com/a/27502049
duplicate of: http://stackoverflow.com/q/4538180
downvote count: 0
answer count: 1
has body: I get the following error when I want to run "mvn deploy" in my project: [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ JImp --- [INFO] Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar [INFO] Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/1.5.6/plexus-utils-1.5.6.jar (245 KB at 188.8 KB/sec) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 17.973 s [INFO] Finished at: 2014-12-16T10:35:39+01:00 [INFO] Final Memory: 24M/226M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project JImp: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException My POM-File looks like that: 4.0.0 JImp JImp 0.0.1-SNAPSHOT src maven-compiler-plugin 3.1 1.7 1.7 org.apache.xmlbeans xmlbeans 2.6.0 .... In my project I am using a bunch of jar-Files (like SWT, Log4j and so on, but also own libraries). But all of these are added to my local repository (my own libs I added by mvn install:install-file ..) and in the depedencies of my POM.. In Eclipse my Project "knows" all imports, the code looks fine, has no errors or something like that.. If I only run mvn package and then executing my jar java -cp target\JImp-0.0.1-SNAPSHOT.ja…
has answer: http://stackoverflow.com/a/27502049
favorite count: 0
linked to: http://stackoverflow.com/q/4538180
type: AnsweredQuestion
tagged with: maven
upvote count: 1
type: Question
score: 1
tagged with: java

tomcat7
tags question: http://stackoverflow.com/q/27506823
tags question: http://stackoverflow.com/q/27525941
tags question: http://stackoverflow.com/q/27582254
tags question: http://stackoverflow.com/q/27490860
tags question: http://stackoverflow.com/q/27580666
tags question: http://stackoverflow.com/q/27538567
tags question: http://stackoverflow.com/q/27540986
type: Tag
tags question: http://stackoverflow.com/q/27579991
tags question: http://stackoverflow.com/q/27583038
tags question: http://stackoverflow.com/q/27617158
tags question: http://stackoverflow.com/q/27544766
tags question: http://stackoverflow.com/q/27610788
tags question: http://stackoverflow.com/q/27502882
tags question: http://stackoverflow.com/q/27499471
tags question: http://stackoverflow.com/q/27537555
tags question: http://stackoverflow.com/q/27559446
tags question: http://stackoverflow.com/q/27511618
tag name: tomcat7
tags question: http://stackoverflow.com/q/27484448

http://stackoverflow.com/comment/43626007
score: 0
comment on: http://stackoverflow.com/q/27601703
type: Comment
type: QuestionComment
has text: Maybe the Arquillian framework would be helpful. It's designed to handle this kind of thing. http://arquillian.org/ . Here's a link to the guice extension: http://arquillian.org/modules/guice-extension/

http://stackoverflow.com/comment/43431672
comment on: http://stackoverflow.com/q/27500315
score: 0
type: QuestionComment
type: Comment
has text: At least IE 10+ actually makes a valid attempt to support standards. IE 9 doesn't support strict mode, and IE 8 hardly supports ES5. IE8+ do largely support HTML 4.01 and CSS 2.1 but that was only when things started getting consistent cross-browser.

http://stackoverflow.com/comment/43802220
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27632802
has text: One could create a function `printLineWrapped(Reader in, int lineLimit)` passing in the call either a StringReader, FileReader or whatever. As `Reader = InputStream + Charset` one could not elegantly create a similar function.
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/27612509
tags question: http://stackoverflow.com/q/27484353
tag name: instantiation
tags question: http://stackoverflow.com/q/27565611

http://stackoverflow.com/comment/43443501
type: AnswerComment
comment on: http://stackoverflow.com/a/27506666
score: 0
type: Comment
has text: the comparison predicate >>? = '%'<< contains a host variable (parameter marker) on the left hand side

http://stackoverflow.com/q/27611160
tagged with: java
tagged with: eclipse
score: 0
has body: I wrote a "complex" client/server application which runs in locally in eclipse or an exported runable jar file. However, when I run the exported client jar on another computer in my network it doesn't work. The remote client connects, I can see it on the locally running client but the remote client doesn't seem to get any messages from the server. For testing I imported the project into eclipse on the remote client and ran it expecting to see some exceptions. Everything works fine, both clients are able to communicate. I had this happen with a test version, the same exact symptoms. I fixed it by selecting "Package required libraries into generated JAR" in the export dialog. This time it doesn't work. The project contains 3 packages: Server, Client, and Message. Message is where I have a serializable class which is the basis for sending the messages. Looking at the exported JAR I can see all three packages with .class files. I cleaned and rebuilt the project and exported again, but the same happens. I've ran both the exported server and client files on the local machine and was only able to make the remote machine connect using eclipse, not the same exported client jar. Any ideas on what could be the problem? UPDATE: I exported from a different computer and it works as expected. 2 computers I export from don't work, but one it does. Any suggestions for the 2 computers?
tagged with: jar
tagged with: client
has title: Client/Server app works in Eclipse but not as Exported JAR
has comment: http://stackoverflow.com/comment/43644711
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43644655
type: Question
tagged with: server
has comment: http://stackoverflow.com/comment/43644814

http://stackoverflow.com/comment/43568673
comment on: http://stackoverflow.com/q/27571380
score: 0
type: QuestionComment
has text: [Maybe relevant](https://github.com/FasterXML/jackson-module-paranamer/issues/11).
type: Comment

http://stackoverflow.com/comment/43411484
type: AnswerComment
score: 0
type: Comment
has text: Can you update your source in the question to what you have now? After changing the line mentioned in my answer, the program prints out '100'.
comment on: http://stackoverflow.com/a/27489573

http://stackoverflow.com/comment/43678388
has text: I didn't realize the windows bar was orientation dependent..
score: 0
comment on: http://stackoverflow.com/q/27627873
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43515023
score: 0
has text: I'd use named parameters (e.g. employing Apache CLI) and if the parameter is missing, null or invalid use the default. Besides that it should not be that difficult.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27544013

http://stackoverflow.com/q/27480274
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43394083
tagged with: jpanel
score: 4
has body: This code is just a silly example which I need to understand to solve a much bigger problem about another project I am working on: as you can see, in the for cycle, 23 buttons are supposed to be added to JPanel. As they cannot be shown all together I decided to add a JScrollPane but a strange thing happens: only 19 are shown and I do not understand why. The size matrix has 1 column for 23 rows so it is correct. Do you know why this happens? Thanks package proveGUI; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import layout.TableLayout; public class Main { public static void main(String argv[]) { JFrame jframe = new JFrame("Protocollo UTL"); //jframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); jframe.setSize(1200, 450); JPanel body = new JPanel(); double[][] size = { {0.05}, {0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05,0.05} }; body.setLayout(new TableLayout(size)); for(int i=0; i&lt;22; i++) { body.add(new JButton(String.valueOf(i)), "0,"+String.valueOf(i)); } JScrollPane scrollPane = new JScrollPane(body, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); jframe.add(scrollPane); jframe.setVisible(true); } }
upvote count: 4
has comment: http://stackoverflow.com/comment/43393652
answer count: 2
tagged with: tablelayout
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/43394131
has answer: http://stackoverflow.com/a/27481763
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43393865
has comment: http://stackoverflow.com/comment/43393709
has title: Java Swing: components not added to JPanel with JScrollPane
possible better answer: http://stackoverflow.com/a/27480599
accepted answer: http://stackoverflow.com/a/27481763
tagged with: java
has answer: http://stackoverflow.com/a/27480599
has comment: http://stackoverflow.com/comment/43393849
tagged with: swing
type: Question

http://stackoverflow.com/q/27551026
has comment: http://stackoverflow.com/comment/43528852
has title: Unit testing Services in Spring by Mocking DAO
has comment: http://stackoverflow.com/comment/43528497
downvote count: 0
has comment: http://stackoverflow.com/comment/43532252
favorite count: 0
linked to: http://stackoverflow.com/q/2457239
has comment: http://stackoverflow.com/comment/43545439
has comment: http://stackoverflow.com/comment/43528706
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43557749
tagged with: spring
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43528510
has comment: http://stackoverflow.com/comment/43551364
upvote count: 1
has comment: http://stackoverflow.com/comment/43529461
has body: I am using Mockito to mock my DAOS and test my Service Layer. This is an example of what I've got: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/spring/programacion-service-test.xml" }) public class ProgramacionServiceUnitTest { @Autowired private ProgramacionService programacionService; @InjectMocks @Autowired private IProgramacionDAO programacionDAO; private Mapper mapper = new DozerMapper(); @Before public void init() { } // Probamos comprobando el id. @Test public void saveProgramacionTest() { ProgramacionDTO p = getEntityDTO(); Mockito.when(programacionDAO.persist(Matchers.any(Programacion.class))).thenAnswer(new Answer&lt;Programacion&gt;() { @Override public Programacion answer(InvocationOnMock invocation) throws Throwable { Programacion programacion = (Programacion) invocation.getArguments()[0]; programacion.setIdProgramacion(1L); return programacion; } }); try{ programacionService.altaProgramacion(p); compareEntities(p, programacionService.getProgramacion(0L)); }catch(Exception e){ System.out.println("ERrOR:"+e.getMessage()); } } (...) } And this is my XML config: &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:jms="http://www.springframework.org/schema/jms" xmlns:context="http://www.springframework.org/schema/context" xmlns:mockito="http://www.mockito.org/spring/mockito" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:cache="http://www.springframework.org/schema/cache" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/cache http://www.springframework.org/sch…
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/43549800
tagged with: mockito

http://stackoverflow.com/q/27534062
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/43496528
has answer: http://stackoverflow.com/a/67881015
has title: Passing an array of objects to a method in java
has comment: http://stackoverflow.com/comment/43496537
has body: Hello guys I have a question. I have an error when I am trying to pass an array of object to a method My class public class Object { private int x1; public Object(int a ,){ this.x1=a; } public class staticMethods{ public static void findMaxPos(Object[] name){ max = name[0] pos = 0 for( int i=1; i&lt;name.length ; i++){ if ( name[i] &gt;max ){ max = name[i]; pos = i; } } } public class Example{ public static void main(String[] args) { Object[] yp = new Object2[3]; yp[0] = new Object(5); yp[1] = new Object(6); yp[2] = new Object(8); findMaxPos(type)// i get an error of the method findMaxPos is undefined for the type Example } So sorry for the long post ...
tagged with: arguments
possible better answer: http://stackoverflow.com/a/67881015
has comment: http://stackoverflow.com/comment/43496632
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27534124
score: 0
tagged with: java
tagged with: methods
type: Question
tagged with: object
accepted answer: http://stackoverflow.com/a/27534124
has comment: http://stackoverflow.com/comment/43496560

http://stackoverflow.com/comment/43483001
type: QuestionComment
has text: possible duplicate of [How to check if the application is installed or not in android programmatically](http://stackoverflow.com/questions/11392183/how-to-check-if-the-application-is-installed-or-not-in-android-programmatically)
score: 0
comment on: http://stackoverflow.com/q/27527097
type: Comment

http://stackoverflow.com/comment/43547860
type: Comment
comment on: http://stackoverflow.com/q/27560703
has text: Thanks @AndrewThompson i just have bad habit of the class main and the method!
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43474813
has text: Can you indicate the line number in the code please?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27522891

http://stackoverflow.com/comment/43679107
type: Comment
comment on: http://stackoverflow.com/a/27629241
type: AnswerComment
has text: Yes. I was asking this same thing. Thank you.
score: 0

http://stackoverflow.com/comment/43561296
comment on: http://stackoverflow.com/a/27567989
type: AnswerComment
type: Comment
has text: I tried to add a reset of bottomRow before the loop and before the call of the method, but no change. Thanks for the style tip by the way, but for some reason I have always seemed to have trouble with returns.
score: 0

selenium-webdriver
tags question: http://stackoverflow.com/q/27563502
tags question: http://stackoverflow.com/q/27486917
tags question: http://stackoverflow.com/q/27502730
tags question: http://stackoverflow.com/q/27601227
tags question: http://stackoverflow.com/q/27508008
tags question: http://stackoverflow.com/q/27515368
tags question: http://stackoverflow.com/q/27598619
tags question: http://stackoverflow.com/q/27506544
tags question: http://stackoverflow.com/q/27501271
tags question: http://stackoverflow.com/q/27565416
tags question: http://stackoverflow.com/q/27570746
tags question: http://stackoverflow.com/q/27633001
tags question: http://stackoverflow.com/q/27503823
tags question: http://stackoverflow.com/q/27588775
tags question: http://stackoverflow.com/q/27491749
tags question: http://stackoverflow.com/q/27506866
tags question: http://stackoverflow.com/q/27511124
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/27561662
tags question: http://stackoverflow.com/q/27506816
tags question: http://stackoverflow.com/q/27548609
tags question: http://stackoverflow.com/q/27526498
tags question: http://stackoverflow.com/q/27529967
tags question: http://stackoverflow.com/q/27560856
tags question: http://stackoverflow.com/q/27605277
tags question: http://stackoverflow.com/q/27551826
tags question: http://stackoverflow.com/q/27510191
tags question: http://stackoverflow.com/q/27600342
tags question: http://stackoverflow.com/q/27603446
tags question: http://stackoverflow.com/q/27618812
tags question: http://stackoverflow.com/q/27555045
type: Tag
tags question: http://stackoverflow.com/q/27621084
tags question: http://stackoverflow.com/q/27501492
tags question: http://stackoverflow.com/q/27600622
tags question: http://stackoverflow.com/q/27547445
tags question: http://stackoverflow.com/q/27520374

http://stackoverflow.com/q/27515194
has answer: http://stackoverflow.com/a/27515515
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27515547
score: 1
tagged with: java
tagged with: recurrence
tagged with: pseudocode
tagged with: computer-science
type: Question
answer count: 2
tagged with: runtime
downvote count: 0
has title: Creating recurrence equation of a simple recursive function
has body: If I was given the following recursive function, how would I create a recurrence equation for it? QUIBBLE(n) { if n = 0 return 1; else return QUIBBLE(n-1) + QUIBBLE(n-1); } I was thinking that it would be: T(n): 2T(n-1) + 1 when n is &gt;= 1 T(n) = 1 when n is 0,
has answer: http://stackoverflow.com/a/27515547
possible better answer: http://stackoverflow.com/a/27515515
favorite count: 0

http://stackoverflow.com/a/27575672
answers question: http://stackoverflow.com/q/27573828
has body: Note: To restate the problem, as I understand it: Suppose you're given nonnegative integers a, b, and c. Is it possible, by performing a sequence of zero or more operations a = a + b or b = b + a, to reach a point where a + b == c? OK, after looking into this further, I think you can make a small change to the statement you made in your question: In order for this to be possible, the target number c, must be able to be represented in the form: c = xa + yb where GCD(x,y) = 1. (Also, x and y need to be nonnegative; I'm not sure if they may be 0 or not.) Your original observation, that x may not equal y (unless they're both 1) and that x and y cannot both be even, are implied by the new condition GCD(x,y) = 1; so those observations were correct, but not strong enough. If you use this in your program instead of the test you already have, it may make the tests pass. (I'm not guaranteeing anything.) For a faster algorithm, you can use Extended Euclid's Algorithm as suggested in the comments (and Henry's answer) to find one x0 and y0; but if GCD(x0,y0) ≠ 1, you'd have to try other possibilities x = x0 + nb, y = y0 - na, for some n (which may be negative). I don't have a rigorous proof. Suppose we constructed the set S of all pairs (x,y) such that (1,1) is in S, and if (x,y) is in S then (x,x+y) and (x+y,y) are in S. It's obvious that (1,n) and (n,1) are in S for all n > 1. Then we can try to figure out, for some m and n > 1, how could the pair (m,n) get into S? If m &lt; n, this is possible only if (m, n-m) was already in S. If m > n, it's possible only if (m-n, n) was already in S. Either way, when you keep subtracting the smaller number from the larger, what you get is essentially Euclid's algorithm, which means you'll hit a point where your pair is (g,g) where g = GCD(m,n); and that pair is in S only if g = 1. It appears to me that the possible values for x and y in the above equation for the target number c are exactly those which are in S. Still, this is partly based …
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43578086
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27573828

http://stackoverflow.com/a/27555761
has comment: http://stackoverflow.com/comment/45272245
has body: Scala makes it easy to fall into the trap. The easy workaround or diagnostic (if you see clinit in your stack trace) is to let your object extend App to let DelayedInit take your code off the static initializer. Some clarifying links: https://issues.scala-lang.org/browse/SI-7646 Scala: Parallel collection in object initializer causes a program to hang http://permalink.gmane.org/gmane.comp.lang.scala.user/72499
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27549671
upvote count: 1

http://stackoverflow.com/q/27627213
tagged with: android
has title: proc/stat idle time decreasing
has comment: http://stackoverflow.com/comment/43675143
type: Question
has answer: http://stackoverflow.com/a/29120927
tagged with: java
has body: I have written some code to calculate cpu load on android devices by reading the first line in proc/stat which works fine most of the time except it returns a negative value now and again, upon further inspection i realized that the idle time value decreases sometimes, i created a dummy runnable class to demonstrate this behaviour: public class MyRunnable implements Runnable{ String[]cpuTimeInfo; long idle2; long idle1; @Override public void run() { if (new File("/proc/stat").exists()) { try{ BufferedReader br = new BufferedReader(new FileReader(new File("/proc/stat"))); String aLine; while ((aLine = br.readLine()) != null){ if(aLine.substring(0, 3).equals("cpu")){ cpuTimeInfo = aLine.split("\\s+"); idle1 = Long.parseLong(cpuTimeInfo[4]);; try{ Thread.sleep(1000); br = new BufferedReader(new FileReader(new File("/proc/stat"))); aLine = br.readLine(); cpuTimeInfo = aLine.split("\\s+"); } catch(InterruptedException e){ } idle2 = Long.parseLong(cpuTimeInfo[4]);; if(idle2 &lt; idle1) Log.d("????", "Idle 1: " + idle1 + " Idle 2: " + idle2); break; } } if (br != null) { br.close(); } } catch (IOException | NumberFormatException e){ } } new Thread(this).start(); } } Can someone please explain to me how is this possible. Is there a proper workaround or real solution to this problem
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/27573432
downvote count: 0
score: 1
has body: What they said, plus here's some additional useful tricks for navigating up and down folder levels: //absolute path from where application has initialized String target = System.getProperty("user.dir"); //drop the last folder to go down one level target = target.substring(0, target.lastIndexOf(File.separator)); //go into another directory target = target + File.separator + targetFolder; //use it return target;
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27573312

http://stackoverflow.com/comment/43525954
has text: Thanks for he reply, I took out that bit, but it just changed the error: Exception in thread "main" org.openqa.selenium.InvalidSelectorException: invalid selector: An invalid or illegal selector was specified (Session info: chrome=39.0.2171.95)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27540612

http://stackoverflow.com/comment/43659101
has text: I read that tutorial. The problem I am facing is at this point. `IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 3000);` My router address is 192.168.1.1 and if I give any port number to it i get an error "No connection could be made because the target machine actively refused it".
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27618694

http://stackoverflow.com/comment/43434809
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27502211
type: QuestionComment
has text: Please clarify your question !

http://stackoverflow.com/comment/43555377
type: Comment
score: 0
type: AnswerComment
has text: @Leo but why? it's easier and better to use maps in this case
comment on: http://stackoverflow.com/a/27565062

http://stackoverflow.com/q/27609595
answer count: 2
has answer: http://stackoverflow.com/a/27609713
has comment: http://stackoverflow.com/comment/43644657
score: 0
tagged with: truncate
tagged with: sequence
has title: Java Add Escape Sequence to String
has answer: http://stackoverflow.com/a/27611596
type: UnansweredQuestion
tagged with: escaping
tagged with: java
has body: Say for example, that I have a method that returns the string \"ex\". Obviously, this will be printed out as "ex" How can I make a method that allows me to print \"ex\" without the escape sequences cut out? I need to create or use another method to do so, as I have no access to the original method that returns the string. The reason I'm doing this is because I am trying to create a JSON representation to parse with a json parser. With my current code, I am getting {example:[{"url":""ex""}]} along with all the other special characters that individually need an escape character in order for it to parse properly.
type: Question

http://stackoverflow.com/q/27623450
has comment: http://stackoverflow.com/comment/43668946
type: UnansweredQuestion
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43670591
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: First, let me emphasize that I am not talking about obfuscating library projects independently or obfuscating library jars. Suppose an Android app FooApp has a library project FooLib in its build path (please note it is a project, not a jar in Eclipse). Is FooLib obfuscated when FooApp is obfuscated by ProGuard? I have configured FooLib to use ProGuard, but such configuration does not seem to do anything.
tagged with: android
has title: Does Proguard obfuscate library projects used by an app?
tagged with: proguard
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/43590014
has text: This code is written by someone else .I am debugging the memory leak. @Tom .Plz forget about compilation error and lets solve the main problem
comment on: http://stackoverflow.com/q/27582765
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43577015
score: 1
type: AnswerComment
has text: "*The closest you could get is saying x happens-before r2, but the partial order would allow x to also occur before r1, thus collapsing the read operations*" -> yes, and no: if you have 2 writes w1 and w2 and r1 is *executed* in between (wall clock perspective) then it must see w1 and can't see w2 yet. If r2 is executed subsequently it must see w2. So you can only collapse the two reads if you can guarantee that no write can be executed in between (which is what your last paragraph says I think).
type: Comment
comment on: http://stackoverflow.com/a/27575621

http://stackoverflow.com/a/27613803
score: 0
type: Answer
has body: You can have many different versions of Java on your system. In general Java depends on environment variables and the PATH environment variable. Some programs and tools look for tool specific environment variables to allow you to use a specific version of Java for that particular tool. In the case of IntellJ the link that Eddie B posted in his comment explains how IntellJ determines which "installation" of Java it should use.
answers question: http://stackoverflow.com/q/27613577

http://stackoverflow.com/q/27582757
accepted answer: http://stackoverflow.com/a/27583544
has answer: http://stackoverflow.com/a/30982122
has answer: http://stackoverflow.com/a/51706079
has answer: http://stackoverflow.com/a/52597519
has answer: http://stackoverflow.com/a/49668736
has title: Catch duplicate entry Exception
favorite count: 0
has answer: http://stackoverflow.com/a/56824030
has answer: http://stackoverflow.com/a/27583544
has comment: http://stackoverflow.com/comment/43590897
answer count: 9
possible better answer: http://stackoverflow.com/a/27582891
has body: How can i catch this Exception : com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '22-85' for key 'ID_CONTACT'
linked to: http://stackoverflow.com/q/54900971
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/55678435
has answer: http://stackoverflow.com/a/27582891
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/44712749
tagged with: mysql
score: 40
has comment: http://stackoverflow.com/comment/43590747
type: Question
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/43590418
tagged with: sqlexception
has answer: http://stackoverflow.com/a/58239601
upvote count: 40
has comment: http://stackoverflow.com/comment/43590033

http://stackoverflow.com/comment/43681183
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27630252
has text: @ClearCode, can you show log please and part of code?
score: 0

http://stackoverflow.com/comment/43443791
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27504787
has text: @DavidtenHove, mycb is a field, and I tried with 'private' and 'final' and the result is the same.
score: 0

http://stackoverflow.com/comment/43692607
comment on: http://stackoverflow.com/a/27636612
score: 0
type: AnswerComment
has text: `Date` has predefined `toString()` so it prints as per its definition.
type: Comment

http://stackoverflow.com/comment/43455193
type: Comment
comment on: http://stackoverflow.com/a/27507378
score: 0
type: AnswerComment
has text: It looks so simple and yet I couldn't figure it out. I feel relieved that I will not get more of those warnings and still use generics. Thank you very much.

http://stackoverflow.com/comment/43625037
type: Comment
has text: Immutable collections might allow changing their contens, returning new objects with new contents. Check out Scala immutable collections, for example. But Guava doesn't have this functionality, probably because ImmutableXXX collections build for different purposes.
type: QuestionComment
comment on: http://stackoverflow.com/q/27599607
score: 0

http://stackoverflow.com/a/27632247
accepted answer of: http://stackoverflow.com/q/27631657
has comment: http://stackoverflow.com/comment/44349747
answers question: http://stackoverflow.com/q/27631657
has comment: http://stackoverflow.com/comment/44349896
type: AcceptedAnswer
has body: My friend has found answer for my question.. To get common column from multiple tables,Use INFORMATION_SCHEMA.COLUMNS and common column name. Query : select *from information_schema.columns where column_name='column name' Hope this will helpful !
score: 0
type: Answer

http://stackoverflow.com/comment/43449335
type: Comment
score: 0
has text: Thank you. So why do we need to skip `bits - val + (n-1) < 0` (or as you say `bits - val + (n-1) >= INT_MAX + 1` ? What is so magic in this formula ?
type: AnswerComment
comment on: http://stackoverflow.com/a/27505468

http://stackoverflow.com/q/27566066
has comment: http://stackoverflow.com/comment/43557608
has comment: http://stackoverflow.com/comment/43557909
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43557503
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27567814
score: 9
type: Question
has comment: http://stackoverflow.com/comment/43557329
has answer: http://stackoverflow.com/a/27567814
tagged with: jackson
answer count: 2
has title: Jackson, move dynamic property value one level up
has body: I have problem with modelling server responses, some of them look like that: { "_links":{ "self":{ "href":"http:\/\/example.com" } }, "_embedded":{ "category":{ &lt;...data...&gt; } } } or { "_links":{ "self":{ "href":"http:\/\/example.com" } }, "_embedded":{ "episodes":[ &lt;...list_data...&gt; ] } } It seems that "_embedded" property has only one JSON object and that object has only one property ( named differently ) with actual data. I would like to create some kind of generic POJO class to support those kind of responses, something like: public abstract class EmbeddedResponse&lt;T&gt; { @JsonProperty("_embedded") private T embedded; public T getEmbedded() { return embedded; } ... &lt;other_members&gt; ... } public class CategoriesResponse extends EmbeddedResponse&lt;List&lt;Category&gt;&gt; { } Where calling 'getEmbedded()' would return list of categories ( or episodes, or anything ). I am working with custom deserialization now, but without much success, I would like to keep code base minimal.
favorite count: 0
has comment: http://stackoverflow.com/comment/43557970
upvote count: 9
possible better answer: http://stackoverflow.com/a/27588707
has answer: http://stackoverflow.com/a/27588707

http://stackoverflow.com/comment/43478777
comment on: http://stackoverflow.com/a/27525040
score: 0
type: Comment
type: AnswerComment
has text: @Espore Then you need your value to come from somewhere! If you're going to be generating it programmatically, you get yourself some `float myBalance` somehow, and call it by passing `myBalance`. If you want to be able to specify the value on the command line when you run the application, then Eran's answer is the one to go for.

http://stackoverflow.com/a/63049958
downvote count: 1
answers question: http://stackoverflow.com/q/27632355
score: -1
has comment: http://stackoverflow.com/comment/111495488
upvote count: 0
type: Answer
has body: If eclipse is not showing path, Please click on RUN-&gt; Run configuration-&gt;click on environment tab-&gt;click on New-&gt; add a path variable as mingw_path(if compiler is mingw in case of c++ ) and set value as C:\MinGw\bin (please check ur mingw bin path then only set).

http://stackoverflow.com/comment/43603057
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27584718
type: Comment
has text: posted a separate question for this http://stackoverflow.com/questions/27589520/using-modelattribute-on-a-method-argument

http://stackoverflow.com/q/27486705
tagged with: java
type: UnansweredQuestion
tagged with: icalendar
tagged with: rfc2445
has body: I ran through a lot of RRULEs just for testing out the performance of google-rfc-2445 (a Java implementation of IETF RFC 2445 iCalendar). I saw that I got the start date back in some cases in the returning list from the method. The test is very simple: private static void runGoogleTests() throws ParseException { DateTimeZone dtz = DateTimeZone.UTC; DateTime dtStart = new DateTime("2014-11-22T00:00:00Z", dtz);//SATURDAY DateTimeIterable dti = DateTimeIteratorFactory.createDateTimeIterable("RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO", dtStart, dtz, true); System.out.println("Size of iterable = " + Iterators.size(dti.iterator())); for(DateTime dateTime : dti) { System.out.println(dateTime); } } The list returned by the factory returns this list. The first date is the start date and it's a saturday that should not be there. The RRULE also contained a COUNT=10 so why return 11? Size of iterable = 11 2014-11-22T00:00:00.000Z 2014-11-24T00:00:00.000Z 2014-12-01T00:00:00.000Z 2014-12-08T00:00:00.000Z 2014-12-15T00:00:00.000Z 2014-12-22T00:00:00.000Z 2014-12-29T00:00:00.000Z 2015-01-05T00:00:00.000Z 2015-01-12T00:00:00.000Z 2015-01-19T00:00:00.000Z 2015-01-26T00:00:00.000Z Someone using the Google-rfc-2445 must have encountered this problem before? I posted the issue on the projects page but it's very quiet there. Link to the issue on google-rfc-2445 page
downvote count: 0
has title: Start date returns in some cases when using google-rfc-2445 (iCalendar)
favorite count: 0
has answer: http://stackoverflow.com/a/27659453
upvote count: 8
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27628608
score: 8

http://stackoverflow.com/comment/43555355
has text: upadated question...not using map or collections...sticking to string, arrays
comment on: http://stackoverflow.com/a/27565062
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27551130
type: Answer
downvote count: 0
score: 1
has body: Please advice if there is a simpler or elegant way to achieve the same. You can extend the DefaultListSelectionModel and override the addSelectionInterval(...) method. Then you add you custom selection model to the table.
answers question: http://stackoverflow.com/q/27546977
upvote count: 1

android-volley
tags question: http://stackoverflow.com/q/27475332
tags question: http://stackoverflow.com/q/27608648
tags question: http://stackoverflow.com/q/27579468
type: Tag
tags question: http://stackoverflow.com/q/27605539
tag name: android-volley
tags question: http://stackoverflow.com/q/27629916

http://stackoverflow.com/comment/43626424
has text: @Gustavo In that case, try the code in my answer. First the `while (rs.next())` loop, and then the if conditions with the changed order.
type: Comment
comment on: http://stackoverflow.com/a/27601116
score: 0
type: AnswerComment

http://stackoverflow.com/a/27620912
score: 4
has body: Don't access numbers[3]; when your array has only 3 elements, whose indices are 0, 1 and 2. Also don't access chars[numbers.length + 4] before making sure this is a valid index of the chars array.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27620899
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27620899
has comment: http://stackoverflow.com/comment/43662603
downvote count: 0
has comment: http://stackoverflow.com/comment/43662929

http://stackoverflow.com/a/27581685
upvote count: 1
answers question: http://stackoverflow.com/q/27581641
downvote count: 0
score: 1
has body: You have defined just 1D array and its number so you should use int. Instead of doing it recursively, try solving it easily with two for loops (1 for row and 1 for column) for 2D array as below: int array[][] = {{0, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1}}; for (int i = 0; i&lt; array.length; i++) { for (int j = 0; j&lt; array[0].length; j++) { if (array[i][j] == 1) { array[i][j] = 2; } } }
type: Answer
has comment: http://stackoverflow.com/comment/43587838

http://stackoverflow.com/comment/43428601
has text: I think the comparison in the following `if` is not correct `if(publicity.getBrand().getCompany() == company)`. From your `company` param it seems like Company `Object` but you comparing it using `==` which should be valid for `Integers` for `Object` you should use `.equals`. This might help you..
comment on: http://stackoverflow.com/q/27498165
score: 0
type: Comment
type: QuestionComment

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/27595635
type: Tag

http://stackoverflow.com/comment/43450650
comment on: http://stackoverflow.com/a/27510227
score: 0
type: Comment
has text: Uhm, if you are running an infinite loop you can never return something after that unless you beak out of the loop.
type: AnswerComment

http://stackoverflow.com/a/46713855
downvote count: 0
answers question: http://stackoverflow.com/q/27545013
has body: I know the question is old but there is a simple way to "convert" XWPFDocument to InputStream. Just in case someone needs it... ByteArrayOutputStream b = new ByteArrayOutputStream(); doc.write(b); // doc should be a XWPFDocument InputStream inputStream = new ByteArrayInputStream(b.toByteArray());
score: 7
upvote count: 7
type: Answer

http://stackoverflow.com/comment/43531208
has text: possible duplicate of [Exception in thread "main" java.lang.UnsupportedClassVersionError, Unsupported major.minor version 52.0](http://stackoverflow.com/questions/18161907/exception-in-thread-main-java-lang-unsupportedclassversionerror-unsupported-m)
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27551862

http://stackoverflow.com/q/27563999
has title: find substring ignoring whitespaces
has answer: http://stackoverflow.com/a/27564197
tagged with: search
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: string
score: -4
favorite count: 0
has body: I want to search java strings ignoring whitespaces. for eg abc cdf sdf abc cdf sdf abc cdf sdf what should be a possible search keyword , may be regular expression. If I will search the above strings with abc cdf sdf This will not match.
type: Question
has answer: http://stackoverflow.com/a/27564643
accepted answer: http://stackoverflow.com/a/27564197
has answer: http://stackoverflow.com/a/27564039
possible better answer: http://stackoverflow.com/a/27564643
answer count: 3
has comment: http://stackoverflow.com/comment/43553358
tagged with: java

http://stackoverflow.com/a/59891528
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27589701
has body: In kotlin use the following fun getCurrentTime(dateFormatInPut:String,myDate:String): Time { val sdf = SimpleDateFormat(dateFormatInPut, Locale.ENGLISH) val date = sdf.parse(myDate) val millis = date!!.time val calendar=Calendar.getInstance() calendar.timeInMillis=millis return when (calendar.get(Calendar.HOUR_OF_DAY)) { in 0..11 -&gt; Time.Morning in 12..15 -&gt; Time.AfterNoon else -&gt; Time.Evening } } Here Time is enum class enum class Time { Morning, AfterNoon, Evening }

http://stackoverflow.com/q/27626825
type: AnsweredQuestion
downvote count: 0
has body: Using Spring Data JPA can I do a query by example where a particular entity instance is used as the search criteria? For example (no pun intended), if I have a Person entity that looks like: @Entity public class Person { private String firstName; private String lastName; private boolean employed; private LocalDate dob; ... } I could find all employed persons with a last name of Smith born on January 1, 1977 with an example: Person example = new Person(); example.setEmployed(true); example.setLastName("Smith"); example.setDob(LocalDate.of(1977, Month.JANUARY, 1)); List&lt;Person&gt; foundPersons = personRepository.findByExample(example);
tagged with: java
tagged with: spring-data
score: 44
type: Question
has answer: http://stackoverflow.com/a/37013060
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/27790696
has answer: http://stackoverflow.com/a/27627297
accepted answer: http://stackoverflow.com/a/27627297
answer count: 3
has comment: http://stackoverflow.com/comment/43675221
has title: Spring Data JPA: Query by Example?
upvote count: 44
possible better answer: http://stackoverflow.com/a/37013060
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/43674723

http://stackoverflow.com/a/27508444
score: 0
type: Answer
has body: how come when i run the classes separately nothing actually prints out, but when i run main class, everything prints? A JAVA code requires main method to start its execution. So when you run other classes, it won't find the main method and so it does not print anything. In inheritance only the variables and methods which you declare are inherited (passed on) to the sub class. The other things are of no matter for sub class. For example: Consider the relationship between you and your dad. Your dad is the super class here and you are the sub class. You have some all properties of your dad but they might not be the same. Like you have your eyes same as your dad, but their color may be different. An if statement can be considered as any decision that your dad took but you don't have to take that decision, so it is irrelevant to you. System.out.println(); in mian does not do anything extra. You can remove it. I hope this helps you a bit. If you have any questions, do ask me.
answers question: http://stackoverflow.com/q/27508119

http://stackoverflow.com/q/27549359
score: -7
has comment: http://stackoverflow.com/comment/43524975
tagged with: string
favorite count: 0
answer count: 3
downvote count: 8
has body: I want to parse numbers from a String. Example input String: 0 = 2*x+2*x^2-4 Transform to: leftside = 0 rightside = 2*x,2*x^2,-4 Finally I want to save the numbers in variables like leftN = 0 , rightX = 2 How can this be done? Any hints?
has title: Reading a String and get the numbers out of it;
type: UnansweredQuestion
tagged with: equation
upvote count: 1
has comment: http://stackoverflow.com/comment/43525514
tagged with: java
has answer: http://stackoverflow.com/a/27549420
type: Question
has comment: http://stackoverflow.com/comment/43525329
has answer: http://stackoverflow.com/a/27549572
linked to: http://stackoverflow.com/q/9785553
has comment: http://stackoverflow.com/comment/43525190
has answer: http://stackoverflow.com/a/27549489

http://stackoverflow.com/q/27499450
has title: How do you change the label text in java using eclipse and scene builder?
possible better answer: http://stackoverflow.com/a/27499574
favorite count: 0
has answer: http://stackoverflow.com/a/27499737
upvote count: 2
has body: I'm trying to make a "Hello World" using eclipse and scene builder. package lj.HelloWorld; import java.io.IOException; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; public class HelloWorld extends Application { private Stage primaryStage; private BorderPane rootLayout; @Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; this.primaryStage.setTitle("AddressApp"); initRootLayout(); } /** * Initializes the root layout. */ public void initRootLayout() { try { // Load root layout from fxml file. FXMLLoader loader = new FXMLLoader(); loader.setLocation(HelloWorld.class.getResource("rootHelloWorld.fxml")); rootLayout = (BorderPane) loader.load(); // Show the scene containing the root layout. Scene scene = new Scene(rootLayout); primaryStage.setScene(scene); primaryStage.show(); } catch (IOException e) { e.printStackTrace(); } } // my attempt to refer to my label object in scenebuilder. @FXML private Label lblOutput; @FXML private void handleClick(ActionEvent event) { lblOutput.setText("This"); } } And this is my fxml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import java.lang.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;?import javafx.scene.layout.BorderPane?&gt; &lt;BorderPane prefHeight="200.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"&gt; &lt;center&gt; &lt;Pane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER"&gt; &lt;children&gt; &lt;Button fx:id="btnClick" layoutX="98.0" layoutY="14.0" mnemonicParsing="false" text="Click Me" /&gt; &lt;Label fx:id="lblOutput" layoutX="167.0" layoutY="18.0" text="1231231" /&gt; &lt;/children&gt; &lt;/Pane&gt; &lt;/center&gt; &lt;/BorderPane&gt; I just want to know how to refer the the …
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: scenebuilder
tagged with: javafx
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27499737
has answer: http://stackoverflow.com/a/27499574
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/43698472
has text: See [related post](http://stackoverflow.com/a/26341881/2587435)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27638754
type: QuestionComment

http://stackoverflow.com/q/27594455
score: 2
has comment: http://stackoverflow.com/comment/43612928
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has title: How to set default database values
has answer: http://stackoverflow.com/a/27594727
has comment: http://stackoverflow.com/comment/43612963
has body: I'm trying to set up the default database values as follows, but I get: error: Caused by: java.lang.NullPointerException for: @Column(name = "dateOfBirth", insertable = false, updatable = false, nullable=false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") @Temporal(javax.persistence.TemporalType.DATE) private Date dateOfBirth; AND... error: Caused by: java.lang.NumberFormatException: For input string: "" for: @Column(name = "zip", insertable = false, updatable = false, nullable=false, columnDefinition = "bigint(20) default 0") private long zip; What is the correct way for setting up the default values for Date and long?
has answer: http://stackoverflow.com/a/27600319
upvote count: 2
answer count: 2
tagged with: jpa
favorite count: 0
type: UnansweredQuestion
tagged with: hibernate-mapping

http://stackoverflow.com/a/27528837
type: Answer
accepted answer of: http://stackoverflow.com/q/27527892
answers question: http://stackoverflow.com/q/27527892
has body: Here is example, explanations are in code. public static void main(String[] args) throws FileNotFoundException, IOException { List&lt;String&gt; xValues = new ArrayList&lt;String&gt;(); List&lt;String&gt; yValues = new ArrayList&lt;String&gt;(); List&lt;String&gt; zValues = new ArrayList&lt;String&gt;(); //convert these lists of String to double yourself. xValues = readValuesFor("x"); yValues = readValuesFor("y"); zValues = readValuesFor("z"); //print contents System.out.println("X values: "); for (final String x : xValues) { System.out.println(x); } System.out.println("Y values: "); for (final String y : yValues) { System.out.println(y); } System.out.println("Z values:"); for (final String z : zValues) { System.out.println(z); } } public static List&lt;String&gt; readValuesFor(String variableName) throws FileNotFoundException, IOException { final List&lt;String&gt; result = new ArrayList&lt;String&gt;(); final BufferedReader br = new BufferedReader(new FileReader("output.txt")); //change file name and path to yours String line; //read through file until you find a line that end with the variable x ,y, or z while ((line = br.readLine()) != null) { if (line.endsWith("for "+variableName.trim())) { break; } } if (!variableName.equals("z")) { //if variable is x or y while (!(line = br.readLine()).contains("Distribution")) { //read the lines between line ending in letters x or y and line containing word "Distribution" final String[] values = line.split(" "); result.add(values[0]); //get the first value of the split } } else{ while (!(line = br.readLine()).contains("Done")) { //if variable is z //read the lines between line ending with letter z and line containing word "Done" final String[] values = line.split(" "); result.add(values[0]); //get the first value of the split } } return result; //array with first values as string } Output is: X values: -5.344029659372277 -3.6282706290477384 -3.497553178865327 -0.8324886197923229 Y values: -3.8401834274154405 -2.8617608524112…
has comment: http://stackoverflow.com/comment/43487501
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27561605
has body: I have the following code in Java: public static void deriveKeyAndIV(String password) throws Exception { SecureRandom random = new SecureRandom(); if (salt == null) { salt = new byte[HASH_BYTE_SIZE / 8]; // use salt size at least as long as hash random.nextBytes(salt); } if (ivBytes == null) { ivBytes = new byte[HASH_BYTE_SIZE / 8]; random.nextBytes(ivBytes); } PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt, PBKDF2_ITERATIONS, HASH_BYTE_SIZE); SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); keyBytes = skf.generateSecret(spec).getEncoded(); } public static byte[] encrypt(byte[] message) throws Exception { // wrap key data in Key/IV specs to pass to cipher SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); //IvParameterSpec ivSpec = new IvParameterSpec(ivBytes); // create the cipher with the algorithm you choose // see javadoc for Cipher class for more info, e.g. Cipher cipher = Cipher.getInstance("AES/GCM/PKCS5Padding"); GCMParameterSpec gps = new GCMParameterSpec(128, ivBytes); cipher.init(Cipher.ENCRYPT_MODE, key, gps); byte[] encrypted = new byte[cipher.getOutputSize(message.length)]; int enc_len = cipher.update(message, 0, message.length, encrypted, 0); enc_len += cipher.doFinal(encrypted, enc_len); return encrypted; } public static byte[] decrypt(byte[] cipher_text) throws Exception { // wrap key data in Key/IV specs to pass to cipher SecretKeySpec key = new SecretKeySpec(keyBytes, "AES"); // create the cipher with the algorithm you choose // see javadoc for Cipher class for more info, e.g. Cipher cipher = Cipher.getInstance("AES/GCM/PKCS5Padding"); GCMParameterSpec gps = new GCMParameterSpec(128, ivBytes); cipher.init(Cipher.DECRYPT_MODE, key, gps); byte[] decrypted = new byte[cipher.getOutputSize(cipher_text.length)]; int dec_len = cipher.update(cipher_text, 0, cipher_text.length, decrypted, 0); dec_len += cipher.doFinal(decrypted, dec_len); return decrypted; } public static void main(String[] args) { String pas…
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27593836
tagged with: aes-gcm
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27593836
tagged with: openssl
downvote count: 0
possible better answer: http://stackoverflow.com/a/27567689
has answer: http://stackoverflow.com/a/27567689
favorite count: 0
has comment: http://stackoverflow.com/comment/43611362
upvote count: 2
has title: decrypting aes-gcm encrypted with java using openssl

http://stackoverflow.com/comment/43599298
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27587526
has text: Can't we do it by autowiring it ? If we autowire it, unit testing becomes easier for me. I can load a mocked instance while unit testing.

http://stackoverflow.com/q/27620274
has comment: http://stackoverflow.com/comment/43661731
accepted answer: http://stackoverflow.com/a/27620588
type: AnsweredQuestion
score: 0
tagged with: java
has body: I am configuring the database details in one of my spring configuration files as below: &lt;bean id="awd" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="com.ibm.as400.access.AS400JDBCDriver"/&gt; &lt;property name="url" value="jdbc:db2://123.43.133.257/XYZ" /&gt; &lt;property name="username" value="xyz" /&gt; &lt;property name="password" value="xyz" /&gt; &lt;/bean&gt; When I try to connect the above database from Java end, I am getting the following exception: Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Bad connection URL at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:280) ... 139 more Caused by: java.sql.SQLException: Bad connection URL at com.ibm.u2.jdbc.UniJDBCMsgFactory.createException(UniJDBCMsgFactory.java:109) at com.ibm.u2.jdbc.UniJDBCDriver.connect(UniJDBCDriver.java:116) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173) at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:153) at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119) at org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource.getConnection(AbstractRoutingDataSource.java:162) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) at org.springframework.jdbc.datasource.DataSourceUtils.…
tagged with: ibm-midrange
type: Question
tagged with: db2-400
answer count: 1
has comment: http://stackoverflow.com/comment/43661683
has answer: http://stackoverflow.com/a/27620588
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43661610
has title: java.sql.SQLException: Bad connection URL while accessing the database

http://stackoverflow.com/a/61675604
type: Answer
has comment: http://stackoverflow.com/comment/109489422
score: 1
upvote count: 1
has body: Double-check you actually saved your file. Many of us forget to save the file and simply hit run.
downvote count: 0
answers question: http://stackoverflow.com/q/27632355

http://stackoverflow.com/comment/43605920
comment on: http://stackoverflow.com/q/27591061
score: 0
has text: @lea protected E[] elements = null;
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27594878
has answer: http://stackoverflow.com/a/27595673
score: 4
favorite count: 0
tagged with: maven-shade-plugin
answer count: 3
upvote count: 4
has answer: http://stackoverflow.com/a/27595660
accepted answer: http://stackoverflow.com/a/27595660
has title: Transitive dependencies of a shaded JAR
has answer: http://stackoverflow.com/a/27595158
tagged with: maven
type: AnsweredQuestion
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27595673
type: Question
has body: I have packaged myjar using maven-shade plugin and am interested to know how it will behave when referenced by a client maven project Does a maven shaded jar download transitive dependencies when referenced in a maven environment? Am I able to exclude the dependencies from being packaged by the shade plugin and assume that they will be downloaded by maven when the client references myjar and builds? Scenarios required: 1. Execute myjar from command line to get an AWT Forms dialog to appear (which will write out a licence file) 2. Referenced in a standard maven by a client project. Maven should download all dependencies transitively. Therefore to satisfy scenario 1 I want to include the dependencies for forms-1.2.1 but exclude all others to be downloaded by the client during scenario 2.

http://stackoverflow.com/a/27601674
upvote count: 1
answers question: http://stackoverflow.com/q/27601535
score: 1
downvote count: 0
has body: String is immutable, cant be replaced, just toReturn = toReturn.replace("$...","")
type: Answer

http://stackoverflow.com/a/27481188
has comment: http://stackoverflow.com/comment/43397010
answers question: http://stackoverflow.com/q/27481147
has body: You are overriding the first one with the second statement scrollPane.getViewport().setView(body); scrollPane.getViewport().setView(body2); You should add both JPanels to some parent component, and set that component as view. Something like this: Container cont = new Container(); cont.add(body); cont.add(body2); scrollPane.getViewport().setView(cont); EDIT I don't think you need that line (setView(...)) at all. Try this (put this instead of last four lines) Container cont = new Container(); cont.add(scrollPane); cont.add(body2); cont.setLayout(new GridLayout()); jframe.add(cont); jframe.setVisible(true);
has comment: http://stackoverflow.com/comment/43395143
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43396168
type: Answer
has comment: http://stackoverflow.com/comment/43396728
has comment: http://stackoverflow.com/comment/43395406
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27481147

http://stackoverflow.com/q/27523939
has answer: http://stackoverflow.com/a/27592797
tagged with: spring
upvote count: 4
has answer: http://stackoverflow.com/a/27524217
has body: I configured my web application to authenticate via Active Directory repo and it works fine, but I always need to insert credentials in login form. The application clients will be Windows machines connected to the company network all in the same domain. I need to configure my web app to authenticate automatically the user that has been yet authenticated in Windows. I'm using this config for Spring Security: &lt;security:authentication-manager alias="authenticationManager"&gt; &lt;security:authentication-provider user-service-ref="userDetailsService"&gt; &lt;security:password-encoder hash="plaintext" /&gt; &lt;/security:authentication-provider&gt; &lt;!-- for DB authentication --&gt; &lt;security:authentication-provider ref="adAuthenticationProvider" /&gt; &lt;/security:authentication-manager&gt; &lt;bean id="adAuthenticationProvider" class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"&gt; &lt;constructor-arg name="domain" value="mydomain.it" /&gt; &lt;constructor-arg name="url" value="ldap://domaincontroller.mydomain.it/" /&gt; &lt;/bean&gt; NOTE I also need a secondary authentication provider to provide DB authentication. I also set the following option in IE (v 9) that should enable automatic logon: But it doesn't work... so what's wrong in my configuration? NOTE #2 I'm using Spring v 3.2.9 and Spring Security v 3.2.3
linked to: http://stackoverflow.com/q/21093480
tagged with: java
tagged with: authentication
has answer: http://stackoverflow.com/a/27525972
type: Question
tagged with: active-directory
score: 4
has title: Single sign-on not working in Spring web app
answer count: 3
linked to: http://stackoverflow.com/q/22066184
downvote count: 0
linked to: http://stackoverflow.com/q/14729387
tagged with: spring-security
favorite count: 0
linked to: http://stackoverflow.com/q/13583682
type: UnansweredQuestion

http://stackoverflow.com/a/27622496
answers question: http://stackoverflow.com/q/27622438
has comment: http://stackoverflow.com/comment/43665443
type: Answer
has body: Something like this maybe? public static PlayerData importFromString(String str) { Gson gson = new Gson(); Object obj = gson.fromJson(str, PlayerData.class); return (PlayerData) obj; }
score: 0

http://stackoverflow.com/comment/43529433
has text: Elliott Frisch: the increment is in a constructor in a another class
score: 0
comment on: http://stackoverflow.com/q/27551305
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43566778
type: AnswerComment
has text: Could you elaborate a little more on how you "touch" the data to start the transaction (solution #1 from the link), but still maintain abstraction from the data layer? I guess I don't understand how you make what appears to be two round trips from the business layer to the data layer all take place under one transaction.
type: Comment
comment on: http://stackoverflow.com/a/27562820
score: 0

http://stackoverflow.com/comment/43600542
has text: I checked if the number was power of two by using `if((n & (n - 1)) == 1)`, and I used harolds answer, because I thought it was easier to use with `int`s. Thanks everyone!
type: Comment
comment on: http://stackoverflow.com/a/27583174
type: AnswerComment
score: 0

http://stackoverflow.com/q/27475121
tagged with: git
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/43384992
has comment: http://stackoverflow.com/comment/43427696
downvote count: 0
tagged with: github
tagged with: repository
favorite count: 0
has title: Error while configuring local repository in Git in Eclipse
has body: This may sound too amateur but as a whole i want to configure my Git repository and move my code from eclipse to Github. So i checked out a couple of video tutorials and applied the steps but none of them seems to work in my case. This is what i did. 1) Right click on the project > Team > Share Project > Select Git > and then this window comes now when i try to create my repository by clicking on create button> fill the parent directory and the name and click finish. Nothing really happens and i am redirected to the same previous window, without the repository column loaded. Can anyone help me out of this. First i thought it to be a Eclipse version issue, earlier i tried on Luna, also after installing Juno its the same issue. Help me with this. Thanks in advance.
has comment: http://stackoverflow.com/comment/43384956
type: UnansweredQuestion

http://stackoverflow.com/comment/43411157
score: 2
comment on: http://stackoverflow.com/q/27489780
has text: Can you show the definition of `Settings`? Did you change the class definition since you last serialized the object?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43572147
score: 0
has text: @user3634133 There are many videos on youtube that can help. e.g. https://www.youtube.com/results?search_query=JSP
type: QuestionComment
comment on: http://stackoverflow.com/q/27571189
type: Comment

http://stackoverflow.com/q/27574785
has answer: http://stackoverflow.com/a/27575085
tagged with: jdbc
has body: I need to call a stored procedure using dblink and Java, I've got this code calling the stored procedure with jdbc, but now I need to do the same call using dblink this is the call using JDBC String sqlQuery = "{ CALL ACCUMULATED.GENERAR_ACUMULATED (?,?,?) }"; DatabaseConnection connection = new DatabaseConnection(); try { int[] returnSQLTypes = { Types.VARCHAR }; Object[] returnValues = null; List args = new ArrayList(); args.add(this.getCompanyCodeNgsoft(companyCode)); args.add(codUsuario); args.add("S"); connection.connect(DatabaseConnection.NGSOFT_DATA_SOURCE_NAME); returnValues = connection.executeStoreProcedure(sqlQuery, args, returnSQLTypes); String swSuccessful = (String) returnValues[0]; if ((swSuccessful != null) &amp;&amp; swSuccessful.trim().equalsIgnoreCase("S")) { successful = true; } else { successful = false; } } catch (SQLException ex) { throw new GenerateInterfacesException(getMessageFac().getMessage( ex.getErrorCode())); } finally { try { connection.disconnect(); } catch (SQLException ex1) { throw new GenerateInterfacesException(getMessageFac() .getMessage(ex1.getErrorCode())); } } thanks
score: 0
answer count: 1
tagged with: stored-procedures
accepted answer: http://stackoverflow.com/a/27575085
tagged with: java
has title: call stored procedure using dblink and Java
type: AnsweredQuestion
tagged with: dblink
type: Question

http://stackoverflow.com/a/27570839
score: 3
answers question: http://stackoverflow.com/q/27490318
upvote count: 4
has comment: http://stackoverflow.com/comment/53217946
has body: No. Yaml file is parsed at startup and given to the application as Configuration object once and for all. I believe you can change the file after that but it wouldn't affect your application until you restart it. Possible follow up question: Can one restart the service programmatically? AFAIK, no. I've researched and read the code somewhat for that but couldn't find a way to do that yet. If there is, I'd love to hear that :).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/46878947
has comment: http://stackoverflow.com/comment/43604787
has comment: http://stackoverflow.com/comment/46876038
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27490318

http://stackoverflow.com/comment/43999290
type: Comment
comment on: http://stackoverflow.com/a/27623375
has text: Sure, your idea is quite good for a release or nigthly build.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27482354
has comment: http://stackoverflow.com/comment/43397413
has title: Maven update links
has body: Hi I'm new in android development and in JAVA. I have Android studio and a new project. I added to my project one dependency on library from maven repository in project properties. So if for example after one year someone will update this library in maven repository, I will need update also link to this library in project settings, or it will load new version of library automatically? Thanks. Here my .gradle configuration: apply plugin: 'com.android.library' dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.robbypond:mopub-android-sdk:3.2.2d' compile 'com.googlecode.android-query:android-query:0.25.9' }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27482545
tagged with: java
has comment: http://stackoverflow.com/comment/43397276
has comment: http://stackoverflow.com/comment/43397350
type: Question
has answer: http://stackoverflow.com/a/27482545
score: 0
tagged with: android
answer count: 1
tagged with: maven-plugin
has comment: http://stackoverflow.com/comment/43397367
tagged with: android-studio
tagged with: maven

http://stackoverflow.com/comment/43524735
comment on: http://stackoverflow.com/q/27544456
has text: The `<200c><200b>` makes me wonder if you have some trash character in your config?
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/27574874
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/43576238
has answer: http://stackoverflow.com/a/27575171
tagged with: java
tagged with: hibernate
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27575188
tagged with: junit
has comment: http://stackoverflow.com/comment/43575947
has answer: http://stackoverflow.com/a/27575188
accepted answer: http://stackoverflow.com/a/27575171
type: Question
has comment: http://stackoverflow.com/comment/43575723
score: 0
has body: I'm testing DAO layer in Spring MVC + Hibernate + HSQLDB and I'm not able to load playlist twice from database. I don't know why I get size of List as 0. Method testSavePlaylist is successful, but method test_getPlaylistById fails. When I test only one method it's working great. Error Trace: java.lang.AssertionError: expected:&lt;2&gt; but was:&lt;0&gt; at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:743) at org.junit.Assert.assertEquals(Assert.java:118) at org.junit.Assert.assertEquals(Assert.java:555) at org.junit.Assert.assertEquals(Assert.java:542) at adrian.example.musicplayer.dao.music.PlayListImplDaoTest.test_getPlaylistById(PlayListImplDaoTest.java:44) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87) at or…
answer count: 2
has title: Can't get elements from database twice
tagged with: spring

http://stackoverflow.com/q/27590275
answer count: 1
has comment: http://stackoverflow.com/comment/43604962
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43604666
has answer: http://stackoverflow.com/a/27590530
has comment: http://stackoverflow.com/comment/43604929
tagged with: java
has title: Getting the result of an activity from a non-activity class
linked to: http://stackoverflow.com/q/2848775
upvote count: 1
downvote count: 1
type: Question
tagged with: start-activity
has body: &lt;summary&gt; Is there an elegant way of getting the result of an activity from a non-activity class, or is it always going to be a hack? Would I be better avoiding that situation if possible? &lt;/summary&gt; I have an activity, that has an instance of a session for a web service, which will generally be pre-authenticated (the session key will be saved in SharedPreferences). However, the first time it runs, I will need to pop up a log in activity, which will return the username and password to the session, which will then talk to the server and get a session key. Ideally, I would like to have the non-activity session class call startActivityForResult, but I'm not sure it's possible. I've seen various questions about how it can be done: How to get the result from OnActivityResult inside another class?(outside of the activity use startActivityForResult from non-activity But they all seem a little hacky. I've also seen this, which suggests that passing round contexts is not the best idea anyway: http://android-developers.blogspot.co.uk/2009/01/avoiding-memory-leaks.html Another option is to save the username and password to sharedpreferences and retrieve it in the other class, but then I'd have to have some way of figuring out when it had been saved, and it all seems to be getting rather messy. Another option is to make the session a non-displaying activity. Seems like a large overhead though. My project is still in planning stages, so I'm after best practice. What is the most elegant way to do this?
has comment: http://stackoverflow.com/comment/43605043
linked to: http://stackoverflow.com/q/25557087
score: 0

http://stackoverflow.com/a/27569864
has body: You could do something like this I think List&lt;Integer&gt; maxValues = new ArrayList&lt;Integer&gt;(); int max = Integer.MIN_VALUE; for(int i = 0; i &lt; item.length; i++) { if(item[i] &gt; max) { max = item[i]; maxValues = new ArrayList&lt;Integer&gt;(); } if(item[i] == max) { maxValues.add(i); } }
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27569735

http://stackoverflow.com/comment/43607057
score: 1
comment on: http://stackoverflow.com/a/27591684
type: AnswerComment
type: Comment
has text: If I'm not mistaken. This excludes a dependency, not a resource in Project-A which was what the OP asked for?

http://stackoverflow.com/comment/43527168
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27549924
score: 0
has text: @DerGolem Thanks, I added 'string' and it worked, but I also have another update Code at my program, but it worked without using 'string', I wonder how could this time is different from my previous code?

http://stackoverflow.com/q/27540235
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27540616
tagged with: java
linked to: http://stackoverflow.com/q/7670355
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/27540808
duplicate of: http://stackoverflow.com/q/7670355
score: -2
tagged with: date
has comment: http://stackoverflow.com/comment/43510018
answer count: 2
has body: I have one date format in 2014-12-18T05:39:04.523Z I want to convert it into IST format. I tried for this one. SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); SimpleDateFormat targetFormat = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy"); Date date; try { //2014-12-04T12:27:15 date = originalFormat.parse("2014-12-18T05:39:04.523Z"); System.out.println("Old Format : " + originalFormat.format(date)); System.out.println("New Format : " + targetFormat.format(date)); } catch (ParseException ex) { System.out.println("Exception *** " +ex); } In output: Old Format : 2014-12-18T05:39:04 New Format : Thu Dec 18 05:39:04 IST 2014 Here instead of z, if I put Z, it is showing like this.. New Format : Thu Dec 18 05:39:04 +0530 2014 But here I want to get 11:09 like this. How can I get the result I want? Here day month date year all are perfect, but hours minutes seconds are not correct. I have to show 11 hours 09 minutes. Why? Because I am getting this date format one greenhouse Account. This belongs to US, so I want to convert into IST Format.
upvote count: 0
has title: Not able to convert datefomat using Java
has comment: http://stackoverflow.com/comment/43508833

http://stackoverflow.com/q/27634276
has title: How to search full text in lucene 4.10
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27634518
type: Question
has body: I want to search text phase in pdf like "Labor Law". But in result, it return all file that contain the word "Labor" and "Law". please any help checking my cod below: EnglishAnalyzer analyzer = new EnglishAnalyzer(); analyzer.setVersion(Version.LATEST); QueryParser parser = new QueryParser("content", analyzer); Query query = parser.parse("Labor Law"); Directory indexDirectory = FSDirectory.open(new File(indexLucencePath)); DirectoryReader dirReader = DirectoryReader.open(indexDirectory); indexSearcher = new IndexSearcher(dirReader); ScoreDoc[] queryResults = indexSearcher.search(query, numOfResults).scoreDocs; List&lt;IndexItem&gt; results = new ArrayList&lt;IndexItem&gt;(); for (ScoreDoc scoreDoc : queryResults) { Document doc = indexSearcher.doc(scoreDoc.doc); results.add(new IndexItem(doc.get(IndexItem.TITLE), doc.get(IndexItem.CONTENT))); }
tagged with: lucene
linked to: http://stackoverflow.com/q/9066347
upvote count: 3
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/5483903
has answer: http://stackoverflow.com/a/27634463

http://stackoverflow.com/q/27630194
type: UnansweredQuestion
has body: I'm creating a highlighting communication logger which uses a ListView to display each message in a single cell. It basically works, but when I scroll very fast up and down, weird things happen. As you can see I'm highlighting the cell which is currently selected and the cell where the mouse is over. After I scrolled up and down, the highlighted cells are not the ones where my mousepointer is and for some cells, I'm unable to select them by click. I was able to reproduce this in a very simple example. Assume we have a ListView of strings with custom MyListCell's that render those cells using a TextFlow. The updateItem method of MyListCell looks like this @Override protected void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { setText(null); setGraphic(null); return; } TextFlow textFlow = new TextFlow(new Text(item)); setGraphic(textFlow); setText(null); } in the initialization I just create a new observable array of strings and I set the cell factory accordingly: public ObservableList&lt;String &gt; content = FXCollections.observableArrayList(); public ListView&lt;String&gt; listView; @Override public void initialize(URL location, ResourceBundle resources) { listView.setCellFactory(cb -&gt; new MyListCell()); listView.setItems(content); /* ... /* The full working example code consists only of some files (you need to adapt the package path): gui.fxml GUI.java Controller.java MyListCell.java style.css Question: Can anybody confirm this behavior and tell me what I'm doing wrong? My system is Ubuntu 14.04 with Oracle jdk 1.8.0_25
score: 3
downvote count: 0
tagged with: java
tagged with: javafx
tagged with: listviewitem
type: Question
linked to: http://stackoverflow.com/q/27414689
tagged with: listview
upvote count: 3
has comment: http://stackoverflow.com/comment/43683289
answer count: 1
has answer: http://stackoverflow.com/a/27634169
favorite count: 0
has title: JavaFX ListView rendering bug when using custom list cells

http://stackoverflow.com/comment/43573287
has text: Actually, it's not obvious to me at all. And I will ask the OP about that. What he states is (a) He needs to get it into a 15-character string (I assume, a database field or something like that), and (b) that he looked up known algorithms, and they are not sufficient. To me this merely indicates that he is not aware that the algorithms he used are meant to represent binary as ASCII, not as Java characters.
comment on: http://stackoverflow.com/a/27573322
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43623035
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27579627
has text: can you provide the variable declaration part as well , it is getting difficult to execute

http://stackoverflow.com/a/27531988
downvote count: 0
has body: add /wait to wait for the entire execution to complete and then close the batch file. Try this. Hope this works cmd /c start" + " "+"/wait"+"
answers question: http://stackoverflow.com/q/27530317
accepted answer of: http://stackoverflow.com/q/27530317
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer

http://stackoverflow.com/comment/43771253
type: Comment
comment on: http://stackoverflow.com/q/27576901
score: 0
type: QuestionComment
has text: @OneWay what type of more detail?

http://stackoverflow.com/comment/43463808
comment on: http://stackoverflow.com/q/27516831
has text: You must search before asking here. Look at this = http://www.tutorialspoint.com/java/java_string_charat.htm
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27553710
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: business-process-management
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: xCP2.0 Java Service not working - IDfSession is null
tagged with: documentum
has body: I'm currently working on a xCP 2.0 project with Documentum 7.0 and I'm trying to run a Java Service inside a workflow. The Java Service works alright when the function I use does no more than return a "some_string" String. But as soon as I try the actual thing and use documentum specific Objects like: IDfSession mySession = getSession(); I get these exceptions right here: java.lang.RuntimeException: Could not invoke the method 'test' from interface 'class com.gemp1.Test' from BOF module 'gemp1_xCPJava' in Process Template: 'Peticion de Nuevo Producto v2' - Activity: 'Execute Java Service'. Workitem: '4a015abd80004959' Workflow: 'Peticion de Nuevo Producto v2 2014-12-18' - '4d015abd8000411e' Activity: 'Execute Java Service' - '4c015abd8002e358' Process: 'Peticion de Nuevo Producto v2' - '4b015abd8002c56c' java.lang.Exception: java.lang.RuntimeException: Could not invoke the method 'test' from interface 'class com.gemp1.Test' from BOF module 'gemp1_xCPJava' at com.documentum.bps.outbound.AbstractService.execute(AbstractService.java:98) at com.documentum.bpm.services.BPSIntegrationFramework.executeService(BPSIntegrationFramework.java:260) at com.documentum.bpm.services.BPSIntegrationFramework.executeMethod(BPSIntegrationFramework.java:92) at com.documentum.bpm.services.BPSIntegrationMethod.executeMethod(BPSIntegrationMethod.java:26) at com.documentum.bpm.rtutil.GenericWorkflowMethod.execute(GenericWorkflowMethod.java:129) at com.documentum.bpm.rtutil.GenericWorkflowMethod.execute(GenericWorkflowMethod.java:355) at com.documentum.bpm.rtutil.GenericWorkflowMethod.execute(GenericWorkflowMethod.java:70) at com.documentum.mthdservlet.DfMethodRunner.runIt(Unknown Source) at com.documentum.mthdservlet.AMethodRunner.runAndReturnStatus(Unknown Source) at com.documentum.mthdservlet.DoMethod.invokeMethod(Unknown Source) at com.documentum.mthdservlet.DoMethod.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.se…

http://stackoverflow.com/q/27560690
type: UnansweredQuestion
answer count: 0
upvote count: 1
type: Question
has title: JAVA RMI Based Application Hang (client)
tagged with: java
has comment: http://stackoverflow.com/comment/43547566
downvote count: 0
score: 1
favorite count: 0
has body: Currently I am facing application (JAVA RMI based) hang situation and RMI client GUI become Black. In the application log does not record any exception and client / server communication has completely stopped at one stage. Once user restart the application it will resume the operations. Initially we thought it was due to a JVM issue since we saw a dump file during this hang situation. This Dump file was not able to open or copy during this time, it is disappearing once we closed the application. We re-installed the JVM but this issue still hits intermittently. We noticed this issue started few months after the production cutover and we did not come across during our testing and the initial few months of live cutover. Application background -RMI client/server based compiled on java 1.7_55 -OS (client Win7 32 bit &amp; Server Win 2008 32 bit data centre), Win2008 runs on VMWare -DB MSSql server 2008 It would be great if someone can advice me on this. Thanks and Regards Chamantha
tagged with: sql-server

http://stackoverflow.com/a/27605157
type: Answer
has body: SOLVED IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.createFromFilePath(output); mxDocument.addLayer(rasterLayer); Found this code by browsing the JavaDoc Tooltips in Eclipse. Just type in the object and a "." Eclipse will show all the options available. I'm amazed this code snippet wasn't listed anywhere online (that I found in about 8 hours of searching). Anyways, that's the simple 3 line solution!
score: 0
answers question: http://stackoverflow.com/q/27604594

http://stackoverflow.com/comment/43475669
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27523290
has text: Is the `doPost()` method invoked properly, when you click the submit button given? Here is an invalid HTML mark up ` `. `method=post` should be `method="post"` enclosed within quotes.
score: 0

http://stackoverflow.com/comment/43553166
type: Comment
type: QuestionComment
has text: What's the context here? Is your input string a structured syntax? If so, perhaps you need to be parsing the string against a grammar, then acting upon certain tokens if you wish to.
comment on: http://stackoverflow.com/q/27563671
score: 0

http://stackoverflow.com/comment/43542755
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27558206
has text: What are the settings? There isn't an other way to get the data? via xml, json, ...

http://stackoverflow.com/q/27530655
has title: Java/WEKA: K Clustering error: Cannot handle any class attribute
has comment: http://stackoverflow.com/comment/43500785
has body: SimpleKMeans kmeans = new SimpleKMeans(); int numberOfClusters = 2; int[] assignments = null; kmeans.setSeed(10); // This is the important parameter to set kmeans.setPreserveInstancesOrder(true); try { kmeans.setNumClusters(numberOfClusters); kmeans.buildClusterer(instancesOne); // &lt;-- exception being thrown // This array returns the cluster number (starting with 0) for each instance // The array has as many elements as the number of instances assignments = kmeans.getAssignments(); } catch (Exception e) { e.printStackTrace(); } I am trying to initialize the parameters of a EM algorithm by a k-means algorithm. So I am trying to get 2 centroids in which I can further train parameters for a GMM. I am however receiving the following error: weka.core.WekaException: weka.clusterers.SimpleKMeans: Cannot handle any class attribute! at weka.core.Capabilities.test(Unknown Source) at weka.core.Capabilities.test(Unknown Source) at weka.core.Capabilities.testWithFail(Unknown Source) at weka.clusterers.SimpleKMeans.buildClusterer(Unknown Source) at hmm.HMM.run(HMM.java:62) at hmm.HMM.main(HMM.java:22) Exception in thread "main" java.lang.NullPointerException at hmm.HMM.run(HMM.java:71) at hmm.HMM.main(HMM.java:22) Also how do I set two random centroids to begin with. I think the setSeed() method does that but how Do I get it to word with my dataset? My csv file looks as so: And load it so: Instances instancesOne = loader.loadCsv("train", "class1"); Here is some information about the attributes when loaded: dataset: @relation class1 @attribute x numeric @attribute y numeric @data -9.0278,3.1518 -9.5656,3.6383 -9.805,3.8284 etc... Answer, this code was needed to make the Instances class-less(remove the class attribute): // remove class attribute, make class-less Instances dataClusterer = null; weka.filters.unsupervised.attribute.Remove filter = new weka.filters.unsupervised.attribute.Remove(); filter.setAttributeIndices("" + (instancesOne.classIndex() + 1)); try { filter.setInpu…
tagged with: weka
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43500760
favorite count: 0
accepted answer: http://stackoverflow.com/a/27536297
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27536297

http://stackoverflow.com/a/27510240
answers question: http://stackoverflow.com/q/27508521
type: Answer
has comment: http://stackoverflow.com/comment/43451174
has body: Although I am not IDEA expert, I know that resources such as .property files placed in the source code hierarchy are copied to the classpath when using the IDE alone. However, if you use maven, then it takes over the build and whatever is in the java path is not copied by default. You have to place all your classpath resources in src\main\resources and under whatever hierarchy mirrors the package name to have the same result. So in your case : src\main\resources\com\test\messages\messages.properties and maven will copy it properly
score: 0
has comment: http://stackoverflow.com/comment/43450982

http://stackoverflow.com/comment/43598417
score: 0
type: Comment
type: QuestionComment
has text: Sorry if I made you confused, I have just realized that `rowData` doesn't exist. Basically I want to set the value of the cell on row `r` and column `c` into `v`.
comment on: http://stackoverflow.com/q/27587012

http://stackoverflow.com/comment/43604506
type: AnswerComment
score: 0
type: Comment
has text: Oops yes that's what I meant :) I didn't know the exact name so put a placeholder in there. Thanks!
comment on: http://stackoverflow.com/a/27589947

http://stackoverflow.com/comment/43412359
type: QuestionComment
score: 0
has text: I know. But I need to write a small program to organize those files.
comment on: http://stackoverflow.com/q/27490355
type: Comment

http://stackoverflow.com/a/27637356
upvote count: 1
has body: It's not a sign that you're doing anything wrong. What is happening here is that the Abstract Class is providing the basic behaviour for a method, while still allowing any of its children to overrule this default behaviour with their own implementation. You are probably being thrown off because the default behaviour for announceOutput() method in your example has no body, which makes it look strange. It would look perfectly normal if there was actual code in there. However, as mentioned in the Comments, you could also fix this with an Interface. Whether that would be any better depends on the context. In your example, this seems to be perfectly workable.
downvote count: 0
answers question: http://stackoverflow.com/q/27637306
type: Answer
score: 1

http://stackoverflow.com/q/27511977
has comment: http://stackoverflow.com/comment/43456098
tagged with: custom-component
tagged with: java
has body: i have the following problem. i want to paint something on a custom jpanel and then set custom buttons on a absolute positions. these buttons should listen on clicking and then provide their position. but everything i tried is not working. the buttons are not displaying when i use add(); public class IslePanel extends JPanel { private static final long serialVersionUID = 1L; private Color backgroundColor = new Color(90, 74, 66); private Color strokeColor = new Color(254, 254, 254); private Color lightGrayColor = new Color(220, 220, 220); /** * Constructor of the GameView * * @param game * @param controller */ public IslePanel() { setBackground(backgroundColor); SiteButton sb = new SiteButton(); sb.setXPos(100); sb.setYPos(100); sb.setSiteRadius(20); add(sb); //example: i plan to draw a circle formed button on absolute Position (100,100) radius 20 } /** * paintComponent-method for ALL drawing functions * * @param Graphics * g * **/ public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); try { drawTile(g, tile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } sitebutton superclass: public abstract class CustomButton extends JPanel implements MouseListener { private Vector listeners = null; boolean hit = false; public CustomButton(String title) { super(); this.title = title; listeners = new Vector(); addMouseListener(this); } // public Dimension getPreferredSize() { // return new Dimension(120, 80); // } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseClicked(MouseEvent e) { fireEvent(new ActionEvent(this, 0, title)); System.out.println("bauen"); } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void addAct…
score: 0
has comment: http://stackoverflow.com/comment/43454303
has answer: http://stackoverflow.com/a/27513354
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/43454287
has comment: http://stackoverflow.com/comment/43461862
favorite count: 0
linked to: http://stackoverflow.com/q/778222
has comment: http://stackoverflow.com/comment/43554223
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/43530867
has comment: http://stackoverflow.com/comment/43491390
has comment: http://stackoverflow.com/comment/43488278
has title: Adding Buttons on Custom JPanel
has comment: http://stackoverflow.com/comment/43529402
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43543873
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/43534069
type: Question

bezier
tags question: http://stackoverflow.com/q/27575878
type: Tag
tag name: bezier

http://stackoverflow.com/comment/43616319
type: Comment
has text: I modified my question already. Yeah, I did but I wrapped it all with another linear layout just right under the scroll view.
comment on: http://stackoverflow.com/a/27596099
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43627942
has text: I know how to use this for needle (string from JTextField). But how can I apply this on haystack (strings from JTable)?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27602793
type: Comment

http://stackoverflow.com/q/27496314
type: Question
score: 3
tagged with: spring-tool-suite
has comment: http://stackoverflow.com/comment/43424241
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/27510202
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43424247
type: UnansweredQuestion
has body: I am trying to disable automatic start up of the STS dashboard, but I cannot find any option under Window->Preferences->Spring->Dashboard which was present in older versions. If I close that window it gets opened once again after every Eclipse start. Is there any solution to this? I would prefer solution without re-installing of anything to get deeper insight. Thanks.
tagged with: spring
has answer: http://stackoverflow.com/a/27496352
upvote count: 3
tagged with: java
has title: How can I disable Spring Tool Suite 3.6.2 dashboard in Eclipse Luna?

http://stackoverflow.com/q/27527132
has body: This is my code: clientGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { gridClientChooseMode = !gridClientChooseMode; clientAdapter.notifyDataSetChanged(); return false; } };) and this is the adapter for the gridview: class ClientListAdapter extends ArrayAdapter&lt;ClientData&gt; { public ClientListAdapter(Context context, List&lt;ClientData&gt; list) { super(context, R.layout.view_item, list); } @Override public View getView(final int position, View convertView, ViewGroup parent) { if (gridClientChooseMode) { checkBox.setVisibility(View.VISIBLE); }else{ checkBox.setVisibility(View.GONE); } } } checkBox will change its visibility to VISIBLE when gridClientChooseMode=true (when long click on item of the gridview).But after that I cannot turn off the check box because the OnItemLongClickListener didn't work anymore, I mean it works only at first time. Any help is highly appreaciate. Thanks in adavance.
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27528673
tagged with: android
has answer: http://stackoverflow.com/a/27528816
accepted answer: http://stackoverflow.com/a/27528816
type: AnsweredQuestion
tagged with: java
has title: Android GridView setOnItemLongClickListener not work after set Visible of child widget of item
type: Question
has answer: http://stackoverflow.com/a/27528673

http://stackoverflow.com/q/27630305
tagged with: concurrency
score: 0
has title: Java Update Components Dynamically
answer count: 1
linked to: http://stackoverflow.com/q/6774414
has answer: http://stackoverflow.com/a/27630319
accepted answer: http://stackoverflow.com/a/27630319
has body: So let's say hypothetically I have a JEditorPane. I also have a void called addText(String S) which goes like this public void addText(String s) jeditorpane.setText(jeditorpane.getText() + s); } Now I will have a button and when pressed reads all the lines of a text file and writes them into the text editor box using a buffered reader and adding text line by line. Why is it that when the button is pressed the application will freeze for a couple seconds then have everything posted on at once. Is their a way so you see everything posting dynamically and seeing itbeing posted one by one. That is how the code is written. I have some sources from StackOverFlow that may help you: Why is my JTextArea not updating? Dynamically refresh JTextArea as processing occurs?
type: AnsweredQuestion
tagged with: jeditorpane
tagged with: dynamic
linked to: http://stackoverflow.com/q/629315
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/comment/43594686
comment on: http://stackoverflow.com/q/27584924
score: 0
type: Comment
type: QuestionComment
has text: @OlaviMustanoja Or you could drop a web link to the actual algorithm on the javadoc.

http://stackoverflow.com/q/27590716
has body: This is what I am doing FIRST ACTIVITY public void onClick(View v) { Intent intent = new Intent(TeamsActivity.this,PakistaniPlayers.class).putExtra("StringName","hello"); startActivity(intent); } SECOND ACTIVITY if(getIntent().getStringExtra("StringName")=="hello") { TextView t=(TextView) findViewById(R.id.textView1); t.setText(getIntent().getStringExtra("StringName")); } Now the code inside the if statement doesn't run but if I run the statements inside the if statement separately I get hello displayed.
has answer: http://stackoverflow.com/a/27590924
tagged with: java
has comment: http://stackoverflow.com/comment/43605404
has comment: http://stackoverflow.com/comment/43605482
has title: Using the getIntent function in if statement
type: Question
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/43605361
tagged with: android
has comment: http://stackoverflow.com/comment/43605278
linked to: http://stackoverflow.com/q/767372
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/43605437
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/767372
has answer: http://stackoverflow.com/a/27590893

http://stackoverflow.com/q/27536250
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27536334
has answer: http://stackoverflow.com/a/27536251
has answer: http://stackoverflow.com/a/27536284
score: 1
tagged with: generics
favorite count: 0
type: Question
tagged with: interface
has title: How do you enforce that a method parameter type extends a specific class and implements a specific interface?
has body: How do you enforce that a method parameter type both extends a specific class and implements a specific interface?
tagged with: parameters
has comment: http://stackoverflow.com/comment/43501037
linked to: http://stackoverflow.com/q/20716651
upvote count: 2
tagged with: java
answer count: 3
tagged with: methods
downvote count: 1

http://stackoverflow.com/q/27482582
favorite count: 0
has answer: http://stackoverflow.com/a/27646789
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: iframe
tagged with: crawler4j
has body: I am using crawler4j for crawling some websites and it is working fine. I am able to download all the files present in a website and now I have a new task ahead of me.I need to extract iframe,base64 and other embedded codes also if possible! Till now what i am doing is, in my visit method String place="<iframe"; if (page.getParseData() instanceof HtmlParseData) { HtmlParseData htmlParseData = (HtmlParseData) page.getParseData(); String text = htmlParseData.getText(); String html = htmlParseData.getHtml(); List<WebURL> links = htmlParseData.getOutgoingUrls(); System.out.println("Text length: " + text.length()); // System.out.println("html sorce code:- "+html); int number=html.length(); String[] result=html.split("\\s"); System.out.println("print random word"+result[12500]+number); int i; for(i=0;i<number;i++) { if(result[i].equals(place)) { System.out.println("iframe found"+i); } } System.out.println("Text length: " + text.length()); System.out.println("Html length: " + html.length()); System.out.println("Number of outgoing links: " + links.size()); } I have added the above if case to get the iframes of the given html page.It is working almost near to perfect. I know that this is a bad way of extracting of iframes from a html page.I tried many other ways to extract iframes and other embedded codes from html pages but failed.After going through the source code I found a java class which can satisfy my requirement.As you can see from the url above I have to call startElemnt method using necessary parameters in the HtmlContentHandler class inorder to get the required codes. `public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException` { } So In my visit method I have created a HtmlContentHandler object and tried to call the startElement method mentioned above. HtmlContentHandler ecode=new HtmlContentHandler(); ecode.startElement(url,localName,qName,attributes); Now the problem is with parameters of that method. I am se…
type: Question
accepted answer: http://stackoverflow.com/a/27646789
upvote count: 1
answer count: 1
has title: Getting all iframes,base64 codes which are present in html pages using crawler4j

http://stackoverflow.com/a/27578737
type: Answer
answers question: http://stackoverflow.com/q/27576524
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27576524
has body: That's the documented and expected behaviour. RTFM (read the fine manual) at http://docs.spring.io/spring-data/data-neo4j/docs/3.2.1.RELEASE/reference/html/#reference_programming-model_typerepresentationstrategy : Each node gets labeled with its type and all supertypes and interfaces that are also @NodeEntity-annotated. There is a special Label prefixed with _ that represents the current type of the entity.

http://stackoverflow.com/a/27618238
answers question: http://stackoverflow.com/q/27616002
type: AcceptedAnswer
type: Answer
has body: Override onTouchEvent in your custom button: @Override public boolean onTouchEvent(MotionEvent event) { if (isInGrayArea(event.getX(), event.getY())) { return super.onTouchEvent(event); } return false; } event.getX() and event.getY() is pixels coordinates, you will need to convert them into dp, I suppose.
has comment: http://stackoverflow.com/comment/121589376
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27616002
score: 0

http://stackoverflow.com/comment/43693532
has text: Thanks @MarkRotteveel for your time and help, I couldn't manage without it!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27611565

http://stackoverflow.com/a/27499280
answers question: http://stackoverflow.com/q/27499140
score: 0
has body: it is difficult to answer the question because it is very broad. but i'll answer the common mistakes: it might be that you want a method in the superclass to be override in the sub class. you need to cast from Person to the subclasses Member or Author and the use your methods. you need to initiate a variable of Member or Author and then use the methods. not very likely but might be - you want the method to be static
type: Answer

http://stackoverflow.com/comment/43470491
comment on: http://stackoverflow.com/a/27519909
type: AnswerComment
type: Comment
score: 1
has text: @aurelianus I said it was pdeudo code :) fixed the return type. It can hold as many elements as there is room in the call stack for recursive calls to the stack method. If the user types 1 and inputs a new element, and repeat the process 10 times, `stack` is called 10 times recursively, and the local variable in each one of them holds a different element.

http://stackoverflow.com/comment/43641068
type: QuestionComment
comment on: http://stackoverflow.com/q/27607949
has text: Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/67496/discussion-on-question-by-dring-dring-java-equals-does-not-working-correctly).
score: 0
type: Comment

http://stackoverflow.com/a/27529463
accepted answer of: http://stackoverflow.com/q/27528778
score: 1
answers question: http://stackoverflow.com/q/27528778
upvote count: 1
type: AcceptedAnswer
has body: I don't know what type your Vectors are, but I'll assume they're Integers for now. Replace Integer with whatever type you're using if you aren't. If you're willing to use a Vector instead of an array, you can declare matrix like: Vector&lt;Vector&lt;Integer&gt;&gt; matrix = new Vector&lt;Vector&lt;Integer&gt;&gt;(); And you can then add the elements like matrix.add(vector1); matrix.add(vector2); matrix.add(vector3); You'll then be able to access elements like matrix.get(2).get(4); //Returns 6 from the sample data If you really want to use arrays, for whatever reason, it's still not hard to do, it's just another method from your vectors. You would instead declare your matrix like: Integer[][] matrix = {vector1.toArray(), vector2.toArray(), vector3.toArray()}; Then you can access elements like matrix[2][4]; //Returns 6 from the sample data I will note, I'm not 100% that you'd need to do Integer[][] instead of just int[][], but I think since you can't use primitives for your Vector's generic you might have to keep on using Integer.
type: Answer
downvote count: 0

akka
type: Tag
tags question: http://stackoverflow.com/q/27511111
tags question: http://stackoverflow.com/q/27525849
tag name: akka
tags question: http://stackoverflow.com/q/27481508

http://stackoverflow.com/comment/43535939
comment on: http://stackoverflow.com/a/27553229
score: 0
has text: is it ok to store in bundle properties?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43583753
type: Comment
comment on: http://stackoverflow.com/a/27578877
score: 1
has text: ehh, I still think this answer is helpful (although certainly not complete)--it does give an explanation as to how to encrypt/decrypt messages via a symmetric algorithm.
type: AnswerComment

http://stackoverflow.com/q/27621597
has comment: http://stackoverflow.com/comment/43663994
score: 1
tagged with: java
upvote count: 1
has body: (Beginner Android Question: ) I'm loading a 25MB thesaurus text file into a HashMap but I get an Out Of Memory Fatal Exception. I have researched this site to find ideas on other ways to do this but am still unsure. Would it be sensible to split the text file into a number of smaller ones (say 26, one for each letter) , and then read these from text file to HashMap as needed by the program ? Are there better ways to do this ? The app is meant to show all the synonyms for words inputted by the user. 12-23 13:04:44.336: E/AndroidRuntime(9865): FATAL EXCEPTION: main 12-23 13:04:44.336: E/AndroidRuntime(9865): Process: com.example.dictfromtextfile, PID: 9865 12-23 13:04:44.336: E/AndroidRuntime(9865): java.lang.OutOfMemoryError: Failed to allocate a 6532 byte allocation with 4262 free bytes and 4KB until OOM 12-23 13:04:44.336: E/AndroidRuntime(9865): at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:95
type: Question
has comment: http://stackoverflow.com/comment/43665970
has answer: http://stackoverflow.com/a/27622037
accepted answer: http://stackoverflow.com/a/27622037
has comment: http://stackoverflow.com/comment/43663675
linked to: http://stackoverflow.com/q/18675557
answer count: 1
downvote count: 0
favorite count: 0
tagged with: out-of-memory
tagged with: android
type: AnsweredQuestion
has title: Android Out Of Memory error with 20MB text file in HashMap

http://stackoverflow.com/comment/43683048
comment on: http://stackoverflow.com/a/27621228
type: AnswerComment
has text: Ok, i am still having the null pointer exception error :/ here i paste the code: http://paste.ubuntu.com/9608515/
type: Comment
score: 0

http://stackoverflow.com/comment/43446419
score: 0
type: Comment
type: QuestionComment
has text: Can you show us what you have done so far?
comment on: http://stackoverflow.com/q/27508133

http://stackoverflow.com/comment/43484762
comment on: http://stackoverflow.com/q/27527495
score: 0
type: Comment
type: QuestionComment
has text: Maybe with AspectJ instrumentation.

http://stackoverflow.com/comment/43568769
has text: I suggest you use PrintWriter.println() and it will handle new lines for your.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27571620

http://stackoverflow.com/a/27545253
answers question: http://stackoverflow.com/q/27545004
type: Answer
upvote count: 1
has body: Here is how to write "hello" to field1 of ThingSpeak public channel 1234. String apiWriteKey = "your-channel-write-key"; Channel channel = new Channel(1234, apiWriteKey); Entry entry = new Entry(); entry.setField(1, "hello"); channel.update(entry); And here is how to read it back: Channel channel = new Channel(1234); Entry entry = channel.getLastChannelEntry(); System.out.println(entry.getField(1); Source : https://github.com/angryelectron/thingspeak-java/ Hope this will help you :)
score: 1
downvote count: 0

spring-tool-suite
tags question: http://stackoverflow.com/q/27517786
tags question: http://stackoverflow.com/q/27543282
type: Tag
tag name: spring-tool-suite
tags question: http://stackoverflow.com/q/27496314

http://stackoverflow.com/q/27485252
type: Question
has answer: http://stackoverflow.com/a/27485393
type: AnsweredQuestion
has title: BigDecimal.scale(0) put in method call works in not an appropriat way
has comment: http://stackoverflow.com/comment/43402429
tagged with: java
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/43402576
has body: I have the method: public void send(Player player, String sum) { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); addPlayerVariables(map, player); map.put("sum", sum); setVariableMap(map); setTemplateType(TemplateType.BIRTHDAY); sendMessage(player.getEmail()); } and I call that method as follows: send(player, newBonus.getBonusSum().setScale(0).toPlainString() + " " + account.getCurrency().getName()); and it works as if I ever didn't put the scale into getBonusSum(). For instance: newBonus.getBonusSum().setScale(0).toPlainString() is 1500 newBonus.getBonusSum().toPlainString() is 1500.0000 and in the send() 1500.0000 is passed instead of 1500. Why? But If I split that into: String str = newBonus.getBonusSum().setScale(0).toPlainString(); send(player, str + " " + account.getCurrency().getName()); it works fine. Could someone explain the reason?
downvote count: 2
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/43403106
favorite count: 0
accepted answer: http://stackoverflow.com/a/27485393
upvote count: 0
has comment: http://stackoverflow.com/comment/43403075

http://stackoverflow.com/q/27578978
has comment: http://stackoverflow.com/comment/43582719
tagged with: swing
linked to: http://stackoverflow.com/q/15961412
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43583132
accepted answer: http://stackoverflow.com/a/27579115
has comment: http://stackoverflow.com/comment/43582706
downvote count: 0
answer count: 1
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/43582679
has comment: http://stackoverflow.com/comment/43582804
has title: What is an effective way of painting hundreds of images to a JFrame at a time?
score: 2
has body: I am writing a 2D strategy game and require to be able to display hundreds of images at one time. So far I have many classes, but I have one dilemma as I fear I do not understand the JFrame components well enough. I have written a smaller 3 class program to show my problem: First I have a main class which constructs the frame: import javax.swing.JFrame; public class MainClass { static JFrame Frame = new JFrame("MainFrame"); public static void main(String[] args){ Frame.add(new Board()); Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.setSize(1024, 500); Frame.setVisible(true); Frame.setResizable(false); } } Currently the board class is the class which sits at the center of the program and pulls all of the strings to make the program run. Previously all of the tutorials I have seen on the internet have pointed towards having the paint(Graphics g) method inside the board class, but this gives me the main dilemma. Currently I have to type out manually every time I want something painted to the screen: public board{ //......code.... public void paint(Graphics g){ super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.drawImage(b.getImage(0), 0, 0, null);//Black g2d.drawImage(b.getImage(1), GameMachanic.getCurrentPosX(), GameMachanic.getCurrentPosY(), null);//background g2d.drawImage(b.getImage(3), GameMachanic.getCurrentPosX(), GameMachanic.getCurrentPosY(), null);//background //...more paint to screen code } //......code...... } This method is repainted every few milliseconds and everything is great! except... now I have gotten to the point where I need hundreds of different elements painted to the screen at one time, from different classes and with this current method U have to type out manually each and every paint command, making the code ineffective and frankly pointless. Therefore I tried making a class that replaces the need of this manual labour, making the method reusable, but I am finding it extremely hard to make it work: public class GraphicsPaint …
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27579115
tagged with: paint
upvote count: 2
tagged with: jframe

http://stackoverflow.com/a/27504766
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27504715
has body: Basically you are talking about runtime polymorphism. Yes you could do that. See following exmaple: class Flight extends Thread { public void run() { System.out.println("Hello World.. I took off"); } } public static void main(String[] args) { Flight flight = new Flight(); Thread myflight = new Flight();//See how i used runtime polymorphism. flight.start(); myflight.start(); }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43460211
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27514850
has text: yep I agree .. do something like this: if (info.length > 10 && info[10].toLowerCase()... )

http://stackoverflow.com/q/27508854
type: Question
has comment: http://stackoverflow.com/comment/43448028
has comment: http://stackoverflow.com/comment/43447757
score: 0
has comment: http://stackoverflow.com/comment/43447906
has comment: http://stackoverflow.com/comment/43447768
has comment: http://stackoverflow.com/comment/43447856
has body: when i wanta set the environment variable for java: someone said "~/.bashrc" and someone else said "/etc/profile" or "~/.profile" i wanta know what different from these files? And why the commod is "export PATH=$JAVA_HOME/bin:$PATH" but "export PATH=$JAVA_HOME/bin"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43447806
linked to: http://stackoverflow.com/q/415403
has title: Where should i set the environment variable for java in ubuntu？
answer count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/415403

http://stackoverflow.com/comment/43683995
comment on: http://stackoverflow.com/q/27631880
has text: Because, code of static block executes immediately after loading the class and before calling its main method
score: 1
type: QuestionComment
type: Comment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/27563625
tags question: http://stackoverflow.com/q/27612680
tags question: http://stackoverflow.com/q/27515322
tags question: http://stackoverflow.com/q/27536441
tags question: http://stackoverflow.com/q/27519053
type: Tag
tags question: http://stackoverflow.com/q/27596778
tags question: http://stackoverflow.com/q/27631626

http://stackoverflow.com/comment/43499227
comment on: http://stackoverflow.com/a/27535330
score: 0
type: AnswerComment
type: Comment
has text: For example 1 ulp [`Math.ulp(float)`](http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#ulp%28float%29) that should be the smallest thing that will make a difference

http://stackoverflow.com/comment/43435869
type: AnswerComment
comment on: http://stackoverflow.com/a/27501685
score: 0
type: Comment
has text: what will be regex compile for "sum(...)"?

http://stackoverflow.com/a/27633316
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27633133
type: Answer
answers question: http://stackoverflow.com/q/27633133
has body: You need to use: String text = jTextfield1.getText() and then use some persistence technology: JDBC, or an ORM (JPA). You need a data layer for better design. The simplest is JDBC, but put it in another class.
score: 0

http://stackoverflow.com/q/27602066
answer count: 1
accepted answer: http://stackoverflow.com/a/27602266
has comment: http://stackoverflow.com/comment/43626839
score: 0
has body: So i have this code: Pattern pattern = Pattern.compile("\\d*(\\s\\d+\\.)*\\s*[-\\+\\*/\\$£]"); String input = "4.0 5.0 2.0 / + 7.0 - 11.0 34.0 2.0 / 3.0 / 1.0 * +"; Matcher matcher = pattern.matcher(input); List&lt;String&gt; output = new ArrayList&lt;&gt;(); while (matcher.find()) { output.add(matcher.group()); } When i was working on just parsing integers the regex was of course fine however i now need it to take into account that there can be a . to represent a floating point. Wondering if someone can help me with adding this in expected output should be : 4.0 5.0 2.0 / + 7.0 - 11.0 34.0 2.0 / 3.0 / 1.0 * +
has comment: http://stackoverflow.com/comment/43626704
tagged with: postfix-notation
duplicate of: http://stackoverflow.com/q/27604625
tagged with: regex
has comment: http://stackoverflow.com/comment/43626748
has answer: http://stackoverflow.com/a/27602266
has comment: http://stackoverflow.com/comment/43626712
type: AnsweredQuestion
tagged with: java
has title: need to change regex for additional postfix criteria
has comment: http://stackoverflow.com/comment/43626560
type: Question
linked to: http://stackoverflow.com/q/27604625

http://stackoverflow.com/comment/43660463
type: Comment
comment on: http://stackoverflow.com/a/27619708
has text: Well a quick google search shows you cannot pass image bytes to this function. You must pass a URI. You need to save bytes to file and pass URI to that file. Here is all the detail http://stackoverflow.com/questions/19145375/unable-to-post-an-image-from-drawable-to-facebook
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43652648
comment on: http://stackoverflow.com/a/27615471
score: 0
type: AnswerComment
has text: String mystring="["123","123"]["7845760296","yoga"]";
type: Comment

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/27507932
type: Tag
tags question: http://stackoverflow.com/q/27512347

http://stackoverflow.com/comment/43667142
score: 0
has text: Just Java - have added in the game class
type: Comment
comment on: http://stackoverflow.com/q/27623112
type: QuestionComment

http://stackoverflow.com/q/27593322
accepted answer: http://stackoverflow.com/a/27593350
upvote count: 5
tagged with: arrays
has body: I am searching for something like javadocs for the arrays in Java. What methods, what their signatures and what they do. I got this problem, because IDE (Intelij) if you click on the called method of the array with pressed cntrl, shows nothing.
answer count: 2
has answer: http://stackoverflow.com/a/27593354
tagged with: api
favorite count: 0
has title: Java: javadocs of arrays type
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/27593354
tagged with: java
downvote count: 2
tagged with: javadoc
type: Question
has answer: http://stackoverflow.com/a/27593350

http://stackoverflow.com/comment/43606195
has text: Just creating a new instance of your `Stack` (without the `IStack` interface) I can not reproduce your problem. No Exceptions.
type: Comment
comment on: http://stackoverflow.com/q/27591061
score: 4
type: QuestionComment

http://stackoverflow.com/a/27638073
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27637643
type: Answer
has body: From a purely syntactic point of view, no, you can't. Type arguments must be type names (or the wildcard, ?) known at compile time. They cannot be variables or other expressions that evaluate to a value. It is still unclear why you need this, especially since your anInstance is of type SomeClass&lt;?&gt;, in which case you wouldn't care about the type argument used.

http://stackoverflow.com/a/27502542
downvote count: 0
has body: You need to access through Expression language ${projectDetails.title} ${projectDetails.addedBy} ....... so on
score: 1
answers question: http://stackoverflow.com/q/27502466
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27502466

http://stackoverflow.com/a/27520340
has comment: http://stackoverflow.com/comment/43483201
has body: Constructor you have Transaction(String, int, double); But you are trying to give Transaction(int, String, int, double); Modify the following, Transaction transaction = new Transaction("Deposit", depositAmount, currentBalance); instead of Transaction transaction = new Transaction(bankAccount.getTransactions().size(), "Deposit", depositAmount, currentBalance); Replace your Transaction class by the following. public class Transaction { private String transactionType; private double transactionAmount; private double balanceAmount; private Date transactionDate; public Transaction() {} public Transaction( String transactionType, Date transactionDate, double transactionAmount, double balanceAmount) { this.transactionType = transactionType; this.transactionAmount = transactionAmount; this.transactionDate = transactionDate; this.balanceAmount = balanceAmount; } public Transaction( String transactionType, double transactionAmount, double balanceAmount) { this.transactionType = transactionType; this.transactionAmount = transactionAmount; this.balanceAmount = balanceAmount; } public String getTransactionType() { return transactionType; } public void setTransactionType(String transactionType) { this.transactionType = transactionType; } public double getTransactionAmount() { return transactionAmount; } public void setTransactionAmount(double transactionAmount) { this.transactionAmount = transactionAmount; } //Override the toString() method of String ? public String toString() { return " Transaction Amount : "+ this.transactionAmount + " Transaction Type : " + this.transactionType + " Balance Amount : " + this.balanceAmount + " Transaction Date: " + this.transactionDate; } /** * @return the balanceAmount */ public double getBalanceAmount() { return balanceAmount; } /** * @param balanceAmount the balanceAmount to set */ public void setBalanceAmount(double balanceAmount) { this.balanceAmount = balanceAmount; } } Print Transaction method public void printTransaction(int accountNumbe…
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27520288
type: Answer

http://stackoverflow.com/a/27620445
type: Answer
has comment: http://stackoverflow.com/comment/43663362
score: 0
answers question: http://stackoverflow.com/q/27619284
has body: The problem of your method is you must take good care of the security of encryption key This is a mormal way for websites or applications authentication: During registration use hash algorithm (MD5 is popular before but proved to be unsafe now) to encrypt the password+salt, where salt is a random string. Then store hash value and salt with username. When a user wants to log in and enter username and password, first add the salt to password and use the same hash algorithm to encrypt it. Then see if the result matches stored hash value.
has comment: http://stackoverflow.com/comment/43661969

http://stackoverflow.com/q/27522711
has comment: http://stackoverflow.com/comment/43478397
favorite count: 0
has comment: http://stackoverflow.com/comment/43475394
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31376440
has title: Is there any API in drools to create the drl files dynamically by just passing values?
upvote count: 13
tagged with: kie
tagged with: java
tagged with: drools-guvnor
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/49898219
has body: I know how to create DRL files inside KIE workbench by using all the methods. But what my problem is without using the KIE workbench, can we create the .drl file by using our required values.If any possibility is there please suggest me. Same way suggest me any API is regarding to that. Thanks in advance.
tagged with: drools
has comment: http://stackoverflow.com/comment/43475502
answer count: 6
has answer: http://stackoverflow.com/a/39889859
has answer: http://stackoverflow.com/a/27623395
has answer: http://stackoverflow.com/a/27523440
score: 12
has answer: http://stackoverflow.com/a/27625235

http://stackoverflow.com/comment/43527829
comment on: http://stackoverflow.com/a/27550813
score: 0
type: Comment
type: AnswerComment
has text: But, with this how do i update the Snippet Value. i tried storing the result to Node and access the Node value and update but didn't work for me.

http://stackoverflow.com/comment/43664288
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27621527
has text: Have you tried: `cs.getFillBackgroundColorColor().getRgb()` ? Notice the word `Color` is used twice

http://stackoverflow.com/comment/43536253
score: 0
type: AnswerComment
has text: The reason for using `twodim[i].length` for the inner loop is to get the length of the current array. So, when `i = 0`, that length will be 4 (for the first inner array), and when `i = 1`, that length will be 7 (for the second inner array).
type: Comment
comment on: http://stackoverflow.com/a/27552272

http://stackoverflow.com/comment/43528776
type: AnswerComment
has text: @RobertBain - You can chose your own order merely by providing a different Iterable (other than `Engine.values()`). I use this pattern often but I do a lot of data translation where it applies regularly. Do not shy away from unfamiliar constructs just because they are unexpected.
comment on: http://stackoverflow.com/a/27549637
type: Comment
score: 0

http://stackoverflow.com/q/27541868
type: UnansweredQuestion
upvote count: 1
type: Question
has body: I have a parent entity DBParentEntity that have relation to FK-entity DBForeignEntity. @Entity @Table(catalog = "my_schema", name = "my_table") public class DBParentEntity { ... private DBForeignEntity foreign; @ManyToOne @JoinColumn(name = "foreign_id", referencedColumnName = "id") public DBForeignEntity getForeign() { return foreign; } public void setForeign(DBForeignEntity foreign) { this.foreign = foreign; } } How to avoid any loading FK-entity, but still use it in HQL? I want to load foreign entity with my own cached method private int foregnId; @Basic @Column(name = "foreign_id") public int getForegnId() { return foregnId; } public void setForegnId(int foregnId) { this.foregnId = foregnId; } private DBForeignEntity foreign; private boolean hasForeign; @Transient public DBForeignEntity getForeign() { if (!hasForeign) { initForeign(); } return foreign; } @Transient private synchronized void initForeign() { if (hasForeign) return; foreign = getFromCache(foregnId) if (foreign!= null) hasForeign= true; } I can drop @ManyToOne annotation at all and replace it with @Transient, but all relations HQL will fail: Query query = session.createQuery("from DBParentEntity parent where parent.!foreign!.more_foregn.some_field = :some_value ")
score: 1
tagged with: java
tagged with: hibernate
downvote count: 0
has title: How to avoid any FK-entity loading, but still use FK-entity in HQL?
favorite count: 0
answer count: 0
tagged with: lazy-loading

http://stackoverflow.com/comment/43435388
type: Comment
has text: i don't thing so, if it is then why ModelDriven required. in your code it will create new form instead of populated data from request.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27502493

http://stackoverflow.com/comment/43436726
type: Comment
comment on: http://stackoverflow.com/q/27489256
score: 0
type: QuestionComment
has text: @Dima and Salaman: After uncommenting the if statemnt and changing the pattern to [^a-zA-Z0-9 \\-\\.] it worked. Thanks for the suggestions

http://stackoverflow.com/q/27545644
has answer: http://stackoverflow.com/a/51879065
has body: I have connected a JMX connection from a machine without SSL. But when I give the SSL though the App is getting launched without any error, VisualVM is unable to establish a JMX connection through the specified port. Following is the command I used to establish JMX connection from the App side. java -Dcom.sun.management.jmxremote.port=4444 -Dcom.sun.management.jmxremote.password.file="C:/Program Files/Java/jre1.8.0_25/lib/management/jmxremote.password" -Djavax.net.ssl.keyStore="C:/Program Files/Java/jdk1.8.0_25/bin/testkeystore" -Djavax.net.ssl.keyStorePassword=123456 -Dcom.sun.management.jmxremote.ssl=true -Dcom.sun.management.jmxremote.authenticate=true DemoApp Please advice.
has title: Fails to connect through JMX+SSL from VisualVM
answer count: 1
downvote count: 0
favorite count: 0
tagged with: visualvm
has comment: http://stackoverflow.com/comment/44085277
type: UnansweredQuestion
tagged with: jmx
tagged with: jvisualvm
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43523621
has comment: http://stackoverflow.com/comment/44084791
has comment: http://stackoverflow.com/comment/43546149
tagged with: ssl
has comment: http://stackoverflow.com/comment/43544228

http://stackoverflow.com/comment/43384634
type: QuestionComment
comment on: http://stackoverflow.com/q/27475010
score: 0
type: Comment
has text: EDIT: I think my problem is between the first and last if condition since positiony is true for both. I'm not sure what I could do though to fix this.

http://stackoverflow.com/comment/43476060
type: Comment
type: QuestionComment
has text: how are you trying to increase heap space and to what amount?
score: 0
comment on: http://stackoverflow.com/q/27522786

http://stackoverflow.com/comment/107961522
score: 1
type: AnswerComment
type: Comment
has text: Is there anything like `MaxDegreeOfParallelism` as in `Parallel.ForEach` in C#? It helps us limit the number of threads we want to run in parallel.
comment on: http://stackoverflow.com/a/27558698

http://stackoverflow.com/a/27543577
score: 5
downvote count: 0
type: Answer
has body: You have an oversimplified understanding of how timing works. You don't do precision timing in user-space software. The precision timing is done elsewhere. Software composes the next frame. When it's done, it passes the frame to a driver which displays the frame at the right time and at the right rate. Typically, the driver can trigger software to render the next frame. Software just doesn't work by sleeping for amount of time. When it needs to wait for something, it actually waits for the thing it needs to wait for.
answers question: http://stackoverflow.com/q/27543478
has comment: http://stackoverflow.com/comment/43514305
has comment: http://stackoverflow.com/comment/43514122
upvote count: 5

http://stackoverflow.com/q/27586033
has body: I am making a command processing library which takes input and throws an exception if the command cannot be executed for various reasons. I would like to provide helpful information to the user about what has gone wrong and I would also like all the messages to be customisable so it can be used in multiple projects. As I am dealing with user input there are a stupidly large number of things which could go wrong and making an exception for all of them would leave me with more exception classes than actual command processing classes so I have made a few generic exceptions: CommandException and CommandUsageException and CommandPermissionException which extend CommandException. Is it worth making an exception for everything that could go wrong for example InvalidFlagValueException or WrongSubcommandArgumentsException or is there a better way to do this? Is it a good idea to have an Enum for example in the exception to give it more detail?
has answer: http://stackoverflow.com/a/27586098
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/43596656
has comment: http://stackoverflow.com/comment/43597010
has comment: http://stackoverflow.com/comment/43596836
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43596854
type: Question
has title: Convey more information in exception
tagged with: java
has comment: http://stackoverflow.com/comment/43596545
has answer: http://stackoverflow.com/a/27586184
has answer: http://stackoverflow.com/a/27586075
answer count: 3

http://stackoverflow.com/q/27606577
tagged with: java
has title: Best way to parse commands in a java text-based game
type: Question
has body: I'm developing a text based game in java and I'm looking for the best way to deal with player's commands. Commands allow the player to interact with the environment, like : "look north" : to have a full description of what you have in the north direction "drink potion" : to pick an object named "potion" in your inventory and drink it "touch 'strange button'" : touch the object called 'strange button' and trigger an action if there is one attached to it, like "oops you died..." "inventory" : to have a full description of your inventory etc... My objective is now to develop a complete set of those simple commands but I'm having trouble to find an easy way to parse it. I would like to develop a flexible and extensible parser which could call the main command like "look", "use", "attack", etc... and each of them would have a specific syntax and actions in the game. I found a lot of tools to parse command line arguments like -i -v --verbose but none of them seems to have the sufficient flexibility to fit my needs. They can parse one by one argument but without taking into account a specific syntax for each of them. I tried JCommander which seems to be perfect but I'm lost between what is an argument, a parameter, who call who, etc... So if someone could help me to pick the correct java library to do that, that would be great :)
has comment: http://stackoverflow.com/comment/43635430
downvote count: 0
accepted answer: http://stackoverflow.com/a/27606727
has comment: http://stackoverflow.com/comment/43635462
has comment: http://stackoverflow.com/comment/43635455
has comment: http://stackoverflow.com/comment/43635499
answer count: 3
has answer: http://stackoverflow.com/a/27606897
possible better answer: http://stackoverflow.com/a/27606692
tagged with: parsing
has answer: http://stackoverflow.com/a/27606692
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27606727
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/43543775
type: AnswerComment
type: Comment
has text: I tried to specify it but unfortunately still not working. Thank you for your tries and time.
comment on: http://stackoverflow.com/a/27558665
score: 0

http://stackoverflow.com/a/27792846
score: 2
has comment: http://stackoverflow.com/comment/100049832
downvote count: 0
answers question: http://stackoverflow.com/q/27622016
has body: I figured out the problem and fixed the issue. The issue was not with Axis2.The exception as listed in my question relates to the way XML Security works. The services.xml in .aar file had targetNamespace="test_vish_listRoutines". The client code consuming the webservices with WS-Security set to true, was using this namespace. It was calling 'listRoutines', which is a relative namespace and not allowed in standard XMLSecurity. On the serer side, the service method related to listRoutines was not getting called itself. Changing is to a standard URL type namespace like 'http://www.testing.com/webserice solved the problem. Sigh of relief atlast. Hope this helps
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43651923
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27542020
has text: But, my answer does not contain this line: `res.setStatus("FAIL"); or res.setResult(result.getAllErrors());`. I had updated my answer with all required changes.
score: 0

http://stackoverflow.com/q/27515653
tagged with: sockets
tagged with: android
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43461729
type: Question
has comment: http://stackoverflow.com/comment/43461692
score: 0
has title: Send Object with Object attribute as file
has comment: http://stackoverflow.com/comment/43461614
has body: I have a Serializable Object called Message and I want it to contain a music, I have the path of it. I don't want to directly send a music using inputStream/outputStream, I want to put it in a message which I send. How is it possible to do that? Client code : if (intent.getAction().equals(ACTION_SEND_MESSAGE)){ String host = intent.getExtras().getString(EXTRAS_GROUP_OWNER_ADDRESS); Socket socket = new Socket(); int port = intent.getExtras().getInt(EXTRAS_GROUP_OWNER_PORT); Message lcm = (Message) intent.getSerializableExtra(DATA); Air.get().log("MessageService", "Send message: "+lcm.getClass().getSimpleName()); ObjectInputStream inputStream; try { Log.d(WiFiDirectActivity.TAG, "Opening client socket - "+host+":"+port); socket.bind(null); socket.connect((new InetSocketAddress(host, port)), SOCKET_TIMEOUT); OutputStream os = socket.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeObject(lcm); oos.close(); os.close(); } catch (IOException e) { Log.e(WiFiDirectActivity.TAG, e.getMessage()); } catch(Exception e){ } finally { if (socket != null) { if (socket.isConnected()) { try { socket.close(); } catch (IOException e) { // Give up e.printStackTrace(); } } } } } and the server part : ServerSocket serverSocket = new ServerSocket(8988); Log.d(WiFiDirectActivity.TAG, "Server: Socket opened"); while (true) { Socket client = serverSocket.accept(); Log.d(WiFiDirectActivity.TAG, "Server: connection done"); InputStream is = client.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); Message to = (Message) ois.readObject(); if (to != null) { Log.d(to.toString(), to.toString()); } }
has comment: http://stackoverflow.com/comment/43461648

android-snackbar
tags question: http://stackoverflow.com/q/27488826
type: Tag
tag name: android-snackbar

http://stackoverflow.com/comment/43692770
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27633001
has text: You enter a URL on a parent window & enter,it opens another window on which all the action happens.Here on this browser window,one cannot alter the URL(its read only) manually. & when i tried altering the URL through selenium i.e. performed a **get** command from home page putting URL of concerned page trying to skip a couple of navigation steps, I got invalid session page
score: 0

http://stackoverflow.com/comment/43690090
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27635392
score: 0
has text: You can edit here too http://stackoverflow.com/questions/27546757/gcm-push-notifications-not-coming-through-proxy/27622388?noredirect=1#comment43689674_27622388

http://stackoverflow.com/comment/43433803
score: 0
type: Comment
type: QuestionComment
has text: Actually i am not using a HQL here its a SQLQuery with native query, and SQLQuery has a provisioin to setMaxResults
comment on: http://stackoverflow.com/q/27501119

http://stackoverflow.com/a/27614031
has comment: http://stackoverflow.com/comment/43650280
upvote count: 3
has comment: http://stackoverflow.com/comment/52280292
has comment: http://stackoverflow.com/comment/43650172
type: Answer
has comment: http://stackoverflow.com/comment/43650375
downvote count: 0
has body: In default this plugin require WEB-INF/web.xml present in build path. If you don'nt have one please set the following property to avoid error failOnMissingWebXml = false //case sensitive, default value is true Example ... org.apache.maven.plugins maven-war-plugin 2.5 // Must use 2.1-alpha-2+ false Creating dummy web.xml file is not a clean way to fix this issue. More configurations are given in apache documentation
answers question: http://stackoverflow.com/q/27612961
score: 3

http://stackoverflow.com/a/27581677
type: Answer
has body: In general, no, because the database server is a separate process than the process running your application. Perhaps, instead of the client-server configuration, you would be more comfortable with the embedded Derby configuration, in which there is no separate server process to start or stop. The limitation of the embedded configuration is that (a) your application is the only one that can be accessing the database at that time, and (b) your application must be on the same machine as the database. Here's some more information about the differences between the two configurations: http://db.apache.org/derby/docs/10.11/getstart/cgsquck70629.html
answers question: http://stackoverflow.com/q/27579232
score: 0

http://stackoverflow.com/q/27538276
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to get my code to check for wins and ties for my Tic Tac Toe game. So far, win checks only work for diagonals, but it's still buggy. Tie check doesn't work at all. I need help on my winCheck method and getting it to check for wins across, vertical, and diagonal. I also need help on getting it to print the Player who won the game. Here is my code. import java.util.Scanner; import java.util.StringTokenizer; public class TicTacToe { public static void main(String[] args){ Scanner console = new Scanner(System.in); System.out.print("Enter board size (e.g. 5): "); int size = 0; if(console.hasNextInt()){ //If the console has an integer, sets the size size = console.nextInt(); } else { while(!console.hasNextInt()){ //If no integer console.next(); //Discards bad input System.out.print("Invalid input. Enter a whole positive integer: "); } size = console.nextInt(); //Sets integer once valid input is entered } int[][] array = new int[size][size]; //Sets the board size by the input (input x input) int i=0; //Initializing "i" for the loops do{ i=1; //Resets "i" to one for(; i&lt;=2; i++){ //For loop repeating for both players 1 and 2 System.out.print("Player " + i + "'s Move (row,column): "); String plyrInput = console.next(); //errorCheck(plyrInput, console); inputParse(plyrInput, i, array); //Sends player's coordinates, player number, and the array if(winCheck(array, i)==true){ System.out.print("Game over."); break; } } }while(winCheck(array, i)==false); console.close(); } public static String errorCheck(String input, Scanner console){ while(!input.contains(",")){ console.next(); System.out.print("Please re-enter in proper format; row,column: "); } return console.next(); } public static void inputParse(String input, int player, int[][] array){ StringTokenizer tokens = new StringTokenizer(input, ","); //Parses input by comma String row = tokens.nextToken(); //First part of input String column = tokens.nextToken(); //Second part of input int rowNum = Integer.parseInt(r…
has title: Win/Tie Check for Tic Tac Toe in Java
tagged with: java
has answer: http://stackoverflow.com/a/27538497
has comment: http://stackoverflow.com/comment/43504733
tagged with: tic-tac-toe
type: Question
score: -9
downvote count: 9
has comment: http://stackoverflow.com/comment/43504861

http://stackoverflow.com/a/27513442
downvote count: 0
has body: Option1 : If you are choosing any collections like List or Set these are specific to an object . I mean, Lets Assume, Set sets = new HashSet(); If I want 5 Object of different different class having no relationship to be send, then It would be very difficult to recognize that which Object is belong to which class while Iteration. So, I wont recommend Collections. Option2 : If you are choosing Map, the same above problem may occurs while getting the Object Dynamically. So, This Options is also not recommended. Option3 : Why cann't you create your own DTO and in that DTO place your reqyired datastructure and pass it over. If you want 5 different Object to be pass then, you can pass. If all are of same type then you may use Collection or array or Variable Arguement based on your scenerio.
answers question: http://stackoverflow.com/q/27513023
score: 1
accepted answer of: http://stackoverflow.com/q/27513023
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27520229
favorite count: 0
has body: I have the following String/text: It was very hot today, even by local standards, and the only other fossils we found in the quarry during the rest of our searching were small, unidentifiable fragments of bone. The plan for tomorrow is to do more prospecting for fossils in a couple of other quarries in the area. I need have to follow these rules: all words greater than 2 characters should be truncated after the second character and suffixed with the string "-xx"; for example the english word "the" becomes "th-xx" capitalization must be maintained punctuation must be maintained, unless it appears in a part of the word to be truncated I would like to use some sort of regular expression to scan through the text and change it according to the rules described above. This is on Android/Java, any suggestions would be greatly appreciated.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43470010
tagged with: java
accepted answer: http://stackoverflow.com/a/27520277
upvote count: 1
downvote count: 1
type: Question
has title: Regex: I would like to use Regular Expression to manipulate/change a specific phrase.
has answer: http://stackoverflow.com/a/27520277
score: 0
tagged with: android
answer count: 1
tagged with: regex

http://stackoverflow.com/q/27634599
tagged with: java
has title: Java - outer variable declaration
possible better answer: http://stackoverflow.com/a/27634724
type: Question
has answer: http://stackoverflow.com/a/27634724
has body: For my below example, I want to know when in the script the private variable is instantiated... class Foo { private String foo123; Foo(String s){ foo123 = s; } } public class FooDo { public static void main(String[] args){ Foo a = new Foo("hello"); } } When is the private String foo123 first instantiated?
score: 0
answer count: 3
tagged with: variables
tagged with: initialization
has answer: http://stackoverflow.com/a/27634839
accepted answer: http://stackoverflow.com/a/27634839
has answer: http://stackoverflow.com/a/27634881
type: AnsweredQuestion

http://stackoverflow.com/a/27634400
answers question: http://stackoverflow.com/q/27634234
downvote count: 0
type: Answer
has body: Under normal circumstances, there is no difference between the result of those two expressions. So, use the simpler: folder.exists()
score: 3
upvote count: 3

http://stackoverflow.com/comment/43493012
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27532032
has text: That helped me. The error actually shows that i have the file still open.
type: AnswerComment

http://stackoverflow.com/a/27488640
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27488432
has body: ok i found the solution this post is not at all right. How to detect JFrame window minimize and maximize events? this code, do the trick import java.awt.Dimension; import java.awt.Frame; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import javax.swing.JFrame; public class Main extends JFrame implements ComponentListener { public Main() { addComponentListener(this); } public void componentHidden(ComponentEvent e) { System.out.println("componentHidden"); } public void componentMoved(ComponentEvent e) { System.out.println("componentMoved"); } public void componentResized(ComponentEvent e) { System.out.println("componentResized"); if (getState() == Frame.ICONIFIED) { System.out.println("RESIZED TO ICONIFIED"); } else if (getState() == Frame.NORMAL) { System.out.println("RESIZED TO NORMAL"); } else { System.out.println("RESIZED TO MAXIMIZED"); } } public void componentShown(ComponentEvent e) { } public static void main(String[] arg) { Main m = new Main(); m.setVisible(true); m.setSize(new Dimension(300, 100)); m.setLocation(50, 50); } }

http://stackoverflow.com/q/27538938
has body: When I run this, it will prompt for miles and then will get hung up and not progress to ask for mph. It is supposed to go back into the loop and if 0 is entered for miles, it will end the program. Why is it getting hung up after my while? import java.text.NumberFormat; import java.util.Scanner; // use integer division to divide time into hours and minutes? public class TravelTimeApp { private static double miles; private static double milesPerHour; private static double hours; private static int minutes; private static int hoursInt; public TravelTimeApp () { miles = 0; } public static void main(String[] args) { //NumberFormat NumberFormat onePlace = NumberFormat.getNumberInstance(); onePlace.setMaximumFractionDigits(1); // create the Scanner object Scanner sc = new Scanner(System.in); System.out.printf(" Enter miles traveled, or a zero (0) to exit -&gt; "); miles = sc.nextDouble(); if (miles == 0) { System.out.printf("\n Program completed."); System.exit(0); } while(miles != 0) { System.out.printf(" Enter miles per hour rate of travel -&gt; "); milesPerHour = sc.nextDouble(); // calculate the travel time in hours with decimal division hours = miles / milesPerHour; // get number of minutes as an int minutes = (int) (hours * 60); // use integer arithmetic to get hours and minutes as int values hoursInt = minutes / 60; minutes = minutes % 60; // display the result System.out.printf(" \nEstimated Travel Time (%,.1f miles at %,.1f mph)\n", miles,milesPerHour); System.out.printf(" Hours%,10d\n", hoursInt); System.out.printf(" Minutes%,8d\n\n", minutes); } } }
type: Question
has comment: http://stackoverflow.com/comment/43505950
answer count: 2
has title: if/while loop will not progress after the while java
accepted answer: http://stackoverflow.com/a/27538970
tagged with: while-loop
upvote count: 1
has comment: http://stackoverflow.com/comment/43507873
has comment: http://stackoverflow.com/comment/43505881
has answer: http://stackoverflow.com/a/27538970
favorite count: 0
has comment: http://stackoverflow.com/comment/43505771
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27539028
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27539028
tagged with: java

mysql
tags question: http://stackoverflow.com/q/27532036
tags question: http://stackoverflow.com/q/27496221
tags question: http://stackoverflow.com/q/27607184
tags question: http://stackoverflow.com/q/27503612
tags question: http://stackoverflow.com/q/27516036
tags question: http://stackoverflow.com/q/27573584
tags question: http://stackoverflow.com/q/27542333
tags question: http://stackoverflow.com/q/27633292
tags question: http://stackoverflow.com/q/27638568
tags question: http://stackoverflow.com/q/27491964
tags question: http://stackoverflow.com/q/27602525
tags question: http://stackoverflow.com/q/27577773
tags question: http://stackoverflow.com/q/27497029
tags question: http://stackoverflow.com/q/27616172
tags question: http://stackoverflow.com/q/27580319
tag name: mysql
tags question: http://stackoverflow.com/q/27595535
tags question: http://stackoverflow.com/q/27563656
tags question: http://stackoverflow.com/q/27581292
tags question: http://stackoverflow.com/q/27597514
tags question: http://stackoverflow.com/q/27607314
tags question: http://stackoverflow.com/q/27533374
tags question: http://stackoverflow.com/q/27620471
tags question: http://stackoverflow.com/q/27636084
tags question: http://stackoverflow.com/q/27536424
tags question: http://stackoverflow.com/q/27563567
tags question: http://stackoverflow.com/q/27500578
tags question: http://stackoverflow.com/q/27597660
tags question: http://stackoverflow.com/q/27638750
tags question: http://stackoverflow.com/q/27630803
tags question: http://stackoverflow.com/q/27504172
tags question: http://stackoverflow.com/q/27604852
tags question: http://stackoverflow.com/q/27500712
tags question: http://stackoverflow.com/q/27635085
tags question: http://stackoverflow.com/q/27579730
tags question: http://stackoverflow.com/q/27617841
tags question: http://stackoverflow.com/q/27589561
tags question: http://stackoverflow.com/q/27632758
tags question: http://stackoverflow.com/q/27511600
tags question: http://stackoverflow.com/q/27564967
tags question: http://stackoverflow.com/q/27565594
tags question: http://stackoverflow.com/q/27604235
tags question: http://stackoverflow.com/q/27505536
tags question: http://stackoverflow.com/q/27486104
tags question: http://stackoverflow.com/q/27594455
tags question: http://stackoverflow.com/q/27638322
tags question: http://stackoverflow.com/q/27582757
tags question: http://stackoverflow.com/q/27541951
tags question: http://stackoverflow.com/q/27632722
tags question: http://stackoverflow.com/q/27581325
tags question: http://stackoverflow.com/q/27582167
tags question: http://stackoverflow.com/q/27551247
tags question: http://stackoverflow.com/q/27585411
tags question: http://stackoverflow.com/q/27533302
tags question: http://stackoverflow.com/q/27636242
tags question: http://stackoverflow.com/q/27476072
tags question: http://stackoverflow.com/q/27541924
type: Tag
tags question: http://stackoverflow.com/q/27580444
tags question: http://stackoverflow.com/q/27553161
tags question: http://stackoverflow.com/q/27582689
tags question: http://stackoverflow.com/q/27534003
tags question: http://stackoverflow.com/q/27566561
tags question: http://stackoverflow.com/q/27518666
tags question: http://stackoverflow.com/q/27489523
tags question: http://stackoverflow.com/q/27632462
tags question: http://stackoverflow.com/q/27548809
tags question: http://stackoverflow.com/q/27608928
tags question: http://stackoverflow.com/q/27553114
tags question: http://stackoverflow.com/q/27525841
tags question: http://stackoverflow.com/q/27618862
tags question: http://stackoverflow.com/q/27622963
tags question: http://stackoverflow.com/q/27593003
tags question: http://stackoverflow.com/q/27538600
tags question: http://stackoverflow.com/q/27541894
tags question: http://stackoverflow.com/q/27564411
tags question: http://stackoverflow.com/q/27534178
tags question: http://stackoverflow.com/q/27623383
tags question: http://stackoverflow.com/q/27564527
tags question: http://stackoverflow.com/q/27594473

http://stackoverflow.com/comment/43579282
has text: so why dont you use touchlistener on listview to change yours linear layout background?
comment on: http://stackoverflow.com/q/27576737
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43436843
comment on: http://stackoverflow.com/q/27503371
has text: Put `static` back in `main` and `nu` declaration :D
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27529324
type: UnansweredQuestion
has title: Jena: How to get Integer result from SPARQL (Jena) ResultSet in Java?
tagged with: sparql
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27529364
type: Question
tagged with: jena
downvote count: 0
has body: I am querying for integer result using a SPARQL Query: String qString = "SELECT (COUNT(?S) AS ?C) "+ "WHERE "+ "{ "+ "?S &lt;"+p1+"&gt; ?O ."+ "?S &lt;"+p2+"&gt; ?O ."+ "} "; Query q = QueryFactory.create(PREFIX+qString); QueryExecution qExecution = QueryExecutionFactory.sparqlService(ENDPOINT, q); ResultSet qResults = qExecution.execSelect(); if(qResults.hasNext()){ QuerySolution thisRow = qResults.next(); int C = thisRow.get("C").toString(); } Problem is that the get() function would return only string outputs using toString(). I need an int output. How do I go about doing that?
tagged with: resultset
has comment: http://stackoverflow.com/comment/43487796
linked to: http://stackoverflow.com/q/16737653
answer count: 1
favorite count: 0
tagged with: integer
upvote count: 2

http://stackoverflow.com/comment/43422243
type: Comment
type: QuestionComment
has text: Can you provide more details on the actual use-case ?
comment on: http://stackoverflow.com/q/27494775
score: 0

http://stackoverflow.com/q/27493705
answer count: 1
downvote count: 0
tagged with: macos
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27493869
has title: How to install ibm-java-sdk-7.1-2.0-x86_64-archive.bin on OS X 10.10.1
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27493869
has body: I was wondering if anyone knows if it possible to install the following version of the jvm on OS X 10.10.1: IBM SDK, Java Technology Edition, Version 7 Release 1, Service Refresh 2 Fix pack 0 The name of the package that I downloaded is the following: ibm-java-sdk-7.1-2.0-x86_64-archive.bin The error that I get if I try to install is: Diegos-MacBook-Pro:Downloads diego$ ./ibm-java-sdk-7.1-2.0-x86_64-archive.bin Preparing to install... Extracting the JRE from the installer archive... Unpacking the JRE... Extracting the installation resources from the installer archive... Configuring the installer for this system's environment... Launching installer... ./ibm-java-sdk-7.1-2.0-x86_64-archive.bin: line 2506: /tmp/install.dir.19329/Linux/resource/jre/bin/java: cannot execute binary file ./ibm-java-sdk-7.1-2.0-x86_64-archive.bin: line 2506: /tmp/install.dir.19329/Linux/resource/jre/bin/java: Undefined error: 0 Thank you

http://stackoverflow.com/comment/43614314
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27595282
has text: yeah, I have implemented Comparable<ElementType> However it seems that the double linked List isn't exactly doing, what it should do and I wonder, how to fix those pointer issues.
type: AnswerComment

http://stackoverflow.com/comment/43519980
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27527200
has text: I add this code and in the if(someView instanceof EditText) statement I add a toast...the toast never shows even when the edittext fields are empty!

http://stackoverflow.com/q/27556655
type: Question
tagged with: java
upvote count: 3
answer count: 2
has body: I'm using java 7 and this snippet doesn't compile ImmutableSortedMap&lt;Integer, String&gt; INT_TO_WORD = new ImmutableSortedMap.Builder&lt;&gt;(Ordering.natural()) .put(1, "one") .put(2, "two") .put(3, "three") .build(); whereas this one does ImmutableSortedMap&lt;Integer, String&gt; INT_TO_WORD = new ImmutableSortedMap.Builder&lt;Integer, String&gt;(Ordering.natural()) .put(1, "one") .put(2, "two") .put(3, "three") .build(); Why do I need to specify the types on the rhs when I have specified them on the lhs? Is there something more to the &lt;&gt; operator than meets the eye.
tagged with: java-7
downvote count: 1
has title: Why can't I use the Java 7 diamond syntax with a guava ImmutableSortedMap.Builder
possible better answer: http://stackoverflow.com/a/27556725
favorite count: 0
has answer: http://stackoverflow.com/a/27556725
has comment: http://stackoverflow.com/comment/43539529
has comment: http://stackoverflow.com/comment/44160597
score: 2
type: AnsweredQuestion
tagged with: guava
tagged with: diamond-operator
has answer: http://stackoverflow.com/a/27556771
accepted answer: http://stackoverflow.com/a/27556771
has comment: http://stackoverflow.com/comment/43540400

http://stackoverflow.com/comment/43506258
type: QuestionComment
has text: my query and the result is true. i want get value from the result of my query, but always show [{NAME=TUTORIAL}]. i want get value "TUTORIAL" only in my result. So, what i must to do??
type: Comment
comment on: http://stackoverflow.com/q/27538600
score: 0

http://stackoverflow.com/comment/43411985
comment on: http://stackoverflow.com/q/27489588
score: 0
type: Comment
type: QuestionComment
has text: You mean you have a `switch` statement that has `return` statements in the body? I don't see how there's any relation between the order of the `cases` and what gets returned. The `switch` statement selects one `case` to execute, then it jumps there; `return` statements in other cases aren't going to have any effect on anything. Perhaps you should still include a code example, since I am having trouble seeing how this question makes sense.

http://stackoverflow.com/comment/43508229
type: QuestionComment
score: 1
has text: logcat is showing same error. no other explanation.
comment on: http://stackoverflow.com/q/27539561
type: Comment

http://stackoverflow.com/comment/43546524
score: 1
comment on: http://stackoverflow.com/q/27560010
has text: Go to the PuTTY User Manual at [this link](http://the.earth.li/~sgtatham/putty/0.63/htmldoc/). The section on Plink may do what you need. I've never used this feature of PuTTY, so I don't know if it will do what you need.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27591465
type: AnsweredQuestion
score: 2
tagged with: java
downvote count: 2
has title: Java code giving error,: Syntax error or token "1", < expected
has body: i am trying to make an HTTP POST request to Hackerrank API but the code is not compiling and giving the error Syntax error or token "1", &lt; expected. One of the POST parameters is 'testcase' which needs to be a string but this is where eclipse gives an error. If i don't put " " around the 1 it works fine but now the Hackerrank API gives response code : 400 because testcase needs to be string. I can't figure out as to how to resolve this problem. Can someone please guide me. Thanks in advance. This is the code: package com.us.ABC; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class HttpURLConnectionExample { private final String USER_AGENT = "Mozilla/5.0"; public static void main(String[] args) throws Exception { HttpURLConnectionExample http = new HttpURLConnectionExample(); System.out.println("\nTesting 2 - Send Http POST request"); http.sendPost(); } // HTTP POST request private void sendPost() throws Exception { String url = "http://api.hackerrank.com/checker/submission.json"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); //add request header con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); String urlParameters = "source=print 1&amp;lang=5&amp;testcases=["1"]&amp;api_key=hackerrank|282807-132|8d62bbbdf90d6a790747561f031a017b7f6cbbeb"; // Send post request con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; S…
tagged with: http
type: Question
upvote count: 4
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27591477
tagged with: android
accepted answer: http://stackoverflow.com/a/27591477

http://stackoverflow.com/a/27531306
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43491375
score: 3
has body: The code catch (Exception | OutOfMemoryError e){ } compiles because OutOfMemoryError is not an Exception, so Exception doesn't cover OutOfMemoryError. OutOfMemoryError is an Error and it is not an Exception. It's usually not a good idea to catch Errors, because they are usually unrecoverable anyway.
upvote count: 3
has comment: http://stackoverflow.com/comment/43491435
has comment: http://stackoverflow.com/comment/43491291
answers question: http://stackoverflow.com/q/27531249

http://stackoverflow.com/comment/43651640
type: Comment
comment on: http://stackoverflow.com/a/27614931
has text: Is my office firewell causing the issue ?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27496870
possible better answer: http://stackoverflow.com/a/27496933
has answer: http://stackoverflow.com/a/27496933
tagged with: java
upvote count: 10
type: Question
has body: In short, does the JVM internally optimize the following code public void test(String str) { int a = 0; for( int i = 0; i &lt; 10; i++) { a = a + str.length(); } } to behave as efficiently as the one below: public void test(String str) { int len = str.length(); int a = 0; for( int i = 0; i &lt; 10; i++) { a = a + len; } } If it does optimize, does it do so by caching the str.length() value internally?
score: 10
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27497034
has comment: http://stackoverflow.com/comment/43425325
tagged with: jvm
favorite count: 0
has title: Does storing the str.length() value in a variable before using it in a for loop have any performance improvements in Java?
accepted answer: http://stackoverflow.com/a/27497034
type: AnsweredQuestion

http://stackoverflow.com/comment/43486387
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27528160
type: AnswerComment
has text: si les balises sont en dehors de la boucle comment je peux parcourir ma liste(j'ai ajouté la page entière au dessus)

http://stackoverflow.com/a/27550326
upvote count: 2
has body: Try this.. setting focus false for the list item would work list = (ListView) findViewById(R.id.listView); list.setItemsCanFocus(false);
accepted answer of: http://stackoverflow.com/q/27550213
answers question: http://stackoverflow.com/q/27550213
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/27593737
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/43647543
has body: Here is the most-minimal code necessary to reproduce your exception. class Stack&lt;E&gt; { protected E[] elements = (E[])new Object[1]; } class IntStack extends Stack&lt;Integer&gt; { void push(Integer i) { // subtly accessing elements as Integer[] which it's not elements[0] = i; } } Java generics are implemented with type erasure so after compilation, this code translates to something like this: class Stack { protected Object[] elements = new Object[1]; } class IntStack extends Stack { void push(Integer i) { // throws ClassCastException ((Integer[])elements)[0] = i; } } Clearly a new Object[] is not an Integer[]. Notice how the cast gets moved to somewhere you did not explicitly put it. This is why (E[])new Object[size] was an unchecked cast and displayed a warning. Instead, you should use Object[] and perform the unchecked cast only when you need to return an element to the outside world. class Stack&lt;E&gt; { private Object[] elements; private int size; Stack(int len) { elements = new Object[len]; } void push(E e) { elements[size] = e; size++; } E pop() { @SuppressWarnings("unchecked"); E e = (E)elements[size - 1]; size--; return e; } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27591061
answers question: http://stackoverflow.com/q/27591061
has comment: http://stackoverflow.com/comment/43611161
type: Answer
score: 6

http://stackoverflow.com/comment/43403075
score: 0
type: Comment
type: QuestionComment
has text: Are you sure that this is the only place in your program where the `send` method is called?
comment on: http://stackoverflow.com/q/27485252

http://stackoverflow.com/comment/43669092
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27624270
has text: Related question: http://stackoverflow.com/questions/9717121/append-text-in-jlabel
score: 0

http://stackoverflow.com/comment/43660456
comment on: http://stackoverflow.com/q/27520905
score: 0
type: Comment
type: QuestionComment
has text: Actually I could not really get that. Sorry. The Exception is : java.lang.NullPointerException at java.util.Base64$Decoder.decode(Base64.java:549) at com.file.up.FileUp.crunchifyREST(FileUp.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) But I think this exception is their because I ams ending an Image as JSON and consuming a InputStream

http://stackoverflow.com/q/27559040
type: Question
has title: JestResult.getSourceAsObjectList - for "@timestamp" or seemingly any field starting with "@"
has body: How would JestResult.getSourceAsObjectList be used to map the field "@timestamp"? Actually, I cannot figure out how to map any field with a name starting with "@". It keeps getting set to "null". For example if the Elasticsearch query returns { "_id": "Vhv2OE1SNSeSg285UYQRQ", "@version": "1", "@timestamp": "2014-12-19T01:18:06.454Z" "type": "hdfs" } and there is a matching POJO Java class import io.searchbox.annotations.JestId; public class ElasticsearchLog { @JestId private String _id; private String version; private String timestamp; private String type; @Override public String toString() { return "ElasticsearchLog{" + "_id='" + _id + '\'' + ", version='" + version + '\'' + ", timestamp='" + timestamp + '\'' + ", type='" + type + '\'' ' }'; } Then doing import io.searchbox.client.JestClient; import io.searchbox.client.JestClientFactory; import io.searchbox.client.JestResult; import io.searchbox.client.config.HttpClientConfig; import io.searchbox.core.Search; import java.util.List; public class JESTClient { public static void main(String[] args) throws Exception { String clusterIP = "localhost"; String port = "9200"; //setup client JestClientFactory factory = new JestClientFactory(); factory.setHttpClientConfig(new HttpClientConfig .Builder("http://" + clusterIP + ":" + port) .multiThreaded(true) .build()); JestClient client = factory.getObject(); Search search = new Search.Builder("{ \"query\": { \"match_all\": {} } }") .addIndex("_all") .build(); JestResult result = client.execute(search); List<ElasticsearchLog> resultLogs = result.getSourceAsObjectList(ElasticsearchLog.class); for(ElasticsearchLog log: resultLogs){ System.out.println(log); } Prints out ElasticsearchLog{_id='Vhv2OE1SNSeSg285UYQRQ', version='null', timestamp='null', type='hdfs'} So the "@version" and "@timestamp" are not getting mapped properly. JsonObject itself seems to be just fine with "@" symbols: import com.google.gson.JsonObject; public static void main(String[] args){ JsonObject testy = ne…
score: 0
tagged with: elasticsearch-jest
answer count: 1
tagged with: elasticsearch
accepted answer: http://stackoverflow.com/a/27626026
has answer: http://stackoverflow.com/a/27626026
tagged with: timestamp
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/43629781
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27602397
has text: Yes but I am only referring to Read Only here, not Immutable, which is a different interface. So if I did `List<Integer>` l = Arrays.asList(1,2)` I could not change it by l.set(0,2)) since that method is not available in the List interface.

http://stackoverflow.com/comment/43499679
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27535551
has text: I think you are focusing on letters in a word while his question is words in a sentence.

http://stackoverflow.com/comment/43564774
type: AnswerComment
comment on: http://stackoverflow.com/a/27568981
type: Comment
has text: I'll take a look. Quick question - is there a better way to read the obj file? this one isn't too bad, but its a test. My actual OBJs will be big, around 400,000 lines to read through.
score: 0

http://stackoverflow.com/a/27529095
score: 3
has comment: http://stackoverflow.com/comment/43490679
accepted answer of: http://stackoverflow.com/q/27524865
type: AcceptedAnswer
downvote count: 0
has body: First define a simple taskExecutor in your config file. &lt;bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"&gt; &lt;property name="corePoolSize" value="5" /&gt; &lt;property name="maxPoolSize" value="10" /&gt; &lt;property name="WaitForTasksToCompleteOnShutdown" value="true" /&gt; &lt;/bean&gt; Create spring bean with prototype scope (prototype is important as you want to give each thread different data), and they will run simultaneously. This spring bean will implement runnable with run method and will have class level variable paramlist for getting vales. public class MyRunnableBean implements runnable{ private Map&lt;String, String&gt; paramList(); // add setter public void run(){ // your logic } } Inject task executor (singleton) in your existin bean , get the instances of this runnable bean in your existing bean set the paramlist and add it in executor :- MyRunnableBEan myRunnableBEan = applicationContext.getBean("myRunnable"); myRunnableBean.setParamList(/* your paramlist*/ ); taskExecutor.execute(myRunnableBean); Correct the compilation and syntax error, this sample code written on notepad, i don't have java on my machine.
answers question: http://stackoverflow.com/q/27524865
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43490877
has comment: http://stackoverflow.com/comment/43490739

http://stackoverflow.com/comment/43494803
has text: Read: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/ObjectFactory.html
score: 2
comment on: http://stackoverflow.com/q/27533132
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27564049
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27563902
has body: Your keystroke is incorrect. The second integer is not a keycode but a modifier. Try it like this: textField.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_TAB, java.awt.event.InputEvent.SHIFT_DOWN_MASK), "BackTab"); textField.getActionMap().put("BackTab", new AbstractAction() { public void actionPerformed(ActionEvent e) { navigateUp(); } }); See also the JavaDoc on Keystroke.getKeyStroke()
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27563902
score: 5

http://stackoverflow.com/a/27482179
score: 7
has comment: http://stackoverflow.com/comment/43396981
type: AcceptedAnswer
downvote count: 0
upvote count: 7
accepted answer of: http://stackoverflow.com/q/27482084
type: Answer
answers question: http://stackoverflow.com/q/27482084
has comment: http://stackoverflow.com/comment/43397140
has body: UTF-8 is a red herring here. You don't need to convert to UTF-8 and back at all - you just need to fix your strings so that you're not escaping the backslash: SUNDAY(1, "Sunday", "\u0627\u0644\u0623\u062d\u062f"), // etc Within a string literal, \\ is used for the backslash character - so in your original code, the strings genuinely contained backslashes, u characters, and hex digits... the only thing that was an escape sequence was the \\ repeatedly. You don't want that - you just want the Unicode characters, using \uXXXX as a Unicode escape sequence. With the code above, you don't need to convert at all - just use: readyToPrintDeliver.setContractDayDescAr(dayDescriptionEnum.getDayDescriptionArabic());

http://stackoverflow.com/comment/43550417
type: QuestionComment
has text: The solution is given in your link. A .cer file is not a PKCS12 keystore.
score: 1
comment on: http://stackoverflow.com/q/27562289
type: Comment

resize
tags question: http://stackoverflow.com/q/27610145
tags question: http://stackoverflow.com/q/27476556
type: Tag
tags question: http://stackoverflow.com/q/27624408
tag name: resize

http://stackoverflow.com/comment/43549451
score: 0
has text: Which object arrays are you talking about?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27561902

http://stackoverflow.com/q/27636272
downvote count: 0
score: 6
has answer: http://stackoverflow.com/a/30208720
possible better answer: http://stackoverflow.com/a/27655948
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43691588
type: Question
has comment: http://stackoverflow.com/comment/43691702
upvote count: 6
has body: I am new to this kind of error in Netbeans. I have been working in Java J2SE using my net beans 8.0.2. I am doing Fuzzy Search on Strings usually strings having 300-500 length. I am using Levenshtein and Jaro Winkler Algorithms to find the Distance between the strings. There are about 1500 iterations to find the distance between the strings! The problem is that my net beans often gives error for: Low on Memory, Error Unable to Compile I have done some search online to get rid of this error and found how to increase the heap size by adding -Xms3G command means to give 3GB space for the heap! but the error still comes up in the compilation process and project run in net beans. Can somebody help me out how to get rid of this error because when it happen i got this error java.lang.noClassDefError Please help me getting rid of this error I am a newbie for this error!
has answer: http://stackoverflow.com/a/27655948
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/62806628
accepted answer: http://stackoverflow.com/a/30208720
has title: NetBeans Low on Memory Error
tagged with: netbeans

http://stackoverflow.com/a/27527899
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27527436
upvote count: 1
type: Answer
has body: The first problem is that you're having your panels share a layout. You must use a new BorderLayout for each of them. The second problem is that a BorderLayout can only have one component in each constraint position. When you try to add multiple components to the WEST position, each one replaces the one that was previously in that position: panel.add(BorderLayout.WEST,oriented_btn); // Implicitly removes oriented_btn from panel panel.add(BorderLayout.WEST,programming_btn); // Implicitly removes programming_btn from panel panel.add(BorderLayout.WEST,and_btn); // Implicitly removes and_btn from panel panel.add(BorderLayout.WEST,java_btn); The solution is to put them in their own container, such as a Box or a JPanel with a GridLayout: Box box = Box.createVerticalBox(); // Or: //JComponent box = new JPanel(new GridLayout(0, 1)); box.add(oriented_btn); box.add(programming_btn); box.add(and_btn); box.add(java_btn); panel.add(BorderLayout.WEST, box);

http://stackoverflow.com/a/27565392
upvote count: 1
has body: Google App Engine integration is only available in IntelliJ IDEA Ultimate. It's not available in IntelliJ IDEA Community Edition.
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27536240
type: Answer
accepted answer of: http://stackoverflow.com/q/27536240

http://stackoverflow.com/comment/43668542
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27623815
has text: I am asking that can you please convert it into c#. I need this because when i simply write WebClient w = new WebClient(); String s = w.DownloadString("https://yellowpages.com.au/nsw/sydney/allergy-testing-12388031-listing.html?context=businessTypeSearch"); Console.Write(s); Nothing is caught in the String. That's why I need useragent type thing(that is in java) need that in c#
type: Comment

http://stackoverflow.com/comment/43397971
type: QuestionComment
has text: Useful series of articles on binary search on Dr Dobbs http://www.drdobbs.com/author/Andrew-Koenig
score: 0
comment on: http://stackoverflow.com/q/27480411
type: Comment

http://stackoverflow.com/comment/43650266
score: 0
type: Comment
has text: i see the update. so you mean it is wrong to use **string** instead ?
type: AnswerComment
comment on: http://stackoverflow.com/a/27614047

http://stackoverflow.com/a/27515363
has body: When changing the address and or port the server listens on you need to ensure the firewall allows that port to be accessed. Something like sudo iptables -A INPUT -p tcp --dport 9990 -j ACCEPT
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27513578
has comment: http://stackoverflow.com/comment/43462063
answers question: http://stackoverflow.com/q/27513578

http://stackoverflow.com/comment/43511204
score: 0
has text: Is this the way to do multithreading in Andriod?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27541989

http://stackoverflow.com/comment/43648348
comment on: http://stackoverflow.com/q/27612828
score: 0
has text: @Ali Railo is an opensource version of ColdFusion built in Java and they have a RegEx implementation you 'might' be able to get some use from... https://gist.github.com/EdwardBeckett/76e1211a336c10aa545b
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43520044
has text: I have change the constructor.But i have another question.Why do i have applets asking for authorizations when i run TestCrons class?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27546605

http://stackoverflow.com/a/27544739
has body: Try Using replaceAll method of String System.out.println(str.replaceAll("hig@123.net ,?", ""));//will work even if you dont have comma at the end of the string. //if you are sure that every String has " ," then consider using replace("hig@123.net ,", "");
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43516265
answers question: http://stackoverflow.com/q/27544542
downvote count: 0
score: 1

http://stackoverflow.com/comment/43652698
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27615542
has text: connection pool leakage?

http://stackoverflow.com/comment/43584484
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27579942
has text: `return x=false` makes no sense (tip: `x = false` or `return false`)

http://stackoverflow.com/comment/43442963
has text: and what about writing into properties file?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27506370
type: AnswerComment

http://stackoverflow.com/comment/43427144
type: QuestionComment
has text: Just as an idea. Don't use Eclipse to copy the files. Copy them with our file browser. After you are done goto Eclipse, click at the project's root and press F5.
score: 1
comment on: http://stackoverflow.com/q/27497890
type: Comment

parallel-processing
tags question: http://stackoverflow.com/q/27509730
tags question: http://stackoverflow.com/q/27536194
tags question: http://stackoverflow.com/q/27577337
type: Tag
tag name: parallel-processing
tags question: http://stackoverflow.com/q/27604235
tags question: http://stackoverflow.com/q/27621017

http://stackoverflow.com/q/27542218
has comment: http://stackoverflow.com/comment/43511666
has body: I'd like to know why my iterator shows only one result from my jsp. Here's my code in s:iterator: &lt;s:iterator value="origins" var="items"&gt; &lt;s:select list="#items" label="Select origin" name="origin"&gt; &lt;/s:select&gt; &lt;/s:iterator&gt; And here's my code from action: public class QueryAction{ private Sector sectorBean = null; private List&lt;String&gt; origins; private List&lt;String&gt; destinations; public List&lt;String&gt; getOrigins() { return origins; } public void setOrigins(List&lt;String&gt; origins) { this.origins = origins; } public List&lt;String&gt; getDestinations() { return destinations; } public void setDestinations(List&lt;String&gt; destinations) { this.destinations = destinations; } public String listing() { SectorDA sda = new SectorDAImpl(); origins = sda.getOrigins(); destinations = sda.getDestinations(); return "success"; } } The values of both origin and destination are : New York, New Orleans, Michigan, Memphis, Chicago, and Pittsburgh. And both only showed Chicago. Can anyone help me? -UPDATE- I've discovered why the iterator shows only one result. It's because of the class' corresponding DA. Here are the codes: private static final String GET_ALL_SECTORS = "SELECT cSectorId, cOrigin, cDestination, cWeekDay1, cWeekDay2, mFirstClassFare, mBusinessClassFare, mEconomyClassFare FROM Sector"; @Override public List&lt;Sector&gt; getAllSectors() { List&lt;Sector&gt; sectors = new ArrayList&lt;Sector&gt;(); Statement stat = null; try { stat = DatabaseConnector.getConnection().createStatement(); ResultSet rs = stat.executeQuery(GET_ALL_SECTORS); if(rs.next()) { String sectorId = rs.getString(1); String origin = rs.getString(2); String destination = rs.getString(3); String weekDay1 = rs.getString(4); String weekDay2 = rs.getString(5); BigDecimal fcFare = rs.getBigDecimal(6); BigDecimal bcFare = rs.getBigDecimal(7); BigDecimal ecFare = rs.getBigDecimal(8); Sector e = new Sector(sectorId, origin, destination, weekDay1, weekDay2, fcFare, bc…
score: 0
has comment: http://stackoverflow.com/comment/43511580
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43511611
has comment: http://stackoverflow.com/comment/43549821
answer count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has title: Why does s:iterator show only one result?
tagged with: java
tagged with: struts2
favorite count: 0

http://stackoverflow.com/comment/43590456
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27582610
has text: using office 2013 create document and then give name of the document
score: 0

http://stackoverflow.com/comment/43664186
comment on: http://stackoverflow.com/a/27621802
score: 0
type: AnswerComment
type: Comment
has text: You need to send it messages. How you do that exactly is up to you, but you could for example send a string to the server, and let the server decide on the action to perform based on that string.

http://stackoverflow.com/comment/100118317
comment on: http://stackoverflow.com/a/27538483
score: 1
type: AnswerComment
type: Comment
has text: This method doesn't work if the source Object has a ByteBuffer field. Json converts it into struct and AttributeValue considers it to be a Map.

http://stackoverflow.com/q/27488949
upvote count: 1
has body: I am trying to display dynamically some data from the server side (struts java) using jquery datatable, first I tried to hard code my data testing in a jsfidle, thing works fine: http://jsfiddle.net/jakecigar/c918of3t/35/ &lt;td class="details-control" data-agencies='["agency22", "agency33","agency17","agency89"]'&gt;&lt;/td&gt; when you click in the green plus icon you will see the detail data coming from data attributes, but when I try it dynamically: http://s4.postimg.org/8d7ki80q5/rr2.png it does not work.
tagged with: custom-data-attribute
tagged with: java
has comment: http://stackoverflow.com/comment/43412660
score: -1
type: Question
has title: List of strings from java to html to jquery using data attributes
has comment: http://stackoverflow.com/comment/43410009
answer count: 1
tagged with: jquery
has answer: http://stackoverflow.com/a/27491700
has comment: http://stackoverflow.com/comment/43411072
has comment: http://stackoverflow.com/comment/43409680
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has comment: http://stackoverflow.com/comment/43412856
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/a/27540667
has comment: http://stackoverflow.com/comment/43510493
has comment: http://stackoverflow.com/comment/43509568
has body: Try this: Runtime runTime = Runtime.getRuntime(); Process process = runTime.exec("java -jar Demo.jar readExcelDemo.Hvd"); If above code is not okay, try this: Runtime runTime = Runtime.getRuntime(); Process process = runTime.exec("cmd.exe /c start java -jar Demo.jar readExcelDemo.Hvd"); If you want to watch cmd, you can use below code. It will immediately close because of the /c flag. Process p = runTime.exec("cmd.exe /c start cmd /k java -jar Demo.jar readExcelDemo.Hvd");
has comment: http://stackoverflow.com/comment/43510315
score: 0
has comment: http://stackoverflow.com/comment/43510233
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27540442
has comment: http://stackoverflow.com/comment/43510595
accepted answer of: http://stackoverflow.com/q/27540442
type: Answer
has comment: http://stackoverflow.com/comment/43508910
has comment: http://stackoverflow.com/comment/43509729

hql
tag name: hql
tags question: http://stackoverflow.com/q/27505478
tags question: http://stackoverflow.com/q/27484380
tags question: http://stackoverflow.com/q/27503963
tags question: http://stackoverflow.com/q/27480932
tags question: http://stackoverflow.com/q/27636084
type: Tag
tags question: http://stackoverflow.com/q/27506880
tags question: http://stackoverflow.com/q/27477821
tags question: http://stackoverflow.com/q/27565338

http://stackoverflow.com/comment/43557798
score: 1
has text: Is there a problem like that as Pam indicated ? @ZouZou
type: Comment
comment on: http://stackoverflow.com/q/27566310
type: QuestionComment

http://stackoverflow.com/comment/43553738
has text: Remember WEB-INF is totally private and can not be used to access anything from other than the web resources, in your case it's a simple java file and you can not access WEB-INF from that.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27538567

http://stackoverflow.com/q/27554658
score: 4
has body: I have an AnnotationProcessor that reads spring webmvc annotations and generates code based on what it finds. The code works great, but I need to figure out how to unit test a method that takes a javax.lang.model.type.TypeMirror as an argument and spits back it's String type representation, including generics (e.g. java.util.Map&lt;java.lang.String, java.util.List&lt;java.lang.String&gt;&gt; is an example of what it would return if I passed a TypeMirror representing a Map&lt;String, List&lt;String&gt;&gt; as an argument. So in order to unit test this method (I based my code on this answer: Getting the qualified class name of generic type with Java 6 annotation processor) I would like to either mock or create a TypeMirror during unit testing. In my actual code I get the TypeMirror I need using VariableElement.asType(), but running a debugger leads me to discover that the actual implementation of VariableElement is a core Java class, not part of the api: http://www.docjar.com/docs/api/com/sun/tools/javac/code/Symbol$VarSymbol.html And the TypeMirror impl is this, similarly buried in a non-public-facing part of the jdk: http://www.docjar.com/docs/api/com/sun/tools/javac/code/Type$ClassType.html I'd rather not go instantiating internal java types - what's the "right" way to instantiate a TypeMirror (or VariableElement)? Has anybody mocked one out where they could give me an example? This is the method I want to unit test: private void typeToString(final TypeMirror type, final StringBuilder result, final char innerClassSeparator) { type.accept(new SimpleTypeVisitor7&lt;Void, Void&gt;() { @Override public Void visitDeclared(DeclaredType declaredType, Void v) { TypeElement typeElement = (TypeElement) declaredType.asElement(); String rawType = rawTypeToString(typeElement, innerClassSeparator); result.append(Util.getUnqualifiedClassName(rawType)); //java.lang.* is auto-included by the compiler for all classes if (!rawType.startsWith("java.lang")) { importTypes.add(rawType); …
has title: How to instantiate a TypeMirror
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27555293
type: AnsweredQuestion
tagged with: java
tagged with: unit-testing
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/27555293
tagged with: annotation-processing
linked to: http://stackoverflow.com/q/9587211
downvote count: 0

http://stackoverflow.com/comment/43562211
has text: If the field is always null, then your loop will never exit :) This has nothing to do with threads or volatility. You need some code to modify the value of the field.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27568058
score: 0

http://stackoverflow.com/q/27527976
upvote count: 1
downvote count: 1
has title: syntax error insert while expression to complete blockstatements JAVA
favorite count: 0
has comment: http://stackoverflow.com/comment/43484537
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27528008
type: Question
has answer: http://stackoverflow.com/a/27528069
tagged with: java
score: 0
has body: this is my code so far to make a program which accepts numbers between 1 and 100 inputted by the user and only even numbers. it also needs to end when N or n is inputted and calculates the sum of valid numbers aswell as displaying the highest number. i have an error which says Syntax error insert "while (expression)"; to complete block statements on this pice of code...: 'System.out.println("Enter the list of whole numbers, pressing N or n will Calculate your numbers");' any help would be greatly appreciated. This is the start of the code: - package week11; import java.util.*; public class repeatlist { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int number = 0, Sum = 0; //variables char letter; char choice; //if (Number %2 ==0) { do System.out.println("Enter the list of whole numbers, pressing N or n will Calculate your numbers"); number = sc.nextInt(); letter = sc.next().charAt(0); { while(letter != 'N' &amp;&amp; letter != 'n' ); System.out.println("end of program"); Sum = Sum + number; number = sc.nextInt(); System.out.println("Sum is "+ Sum); System.out.print("Do you want to repeat the "); System.out.println(" Program ['Y' or 'N']"); choice = sc.next().charAt(0); } } } }
answer count: 2

http://stackoverflow.com/comment/56199754
comment on: http://stackoverflow.com/q/27506299
score: 0
type: Comment
type: QuestionComment
has text: @mrbela Did you ever figure out what the problem was? Or do you still have an idea how you solved it?

http://stackoverflow.com/a/27596753
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27596380
has body: you can remove the action bar from your entier application by adding false to your styles.xml, but remember this will remove the action bar from your entire application if you want to remove the action bar only for certain activities you can call the getActionBar().hide() or getSupportActionBar().hide() (for v7 support)

http://stackoverflow.com/q/27549562
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27550132
tagged with: java
type: Question
has title: Spring Security - where to set default user's authority?
downvote count: 0
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/27550132
answer count: 1
has body: I'm creating a simple application using Spring MVC and Security. I've created User and Authority tables in the db and mapped them in my application. Whenever a new user registers, I'd like to give him a "ROLE_USER" by default. On what layer should I assign him a new role while registering? In the controller, DAO, Service, or as a trigger in the database? Regards, Tom.
favorite count: 0
upvote count: 2
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/a/27505263
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27505196
has body: Instead of checking for equality, you could use contains api from String as below: cell.getStringCellValue().contains(columnWanted) Which means "What is /@v1@/% of /@v2@/?".contains("v4") //No it doesnt "What is /@v1@/% of /@v2@/?".contains("v2") //Yes it does
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43601005
type: Comment
comment on: http://stackoverflow.com/q/27581492
type: QuestionComment
has text: have you set max fetch depth on the FetchPlan?
score: 0

http://stackoverflow.com/a/27478968
type: AcceptedAnswer
has body: When you parse a time string like "1:70", Java calculates the canonical time from that as "2:10". Since you don't want such time recalculation, simply reformat with: drop seconds add padding zeros It's better to use String operations. For example something like this: String str = "1:70:00"; String[] parts = str.split(":"); String newFormat = String.format("%02d:%02d", Integer.parseInt(parts[0]), Integer.parseInt(parts[1])); // will be: "01:70"
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43465787
has comment: http://stackoverflow.com/comment/43391957
answers question: http://stackoverflow.com/q/27478815
accepted answer of: http://stackoverflow.com/q/27478815
upvote count: 1

http://stackoverflow.com/comment/43584209
type: QuestionComment
has text: I have added the `DrawingPanel` to the `JPanel`. I thought to add the `JPanel` again in the main class `TheGame.add(jp)` but that doesn't even exist.
score: 0
comment on: http://stackoverflow.com/q/27579627
type: Comment

http://stackoverflow.com/comment/43384590
comment on: http://stackoverflow.com/a/27475124
type: AnswerComment
has text: FYI: Swing itself is not thread safe, while only a simple example, a more complex update process could cause dirty updates as paint cycles can occur independently of the programmers requests
score: 0
type: Comment

http://stackoverflow.com/comment/43617680
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27596792
has text: Ok.. I think this should be enough.
score: 0

http://stackoverflow.com/a/27523459
score: 0
answers question: http://stackoverflow.com/q/27523292
has body: You are overwriting the key/value in the map store each time around the loop. for(int i=0;i&lt;len;i++) { ... store.put("ID", cid[i]); // always using key "ID" store.put("Names",name[i]); // always using key "Names" } You need to move Children.add(store); inside the for loop. Having said that, do you really need to use store at all here?
type: Answer

http://stackoverflow.com/comment/43422928
score: 0
type: Comment
type: QuestionComment
has text: Can you add the code you have written so far?
comment on: http://stackoverflow.com/q/27495624

http://stackoverflow.com/a/27597821
has comment: http://stackoverflow.com/comment/43634539
has comment: http://stackoverflow.com/comment/43634574
has body: Noclassdeffound error is thrown when the Java Virtual Machine (JVM) or an instance of the ClassLoader class tries to load the definition of a class, but the definition could not be found.where a class has a dependency on some other class and that class is not accessible. In short at if you have used any external jar file than that jar file will be required at compile time as well at Run-time also in your case it seems that JVM is unable to find external jar file that contains WebcamPanel class at run time. so you need to pack that Jar file also with your application's Jar file. for how to add External Jar file in your project you can refer How can I include external jar on my Netbeans project
answers question: http://stackoverflow.com/q/27597324
score: 6
type: Answer
upvote count: 6
downvote count: 0

http://stackoverflow.com/comment/43648257
score: 0
has text: did you tried to update an entity?
type: Comment
comment on: http://stackoverflow.com/q/27602318
type: QuestionComment

http://stackoverflow.com/q/27516177
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43463372
tagged with: java
has answer: http://stackoverflow.com/a/27516234
type: Question
possible better answer: http://stackoverflow.com/a/27516237
has answer: http://stackoverflow.com/a/27516617
score: 0
answer count: 3
has body: so I have a list of basic nodes, for example nodes A B C. each component can see what it is attached to for example: a->b b->c c->a I want a way that I can get a list of all the nodes in the graph. However, I'm running into trouble as my current system can't detect if it has already reached a point. EG in the above example it will go a->b->c->a->b etc. How can I detect this or how can I solve this problem. My current "solution" getList() in the Node class: ArrayList&lt;Node&gt; tempList = new ArrayList&lt;Node&gt;(); tempList.add(this); for(int i = 0 ; i &lt; nodesAttachedTo.size();i++){ tempList.addAll(nodesAttachedTo.get(i).getList()); } return tempList;
has title: Basic java: getting a list of attached nodes
has answer: http://stackoverflow.com/a/27516237
accepted answer: http://stackoverflow.com/a/27516234

http://stackoverflow.com/a/27579896
has body: Correct annotation is @Transactional not @Transaction
answers question: http://stackoverflow.com/q/27579881
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43584346
has comment: http://stackoverflow.com/comment/43619663

http://stackoverflow.com/comment/43686114
type: AnswerComment
comment on: http://stackoverflow.com/a/27632766
score: 0
has text: @Eran `book.book[50] = new GuiApp.book();` I don't think it is required?
type: Comment

http://stackoverflow.com/a/27527716
score: 1
downvote count: 0
has body: Going by your code, the service you are trying to call is a JSON HTTP service. Consuming such services is what the Spring RestTemplate was designed to simplify. There is a guide on how to consume REST web services at spring.io. The code for your call, using RestTemplate is as follows: RestTemplate restTemplate = new RestTemplate(); CardDetailsResponse cardDetails = restTemplate.getForObject( "https://sriharicorp.com/sampleApplications/CoreIssue.aspx?" + "serviceName=svc" + "&amp;loginStatus=1" + "&amp;accountNumber=32146546454", CardDetailsResponse.class);
type: Answer
answers question: http://stackoverflow.com/q/27520382
upvote count: 1

http://stackoverflow.com/a/29211444
accepted answer of: http://stackoverflow.com/q/27551358
type: Answer
has comment: http://stackoverflow.com/comment/130499982
score: 25
downvote count: 0
has comment: http://stackoverflow.com/comment/130486464
upvote count: 25
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27551358
has body: After doing some research, I figured out how to do it. The solution is divided into 2 main parts: WSO2 IS configuration &amp; Resources server configuration. The basic scenario goes as follows: 1- A client (e.g. mobile app) consume a secured resource (e.g. web service) by sending a request to the resources sever (Java web application in my case). 2- The resources server validates the "Authorization" header in the request and extracts the access token. 3- The resources server validates the access token by sending it to the authorization server (WSO2 IS). 4- The authorization server responds with validation response. 5- The resources server validates the response and decides whether to grant or deny access to the requested resource. In my demo, I used WSO2 IS 5.0.0 and Spring security 3.1.0. 1- WSO2 IS Configuration WSO2 IS will act as the authorization server. So, it should be configured to support OAuth 2.0. To do so, a new service provider should be added and configured as follows: (a) Login to WSO2 IS management console. (b) Add a new service provider and give it a name and description. (c) Under Inbound Authentication Configuration >> OAuth/OpenID Connect Configuration >> Click Configure. (d) Configure OAuth 2.0 provider as shown in the below screenshot and click Add. We'll need Password grant type which maps to Resource Owner Password Credentials grant type. It is best suited for my case (securing web services). (e) Under OAuth/OpenID Connect Configuration, you'll find OAuth Client Key and OAuth Client Secret generated. They are used along with username, password, and scope to generate access tokens. 2- Resources Server Configuration As mentioned earlier, the demo Java web application will act as Resources server and client at the same time. To act as resources server, Spring security needs to know how to validate access tokens. So, a token services implementation should be provided. (a) Configure spring to act as resources server. Here is a sample configuration…

http://stackoverflow.com/comment/43546169
has text: did you solve your problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27559736

http://stackoverflow.com/comment/43687283
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27633700
has text: <Button android:id="@+id/btnLogin" style="@android:style/Widget.Material.Button.Borderless" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/password" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:background="@drawable/button" android:text="Login" android:textColor="#ffffff" android:textSize="20sp" android:onClick="welcome" />

http://stackoverflow.com/comment/43583578
has text: Ive checked out the "Timing Service" , you know if I can adapt that to my case?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27562288
type: QuestionComment

http://stackoverflow.com/comment/43398854
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27481850
type: Comment
has text: @PeterLawrey: you hint is about as useful as saying "solve it by yourself".

http://stackoverflow.com/q/27545411
has comment: http://stackoverflow.com/comment/43518224
has answer: http://stackoverflow.com/a/27546605
has comment: http://stackoverflow.com/comment/43518433
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27546882
has answer: http://stackoverflow.com/a/27546882
has title: java quartz cron schedule error
tagged with: cron
accepted answer: http://stackoverflow.com/a/27546605
has comment: http://stackoverflow.com/comment/43517662
type: AnsweredQuestion
has body: sorry for the english (i'm not a native speaker), i wanted to build a job for test.This job might just display a simple message "test job".I have build the classes but i have some errors that i don't really understand. import org.quartz.CronTrigger; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.impl.StdSchedulerFactory; public class TestCrons { public static void main(String[] args) { // TODO Auto-generated method stub JobDetail job = new JobDetail(); job.setName("dummyJobName"); job.setJobClass(HelloJob.class); job.setGroup(Scheduler.DEFAULT_GROUP); CronTrigger trigger = new CronTrigger(); trigger.setName("dummyTriggerName"); trigger.setGroup(Scheduler.DEFAULT_GROUP); try { trigger.setCronExpression("0 0 11 18 * ?"); //schedule it Scheduler scheduler = new StdSchedulerFactory().getScheduler(); scheduler.start(); scheduler.scheduleJob(job, trigger); } catch(Exception e) { System.out.println("erro :-p "); e.printStackTrace(); } } } This is my HelloJob class import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class HelloJob implements Job{ @Override public void execute(JobExecutionContext arg0) throws JobExecutionException { // TODO Auto-generated method stub System.out.println("test job"); } } When i run my TestCrons class i have this error : java.lang.NullPointerException at org.quartz.CronTrigger.computeFirstFireTime(CronTrigger.java:1086) at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:569) at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:221) at sn.orange.test.TestCrons.main(TestCrons.java:30) Can anyone help me please. Another question,why do i have applets which ask me authorizations when running TestCrons class ?
tagged with: quartz-scheduler
type: Question
tagged with: java

http://stackoverflow.com/a/27525220
accepted answer of: http://stackoverflow.com/q/27523670
has comment: http://stackoverflow.com/comment/43479845
answers question: http://stackoverflow.com/q/27523670
upvote count: 1
type: AcceptedAnswer
has body: First create a Panel as: JPanel panel=new JPanel(); Then set the layout as panel.setLayout(new GridLayout(8,8)); Then using a for loop create and add the buttons and the buttons will be displayed in eight by eight grid. Thanks.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43480186

http://stackoverflow.com/comment/43390820
has text: since I dont have any experience with shell, I have to ask this, the line of code provided by you above does not do that what I want right? It is just an example
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27478647

http://stackoverflow.com/a/27605639
has comment: http://stackoverflow.com/comment/43633495
upvote count: 5
answers question: http://stackoverflow.com/q/27605613
has body: this line make error for(int x = 0 ; x &lt;= 2 ; x++) change to for(int x = 0 ; x &lt; 2 ; x++) complete code public static void main(String[] args) { String str[] = {"Enter your name", "Enter your age", "Enter your salary"}; Scanner sc = new Scanner(System.in); int[] i = new int[2]; String[] s = new String[2]; int[] y = new int[2]; for (int x = 0; x &lt; 2; x++) { System.out.println(str[0]); s[x] = sc.nextLine(); System.out.println(s[x]); System.out.println(str[1]); i[x] = sc.nextInt(); System.out.println(i[x]); System.out.println(str[2]); y[x] = sc.nextInt(); System.out.println(y[x]); sc.nextLine();// add this line to skip "\n" Enter key } } ........................explain.................................. the error is here for (int x = 0; x =&lt; 2; x++) { s[x] = sc.nextLine();// when x=2 error occurs because s array is length of 2 and has only 2 elements but array indexes are zero based and you can't get s[2] . and second problem is "But 1st loop works correctly. when loop 2 starts its not allowing me to type Name .its directly goes to age .Do you know why ? " well.. input.nextInt() which only reads the int value. when you continue reading with input.nextLine() you receive the "\n" Enter key. So to skip this you have to add the input.nextLine() to get more explanation about this 2nd issue you must read this question Skipping nextLine() after use nextInt()
score: 5
has comment: http://stackoverflow.com/comment/43634246
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43633830
has comment: http://stackoverflow.com/comment/43633601
type: Answer
has comment: http://stackoverflow.com/comment/43633439
accepted answer of: http://stackoverflow.com/q/27605613

http://stackoverflow.com/q/27554937
has answer: http://stackoverflow.com/a/27555068
type: Question
has answer: http://stackoverflow.com/a/27555088
accepted answer: http://stackoverflow.com/a/27555088
has comment: http://stackoverflow.com/comment/43536172
tagged with: if-statement
has comment: http://stackoverflow.com/comment/43536583
has comment: http://stackoverflow.com/comment/43536437
score: -1
has answer: http://stackoverflow.com/a/27555170
has title: Creating if statement for the small program
has comment: http://stackoverflow.com/comment/43536188
has comment: http://stackoverflow.com/comment/43536271
upvote count: 2
has comment: http://stackoverflow.com/comment/43536438
downvote count: 3
answer count: 3
has body: I am currently struggling with my first java program. The question's task was to create a program that prompts the user to enter 5 numbers and store them in an array. Then the array should be printed, after that's done the program prompts the user to enter a number to search. Depending on the number the program should print "(display number) is on the list" or "(display number) is not on the list" I have been struggling with this for quite a while now not fully understanding the conditional task. Here is what my code looks like: public class NewClass { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in); // Enter three numbers System.out.print("Enter five numbers: "); int number1 = input.nextInt(); int number2 = input.nextInt(); int number3 = input.nextInt(); int number4 = input.nextInt(); int number5 = input.nextInt(); System.out.println("The sorted numbers are " + number1 + ", " + number2 + ", " + number3 + ", " + number4 + ", " + number5); System.out.println("Enter a number to search: "); }
possible better answer: http://stackoverflow.com/a/27555170
favorite count: 0
has comment: http://stackoverflow.com/comment/43536261
has comment: http://stackoverflow.com/comment/43536323
type: AnsweredQuestion
tagged with: conditional-statements
tagged with: java

http://stackoverflow.com/a/27600953
answers question: http://stackoverflow.com/q/27600871
has body: You could set a base tag in the head of your HTML document: &lt;base href="http://www.rooturl.com/"&gt; ..and then just make sure that all images are linked relative to this URL.
score: 0
type: Answer

http://stackoverflow.com/q/27589086
score: 1
tagged with: java
tagged with: quartz-scheduler
upvote count: 1
accepted answer: http://stackoverflow.com/a/27627007
type: Question
has body: I am a developer returning back to Java after about 5 years of .NET experience. I am working on a web app project where I need to update a DB and make an http post every 15 mins. I have put together the following but although it shows me in tomcat, that a thread has been started to execute the Quartz job, it does not do anything. The Database is not updated. For the records, the JPA hibernate implementation that I have works. I have tested it because there is a CRUD form too. For the scheduled task, I have two classes: I have a ContextListener class that will extend the ServletContextListener. It will be registered with the servlet container or AS and scheduled to start when it starts. In this case the AS is Tomcat 7.0.57. I also have a ApiKeyExpirationJob class that represents the job proper. I have also added some config to the web.xml file to instruc Tomcat to start the job whenever it starts. ContextListener class, that initializes the job in the bounds of the context. import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.quartz.DateBuilder; import org.quartz.DateBuilder.IntervalUnit; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SchedulerFactory; import org.quartz.SimpleScheduleBuilder; import org.quartz.SimpleTrigger; import org.quartz.TriggerBuilder; import org.quartz.TriggerKey; import org.quartz.impl.StdSchedulerFactory; import org.apache.log4j.Logger; public class ContextListener implements ServletContextListener { /*private static final Logger LOGGER = Logger.getLogger(ContextListener.class);*/ // Initiate a Schedule Factory private static final SchedulerFactory schedulerFactory = new StdSchedulerFactory(); // Retrieve a scheduler from schedule factory (Lazy init) private Scheduler scheduler = null; @Override public void contextDestroyed(ServletContextEvent arg0) { try { if (scheduler != null && scheduler.isStarted(…
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/27627007
tagged with: spring
has comment: http://stackoverflow.com/comment/43602625
has title: Unable to get Quartz task to run in Spring web mvc
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/43692645
type: QuestionComment
comment on: http://stackoverflow.com/q/27636864
has text: Please provide code, i mean what you are trying to do when this exception is occuring
score: 0
type: Comment

http://stackoverflow.com/q/27550048
has comment: http://stackoverflow.com/comment/43526430
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/27550119
score: 0
has body: In my project i have a simple class to retrieve location..it has a static Fragment as innerclass. MainActivity.java public class MainActivity extends Activity { GPSTracker gps; double mylatitude, mylongitude; TextView txt_location; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txt_location = (TextView) findViewById(R.id.current_location); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } gps = new GPSTracker(MainActivity.this); if (gps.canGetLocation()) { mylatitude = gps.getLatitude(); mylongitude = gps.getLongitude(); String latis = Double.toString(mylatitude); String longis = Double.toString(mylongitude); Log.d("my",latis+ "location to string is done " + longis); txt_location.setText(latis+longis); } } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_main, container, false); } } } The code is showing NullPointerException at txt_location.setText(latis+longis);. Logcat log is as follows: java.lang.RuntimeException: Unable to start activity ComponentInfo{.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) at android.app.ActivityThread.access$600(ActivityThread.java:123) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4424) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsC…
tagged with: android
has title: Getting views in Activity from fragment
tagged with: android-activity
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27550120
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43526613
tagged with: java
has answer: http://stackoverflow.com/a/28513873
has answer: http://stackoverflow.com/a/27550477

http://stackoverflow.com/a/27481215
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43396640
type: Answer
has comment: http://stackoverflow.com/comment/43398300
accepted answer of: http://stackoverflow.com/q/27480933
answers question: http://stackoverflow.com/q/27480933
downvote count: 0
score: 1
has body: Two things: You are going into infinite loop in your method countZero. Remember BigInteger is immutable, so doing operation on the same, you should reassign the value like: a = a.divide(BigInteger.TEN); Your condition will never get satisfied because of above and hence will lead to infinite loop. You should check for below condition: } while (!a.equals(BigInteger.ZERO)); Note Aside: Any reason for defining your class as abstract?

http://stackoverflow.com/a/27612229
upvote count: 3
score: 3
has body: More chatter: scala&gt; import runtime.BoxesRunTime.boxToInteger import runtime.BoxesRunTime.boxToInteger scala&gt; val x = Some(42) x: Some[Int] = Some(42) scala&gt; val y: Option[Int] = None y: Option[Int] = None scala&gt; x.fold(null: Integer)(boxToInteger) res0: Integer = 42 scala&gt; y.fold(null: Integer)(boxToInteger) res1: Integer = null Of course it's better to scala&gt; x.fold(null: Integer)(i =&gt; i: Integer) res2: Integer = 42 and even better scala&gt; x.fold[Integer](null)(identity) res3: Integer = 42 scala&gt; y.fold[Integer](null)(identity) res4: Integer = null
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27611133

http://stackoverflow.com/q/27479066
has answer: http://stackoverflow.com/a/27480140
tagged with: java
has title: want to check value of a particular node exists or not in Java
type: Question
downvote count: 3
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27480140
tagged with: android
score: -3
has body: My XML file as follows: <Data> 51 305 232 sdjhjhd 51 291,305 231 hfhjkjk 51 308 hfhjkjk <Data> want to check a goal id exists under particular passion id or not.
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/27621977
type: Question
score: -1
tagged with: gephi
tagged with: eclipse
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27622062
type: UnansweredQuestion
has body: I am trying to implement gephi 3d atlas and getting java.lang.NoClassDefFoundError : Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLCanvas at org.gephi.visualization.config.VizCommander.createCanvas(VizCommander.java:54) at org.gephi.visualization.VizController.initInstances(VizController.java:138) at org.gephi.visualization.VizController.getInstance(VizController.java:94) at net.clementlevallois.ForceAtlas3D.ForceAtlas2.initAlgo(ForceAtlas2.java:156) at org.gephi.toolkit.demos.MYSQLImportExport.script(MYSQLImportExport.java:113) at org.gephi.toolkit.demos.PreviewJFrame.main(PreviewJFrame.java:100) here is the ForceAtlas2 class implementation (error on last line): package net.clementlevallois.ForceAtlas3D; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import net.clementlevallois.ForceAtlas3D.ForceFactory.AttractionForce; import net.clementlevallois.ForceAtlas3D.ForceFactory.RepulsionForce; import org.gephi.data.attributes.type.TimeInterval; import org.gephi.dynamic.DynamicUtilities; import org.gephi.dynamic.api.DynamicController; import org.gephi.dynamic.api.DynamicModel; import org.gephi.graph.api.Edge; import org.gephi.graph.api.GraphModel; import org.gephi.graph.api.HierarchicalGraph; import org.gephi.graph.api.Node; import org.gephi.graph.api.NodeData; import org.gephi.graph.spi.LayoutData; import org.gephi.layout.spi.Layout; import org.gephi.layout.spi.LayoutBuilder; import org.gephi.layout.spi.LayoutProperty; import org.gephi.project.api.Workspace; import org.gephi.visualization.*; import org.gephi.visualization.api.initializer.Modeler; import org.gephi.visualization.api.initializer.NodeModeler; import org.gephi.visualization.api.objects.ModelClass; import org.gephi.visualization.api.objects.ModelClassLibrary; import org.openide.util.Exceptions; import org.o…
upvote count: 0
tagged with: java
has title: Java Eclipse class not found exception (javax/media/opengl/GLCanvas)

http://stackoverflow.com/comment/43490326
comment on: http://stackoverflow.com/q/27530800
has text: Just to see if I understand the request... you want to store the selected value from the drop down into a form field called "object.id" and pass this value to the Controller?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43613042
has text: I found the problem. I had a java.util.NoSuchElementException during the reading of the EOF.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27593843

http://stackoverflow.com/comment/71410895
has text: 2500+ views and off-topic...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27625528
score: 1

http://stackoverflow.com/comment/43581396
comment on: http://stackoverflow.com/q/27578243
type: Comment
type: QuestionComment
has text: @almasshaikh I misunderstood your point.
score: 0

http://stackoverflow.com/comment/43662608
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27620960
has text: You didn't initialize the second dimension of the array, that's why it's null. Should be `new String[100][4]`. Also, you increment your row counter `j` outside of the `while` loop.
type: Comment

finalize
type: Tag
tags question: http://stackoverflow.com/q/27499077
tag name: finalize

http://stackoverflow.com/q/27495414
linked to: http://stackoverflow.com/q/18390303
linked to: http://stackoverflow.com/q/16847394
has comment: http://stackoverflow.com/comment/43422640
score: 0
has comment: http://stackoverflow.com/comment/43422778
has comment: http://stackoverflow.com/comment/43422765
has answer: http://stackoverflow.com/a/27516280
answer count: 1
has comment: http://stackoverflow.com/comment/43422664
tagged with: applet
has body: I am writing a Java Applet. I am using images to display content on the Applet window. I have a separate folder in which all of these images are contained. This folder is not in the src or bin folder but a separate folder. This folder is called 'assets'. Inside this folder, there is a folder called 'images'. Inside this asset folder, I have a couple sub folders. In these sub folders, I have the images I am using. I use the methods listed below to load these images and display them onto the screen. The Applet runs fine in Eclipse. The problem occurs when I try putting the Applet onto a website. I have done quite a bit of searching, but of the things I tried, none of them solved my problem. I scan an image for certain pixel colors. My code I am using for the images is listed below. When I look at my .jar file, my images seem to be in the .jar file. (I used the Unarchived and JD-GUI to view the .jar file) Please let me know what I should do. ~Rane Method for drawing image onto the screen: loadImg.renderImage("images/walls/lawn.png", xCoord, yCoord, imgWidth, imgHeight, graphics); renderImage method: public void renderImage(String path, int x, int y, int width, int height, Graphics g) { g.setColor(Color.BLACK); g.fillRect(x, y, width, height); g.drawImage(getImage(path), x, y, width, height, applet); } getImage method: public Image getImage(String path) { Image img; URL url = null; try { url = applet.getDocumentBase(); } catch (Exception e) { // TODO: handle exception } img = applet.getImage(url, path); return img; } My HTML: &lt;object type="application/x-java-applet" archive="Applet.jar" code="AppletGame.class" width="600" height="600"&gt;&lt;/object&gt; Two of the many answered that DIDN'T work for me: http://www.java-gaming.org/index.php?topic=27203.0 Java Applet Images will not display when run in browser
has comment: http://stackoverflow.com/comment/43422611
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43425235
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/43423362
has comment: http://stackoverflow.com/comment/43423442
has comment: http://stackoverflow.com/comment/43460025
has title: Images on Java Applet not being displayed when run on a website; why?
type: Question
has comment: http://stackoverflow.com/comment/43461419
has comment: http://stackoverflow.com/comment/43425274
tagged with: java
tagged with: eclipse
tagged with: image

concurrency
tags question: http://stackoverflow.com/q/27515137
tag name: concurrency
tags question: http://stackoverflow.com/q/27525849
tags question: http://stackoverflow.com/q/27529398
tags question: http://stackoverflow.com/q/27515020
tags question: http://stackoverflow.com/q/27486031
tags question: http://stackoverflow.com/q/27486163
tags question: http://stackoverflow.com/q/27602914
tags question: http://stackoverflow.com/q/27576569
tags question: http://stackoverflow.com/q/27590181
tags question: http://stackoverflow.com/q/27536194
tags question: http://stackoverflow.com/q/27600800
tags question: http://stackoverflow.com/q/27499317
tags question: http://stackoverflow.com/q/27602185
tags question: http://stackoverflow.com/q/27570122
tags question: http://stackoverflow.com/q/27561501
tags question: http://stackoverflow.com/q/27611026
tags question: http://stackoverflow.com/q/27508133
tags question: http://stackoverflow.com/q/27554184
type: Tag
tags question: http://stackoverflow.com/q/27558605
tags question: http://stackoverflow.com/q/27505368
tags question: http://stackoverflow.com/q/27605329
tags question: http://stackoverflow.com/q/27564963
tags question: http://stackoverflow.com/q/27487940
tags question: http://stackoverflow.com/q/27630305

http://stackoverflow.com/q/27565398
has title: Libgdx - How to store evrey touch point on drag path?
score: 0
answer count: 1
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/27566097
type: UnansweredQuestion
type: Question
has body: Whenever i try to store points on drag event ,if i drag a little faster it doesn't store each and every point i drag on screen. What should i do that it stores each and every point on my touch path?

http://stackoverflow.com/q/27605613
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/27605870
has answer: http://stackoverflow.com/a/27605870
accepted answer: http://stackoverflow.com/a/27605639
tagged with: netbeans
answer count: 2
upvote count: 1
tagged with: java
tagged with: indexoutofboundsexception
has title: String Array throws error-Java
linked to: http://stackoverflow.com/q/13102045
has body: I am new to Java, This may be a silly question but I really need your help. Code: String str[] ={"Enter your name","Enter your age","Enter your salary"}; Scanner sc = new Scanner(System.in); int[] i = new int[2]; String[] s = new String[2]; int[] y = new int[2]; for(int x = 0 ; x &lt;= 2 ; x++) { System.out.println(str[0]); s[x] = sc.nextLine(); System.out.println(s[x]); System.out.println(str[1]); i[x]=sc.nextInt(); System.out.println(i[x]); System.out.println(str[2]); y[x]=sc.nextInt(); System.out.println(y[x]); } Output : run: Enter your name Sathish Sathish Enter your age 26 26 Enter your salary 25000 25000 Enter your name Enter your age 23 23 Enter your salary 456 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2 at javaapplication1.JavaApplication1.main(JavaApplication1.java:121) 456 Enter your name Java Result: 1 BUILD SUCCESSFUL (total time: 34 seconds) Note: 1st loop works correctly. Then it throws error. Can someone tell me where my mistake is and why it is not working?
has answer: http://stackoverflow.com/a/27605639

http://stackoverflow.com/comment/43615865
score: 0
type: Comment
type: QuestionComment
has text: telnet will not connect to the Java Server, the connection times out. I've tried using `telnet 127.0.0.1 20222` , `telnet localhost 20222` and `telnet 10.0.0.271 20222` all of which timed out. What is interesting is that when I run a Java Client program on the Pi and connect it to the Server's socket at `10.0.0.27 20222` it connects fine. This has me completely stumped...
comment on: http://stackoverflow.com/q/27536254

http://stackoverflow.com/a/27479371
answers question: http://stackoverflow.com/q/27478837
type: Answer
upvote count: 1
downvote count: 1
has body: static int x,y,z; This should make a group of variables static... as long as they are of the same type of course. You can also make them all public, private etc. public static int x,y,z;
score: 0

http://stackoverflow.com/q/27506180
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27512149
tagged with: jmockit
favorite count: 0
has body: Matching doubles is a tricky thing. From experience we've learned to use an EPSILON to allow small double differences. How is double matching handled by JMockit? For example, when I have the following code: new Expectations() {{ mock.applyWithDouble(4.5); return 4.0; mock.applyWithDoubleArray(new Double[] { 4.0, 5.0 }); returns(7.5); }}; Can I be sure that JMockit will match these invocations?
has title: JMockit Expectations of double array argument
tagged with: equals
accepted answer: http://stackoverflow.com/a/27512149
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/27586112
has comment: http://stackoverflow.com/comment/43596952
has answer: http://stackoverflow.com/a/27586547
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/43596709
type: UnansweredQuestion
tagged with: swing
has title: show the 1st and 2nd value of object in comboBox
type: Question
tagged with: java
has body: I have a combobox with list of authors and with change in combobox I have to show the author's detail in table using java swing. I did like: for(Author author: Application.authors){ jComboBoxAuthors.addItem(author); } and with change in item selected : if(jComboBoxAuthors.getSelectedIndex()&gt;0){ Author author = (Author)e.getItem(); String name = author.getFirstName()+" "+author.getLastName(); } It shows object in combo but i need the name only and if I dojComboBoxAuthors.addItem(author.getFirstName()); I can't get value in table ie. name return nothing. How can I fix this issue?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27586241
linked to: http://stackoverflow.com/q/10951449

http://stackoverflow.com/q/27555023
tagged with: libgdx
score: 0
has body: I have a square 2d array of sprites and im trying to rotate all of them around the center position of the map, but after many attempts the sprites seem to be only rotating around their own center. Is this possible?
answer count: 1
has answer: http://stackoverflow.com/a/27555676
accepted answer: http://stackoverflow.com/a/27555676
type: AnsweredQuestion
tagged with: java
type: Question
has title: LibGDX - Rotate a 2d array of sprites around their center

http://stackoverflow.com/a/61260738
answers question: http://stackoverflow.com/q/27563458
downvote count: 0
score: 1
type: Answer
has body: Let's say we want to map Source source to Destination destination. Instead of Destination destination = modelMapper.map(source, Destination.class); In order to combine explicit and implicit mappings we nedd to add implicitMappings() in TypeMap public Destination mapSourceToDestination(Source source) { TypeMap&lt;Source, Destination&gt; typeMap = modelMapper .typeMap(Source.class, Destination.class) .implicitMappings() .addMappings(mapper -&gt; { mapper.map(source -&gt; source.getPropetryOne().getSubPropetryOne(), Destination::setPropetryA); }); return typeMap.map(source); }
upvote count: 1

http://stackoverflow.com/q/27524048
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27524691
accepted answer: http://stackoverflow.com/a/27524691
type: Question
has title: How to store Data for program logic in Android Development in Java?
answer count: 1
has body: I'm currently designing an app that will assist players of a board game by helping randomly select an element of it within certain constraints such as setting expansions owned, house-rules, banned cards, plus same more complex stuff. If I were designing this as a website, I'd use a database to hold all the data on the cards I'll be randomising, but on android I'm unsure what would be the best approach to store the data in. I'd rather not have the app communicate with a server to keep it offline compatible. I also need to be able to update the data store when I update the app so I can support future expansions. I'm planning on using Java to develop as it would keep development time short, and my app wouldn't benefit from the performance that C++ would provide. But I've only developed for Android once in the past, and my Java knowledge is much worse than my C++. Reading in this question, Android - Storing fair amounts of data locally, xml/json or SQLite?, it seems I have three choices: XML, JSON, or SQLite. I'm familiar with the first two, but wouldn't know how to package any of them inside a self-contained apk. The data I'm storing is currently 50 entries long and comprises of integers, strings, booleans, and HTML-formatted text about individual cards. I'd also like to store 64 card thumbnail images of about 10KB each locally too. Each expansion adds approximately 15-20 to the list. What would be the best way to store this and how do I package this all in a single apk? While researching this I've learnt of the new Android Studio, and will likely use that, however I used Eclipse with ADT in the past but my knowledge of it is still pretty limited. Assume development in Windows, total beginner knowledge of both IDEs and Android/Java development in general; as even though I've used Java before on both Android and PC I'm fairly sure my last app broke quite a few 'best practice rules'
score: 0
tagged with: sqlite
linked to: http://stackoverflow.com/q/17394225
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/27477145
tagged with: methods
accepted answer: http://stackoverflow.com/a/27477205
type: Question
has title: Multiple object in array (java)
possible better answer: http://stackoverflow.com/a/27477177
tagged with: arrays
has answer: http://stackoverflow.com/a/27477205
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/27477185
favorite count: 0
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27477177
type: AnsweredQuestion
tagged with: object
score: 3
downvote count: 0
tagged with: java
has body: I want to create objects using the result from Scanner and add them to an array. However, each time I ask for user input for the second time, it just overwrites the first object. How can I add multiple objects to the array? Here's my code: public void ajoutadd() { int i=0; boolean boucle=true; while(i!=2){ Scanner thegame = new Scanner(System.in); System.out.print("name: \n"); String jname = lejeu.nextLine(); System.out.print(jname); Scanner qty = new Scanner(System.in); System.out.print("qty \n"); int jqty = qty.nextInt(); Scanner cat = new Scanner(System.in); System.out.print("cat: \n"); String categ = cat.nextLine(); Scanner price = new Scanner(System.in); System.out.print("price: \n"); int jprice = price.nextInt(); Game agame = new Game(jname,jqty,categ,jprice); System.out.print(unjeu.Nom); // creating the array to contain the game(s) ArrayList&lt;Game&gt; thegame = new ArrayList&lt;Game&gt;(); thegame.add(new Game(jname,jqty,categ,jprice)); // actually only display 1 object that is overwritten // each time after the loop System.out.println(thegame); i=i++; } }

http://stackoverflow.com/q/27481214
upvote count: 1
answer count: 1
favorite count: 0
tagged with: ehcache
has comment: http://stackoverflow.com/comment/43402407
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/43398186
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43426751
has comment: http://stackoverflow.com/comment/43427262
has title: How to cache list using hibernate ehcache
type: Question
has answer: http://stackoverflow.com/a/27498166
has comment: http://stackoverflow.com/comment/43397578
has body: i am using hibernate ehcache in my web application.i cached the list like below. model.put("projecttype",sessionfactory.getCurrentSession().createCriteria(TblProjectType.class).list()); System.out.println("Fetch Count="+ stats.getEntityFetchCount()); System.out.println("Second Level Hit Count="+ stats.getSecondLevelCacheHitCount()); System.out.println("Second Level Miss Count="+ stats.getSecondLevelCacheMissCount()); System.out.println("Second Level Put Count="+ stats.getSecondLevelCachePutCount()); EHCACHE.xml &lt;cache name="com.uniphore.timesheet.domain.TblProjectType" maxElementsInMemory="1000" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true" statistics="true"/&gt; TblProjectType table has 5 rows only. My Output: --First--- Fetch Count=0 Second Level Hit Count=0 Second Level Miss Count=0 Second Level Put Count=0 --Second--- Fetch Count=0 Second Level Hit Count=0 Second Level Miss Count=0 Second Level Put Count=11 ---Third-- Fetch Count=0 Second Level Hit Count=0 Second Level Miss Count=0 Second Level Put Count=22 My Ebtity Class: @Entity @Table(name="tblProjectType") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @Repository public class TblProjectType implements java.io.Serializable { private static final long serialVersionUID = -1798070786993154681L; @Id @GeneratedValue @Column(name ="ID") private short id; @Column(name ="TypeName") private String typeName; @Column(name="CreatedDate") private Date createdDate; @Column(name="ModifiedDate") private Date modifiedDate; @OneToMany(fetch = FetchType.LAZY, mappedBy = "tblProjectType", cascade = CascadeType.ALL) private Set&lt;TblStage&gt; tblStages = new HashSet&lt;TblStage&gt;(0); @OneToMany(fetch = FetchType.LAZY, mappedBy = "tblProjectType", cascade = CascadeType.ALL) private Set&lt;TblProject&gt; tblProjects = new HashSet&lt;TblProject&gt;(0); //getters and setters } Each time put count increases 11.But no other values are changed.why second level cache not hits…
tagged with: caching

http://stackoverflow.com/comment/43573406
score: 0
type: QuestionComment
has text: the getAccountTypes actually accesses the enum. There is also an account for Cash, and I would like to eventually further add accounts as I build the app, so that is why I wanted to further avoid the if/else structure. Also i'm just not sure how to instantiating a new class without having to do an if/else structure. I'm going to see what I can do with the Factory Pattern though. Thanks Luiggi.
comment on: http://stackoverflow.com/q/27573849
type: Comment

http://stackoverflow.com/q/27587348
tagged with: java
tagged with: smslib
type: Question
has answer: http://stackoverflow.com/a/32217368
answer count: 2
has body: I am trying to receive sms on computer using D-Link USB Modem. I have find out solution of my problem on this link But now issue i am facing is that i am receiving same message 3 times, like this New Inbound message detected from Gateway: 923145663675 Hello New Inbound message detected from Gateway: 923145663675 Hello New Inbound message detected from Gateway: 923145663675 Hello Also if program remains open for long time then these above given lines will be printed on screen again and again I did search on google a lot and some where a suggestion i found to remove unused notification, i have done that but still duplicate messages are being received. Code is given below public void doIt() throws Exception{ InboundNotification inboundNotification = new InboundNotification(); try{ SerialModemGateway gateway = new SerialModemGateway("modem.com4", "COM7", 921600, "", ""); gateway.setProtocol(Protocols.PDU); gateway.setInbound(true); gateway.setSimPin("0000"); Service.getInstance().setInboundMessageNotification(inboundNotification); Service.getInstance().addGateway(gateway); Service.getInstance().startService(); System.out.println("Now Sleeping - Hit &lt;enter&gt; to stop service."); System.in.read(); System.in.read(); }catch (Exception e){ e.printStackTrace(); }finally{ Service.getInstance().stopService(); } } public class InboundNotification implements IInboundMessageNotification{ public void process(AGateway gateway, MessageTypes msgType, InboundMessage msg){ if (msgType == MessageTypes.INBOUND) { System.out.println("New Inbound message detected from Gateway: " + msg.getOriginator() + " " + msg.getText()); try { gateway.deleteMessage(msg); } catch (GatewayException ex) { Logger.getLogger(ReadMessages.class.getName()).log(Level.SEVERE, null, ex); } } } }
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/32217368
has title: SMSlib receiving duplicate messages
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34149112
accepted answer: http://stackoverflow.com/a/34149112
score: 1

http://stackoverflow.com/comment/43649611
type: AnswerComment
type: Comment
has text: S3 can now autonomously write a message into SQS or SNS (which can be used to fan-out into multiple SQS queues) to notify your back-end each time a new object is created in an S3 bucket, which is much tidier than the data source having to write to both S3 and then send a back-end notification to SQS. Depending on the scale of your data feed, there's also Amazon Kinesis: http://aws.amazon.com/kinesis/
comment on: http://stackoverflow.com/a/27611847
score: 0

http://stackoverflow.com/comment/43547402
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27560703
has text: Have you looked at using a dialog of some kind? Take a look at [How to Make Dialogs](http://docs.oracle.com/javase/tutorial/uiswing/components/dialog.html)
score: 0

http://stackoverflow.com/a/27629291
has comment: http://stackoverflow.com/comment/43833083
answers question: http://stackoverflow.com/q/27629027
score: 3
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43833283
has body: There are a number of ways you could do this, you could use the process method of the SwingWorker to also update the progress bar, but for me, this couples your worker to the UI, which isn't always desirable. A better solution is to take advantage of the SwingWorkers progress and PropertyChange support, for example.... worker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("state".equalsIgnoreCase(evt.getPropertyName())) { SwingWorker worker = (SwingWorker) evt.getSource(); switch (worker.getState()) { case DONE: // Clean up here... break; } } else if ("progress".equalsIgnoreCase(evt.getPropertyName())) { // You could get the SwingWorker and use getProgress, but I'm lazy... pb.setIndeterminate(false); pb.setValue((Integer)evt.getNewValue()); } } }); worker.execute(); This means you could do this for ANY SwingWorker, so long as it was the worker was calling setProgress internally... public static class ProgressWorker extends SwingWorker { public static final int MAX = 1000; @Override protected Object doInBackground() throws Exception { for (int index = 0; index &lt; MAX; index++) { Thread.sleep(250); setProgress(Math.round((index / (float)MAX) * 100f)); } return null; } } The benefit of this is that the PropertyChange event notification is called from within the context of the of Event Dispatching Thread, making it safe to update the UI from within. And fully runnable example... import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingWorker; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class SwingWorkerProgressExample { public static void main(String[] args) { new SwingWorkerPr…
has comment: http://stackoverflow.com/comment/43679508
downvote count: 0
has comment: http://stackoverflow.com/comment/43679835

http://stackoverflow.com/comment/65714019
has text: did you make it work? and how?
score: 0
comment on: http://stackoverflow.com/q/27623679
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27593960
type: Answer
has body: You can take advantage of the default value of 0 for arrays of integral types as this is guaranteed by the java language spec. So your array is already initialized with zeros. You can now only add the non-zero values, using a counter. eg int nonZeroCounter = 0; int current = 0; for (int i = 0 ; i &lt; numbers.length-1; i++){ System.out.println("enter the number"); current = scan.nextInt(); if (current!=0) numbers[nonZeroCounter++] = current; }
score: 0
answers question: http://stackoverflow.com/q/27593863

http://stackoverflow.com/q/27500075
score: -1
has comment: http://stackoverflow.com/comment/43430666
has answer: http://stackoverflow.com/a/27500167
downvote count: 1
tagged with: ssh
answer count: 1
has comment: http://stackoverflow.com/comment/43430880
favorite count: 0
has comment: http://stackoverflow.com/comment/43430677
tagged with: linux
has comment: http://stackoverflow.com/comment/43430702
type: UnansweredQuestion
has title: Getting IO exception when running Linux command in Java
upvote count: 0
tagged with: java
has body: I'm writing a java app in windows that connect to a Linux machine through SSH. I'm getting the following exception: java.io.IOException: Cannot run program ssh: CreateProcess error=2, cannot find specified file. Code: Process p = Runtime.getRuntime().exec("ssh root@xxx.xxx.xxx.xxx ls"); While running this command in cmd everything is working, but not through java. SSH is in my Path environmental vars.
type: Question
has comment: http://stackoverflow.com/comment/43430744

http://stackoverflow.com/q/27544973
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/27545319
has answer: http://stackoverflow.com/a/27545036
linked to: http://stackoverflow.com/q/6271075
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43516921
score: 1
has answer: http://stackoverflow.com/a/52171587
upvote count: 1
has body: I have a Controller Servlet that has to forward a request to a specific JSP. However, whenever I forward the request it loads the JSP but the URL in the browser does something quite strange. For example: Via index.jsp I click: In the Controller I have a method if(request.getPathInfo().equals("/login"){ dispatcher = this.getServletContext().getRequestDispatcher("/login.jsp"); dispatcher.forward(request, response); } The URL in the browser will say: http://mywebsite.com/my_work/do/login and not: http://mywebsite.com/my_work/login.jsp The login.jsp page will be shown, just the URL is wrong. This causes problems, as I have to include 2 x References to Javascript and CSS files in each JSP as the relative URL changes depending on if I accessed the page manually by typing http://mywebsite.com/my_work/login.jsp into the browser, or whether it was accessed via a forward from the Controller servlet. My web.xml: <?xml version="1.0" encoding="UTF-8"?> Controller controller.Controller Controller /do/* 30 jdbc/LessonDatabase javax.sql.DataSource Container Shareable Any help would be great. I've got everything to work, but I'm guessing that this is not correct! It should be noted that this occurs for any forwarding.
type: Question
accepted answer: http://stackoverflow.com/a/27545036
tagged with: java
tagged with: servlets
has title: JSP - Servlet not forwarding to JSP correctly
has answer: http://stackoverflow.com/a/27545319
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/43640204
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27608831
has text: what is position of `ColorFragment` in ViewPager?
type: Comment

http://stackoverflow.com/a/27630005
answers question: http://stackoverflow.com/q/27601047
type: AcceptedAnswer
score: 0
type: Answer
has body: you have 2 options basically: use GORM standalone, as nicely described here. You'll be able to run a query like: def p = Person.findByFirstName(firstName) or any other GORM or hibernate query use groovy.sql.Sql class (see docs. it doesn't have hibernate on board, but is really powerful if you need to get the things done as simple and as fast as possible: def db = [url:'jdbc:hsqldb:mem:testDB', user:'sa', password:'', driver:'org.hsqldb.jdbc.JDBCDriver'] def sql = Sql.newInstance(db.url, db.user, db.password, db.driver) sql.eachRow( "select * from person" ){ row -> println "$row.id -> $row.userame , $row.firstName" }
accepted answer of: http://stackoverflow.com/q/27601047

http://stackoverflow.com/comment/43438646
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27503046
type: Comment
has text: Do you have a java-agent you want to use? In that case consult its documentation. Otherwise, why bother?

http://stackoverflow.com/a/27607469
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27606986
has body: When an array element satisfies the query criteria specified in find/distinct, the entire document is returned and NOT just the matching array elements. To achieve what you want, you'll need to use the aggregation framework. I have provided the Mongo query below which can be executed in shell. This should help you rewrite it in Java. db.Products.aggregate([ // Match only those documents that have atleast one category satisfying regex `/el/` {$match: {categories: /el/}}, // De-normalize the 'categories' array {$unwind: "$categories"}, // Get only those array elements matching regex '/el/' {$match: {categories: /el/}}, // Group by the array elements to get distinct value {$group: {_id: "$categories"}} ])
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27606986

http://stackoverflow.com/q/27589848
type: Question
linked to: http://stackoverflow.com/q/17874717
has body: I'm trying to code a simple Pong and I have the background panel which contains a Bar panel. So of course I need to be able to place the bar on the size and move it vertically at request. Now I'm just trying to put it in a starting position. If I don't disable the layout the bar gets placed in the top center regardless of location setting, but if I disable the layout and set location it just doesn't show up. I'm not sure what I missing. Here is a code snippet if it can be relevant: public PongPanel() { setLayout(null); setPreferredSize(SIZE); setBackground(Color.BLACK); player_one_bar = new Bar(); add(player_one_bar); player_one_bar.setLocation(10, getSize().height/2-3); }
has answer: http://stackoverflow.com/a/27589947
score: 0
answer count: 2
tagged with: swing
has title: Placement of a JPanel within a JPanel
has answer: http://stackoverflow.com/a/27589933
tagged with: java
linked to: http://stackoverflow.com/q/5621338
type: UnansweredQuestion

http://stackoverflow.com/a/27638352
answers question: http://stackoverflow.com/q/27633443
score: 0
type: Answer
has body: Since you're setting the Browser widget to display a URL, the widget will display the contents of that URL. If you want to display your own content, you'll have to use the setText() method. Perhaps you can create html that includes the URL you want in an IFRAME and compose the rest of the html with your own content? As for the image, I'm sure there are ways to include the image in the constructed HTML ... or you can base64 encode the data and include it in the constructed HTML. See Can I embed a .png image into an html page?

http://stackoverflow.com/comment/43655808
type: Comment
has text: @User10 all ? are in the predefined method replaced by their values before executing the Sqlite statement..
comment on: http://stackoverflow.com/a/27616155
score: 0
type: AnswerComment

http://stackoverflow.com/q/27634220
accepted answer: http://stackoverflow.com/a/27634718
tagged with: java
has comment: http://stackoverflow.com/comment/43688162
has comment: http://stackoverflow.com/comment/43688743
answer count: 1
upvote count: 5
has body: Intro: I have a (obfuscated) METHOD that I printed using ASM and the output was as follows: METHOD: m(ZB)Lcc; -------------------------------------- L0: { ALOAD_0 GETFIELD d/x I LDC 2036719157 IMUL ISTORE GOTO L1 } L2: { ALOAD_6 ICONST_0 LDC -373364649 ALOAD_0 GETFIELD d/at I IMUL ICONST_0 INVOKEVIRTUAL cc/y(III)V GOTO L3 } L4: { ACONST_NULL ARETURN } L5: { ILOAD_1 IFEQ L6 LDC -723220973 ALOAD_0 GETFIELD d/an I IMUL ISTORE LDC 1671960653 ALOAD_0 GETFIELD d/ad I IMUL ISTORE GOTO L7 } L8: { LDC 1955946639 ALOAD_0 GETFIELD d/au I IMUL IFEQ L9 ILOAD_2 ICONST_1 IF_ICMPEQ L10 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/&lt;init&gt;()V ATHROW } L11: { IINC GOTO L12 } L7: { LDC 894092883 ALOAD_0 GETFIELD d/ac I IMUL ISTORE GOTO L6 } L13: { GETSTATIC d/b Lem; ILOAD_3 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE ILOAD_4 ICONST_M1 IF_ICMPEQ L14 GETSTATIC d/b Lem; ILOAD_4 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE GOTO L15 } L16: { ICONST_2 ANEWARRAY DUP ICONST_0 ALOAD_6 AASTORE DUP ICONST_1 ALOAD_7 AASTORE ASTORE GOTO L17 } L18: { GETSTATIC d/b Lem; ILOAD_5 ICONST_0 INVOKESTATIC cc/l(Lem;II)Lcc; ASTORE ICONST_3 ANEWARRAY DUP ICONST_0 ALOAD_6 AASTORE DUP ICONST_1 ALOAD_7 AASTORE DUP ICONST_2 ALOAD_8 AASTORE ASTORE NEW DUP ALOAD_9 ICONST_3 INVOKESPECIAL cc/&lt;init&gt;([Lcc;I)V ASTORE GOTO L14 } L19: { ALOAD_6 ARETURN } L17: { NEW DUP ALOAD_8 ICONST_2 INVOKESPECIAL cc/&lt;init&gt;([Lcc;I)V ASTORE } L14: { ILOAD_1 IFNE L9 ILOAD_2 ICONST_1 IF_ICMPEQ L8 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/&lt;init&gt;()V ATHROW } L15: { ILOAD_5 ICONST_M1 IF_ICMPEQ L16 ILOAD_2 ICONST_1 IF_ICMPEQ L18 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/&lt;init&gt;()V ATHROW } L20: { LDC 1642271889 ALOAD_0 GETFIELD d/ay I IMUL ISTORE GOTO L5 } L9: { ILOAD_1 IFEQ L3 ILOAD_2 ICONST_1 IF_ICMPEQ L21 NEW DUP INVOKESPECIAL java/lang/IllegalStateException/&lt;init&gt;()V ATHROW } L21: { ICONST_0 LDC -373364649 ALOAD_0 GETFIELD d/at I IMUL IF_ICMPEQ L3 ILOAD_2 ICONST_1 IF_ICM…
type: AnsweredQuestion
downvote count: 0
tagged with: java-bytecode-asm
favorite count: 0
has comment: http://stackoverflow.com/comment/43688661
has title: Remove Exception from method body with ASM
has comment: http://stackoverflow.com/comment/43688415
has comment: http://stackoverflow.com/comment/43688245
type: Question
has comment: http://stackoverflow.com/comment/43688851
has comment: http://stackoverflow.com/comment/43688087
score: 5
has answer: http://stackoverflow.com/a/27634718
tagged with: bytecode-manipulation
has comment: http://stackoverflow.com/comment/43688601
has comment: http://stackoverflow.com/comment/43688248

http://stackoverflow.com/a/27576001
has comment: http://stackoverflow.com/comment/43577491
downvote count: 0
has comment: http://stackoverflow.com/comment/43577539
type: Answer
has body: Very unfortunate semi-colon. Change it to a brace. This switch(itemId); should be switch(itemId) { the semicolon terminates the code block so your default isn't part of the switch block.
answers question: http://stackoverflow.com/q/27575988
upvote count: 3
score: 3

http://stackoverflow.com/comment/43648462
has text: @user3928546: It would replace it.
comment on: http://stackoverflow.com/a/27613044
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27533956
has answer: http://stackoverflow.com/a/27668436
possible better answer: http://stackoverflow.com/a/27534047
has answer: http://stackoverflow.com/a/27534047
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27668436
has body: I'm trying to configure a spring security without any web.xml or xml at all, but I get an error which I can't get ride of. Do I get the error because of spring framework version? or the version is in conflict with spring security? Here are the codes and error. @Configuration @EnableWebSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/resources/**", "/signup", "/logout", "/login", "/default").permitAll() .antMatchers("/admin/**").hasRole("ADMIN") .antMatchers("/user/**").hasRole("USER") .anyRequest().authenticated() .and() .formLogin() .loginPage("/login").permitAll() .and() .logout() .deleteCookies("JSESSIONID") .logoutSuccessUrl("/login?logout=success") .logoutUrl("/logout"); } @Bean public BCryptPasswordEncoder getPasswordEncoder() { return new BCryptPasswordEncoder(); } @Override public void configure(WebSecurity builder) throws Exception { builder.ignoring().antMatchers("/resources/**"); } @Bean public AuthenticationManager getAuthenticationManager() throws Exception { return super.authenticationManager(); } } The initializer public class SpringWebAppInitializer implements WebApplicationInitializer { private static final String DISPATCHER_SERVLET_NAME = "dispatcher"; private static final String DISPATCHER_SERVLET_MAPPING = "/"; // gets invoked automatically when application starts up public void onStartup(ServletContext servletContext) throws ServletException { // Create ApplicationContext. I'm using the // AnnotationConfigWebApplicationContext to avoid using beans xml files. AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebMvcConfig.class); // Add the servlet mapping manually and make it initialize automatically Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(…
tagged with: java
has answer: http://stackoverflow.com/a/31561092
type: Question
tagged with: spring-security
has title: spring security 4.0.0 java configuration with no xml
score: 0
answer count: 3

http://stackoverflow.com/q/27568575
upvote count: 5
tagged with: java
type: Question
answer count: 2
score: 5
possible better answer: http://stackoverflow.com/a/27575063
has answer: http://stackoverflow.com/a/27575063
downvote count: 0
has body: My Scenario: I am opening an activity I am doing a validation(checking internet) On false of that validation, launching an alert dialog Now I go to settings enable internet comeback by pressing back button The dialog is not dismissed it still is in the screen My objective is to restart the activity when i return from settings screen CODE public void open(){ final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); alertDialogBuilder.setMessage(getApplicationContext().getResources().getString(R.string.searchFilterLocationMessage)); alertDialogBuilder.setPositiveButton(R.string.Ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { /*Intent intent = new Intent(Settings.ACTION_SETTINGS) ; this.startActivity(intent); */ startActivityForResult(new Intent(Settings.ACTION_SETTINGS), 0); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 0) { Intent intent = getIntent(); finish(); startActivity(intent); } }//onActivityResult
accepted answer: http://stackoverflow.com/a/27568931
tagged with: android-activity
favorite count: 0
tagged with: android
has title: Start an action on returning from settings screen android
tagged with: android-alertdialog
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27568931

http://stackoverflow.com/comment/43695634
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27637598
has text: Do you have central auth server (CAS or something)?

http://stackoverflow.com/comment/43516997
has text: Have you tried the path till here :https://dl-ssl.google.com/android/repository
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27545216

http://stackoverflow.com/a/27595121
score: 3
upvote count: 3
has body: When you invoke System.exit the entire program exits and the process is terminated. Instead you could replace the else statement with: else { break; } That will break the current loop and the rest of the statements will be printed. The keyword break simply breaks the loop.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27595110
answers question: http://stackoverflow.com/q/27595110
type: Answer

http://stackoverflow.com/q/27555047
tagged with: powermock
has answer: http://stackoverflow.com/a/27555299
type: UnansweredQuestion
tagged with: unit-testing
type: Question
has body: I have two classes Parameter and ParameterList. The ParameterList class is an ArrayList made up of Parameters. There is a method getParameterByKey that finds the parameter in the list by key value. I don't want to mock Parameter.getValueString() since I want the value to be different depending on the key and that would require mocks for each key/value. Any input is appreciated. I want to say go get the key "A431" and return "BOSTON" (etc) but I am getting "java.lang.NullPointerException". when(mockedParmList.getParameterByKey("A431").getValueString()).thenReturn("BOSTON"); when(mockedParmList.getParameterByKey("A432").getValueString()).thenReturn("NYC")
tagged with: java
has title: Mocking a method within the context of another class
score: 0
tagged with: mockito
answer count: 1

http://stackoverflow.com/comment/43557914
comment on: http://stackoverflow.com/a/27566467
has text: try that with parameter
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27620477
type: Question
has title: How check Internet-connection in Android?
downvote count: 5
accepted answer: http://stackoverflow.com/a/27620496
duplicate of: http://stackoverflow.com/q/2326767
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27620496
has body: What are the ways to check your Internet connection in Android. And what is the difference between them?
tagged with: android
linked to: http://stackoverflow.com/q/2326767
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/43661712

http://stackoverflow.com/a/27505158
has comment: http://stackoverflow.com/comment/43440458
has body: Try this one.. Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + yours_numbers_values)); startActivity(intent);
answers question: http://stackoverflow.com/q/27505055
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43440457

http://stackoverflow.com/q/27537906
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43504177
tagged with: dijkstra
type: Question
has answer: http://stackoverflow.com/a/27538194
has answer: http://stackoverflow.com/a/27538029
has comment: http://stackoverflow.com/comment/43504165
upvote count: 2
answer count: 2
tagged with: path-finding
has comment: http://stackoverflow.com/comment/43504367
has title: Returning the path in Dijkstra's Algorithm
has comment: http://stackoverflow.com/comment/43504161
has comment: http://stackoverflow.com/comment/43504122
favorite count: 0
has body: So, I've been implementing Dijkstra's algorithm for pathfinding through a maze I generate (I know some of you might think something like A* would be better, but Dijkstra's perfectly fits my needs), and I've run into a small issue. I feel like I'm overlooking something, but when I return the "path" from the start node to the end node, it returns the entire search path the algorithm took (every node it visited), and not the path to the node. //Uses djikstra's algorithm to find the shortest path between two nodes //"vertices" is the global ArrayList in the class with all vertices in the graph. @Override public ArrayList&lt;Vertex&gt; pathfind(Vertex v1, Vertex v2) { ArrayList&lt;Vertex&gt; path = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Vertex&gt; unvisited = new ArrayList&lt;Vertex&gt;(); ArrayList&lt;Vertex&gt; visited = new ArrayList&lt;Vertex&gt;(); if (!vertices.contains(v1) || !vertices.contains(v2)) { return path; } //initialize distances v1.setDistance(0); for(Vertex vert : vertices) { if(vert != v1) { vert.setDistance(Integer.MAX_VALUE); } unvisited.add(vert); } Vertex current = v1; //begin while (!unvisited.isEmpty()) { //for all adjacent vertices that are unvisited for (Vertex v : current.adjacentVertices()) { if (!visited.contains(v)) { //if the distance of that vertex is greater than //the added distance of the current node + the edge connecting the two int pathDist = current.getDistance() + findEdge(current, v).getElement(); if (v.getDistance() &gt; pathDist) { //assign the new distance v.setDistance(pathDist); } } } //remove the current node from the visited set and add it to visited visited.add(current); unvisited.remove(current); //add current node to the path path.add(current); //return if we found the destination if (current == v2)) { return path; } //else move to the lowest value node current = findSmallest(unvisited); } return path; } I know it must be something painfully obvious but I'm hitting my head against the wall, any help would be apprec…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43504388
has comment: http://stackoverflow.com/comment/43504180
has comment: http://stackoverflow.com/comment/43504261

http://stackoverflow.com/comment/43663994
has text: I think you've reached max limit of android apps: http://stackoverflow.com/questions/18675557/what-is-the-maximum-amount-of-ram-an-app-can-use
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27621597

http://stackoverflow.com/comment/43502972
type: AnswerComment
comment on: http://stackoverflow.com/a/27533676
score: 0
has text: One of the very first things the weblogic recipe does is try to create a user called 'oracle' and add that to a group called 'oracle', this is failing on your system, possibly because the group already exists. Read the weblogic/recipes/default.rb file to find out what's happening – If this answer helped, please accept it and ask a new question rather than adding more comments
type: Comment

http://stackoverflow.com/a/27515164
has comment: http://stackoverflow.com/comment/43520014
has comment: http://stackoverflow.com/comment/43464415
has comment: http://stackoverflow.com/comment/43464370
has body: You should get a connection from a connection pool when you need it and close the connection as soon as you can. It is the job of the connection pool to re-use connections, not yours. In other words: Do not keep a connection alive until your consumer bundle is deactivated. Connection pools normally implement DataSource interface, you should use the pools via it. In that case you can replace the pool implementation easily without changing your code. E.g: @Component public class MyComponent { // Connection pool based DataSource @Reference DataSource dataSource; public void myFunction() { try (Connection c = dataSource.getConnection()) { // Database operations } catch (SQLException e) { // TODO } } } When you find yourself repeating the same code many times (getting connection, catching SQLException), you can write a simple component that accepts functional interfaces. E.g.: @Component @Service public class SQLHelper { @Reference // This is a connection pool DataSource private DataSource dataSource; public &lt;R&gt; R execute(Callback&lt;R&gt; callback) { try (Connection c = dataSource.getConnection()) { return callback.call(c); } catch (SQLException e) { throw new UncheckedSQLException(e); } } } Your functional interface would look like this: public interface Callback&lt;R&gt; { R call(Connection connection); } And you would use it like this: sqlHelper.execute((Connection c) -&gt; { // Do some stuff with the connection }); Using transactions If you want to use atomic transactions, I suggest that you should use org.apache.derby.jdbc.EmbeddedXADataSource together with org.apache.commons.dbcp.managed.BasicManagedDataSource from commons-dbcp. After that, you can handle transactions via JTA. It is hard to use the JTA API directly. You should choose a library that helps you propagating transactions. A small guide based on Declarative Services: Install derby jar into your OSGi container Install pax-derby bundle as well! By doing that, you will have a DataSourceFactory OSGi s…
has comment: http://stackoverflow.com/comment/43494680
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43516577
accepted answer of: http://stackoverflow.com/q/27506647
has comment: http://stackoverflow.com/comment/43520100
answers question: http://stackoverflow.com/q/27506647
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43494581
downvote count: 0

http://stackoverflow.com/comment/43483564
has text: I want the program to wait untill all my data is read. But the problem here is that the readLine never returns! Basically I am good if readLine after some amount of time.
comment on: http://stackoverflow.com/a/27521605
type: Comment
score: 0
type: AnswerComment

spring-security
tags question: http://stackoverflow.com/q/27576624
tags question: http://stackoverflow.com/q/27583194
tags question: http://stackoverflow.com/q/27518484
tags question: http://stackoverflow.com/q/27503285
tags question: http://stackoverflow.com/q/27523939
tags question: http://stackoverflow.com/q/27637598
tags question: http://stackoverflow.com/q/27558600
tags question: http://stackoverflow.com/q/27600879
type: Tag
tags question: http://stackoverflow.com/q/27496262
tags question: http://stackoverflow.com/q/27571178
tags question: http://stackoverflow.com/q/27556523
tags question: http://stackoverflow.com/q/27605257
tags question: http://stackoverflow.com/q/27628735
tags question: http://stackoverflow.com/q/27499100
tags question: http://stackoverflow.com/q/27551358
tags question: http://stackoverflow.com/q/27629373
tags question: http://stackoverflow.com/q/27551868
tags question: http://stackoverflow.com/q/27601462
tags question: http://stackoverflow.com/q/27544456
tags question: http://stackoverflow.com/q/27605340
tags question: http://stackoverflow.com/q/27568983
tags question: http://stackoverflow.com/q/27616606
tags question: http://stackoverflow.com/q/27605985
tags question: http://stackoverflow.com/q/27618195
tags question: http://stackoverflow.com/q/27507862
tags question: http://stackoverflow.com/q/27542762
tags question: http://stackoverflow.com/q/27533956
tags question: http://stackoverflow.com/q/27624921
tags question: http://stackoverflow.com/q/27608802
tags question: http://stackoverflow.com/q/27510849
tags question: http://stackoverflow.com/q/27549562
tags question: http://stackoverflow.com/q/27636992
tags question: http://stackoverflow.com/q/27561920
tags question: http://stackoverflow.com/q/27525125
tags question: http://stackoverflow.com/q/27551517
tags question: http://stackoverflow.com/q/27584031
tags question: http://stackoverflow.com/q/27480354
tags question: http://stackoverflow.com/q/27476140
tag name: spring-security

http://stackoverflow.com/comment/43619875
has text: Is that import in the code you are trying to compile? You know that all "com.sun.*" packages are internal and should not be directly used by custom code? Doing so will cause problems like this one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27597750
score: 2

http://stackoverflow.com/q/27633752
favorite count: 0
has comment: http://stackoverflow.com/comment/43687235
has comment: http://stackoverflow.com/comment/43687170
tagged with: android
has comment: http://stackoverflow.com/comment/43687184
has comment: http://stackoverflow.com/comment/43687250
tagged with: http://stackoverflow.com/tag/xml
has body: i have a radio button group which contains 4 radio buttons none of them is checked by default &lt;RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" &gt; &lt;RadioButton android:id="@+id/ans11" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/q" android:text="RadioButton" android:textColor="#747577" android:textSize="35dp" /&gt; &lt;RadioButton android:id="@+id/ans22" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/ans11" android:text="RadioButton" android:textColor="#747577" android:textSize="35dp" /&gt; &lt;RadioButton android:id="@+id/ans33" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/memberexdone" android:layout_below="@+id/ans22" android:text="RadioButton" android:textColor="#747577" android:textSize="35dp" /&gt; &lt;RadioButton android:id="@+id/ans44" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/memberexdone" android:layout_below="@+id/ans22" android:text="RadioButton" android:textColor="#747577" android:textSize="35dp" /&gt; &lt;/RadioGroup&gt; im trying to check if clicked on a button without selecting any of the radio buttons .. rg = (RadioGroup) findViewById(R.id.radioGroup1); // get selected radio button from radioGroup int selectedId = rg.getCheckedRadioButtonId(); // find the radiobutton by returned id rbtn = (RadioButton) findViewById(selectedId); String selected = rbtn.getText().toString(); if (rg.getCheckedRadioButtonId() == -1) { //if the password less than 8 or more than 10 AlertDialog.Builder alertBuilder3=new AlertDialog.Builder(MemberExercise.this); alertBuilder3.setTitle("Invalid"); alertBuilder3.setMessage("Please select an answer first, then click on done."); alertBuilder3.setP…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27634087
tagged with: java
has comment: http://stackoverflow.com/comment/43687551
type: Question
has answer: http://stackoverflow.com/a/27634087
has comment: http://stackoverflow.com/comment/43687201
has title: checking if a radio button is selected
score: 0
has comment: http://stackoverflow.com/comment/43687108
upvote count: 1
answer count: 1
downvote count: 1

file
tags question: http://stackoverflow.com/q/27609840
type: Tag
tags question: http://stackoverflow.com/q/27478888
tags question: http://stackoverflow.com/q/27498954
tags question: http://stackoverflow.com/q/27634234
tags question: http://stackoverflow.com/q/27571707
tags question: http://stackoverflow.com/q/27532492
tags question: http://stackoverflow.com/q/27488778
tag name: file
tags question: http://stackoverflow.com/q/27540090
tags question: http://stackoverflow.com/q/27638981
tags question: http://stackoverflow.com/q/27518022
tags question: http://stackoverflow.com/q/27624740
tags question: http://stackoverflow.com/q/27613419
tags question: http://stackoverflow.com/q/27564956
tags question: http://stackoverflow.com/q/27614799
tags question: http://stackoverflow.com/q/27525019
tags question: http://stackoverflow.com/q/27475827
tags question: http://stackoverflow.com/q/27516340
tags question: http://stackoverflow.com/q/27585437
tags question: http://stackoverflow.com/q/27476838
tags question: http://stackoverflow.com/q/27573312
tags question: http://stackoverflow.com/q/27593587
tags question: http://stackoverflow.com/q/27614030
tags question: http://stackoverflow.com/q/27506216
tags question: http://stackoverflow.com/q/27577306
tags question: http://stackoverflow.com/q/27484670
tags question: http://stackoverflow.com/q/27541669
tags question: http://stackoverflow.com/q/27608988
tags question: http://stackoverflow.com/q/27584861
tags question: http://stackoverflow.com/q/27520747
tags question: http://stackoverflow.com/q/27482200
tags question: http://stackoverflow.com/q/27639106
tags question: http://stackoverflow.com/q/27559498
tags question: http://stackoverflow.com/q/27492795
tags question: http://stackoverflow.com/q/27565876
tags question: http://stackoverflow.com/q/27527870
tags question: http://stackoverflow.com/q/27610519
tags question: http://stackoverflow.com/q/27480181
tags question: http://stackoverflow.com/q/27531975
tags question: http://stackoverflow.com/q/27548090
tags question: http://stackoverflow.com/q/27528900
tags question: http://stackoverflow.com/q/27583912
tags question: http://stackoverflow.com/q/27573841

http://stackoverflow.com/comment/43556702
has text: What error are you getting?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27565876
score: 0

http://stackoverflow.com/comment/43454604
type: QuestionComment
has text: You could use Hibernate Envers that will do the second option automatically.
score: 3
comment on: http://stackoverflow.com/q/27511768
type: Comment

http://stackoverflow.com/a/27577645
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27577371
has body: Null pointer exception. Caused by: java.lang.NullPointerException: uriString Check the value of uriString
has comment: http://stackoverflow.com/comment/43580323

http://stackoverflow.com/comment/43384948
comment on: http://stackoverflow.com/q/27475308
type: Comment
type: QuestionComment
has text: Varies as in it gives the wrong result? Or varies as in this is a correct answer but different from the one in the book?
score: 2

http://stackoverflow.com/q/27632183
tagged with: java
has body: I am using JXL to copy from one excel sheet to another. When the data is getting copied to a new cell, it loses the actual formatting. Eg. The large cells are converted to smaller ones in the new excel file. Can someone please let me know if this is possible. Regards Bipul
has title: Preserve excel format using jxl API
answer count: 1
downvote count: 0
tagged with: jxl
favorite count: 0
has answer: http://stackoverflow.com/a/27632351
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/q/27513833
has comment: http://stackoverflow.com/comment/43529656
tagged with: lint
downvote count: 0
favorite count: 0
has body: i get the following error in my gradle console. Tried looking for the deprecated API but couldn't find it. Thanks in advance!!! Error: DemoActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. public class BaseActivity extends ActionBarActivity { private static final String TAG = "DemoActivity"; DrawerLayout mDrawerlDrawerLayout; FrameLayout actContent; private LinearLayout linear; private ActionBarDrawerToggle actionBarToggle; private Toolbar toolbar; private ImageView mImageView; private int height; private SlidingUpPanelLayout mSlidingUpPanelLayout; private ListView drawerListView; private ArrayAdapter&lt;String&gt; navigationDrawerAdapter; private String[] drawerItem = {"Email", "Wink", "Favourite", "Match me", "About"}; @Override public void setContentView(final int layoutResID) { // TODO Auto-generated method stub linear = (LinearLayout) getLayoutInflater().inflate(R.layout.base_activity, null); actContent = (FrameLayout) linear.findViewById(R.id.frame_container); mDrawerlDrawerLayout = (DrawerLayout) linear.findViewById(R.id.drawer_layout); // set the drawer layout as base_activity content view of Activity. toolbar = (Toolbar) linear.findViewById(R.id.main_toolbar); setSupportActionBar((Toolbar) linear.findViewById(R.id.main_toolbar)); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { return true; } }); // Inflate a menu to be displayed in the toolbar toolbar.inflateMenu(R.menu.demo); //toolbar.getBackground().setAlpha(0); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); setContentView(linear); // add layout of BaseActivities inside framelayout.i.e. frame_container getLayoutInflater().inflate(layoutResID, actContent, true); initDrawerView(); initDrawer(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // I…
tagged with: multithreading
tagged with: android
accepted answer: http://stackoverflow.com/a/27515814
type: AnsweredQuestion
tagged with: android-gradle-plugin
tagged with: java
possible better answer: http://stackoverflow.com/a/57099773
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/57099773
answer count: 2
has answer: http://stackoverflow.com/a/27515814
has title: DemoActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details
score: 4
has comment: http://stackoverflow.com/comment/43460758

http://stackoverflow.com/q/27522314
type: Question
has body: I have a requirement to produce a DTO from a variety of different sources. Each source has been populated into a DTO so I just have to map all 3 beans into 1 bean. Each field has a priority list where field A should be populate from Source 1, if that is null then source 2 and if that is null source 3. But the order of the sources changes for each field of the bean. | Field | Priority 1 | Priorirty 2 | Priority 3 | | A | Source 1 | Source 2 | Source 3 | | B | Source 3 | Source 1 | Source 2 | | C | Source 1 | Source 3 | Source 2 | Is that any good frameworks/libraries that can help me do this?
score: 0
answer count: 1
tagged with: javabeans
type: UnansweredQuestion
tagged with: spring
tagged with: mapping
tagged with: java
has answer: http://stackoverflow.com/a/29343425
has title: Mapping 3 Java Beans into 1

http://stackoverflow.com/comment/43432863
type: QuestionComment
has text: but i can flush it only after tx.commit(); in a finally block, not before that. is there any way to make it faster?
comment on: http://stackoverflow.com/q/27500677
score: 0
type: Comment

http://stackoverflow.com/comment/43393000
comment on: http://stackoverflow.com/q/27479707
score: 0
has text: all sort of: http://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43568027
has text: I think it's **not a duplicate of** "File to byte[] in java": this question is about reading C++ generated data AND ESPECIALLY FLOATS in a java programme, whereas the other question is only about reading a file as a byte array.
score: 1
comment on: http://stackoverflow.com/q/27571156
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43499006
type: QuestionComment
has text: Do you *have* to have a collection of strings instead of a collection of date-based objects (`LocalDate` for example)? In general, it's a good idea to keep data in its "natural" form for as much of the time as possible.
score: 4
comment on: http://stackoverflow.com/q/27535224
type: Comment

http://stackoverflow.com/q/27569603
has title: Java retrieve data from sqlite return Objects instead of values
tagged with: sqlite
tagged with: data-retrieval
type: Question
answer count: 2
score: 0
tagged with: java
has body: I'm trying to retrieve some data from my Db (I'm using SQLite) using DAO public class ClassSectionDAO implements IClassSectionDAO{ @Override public void selectAllClassSection() { d = new DBManager(); sqliteQuery = new SqliteQueries(); d.executeQuery(sqliteQuery.selectAllFrom("classSection")); try{ while(d.getResultSet().next()){ ClassSection classSection = new ClassSection(); classSection.setClassSectionId(d.getResultSet().getString("classSectionId")); classSection.setSchoolClassCode(d.getResultSet().getString("schoolClassCode")); classSection.setClassSectionNumber(d.getResultSet().getInt("classSectionNumber")); classSection.setClassSectionAvailability(d.getResultSet().getString("classSectionAvailability")); classSectionList.add(classSection); System.out.println("classSectionList: " + classSectionList); } } catch(Exception e){ Logger.getLogger(ClassSectionDAO.class.getName()).log(Level.SEVERE, null, e); classSectionList = null; } finally{ d.closeDatabaseConnection(); } } } All I'm getting is a list of objects like classSectionList: [entities.classSection.ClassSection@19ccf6d, entities.classSection.ClassSection@1faf0e7, entities.classSection.ClassSection@1cf8409] What should I do in order to get the values instead? PS: If you want to see more code, let me know
has answer: http://stackoverflow.com/a/27569671
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27569820

http://stackoverflow.com/a/27593044
upvote count: 4
has comment: http://stackoverflow.com/comment/54850116
downvote count: 0
has comment: http://stackoverflow.com/comment/54894989
answers question: http://stackoverflow.com/q/27588787
score: 4
has comment: http://stackoverflow.com/comment/60411682
has comment: http://stackoverflow.com/comment/98177949
has body: I found the answer to this question here. Basically, to disable the feature you have to manually edit the editor.xml and change SHOW_INTENTION_BULB from true to false. The editor settings are located here: The file is located at: On OS X: ~/Library/Preferences/&lt;PRODUCT&gt;/options/editor.xml On Windows: %HOMEPATH%\.&lt;PRODUCT&gt;\config\options\editor.xml On Linux: ~/.&lt;PRODUCT&gt;/config/options/editor.xml &lt;PRODUCT> for me was AndroidStudio.
type: Answer

http://stackoverflow.com/comment/43549298
comment on: http://stackoverflow.com/a/27554558
score: 0
type: Comment
has text: You could also have a look at IdleStateHandler which could help you to manage this kind of issue.
type: AnswerComment

http://stackoverflow.com/comment/43394361
comment on: http://stackoverflow.com/q/27480634
has text: how to use in jsoup?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27624410
has title: JPA entities: inheritance and one-to-one relationship not working simultaneously
has body: I have the following scheme: TableA1 and TableA2 exist in the database and each is represented by an entity bean. Since they are related, I created an abstract class (TableA, it's an entity but does not exist in the database) where both entities inherit from this class. In addition, TableA has a one-to-one relationship with TableB. My objective is to query TableB and from there get information of TableA1 or TableA2 depending on the type. TableA1 and TableA2 each has an id (each table generates automatically a sequential number, so you may have repetition). In TableB I have two columns that combined represent the foreign key: type and id. Type = 1 means that id is in TableA1. Similarly with TableA2. My problem is that I don't know how to define these two columns as an external foreign key. This is what I've got: @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @DiscriminatorColumn(name="type") public abstract class TableA { @Id @Column(name = "type") protected int type; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") protected int id; @Column(name = "name") private String name; // Getters and setters } @Entity @DiscriminatorValue("1") @Table (name="tableA1") public class TableA1 extends TableA { @Column(name="col1") private String col1; // Getters and setters } @Entity @DiscriminatorValue("2") @Table (name="tableA2") public class TableA2 extends TableA { @Column(name="col2") private String col2; // Getters and setters } @Entity @Table (name="tableB") public class TableB { @Id @Column(name="someId") private Integer someId; @Column(name="type") private int type; @Column(name="id") private Integer id; @OneToOne(optional = false, cascade = CascadeType.ALL) @JoinColumns({ @JoinColumn(name = "type"), @JoinColumn(name = "id" ) }) private TableA tableA; // Getters and setters } Update Am I looking for the impossible? This is what I found: Polymorphic relations to non-leaf classes in a table-per-class hierarchy have many limitation…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43796170
upvote count: 1
has answer: http://stackoverflow.com/a/27646607
score: 1
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/43853952
tagged with: ejb
has comment: http://stackoverflow.com/comment/43704123
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/43731125
has comment: http://stackoverflow.com/comment/43729569
has comment: http://stackoverflow.com/comment/43731406
has comment: http://stackoverflow.com/comment/43803997
favorite count: 0

http://stackoverflow.com/a/31204849
has body: From Duncan McGregor's answer: Its better to use it like this: objectMapper.configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY, true); as MapperFeature is for XMLs and comes with jackson-databind which is not required...
downvote count: 2
type: Answer
upvote count: 4
score: 2
answers question: http://stackoverflow.com/q/27577701

http://stackoverflow.com/comment/43475688
has text: Could you please check (1)submit button reach to your doPostmethod(). (2) int result = ps.executeUpdate(); and print out this result is greater than 0.
type: QuestionComment
comment on: http://stackoverflow.com/q/27523290
score: 0
type: Comment

http://stackoverflow.com/q/27511104
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27511471
tagged with: function
has comment: http://stackoverflow.com/comment/43452362
tagged with: boolean
score: 0
answer count: 1
has body: I am working on a project, and I have written the code that I know how to do. I am having multiple problems, and I don't know whether I should post the entire project code at once or just focus on one problem at a time. The directions for the games are: "At the start of the game, both the player's and Slick's scores are set to zero. For each turn, the player picks one number from the pool. That value is added to the player's score. Slick gets the sum of all the remaining numbers in the pool that divide evenly into the player's pick. The player's pick and it's divisors are then removed from the pool. For each turn, Slick must be able to get at least one number. If the player does not have any picks left, the game is over and Slick gets the sum of all remaining numbers in the pool. The highest score wins." If the player's pick is valid, the list of divisors is printed; if the player's pick is not valid, an error message should be printed and the prompt should appear again. For a pick to be legal, it must be in the pool, and it must have at least one divisor in the pool. My code is below: //Name : pickValidity //Description : This funtion determines if the player's pick is valid. //Parameters : The pool array and the user's pick, in that order. //Return : True/false indicator. public static boolean pickValidity(int[] pool, int size, int pick){ int low=0; int high=size-1; int mid; int poolIndex=0; boolean found=false; boolean isValid=false; while(low&lt;=high &amp;&amp; !found){ mid=(low + high) / 2; if(pick == pool[mid]){ found = true; }else if(pick &lt; pool[mid]){ high = mid-1; }else{ low = mid+1; } } if(found){ while(pool[poolIndex] &lt; pick &amp;&amp; !isValid){ if(pick % pool[poolIndex] == 0){ isValid = true; }else{ isValid = false; } poolIndex++; } } return(isValid); } Below, I've added my call statements. When I run the program and deliberately enter non-valid picks, the prompt comes up again, but after I enter another number, the program stops. How do I make i…
type: UnansweredQuestion
has title: Slick pick game - boolean functions and return statements
has comment: http://stackoverflow.com/comment/43452703

http://stackoverflow.com/comment/43530146
score: 0
type: Comment
type: QuestionComment
has text: I think you may try use Android Studio, it's easy.http://developer.android.com/google/play-services/setup.html#Setup
comment on: http://stackoverflow.com/q/27551944

http://stackoverflow.com/a/29244487
has comment: http://stackoverflow.com/comment/46694983
has comment: http://stackoverflow.com/comment/46694917
answers question: http://stackoverflow.com/q/27516576
type: Answer
score: 4
downvote count: 1
upvote count: 5
has body: To precise Eduardo answer: &lt;%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %&gt; &lt;fmt:formatDate pattern="MM/dd/yyyy" value="${widget.created}" /&gt;

http://stackoverflow.com/q/27497962
has comment: http://stackoverflow.com/comment/43427212
has comment: http://stackoverflow.com/comment/43454695
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/43429243
score: 4
has comment: http://stackoverflow.com/comment/43427287
has answer: http://stackoverflow.com/a/27500437
tagged with: ordinal
type: UnansweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/61313364
tagged with: java
has title: Java enum ordinal returning -1?
has comment: http://stackoverflow.com/comment/43429019
has comment: http://stackoverflow.com/comment/43461842
has answer: http://stackoverflow.com/a/27498228
has body: Alright so I'm currently writing some code for a project I'm working on, and I decided an Enum for data storage will be my best bet. But in the first time in my life, the enum.ordinal() returns -1? Heres the code: DuelRules.Rules rule = DuelRules.Rules.values()[(buttonId - (buttonId &lt; 29 ? 18 : 19))]; if (buttonId == 29) { rule = DuelRules.Rules.POCKET; } System.out.println(rule + ", " + rule.ordinal()); rules.swapRule(player, other, rule); reset(false); This statement here: System.out.println(rule + ", " + rule.ordinal()); It prints the correct rule value, but when it prints rule.ordinal() it is printing -1? Example: HAT, -1 My Enum: public enum Rules { HAT(5000, 1), CAPE(5000, 2), AMULET(5000, 4), WEAPON(5000, 8), BODY(5000, 16), SHIELD(5000, 32), LEG(5000, 128), GLOVE(5000, 512), BOOT(5000, 1024), RING(5000, 4096), ARROW(5000, 8192), POCKET(17837, 1), FORFEIT(4989), MOVEMENT(4990), RANGE(4991), MELEE(4992), MAGIC(4993), DRINKS(4994), FOOD(4995), PRAYER(4996), OBSTACLES(4997), FUN_WEAPONS(4998), NO_ABILITIES(4999), SUMMONING(5001); private final int varbitId; private final int value; private Rules(int id, int... value) { this.varbitId = id; this.value = value.length &gt; 0 ? value[0] : 0; } } Note, that enum is inside of another class, not sure if that can effect the outcome. Thanks for your help, I'm completely lost with this one. EDIT: Upon farther review I found that the ordinal is being changed by passing it as an argument? Screnshot of console: Code: } else if (buttonId &gt;= 18 &amp;&amp; buttonId &lt;= 42) { DuelRules.Rules rule = DuelRules.Rules.values()[(buttonId - (buttonId &lt; 29 ? 18 : 19))]; System.out.println("Point one: "+rule + ", " + rule.ordinal()); rules.swapRule(player, other, rule); getDuel(other).rules.setRules(player, other, rules .rules); reset(false); sendFlash(interfaceId, buttonId); } Where it prints Point one, the Rule and its .ordinal is correct, in this case OBSTACLES, 20 But where it passes the rule paramters in rules.swapRule, i…
type: Question
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/43428025
has comment: http://stackoverflow.com/comment/43456205

http://stackoverflow.com/a/27493596
type: Answer
answers question: http://stackoverflow.com/q/27493504
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27493504
score: 1
has body: Maven is exactly what you need. And you don't need to think which exactly jars you need to add to lib folder. But you need to install Maven on your different machines. Your pom.xml have to include: org.seleniumhq.selenium selenium-server-standalone 2.44.0 Additional links: How To Install Maven On Windows Using NetBeans with Apache Maven Maven in 5 Minutes
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/q/27562391
score: 0
has answer: http://stackoverflow.com/a/27564768
tagged with: spring
has body: I'm using Spring 3.1.1 and tomcat 5.5.31 The invoke method in the cardproducer.jsp file: window.location.href = "${pageContext.request.contextPath}/deleteCardProducer/" + id + ".html"; The Controller: @RequestMapping("/deleteCardProducer/{id}") public String delete(@PathVariable("id") String id, Model model,RedirectAttributes att,HttpServletRequest request) throws Exception { if(service.deleteCardProducer(id)){ return getCardProducerList(model,request); }else{ request.setAttribute("errorMessage", resource.getMessage( "error.relevantCardProducer", new Object[] {}, LocaleContextHolder.getLocale())); return "redirect:cardProducer.html"; } } After delete it should list all cardProducers: @RequestMapping("/cardProducer") public String getCardProducerList(Model model,HttpServletRequest request) { model.addAttribute("cardProducerList", service.getAllProducer()); try { if (request.getParameter("errorMessage")==null) { return "cardproducer/cardProducer"; } String errorMessage=new String(request.getParameter("errorMessage").getBytes("ISO-8859-1"), "GBK"); model.addAttribute("errorMessage",errorMessage); log.info("request.getParameter(errorMessage):"+errorMessage); } catch (UnsupportedEncodingException e) { log.error("errors"+e.getMessage()); } return "cardproducer/cardProducer"; The log info show the request URL is cardpro as follow: 2014-12-19 16:21:09,997 DEBUG web.persistence.HBOPSWebDaoImpl.deleteCardProducer(HBOPSWebDaoImpl.java:138) http-8080-2 - queryCardProducer relevant sql String is ~select count(1) from ops_writecardlog t where t.supplier='cardProducer' 2014-12-19 16:21:10,012 DEBUG web.persistence.HBOPSWebDaoImpl.deleteCardProducer(HBOPSWebDaoImpl.java:136) http-8080-2 - deleteCardProducer sql String is ~delete ops_cardproducer where id='cardProducer' 2014-12-19 16:21:10,013 DEBUG web.persistence.HBOPSWebDaoImpl.deleteCardProducer(HBOPSWebDaoImpl.java:138) http-8080-2 - queryCardProducer relevant sql String is ~select count(1) from ops_writecardlog t where t.suppl…
type: Question
has comment: http://stackoverflow.com/comment/43551799
tagged with: spring-mvc
tagged with: java
accepted answer: http://stackoverflow.com/a/27569016
answer count: 2
has title: redirect in Spring MVC occur Infinite loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43648676
has answer: http://stackoverflow.com/a/27569016
has comment: http://stackoverflow.com/comment/43648713
possible better answer: http://stackoverflow.com/a/27564768

http://stackoverflow.com/a/27586863
has comment: http://stackoverflow.com/comment/43599883
has body: Yes there are a few rules about that, nothing written in stone, just kind of practices which became accepted best practices by experience and imitation. Overview Make the responsibility clear. Use Camel Case. Name objects, not classes. Use nouns. Avoid words like Info, Processor or Manager. Use singular if there are objects. Use plural for utility classes. Prefix abstract base class with Abstract. Suffix hidden implementation class with Impl. Do not prefix interface names with I. Use design pattern names correctly. Prefix names with their specialization. Use data structure names correctly Details Make the Responsibility Clear It's important that the name reflects the responsibility nicely. The name shall communicate its intent. Name Objects, not Classes Use a name which looks good when using a single object. Name the object, not the class. Use Camel Case UseCamelCaseForNamesOfTypesInJava. Use nouns Use nouns for objects. If the object represents an action, turn the verb into a noun. If the object represents an attribute, turn the adjective into a noun. For example, if the action is compile(), use Compiler if it is an active action, or Compilable if it is a passive ability. If the action is run(), use Runner if it is an active action, Runnable if it is a passive ability. Avoid words like Info, Processor or Manager In most of the cases, they're just synonyms for "I don't know what to call this" (Robert C. Martin). This itself is a symptom of "I don't know what this thing is doing" or "This thing is doing more than one thing". Which is why we often rightfully feel the urge to refactor when we see such names. Use singular if there are objects Class names usually are singular, especially if you can obtain multiple objects of a single class. We like to reserve the plural for variable names of collections of such objects. Good Example JButton button; List&lt;JButton&gt; buttons; Bad Example Properties is a bad class name because it is plural although there are objects. We …
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/27580974
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43599758
accepted answer of: http://stackoverflow.com/q/27580974
type: Answer

http://stackoverflow.com/comment/43572340
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27573354
has text: The best way across OS is to use 'System.getProperty("user.dir")' and/or 'System.getProperty("user.home")'
type: Comment

http://stackoverflow.com/comment/59516865
type: QuestionComment
comment on: http://stackoverflow.com/q/27578348
type: Comment
has text: Remove `~\.gradle` directory (@home) and restart `AS`. see: http://stackoverflow.com/a/27516679/483588
score: 0

http://stackoverflow.com/a/56600968
answers question: http://stackoverflow.com/q/27580655
score: 0
has body: This is working I tried! package javaapplication2; //@author Ibrahim Yesilay import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Scanner; public class JavaApplication2 { public static void main(String[] args) throws ParseException { Scanner giris = new Scanner(System.in); System.out.println("gün:"); int d = giris.nextInt(); System.out.println("ay:"); int m = giris.nextInt(); System.out.println("yil:"); int y = giris.nextInt(); String tarih; tarih = Integer.toString(d) + "/" + Integer.toString(m) + "/" + Integer.toString(y); System.out.println("Tarih : " + tarih); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date girilentarih = null; girilentarih = dateFormat.parse(tarih); System.out.println(dateFormat.format(girilentarih)); } }
type: Answer

http://stackoverflow.com/comment/43589312
score: 0
type: Comment
has text: @MariosAth You'll need to conduct a google search and Stack Overflow search for this issue, and if it's an issue, post a new question.
type: AnswerComment
comment on: http://stackoverflow.com/a/27582186

http://stackoverflow.com/a/27475899
has comment: http://stackoverflow.com/comment/43386130
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/43412530
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43387765
type: AcceptedAnswer
has body: Think in terms of objects. There are two objects in that JSON string. All the other properties are inner objects or properties. package com.apple.internal.helper; public class IUSAuth { IAMTicket iamTicket; UserExtInfo userExtInfo; public IUSAuth() {} public class IAMTicket { // ADD ALL YOUR IAMTicket Properties Here String ticket; } public class UserExtInfo{ // ADD ALL YOUR USEREXTINFO Properties here } }
answers question: http://stackoverflow.com/q/27475722
accepted answer of: http://stackoverflow.com/q/27475722

http://stackoverflow.com/a/27600295
type: Answer
has body: -Xms128m -Xmx128m -XX:PermSize=64m -XX:MaxPermSize=128m Above your command is simply ignore the default VM(Vritual Machine) settings and overwrite your customize memory settings to netbeans. The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine (JVM), while Xms specifies the initial memory allocation pool. This means that your JVM will be started with Xms amount of memory and will be able to use a maximum of Xmx amount of memory. For example, starting a JVM like below will start it with 256MB of memory, and will allow the process to use up to 2048MB of memory: java -Xmx2048m -Xms256m The memory flag can also be specified in multiple sizes, such as kilobytes, megabytes, and so on. -Xmx1024k -Xmx512m -Xmx8g The Xms flag has no default value, and Xmx typically has a default value of 256MB. A common use for these flags is when you encounter a java.lang.OutOfMemoryError. JVM PermGen Sun JVM’s has a concept of PermGen space that is a seperate allocated memory region that is used for e.g. allocating classes. This is actually the memory region most people have issues with and not so much the normal heap space, but as a normal user one have a hard time realizing this when eclipse (or rather the jvm) just says “Out of Memory” or simply just crashes. The solution for this is to add a MaxPermSize value to the vmargs. e.g. I normally use -XX:MaxPermSize=128m to make sure I don’t run out of PermGen space.
score: 0
answers question: http://stackoverflow.com/q/27600037

http://stackoverflow.com/q/27590170
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27590760
has body: I read about InitBinder on net but not very clear how it works. As per my understanding it can be used to perform cross cutting concern like setting validator, conversion of request parameter to some custom object etc Came across below example on net @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } Handler method is public void handlerMethod(@RequestParam("date") Date date) { } The advantage is before DispatcherServlet calls the handlerMethod it converts the request parameter in to Date object (otherwise developer has to do it handleMethod). Right? My question how spring knows which request parameter needs to be converted to Date object? Say my request string is /someHandler/name?user=Brian&amp;userCreatedDate=2011-01-01&amp;code=aaaa-bb-cc So how spring knows it has to convert userCreatedDate not other two parameters i.e code/user?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27590760
has title: How spring InitBinder works?
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/43559431
type: QuestionComment
type: Comment
has text: You need to share the code you tried and explain what "doesn't work properly" means for us to be able to help. Thanks.
score: 0
comment on: http://stackoverflow.com/q/27565492

http://stackoverflow.com/q/27576005
answer count: 1
has body: I have a Role node that contains some privileges that I am trying to persist into Neo4j. When I construct the object, I see that the privileges exist, but after the save call they disappear. Here's my Role Node: @NodeEntity public class Role { @GraphId Long id; private RoleType roleType; //@RelatedToVia(type="HAS_ROLE", direction=Direction.OUTGOING) private List&lt;Person&gt; users; private List&lt;Privilege&gt; defaultPrivileges; //private List&lt;Task&gt; tasks; public Role(){} public Role(RoleType roleType){ this.roleType=roleType; this.defaultPrivileges=roleType.getDefaultPrivileges(); } } Here's my save: admin= roleRepository.save(admin); Before I save the object it is fully populate and after it's empty. Any ideas as to why that might be EDIT: The code causing the issue is in my Privilege class. This does not work: public class Privilege { private String name; public Privilege(PrivilegeType pt) { this.name = pt.name(); } } This works: public class Privilege { private String name; public Privilege(String pt) { this.name = pt; } } Why would that be causing it to not persist? What am I missing in my RoleRepository?
tagged with: neo4j
has answer: http://stackoverflow.com/a/27586197
tagged with: spring-data-neo4j
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27586197
type: Question
has title: Node will not persist to Neo4j
score: 0

http://stackoverflow.com/comment/43546399
comment on: http://stackoverflow.com/a/27560099
has text: Aah, I see. Currently removing the synchronized doesn't affect the code but I guess if the value updating process was longer then there is a possibility that read happens from multiple threads at the same time. Got it. Thanks a lot bkail.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43643555
comment on: http://stackoverflow.com/q/27610274
type: Comment
has text: @taimeili123 Upvoting is definitely good, but its more to show that the answer was good, or useful. Looks like you already discovered the green "accept" checkmark next to the answer. Good luck.
score: 0
type: QuestionComment

http://stackoverflow.com/a/27516522
has comment: http://stackoverflow.com/comment/43464031
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27515656
type: Answer
has comment: http://stackoverflow.com/comment/43463431
has body: You need to construct your $match stage operation as below: DBObject regex = new BasicDBObject("$regex","Texas"); DBObject condition = new BasicDBObject("value.tweets",regex); DBObject match = new BasicDBObject("$match",condition); The corresponding mongodb query that would be generated as in your question would be: {$match:{"value":{"tweets":{$regex:"Texas"}}}} which actually should be formed as: {$match:{"value.tweets":{$regex:"Texas"}}} The project stage should be built as below: When you need to project a nested field's value as a top level field, in this case User_name, you need to project it using aliases, in this case the alias being user_name. DBObject fields = new BasicDBObject("_id", 0); fields.put("user_name", "$value.User_Name"); // project the user_name for each record. Execute the pipeline: DBObject project = new BasicDBObject("$project", fields ); AggregationOutput output = tweets.aggregate( match, project);
has comment: http://stackoverflow.com/comment/43465091
score: 2
has comment: http://stackoverflow.com/comment/43464613
upvote count: 2
has comment: http://stackoverflow.com/comment/43465236
accepted answer of: http://stackoverflow.com/q/27515656

http://stackoverflow.com/comment/43461582
score: 0
has text: Are you checking in the afternoon? Your SimpleDateFormat isn't using 24hr hour values and isn't showing AM/PM. So the afternoon will look exactly like the morning.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27511590

http://stackoverflow.com/q/27581963
tagged with: android
has comment: http://stackoverflow.com/comment/43588425
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27582173
tagged with: java
has answer: http://stackoverflow.com/a/27582173
has title: Google i/o app: where it sets toolbar_actionbar
type: Question
accepted answer: http://stackoverflow.com/a/27582260
has comment: http://stackoverflow.com/comment/43588239
has answer: http://stackoverflow.com/a/27582260
upvote count: 3
has answer: http://stackoverflow.com/a/27582140
answer count: 3
downvote count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I'm trying to study the Google i/o 2014's app. Inside the BaseActivity it has this method: protected Toolbar getActionBarToolbar() { if (mActionBarToolbar == null) { mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); if (mActionBarToolbar != null) { setSupportActionBar(mActionBarToolbar); } } return mActionBarToolbar; } Why findViewById dosen't return null? :/ The content view of the WelcomeActivity does this: setContentView(R.layout.activity_welcome); and this is the activity_welcome.xml: <ImageView android:src="@drawable/io2014_logo" android:layout_width="200dp" android:layout_height="100dp" android:scaleType="fitCenter" android:tint="#7000" android:layout_gravity="center|top" /> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" iosched:cardBackgroundColor="#fff" iosched:cardCornerRadius="@dimen/card_corner_radius" iosched:cardElevation="@dimen/card_elevation" iosched:cardPreventCornerOverlap="false"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:fontFamily="@string/font_fontFamily_medium" android:text="@string/welcome_to_google_i_o_app" android:textColor="@color/theme_primary" android:textSize="@dimen/text_size_xlarge" android:textStyle="@integer/font_textStyle_medium" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:autoLink="web" android:text="@string/welcome_text" android:textColor="@color/body_text_2" android:textSize="@dimen/text_size_medium" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:autoLink="web" android:text="@string/eula_legal_text" android:textColor="@color/body_text_2" android:textSize="@dimen/text_size_medium" /> </android.support.v7.widget.CardView> So it dosen't include in any way the toolbar_actionbar.xml. Also i looked inside the style.xml for some hint (maybe it was inc…

http://stackoverflow.com/comment/43553515
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27564052
has text: What depth first search has to do with this simple problem?

adt
tags question: http://stackoverflow.com/q/27581839
tags question: http://stackoverflow.com/q/27599096
tag name: adt
tags question: http://stackoverflow.com/q/27563741
tags question: http://stackoverflow.com/q/27636450
tags question: http://stackoverflow.com/q/27555157
type: Tag

http://stackoverflow.com/comment/43393252
has text: If i use synchronized to add method, no two threads can add data to the file at the same time but a thread can be adding data to the file while the other thread can be deleting at the same time right?
type: AnswerComment
comment on: http://stackoverflow.com/a/27478947
score: 0
type: Comment

http://stackoverflow.com/comment/43626888
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27597808
has text: I would recommend asking this on the golang-nuts group. Some (most) of the core developers are regularly on that list, and this would probably be best answered by them. https://groups.google.com/d/forum/golang-nuts
type: Comment

http://stackoverflow.com/comment/43658859
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27617826
type: AnswerComment
has text: i didn't get your question. what "em" means? And give me some clarity, what is your requirement exactly?

http://stackoverflow.com/a/27632597
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27632506
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27632506
type: Answer
has body: When your using (Calendar.YEAR, Calendar.MONTH), these are the static fields in the Calendar class and if you are printing those it will print default values for those fields. In case of Calendar calendar = new GregorianCalendar(); this will create a new instance of calendar with the current time and date values and you are using those static final variables to get that particular value from the newly created calendar instance. you can check documentation for Calender here UPDATE Below is the code for get method, when you pass those static fields to get the method, it will return value for that field from fields array for that index. public int get(int field) { complete(); return internalGet(field); } protected final int internalGet(int field) { return fields[field]; }
downvote count: 0

http://stackoverflow.com/q/27520459
has body: I try to create some nodes in Neo4j with Java via CYPHER, more specifically with JSON and http://hostname:7474/db/data/transaction/commit. My test should create some nodes with the following CYPHER statements: MERGE (a:LABEL1 { name: 'nameNNN', version: 1001 }) SET a.PROP1='&lt;data&gt;' RETURN id(a) As long as is small, e.g. one or more properties with &lt; 1kB in the sum, everything works. If a try to write nodes with a larger property (10MB binary data base64 encoded for example), the test creates 9 or 10 nodes: {errors=[], results=[{"data":[{"row":[10009]}],"columns":["id(a)"]}]} {errors=[], results=[{"data":[{"row":[10010]}],"columns":["id(a)"]}]} ... {errors=[], results=[{"data":[{"row":[10011]}],"columns":["id(a)"]}]} and then starts to return: {errors=[], results=[]} If I restart the test, I get immediately the empty result. If I restart the Neo4j Server, I can either update these 9 or 10 nodes or create 9 or 10 nodes with different names and then again I get only empty results. As I understand it, every statement is a single transaction (I execute one merge per server request). Is this a bug, or a limit of the community edition (2.1.6) or do I something wrong?
tagged with: neo4j
has comment: http://stackoverflow.com/comment/43597568
has title: Neo4j problems storing nodes with large properties
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43597560
has answer: http://stackoverflow.com/a/27521430
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43791299
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43597549
has answer: http://stackoverflow.com/a/27689122
tagged with: rest

http://stackoverflow.com/q/27593747
type: Question
score: 0
answer count: 1
tagged with: one-to-many
tagged with: many-to-one
type: UnansweredQuestion
has title: Hibernate one-to-many mapping integrity constraint violation
has answer: http://stackoverflow.com/a/27594137
has body: @Entity @Table(name = "accommodation") public class Accommodation { public Accommodation(){ } public Accommodation(String name, Boolean status, Def country, Def region, Def town, Def star){ this.name = name; this.status = status; this.country = country; this.region = region; this.town = town; this.star = star; } private Long id; private List&lt;AccommodationCategory&gt; accommodationCategoryList = new ArrayList&lt;AccommodationCategory&gt;(); @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ACC_ID", unique = true, nullable = false) public Long getId() { return id; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "accommodation") public List&lt;AccommodationCategory&gt; getAccommodationCategoryList() { return accommodationCategoryList; } public void setAccommodationCategoryList(List&lt;AccommodationCategory&gt; accommodationCategoryList) { this.accommodationCategoryList = accommodationCategoryList; } } @Entity @Table(name = "accommodation_category") public class AccommodationCategory{ public AccommodationCategory(){} public AccommodationCategory(String name, Boolean valid) { this.name = name; this.valid = valid; } private Long id; private String name; private Boolean valid; private Accommodation accommodation; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "ACC_CAT_ID", unique = true, nullable = false) public Long getId() { return id; } public Boolean getValid() { return valid; } public void setValid(Boolean valid) { this.valid = valid; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ACC_ID", nullable = false) public Accommodation getAccommodation() { return accommodation; } public void setAccommodation(Accommodation accommodation) { this.accommodation = accommodation; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } Accommodation has many AccommodationCategory, but when I save to db I get Caused by: org.hsqldb.HsqlException: …
tagged with: java
tagged with: hibernate
tagged with: nhibernate-mapping

http://stackoverflow.com/comment/80513712
score: 4
type: AnswerComment
has text: @zygimantus: if you can live with a second linear search, yes. Otherwise, use `IntStream.range(0, names.length()).boxed().max(Comparator.comparingInt(ix -> names.get().length())` to search for the index in the first place.
type: Comment
comment on: http://stackoverflow.com/a/27606219

http://stackoverflow.com/comment/43714397
comment on: http://stackoverflow.com/a/27640018
type: AnswerComment
has text: @Ali, what I meant was that it should be explained that the proper Java "way" to do it would be probably be by using an object which stores these values, and not by concatenating them to a string. Your initial example is a good one (though I personally wouldn't call a key-value pair a tuple).
score: 0
type: Comment

http://stackoverflow.com/comment/43451759
type: Comment
comment on: http://stackoverflow.com/q/27510768
has text: my problem is that it always displays "cannot delete file" or "cannot rename file".. how can i solve this?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43790602
type: AnswerComment
has text: Not sure I understand. Using the incremental solver (i.e., using push/pop) does have an effect on the behavior of the solver; in many cases Z3 switches to a completely different solver that supports incremental solving (which is often slower for one particular query, but sometimes quicker). Some things will persist in memory across calls to push/pop (e.g., symbols), is that what you call a leak?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27566112

http://stackoverflow.com/comment/43608396
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27591898
type: AnswerComment
has text: Yep, you forgot the parameters after the `?`. [This is the link](http://www.wunderground.com/history/airport/LAX/2014/12/21/DailyHistory.html?HideSpecis=%201&format=1). Admittedly, it contains ` ` at the end of each line, but you *could* say it's a predictable format.

http://stackoverflow.com/a/27493869
score: 4
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27493705
downvote count: 0
answers question: http://stackoverflow.com/q/27493705
has body: You can't. The installer you are trying to use is for Linux systems, not Mac OS X. IBM's Java SDK is not available for Mac OS X.
type: AcceptedAnswer

http://stackoverflow.com/q/27607314
has comment: http://stackoverflow.com/comment/43668458
upvote count: 2
has answer: http://stackoverflow.com/a/27607384
answer count: 3
has comment: http://stackoverflow.com/comment/43636804
downvote count: 0
has comment: http://stackoverflow.com/comment/43636933
has comment: http://stackoverflow.com/comment/43672878
has comment: http://stackoverflow.com/comment/43637562
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43636873
has answer: http://stackoverflow.com/a/27607594
has answer: http://stackoverflow.com/a/27637991
score: 2
tagged with: java
has body: Ok, so I am a little new to MySQL querys and I am wondering if this would be the correct syntax to get if a value is false in a row. "SELECT `status` FROM `friends` WHERE `requester`= '"+requester+"' AND `requested` = '"+requested+"' AND `status`= 'false'"; If that is wrong, I'm trying to fetch the requests where you are the requester and the status is false through a java method.
has comment: http://stackoverflow.com/comment/43637157
has comment: http://stackoverflow.com/comment/43637755
tagged with: mysql
has title: MySQL Selecting Status from Database Issue
type: Question
has comment: http://stackoverflow.com/comment/43637058
has comment: http://stackoverflow.com/comment/43636918

http://stackoverflow.com/a/27631074
has body: I take it as you're a beginner so i'll say just keep at it and you'll sure improve. I improved your code below for you: public class Ex5_ShiftLeft { public static void main(String[] args) { int[] a = {6, 2, 5, 3}; swap (a); } public static void swap(int[] array){ int temp = array[0] array[0] = array[array.length-1]; array[array.length-1] for(int x : array){ System.out.println(x+" "); } } } CHANGES: You can declare an array just with this: int[] myArray = {6,2,5,3}; There was a problem with your swap function. You have to create temporary variable so you can swap the first element of the array with the last.Also, the last element of the array is array[array.length-1] Second, I used an Enhanced For-loop to print out the array. Hope this helps
has comment: http://stackoverflow.com/comment/43709951
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27630178
type: Answer
has comment: http://stackoverflow.com/comment/43682870
upvote count: 2
has comment: http://stackoverflow.com/comment/43716620

http://stackoverflow.com/comment/43480429
type: Comment
type: QuestionComment
has text: LOL, of course. As I sad a socket is the lowest end of a network communication between two endpoints ;)
score: 0
comment on: http://stackoverflow.com/q/27525841

http://stackoverflow.com/comment/43600398
comment on: http://stackoverflow.com/a/27588133
type: AnswerComment
type: Comment
has text: (and also correct their own declaration to lowercase)
score: 1

http://stackoverflow.com/comment/43523439
type: Comment
has text: Yeah, but 2.3 doesn't have the BeanToCSV feature I was looking for.
comment on: http://stackoverflow.com/a/27548001
type: AnswerComment
score: 0

http://stackoverflow.com/q/27543837
answer count: 1
has title: How to decompress an image stored using stenography?
linked to: http://stackoverflow.com/q/356616
has comment: http://stackoverflow.com/comment/43515660
has comment: http://stackoverflow.com/comment/43514809
has comment: http://stackoverflow.com/comment/43515109
has body: I am currently doing project related to "image steganography" in Java, for that I want to compress and decompress the secret image. I have done the compression part. But I don't know how to perform the decompression part. I have compressed the JPEG image using the following code: public class CompressJPEGFile { public static void main(String[] args) throws IOException { File imageFile = new File("C:\\Users\\user\\Desktop\\encryption\\d.jpg"); File compressedImageFile = new File("C:\\Users\\user\\Desktop\\encryption\\compress.jpg"); InputStream is = new FileInputStream(imageFile); OutputStream os = new FileOutputStream(compressedImageFile); float quality = 0.5f; BufferedImage image = ImageIO.read(is); // get all image writers for JPG format Iterator&lt;ImageWriter&gt; writers = ImageIO.getImageWritersByFormatName("jpg"); if (!writers.hasNext()) throw new IllegalStateException("No writers found"); ImageWriter writer = (ImageWriter) writers.next(); ImageOutputStream ios = ImageIO.createImageOutputStream(os); writer.setOutput(ios); ImageWriteParam param = writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(quality); //associated stream and image metadata and thumbnails to the output writer.write(null, new IIOImage(image, null, null), param); // close all streams is.close(); os.close(); ios.close(); writer.dispose(); } } I have written the code for decompression. Is the code right if I am not considering the quality of image? public static void decompress() throws FileNotFoundException { try { File compressedImageFile = new File("C:\\Users\\user\\Desktop\\encryption\\compressnew.jpg"); File imageFile = new File("C:\\Users\\user\\Desktop\\encryption\\dnew.jpg"); InputStream is = new FileInputStream(compressedImageFile); OutputStream os = new FileOutputStream(imageFile ); BufferedImage image = ImageIO.read(is); // get all image writers for JPG format Iterator&lt;ImageWriter&gt; writers = ImageIO.getImageWriter…
has comment: http://stackoverflow.com/comment/43515746
favorite count: 0
tagged with: image-compression
has comment: http://stackoverflow.com/comment/43517606
score: 0
tagged with: compression
upvote count: 1
has answer: http://stackoverflow.com/a/27544951
downvote count: 1
has comment: http://stackoverflow.com/comment/43516031
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27544951
tagged with: image-processing
has comment: http://stackoverflow.com/comment/43515842
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/43515464

android-espresso
tags question: http://stackoverflow.com/q/27602163
type: Tag
tag name: android-espresso
tags question: http://stackoverflow.com/q/27552931

http://stackoverflow.com/comment/43699530
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27639554
has text: have to search for code based on (Abstract)Document, note DocumentListener is designated to notify about changes out of Editor (to another JComponent or variable), otherwise to use DocumentFilter

http://stackoverflow.com/comment/112786653
comment on: http://stackoverflow.com/a/27555253
type: AnswerComment
type: Comment
has text: Can you give an example? @Christopher Schultz
score: 0

http://stackoverflow.com/comment/43603542
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27589764
score: 0
has text: I would strongly recommend working through an organized Java tutorial.

http://stackoverflow.com/comment/43687083
type: Comment
has text: Or in Java 8 `getInstance` can be defined in `Ninja`.
comment on: http://stackoverflow.com/a/27633389
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43407729
has text: Thanks... Is there a better way to do this with Java than to use JSoup? From what I see now Jsoup is usually based on a full URL. I have not tried using a relative URL from my application, but I hope that works. i.e., my application will be in some folder on my server and ../users/username/data is where the data is.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27478541

http://stackoverflow.com/q/27501806
answer count: 2
has body: When we write data of view result tree listener to CSV/XML , it does not write all data like parameters used in request to CSV. All the details are related to the response.How to get the the request details in the csv so that we can have one to one mapping of request and response and find out which request has failed.
favorite count: 0
upvote count: 9
tagged with: http://stackoverflow.com/tag/csv
tagged with: http://stackoverflow.com/tag/xml
tagged with: jmeter
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27502441
has answer: http://stackoverflow.com/a/27503627
tagged with: java
has title: Jmeter writing the request details to CSV/XML from view result tree listener
type: Question
score: 9

http://stackoverflow.com/comment/43460207
comment on: http://stackoverflow.com/q/27514850
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?](http://stackoverflow.com/questions/5554734/what-causes-a-java-lang-arrayindexoutofboundsexception-and-how-do-i-prevent-it)

http://stackoverflow.com/a/27510200
score: 0
type: Answer
has body: It would be helpful to see the code calling the @Transactional annotated method. Make sure that when calling the method you are using the method stub created by the framework and not the method directly. In other words, assuming this method is written in some EJB, you should be calling the method from an EJB client using the injected EJB instance as opposed to calling the method from within the EJB instance itself.
answers question: http://stackoverflow.com/q/27509751

http://stackoverflow.com/comment/43402415
type: AnswerComment
comment on: http://stackoverflow.com/a/27485248
type: Comment
has text: Thanks a lot. My requirements are pretty loose, I'll be looking at the MDB approach (never worker with one)
score: 0

http://stackoverflow.com/a/27592133
upvote count: 6
has comment: http://stackoverflow.com/comment/43622470
accepted answer of: http://stackoverflow.com/q/27591685
answers question: http://stackoverflow.com/q/27591685
type: AcceptedAnswer
has body: This was a change in 2.6. The MongoDB server now requires that journaling be enabled to use a write concern that has journaling as a requirement. In 2.4 and before the server would silently ignore the journal requirement is journaling was not enabled on the server. You test MongoDB cluster must have journaling disabled. Either enable journaling on the server or remove the default write concern on the client (e.g., remove/change write-concern="JOURNAL_SAFE"). For production, you almost definitely want journaling enabled. If you are using a replica set (or a shared cluster of replica sets) with at least 3 data holding members then a write concern of 'majority' might be a better, more performant, choice. (e.g., write-concern="MAJORITY" ). If you are running a single Mongod process that is not part of a replica-set then you probably want a journal write concern but need to make sure that the journal is not disabled on the server. If you cannot control the server (and are still using a single mongod process) then you might want to switch to the FSYNC write concern. With FSYNC if the server has journaling enabled then it acts as a Journaled write, for a server without journaling enabled it will force all of the data files to disk (which will cause a lot of latency). Having said that you are better off getting journaling enabled on the server. Rob.
score: 6
has comment: http://stackoverflow.com/comment/43616039
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43468352
type: AnswerComment
has text: Nor does it guarantee the order of execution, i.e. the order of submissions is not necessarily the order of execution.
type: Comment
comment on: http://stackoverflow.com/a/27519330
score: 3

http://stackoverflow.com/a/32881537
has body: This works like an if-else-statement but technically you could convert this into an if-else-statement. That would look like this: if (one == two) { "do this" } else { "do that" } if your question is whether or not you could insert an if statement into (one == two) ? "do this" : "do this" ... no, rather you should use nested if statements.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27604724
type: Answer
downvote count: 0

http://stackoverflow.com/a/27583716
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27583655
type: Answer
upvote count: 1
has body: Open 'Windows > Preferences > Java > Installed JREs'. Select the JRE you are using and click 'Edit...'. Enter your default -Xss setting in the 'Default VM arguments' field.
accepted answer of: http://stackoverflow.com/q/27583655

http://stackoverflow.com/comment/43590111
has text: Yes, it just stores the reference -- You should create a copy and save it yourself
comment on: http://stackoverflow.com/q/27582822
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27608228
has answer: http://stackoverflow.com/a/61624335
has title: Hibernate java.lang.ExceptionInInitializerError
type: AnsweredQuestion
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/40672940
upvote count: 3
tagged with: java
tagged with: hibernate
has body: I've been working through the Hibernate Tutorial provided by Netbeans but whenever I tried running the program I end up with a java.lang.ExceptionInInitializerError. Anyone have any ideas about what's wrong? Stack Trace: java.lang.ExceptionInInitializerError at dvdrental.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:29) at dvdrental.FilmHelper.&lt;init&gt;(FilmHelper.java:18) at dvdrental.FilmController.&lt;init&gt;(FilmController.java:34) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at java.lang.Class.newInstance(Class.java:438) at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186) at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:100) at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257) at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117) at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:80) at org.apache.el.parser.AstValue.getValue(AstValue.java:135) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:457) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1850) at javax.faces.render…
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/27608323
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27608323
has answer: http://stackoverflow.com/a/40672940

http://stackoverflow.com/a/27588496
score: 3
has comment: http://stackoverflow.com/comment/46553632
has comment: http://stackoverflow.com/comment/43601425
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27588445
type: AcceptedAnswer
downvote count: 0
has body: GWT 2.7's DevMode defaults to using SuperDevMode (as you can see in your logs), rather than "classic DevMode" with the browser plugin. With SuperDevMode you debug client-side code in your browser using source maps, or in your IDE by remote-debugging your browser (in Eclipse using SDBG for example). To roll back to "classic DevMode", configure your gwt-maven-plugin with false or pass -Dgwt.superDevMode=false to Maven. See http://mojo.codehaus.org/gwt-maven-plugin/debug-mojo.html#superDevMode
answers question: http://stackoverflow.com/q/27588445
type: Answer

http://stackoverflow.com/comment/43585591
comment on: http://stackoverflow.com/q/27577475
has text: I guess, every IDE has a “convert to inner class” refactoring action…
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/27535380
accepted answer: http://stackoverflow.com/a/27535436
answer count: 3
downvote count: 0
tagged with: inheritance
favorite count: 0
has body: I somehow think that doing this is a bad idea. Is it common to do this? I'm unsure of it's usage because I've never seen it in practice, as a real world example anyway. public abstract class Car{ protected int speed; public Car(int speed){ this.speed = speed; } } public class Ambulance extends Car{ public Ambulance(int speed){ super(speed); } }
score: 3
type: AnsweredQuestion
has title: Should you use the superclass constructor to set variables?
tagged with: constructor
has comment: http://stackoverflow.com/comment/43500967
upvote count: 3
has answer: http://stackoverflow.com/a/27535436
possible better answer: http://stackoverflow.com/a/27535451
tagged with: superclass
type: Question
has answer: http://stackoverflow.com/a/27535451
tagged with: java
linked to: http://stackoverflow.com/q/4090834
has answer: http://stackoverflow.com/a/27535446

http://stackoverflow.com/comment/43688357
score: 0
type: Comment
type: QuestionComment
has text: You can't manually force the GC to free up memory programatically in Java; not without some kind of hack. `System.gc()` is nothing more than a *request* to clean up; a request that can be ignored. Look into the documentation of this method. Why do you want to force GC? I feel the actual problems resides somewhere else. Forcing GC is what you find to be the solution to your problem (check out the XY problem); what's your problem and show us the relevant code please. You shouldn't have to force GC; manage your objects better and size your heap accordingly
comment on: http://stackoverflow.com/q/27634308

http://stackoverflow.com/comment/43503973
score: 1
comment on: http://stackoverflow.com/q/27537734
has text: Take a look at `TreeSet` class with custom comparator. Create a custom class with key and value and add its instances to the TreeSet. TreeSet is always sorted hence you can take two elements from the top and they will be the highest. NOTE: TreeSet provide add, remove and contains operations at log(N) time.
type: Comment
type: QuestionComment

appassembler
type: Tag
tags question: http://stackoverflow.com/q/27537676
tag name: appassembler

http://stackoverflow.com/q/27610827
upvote count: 0
has title: Sequences in JAVA
has comment: http://stackoverflow.com/comment/43644177
tagged with: string
has comment: http://stackoverflow.com/comment/43644096
score: -6
tagged with: sequence
favorite count: 0
has answer: http://stackoverflow.com/a/27611377
downvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27611377
possible better answer: http://stackoverflow.com/a/27611285
has body: I've been trying to generate this output : aaa aaa aab aOa baa aaa aab c given this sequence: aaaab aOa baaab c I'm really new to JAVA and I can't form the other sequences, just aaa aaa aab I've been trying for a month so that's why I'm asking here, can someone help me please? Here is my code: public void generateSequence(String text, int n) { text ="aaaab aOa baaab c"; n=3; //i.e String[] words = text.split(" "); StringBuilder newGram = new StringBuilder(); int p1 = 0; int p2 = n; String seq = ""; int seqLength = seq.length(); while (p1 &lt; p2 &amp;&amp; p2 &lt;= seqLength) { newGram = newGram.append(seq.substring(p1, p2) + " "); p1++; p2++; if (p2 == seqLength) { System.out.println("End of 1st element"); //Skip to the next elements in array and form sequences.... } } System.out.println(newGram); }
tagged with: java
has answer: http://stackoverflow.com/a/27611285
type: Question
answer count: 2

http://stackoverflow.com/comment/43427248
type: Comment
comment on: http://stackoverflow.com/q/27498021
type: QuestionComment
score: 0
has text: On StackOverflow, if you are requesting help with a piece of code, you must show that code and indicate exactly what trouble you're having with it (and where, specifically, in the code). If you are unclear about the actual problem statement of your assignment, it would probably be best to talk to your teacher.

http://stackoverflow.com/a/27582517
has comment: http://stackoverflow.com/comment/43607925
answers question: http://stackoverflow.com/q/27582486
downvote count: 0
has comment: http://stackoverflow.com/comment/43589538
type: Answer
has comment: http://stackoverflow.com/comment/76514128
upvote count: 6
has body: Both of your threads are trying to write to System.out. Since writing to PrintStream is synchronized, at every time one of your threads is writing to the stream and another is waiting for the stream to become available. You would be able to see threads executing at the same time if they performed some activity that does not depend on a shared resource (for example, some computation).
score: 6

http://stackoverflow.com/a/27555905
type: Answer
has body: You could use a boolean and only execute the second for loop if it's true... boolean executed = false; for ( /* code here */ ) { executed = true; /* code here */ } if (!executed) { for ( /* code here */ ) { /* code here */ } } However, in your case a better approach would be to work out which of the numbers is smaller: int smaller, bigger; if (num1 &gt; num2) { smaller = num2; bigger = num1; } else { /* may want to do something different if they are equal */ bigger = num2; smaller = num1; } Then you only need a single loop, and you just need to use bigger and smaller with it.
downvote count: 0
has comment: http://stackoverflow.com/comment/43538342
has comment: http://stackoverflow.com/comment/43538009
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27555796
has comment: http://stackoverflow.com/comment/43538189

http://stackoverflow.com/a/27493923
score: 0
has body: You are extending AsyncTask &lt; Void, String, Void > which means you are passing String.. as an argument to doInBackground method and the doInBackground method will return Void. But, in your code doInBackground method is returning String. So, you should change AsyncTask &lt; Void, String, Void > to AsyncTask &lt; Void, String, String >. Also, you are missing @Override above the doInBackground method. Hope it helps! :)
type: Answer
answers question: http://stackoverflow.com/q/27493584

http://stackoverflow.com/comment/43596050
type: AnswerComment
has text: So, should I change the theme? Because I follow a tutorial and I need to use setListAdapter()
comment on: http://stackoverflow.com/a/27585760
type: Comment
score: 0

http://stackoverflow.com/comment/92656425
comment on: http://stackoverflow.com/a/27576660
type: Comment
has text: StephaneNicoll May i ask you why overriding the method after extending CachingConfigurer is not enough to let the system know what instances of CacheManager and KeyGenerator it has to use and instead we need to annotate the methods returning them with @Bean ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43609347
type: Comment
has text: I want to write a code example in my JavaDoc not what you did?
type: AnswerComment
comment on: http://stackoverflow.com/a/27592858
score: 0

http://stackoverflow.com/q/27602152
tagged with: grails
type: Question
has body: In my groovy service class , I have a SQL statement which sometimes returns numbers with concepts for ex: 01 John, 02 Smith. How can I filter only John, Smith and not include numbers. I want to show in my gsp view only John , Smith and not the number tags before them? In the groovy Controller Code I call the function: def wiki = { def currentNode = params.nodePath def conceptName = nodeService.retrieveConceptName (currentNode); render (template:'wiki', model:[conceptName : conceptName]) } In the service class I define the function retrieveConceptName: def retrieveConceptName(currentNode) { groovy.sql.Sql sql = new groovy.sql.Sql(dataSource); def row= sql.firstRow(" SELECT cname FROM Person WHERE FULLNAME= ?",[currentNode]); return row; } .gsp view:(starting lines) &lt;span class="metaDataDialog nodePathTitle"&gt;${conceptName.cname}&lt;/span&gt;
has comment: http://stackoverflow.com/comment/43628322
downvote count: 0
has comment: http://stackoverflow.com/comment/43628401
tagged with: groovy
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27604590
has title: filter out numbers from SQL statement in groovy controller code and display just alplhabetic characyers in gsp view
upvote count: 1
tagged with: gsp
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27604590

http://stackoverflow.com/comment/43584871
has text: But you said you are not checking if the element is in the list prior to adding it, which implies it could already be in the list.
comment on: http://stackoverflow.com/a/27580172
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43502416
comment on: http://stackoverflow.com/a/27530246
type: Comment
score: 0
type: AnswerComment
has text: Yes. This is one nasty problem with `SimpleDateFormat`. Jackson internally has synchronization and/or creates clones of format instances, just for this reason.

http://stackoverflow.com/q/27573582
has title: No response on trying to post data to webservice
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27574690
tagged with: java
type: Question
score: 0
has body: I am trying to post some data to my webservice but when I am testing it out in my device I am not getting error but at the same time nothing really happens, the tablet is responding just fine everything works but my webservice is not getting any data nor does the application show any error. I have added some Toast messages to check the flow of logic and from what I can determine the app goes into the method to send data to the webservice and then just does nothing. This is my code //Method to post data to webservice public void post() throws UnsupportedEncodingException { try { Toast.makeText(getBaseContext(), "Creating new user", Toast.LENGTH_SHORT).show(); HttpURLConnection urlConnection = (HttpURLConnection) (new URL("http://www.rgbpallete.in/led/api/signup").openConnection()); urlConnection.setConnectTimeout(1500); urlConnection.setRequestMethod("POST"); urlConnection.setDoInput(true); urlConnection.setDoOutput(true); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("uname", uname)); params.add(new BasicNameValuePair("pass", password)); params.add(new BasicNameValuePair("email", email)); OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write(getQuery(params)); writer.flush(); writer.close(); os.close(); urlConnection.connect(); if(urlConnection.getResponseCode() == 200){ InputStream inputStream = new BufferedInputStream(urlConnection.getInputStream()); BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); JSONObject json = new JSONObject(responseStrBuilder.toString()); String message = json.getString("message"); boolean error = json.getBoolean("error"); error(error, message); } } catch (Exception e) { e.printStackTr…
tagged with: http-post

reflection
tags question: http://stackoverflow.com/q/27591279
tags question: http://stackoverflow.com/q/27485417
tags question: http://stackoverflow.com/q/27565619
tags question: http://stackoverflow.com/q/27560247
tags question: http://stackoverflow.com/q/27539257
tags question: http://stackoverflow.com/q/27562351
tags question: http://stackoverflow.com/q/27497720
tags question: http://stackoverflow.com/q/27569582
type: Tag
tags question: http://stackoverflow.com/q/27572594
tags question: http://stackoverflow.com/q/27572966
tags question: http://stackoverflow.com/q/27568798
tags question: http://stackoverflow.com/q/27622833
tags question: http://stackoverflow.com/q/27563207
tags question: http://stackoverflow.com/q/27490325
tags question: http://stackoverflow.com/q/27590593
tags question: http://stackoverflow.com/q/27491597
tag name: reflection
tags question: http://stackoverflow.com/q/27636779
tags question: http://stackoverflow.com/q/27602710
tags question: http://stackoverflow.com/q/27591852

http://stackoverflow.com/comment/43445085
score: 1
has text: Your question is still a bit broad. I would follow Kyranstar's recommendations since his advice is sound (1+ to his answer), but most importantly for you is that you should try to break your larger problem, that of shooting bullets, into small constituent small problem steps, and then try to solve each step one at a time, best in isolation of the main program. Then if you get stuck at any one step, you can come back here with a much more specific and answerable question, and thus be able to get much better and more specific help.
comment on: http://stackoverflow.com/q/27496507
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43601695
type: AnswerComment
score: 0
type: Comment
has text: Ok, I will provide also a JPA solution
comment on: http://stackoverflow.com/a/27583603

http://stackoverflow.com/comment/43581182
score: 0
type: AnswerComment
type: Comment
has text: I thought the question made it clear that I was on Cloud9. In any case I removed the tag
comment on: http://stackoverflow.com/a/27577879

http://stackoverflow.com/a/27559865
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/62557247
type: Answer
answers question: http://stackoverflow.com/q/27559449
has comment: http://stackoverflow.com/comment/43555583
score: 4
has body: I have tried just straight Base64 encode, but for some smaller numbers, the encoded string is longer than just storing the number as a string Base64 encoding of binary byte data will make it longer, by about a third. It is not supposed to make it shorter, but to allow safe transport of binary data in formats that are not binary safe. However, base 64 is more compact than decimal representation of a number (or of byte data), even if it is less compact than base 256 (the raw byte data). Encoding your numbers in base 64 directly will make them more compact than decimal. This will do it: private static final String base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; static String encodeNumber(long x) { char[] buf = new char[11]; int p = buf.length; do { buf[--p] = base64Chars.charAt((int)(x % 64)); x /= 64; } while (x != 0); return new String(buf, p, buf.length - p); } static long decodeNumber(String s) { long x = 0; for (char c : s.toCharArray()) { int charValue = base64Chars.indexOf(c); if (charValue == -1) throw new NumberFormatException(s); x *= 64; x += charValue; } return x; } Using this encoding scheme, Long.MAX_VALUE will be the string H__________, which is 11 characters long, compared to its decimal representation 9223372036854775807 which is 19 characters long. Numbers up to about 16 million will fit in a mere 4 characters. That's about as short as you'll get it. (Technically there are two other characters which do not need to be encoded in URLs: . and ~. You can incorporate those to get base 66, which would be a smidgin shorter for some numbers, although that seems a bit pedantic.)

http://stackoverflow.com/q/27502882
type: UnansweredQuestion
upvote count: 1
tagged with: tomcat7
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/43619772
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43449016
tagged with: apache
downvote count: 0
favorite count: 0
has body: Client is requesting to Rest Web service API running with Tomcat server. Rest web service completed the operation trying to send the success message but client not receiving the message. I checked Catalina.out got the stack trace given below. Suggest me something. org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:77) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:154) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:129) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:187) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:166) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostV…
has comment: http://stackoverflow.com/comment/43628767
answer count: 0
has title: org.apache.cxf.interceptor.Fault: Could not send Message
tagged with: cxf

http://stackoverflow.com/comment/43574489
type: QuestionComment
comment on: http://stackoverflow.com/q/27572734
score: 0
has text: @kukis Could you please post the code you used? Did you use columnGenerators?
type: Comment

http://stackoverflow.com/q/27629270
type: Question
has title: Error starting camel subsystem in Wildfly 8.2.0.Final
tagged with: wildfly-8
score: 0
answer count: 1
has body: I get the following exception in my standalone/log/server.log when I use the instructions in (http://blog.eisele.net/2014/12/wildfly-camel-subsystem-for-wildfly-integrates-javaee-getting-started.html) to use the Camel subsystem in Wildfly 8.2.0.Final. The issue seems to be resolved in a later version of Camel (https://issues.apache.org/jira/browse/CAMEL-7992). So I tried changing the org/apache/camel/core module to use camel-core-2.14.1.jar but I still see the same exception. Any pointers on how I can resolve this issue? I am eager to try out the Camel subsystem. 2014-12-23 14:35:09,950 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" =&gt; "wildfly-camel.war")]) - failure description: {"JBAS014671: Failed services" =&gt; {"jboss.deployment.unit.\"wildfly-camel.war\".WeldStartService" =&gt; "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"wildfly-camel.war\".WeldStartService: Failed to start service Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 1 exceptions: Exception 0 : org.jboss.weld.exceptions.IllegalStateException: WELD-000143: Container lifecycle event method invoked outside of extension observer method invocation. at org.jboss.weld.bootstrap.events.ContainerEvent.checkWithinObserverNotification(ContainerEvent.java:61) at org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl.getAnnotatedType(ProcessAnnotatedTypeImpl.java:56) at org.apache.camel.cdi.internal.CamelContextConfig.configure(CamelContextConfig.java:47) at org.apache.camel.cdi.internal.CamelContextBean.configureCamelContext(CamelContextBean.java:131) at org.apache.camel.cdi.internal.CamelExtension.startConsumeBeans(CamelExtension.java:231) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA…
has answer: http://stackoverflow.com/a/27643559
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27643559
tagged with: apache-camel

http://stackoverflow.com/comment/43573269
type: QuestionComment
score: 14
comment on: http://stackoverflow.com/q/27573904
type: Comment
has text: Why did you think `toString` would get rid of the brackets?

http://stackoverflow.com/comment/43593306
score: 2
comment on: http://stackoverflow.com/q/27584378
has text: `div#news_content_wide > p~p`?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27498954
tagged with: swing
has comment: http://stackoverflow.com/comment/43429354
has comment: http://stackoverflow.com/comment/43428887
has title: Getting an unexpected error when trying to load files into a JList
has comment: http://stackoverflow.com/comment/43429050
tagged with: java
has comment: http://stackoverflow.com/comment/43429364
tagged with: file
has body: I'm trying to build a Java-based Network manager for unix-based systems, but I ran into some trouble I cant quite find the source of: Exception in thread "main" java.lang.NullPointerException at net.argvarg.NetworkManual.SelectConfDialog.loadConfList(SelectConfDialog.java:51) at net.argvarg.NetworkManual.SelectConfDialog.&lt;init&gt;(SelectConfDialog.java:20) at net.argvarg.NetworkManual.Main.run(Main.java:16) at net.argvarg.NetworkManual.Main.main(Main.java:7) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Here are the the parts of the file that are giving an error: package net.argvarg.NetworkManual; import javax.swing.*; import java.awt.event.*; import java.io.File; public class SelectConfDialog extends JDialog { private DefaultListModel confList = new DefaultListModel(); private JList confListContainer = new JList(confList); private File[] confs = new File(Main.absolutePathToConfsDir).listFiles(); private void loadConfList() { for (int i = 0; i &lt; confs.length - 1; i++) { confList.addElement(confs[i].getName()); } } } Any help would be greatly appreciated, thank you.
has answer: http://stackoverflow.com/a/27499391
type: Question
linked to: http://stackoverflow.com/q/218384
linked to: http://stackoverflow.com/q/3988788
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/43429021
has comment: http://stackoverflow.com/comment/43428885
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/43524870
has text: You could write public abstract A findByName(String name), so all subclasses have to implement this method.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27543771

http://stackoverflow.com/comment/43967745
score: 0
type: AnswerComment
has text: NOTE: the javascript made use of the _document.getElementById_ to get the hidden field textbox, and the _document.getElementsByName_ to get the repeated components
comment on: http://stackoverflow.com/a/27778845
type: Comment

http://stackoverflow.com/comment/43433165
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27500731
has text: Ok, the startThread returns the process you want to kill. I guess you store this result somewhere. You need to structure your code so you can access this value in the eventListner.

http://stackoverflow.com/q/27628613
has answer: http://stackoverflow.com/a/27628690
tagged with: parameters
possible better answer: http://stackoverflow.com/a/27628690
has answer: http://stackoverflow.com/a/27628831
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27628831
has title: Android AsyncTask params not found
tagged with: nullpointerexception
type: Question
type: AnsweredQuestion
tagged with: android
has body: i am new to android / java but i have advanced knowledge in c# and .Net. I have a problem with the AsyncTask. My Code: import android.os.AsyncTask; public class testtask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String response = ""; // BREAKPOINT HERE return ""; } @Override protected void onPostExecute(String result) { } } And the Call: public void RequestDepartments(View view) { BamakiWebService service = new BamakiWebService(); RequestType request = new RequestType(); request.Uri = "departments/all"; try { testtask task = new testtask(); task.execute("wfwef"); } catch (Exception ex) { Log.e("Main", ex.getMessage()); } } The Code fails because i can not access the urls?! When i debug the doInBackground and add the urls to watch it says "Cannot find local variable 'urls'"?! ( on BreakPoint -> // BREAKPOINT HERE) What i am doing wrong ?! EDIT Changing the Execute to testtask task = new testtask(); String[] params = new String[] {"wfwef"}; task.execute(params); Did not solved the Problem ...
tagged with: android-asynctask
answer count: 2

http://stackoverflow.com/a/27645191
has comment: http://stackoverflow.com/comment/43748347
score: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/27624936
downvote count: 0
answers question: http://stackoverflow.com/q/27624936
has body: Last night i found solution it's very easy to upload file.... First you have manage 'TempFileManager'. It's handle temp file directory so it' create file and delete automatically after your work finish like copy,read,edit,move etc... server.setTempFileManagerFactory(new ExampleManagerFactory()); So now you not have manage temp file it's work automatically... Manage post request like this private Response POST(IHTTPSession) { try { Map&lt;String, String&gt; files = new HashMap&lt;String, String&gt;(); session.parseBody(files); Set&lt;String&gt; keys = files.keySet(); for(String key: keys){ String name = key; String loaction = files.get(key); File tempfile = new File(loaction); Files.copy(tempfile.toPath(), new File("destinamtio_path"+name).toPath(), StandardCopyOption.REPLACE_EXISTING); } } catch (IOException | ResponseException e) { System.out.println("i am error file upload post "); e.printStackTrace(); } return createResponse(Status.OK, NanoHTTPD.MIME_PLAINTEXT, "ok i am "); }
has comment: http://stackoverflow.com/comment/125103137
upvote count: 6
type: AcceptedAnswer

http://stackoverflow.com/q/27506784
has comment: http://stackoverflow.com/comment/43443641
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43443851
tagged with: java
has comment: http://stackoverflow.com/comment/43449546
type: Question
has comment: http://stackoverflow.com/comment/43449686
has comment: http://stackoverflow.com/comment/43443714
has comment: http://stackoverflow.com/comment/43444006
has body: This XML is input <?xml version="1.0" encoding="UTF-8" standalone="no"?> <ns0:EMessage xmlns:ns0="http://www.abc/Something"> <ns0:Header> <ns0:Snumber>1613</ns0:Snumber> </ns0:Header> <ns0:Name>SomeEvent</ns0:Name> <ns0:NameSpace>http://www.abc/Something.xsd</ns0:NameSpace> <ns0:Id>3</ns0:Id> <ns0:myProperty> <ns0:Name>ExtId</ns0:Name> <ns0:Value>TEST_ID_12</ns0:Value> </ns0:myProperty> <ns0:myProperty> <ns0:Name>CVersion</ns0:Name> <ns0:Value>0</ns0:Value> </ns0:myProperty> </ns0:EMessage> Convert to this <?xml version="1.0" encoding="UTF-8" standalone="no"?> <ns0:EMessage xmlns:ns0="http://www.abc/Something"> <ns0:Header> <ns0:Snumber>1613</ns0:Snumber> </ns0:Header> <ns0:Name>SomeEvent</ns0:Name> <ns0:NameSpace>http://www.abc/Something.xsd</ns0:NameSpace> <ns0:Id>3</ns0:Id> TEST_ID_12 0 </ns0:EMessage> Basically what is needed is the parent tag should be removed and the childs should get the immideate child of ROOT. LOGIC part Node root = doc.getElementsByTagName("ns0:EMessage").item(0); NodeList listOfNodes = root.getChildNodes(); int length_Child_nodes=listOfNodes.getLength(); System.out.println("length of child nodes for root element"+length_Child_nodes); for (int i = 0; i < listOfNodes.getLength(); i++) { // Node to be picked in click and this will be the element and will have childs. Node listItem = listOfNodes.item(i); Node Fchild=listItem.getFirstChild(); String value=""; if ("ns0:Name".equals(Fchild.getNodeName())) { Node oldChildNodeName=listItem.getFirstChild(); Node Value=Fchild.getNextSibling(); if("ns0:Value".equals(Fchild.getNextSibling().getNodeName())){ value=Fchild.getNextSibling().getTextContent(); } String localname=listItem.getFirstChild().getTextContent(); Element newChildNode = doc.createElement(localname); // Replace the existing node Property Name. listItem.replaceChild(newChildNode, oldChildNodePrpertyName); // Replace the existing node Property Value listItem.removeChild(Value); //System.out.println("remove child"+node.removeChild(oldChi…
score: 0
has title: Remove Parent Keep Childs- DOM

http://stackoverflow.com/q/27518544
has body: I am new to maven and facing problems while running a class file through maven It runs fine with mvn exec:java -Dexec.mainClass="com.test.Test" But not with mvn exec:exec -Dexec.executable=java -Dexec.mainClass="com.test.Test" It asks for java parameters F:\data\work\Test>mvn exec:exec -Dexec.executable=java -Dexec.mainClass="com.test.Test" Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM -hotspot is a synonym for the "server" VM [deprecated] The default VM is server. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A ; separated list of directories, JAR archives, and ZIP archives to search for class files. I am already providing a class file then why its not able to pick that? I tried providing those even through pom. I am using exec:exec as I dont want to pass VM arguments from MAVEN_OPTS here is my pom fib org.codehaus.mojo exec-maven-plugin 1.3.2 test exec com.test.Test java What am I missing? So 2 questions which arises - 1)What am I missing s that its asking me to pass java parameters despite of passing mainClass? 2)How can I pass VM arguments using exec-maven-plugin? I have found this for my 2nd question using maven 'exec:exec' with arguments
type: Question
accepted answer: http://stackoverflow.com/a/27519890
has comment: http://stackoverflow.com/comment/43467711
has comment: http://stackoverflow.com/comment/43466982
has comment: http://stackoverflow.com/comment/43467830
has comment: http://stackoverflow.com/comment/43467837
has comment: http://stackoverflow.com/comment/43468545
has comment: http://stackoverflow.com/comment/43468094
has comment: http://stackoverflow.com/comment/43467792
has comment: http://stackoverflow.com/comment/43467069
has comment: http://stackoverflow.com/comment/43467028
linked to: http://stackoverflow.com/q/15013651
has comment: http://stackoverflow.com/comment/43468216
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43468605
favorite count: 0
has comment: http://stackoverflow.com/comment/43466941
has title: Running a class file through "mvn exec:exec"
has answer: http://stackoverflow.com/a/27519890
has comment: http://stackoverflow.com/comment/43467083
has comment: http://stackoverflow.com/comment/43467424
tagged with: maven
has comment: http://stackoverflow.com/comment/43467388
tagged with: exec-maven-plugin
has comment: http://stackoverflow.com/comment/43467772
has comment: http://stackoverflow.com/comment/43468417
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43468258
has comment: http://stackoverflow.com/comment/43467099
tagged with: java
score: 7
upvote count: 7
linked to: http://stackoverflow.com/q/16222748

http://stackoverflow.com/q/27550936
answer count: 3
type: UnansweredQuestion
tagged with: sockets
tagged with: client
has answer: http://stackoverflow.com/a/27551186
tagged with: multithreading
type: Question
has body: So this is my first post here, I am currently trying to make a Java client/server chat application using socket programming. I currently have the server waiting for a client to connect and then passing the client's messages back to the client. So far I have tried different methods to make the server continuously listen to new clients and connect them allowing them to post and view messages with each other. Can you point me in the right direction and how I should implement this? SERVER class TCPServer { private ServerSocket serverSocket; private int port; String newLine = System.getProperty("line.separator"); public TCPServer(int port) { this.port = port; } public void begin() throws IOException { System.out.println("Starting the server at port: " + port); serverSocket = new ServerSocket(port); System.out.println("Waiting for clients... " + newLine); try { Socket connectionSocket = serverSocket.accept(); DataOutputStream hello = new DataOutputStream(connectionSocket.getOutputStream()); hello.writeUTF("You have successfully connected!" + newLine + "please type your username"); //A client has connected to this server. Get client's username String username = getUserName(connectionSocket); System.out.println(username + " has connected" + newLine); //Start chat method startChat(connectionSocket, username); } catch (Exception e) { } } public String getUserName(Socket connectionSocket) throws IOException { String clientUserName; // ArrayList clients = new ArrayList(); BufferedReader userNameClient = new BufferedReader(new InputStreamReader( connectionSocket.getInputStream())); clientUserName = userNameClient.readLine(); //clients.add(clientUserName); DataOutputStream greetingFromServer = new DataOutputStream(connectionSocket.getOutputStream()); //writeUTF Caused incorrect key codes to appear at beginning of String greetingFromServer.writeBytes("Welcome " + clientUserName + ", please type your message" + newLine); return clientUserName; } public void startChat(Socket connect…
tagged with: server
has answer: http://stackoverflow.com/a/27551263
tagged with: java
has title: Multi-Threading Server/Client Chat
score: 0
has answer: http://stackoverflow.com/a/27551179

http://stackoverflow.com/a/27499726
has body: 1.) Parse Json String to create JSONObject. 2.) Iterate over JsonObject to create Map. you might get here what you want
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27499650
answers question: http://stackoverflow.com/q/27499650
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27622846
has comment: http://stackoverflow.com/comment/43666436
has comment: http://stackoverflow.com/comment/43689915
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27622582
has body: Your UI thread is blocked on this line: geocoder.getFromLocation You should perform it on a different thread(consider execute it using handler).

http://stackoverflow.com/q/27544245
score: -2
tagged with: bluetooth
downvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27544476
type: UnansweredQuestion
tagged with: android
has title: Async Task Issue Android
upvote count: 0
tagged with: java
type: Question
has body: Async task implementation gives following exceptions in a bluetooth based android application. Code for Async Task package com.example.vedangbluetoothlock; import java.util.Arrays; import android.os.AsyncTask; public class readRegAsyncTask extends AsyncTask &lt;readRegHolding,Void,readRegHolding&gt; { @Override protected readRegHolding doInBackground(readRegHolding...params) { // TODO Auto-generated method stub int uid = params[0].uid; int num_of_reg = params[0].num_of_reg; int start_address = params[0].start_address; blueconnect.readHoldingReg(uid, params[0].data, start_address, num_of_reg); while(!blueconnect.macThread); //params[0].data = Arrays.copyOf(blueconnect.res, num_of_reg); return params[0]; } @Override protected void onPostExecute(readRegHolding result) { // TODO Auto-generated method stub // super.onPostExecute(result); for (int i = 0; i&lt;result.num_of_reg;i++) { result.data[i] = blueconnect.res.getRegisterValue(i); } } } EXCEPTION 12-18 15:41:18.634: E/ActivityThread(23724): Activity com.example.vedangbluetoothlock.Bluetooth has leaked IntentReceiver com.example.vedangbluetoothlock.Bluetooth$1@42649300 that was originally registered here. Are you missing a call to unregisterReceiver()? 12-18 15:41:18.634: E/ActivityThread(23724): android.app.IntentReceiverLeaked: Activity com.example.vedangbluetoothlock.Bluetooth has leaked IntentReceiver com.example.vedangbluetoothlock.Bluetooth$1@42649300 that was originally registered here. Are you missing a call to unregisterReceiver()? 12-18 15:41:18.634: E/ActivityThread(23724): at android.app.LoadedApk$ReceiverDispatcher.&lt;init&gt;(LoadedApk.java:803) 12-18 15:41:18.634: E/ActivityThread(23724): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:604) 12-18 15:41:18.634: E/ActivityThread(23724): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1494) 12-18 15:41:18.634: E/ActivityThread(23724): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1474) 12-18 15:41:18.634:…

http://stackoverflow.com/q/27560469
score: 3
tagged with: hibernate
has answer: http://stackoverflow.com/a/27564098
accepted answer: http://stackoverflow.com/a/27564098
linked to: http://stackoverflow.com/q/27411156
answer count: 1
tagged with: jpa
downvote count: 0
has title: Defining relationship attributes in JPA
favorite count: 0
tagged with: spring-data-jpa
type: AnsweredQuestion
upvote count: 3
tagged with: java
has body: I have a OneToMany relation defined as follows class ActionSet { @OneToMany List&lt;Action&gt; action; } class Action { ActionSet actionSet; Boolean isShared; } Action can either be shared across many action sets or be associated with a single actionSet. When an action is shared, it can be important for some action sets but not others. Here isImportant is a relationship property. How can I define that relationship in JPA ?
type: Question

http://stackoverflow.com/a/27614080
type: Answer
answers question: http://stackoverflow.com/q/27613849
has comment: http://stackoverflow.com/comment/43681479
accepted answer of: http://stackoverflow.com/q/27613849
has comment: http://stackoverflow.com/comment/43681495
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43663773
has comment: http://stackoverflow.com/comment/43668061
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43681902
has body: You shouldn't be using a StringBuffer (StringBuilder has been preferred since Java 1.5). Also, your Pattern isn't being reused; so compiling it seems pointless. Finally, if you just want to test if your node matches a certain number of "tests" in your loop I suggest you use something like String str = node.getNodeValue(); test = (test != null) ? test.toLowerCase() : null; str = (str != null) ? str.toLowerCase() : ""; if (str.contains(test)) { i++; }

jtextfield
tags question: http://stackoverflow.com/q/27560703
tags question: http://stackoverflow.com/q/27495312
tags question: http://stackoverflow.com/q/27590763
tags question: http://stackoverflow.com/q/27490371
tags question: http://stackoverflow.com/q/27604470
tags question: http://stackoverflow.com/q/27582212
tags question: http://stackoverflow.com/q/27610396
tags question: http://stackoverflow.com/q/27496079
tags question: http://stackoverflow.com/q/27476555
tags question: http://stackoverflow.com/q/27537899
tag name: jtextfield
type: Tag
tags question: http://stackoverflow.com/q/27571673

http://stackoverflow.com/q/27629373
tagged with: spring-security
tagged with: spring-security-oauth2
has title: Spring-Oauth2 Access Token request never succeeds due to missing CSRF 'preserved state'
has comment: http://stackoverflow.com/comment/43679592
has comment: http://stackoverflow.com/comment/69658195
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/27638027
upvote count: 8
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/52208160
tagged with: java
has body: I've been working the last couple days to get an implementation of spring boot / spring security / and java configuration working with spring-security-oauth2. I've managed to work through most of the difficulties, but am stumped as to what is going wrong now. I am completing the following steps successfully: sending user to the provider to authorize the application to act on their behalf user is prompted to sign in to provider per security user authorizes the app, and the redirect url sends them back to the client app at the original url along with ?code=asdfa&amp;state=asdfasfin the query string At this point, I believe whatever is using the AuthorizationCodeResourceDetails should be exchanging the authorization code and client app credentials for an access token. This is where the process is failing with the following stack trace. Caused by: org.springframework.security.oauth2.common.exceptions.InvalidRequestException: Possible CSRF detected - state parameter was present but no state could be found at org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider.getParametersForTokenRequest(AuthorizationCodeAccessTokenProvider.java:246) at org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeAccessTokenProvider.obtainAccessToken(AuthorizationCodeAccessTokenProvider.java:198) at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainNewAccessTokenInternal(AccessTokenProviderChain.java:142) at org.springframework.security.oauth2.client.token.AccessTokenProviderChain.obtainAccessToken(AccessTokenProviderChain.java:118) at org.springframework.security.oauth2.client.OAuth2RestTemplate.acquireAccessToken(OAuth2RestTemplate.java:221) at org.springframework.security.oauth2.client.OAuth2RestTemplate.getAccessToken(OAuth2RestTemplate.java:173) at org.springframework.security.oauth2.client.OAuth2RestTemplate.createRequest(OAuth2RestTemplate.java:105) at org.springframework.web.client.RestTemp…
accepted answer: http://stackoverflow.com/a/27638027
type: Question
answer count: 1

http://stackoverflow.com/q/27635610
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43741283
has comment: http://stackoverflow.com/comment/43690398
has comment: http://stackoverflow.com/comment/43691923
has comment: http://stackoverflow.com/comment/43690448
has comment: http://stackoverflow.com/comment/43690387
has comment: http://stackoverflow.com/comment/43690477
favorite count: 0
has comment: http://stackoverflow.com/comment/43702549
has comment: http://stackoverflow.com/comment/43690653
type: Question
linked to: http://stackoverflow.com/q/5501109
has comment: http://stackoverflow.com/comment/43690370
has comment: http://stackoverflow.com/comment/43690487
has body: Why a thread in java cannot be started once it completes its execution? Is it related to any design pattern?
duplicate of: http://stackoverflow.com/q/5501109
score: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43691634
upvote count: 1
downvote count: 1
has title: Why a thread cannot be started twice? Is it related to any design pattern?
linked to: http://stackoverflow.com/q/2663426
has comment: http://stackoverflow.com/comment/43690422

http://stackoverflow.com/q/27518681
type: AnsweredQuestion
has body: Quick Android question... What happens when you create a new AsyncTask that replaces an existing one? For example you have a simple activity: public class ExampleActivity extends Activity{ private MyTask myTask; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // first instance myTask = new MyTask(); myTask.execute(); // immediately replace first instance // assume the first instance hasn't finished yet myTask = new MyTask(); myTask.execute(); } } What happens to the first instance? does it run to completion? Is it garbage collected?
accepted answer: http://stackoverflow.com/a/27518697
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27518721
possible better answer: http://stackoverflow.com/a/27518720
has answer: http://stackoverflow.com/a/27518720
downvote count: 0
has answer: http://stackoverflow.com/a/27519124
has answer: http://stackoverflow.com/a/27518842
tagged with: android
answer count: 7
has answer: http://stackoverflow.com/a/27518743
favorite count: 0
tagged with: android-asynctask
has title: What happens when replacing AsyncTask with new Asynctask
has answer: http://stackoverflow.com/a/27518697
has answer: http://stackoverflow.com/a/27518740
upvote count: 1

http://stackoverflow.com/q/27527265
duplicate of: http://stackoverflow.com/q/4185340
downvote count: 3
answer count: 1
linked to: http://stackoverflow.com/q/65035
has comment: http://stackoverflow.com/comment/43483310
favorite count: 0
duplicate of: http://stackoverflow.com/q/65035
has comment: http://stackoverflow.com/comment/43483380
has comment: http://stackoverflow.com/comment/43487224
has comment: http://stackoverflow.com/comment/43483102
type: AnsweredQuestion
has body: I was wondering why the following code would be accepted by the Java compiler: public class Main { public static void main(String ... args){ System.out.println("a() = " + a()); } public static String a (){ try { return "a"; }catch(Throwable t){ }finally{ return "b"; } } } This can and should not work. The java specification states the finally block will always be executed, but at the same time the return value has already been specified. So either you cannot execute the return "b" statement, because you have exited at return "a", which would be incorrect. However, the other option is that you execute the return "b" statement, and thereby totally disregarding the return "a" statement... I would say that both are wrong, and I would expect that this does not compile. However it compiles and runs fine. I will leave the answer as a nice exercise to the reader ;). Basically my question is: Besides being bad practice, would this be considered a Java bug, or does this have other wonderful uses other than obfuscation? Edit: The question is not so much if it is a bug, that has been answered, but does it have nice use cases?
tagged with: java
has comment: http://stackoverflow.com/comment/43483200
score: 29
has comment: http://stackoverflow.com/comment/43483400
type: Question
has comment: http://stackoverflow.com/comment/43483243
has title: try{} finally{} construct with return values
has comment: http://stackoverflow.com/comment/43483334
has comment: http://stackoverflow.com/comment/43483345
has comment: http://stackoverflow.com/comment/43483473
upvote count: 32
linked to: http://stackoverflow.com/q/4185340
has answer: http://stackoverflow.com/a/27527376
accepted answer: http://stackoverflow.com/a/27527376
has comment: http://stackoverflow.com/comment/43483176
has comment: http://stackoverflow.com/comment/43483170
has comment: http://stackoverflow.com/comment/43483219
linked to: http://stackoverflow.com/q/19899155

http://stackoverflow.com/q/27549974
type: UnansweredQuestion
tagged with: classcastexception
has comment: http://stackoverflow.com/comment/43526380
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43548590
has comment: http://stackoverflow.com/comment/43547710
has comment: http://stackoverflow.com/comment/43526484
type: Question
has comment: http://stackoverflow.com/comment/43526492
tagged with: sql-timestamp
has body: I am having a problem with a Java 1.4 app. I am executing a JDBC Qyery-which is 2 date fields in an Oracle database (both the 2 fields I am reading is of type DATE with NULLABLE = false) SELECT effFrom, effTo FROM myTable WHERE .... And is exceuted with a JDBCConnection Object[][] result = JDBCConnection.getSqlObjectArray(query, bindVals); I get the data back in my result and loop through it for (int i = 0; i &lt; result.length; i++) { java.sql.Timestamp effFrom = (java.sql.Timestamp ) result[i][0]; java.sql.Timestamp effTo = (java.sql.Timestamp ) result[i][1]; but it fails converting the object to a java.sql.Timestamp with the error ClassCastException: Cannot cast java.sql.Date (id=9010) to java.sql.Timestamp (java.sql.Timestamp ) result[i][0] So I changed the convertion to java.sql.Date effFrom = (java.sql.Date) result[i][0]; And it is working. All perfect. But the thing is that my code did not change and the data did not change for the last 6 months atleast. It did work with the Timestamp conversion up to yesterday and today it is not working with the timestamp but with the Date. I then went back to the source code repo and seen that it was originally java.sql.Date about 2 years ago and now I basically rolled it back. So clearly there is something that I am missing here. Is there a way that the JDBC query could mis interpret the data type? As per Rudi's question what is inside JDBCConnection.getSqlObjectArray() It has a JdbcDaoSupport class called dao public static Object[][] getSqlObjectArray(String sql, String bind1, String bind2, String bind3) { Object[][] a = dao.getSqlObjectArrayImpl(sql, bind1, bind2, bind3); return a; }
tagged with: date
score: 0
has title: ClassCastException: Cannot cast java.sql.Date (id=9010) to java.sql.Timestamp
has comment: http://stackoverflow.com/comment/43527231
has comment: http://stackoverflow.com/comment/43527738
tagged with: sqldatetime

http://stackoverflow.com/comment/43640303
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27608010
has text: Not so good. First "+" lost... sample[0] sample = 0123456789; result = 0123456789 sample[1] sample = +380+380+380+; result = 380380380 sample[2] sample = dd0 11 22 33 44 55; result = 01122334455 sample[3] sample = +380-456(789); result = 380456789 sample[4] sample = d3+580 456 789; result = 3580456789 sample[5] sample = +380456789; result = 380456789
type: AnswerComment

http://stackoverflow.com/a/27781761
score: 3
answers question: http://stackoverflow.com/q/27606778
has comment: http://stackoverflow.com/comment/43999256
accepted answer of: http://stackoverflow.com/q/27606778
has body: I'm not sure I understand what you try to achieve, but here is an example how you can access your annotations with the Java reflection api: package test; import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.AnnotatedType; import java.lang.reflect.Method; public class TypeParameterTest { @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) @Retention(RetentionPolicy.RUNTIME) public @interface ExpectedType { public Class&lt;?&gt; value(); } public static interface IObjectA {} public static class ObjectA_DTO implements IObjectA {} public static class ObjectA_Entity implements IObjectA {} public static class SomeServiceImpl { public @ExpectedType(ObjectA_DTO.class) IObjectA doSomething(@ExpectedType(ObjectA_Entity.class) IObjectA obj) { return (ObjectA_Entity) obj; } } public static void main(String[] args) throws NoSuchMethodException, SecurityException { Method m = SomeServiceImpl.class.getMethod("doSomething", IObjectA.class); AnnotatedType returnType = m.getAnnotatedReturnType(); Annotation returnTypeAnnotation = returnType.getAnnotation(ExpectedType.class); System.out.println(returnTypeAnnotation); AnnotatedType[] parameters = m.getAnnotatedParameterTypes(); for (AnnotatedType p : parameters) { Annotation parameterAnnotation = p.getAnnotation(ExpectedType.class); System.out.println(parameterAnnotation); } } } The output looks like this: @test.TypeParameterTest$ExpectedType(value=class test.TypeParameterTest$ObjectA_DTO) @test.TypeParameterTest$ExpectedType(value=class test.TypeParameterTest$ObjectA_Entity) Note though, that not all possible type annotations are accessible through the reflection api, but you can always read them from the byte code if necessary (see my answer here).
has comment: http://stackoverflow.com/comment/43975757
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/43999962
type: Answer
has comment: http://stackoverflow.com/comment/43975125
upvote count: 4

http://stackoverflow.com/comment/43511517
score: 0
has text: The error is in the line right after defining the addGeofence function. mGeofenceRequester = new GeofenceRequester(this);
comment on: http://stackoverflow.com/q/27542103
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27497074
score: 2
has comment: http://stackoverflow.com/comment/43427301
upvote count: 2
has comment: http://stackoverflow.com/comment/43426805
has comment: http://stackoverflow.com/comment/43427095
has body: Need to Modify your comparator method. public int compareTo(placeDisplay placeDisplay){ if (places &gt; placeDisplay.places) return 1; else if (places == placeDisplay.places) return 0; else return -1; }
has comment: http://stackoverflow.com/comment/43426421
has comment: http://stackoverflow.com/comment/43426517
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27497005
type: Answer
answers question: http://stackoverflow.com/q/27497005

http://stackoverflow.com/a/27554305
has comment: http://stackoverflow.com/comment/43534970
score: 0
accepted answer of: http://stackoverflow.com/q/27553704
type: AcceptedAnswer
has body: For speed improvements, a LinkedList would be faster, also using the same StringBuffer and StringBuffer#setCharAt(int, char). Something like this maybe: List&lt;String&gt; permutations = new ArrayList&lt;String&gt;(initial size); // initial size to avoid multiple arrays to be created if (s.length() == 1) { permutations.add(s); } else { StringBuffer sb = new StringBuffer(s); loop { // some kind of loop sb.setCharAt(0, 'a'); // do the next permutation permutations.add(sb.toString()); } } return permutations;
answers question: http://stackoverflow.com/q/27553704
has comment: http://stackoverflow.com/comment/43535088
type: Answer

report
tags question: http://stackoverflow.com/q/27498506
type: Tag
tag name: report
tags question: http://stackoverflow.com/q/27479404

http://stackoverflow.com/q/27639554
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43699530
tagged with: jcombobox
has answer: http://stackoverflow.com/a/27640139
score: 1
has answer: http://stackoverflow.com/a/27639835
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43698338
type: Question
has body: I have an editable combo box with a key listener. I want to write some text in it and with every letter, it has to make a string with the text I have inserted (or deleted). But when I want to get the string I get a NullPointerException. combobox.getEditor().getEditorComponent() .addKeyListener(new KeyListener() { String value=""; @Override public void keyTyped(KeyEvent e) { value = combobox.getSelectedItem().toString(); System.out.println(value); } @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { } }); Stack trace: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at auftrag_paket.Neuer_Auftrag_ohneMwSt$25.keyTyped(Neuer_Auftrag_ohneMwSt.java:2037) at java.awt.Component.processKeyEvent(Unknown Source) at javax.swing.JComponent.processKeyEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(U…
tagged with: keylistener
answer count: 2
downvote count: 0
has title: NullPointerException when calling getSelectedItem() on an editable JComboBox

http://stackoverflow.com/comment/43605895
type: Comment
has text: Do you see how it applies to _The only issue is that producer goes on to produce messages until the maximum at once (until size is 10 for the list), and consumer consumes all 10 at once._?
comment on: http://stackoverflow.com/q/27591043
score: 0
type: QuestionComment

http://stackoverflow.com/a/27490481
upvote count: 1
type: Answer
has body: Here are a couple of things to consider: Do you have a valid JDK installed? You can check C:\Program Files\Java or C:\Program Files(x86)\Java\ for a jdk folder. In eclipse, right click the Java Project, &gt; Build Path &gt; Configure Build Path... This should open up a Java Build Path window. In here, click the Libraries tab. If there are now JRE System Library entries, click Add Library... &gt; JRE System Library &gt; Next and you can either pick Workspace default JRE which should be something like jre1.8.0_25 or, you can select Execution environment. If you select the latter, click the Environments... button, and select the JavaSE-* version that you would like.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27489736
accepted answer of: http://stackoverflow.com/q/27489736
type: AcceptedAnswer

http://stackoverflow.com/comment/43486164
type: Comment
comment on: http://stackoverflow.com/q/27528455
type: QuestionComment
has text: how you have defined entityManager is it in xml or anotation, share that code also
score: 0

http://stackoverflow.com/comment/43463636
type: QuestionComment
has text: I could poll it, but how would I know they are finished? Can I "spy" the threads generated after mine?
comment on: http://stackoverflow.com/q/27516719
score: 0
type: Comment

http://stackoverflow.com/a/27620462
score: 0
has comment: http://stackoverflow.com/comment/43683373
type: Answer
has body: Problem in your configuration file check below and match: < <forward name="success" path="/success.jsp"/> change accordingly. i recommend that you should switch to struts2 as struts1 is EOL.
answers question: http://stackoverflow.com/q/27619414

http://stackoverflow.com/a/27582979
upvote count: 1
has body: It will work if you change to this: for (node&lt;Integer&gt; helper = temp; helper != null &amp;&amp; helper.next != null; helper = helper.next) { //start at helper.next so that temp doesn't delete it's self if( temp.data == helper.next.data &amp;&amp; helper.next.next != null ) { helper.next = helper.next.next; } //can't seem to figure out how to delete the tail if( temp.data == helper.next.data &amp;&amp; helper.next.next == null ) { helper.next = null; } } That is, in the loop condition instead of: helper.next != null You need one more condition: helper != null &amp;&amp; helper.next != null This is because after you set helper.next = null;, the loop moves forward and executes helper = helper.next, and then in the next iteration the loop condition helper.next != null throws a NullPointerException because helper is null.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27582841
answers question: http://stackoverflow.com/q/27582841

http://stackoverflow.com/a/27599045
type: Answer
has comment: http://stackoverflow.com/comment/43663391
score: 1
has comment: http://stackoverflow.com/comment/43681295
upvote count: 1
has comment: http://stackoverflow.com/comment/43684514
has body: You need to make two changes to get the top bitmap to erase. First, make it a mutable Bitmap so that you can change the contents as it is erased: Bitmap temp = BitmapFactory.decodeResource(getResources(), R.drawable.aa); bm1 = temp.copy(Bitmap.Config.ARGB_8888, true); // mutable = true Be careful about out of memory errors here. Secondly, in your onDraw function, update the bitmap contents by writing back to bm1: @Override protected void onDraw(Canvas canvas) { // draw a circle that is erasing bitmap super.onDraw(canvas); canvas.drawBitmap(bm2, 0, 0, null); pcanvas.drawBitmap(bm1, 0, 0, null); pcanvas.drawCircle(x, y, 40, mPaint); canvas.drawBitmap(bmOverlay, 0, 0, null); // erase the top bitmap: Canvas bitmapCanvas = new Canvas(bm1); bitmapCanvas.drawBitmap(bm2, 0, 0, null); bitmapCanvas.drawBitmap(bmOverlay, 0, 0, null); } Also, to stop a circle being erased in the top left corner when you start the app, create a boolean with a default value of false and set it inside onTouchEvent when you have valid co-ordinates, and check it before calling drawCircle.
accepted answer of: http://stackoverflow.com/q/27597878
has comment: http://stackoverflow.com/comment/43684644
has comment: http://stackoverflow.com/comment/43684647
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27597878
has comment: http://stackoverflow.com/comment/43684136

http://stackoverflow.com/comment/43688655
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27634572
has text: Take a look http://stackoverflow.com/questions/389741/continue-keyword-in-java

http://stackoverflow.com/comment/43756912
type: Comment
comment on: http://stackoverflow.com/a/27627409
score: 1
type: AnswerComment
has text: As far as I know Google App Engine requires that your code is compiled with Java 7. You need to change the JDK to 7 instead of 8. Optionally set the flag on JDK 8 to compile as 7. More info: http://stackoverflow.com/questions/16143684/can-java-8-code-be-compiled-to-run-on-java-7-jvm

http://stackoverflow.com/comment/43467805
comment on: http://stackoverflow.com/q/27518866
score: 0
type: QuestionComment
type: Comment
has text: C:\Users\jaina_000\Desktop\learn_java>javac p2/Testp2.java .\p2\Protection2.java:5: error: cannot find symbol Protection p = new Protection(); ^ symbol: class Protection location: class Protection2 .\p2\Protection2.java:5: error: cannot find symbol Protection p = new Protection(); ^ This is the stacktrace @GPRathour, when I try to compile using Protection p = new Protection();

http://stackoverflow.com/q/27627716
tagged with: java
type: Question
tagged with: arrays
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/27627766
answer count: 1
downvote count: 1
favorite count: 0
has body: Question: "A student wants an algorithm to find the hardest spelling word in a list of vocabulary. They define hardest by the longest word. Write the code to find the longest word stored in an array of Strings called list. If several words have the same length it should print the first word in list with the longest length. For example, if the following list were declared: String list [] = {"high", "every", "nearing", "checking", "food ", "stand", "value", "best", "energy", "add", "grand", "notation", "abducted", "food ", "stand"}; It would print: checking " My solution: import java.util.Scanner; import java.lang.Math; class Lesson_29_Activity_One { public static String [] list={}; { String list [] = {"high", "every", "nearing", "checking", "food ", "stand", "value", "best", "energy", "add", "grand", "notation", "abducted", "food ", "stand"}; } public static void main(String[] args) { Scanner console = new Scanner (System.in); int longestInt= list[0].length(); String longest= list[0]; for (int x=0; x&lt; list.length; x++) { if (list[x].length() &gt; longestInt) { longestInt = list[x].length(); longest = list[x]; } } System.out.println (longest); } } Problem with my solution: I receive java.lang.ArrayIndexOutOfBoundsException: 0 when I run the program. But when I put the string array under public static void main(String[] args), the entire program works as it should. Unfortunately, the website requires me to input the string array into "public static String [] list={};". I tried removing all my calculations and printing just a random word from the string array. But I get the same result, java.lang.ArrayIndexOutOfBoundsException: # (# is the random position in the string array that I tried to print out). Am I suppose to put some kind of return for public static String [] list={}?
type: UnansweredQuestion
has title: how to use/return "public static String [] list={};" (program from amplify unit 3 lesson 29)

http://stackoverflow.com/q/27500398
has comment: http://stackoverflow.com/comment/43433163
favorite count: 0
has title: Debugging Java in eclipse error
linked to: http://stackoverflow.com/q/2225737
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/55720549
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am trying to debug my simple program in Eclipse. When I run it, the program runs as expected. But when I try to debug it, the program output is as expected but there is an error ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [util.c:838] I would like to use the advantage of debugging mode. I want to know how to tweak this error.
has comment: http://stackoverflow.com/comment/43431748
tagged with: eclipse
has answer: http://stackoverflow.com/a/27500890
answer count: 2
possible better answer: http://stackoverflow.com/a/31026196
has answer: http://stackoverflow.com/a/31026196
downvote count: 0
accepted answer: http://stackoverflow.com/a/27500890

http://stackoverflow.com/comment/43447223
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27508345
has text: Since you are already receiving the number of decimal digits as a number then the answer Aestel gave is more appropriate.
type: AnswerComment

http://stackoverflow.com/q/27478541
answer count: 0
tagged with: java
downvote count: 1
type: Question
tagged with: jsoup
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/43395039
has title: How to get the names of files in a folder on your server, and put them into an html list
score: 0
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has body: I have tried looking a few times on Google and didn't really find any answer, so I'm hoping I can get some help here. I am trying to get the contents of a user's folder and display it within an html list. So for example if I have some folder on my server named "Names" and within this folder were 5 different names. I want to take those names, and display them in a list. I originally was accomplishing this task by using http://jsoup.org/ I would go to the folder based on the username they logged in with, grab the data, and display it in a list using JSTL. &lt;c:forEach items="${url.PNV}" var="l" varStatus="stat4"&gt; &lt;li&gt; &lt;a href="#"&gt;${l}&lt;/a&gt; &lt;/li&gt; &lt;/c:forEach&gt; UrlReader.java public class URLReader implements Serializable { private List&lt;String&gt; list = new ArrayList&lt;String&gt;(); private String url = ""; public URLReader() throws IOException { Document doc = Jsoup.connect(url).get(); Elements links = doc.select("a[href]"); for (Element link : links) { if (link.text().contains(".txt")) { list.add(link.text()); } } } } However I have changed my approach and am not using java on my server currently, so I wanted to know if there was another way to do this using JS, Jquery or w/e. If there isn't an easier way, or no other known way, then I will just do with what I have. Thank you all!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43407729

http://stackoverflow.com/q/27567498
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27569062
has comment: http://stackoverflow.com/comment/43562550
has body: I have a few thousand strings that look something like this Foo-Bar-Herp Foo-Bar-Derp Baz-Blurb Something else I'm want to provide a search that works so that "foo bar" (tokenized prefix) "foo herp" (skips a token) "foo-bar-" (exact prefix) "Bar-Herp" (exact string in the middle) "foo ba" (one whole token and prefix of another token) etc. All return the first string (and possibly others), but "herp foo" (wrong order, not critical) "foo blerp" (not all tokens) "murp herp" (not all tokens) do not. I.e. both exact prefix match and token (potentially prefix) matches in the right order should match, independent of case, but all tokens in the query must be in the document. I've set up the typical Lucene example using a StandardAnalyzer and a common QueryParser with a prefix query. I figure I might need a BinaryQuery to state that I need all tokens in the query to be in the documents but I can't quite figure to get at the tokens to build it (The query is user-supplied). I also realize that using a StringField instead of a TextField gives me the exact string matches as opposed to the token-wise matches, but I'm not sure if that's something I can combine with the above? How should I go about this? I don't even have to use Lucene to do it, but it looked like a good fit.
tagged with: lucene
score: 0
answer count: 1
has title: Lucene: Prefix token-wise match OR prefix of exact match
has comment: http://stackoverflow.com/comment/43561487

http://stackoverflow.com/a/27536084
has comment: http://stackoverflow.com/comment/43507442
answers question: http://stackoverflow.com/q/27529244
downvote count: 0
has body: Interesting situation, but I fail too see how an extra cache (of any kind) would help solve the problem. Ultimately your problem boils down to one of coordination between servers and a cache has little to add there. Instead I would either use a queue shared between the four servers where only one request for a resource is allowed on at a time. Another possibility is a shared Map where each server will lock a resource name while retrieving it. Other servers can then wait on this lock and once it is released try to retrieve the resource from MongoDB. I haven't tried using it, but a combination of redis and redisson looks like a good fit for such a task.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/51706079
has comment: http://stackoverflow.com/comment/100072513
answers question: http://stackoverflow.com/q/27582757
score: 0
has body: I agree, but we've something like this in my Spring Application,:- RequestValidationException/MessageConstants are custom one's: import org.springframework.dao.DuplicateKeyException; | | | catch (Exception exception) { if(exception instanceof DuplicateKeyException) { logger.error("exception as duplicate Name Found: " + exception.getMessage()); throw new RequestValidationException(MessageConstants.DUPLICATE_NAME_FOUND_ERROR_CD, MessageConstants.DUPLICATE_NAME_FOUND_ERROR_MSG); }else{ logger.error("exception on update: " + exception.getMessage()); throw exception; } }
has comment: http://stackoverflow.com/comment/100078305
type: Answer

http://stackoverflow.com/q/27513023
has title: Passing arguments to java function in bulk
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43493278
possible better answer: http://stackoverflow.com/a/27513144
tagged with: java
has comment: http://stackoverflow.com/comment/43456561
has answer: http://stackoverflow.com/a/27513325
has answer: http://stackoverflow.com/a/27513442
accepted answer: http://stackoverflow.com/a/27513442
has comment: http://stackoverflow.com/comment/43456960
tagged with: function
has answer: http://stackoverflow.com/a/27513144
has comment: http://stackoverflow.com/comment/43457041
has comment: http://stackoverflow.com/comment/43456604
has answer: http://stackoverflow.com/a/27513242
has comment: http://stackoverflow.com/comment/43456445
has comment: http://stackoverflow.com/comment/43456569
score: 0
tagged with: arguments
answer count: 4
has comment: http://stackoverflow.com/comment/43456469
has body: What would you use if you wanted to pass a list of options into a function? For example, if you have an interface to a server: public interface Server { public void authUser(String username, String password, &lt;xyz&gt; options); } What structure would use use for to pass a set of options? Something like a HashMap? The reason I'm saying that it comes from tunnel vision is because I feel that this goes against Java standards. Java has method overloading. So if I get flames for raising the question I understand. But overall, maybe in different cases, would you ever pass bulk data in some collection and, if yes, which one?
type: Question

http://stackoverflow.com/a/27481333
has comment: http://stackoverflow.com/comment/43395511
has comment: http://stackoverflow.com/comment/43395576
has comment: http://stackoverflow.com/comment/43395439
type: Answer
has comment: http://stackoverflow.com/comment/43396079
has body: You can escape the quotes, just write: "grep \"Hello world\" /sratch/temp" You can take a look at this, for more information EDIT If you're parsing the user input Java will escape this special characters automatically. For example, with this code: public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); System.out.println("Input:"+s); } } And the input: Testing "Quotes" You will get this String:
answers question: http://stackoverflow.com/q/27481282
score: 0

http://stackoverflow.com/comment/43467772
type: QuestionComment
comment on: http://stackoverflow.com/q/27518544
score: 0
type: Comment
has text: It is `mvn exec:java -Dexec.mainClass="com.test.Test" -Dexec.args="-XX:+PrintGCDetails"`

http://stackoverflow.com/comment/43603747
type: Comment
type: QuestionComment
has text: do you have the access to source code for `com.example.DBClient` ? if yes you could introduce an additional constructor which takes provider and handler as arguments! In case no, you could consider extending it (if not final)
score: 0
comment on: http://stackoverflow.com/q/27589845

http://stackoverflow.com/q/27482955
accepted answer: http://stackoverflow.com/a/27483197
type: AnsweredQuestion
has body: I'm trying to make a function that takes a String and a double as parameters in Java, like this: public static double calc(String fx, double arg) { return fx.convertToFunction(arg); // Pseudocode } For instance, to calculate the cosine of a number (PI, for example), the code would be: calc("cos", Math.PI); and the function calc has to convert "cos" into Math.cos(). Is that at least possible?
upvote count: 3
possible better answer: http://stackoverflow.com/a/27483003
downvote count: 2
has comment: http://stackoverflow.com/comment/43398532
has comment: http://stackoverflow.com/comment/43398401
has answer: http://stackoverflow.com/a/27483023
has answer: http://stackoverflow.com/a/27483003
type: Question
has answer: http://stackoverflow.com/a/27483153
has title: How to convert Strings in functions in Java?
has comment: http://stackoverflow.com/comment/43428097
has answer: http://stackoverflow.com/a/27483031
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43398397
has answer: http://stackoverflow.com/a/27483088
has answer: http://stackoverflow.com/a/27483197
tagged with: function
answer count: 7
has comment: http://stackoverflow.com/comment/43398414
tagged with: string
has comment: http://stackoverflow.com/comment/43404756
favorite count: 0
linked to: http://stackoverflow.com/q/160970
has answer: http://stackoverflow.com/a/27483166
duplicate of: http://stackoverflow.com/q/160970
linked to: http://stackoverflow.com/q/2882948

http://stackoverflow.com/q/27491438
has body: In Java8, Generated web service java classes by using wsimport -keep http://sasikumar:8080/SimpleWebServiceServer/AdditionService?wsdl I can't MyServicePort.java(AdditionPort.java) class from the generated files list so anyone give me some idea about writing client stub without MyServicePort.java(AdditionPort.java) class
has answer: http://stackoverflow.com/a/37881768
has title: In Java 8, MyServicePort.java class is missing when generating java classes by using wsimport
accepted answer: http://stackoverflow.com/a/37881768
possible better answer: http://stackoverflow.com/a/79510461
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79510461
upvote count: 2
tagged with: web-services
tagged with: java-8
type: Question
tagged with: java
tagged with: wsimport
answer count: 2
tagged with: wsdl
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/27630397
score: 0
answers question: http://stackoverflow.com/q/27630178
type: Answer
has body: The size of an array is basically static. For this purposes, you can use an ArrayList which is dynamic.

http://stackoverflow.com/a/27636448
type: Answer
answers question: http://stackoverflow.com/q/27636242
upvote count: 1
downvote count: 1
has body: try add this config in your persistence.xml utf8 true UTF-8
score: 0
has comment: http://stackoverflow.com/comment/43692042

http://stackoverflow.com/comment/43505106
has text: try to remove your ` actionPackages com.infopool.action `. just a hunch tho
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27537555

http://stackoverflow.com/comment/58154091
has text: This is a useful way of reloading the services, but it won't reload the YAML config file AFAICT.
comment on: http://stackoverflow.com/a/31739228
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43477929
score: 1
has text: It's not really the same, but still at most one object per nesting level will be needed at any one time, which is negligible. Each new iteration of an inner loop will create a new object, most probably capturing the current item from the outer loop. This creates some GC pressure, but still nothing to really worry about.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27524492

http://stackoverflow.com/q/27526116
has answer: http://stackoverflow.com/a/27526335
tagged with: serversocket
has comment: http://stackoverflow.com/comment/43480817
accepted answer: http://stackoverflow.com/a/27528635
type: Question
type: AnsweredQuestion
has title: Keep communication open between server and client - Java
tagged with: server
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27528635
score: 0
tagged with: sockets
has body: How do you make a client which is able to send a server multiple messages at anytime, and therefore a server listening for a message all the time. Right now I have wrote some code which only allows me to send a message once. I thought this was due to me closing the input/output streams and the sockets. So I have been playing around for a while now and I can't seem to do it! Client: public class Client { private Socket socket; private OutputStream os; public Client() {} public void connectToServer(String host, int port) { try { socket = new Socket(host, port); } catch (IOException e) { e.printStackTrace(); } sendMessage(); } public void sendMessage() { try { os = socket.getOutputStream(); String string = "Anthony"; byte[] b = string.getBytes(Charset.forName("UTF-8")); os.write(b); os.flush(); os.close(); } catch (IOException e) { e.printStackTrace(); } } public void STOP() { stopOutput(); stopServer(); } public void stopServer() { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } public void stopOutput() { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } } Server: public class ConnectionHandler implements Runnable { private Socket clientSocket; private BufferedReader in; public ConnectionHandler(Socket clientSocket) { this.clientSocket = clientSocket; String clientAddress = clientSocket.getInetAddress().toString() .substring(1); System.out.println("Connected to " + clientAddress); try { in = new BufferedReader(new InputStreamReader(this.clientSocket.getInputStream())); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { while (true) { try { ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;(); String inputLine; while ((inputLine = in.readLine()) != null) { data.add(inputLine); } if (data.size() &gt; 0) { System.out.println(data.toString()); } } catch (IOException e) { e.printStackTrace(); } } } public void STOP() { stopInput(); stopConnection(); } public void stopInput() { try { in.close(…
tagged with: client
possible better answer: http://stackoverflow.com/a/27526335

http://stackoverflow.com/a/27636679
answers question: http://stackoverflow.com/q/27600097
score: 0
has body: The 'init-param' property is loaded from the init() method in MVCPortlet extended classes with getInitParameter("init-parameter-name"); I never used a Struts2 portlet but I think you can use the same method. The portlet-name and display-name are used for code and deployment identity but portlet-info tags are used for human-readable text (for example, to see the name of the portlet in the list of available portlets to add in the portal's topbar). The supports tag is used to set the mime-type (usually text/html) and the available portlet modes; the VIEW mode is available even if it isn't set. Other modes usually used are EDIT (for use portlet preferences) and HELP (info about the portlet and its use). You can take a look to this article for more info: https://www.liferay.com/es/documentation/liferay-portal/6.0/development/-/ai/anatomy-of-a-portlet Regards.
type: Answer

http://stackoverflow.com/a/27613032
score: 0
answers question: http://stackoverflow.com/q/27610539
type: Answer
has comment: http://stackoverflow.com/comment/43665248
has body: your controller is not designed to be testable. the dependency Mhe_Handler is instantiated as local variable in method getFirst, so there is no way to mock it out in unit test. one solution is to extract it as a private field and autowire it, which is one of the most important benefits of dependency injection: class Controller { //inject real Mhe_Handler backed by jndi datasource in production //while inject mockups in unit test @Autowired private Mhe_Handler mhe_Handler; public LogDisplay getFirst() { //inject dependency instead of hard-wire it mhe_Handler.getConnection() } }

http://stackoverflow.com/q/27590548
has comment: http://stackoverflow.com/comment/43604973
has answer: http://stackoverflow.com/a/27591086
has comment: http://stackoverflow.com/comment/43604935
tagged with: io
has comment: http://stackoverflow.com/comment/43605002
answer count: 1
has comment: http://stackoverflow.com/comment/43605022
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: inputstream
has title: Retrieving data from multiple text files in java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/43605018
has body: I'm trying to retrieve data from multiple text files(say songs) and record them into an array. The problem is, all array values have the LAST FILE's values. Here's a part of code public static Song[] retrieve(String path, String type, String g, int no) { Song[] song; song = new Song[no]; Scanner s; String lrc = ""; for(int i=0;i&lt;no;i++) { try { s = new Scanner(new FileInputStream(path+"\\"+type+"\\"+g+"\\"+(i+1)+".txt")); song[i].artist = s.nextLine(); song[i].title = s.nextLine(); song[i].genre = "ARB"; while(s.hasNext()) lrc = lrc + " " + s.next(); song[i].lyrics = lrc.split(" "); lrc = ""; s.close(); /*System.out.println(song[i].artist); System.out.println(song[i].title); System.out.println(song[i].genre); for(int j = 0; j &lt; song[i].lyrics.length; j++) System.out.print(song[i].lyrics[j]+" "); System.out.println("")*/ } catch(FileNotFoundException e) { System.out.println("File not found"); } } return song; }

http://stackoverflow.com/a/36423510
type: Answer
upvote count: 10
score: 10
downvote count: 0
answers question: http://stackoverflow.com/q/27603747
has body: Late answer but posting anyway hoping it'll help someone. Drop down the compliance level to Java7: Project Properties> Java Compiler and Tick "Enable Project specific settings" Select compiler compliance level to 1.7. If your project is faceted may need to drop down the facet version as well. Project Properties> Project Facets and select 1.7 for the row containing Java.

http://stackoverflow.com/q/27478437
accepted answer: http://stackoverflow.com/a/27478469
downvote count: 0
has answer: http://stackoverflow.com/a/27478450
favorite count: 0
has title: LinkedList.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details
upvote count: 2
possible better answer: http://stackoverflow.com/a/27478450
score: 2
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has answer: http://stackoverflow.com/a/27478469
has body: LinkedList.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. I am getting this message when I compile my LinkedList class. I am assuming it has something to do with me using generics incorrectly, but I'm not exactly sure what I'm doing wrong. Here is the code for the Node class and the Linked List class. Node.java public class Node&lt;T&gt; { private T data; private Node&lt;T&gt; next; public Node() { this.data = null; this.next = null; } public Node(T data, Node&lt;T&gt; next) { this.data = data; this.next = next; } public void setData(T data) { this.data = data; } public void setNext(Node&lt;T&gt; next) { this.next = next; } public T getData() { return this.data; } public Node getNext() { return this.next; } } LinkedList.java public class LinkedList&lt;T&gt; { private Node&lt;T&gt; head; public LinkedList() { this.head = null; } public LinkedList(Node&lt;T&gt; head) { this.head = head; } public void add(T data) { if(this.isEmpty()) this.head = new Node&lt;&gt;(data, null); else { Node&lt;T&gt; current = this.head; while(current.getNext() != null) current = current.getNext(); current.setNext(new Node&lt;&gt;(data, null)); } } public T remove() { Node&lt;T&gt; current = this.head; Node&lt;T&gt; follow = null; while(current.getNext() != null) { follow = current; current = current.getNext(); } if(follow == null) this.head = null; else follow.setNext(null); return current.getData(); } public int size() { Node current = this.head; int count = 0; while(current != null) { count++; current = current.getNext(); } return count; } public boolean contains(T data) { boolean result = false; Node current = this.head; while(current != null) { if(current.getData() == data) result = true; current = current.getNext(); } return result; } public boolean isEmpty() { return (this.head == null); } public String toString() { if(this.isEmpty()) return "[]"; String output = "["; Node&lt;T&gt; current = this.head; while(current != null) { output += c…
type: Question
answer count: 2

http://stackoverflow.com/comment/43415135
score: 0
type: QuestionComment
type: Comment
has text: I am not pushing the content to the screen. It is rendered on the server and then some clients can display it.
comment on: http://stackoverflow.com/q/27490716

http://stackoverflow.com/q/27503611
type: AnsweredQuestion
tagged with: java
downvote count: 3
has body: I have downloaded RabbitMQ and seeking tutorial. However I'm not in Java at all and I don't know how to solve problem. Problem is that I get this error error: package com.rabbitmq.client does not exist import com.rabbitmq.client.ConnectionFactory; error: package com.rabbitmq.client does not exist import com.rabbitmq.client.Connection; error: package com.rabbitmq.client does not exist import com.rabbitmq.client.Channel;` I have downloaded server and some client jars from this website, but I don't know how to include all the stuff in Java Project. Also I'm using netbeans 8.0.2
type: Question
has answer: http://stackoverflow.com/a/27503760
score: -2
has comment: http://stackoverflow.com/comment/43437305
answer count: 1
linked to: http://stackoverflow.com/q/4879903
has comment: http://stackoverflow.com/comment/43438178
accepted answer: http://stackoverflow.com/a/27503760
favorite count: 0
has title: How to use rabbitMQ?
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43437581
has comment: http://stackoverflow.com/comment/43438021
has comment: http://stackoverflow.com/comment/43437870
upvote count: 1
tagged with: rabbitmq

http://stackoverflow.com/comment/43628610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27603130
has text: My guess is that a and b are of non-primitive type and thus you can not compare them with `>`
score: 0

http://stackoverflow.com/q/27555168
type: UnansweredQuestion
has body: I want to create one source folder: "src". in this folder I want to create two sub folder: one "java" for source and "test" for testing code. when I want to create sub folder into the "src" folder, the eclipse just flat it in the project view.
score: 2
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27555217
tagged with: eclipse
answer count: 1
downvote count: 0
has title: How to add sub folder to eclipse source folder in project view?
favorite count: 0

http://stackoverflow.com/q/27618694
has title: Proxy server in C#
has comment: http://stackoverflow.com/comment/43659924
has body: I am a newbie in network programming in C# and I want to create a proxy server which can be used to restrict users from connecting to internet if they have exceeded the download limit. My current config is ---- User -> proxy server -> wifi router -> internet. I searched everywhere and I found that HTTP proxy can be created but it is very hard to create a HTTPS proxy in C# Even the c# library like Trotinet and mentalis does not support the HTTPS proxy. But I found that there are many library in JAVA like little proxy that support HTTPS connection. So, Is it possible to create a fully functional proxy in C#? or should I try switching to JAVA? One More question. Can I create a simple TCP client read its networkstearm and forward that stream as it is to wifi router without need to read its header or anything, will this method work? Just a guess, sorry for noob question. Thanks
type: Question
has comment: http://stackoverflow.com/comment/43659423
tagged with: c#
tagged with: network-programming
has comment: http://stackoverflow.com/comment/43659612
downvote count: 0
has answer: http://stackoverflow.com/a/29650893
favorite count: 0
tagged with: proxy
answer count: 1
has comment: http://stackoverflow.com/comment/43659101
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43658519
has comment: http://stackoverflow.com/comment/43658713
upvote count: 1
has comment: http://stackoverflow.com/comment/43658670
score: 1
tagged with: java

http://stackoverflow.com/comment/43412204
comment on: http://stackoverflow.com/a/27490080
type: Comment
has text: @ChamilaWijayarathna [January is 0](http://stackoverflow.com/questions/344380/why-is-january-month-0-in-java-calendar)
type: AnswerComment
score: 2

http://stackoverflow.com/q/27512569
has answer: http://stackoverflow.com/a/27513699
upvote count: 1
has body: As I understand JVM: A Java virtual machine (JVM) is a virtual machine that can execute Java bytecode. It is the code execution component of the Java software platform. JVM interprets the byte code into the machine code JRE: Java Runtime Environment contains JVM, class libraries . It's needed to run Java programs. You can't compile Java programs with it JDK: jre + development tools such as debugger ,compiler (javac), java (launcher) Question 1 : It is possible to compile only using jdk ? I mean get .class files ? Question 2 : JRE needed to run java ? how it run if it can't compile class? Question 3: why JRE provide jvm if it can't compile ? Question 4 :Did I missed something in jdk explanation ?
accepted answer: http://stackoverflow.com/a/27512735
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/11547458
tagged with: eclipse
has title: Some nuances in jre explanation
has answer: http://stackoverflow.com/a/27512916
downvote count: 0
score: 1
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/27512824
answer count: 5
possible better answer: http://stackoverflow.com/a/27512646
has answer: http://stackoverflow.com/a/27512646
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27283334
has answer: http://stackoverflow.com/a/27512735
tagged with: java

http://stackoverflow.com/comment/43587431
comment on: http://stackoverflow.com/a/27579483
has text: response don't have such method
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/27620065
type: Answer
upvote count: 14
has body: Short answer: Implement AuthenticationProvider in order to integrate your custom authentication scheme into Spring Security. Implement AccessDecisionVoter in order to integrate your custom authorization scheme into Spring Security. You might also need to implement a custom AccessDecisionManager in some particular cases, altough the bundled ones are typically enough. Note that neither of those is web-specific, in contrast with AuthenticationEntryPoint, that is a part of Spring Security Web and not Spring Security Core. The main function of AuthenticationEntryPoint is to allow the framework to send some sort of "to access this resource you must authenticate first" notification from application server to web client. Most standard notifications are already implemented in Spring Security Web. For example: BasicAuthenticationEntryPoint: This is used with Basic authentication. The "notification" is a HTTP 401 response. LoginUrlAuthenticationEntryPoint: Your typical "redirect to login page" behaviour. CasAuthenticationEntryPoint: Similar to the former, redirects to an enterprise-wide login page to perform SSO via CAS. Http403ForbiddenEntryPoint: The notification is just an HTTP 403 response. This is useful when you use pre-authentication (such as client X.509 certificates) and the user credentials do not provide access. ... As you can see, unless your required behaviour is too specific, you should not need to provide your own implementation of AuthenticationEntryPoint.
has comment: http://stackoverflow.com/comment/109564261
score: 14
answers question: http://stackoverflow.com/q/27618195
downvote count: 0

http://stackoverflow.com/comment/43526437
comment on: http://stackoverflow.com/a/27549668
type: AnswerComment
score: 0
type: Comment
has text: ok Than Why cpu load increse in Second Code where i did not use the Thread pool. Second i can not use the batch in this case. Reason system get request frequently and then these entry will be viewed by user at MIS part. Other reason some time system is in idle stage. So i have to hit db one to one.

http://stackoverflow.com/q/27534536
has comment: http://stackoverflow.com/comment/43498793
has comment: http://stackoverflow.com/comment/43499081
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27534580
tagged with: java
has title: Using a static inner class
has comment: http://stackoverflow.com/comment/43498682
type: Question
has comment: http://stackoverflow.com/comment/43498848
answer count: 2
has comment: http://stackoverflow.com/comment/43498692
accepted answer: http://stackoverflow.com/a/27534628
has comment: http://stackoverflow.com/comment/43499439
upvote count: 6
has comment: http://stackoverflow.com/comment/43498114
duplicate of: http://stackoverflow.com/q/70324
has comment: http://stackoverflow.com/comment/43497839
score: 4
downvote count: 2
has answer: http://stackoverflow.com/a/27534628
has comment: http://stackoverflow.com/comment/43499576
has comment: http://stackoverflow.com/comment/43499107
has comment: http://stackoverflow.com/comment/43499003
has comment: http://stackoverflow.com/comment/43498658
has comment: http://stackoverflow.com/comment/43498833
favorite count: 0
linked to: http://stackoverflow.com/q/70324
has body: I have a question about use of static inner class in the following code, adapted from Eckel's Thinking in Java 4th edition (page 625). The code uses a static inner class called Node. When you create a Stack structure, you can then push the nodes onto the stack and pop them off - so far so good. But I'm confused about why the node class is static? Wouldn't that mean that there would be only one Node created in the LinkedStack class? How / why is it that in fact you can push many different nodes onto the stack, and then pop them off (which of course is what the stack is supposed to do). In fact, you can change private static class Node to 'private class Node` and it also works ... so why did Eckels choose static class Node? In this example, the input is the three words "Phasers", "on", "stun!" and output is "stun!", "on", "Phasers". public class LinkedStack&lt;T&gt; { //generic inner class node private static class Node&lt;U&gt; { U item; Node&lt;U&gt; next; Node() { item = null; next = null; } Node(U item, Node&lt;U&gt; next) { this.item = item; this.next = next; } boolean isDummyNode() { return item == null &amp;&amp; next == null; } } //initialize top of stack as a dummy first node private Node&lt;T&gt; top = new Node&lt;T&gt;(); public void push(T item) { top = new Node&lt;T&gt;(item, top); } public T pop() { T result = top.item; if(!top.isDummyNode()) top = top.next; return result; } public static void main(String[] args) { LinkedStack&lt;String&gt; stack = new LinkedStack&lt;String&gt;(); for(String s : "Phasers on stun!".split(" ")) stack.push(s); String s; while((s = stack.pop()) != null) System.out.println(s); } }
has comment: http://stackoverflow.com/comment/43499050
possible better answer: http://stackoverflow.com/a/27534580

http://stackoverflow.com/comment/43517550
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27545216
type: Comment
has text: Hope this helps you http://stackoverflow.com/questions/15796780/failed-to-fetch-url-http-dl-ssl-google-com-android-eclipse-addon-xm

http://stackoverflow.com/comment/43663337
type: QuestionComment
comment on: http://stackoverflow.com/q/27621122
has text: check this: http://stackoverflow.com/a/4451825/801369
score: 0
type: Comment

http://stackoverflow.com/comment/134025135
type: Comment
comment on: http://stackoverflow.com/a/45525372
has text: can you update your code to work for all types values ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/27574220
has answer: http://stackoverflow.com/a/27574252
has comment: http://stackoverflow.com/comment/43574205
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43573971
has comment: http://stackoverflow.com/comment/43573977
type: Question
downvote count: 2
score: -2
has body: am currently working on a project where I have to build a multi thread server. I only started to work with threads so please understand me. So far I have a class that implements the Runnable object, bellow you can see the code I have for the run method provided by the Runnable object. public void run() { while(true) { try { clientSocket = serversocket.accept(); for (int i = 0; i &lt; 100; i++) { DataOutputStream respond = new DataOutputStream(clientSocket.getOutputStream()); respond.writeUTF("Hello World! " + i); try { Thread.sleep(1000); } catch(InterruptedException e) { // } } } catch(IOException e) { System.out.println(e.getMessage()); } } } Bellow is the main method that creates a new object of the server class and creates a threat. initializing the Thread. public static void main(String args[]) { new Thread(new Server(1234, "", false)).start(); } I know this creates a new thread but it does not serve multiple clients at once. The first client need to close the connection for the second to be served. How can I make a multi threated server that will serve different client sockets at once? Do I create the thread on the clientSocket = serverSocket.accept();
answer count: 1
has title: Multi Thread Java Server
tagged with: runnable
accepted answer: http://stackoverflow.com/a/27574252
favorite count: 0
upvote count: 0
tagged with: multithreading

http://stackoverflow.com/q/27504925
has comment: http://stackoverflow.com/comment/43440037
has comment: http://stackoverflow.com/comment/43439952
has comment: http://stackoverflow.com/comment/43440082
has comment: http://stackoverflow.com/comment/43458204
has comment: http://stackoverflow.com/comment/43440174
has comment: http://stackoverflow.com/comment/43440113
score: 66
has comment: http://stackoverflow.com/comment/43440121
tagged with: java
tagged with: compilation
has comment: http://stackoverflow.com/comment/43440085
has answer: http://stackoverflow.com/a/27505116
upvote count: 66
answer count: 4
type: AnsweredQuestion
has body: The Java language specification specifies that In the Java programming language arrays are objects (§4.3.1), are dynamically created, and may be assigned to variables of type Object (§4.3.2). All methods of class Object may be invoked on an array. So, considering arrays are objects — why did the Java designers make the decision not to allow inherit and override from it, for example, toString() or equals()? The current syntax wouldn't allow creating anonymous classes with an array as the base class, but I don't think that was the reason for their decision.
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/43440111
accepted answer: http://stackoverflow.com/a/27505116
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/27505121
possible better answer: http://stackoverflow.com/a/27505095
type: Question
has comment: http://stackoverflow.com/comment/43439962
linked to: http://stackoverflow.com/q/10295600
has answer: http://stackoverflow.com/a/27505095
has answer: http://stackoverflow.com/a/27505130
has comment: http://stackoverflow.com/comment/43439939
has title: Why are arrays Objects, but can not be used as a base class?

http://stackoverflow.com/a/27591751
has body: if your output is a double it will work fine look here public static void main (String[] args) throws java.lang.Exception { double a = Math.round(83.5067 * 100) / 100.0; System.out.println(a); } will print 83.51
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27591699
type: Answer
answers question: http://stackoverflow.com/q/27591699
upvote count: 1

http://stackoverflow.com/q/27629498
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43679739
has comment: http://stackoverflow.com/comment/43679896
accepted answer: http://stackoverflow.com/a/27629669
score: 0
has body: My code is detecting directories as files and files as directories. Why is it doing that? THanks I've attacked the full function where the issues is occuring, sorry if it's messy! Thankyou for your help again! unzip(getFilesDir() + "/", "bla.zip", getFilesDir() + "/unzip/"); public void unzip(String filepath, String filename, String unzip_path) { try { InputStream is = new FileInputStream(filepath + filename); Log.d("1st", filepath + filename); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is)); try { ZipEntry ze; while ((ze = zis.getNextEntry()) != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count; String filename_temp = ze.getName(); File fmd = new File(unzip_path, filename_temp); Log.d("2nd", unzip_path + filename_temp); Log.d("ERROR7", fmd.toString()); //if (!fmd.exists()) { if(fmd.isDirectory()) { Log.d("ERROR4", fmd.toString()); fmd.mkdirs(); } else if (fmd.isFile()) { Log.d("ERROR4", fmd.toString() +"FILE"); } //} else {} Log.d("ERROR5", "DIR"); FileOutputStream fout = new FileOutputStream(unzip_path + filename_temp); Log.d("ERROR6", "DIR"); while ((count = zis.read(buffer)) != -1) { baos.write(buffer, 0, count); byte[] bytes = baos.toByteArray(); fout.write(bytes); baos.reset(); } fout.close(); //} } zis.close(); } catch (IOException e) { Log.d("ERROR1", e.toString()); }} catch (FileNotFoundException e) { Log.d("ERROR2", e.toString());} } 1st﹕ /data/data/au.com.amon/files/bla.zip 2nd﹕ /data/data/au.com.amon/files/unzip/docProps/ ERROR7﹕ /data/data/au.com.amon/files/unzip/docProps ERROR4﹕ /data/data/au.com.amon/files/unzip/docPropsFILE ERROR5﹕ DIR ERROR6﹕ DIR 2nd﹕ /data/data/au.com.amon/files/unzip/docProps/app.xml ERROR7﹕ /data/data/au.com.amon/files/unzip/docProps/app.xml ERROR5﹕ DIR ERROR1﹕ java.io.FileNotFoundException: /data/data/au.com.amon/files/unzip/docProps/app.xml: open failed: ENOTDIR (Not a directory) DOCUMENT﹕ docProps
tagged with: android
has answer: http://stackoverflow.com/a/27629669
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27629538
tagged with: java
has answer: http://stackoverflow.com/a/27629538
has comment: http://stackoverflow.com/comment/43679624
has title: My code is detecting directories as files and files as directories

http://stackoverflow.com/comment/43570970
has text: @Mr.Polywhirl The exception would be thrown within `Function#apply(Object)` within `map` (which doesn't declare a throws either), not within your method.
type: AnswerComment
comment on: http://stackoverflow.com/a/27572674
type: Comment
score: 1

http://stackoverflow.com/a/27584900
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27584861
answers question: http://stackoverflow.com/q/27584861
type: AcceptedAnswer
score: 4
downvote count: 0
has body: You can create a reader as follows: InputStream is = new FileInputStream(inputFile); InputStreamReader in = new InputStreamReader(is, "UTF-8"); and a writer as follows: OutputStream os = new FileOutputStream(outputFile); OutputStreamWriter out = new OutputStreamWriter(os, "UTF-16");
type: Answer

http://stackoverflow.com/a/28093135
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/27574652
downvote count: 0
has body: I solved this by using groupBy() and flatMap(). Here is an example: // your initial stream Broadcaster&lt;Object&gt; stream = Streams.&lt;Object&gt;broadcast(environment); stream .groupBy(o -&gt; o.isValid()) .flatMap(groupedStream -&gt; { if (groupedStream.key()) { return groupedStream.map(o -&gt; trueOperation(o)); } else { return groupedStream.map(o -&gt; falseOperation(o)); } .map(o -&gt; additionalOperations(); What happens here is that groupBy() converts your Stream into a Stream&lt;GroupedStream&lt;O&gt;&gt;. In other words, a stream of streams of objects. Each inner stream contains a group of objects that were bucketed by the operation in the groupBy() call. In my case, I've filtered the Objects into true and false buckets. Next, flatMap() takes the multiple streams, processes them, and then flattens the output back into a single Stream&lt;Object&gt;. Within flatMap(), you can check the Stream's key(), and perform additional operations on the stream based on the key(). Then after the flatMap() finishes, you have a Stream again, and can do any post processing you want.
type: Answer
answers question: http://stackoverflow.com/q/27574652
upvote count: 4

http://stackoverflow.com/comment/43613049
has text: @wassgren brings up a good point -- a Set would work much better because then your duplicate values are taken care of automatically. Did your instructor *specify* that you need to use an ArrayList? Or would he be willing to let you use any kind of collection (i.e. not just a List, but a Set)? Academia is weird sometimes. In the real world you would use a LinkedHashSet, but in the artificial confines of the classroom you may be required to use an ArrayList.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27594436
score: 1

http://stackoverflow.com/a/27492941
type: AcceptedAnswer
downvote count: 0
has body: a and b are reference variables. After initialization you effectively had something like this: a -> [1, 2, 3, 4, 5] b -> [0, 0, 0, 0] When you do b=a, you are only reassigning b to reference the array that a is referencing, and the array that b was initialized with is no longer referenced at all. So, you now have: (a and b) -> [1, 2, 3, 4, 5]
accepted answer of: http://stackoverflow.com/q/27492809
type: Answer
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/27492809

http://stackoverflow.com/q/27524894
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43478412
has body: I am mostly getting illegal starts to expressions and semicolons expected before the curly braces in my methods. I really need some help with this as I can't for the life of me figure out why I'm getting so many errors public class stockItem{ //Declaring Variables private double price; private boolean delivery; private static int counter = 0; // New array with all the catagories stored in it private String[] catagoryArray = new String[] {"furniture", "silver", "mirrors", "jewelry", "miscellaneous"}; private String Catagory; private String code; //default constructor for stockItem public stockItem(){ price = 0; Catagory = catagoryArray[0]; delivery = false; counter++; code = "default"; } // Constructor for stockItem made by the user with all nessacey inputs public stockItem(String Catagory, double price, boolean delivery){ for (int i =0; i &lt; catagoryArray.length; i++){ if (Catagory.equalsIgnoreCase(catagoryArray[i])){ this.Catagory = catagoryArray[i]; } else { System.out.println("This is not a valid catagory!"); } // Variables overwrite old variables from default stockItem this.price = price; this.delivery = delivery; counter++; code = code(); } // Generates codes for each catagory and each item created private String getCode(){ String furnCode = catagoryArray[0].substring(0,4) + counter; String silverCode = catagoryArray[1].substring(0,4) + counter; String mirrorsCode = catagoryArray[2].substring(0,4) + counter; String jewelry = catagoryArray[3].substring(0,4) + counter; String miscCode = catagoryArray[4].substring(0,4) + counter; } //Methods //Returns price of an object public double getPrice(){ return price; } //Returns true of false for delivery of an object public boolean getDelivery(){ return delivery; } //Returns the counter value public int getCounter(){ return counter; } // Returns the catagory of an object public String getCatagory(){ return Catagory; } // gets code of particular item public String getCode(){ return code; } // Returns the amount of objec…
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43478451
has answer: http://stackoverflow.com/a/27525086
downvote count: 0
tagged with: compilation
has answer: http://stackoverflow.com/a/27524949
answer count: 3
has title: What causes "Illegal start of expression" errors?
has answer: http://stackoverflow.com/a/27525901
favorite count: 0

http://stackoverflow.com/a/27533366
answers question: http://stackoverflow.com/q/27533138
downvote count: 0
type: Answer
upvote count: 1
has body: The common solution to this problem is to make Person an interface. interface Person { public String getName(); public int getAge(); } class ActualPerson implements Person { private final String name; private final int age; ActualPerson(String name, int age) { this.name = name; this.age = age; } @Override public String getName() { return name; } @Override public int getAge() { return age; } } class PersonWithId implements Person { private final Person person; private final int id; PersonWithId(Person person, int id) { this.person = person; this.id = id; } @Override public String getName() { return person.getName(); } @Override public int getAge() { return person.getAge(); } } Do not fear lots of code - the time you take writing code is insignificant compared to the time you spend regretting you didn't do it properly in the first place. Old Curmudgeon 2014
score: 1

http://stackoverflow.com/comment/43420413
score: 1
comment on: http://stackoverflow.com/q/27494316
type: Comment
type: QuestionComment
has text: check for actual parameter as well

http://stackoverflow.com/q/27503779
tagged with: java
has answer: http://stackoverflow.com/a/27503915
type: Question
has answer: http://stackoverflow.com/a/27503933
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/27503911
favorite count: 0
type: UnansweredQuestion
upvote count: 4
score: 3
tagged with: treeset
has title: How does the ceiling , floor will behave on TreeSet of String
has body: I am reading about the TreeSet and found it interesting. I have one question lets we have a TreeSet of String. How does this Ceiling and floor function will behave in this case. NavigableSet&lt;String&gt; ns= new TreeSet&lt;String&gt;(); ns.add("Yogi"); ns.add("Yogendra"); ns.add("Yogesh"); ns.add("hello"); String ns1= ns.ceiling("Yog"); System.out.println(ns1); Output==&gt; Yogendra

http://stackoverflow.com/q/27566724
has answer: http://stackoverflow.com/a/27569225
answer count: 1
tagged with: model-view-controller
has body: I'm working with Spring Security 3.2 and Hibernate 4. Currently I have a custom login wich works as follows . The URL "/" (root ) is a welcome jsp requests wich ask for a parameter to display a different login according to the same parameter . For example if the user enters the url "/parameter1" (manual action ) , this variable shows me a personalized login generated by a driver that cathes a RequestMapping ( value = " /{parameter}"from there, all URLS will have that parameter , the problem that I have is that when the user wishes to leave or your session expires , spring sends me the url "/" , but I need it to send me a /parameter1 , in order to capture the parameter "parameter1" so that It leaves me in the custom login. That way I would not have to manually re- enter the parameter . My security settings are as follows: &lt;custom-filter position="FORM_LOGIN_FILTER" ref="myFilter" /&gt; &lt;!-- &lt;form-login login-page="/loginUser" login-processing-url="/testUser/j_spring_security_check" authentication-failure-url="/loginError" default-target-url="/testUser" username-parameter="j_username" password-parameter="j_password" /&gt; --&gt; &lt;logout invalidate-session="true" delete-cookies="JSESSIONID" logout-success-url="/loginUser" logout-url="/testUser/j_spring_security_logout"/&gt; &lt;session-management invalid-session-url="/" session-fixation-protection="migrateSession" &gt; &lt;concurrency-control max-sessions="2" expired-url="/" error-if-maximum-exceeded="false"/&gt; &lt;/session-management&gt; &lt;beans:bean id="loginUrlAuthenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"&gt; &lt;beans:property name="loginFormUrl" value="/loginUser" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="myFilter" class="net.universia.test.autenticacionService.LoginAuthenticationFilter"&gt; &lt;beans:property name="authenticationManager" ref='UserauthenticationManager'/&gt; &lt;beans:property name="authenticationFailureHandler…
score: 0
tagged with: java
tagged with: primavera
type: UnansweredQuestion
has title: Capture url parameter at the end of session con spring security
type: Question

http://stackoverflow.com/q/27572966
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43571784
upvote count: 5
has answer: http://stackoverflow.com/a/27573408
tagged with: lambda
has title: How to pass a Lambda expression as a method argument in JDK8 with reflection
has comment: http://stackoverflow.com/comment/43571913
has comment: http://stackoverflow.com/comment/43572655
has comment: http://stackoverflow.com/comment/43571768
tagged with: reflection
has comment: http://stackoverflow.com/comment/43575373
has comment: http://stackoverflow.com/comment/43572132
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/43572396
tagged with: java
has comment: http://stackoverflow.com/comment/43572332
score: 4
has body: In JDK 8, I can use reflection to call a method with a FunctionalInterface parameter, passing a Lambda expression. For instance, this works. import java.util.function.IntPredicate; import java.lang.reflect.Method; public class LambdaReflect { public static void main(String args[]) { System.out.println(test(x-&gt;true)); // Now do this in reflection Class&lt;LambdaReflect&gt; thisC = LambdaReflect.class; Method meths[] = thisC.getDeclaredMethods(); Method m = meths[1]; // test method try { IntPredicate lamb = x-&gt;true; boolean result = (Boolean) m.invoke(null, lamb); System.out.println(result); } catch (Exception ex) { ex.printStackTrace(); } } public static boolean test(IntPredicate func) { return func.test(1); } } However, if the parameter type is only known at runtime, how can I pass a lambda expression to the method? In other words, if I don't know at compile time the argument type of the method, but only know that it is a functional interface, can I use reflection to call it with a lambda expression?
answer count: 2
has answer: http://stackoverflow.com/a/27574046
has comment: http://stackoverflow.com/comment/43571482

http://stackoverflow.com/q/27503990
upvote count: 1
possible better answer: http://stackoverflow.com/a/27504055
favorite count: 0
has comment: http://stackoverflow.com/comment/43438617
has comment: http://stackoverflow.com/comment/43438295
has title: immutable class objects
has comment: http://stackoverflow.com/comment/43449382
answer count: 4
has comment: http://stackoverflow.com/comment/43438323
has answer: http://stackoverflow.com/a/27504052
tagged with: immutability
has comment: http://stackoverflow.com/comment/43438091
accepted answer: http://stackoverflow.com/a/27504052
has body: the first class is immutable class and i need to make the imm2 immutable class too,my question is can i use objects of the imm class in imm2 class?? final class imm{ private final int value; public imm(int value) { this.value = value; } public int getValue() { return value; } } final class imm2{ imm value; // is this legal ??? public imm2(imm value) { this.value = value; } public imm getValue() { return value; } // set value removed is there any problems here i mean is my code correct now? }
tagged with: java
has answer: http://stackoverflow.com/a/27504047
type: Question
has comment: http://stackoverflow.com/comment/43438067
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27504111
has comment: http://stackoverflow.com/comment/43438211
score: -1
has answer: http://stackoverflow.com/a/27504055
tagged with: class
has comment: http://stackoverflow.com/comment/43438190
downvote count: 2

http://stackoverflow.com/a/27585431
has body: I believe you just need to add @col5. You can ignore @col5 after you define it, but the error is valid (your sample has 5 columns, not 4). "(@col1,@col2,@col3,@col4,@col5)"
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27585411
answers question: http://stackoverflow.com/q/27585411
score: 1

http://stackoverflow.com/q/27574999
favorite count: 0
linked to: http://stackoverflow.com/q/27854919
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/53134247
upvote count: 1
has comment: http://stackoverflow.com/comment/46691356
score: 1
tagged with: java
has body: Anyone knows how to skip the first line of the input text file in MapReduce? For example, I have a following input file: Student Score 00001 90 00002 95 00003 90 . . . Now, I would like to count the frequency of each scores. But I have to skip the first line, which is the title (Student, Score), right? How can I do this? In contratry, if I want to add a title row in the output file of the MapReduce (Score, Frequency), how can I do this? Thanks in advance!
tagged with: mapreduce
type: Question
has title: MapReduce skipping the first line of input file
has answer: http://stackoverflow.com/a/27575173
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/1104336

http://stackoverflow.com/a/27626687
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27626594
upvote count: 2
score: 2
has body: On the line CO2FootprintV1 object = new C02FootprintV1(gals); you have C02 (see zero two) on the right hand side, you meant for it to be CO2FootprintV1 object = new CO2FootprintV1(gals); or CO2 (see oh two). Also, you should consider that the error messages your tools give you might be correct.

http://stackoverflow.com/comment/43697021
score: 0
type: Comment
type: QuestionComment
has text: In other words, don't use the generated class directly; subclass it with the additional functionality you need. I used to do this a lot with Hibernate classes, although composition is another approach, arguably a better one.
comment on: http://stackoverflow.com/q/27638623

http://stackoverflow.com/comment/43751740
comment on: http://stackoverflow.com/q/27629015
has text: Thanks, @FredericBrégier, the only example I found for LocalChannel was from netty examples on Github; are you aware of any others? Regarding sharing eventloopgroups, I considered that too, but wasn't sure if it was valid, thx.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27509657
has comment: http://stackoverflow.com/comment/43472144
type: Answer
has comment: http://stackoverflow.com/comment/44884375
downvote count: 0
answers question: http://stackoverflow.com/q/27509552
has comment: http://stackoverflow.com/comment/43473997
has comment: http://stackoverflow.com/comment/43471034
score: 5
has body: Just solved: It needs to import the Library xmpcore-5.1.2.jar to correctly work!
upvote count: 5

http://stackoverflow.com/a/27521195
upvote count: 1
downvote count: 0
has body: This is what you can do.. Way 1 Rename the file with blank character (Alt+0160) Create new icon bitmap 32x32 blank (fully white) Assign this icon to the file you wanna hide This way file will be really hidden and not affected by "show hidden files and folder option". Way 2 Create a folder and place ur files in that folder. You can fire up cmd command with C# or Java program. Command to lock: ren FolderName Users.{21EC2020-3AEA-1069-A2DD-08002B30309D} Command to unlock: ren Users.{21EC2020-3AEA-1069-A2DD-08002B30309D} FolderName This will basically rename the folder to control panel. When you open the folder, control panel gets launched and because it is a control panel you cannot delete it. Way 3 Fire this CMD command from your program: copy /b Cat.jpg + Secret.zip Cat.jpg This will hide your "Secret.zip" file inside an Cat.jpg. To reveal files you need to open Cat.jpg file with WinZip.
has comment: http://stackoverflow.com/comment/43471792
has comment: http://stackoverflow.com/comment/43472222
answers question: http://stackoverflow.com/q/27520747
type: Answer
score: 1

http://stackoverflow.com/q/27523093
duplicate of: http://stackoverflow.com/q/4851573
score: 5
tagged with: mocking
tagged with: mockito
has comment: http://stackoverflow.com/comment/43475103
has comment: http://stackoverflow.com/comment/43475197
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43475144
upvote count: 5
has answer: http://stackoverflow.com/a/27523321
accepted answer: http://stackoverflow.com/a/27523321
tagged with: powermock
has comment: http://stackoverflow.com/comment/43475246
has title: Mocking a static method in a final class in Java/Mockito
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43475410
downvote count: 0
has body: If I have a class public final class Application { public static String getName() { return "Bad App"; } } then how can I change the behavior and make getName return, say, "Good App"? I need to mock it, so that classes under test receive an expected value. In reality the static method makes some network call that I want to avoid. I cannot rewrite the code of Application. I am using Java 6, Maven, JUnit and Mockito. Is it possible?
tagged with: java
linked to: http://stackoverflow.com/q/4851573
has comment: http://stackoverflow.com/comment/43475108
type: Question

http://stackoverflow.com/q/27584861
upvote count: 3
tagged with: file
has answer: http://stackoverflow.com/a/27628023
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27584900
tagged with: encoding
has comment: http://stackoverflow.com/comment/43594374
has body: How can I open a file in UTF-8 and write to another file in UTF-16? I need an example because I'm having issues with some characters like 'é' and 'a'. When writing "médic", I find in the file written "m@#dic".
has title: How to Open File in UTF-8 and Write in Another File in UTF-16
downvote count: 0
has answer: http://stackoverflow.com/a/27584954
accepted answer: http://stackoverflow.com/a/27584900
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/27584954
tagged with: utf-8

http://stackoverflow.com/a/27570844
score: 1
has comment: http://stackoverflow.com/comment/43584533
has comment: http://stackoverflow.com/comment/43583979
accepted answer of: http://stackoverflow.com/q/27568917
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27568917
has comment: http://stackoverflow.com/comment/43568701
type: Answer
has body: Here it is an url where they explain how to solve your problem http://www.jade-cheng.com/uh/ta/signed-applet-tutorial/
downvote count: 0

http://stackoverflow.com/comment/135497190
type: AnswerComment
type: Comment
has text: You also need to add the `com.google.inject.extensions:guice-testlib` dependency to your project.
score: 1
comment on: http://stackoverflow.com/a/27609674

http://stackoverflow.com/q/27548090
favorite count: 0
has title: How to change the location of a file which is being saved in .camel subdirectory by default
tagged with: spring
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: file
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27548184
tagged with: apache-camel
has body: I'm passing the following path to myBean through dependency injection and want the file to be saved in C:\user\folder1\export\out\ &lt;bean id="myBean" class="com.company.myClass"&gt; &lt;property name="myDirectory" value="${user.home}${file.separator}folder1${file.separator}export${file.separator}out${file.separator}" /&gt; &lt;property name="myDao" ref="myDao" /&gt; &lt;/bean&gt; but instead my process is saving the file in the .camel directory. C:\user\folder1\export\out\.camel I cannot afford the file to stay in .camel location so I will have to eliminate the camel default behavior. Anyone has any idea how to do this? Following is the java code for reference where I create a fileoutputstream for creating the file. final FileOutputStream fos = new FileOutputStream(myDirectory + "ABCD_" + dateFormatFile.format(new Date()) + "_EXPORT.xlsm");
answer count: 1

wikipedia-api
tag name: wikipedia-api
tags question: http://stackoverflow.com/q/27558206
type: Tag
tags question: http://stackoverflow.com/q/27618862

http://stackoverflow.com/comment/43635217
comment on: http://stackoverflow.com/q/27606449
score: 0
type: Comment
type: QuestionComment
has text: What do you mean work/not work. Both of them throw CCE.

http://stackoverflow.com/comment/43657782
has text: It could be that you have an error in some syntax above/below it, and that is where it shows as an error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27618325
score: 0

http://stackoverflow.com/comment/43853952
score: 0
type: Comment
type: QuestionComment
has text: By the way, this model works if I use `InheritanceType.SINGLE_TABLE` and have a single table for both TableA1 and TableA2 (the type would be declared in `@DiscriminatorValue`). I want to avoid having a single table.
comment on: http://stackoverflow.com/q/27624410

user-interface
tags question: http://stackoverflow.com/q/27584069
tags question: http://stackoverflow.com/q/27586065
tags question: http://stackoverflow.com/q/27578896
tags question: http://stackoverflow.com/q/27571996
tags question: http://stackoverflow.com/q/27475384
tags question: http://stackoverflow.com/q/27557998
tags question: http://stackoverflow.com/q/27577077
tags question: http://stackoverflow.com/q/27576150
tags question: http://stackoverflow.com/q/27527436
tags question: http://stackoverflow.com/q/27480107
tags question: http://stackoverflow.com/q/27484474
type: Tag
tags question: http://stackoverflow.com/q/27516478
tags question: http://stackoverflow.com/q/27576528
tags question: http://stackoverflow.com/q/27593964
tags question: http://stackoverflow.com/q/27538904
tags question: http://stackoverflow.com/q/27496598
tags question: http://stackoverflow.com/q/27571572
tags question: http://stackoverflow.com/q/27515919
tags question: http://stackoverflow.com/q/27575172
tags question: http://stackoverflow.com/q/27530403
tags question: http://stackoverflow.com/q/27480108
tags question: http://stackoverflow.com/q/27575968
tags question: http://stackoverflow.com/q/27555582
tags question: http://stackoverflow.com/q/27593080
tags question: http://stackoverflow.com/q/27577289
tags question: http://stackoverflow.com/q/27560772
tags question: http://stackoverflow.com/q/27490371
tags question: http://stackoverflow.com/q/27572690
tags question: http://stackoverflow.com/q/27486394
tags question: http://stackoverflow.com/q/27515747
tags question: http://stackoverflow.com/q/27583419
tags question: http://stackoverflow.com/q/27508525
tags question: http://stackoverflow.com/q/27557330
tags question: http://stackoverflow.com/q/27636030
tags question: http://stackoverflow.com/q/27613331
tag name: user-interface
tags question: http://stackoverflow.com/q/27609167
tags question: http://stackoverflow.com/q/27491476
tags question: http://stackoverflow.com/q/27496079
tags question: http://stackoverflow.com/q/27600224

http://stackoverflow.com/comment/43688543
has text: Guava *does* have support for this operation, fairly heavily optimized, in BigIntegerMath.factorial.
comment on: http://stackoverflow.com/a/27633859
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27541560
has answer: http://stackoverflow.com/a/39887602
tagged with: excel
possible better answer: http://stackoverflow.com/a/41258542
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41258542
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27542530
accepted answer: http://stackoverflow.com/a/27542530
tagged with: apache
has body: I am able to create a table in Apache POI in word ,my table is coming with proper value but what i want i want to decrease the cell size of the column size in the table how to do that ,please help..Here is what i have done upto XWPFTable table = document.createTable(5,3); r3.setText("MSH Activity Score Card"); r3.setBold(true); //creating first row table.getRow(0).getCell(1).setText("Job ID#"); table.getRow(0).getCell(2).setText("1362"); //creating second row table.getRow(1).getCell(1).setText("Job Title#"); table.getRow(1).getCell(2).setText("Global Network Architect Consultant"); //creating third row table.getRow(2).getCell(1).setText("Client"); table.getRow(2).getCell(2).setText("Carnival Corporation"); //creating fourth row table.getRow(3).getCell(1).setText("Start Date"); table.getRow(3).getCell(2).setText("11/13/2014"); //creating fifth row table.getRow(4).getCell(1).setText("Days Old"); table.getRow(4).getCell(2).setText("33"); CTTblWidth width = table.getCTTbl().addNewTblPr().addNewTblW(); width.setType(STTblWidth.DXA); width.setW(BigInteger.valueOf(1500)); I am getting a table with data but i want to minimize the size But i want this size
answer count: 3
upvote count: 1
favorite count: 0
tagged with: apache-poi
has title: How to format cell in XWPFTable in Apache POI

http://stackoverflow.com/a/27634425
score: 2
accepted answer of: http://stackoverflow.com/q/27634234
has body: First of all read Oracle docs on exists. And getAbsoluteFile. Answer yourself what does getAbsoluteFile do? Then answer yourself do you need to get the absolute form of of your folder abstract pathname? Does it help you in anything? If not, use simpliest easy to write easy to read method folder.exists(). In coding we are always trying not to do unneccesary thing, to keep our code fast, clean, readable, easy to understand and update.
answers question: http://stackoverflow.com/q/27634234
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/27637389
answers question: http://stackoverflow.com/q/27636550
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: ![0-9a-zA-Z.]+!=+&gt;[a-zA-Z\s]+&lt;=+([\s\S]*?)(?=\+[0-9a-zA-Z.\s]+=+) Try this.Grab the capture or group 1 .See demo. https://regex101.com/r/gQ3kS4/37

dagger
tags question: http://stackoverflow.com/q/27485669
tag name: dagger
type: Tag
tags question: http://stackoverflow.com/q/27506715
tags question: http://stackoverflow.com/q/27600245

http://stackoverflow.com/q/27602264
favorite count: 0
upvote count: 2
score: -4
tagged with: multithreading
has body: I have two question that are confusing me. I am not professional in java Q1. Two threads A and B hit two different synchronized methods in an object at the same time. Will they both continue? Which of the following option gives the valid outcome for the above question? a. Yes, because the methods are synchronized. b. No, only one method can acquire the lock. c. No, because the methods are synchronized. d. Yes, two different threads hit Q2. wait, notify and notifyAll methods are not called on Thread, they are called on Object . True or false?
accepted answer: http://stackoverflow.com/a/27607761
downvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43627193
tagged with: java
type: Question
has title: When can threads enter synchronised methods?
possible better answer: http://stackoverflow.com/a/27602317
has answer: http://stackoverflow.com/a/27602317
has answer: http://stackoverflow.com/a/27607761
answer count: 2

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/27578757
tags question: http://stackoverflow.com/q/27627000

http://stackoverflow.com/comment/43461616
has text: Well, looks like you have to check one more time in the database you're using. JDBC doesn't throw these errors on purpose.
comment on: http://stackoverflow.com/q/27509574
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43570536
type: QuestionComment
has text: Every answer creates a LOCAL `UserProfile` when the button is clicked. Modify any of these `actionPerformed` method and replace the local `UserProfile` with a global one. How do you expect to use the user profile if the scope is local? Once the method execution concludes, the profile will be garbage collected.
comment on: http://stackoverflow.com/q/27571996
score: 0
type: Comment

http://stackoverflow.com/comment/77980333
type: Comment
has text: Stream of single item does work for me. What kind of error do you see? Could you post code that you tried?
comment on: http://stackoverflow.com/a/38574499
type: AnswerComment
score: 0

http://stackoverflow.com/q/27482528
has answer: http://stackoverflow.com/a/27482631
score: 2
type: AnsweredQuestion
has body: I have to edit the list of String: Delete the value if it contains "h" letter; Do nothing if it contains "h" and "o" Add to the list duplicate of the value if it contains letter "o". I stuck on a step of making a duplicate. What is wrong? And why occurs? Here is the code: public class MyClass { public static void main(String[] args) throws Exception { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("hi"); // this one have to be removed list.add("hello"); // this one have to be left without changes list.add("ops"); // duplicate must be added to the list list = fix(list); for (String s : list) { System.out.println(s); } } public static ArrayList&lt;String&gt; fix(ArrayList&lt;String&gt; list) { for (int i = 0; i &lt; list.size(); i++) { if (list.get(i).contains("h") &amp;&amp; list.get(i).contains("o")) ; // do nothing else if (list.get(i).contains("h")) list.remove(i); else if (list.get(i).contains("o")) { // The problem is here ===&gt; list.add(i + 1, list.get(i)); } } return list; } } I also tried: String s = new String(list.get(i)); list.add(i+1, s);
tagged with: java
has comment: http://stackoverflow.com/comment/43397653
possible better answer: http://stackoverflow.com/a/27482631
type: Question
upvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/43397672
tagged with: arraylist
has answer: http://stackoverflow.com/a/27482850
has answer: http://stackoverflow.com/a/27482637
has answer: http://stackoverflow.com/a/27482601
accepted answer: http://stackoverflow.com/a/27482601
answer count: 5
has answer: http://stackoverflow.com/a/27482678
has comment: http://stackoverflow.com/comment/43397690
downvote count: 0
has title: How to add duplicate values into the ArrayList?

http://stackoverflow.com/q/27625734
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/55861083
type: Question
has body: I'm trying to integrate "Material desing" to my application, but I have problem with appcompat. This error apears when I create new app (without any changes) and the same problem is apearing in all apps, where I have included appcompat. Error: Error:Execution failed for task ':app:dexDebug'. &gt; com.android.ide.common.internal.LoggedErrorException: Failed to run command: D:\SDK\build-tools\21.1.2\dx.bat --dex --no-optimize --output D:\проги\Android SDK\errorshow\app\build\intermediates\dex\debug --input-list=D:\проги\Android SDK\errorshow\app\build\intermediates\tmp\dex\debug\inputList.txt Error Code: 1 Output: UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.RuntimeException: D:\РїСЂРѕРіРё\Android SDK\errorshow\app\build\intermediates\classes\debug: file not found at com.android.dex.util.FileUtils.readFile(FileUtils.java:51) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:169) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:632) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106) UNEXPECTED TOP-LEVEL EXCEPTION: java.io.FileNotFoundException: D:\РїСЂРѕРіРё\Android SDK\errorshow\app\build\intermediates\pre-dexed\debug\support-annotations-21.0.3-7494050873a5e0db75d021ea98f22efdb2950fbf.jar (Системе не удается найти указанный путь) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) at java.util.zip.ZipFile.&lt;init&gt;(Unknown Source) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.dire…
has title: app:dexDebug error in Android Studio
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/46209647
favorite count: 0
linked to: http://stackoverflow.com/q/27500121
tagged with: android-studio
type: UnansweredQuestion
tagged with: android
downvote count: 0

http://stackoverflow.com/q/27500453
favorite count: 0
has comment: http://stackoverflow.com/comment/43432446
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43433066
tagged with: java
tagged with: defaultlistmodel
has body: I'm trying to write a simple chatroom GUI using java, including a Jlist to show the online users. first a user chooses a display name so that the name will be displayed in the JList. here is the code: (the problem is only inside the createServer() method which sends Name as an argument to the handler constructor, in order to display it in the JList!) public class GUI{ private JFrame frame; private JButton btnSend, btnConnect; private JTextArea txtChat; private JTextField fldText, fldName; private JList clientList; private DefaultListModel listModel; private JScrollPane sc, scClients; private JPanel jpS2All, jpS2Client, jpS2Text; private String Name; class handler implements ActionListener, MouseListener{ private String Name = null; void handler(String Name) { this.Name = Name; } @Override public void actionPerformed(ActionEvent e) { chatroom(); } @Override public void mouseClicked(MouseEvent e) { fldName.setText(""); listModel.addElement(Name); } } public void creatServer() { frame = new JFrame("login"); frame.setBounds(50, 50, 300, 200); btnConnect = new JButton("connect"); frame.add(btnConnect, BorderLayout.EAST); fldName = new JTextField("enter your name"); fldName.addMouseListener(new handler()); Name = fldName.getText(); btnConnect.addActionListener(new handler(Name)); frame.add(fldName, BorderLayout.CENTER); frame.setVisible(true); } public void chatroom() { frame = new JFrame("online friends"); frame.setBounds(100, 100, 400, 400); jpS2All = new JPanel(); txtChat = new JTextArea(); txtChat.setRows(25); txtChat.setColumns(25); txtChat.setEditable(false); sc = new JScrollPane(txtChat); jpS2All.add(sc); frame.add(jpS2All, BorderLayout.WEST); //////////////////////// jpS2Text = new JPanel(); fldText = new JTextField(); fldText.setColumns(34); fldText.setHorizontalAlignment(JTextField.RIGHT); jpS2Text.add(fldText); frame.add(jpS2Text, BorderLayout.SOUTH); ///////// jpS2Client = new JPanel(); listModel = new DefaultListModel(); clientList = new JList(listModel); cli…
answer count: 1
has answer: http://stackoverflow.com/a/27501367
score: 0
has title: adding users to JList in chatroom GUI
has comment: http://stackoverflow.com/comment/43432734
tagged with: jlist
accepted answer: http://stackoverflow.com/a/27501367

http://stackoverflow.com/q/27520024
type: Question
tagged with: firefox
answer count: 1
tagged with: javascript
score: 0
accepted answer: http://stackoverflow.com/a/27520373
tagged with: selenium
has body: I am trying to automate few web pages i.e. Case creation, Accounts and Contacts creation through my developer login at www.salesforce.com. I am using Mozilla Firefox 34.0.5 alongwith Eclipse Luna and Java for automation using Selenium WebDriver. I am also using JExcel API for reading data from excel file in hard disk. System Specifications are Windows7 Ultimate 32 bit. My automation code is working fine with Google Chrome but in Firefox certain fields on webpage such as dropdown menu Boxes, popup windows &amp; switching control to new popup window are not working. I have not found any solution to this problem. I can't understand the reason for failure of selenium command : "selectByVisibleText(String)". The dropdown menu list is displayed and the specified option is also highlighted but then click/select action is aborted and default value is selected. With popup windows, selenium command : "driver.switchTo().window(windowhandle)" is not working. New pop window opens and window handle is generated but the error displayed is "Unable to locate window {window Handle String}". I can't figure out why it can't locate the window by window handle and switch to it in firefox if it works fine in other browsers ?? Below is my Complete Code public class PoiExcelCase { WebDriver driver; FileInputStream fis; HSSFWorkbook wb; HSSFSheet sh; @BeforeTest public void login() throws BiffException, IOException { driver = new FirefoxDriver(); //System.setProperty("webdriver.chrome.driver", "D:/chromedriver_win32/chromedriver.exe"); //driver = new ChromeDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); fis = new FileInputStream(new File("D:/Salesforce.xls")); wb = new HSSFWorkbook(fis); sh = wb.getSheet("Sheet1"); driver.navigate().to("http://www.salesforce.com/in/?ir=1"); driver.findElement(By.xpath(".//*[@id='button-login']")).click(); driver.findElement(By.xpath(".//*[@id='username']")).sendKeys(sh.getRow(1).getCell(0).getSt…
has title: Dropdown Menu and switch to new Window in Selenium Webdriver not working in Firefox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27520373
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/43445627
score: 2
comment on: http://stackoverflow.com/q/27507754
has text: Be sure to include a clear "question" in your post.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27539027
has title: Trouble accessing database from class for turn based multiplayer
tagged with: java
accepted answer: http://stackoverflow.com/a/27541823
type: Question
answer count: 1
has body: I am using google's turn based multiplayer api. In the turn data class I am trying to access my sqlite database in order to put the information that needs to be passed to the next player in a byte array. Here is the turn data class: public class BattleTurnData extends Activity { public static final String TAG = "EBTurn"; public String gameData = ""; public int turnCounter; public static Context passedContext; public BattleTurnData(Context context) { passedContext = context; } // This is the byte array we will write out to the TBMP API. public byte[] persist() { //SharedPreferences prefs = getSharedPreferences("Buildings", MODE_PRIVATE); Database data = new Database(this); data.open(); //int colonyHutOneID = prefs.getInt("NewColonyHutOne", 0); int colonyHutOneLevel = data.getColonyHutOneLevel(); int colonyHutOneHealth = data.getColonyHutOneHealth(); int colonyHutTwoLevel = data.getColonyHutTwoLevel(); int colonyHutThreeLevel = data.getColonyHutThreeLevel(); int colonyHutFourLevel = data.getColonyHutFourLevel(); int colonyHutFiveLevel = data.getColonyHutFiveLevel(); data.close(); JSONObject retVal = new JSONObject(); try { retVal.put("data", gameData);//colonyHutOneID + colonyHutOneLevel + colonyHutOneHealth + colonyHutTwoLevel); retVal.put("turnCounter", turnCounter); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } String st = retVal.toString(); Log.d(TAG, "==== PERSISTING\n" + st); return st.getBytes(Charset.forName("UTF-16")); } // Creates a new instance of BattleTurn. static public BattleTurnData unpersist(byte[] byteArray) { if (byteArray == null) { Log.d(TAG, "Empty array---possible bug."); return new BattleTurnData(passedContext); } String st = null; try { st = new String(byteArray, "UTF-16"); } catch (UnsupportedEncodingException e1) { e1.printStackTrace(); return null; } Log.d(TAG, "====UNPERSIST \n" + st); BattleTurnData retVal = new BattleTurnData(passedContext); try { JSONObject obj = new JSONObject(st); if (obj.has("d…
score: 0
tagged with: android
tagged with: sqlite
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/27541823
tagged with: google-api
type: AnsweredQuestion

http://stackoverflow.com/comment/43531063
score: 0
type: QuestionComment
has text: @GáborBakos that seems to be the case.
type: Comment
comment on: http://stackoverflow.com/q/27552373

http://stackoverflow.com/comment/43614683
comment on: http://stackoverflow.com/q/27595454
score: 4
has text: did you actually allocate a depth buffer on startup?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43662109
has text: I'm getting `ChildType table not found` if I use `@Inheritance(strategy = InheritanceType.JOINED)` if I replace with `@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)` the error goes away
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27613154

http://stackoverflow.com/q/27612799
has body: I'm getting some weird errors which seem to eb the result of a missing library, though I can't figure out where it's missing from as all the guides I've seen don't seem to be including anything I'm missing. I've included the AspectJ jars and I'm compiling with ajc through IntelliJ. Error:ajc: can't determine annotations of missing type javax.cache.annotation.CacheRemove when weaving type com.webbilly.dao.hibernate.GenericDAO when weaving classes when weaving when batch building BuildConfig[null] #Files=10 AopXmls=#0 [Xlint:cantFindType] Here it specifies javax.cache.annotation.CacheRemove, but there are other files as well that are missing that I attempted to band-aid with a package from java2s, but it's still missing this one.
has comment: http://stackoverflow.com/comment/55270227
tagged with: java
type: Question
tagged with: aspectj
answer count: 1
accepted answer: http://stackoverflow.com/a/27612902
favorite count: 0
has answer: http://stackoverflow.com/a/27612902
score: 2
upvote count: 3
downvote count: 1
has title: Missing javax.cache.annotation package when compiling with AspectJ
type: AnsweredQuestion

http://stackoverflow.com/q/27518484
has answer: http://stackoverflow.com/a/27541991
has title: spring boot security custom login form
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/48224959
upvote count: 1
tagged with: spring-boot
score: 1
tagged with: java
has body: I am trying to create my own custom login form using spring boot security: org.springframework.boot spring-boot-starter-security 1.1.9.RELEASE In the front-end side I created this login form: @ PWD In the back-end: @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests().antMatchers("/", "/index.html", "/bootstrap/**", "/jquery/**").permitAll() .anyRequest().authenticated().and().formLogin() .loginPage("/login.html").passwordParameter("password").usernameParameter("username") .permitAll() .and().logout() .permitAll(); } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER"); } } I took some ideas from this post: http://www.mkyong.com/spring-security/spring-security-form-login-example And my problem is when I login it never redirects me to the previously requested page and continously displays in the login form. Thanks in advance for your support.
type: Question
has comment: http://stackoverflow.com/comment/139401003
downvote count: 0
has answer: http://stackoverflow.com/a/35679700
tagged with: spring-security
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/43687258
type: Comment
comment on: http://stackoverflow.com/a/27633079
has text: Thanks for help eddie, **but i'm not trying to edit two different windows** . I'm trying to avoid unnecessary navigation between pages of a web app within the same window
score: 0
type: AnswerComment

http://stackoverflow.com/a/27603689
answers question: http://stackoverflow.com/q/27603527
score: 3
has body: You have class CalculatorGUI { KeyHandler keyboard = new KeyHandler(); } class KeyHandler { CalculatorGUI elo = new CalculatorGUI(); } Creating a new CalculatorGUI creates a new KeyHandler, which creates a new CalculatorGUI, which creates a new KeyHandler, which creates a new CalculatorGUI, which creates a new KeyHandler, which creates a new CalculatorGUI, which creates a new KeyHandler, ... StackOverflow
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43642460
accepted answer of: http://stackoverflow.com/q/27603527
type: Answer
has comment: http://stackoverflow.com/comment/43629716
upvote count: 3

jakarta-ee
tags question: http://stackoverflow.com/q/27615255
tags question: http://stackoverflow.com/q/27562288
tags question: http://stackoverflow.com/q/27536196
tags question: http://stackoverflow.com/q/27487441
tags question: http://stackoverflow.com/q/27563155
tags question: http://stackoverflow.com/q/27599910
tags question: http://stackoverflow.com/q/27564551
type: Tag
tags question: http://stackoverflow.com/q/27588665
tags question: http://stackoverflow.com/q/27553217
tags question: http://stackoverflow.com/q/27525968
tags question: http://stackoverflow.com/q/27528139
tags question: http://stackoverflow.com/q/27564411
tags question: http://stackoverflow.com/q/27582083
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/27574855
tags question: http://stackoverflow.com/q/27486648
tags question: http://stackoverflow.com/q/27596576
tags question: http://stackoverflow.com/q/27616997
tags question: http://stackoverflow.com/q/27522734
tags question: http://stackoverflow.com/q/27492590
tags question: http://stackoverflow.com/q/27567511
tags question: http://stackoverflow.com/q/27618719
tags question: http://stackoverflow.com/q/27502509
tags question: http://stackoverflow.com/q/27515201
tags question: http://stackoverflow.com/q/27582621
tags question: http://stackoverflow.com/q/27568633
tags question: http://stackoverflow.com/q/27538123
tags question: http://stackoverflow.com/q/27515262
tags question: http://stackoverflow.com/q/27519075
tags question: http://stackoverflow.com/q/27550663
tags question: http://stackoverflow.com/q/27589845
tags question: http://stackoverflow.com/q/27527955
tags question: http://stackoverflow.com/q/27538567
tags question: http://stackoverflow.com/q/27582962
tags question: http://stackoverflow.com/q/27561696
tags question: http://stackoverflow.com/q/27617763
tags question: http://stackoverflow.com/q/27637077
tags question: http://stackoverflow.com/q/27581017
tags question: http://stackoverflow.com/q/27506727
tags question: http://stackoverflow.com/q/27579686
tags question: http://stackoverflow.com/q/27507392
tags question: http://stackoverflow.com/q/27623037
tags question: http://stackoverflow.com/q/27480587
tags question: http://stackoverflow.com/q/27619121
tags question: http://stackoverflow.com/q/27568407
tags question: http://stackoverflow.com/q/27512569
tags question: http://stackoverflow.com/q/27541349
tags question: http://stackoverflow.com/q/27623929
tags question: http://stackoverflow.com/q/27628681
tags question: http://stackoverflow.com/q/27485111

http://stackoverflow.com/comment/43391330
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27478888
has text: you need to create a class responsible for updating the file, and use `synchronized ` for the methods you need to lock, check `Siva Kumar's` answer below

servlet-filters
tags question: http://stackoverflow.com/q/27481847
type: Tag
tags question: http://stackoverflow.com/q/27527751
tag name: servlet-filters
tags question: http://stackoverflow.com/q/27568522

http://stackoverflow.com/comment/43748128
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27628319
type: Comment
has text: So what do I need to fix? I can't use ShortBuffer, but using IntBuffer doesn't work, and I need it to

http://stackoverflow.com/comment/43495355
comment on: http://stackoverflow.com/q/27532645
score: 0
type: Comment
type: QuestionComment
has text: @LouisWasserman: Actually that need must be implemented using a separated character buffer (raw), not by the (coded) byte buffer.

http://stackoverflow.com/comment/43448438
score: 0
type: Comment
has text: @user3650191 depends what do you want to do into your `AsyncTask`
comment on: http://stackoverflow.com/a/27508782
type: AnswerComment

http://stackoverflow.com/q/27618981
has answer: http://stackoverflow.com/a/27622151
tagged with: android
has comment: http://stackoverflow.com/comment/43658925
tagged with: encryption
has comment: http://stackoverflow.com/comment/43660676
accepted answer: http://stackoverflow.com/a/27622151
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/11418336
has body: I am playing around with saving/loading a text file in Android, works fine. Next step is to encrypt and decrypt with AES. I can call the encrypt() method within the writetofile method,a dn that works fine. If i call the readfromfile method, I can see the ciphertext is retrieved, great. But decryption isnt working for me - I have called simplecrypo in a few places - on stringBuffer.toString(), and within the StringBuffer's append() method - but both crash the application. So does anybody know where I am supposed to decrypt the string within the file? package com.example.filesdemo; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { private EditText etInput; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); etInput = (EditText) findViewById(R.id.etInput); } public void writeToFile(View v) throws Exception { try { String inputStr = etInput.getText().toString(); //encrypt the string - works! String encrypted = SimpleCrypto.encrypt("testkey", inputStr); FileOutputStream fos = openFileOutput("myfile.txt", MODE_PRIVATE); fos.write(encrypted.getBytes()); fos.flush(); fos.close(); Toast.makeText(this, "File saved!", Toast.LENGTH_SHORT).show(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void readFromFile(View v) throws Exception{ try { FileInputStream fis = openFileInput("myfile.txt"); StringBuffer stringBuffer = new StringBuffer(); BufferedReader bReader = new BufferedReader(new InputStreamReader( fis)); String strLine = null; while ((strLine = bReader.readLine()) != null) { stringBuffer.appe…
has title: decryption issue in java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/43875998
has text: Apologies for causing trouble over your brilliant library sir :) I still couldn't get it to work, pardon me. My library is set to the default min and target as you set before distributing and my project is set at min 14 and target 18. It should work yeah? It's still throwing those errors I mentioned in the question. I added that dependency to the library's gradle as well. Even without adding the library as a reference to my project, the library itself is marked with those errors and hence I can't build the library either. What could be causing this issue?
type: Comment
comment on: http://stackoverflow.com/a/27635369
score: 0
type: AnswerComment

swiperefreshlayout
type: Tag
tags question: http://stackoverflow.com/q/27541006
tag name: swiperefreshlayout

http://stackoverflow.com/comment/43632386
has text: i did it but i am getting the same result first entity is again repeated
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27605070
type: Comment

http://stackoverflow.com/comment/43556170
type: QuestionComment
comment on: http://stackoverflow.com/q/27565366
type: Comment
has text: @Joachim: Ya I have imported. What do you mean by exception during static initialization of class TestB
score: 0

http://stackoverflow.com/comment/43401262
comment on: http://stackoverflow.com/q/27484553
has text: This happening because our onFinish() is calling.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/27503136
upvote count: 4
has body: Put this maven assembly plugin in your pom.xml: maven-assembly-plugin package single jar-with-dependencies true de.my.path.MainClass
type: Answer
answers question: http://stackoverflow.com/q/27503047
downvote count: 1
score: 3

http://stackoverflow.com/comment/43551367
score: 8
has text: This question appears to be off-topic because it belongs on code review.
comment on: http://stackoverflow.com/q/27562828
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27575067
has body: I have a java Set and I can't change it to a TreeSet although i could copy it over. Here is the issue: I have names , tower, car, building , office , basement. I have a POJO which has a string label variable containing one of these for each instance. how can i sort these to be the EXACT order of tower, car, building , office , basement. There will be no duplicates allowed of course(its a set). public class Places{ String label; int moreinfo; } so imagine I have 10 Places objects with labels that could be any of tower, car, building , office , basement: how can I sort these in a set to ensure that they are in the exact order of "tower, car, building , office , basement" ?
has title: Java Set - how to sort based on a list of names
tagged with: set
tagged with: collections
possible better answer: http://stackoverflow.com/a/27575296
type: Question
has answer: http://stackoverflow.com/a/27575296
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27575351
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/43575614
tagged with: sorting
score: 0
accepted answer: http://stackoverflow.com/a/27575351

http://stackoverflow.com/q/27585345
has comment: http://stackoverflow.com/comment/43595391
score: -2
downvote count: 2
has body: i modified the code and the same output no circle when i click the mouse public class gui extends JFrame{ Scanner scan = new Scanner(System.in); private final JPanel mousepanal; private final JLabel stutespar ; int x=0; int y=0; public gui() { super("title"); mousepanal = new JPanel(); mousepanal.setBackground(Color.WHITE); add(mousepanal,BorderLayout.CENTER); add(edffnmlsdfkj,BorderLayout.WEST); stutespar = new JLabel(); add(stutespar,BorderLayout.SOUTH); Handlerclass handler = new Handlerclass(); Paintcir p = new Paintcir(); mousepanal.addMouseListener(handler); mousepanal.addMouseMotionListener(handler); } /////////////////////////// private class Handlerclass extends JPanel implements MouseListener,MouseMotionListener{ @Override public void mouseClicked(MouseEvent e) { stutespar.setText(String.format("clicked at %d %d",e.getX(),e.getY())); x=e.getX(); y=e.getY(); how to call repaint()? repaint(); } ///////////////////////////////////////////////////////////// @Override public void mousePressed(MouseEvent e) { stutespar.setText("you bress mouse"); } @Override public void mouseReleased(MouseEvent e) { stutespar.setText("mouse realse"); } @Override public void mouseEntered(MouseEvent e) { stutespar.setText("you entered the mouse"); // mousepanal.setBackground(Color.RED); } @Override public void mouseExited(MouseEvent e) { stutespar.setText("exsitd"); // mousepanal.setBackground(Color.WHITE); } @Override public void mouseDragged(MouseEvent e) { stutespar.setText("dragged"); } @Override public void mouseMoved(MouseEvent e) { stutespar.setText("moved"); } ////////////////////////////////////////// @Override public void paintComponent(Graphics g) { super.paintComponents(g); this.setBackground(Color.yellow); g.setColor(Color.green); g.fillOval(x, y, 40, 40); // g.fillOval(x+50, y+100, 40, 40); } } } this is the main class public class Main extends JFrame { public static void main(String[] args) { gui g = new gui(); g.setDefaultCloseOperation(EXIT_ON_CLOSE); g.setSize(50…
answer count: 1
has title: Draw circle to tha location i clicked doesn't work
has comment: http://stackoverflow.com/comment/43595307
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43595489
has answer: http://stackoverflow.com/a/27586279
upvote count: 0
has comment: http://stackoverflow.com/comment/43595367
tagged with: java
has comment: http://stackoverflow.com/comment/43595260
type: Question

http://stackoverflow.com/a/27585545
downvote count: 0
answers question: http://stackoverflow.com/q/27585484
upvote count: 2
has body: n.getInfo() could be declared to return, for example, Object Clearly if this was the case, it would be the same as saying: Object blah = n.getInfo(); Token abc = blah; And that wouldn't work. To fix it, you would need: Token abc = (Token)blah;
type: Answer
score: 2

http://stackoverflow.com/comment/43607924
has text: I'll have to disappoint you, because it really really is the reason. Add some debug printing: the dimensions of the image, and the coordinates you want to crop.
type: Comment
comment on: http://stackoverflow.com/a/27592048
score: 2
type: AnswerComment

http://stackoverflow.com/a/27627651
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27627609
accepted answer of: http://stackoverflow.com/q/27627609
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try to commit the transaction before closing the connection. Do this instead: conn.commit() before conn.close()

http://stackoverflow.com/a/27733099
has comment: http://stackoverflow.com/comment/44394376
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27611838
accepted answer of: http://stackoverflow.com/q/27611838
has comment: http://stackoverflow.com/comment/44556413
has comment: http://stackoverflow.com/comment/44389853
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/44400307
has body: A separate SOAPAction header is used only in SOAP 1.1. In SOAP 1.2, the action is expected to be set as a parameter in the Content-Type header, and as you have seen, Spring-WS contains the necessary code to set that parameter. If that parameter is lost, then it is most likely an issue with SAAJ. I've seen that issue with the SAAJ implementation in Java 1.6. A workaround is to package a more recent SAAJ version with your application. If that still doesn't help, then your only option is to do some debugging to figure out where the Content-Type header is reset.

http://stackoverflow.com/comment/43497340
type: QuestionComment
has text: @LoudiWasserman That need concerns input: this question is about output.
comment on: http://stackoverflow.com/q/27532645
score: 0
type: Comment

http://stackoverflow.com/comment/43620009
type: AnswerComment
type: Comment
has text: I have updated the answer with a fix. But who the heck downvoted my answer which correctly analysed the root cause of the problem?!
comment on: http://stackoverflow.com/a/27598170
score: 0

http://stackoverflow.com/a/27523763
downvote count: 0
answers question: http://stackoverflow.com/q/27523604
score: 1
has body: It's not incorrect since that's what the method actually throws, and since it's a RuntimeException (i.e. unchecked), it doesn't matter, since you don't have to catch it at all. Now, if it was a checked exception : public char someMethod (int index) throws SomeCheckedException { if (index &lt; 0) { throw new SomeSubCheckedException (index); // subclass of SomeCheckedException } return something; } Here, if you call someMethod in a try block and only catch SomeSubCheckedException, the code won't pass compilation, since, as far as the compiler is concerned, someMethod may throw an instance of SomeCheckedException which is not SomeSubCheckedException.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/43556221
comment on: http://stackoverflow.com/q/27565611
score: 0
has text: I think, it's all about `static` method for creating objects. Something like `Paths.get` for standard library.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27602031
tagged with: java
has comment: http://stackoverflow.com/comment/43659992
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/21062102
answer count: 2
downvote count: 0
tagged with: logback
score: 4
tagged with: tomcat
tagged with: slf4j
has answer: http://stackoverflow.com/a/27624266
accepted answer: http://stackoverflow.com/a/27624266
has answer: http://stackoverflow.com/a/27619722
has title: Spring logs not coming machine specific
has comment: http://stackoverflow.com/comment/43629500
has body: I am using a spring maven tomcat8 java8 stack. The problem I am facing is that logs are not getting generated on certain machines. I am using slf4j-logback combination for logging. The problem has surfaced when I am trying to move my stack from java7 to java8. Here is my logback.xml: <?xml version="1.0" encoding="UTF-8"?> /var/log/dal/dal.log /var/log/dal/dal-%d{yyyy-MM-dd}.log.gz 30 true [%d{HH:mm:ss.SSS} %thread %-5level %C:%L] %msg%n [%d{HH:mm:ss.SSS} %thread %-5level %C:%L] %msg%n API Logs - Error while sending notification [%d{HH:mm:ss.SSS} %thread %-5level %C:%L] %msg%n <appender-ref ref="dal" /> <appender-ref ref="STDOUT" /> Using this, I expect to get logs at two places, at custom location /var/log/dal/dal.log and in catalina.out Here are a few relevant details of the server where logs are getting generated: OS: apache-tomcat-8.0.15 $ uname -a Linux azi 3.2.0-74-generic #109-Ubuntu SMP Tue Dec 9 16:45:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux MVN: apache-tomcat-8.0.15 $ mvn -version Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1024m; support was removed in 8.0 Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.8.0_25, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-8-oracle/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.2.0-74-generic", arch: "amd64", family: "unix" Tomcat: apache-tomcat-8.0.15 $ bin/version.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.15 Using CATALINA_HOME: /opt/apache-tomcat-8.0.15 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.15/temp Using JRE_HOME: /usr/lib/jvm/java-8-oracle/ Using CLASSPATH: /opt/apache-tomcat-8.0.15/bin/bootstrap.jar:/opt/apache-tomcat-8.0.15/bin/tomcat-juli.jar Server version: Apache Tomcat/8.0.15 Server built: Nov 2 2014 19:25:20 UTC Server number: 8.0.15.0 OS Name: Linux OS Version: 3.2.0-74-generic Architecture: amd64 JVM Version: 1.8.0_25-b17 JVM Vendor: Oracle Corporation JAVA: apache-tomcat-8.0.15 $ java -version java version "…
has comment: http://stackoverflow.com/comment/43637923
favorite count: 0
has comment: http://stackoverflow.com/comment/43632818
has comment: http://stackoverflow.com/comment/43634149
tagged with: java-8
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27619722

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/27483196

http://stackoverflow.com/a/27541823
has comment: http://stackoverflow.com/comment/43536686
has comment: http://stackoverflow.com/comment/43536665
accepted answer of: http://stackoverflow.com/q/27539027
type: Answer
has comment: http://stackoverflow.com/comment/43536200
answers question: http://stackoverflow.com/q/27539027
score: 2
has comment: http://stackoverflow.com/comment/43536944
has comment: http://stackoverflow.com/comment/43536507
upvote count: 2
has body: You've passed a null or otherwise invalid Context to your SQLiteOpenHelper constructor. Looking at the stacktrace and your code, BattleTurnData extends Acitivity and explicit constructor BattleTurnData(Context context) looks suspicious. You cannot instantiate activities with new and the activities instantiated by the framework don't have constructors taking arguments. Therefore the this reference of that class is not a valid Context. Looks like BattleTurnData should not be an activity but a regular class. Pass in a Context as an argument to methods that need it.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43608140
has text: I need not foreach, I need direct access by key
comment on: http://stackoverflow.com/a/27592143
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43473084
type: QuestionComment
has text: I could do this by setting on checkchanged listener on each radio Button too. But i want to know if there is any trick i can do in xml to make that possible.
comment on: http://stackoverflow.com/q/27521871
score: 0
type: Comment

variables
tag name: variables
tags question: http://stackoverflow.com/q/27498404
tags question: http://stackoverflow.com/q/27639109
type: Tag
tags question: http://stackoverflow.com/q/27543631
tags question: http://stackoverflow.com/q/27583390
tags question: http://stackoverflow.com/q/27634599
tags question: http://stackoverflow.com/q/27517529
tags question: http://stackoverflow.com/q/27481139

session
tags question: http://stackoverflow.com/q/27529978
tags question: http://stackoverflow.com/q/27514138
tags question: http://stackoverflow.com/q/27542762
tags question: http://stackoverflow.com/q/27527751
type: Tag
tags question: http://stackoverflow.com/q/27508840
tags question: http://stackoverflow.com/q/27565818
tags question: http://stackoverflow.com/q/27543386
tags question: http://stackoverflow.com/q/27569661
tags question: http://stackoverflow.com/q/27522716
tags question: http://stackoverflow.com/q/27516425
tags question: http://stackoverflow.com/q/27620147
tags question: http://stackoverflow.com/q/27616501
tags question: http://stackoverflow.com/q/27485922
tags question: http://stackoverflow.com/q/27586683
tags question: http://stackoverflow.com/q/27542627
tag name: session
tags question: http://stackoverflow.com/q/27482634

http://stackoverflow.com/comment/43609071
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27592700
has text: By convention class names start with a capital letter.
type: Comment

http://stackoverflow.com/a/27517066
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/27516719
has body: I have a Thread that will run a third party lib which also will run their own Threads. @Lawrence Dol's answer explains that you can use ThreadGroup to traverse the group tree and find all live threads ... provided your application is not sandboxed. You then have the problem of figuring out which threads belong to the 3rd-party library, but there is a good chance that you can do this heuristically; e.g. based on thread names. But the point I want to make is that a library that fires up background threads to do work, and provides no way to wait for the work to finish is poorly designed: I'd look at the API spec for the library to see if it already provides its own solution to this; e.g. a "shutdown" method that waits for the worker threads to finish. If not, then contact the library maintainers and ask them how to deal with the situation. The "workaround" with thread groups is a fragile hack. If that doesn't yield results, and if the library is open source, consider coding up an API enhancement and submitting it as a patch.
score: 4

http://stackoverflow.com/q/27502509
favorite count: 0
has body: I define the following entities :BaseEntity , magasin and article : @Entity(name = "magasin") @Table(name = "magasin") public class Magasin extends BaseEntity { private static final long serialVersionUID = 1L; @Basic @Size(min=5, max=100, message="The name must be between {min} and {max} characters") private String name; @OneToMany(cascade=CascadeType.ALL, mappedBy="magasin") @Valid private Set&lt;Article&gt; article; public String getName() { return name; } public void setName(String name) { this.name = name; } public Set&lt;Article&gt; getArticle() { return article; } public void setArticle(Set&lt;Article&gt; article) { this.article = article; } } @Entity(name="article") @Table(name="article") public class Article extends BaseEntity { private static final long serialVersionUID = 1L; @ManyToOne private Magasin magasin; @Basic @Size(min=5, max=100, message="The name must be between {min} and {max} characters") private String name; @Basic private float price; public Magasin getMagasin() { return magasin; } public void setMagasin(Magasin magasin) { this.magasin = magasin; } public String getName() { return name; } public void setName(String nom) { this.name = nom; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } } @MappedSuperclass public class BaseEntity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; public void setId(Integer id) { this.id = id; } public Integer getId() { return id; } public boolean isNew() { return (this.id == null); } I try to add a new entity bit it didn't work .No new entity will be inserted .there is no error .How can I modify it in order to add a new entity for article ? Function from GenericDao public T add(T entity) { System.out.println("start"); getHibernateTemplate().save(entity); System.out.println("end"); return entity; } Flex Main private function submitData(event:Event):void { var article_ajout=new Article(); article_ajout.name=pop1.art_name.text; article_…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43435515
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43435590
downvote count: 1
has title: add a new entity -One-To-Many relation
type: Question
tagged with: jakarta-ee
score: 0

http://stackoverflow.com/q/27584161
has answer: http://stackoverflow.com/a/32677962
linked to: http://stackoverflow.com/q/31522414
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/43608726
upvote count: 7
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/32677962
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/43605533
has title: Read another parameter within jersey's ParamConverter
type: Question
has comment: http://stackoverflow.com/comment/43604458
tagged with: jersey
answer count: 1
tagged with: jersey-2.0
downvote count: 0
has body: I've made a ParamConverter which provides an Instant (Date) when given a string formatted as either Instant's native ISO-8601, or as an integer number of milliseconds since the epoch. This is working fine, but I also need to be able to support other date formats (the customers are fussy). To avoid the classic dd/mm/yyyy vs mm/dd/yyyy ambiguity, I'd like to have the customer specify their preferred format as part of the request*. e.g: GET http://api.example.com/filter?since=01/02/2000&amp;dateformat=dd/mm/yyyy passed to a method which looks like: @GET String getFilteredList( final @QueryParam( "since" ) Instant since ) { ... } (time &amp; timezone parts omitted for clarity) So I'd like my ParamConverter&lt;Instant&gt; to be able to read the dateformat parameter. I've been able to use a combination of a filter which sets a ContainerRequestContext property and an AbstractValueFactoryProvider to do something similar, but that needs the parameter to have a custom annotation applied and doesn't let it work with QueryParam/FormParam/etc., making it far less useful. Is there any way to get other parameters, or the request object itself, from inside a ParamConverter? [*] In the real world this would be from a selection of pre-approved formats, but for now just assume they're providing the input to a DateTimeFormatter For clarity, here's the code I have: public class InstantParameterProvider implements ParamConverterProvider { private static final ParamConverter&lt;Instant&gt; INSTANT_CONVERTER = new ParamConverter&lt;Instant&gt;( ) { @Override public final T fromString( final String value ) { // This is where I would like to get the other parameter's value // Is it possible? } @Override public final String toString( final T value ) { return value.toString( ); } }; @SuppressWarnings( "unchecked" ) @Override public &lt;T&gt; ParamConverter&lt;T&gt; getConverter( final Class&lt;T&gt; rawType, final Type genericType, final Annotation[] annotations ) { if( rawType == Instant.clas…

http://stackoverflow.com/comment/43568141
score: 0
type: Comment
type: QuestionComment
has text: that other guy: please explain more, I have a timestamp for each quote object, how would you suggest I design it?
comment on: http://stackoverflow.com/q/27570896

http://stackoverflow.com/comment/43494991
comment on: http://stackoverflow.com/q/27533115
score: 0
type: Comment
type: QuestionComment
has text: What is your question?

http://stackoverflow.com/comment/43648151
score: 0
comment on: http://stackoverflow.com/q/27605301
type: QuestionComment
type: Comment
has text: http://developer.android.com/training/articles/perf-jni.html

http://stackoverflow.com/a/27539721
has body: My question (my need) is almost same as that in this thread: JSP tag file that either outputs its body or returns it in a variable However, the answers in this thread were related to writing the tag library code in a .tag file, which is new to me. All I know on writing a tag library is to code it as a java class. And that is why I created this thread. Nevertheless, I went ahead to take some hints/help from the above thread and made up my own solution: I used this line of text as my solution - I know that the caller can achieve this by wrapping the custom tag in a c:set, but this is less elegant than simply declaring a "var" Here is the code: &lt;c:set var="optin"&gt; &lt;i:scope type="paramData" scope="${scope}" paramNum="40100"/&gt; &lt;/c:set&gt; No changes done to the tag library java class..
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27478584
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/27478584
score: 2

http://stackoverflow.com/comment/43626258
comment on: http://stackoverflow.com/a/27571925
type: Comment
has text: I don't know on the performance, I would think that they should be similar. You'd need to try it out with your data.
score: 0
type: AnswerComment

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/27568903
type: Tag

http://stackoverflow.com/q/27572836
has answer: http://stackoverflow.com/a/27573034
type: Question
has body: I'm setting up a ListView with an onClickListener for each item. This is being setup in an AsyncTask, in the onPostExecute() function; Each item in the listview should launch an activity that views data set up in the intent. The data comes from an ArrayList of arbitrary length. All items in the ListView launch only the last item from the ArrayList. listViewAdapter = new ListViewAdapter(RegisterActivity.this, userNames, reporNames); localListView.setAdapter(listViewAdapter); for(final Object s : objects){ localListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long arg3) { final Intent localIntent = new Intent(RegisterActivity.this, ViewObjectActivity.class); localIntent.putExtra("id", s.getId()); localIntent.putExtra("permission", s.getPermission()); localIntent.putExtra("lattitude", s.getLattitude()); localIntent.putExtra("longitude", s.getLongitude()); startActivityForResult(localIntent, VIEW_SIT_REP_REQUEST); } }); } listViewAdapter is pretty straight forward. it's an extension of a BaseAdapter. I had this working when It was buttons in a linear layout, and it was an OnTouchListener. Don't know what I changed to break it, but working on it for 3 hours now. Any suggestions? Thanks in advance.
has answer: http://stackoverflow.com/a/27573068
tagged with: listview
tagged with: arraylist
answer count: 2
downvote count: 0
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/27573068
has title: OnClickListener for ListView with new Intent data from ArrayList for each onItemClick
type: AnsweredQuestion
score: 2
tagged with: onclicklistener
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/27573034

http://stackoverflow.com/comment/43407192
has text: what blue icon are you talking about?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27487805
type: Comment

http://stackoverflow.com/q/27628813
tagged with: java
has body: I had created the dynamic library for java using swig and cmake for learning purposes. I can't call a function in java from the same libary that I created. The swig doc told me this is the result of forgeting to compile and link the swig wrapper file to my native libary, but I'm very sure that I did that with cmake build. CMakeList.txt cmake_minimum_required (VERSION 2.6) FIND_PACKAGE(SWIG REQUIRED) find_package(Java REQUIRED COMPONENTS Runtime Development) find_package(JNI REQUIRED) INCLUDE(${SWIG_USE_FILE}) set(JAVA ${java_include_path} ) INCLUDE_DIRECTORIES(${JAVA} ${JAVA}/win32) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET_SOURCE_FILES_PROPERTIES(hello.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(hello.i PROPERTIES SWIG_FLAGS "-includeall") SWIG_ADD_MODULE(hello java hello.i hello.cpp) SWIG_LINK_LIBRARIES(hello ${Java_LIBRARIES} ${JNI_LIBRARIES} ${CMAKE_CURRENT_SOURCE_DIR}) hello.cpp #include "hello.hpp" int adding(const int x, const int y) { return y + x; } hello.hpp int adding(const int x, const int y); hello.i %module hello %{ #include "hello.hpp" %} int adding(const int x, const int y); Can anyone tell me what I"m doing wrong when I'm creating the dynamic library? Thank you for the assistance. The reason why I know this is due to this error message in eclipse Exception in thread "main" java.lang.UnsatisfiedLinkError: hello.helloJNI.adding(II)I at hello.helloJNI.adding(Native Method) at hello.hello.adding(hello.java:14) at hello.Main.main(Main.java:14) Which is the same kind of error message that the docs talk about.
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27700438
tagged with: c++
type: UnansweredQuestion
has title: Java won't call the functions from the .dll created using swig
tagged with: swig

http://stackoverflow.com/a/27606881
has comment: http://stackoverflow.com/comment/43682656
has comment: http://stackoverflow.com/comment/43651124
has comment: http://stackoverflow.com/comment/43669015
has comment: http://stackoverflow.com/comment/43681974
score: 3
accepted answer of: http://stackoverflow.com/q/27588569
has comment: http://stackoverflow.com/comment/43669155
answers question: http://stackoverflow.com/q/27588569
has comment: http://stackoverflow.com/comment/43682319
type: AcceptedAnswer
has body: Seems like you are missing asynchronous pattern. If c=35 has to be executed once character occurs at (24,359), then the correct way is to pass function() c=35 end as third argument to walk method and your engine (that performs actual 'walking') will call that callback when appropriate. character.walkTo(24, 359, function () c = 35 end) Otherwise, walk may schedule walking to engine and yield immediately, resuming on correct event. In this case you have to setup script worker-coroutine (you cannot yield in main state). script = coroutine.wrap(function () character.walkTo(24, 359) -- will yield and leave callable global 'script' c = 35 end) script() -- resume first time -- here script is over ... -- this wrapper may be implemented in Lua or host language function character.walkTo(x, y) engine.startActualWalkingTo(x, y) coroutine.yield() -- yields to host -- coroutine.resume() will continue here end ... -- somewhere in engine code (pseudo-code here) for event in eventLoop do if character.x == endPoint.x and character.y == endPoint.y then script() -- resume again at c=35 end end You may cancel the script anytime with script=nil. yield() has some limitations, consult the manual.
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43662399
has comment: http://stackoverflow.com/comment/43661779
downvote count: 0

http://stackoverflow.com/comment/68664515
comment on: http://stackoverflow.com/a/27482617
score: 0
type: AnswerComment
has text: nice addition and just the explanation I was needed
type: Comment

http://stackoverflow.com/comment/43423181
score: 0
has text: @tshes you have to ask a well focused question!just asking to fix your code is not nice right? we need more information like what actually goes wrong, what have you tried.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27495018

http://stackoverflow.com/q/27548475
favorite count: 0
has body: I have this code: @ElementList(name = "Telefono") @Namespace(reference = "efactura") protected List telefono; which has an ancester: @Namespace(prefix = "ns2", reference = "efactura") public class CFEDefType { and it generates: <ns2:Telefono class="java.util.Arrays$ArrayList"> 12341234 0303456 </ns2:Telefono> when I'm expecting: <ns2:Telefono class="java.util.Arrays$ArrayList"> <ns2:string>12341234 <ns2:string>0303456 </ns2:Telefono> Is is possible to achieve this?
tagged with: simple-framework
tagged with: android
tagged with: prefix
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27548879
tagged with: namespaces
type: Question
score: 1
tagged with: java
has title: Simple XML Framework: Strings in elementlist not having namespace prefix when serializing
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/43499351
comment on: http://stackoverflow.com/a/27535411
type: Comment
has text: Though this doesn't detract from the concept of the answer, it would be worth noting that `info1` needs `protected` or `public` access to be set in such a manner. Usage of a setter function would be required otherwise.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27525323
accepted answer: http://stackoverflow.com/a/27527027
type: AnsweredQuestion
score: 2
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
has body: I keep getting this exception: Exception in thread "main" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Array Buffer Object is disabled at org.lwjgl.opengl.GLChecks.ensureArrayVBOenabled(GLChecks.java:93) at org.lwjgl.opengl.GL11.glVertexPointer(GL11.java:2680) at Joehot200.TerrainDemo.render(TerrainDemo.java:2074) at Joehot200.TerrainDemo.enterGameLoop(TerrainDemo.java:3266) at Joehot200.TerrainDemo.startGame(TerrainDemo.java:3490) at StartScreenExperiments.Test2.resartTDemo(Test2.java:55) at StartScreenExperiments.Test2.main(Test2.java:41) However, the array buffer object IS enabled! glEnableClientState(GL_VERTEX_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle); glVertexPointer(3, GL_FLOAT, 0, 0L); As you can see, two lines before the glVertexPointer call (the one that the error is at), then I am clearly enabling the array buffer! What is wrong here?
possible better answer: http://stackoverflow.com/a/27525594
downvote count: 0
has answer: http://stackoverflow.com/a/27525594
has answer: http://stackoverflow.com/a/27527027
answer count: 2
favorite count: 0
upvote count: 2
has title: OpenGLException: Cannot use offsets when Array Buffer Object is disabled.. On a line after calling glEnable(GL_ARRAY_BUFFER)?

http://stackoverflow.com/a/27491858
has body: public class RegexEx { public static void main(String[] args) { String s = "{name : John, id : '0', fit : '34' }, " + "{name : Paul, id : '0', fit : '34' }," + "{name : Will, id : '0', fit : '24' } "; String name="John"; String age = getAge(s, name); System.out.println(age); } private static String getAge(String s, String name) { String age=null; Pattern namePattern = Pattern.compile("name : "+name+"(.*)\\d\\d"); String[] arr = s.split("}"); for (String str : arr) { Matcher matcher = namePattern.matcher(str); while (matcher.find()) { Pattern numPattern = Pattern.compile("\\d\\d"); String match=matcher.group(); Matcher numMatcher = numPattern.matcher(match); if(numMatcher.find()) age=numMatcher.group(); } } return age; } }
answers question: http://stackoverflow.com/q/27491239
score: 0
type: Answer

http://stackoverflow.com/comment/43500211
comment on: http://stackoverflow.com/a/27492555
type: Comment
score: 0
type: AnswerComment
has text: Edited my answer with the stuff from your comments and your edited answer. Hopefully it helps you fixing your problem :)

http://stackoverflow.com/comment/43513846
has text: heap space exception comes when you store more data than available space provided by jvm. for ex. you adding data in string builder with more data than space allocated by jvm. so, you need to make string builder free. so. other resources can use that memory.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27543087

http://stackoverflow.com/a/27484350
downvote count: 0
type: Answer
has body: I always go for DB, it takes a bit more time to set up but once it's set up it makes things a lot easier and in my opinion has way more pros than cons. Though you can do a bit of research to get a comparison. If you're not going to have a lot of data in your database then you could store in a file for simplicity but I still prefer the DB option and there's plenty of guides and advice on how to implement them out there.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27484174

http://stackoverflow.com/a/27497517
upvote count: 3
has comment: http://stackoverflow.com/comment/43426662
downvote count: 0
answers question: http://stackoverflow.com/q/27497450
type: Answer
has body: I think you need a map for String str to Person str. say the map is HashMap nameMap, and change the code like this: void foo(String str){ Person p = new Person(str); nameMap.put(str, p); } int getAcoountNumber(String str){ return nameMap.get(str).acNumber; }
score: 3

http://stackoverflow.com/comment/43483591
type: Comment
score: 3
has text: If you think the problem is with your conversion, then isolate that part of the code and create an example that demonstrates your problem. Don't just give us all the code for your RSA class.
comment on: http://stackoverflow.com/q/27527156
type: QuestionComment

http://stackoverflow.com/a/27555642
type: Answer
has comment: http://stackoverflow.com/comment/43537679
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27555378
score: 3
answers question: http://stackoverflow.com/q/27555378
has comment: http://stackoverflow.com/comment/43537593
upvote count: 3
has body: The response code can be retrieved this way: final int statusCode = httpResponse.getStatusLine().getStatusCode(); switch (statusCode) { case 201: // Successfuly Registered break; case 400: // Username Already taken break; default: break; } To list the header values, you can use: for (final Header h : httpResponse.getAllHeaders()) { Log.d("Responser Header", h.getName() + ": " + h.getValue()); // or h.getElements() } or pick the desired header directly: final String[] contentLength = httpResponse.getHeaders("Content-Length"); and parse it.
type: AcceptedAnswer

http://stackoverflow.com/q/27561859
score: 1
has title: mediaMetadataRetriever.setDataSource(getBaseContext(),uri) throws illegal argument exception
linked to: http://stackoverflow.com/q/22954894
has comment: http://stackoverflow.com/comment/43549939
type: Question
linked to: http://stackoverflow.com/q/27566480
tagged with: java
has comment: http://stackoverflow.com/comment/43549984
upvote count: 2
tagged with: framebuffer
downvote count: 1
has body: Hello developers I have a piece of that grabs the frames of a video...It seems it will work fine except a part of it where I am getting illegal argument exception...As I set the path of the video it crashes..Here is my code it crashes at the line mediaMetadataRetriever.setDataSource(getBaseContext(),uri) Here is the full code: import java.io.IOException; import android.graphics.Bitmap; import android.media.MediaMetadataRetriever; import android.media.MediaPlayer; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.Button; import android.widget.ImageView; import android.widget.MediaController; import android.widget.Toast; import android.widget.VideoView; public class MainActivity extends Activity { MediaMetadataRetriever mediaMetadataRetriever; MediaController myMediaController; VideoView myVideoView; String viewSource = "/storage/test.mp4"; // String viewSource = "/storage/test.mp4"; Uri uri = null; @TargetApi(Build.VERSION_CODES.GINGERBREAD_MR1) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { AssetFileDescriptor afd = getAssets().openFd("test.mp4"); Log.v("MA", "Before setdatasource"); uri = Uri.parse("E:/test.mp4"); mediaMetadataRetriever = new MediaMetadataRetriever(); **mediaMetadataRetriever.setDataSource(getBaseContext(),uri);** // mediaMetadataRetriever.setDataSource(afd.getFileDescriptor(), // afd.getStartOffset(), afd.getLength()); Log.v("MA", "After setdatasource" + afd.getStartOffset()); myVideoView = (VideoView) findViewById(R.id.videoview); Log.v("MA", "VIdeoview found"); myVideoView.setVideoURI(Uri.parse…
favorite count: 0
has comment: http://stackoverflow.com/comment/43549353
has comment: http://stackoverflow.com/comment/43549693
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43549761
has comment: http://stackoverflow.com/comment/43550131
answer count: 0

http://stackoverflow.com/comment/43614329
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27591734
has text: I use IntelliJ Ultimate 14.0.2 which never did any problem, but maybe you'll find this information useful.
score: 0

http://stackoverflow.com/a/27631780
answers question: http://stackoverflow.com/q/27631691
type: Answer
score: 0
has body: For your date following code should work :- String myString = "2014/01/01 18:02:02"; DateFormat myDateFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); Date myDate = myDateFormat.parse(myString); For more details, see the documentation for SimpleDateFormat. Just make sure you use capital "MM" for month and small "mm" for minute.

http://stackoverflow.com/comment/43492051
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27511983
has text: How would I put this in the sub-panels? Like, how do I access the sub-panels?
type: AnswerComment

http://stackoverflow.com/q/27603735
score: 4
has answer: http://stackoverflow.com/a/27603761
possible better answer: http://stackoverflow.com/a/27603775
favorite count: 0
has comment: http://stackoverflow.com/comment/43630073
accepted answer: http://stackoverflow.com/a/27603761
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has body: I hope I'm able to formulate my question well since I'm from Germany... :) I got a very basic java programm but when I start it I get a java.lang.ArrayIndexOutOfBoundsException error. I searched for the problem but I'm unable to find it: Code.java public class Code { private String code; private int nextStep; public Code() { nextStep = 0; } public void setCode(String code) { this.code = code; } public void setNextStep(int lastStep) { this.nextStep = lastStep; } public String getActiveStepSeq() { String[] activeStepSeq = this.code.split("."); return(activeStepSeq[0]); } } Object.java public class Being { public Code code; private String activeStepSeq; private String activeAction; public String I0; public String O0; public String S0; public Object(Code code) { this.code = code; } public void parseStep() { this.activeStepSeq = this.code.getActiveStepSeq(); this.code.setNextStep(Integer.parseInt(this.activeStepSeq.split("~")[0])); this.activeAction = this.activeStepSeq.split("~")[1]; switch(this.activeAction) { case("A"): this.O0 = this.I0; break; } } } Main.java public class Main { public static void main(String[] args) { Code c = new Code(); c.setCode("0~A."); Object o = new Object(c); o.I0 = "Test"; o.parseStep(); System.out.println(o.O0); } } It should work like that: Create new Code c with the code "0~A." Create new Object o with the Code c Do "parseStep" which gets the String "0~A" Set nextStep to 0 and set o.O0 to o.I0 But now I get the following error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Code.getActiveStepSeq(Code.java:19) at Object.parseStep(Object.java:15) at Main.main(Main.java:7) I don't get why I can't use "activeStepSeq[0]"... I hope you can help me, greetings Marvin
has title: Unable to fix java.lang.ArrayIndexOutOfBoundsException
answer count: 2
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/27603775

http://stackoverflow.com/q/27604283
upvote count: 166
has comment: http://stackoverflow.com/comment/43666111
has answer: http://stackoverflow.com/a/77862472
answer count: 10
has answer: http://stackoverflow.com/a/51407975
favorite count: 0
has answer: http://stackoverflow.com/a/27604495
has answer: http://stackoverflow.com/a/29395132
tagged with: arguments
has title: Gradle task - pass arguments to Java application
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/46944383
has answer: http://stackoverflow.com/a/27604536
has answer: http://stackoverflow.com/a/29382636
has answer: http://stackoverflow.com/a/43566916
has answer: http://stackoverflow.com/a/45812136
has answer: http://stackoverflow.com/a/78001339
tagged with: java
accepted answer: http://stackoverflow.com/a/51407975
has body: I have a Java application that runs with a custom gradle task and the application requires some arguments upon being invoked. These are: programName ( string | -f filename | -d key | -h) Options: string Message to be used. -d key Use default messages, key must be s[hort], m[edium] or l[ong]. -f filename Use specified file as input. -h Help dialog. Gradle task looks like: task run (type: JavaExec){ description = "Secure algorythm testing" main = 'main.Test' classpath = sourceSets.main.runtimeClasspath } I've tried running gradle run -h and it does not work.
tagged with: gradle
type: Question
possible better answer: http://stackoverflow.com/a/29382636
downvote count: 0
linked to: http://stackoverflow.com/q/23689054
has answer: http://stackoverflow.com/a/77166044
score: 166
has comment: http://stackoverflow.com/comment/43705831

http://stackoverflow.com/q/27563517
has answer: http://stackoverflow.com/a/27563694
tagged with: handler
upvote count: 1
tagged with: android
has title: Android Get Location
favorite count: 0
tagged with: timer
has answer: http://stackoverflow.com/a/27563588
tagged with: gps
accepted answer: http://stackoverflow.com/a/27563588
possible better answer: http://stackoverflow.com/a/27563694
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I want to get the user location through GPS, if the GPS can't connect to the satellite within 30 seconds then I want to get the location through LocationManager.getLastKnownLocation(). I can do both the work (i.e. get the location through GPS and from last known location), but I don't know how to do this using a timer (i.e. within 30 seconds). I heard that it can be done by using Handlers or Java Timer class. But I can't understand that.
type: Question
answer count: 2

http://stackoverflow.com/comment/43615647
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27595628
has text: Try passing a string instead of a number. i.e. `"100000"` instead of `100000`
score: 0

http://stackoverflow.com/q/27497441
tagged with: sorting
has comment: http://stackoverflow.com/comment/43426626
has title: Java - Reorder Map<String, List<String>>
answer count: 2
has comment: http://stackoverflow.com/comment/43426592
has answer: http://stackoverflow.com/a/27497573
has comment: http://stackoverflow.com/comment/43426341
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43445751
has body: I have a Map &lt; String, List&lt; String>> called data and looks like this data = {Salad=[Salad Bar Station, Green Pepper &amp; Tomato Salad, Lo Mein Noodle Salad], Pizza=[Cheese Pizza - Slice, Pepperoni Pizza, Tomato Bruschetta Flatbread Pizza, Herb Seasoned Breadsticks, Spaghetti Sauce with Tomato Bits], Dessert=[Carnival Cookies, Sweet Cinnamon Brownies, Oreo Crumble Pudding Cup, Cherry Jell-O Parfait], Cold Cereal=[Miscellaneous/Peripherals]} Now I want to reorder this so it looks like this data = Pizza=[Cheese Pizza - Slice, Pepperoni Pizza, Tomato Bruschetta Flatbread Pizza, Herb Seasoned Breadsticks, Spaghetti Sauce with Tomato Bits], Salad=[Salad Bar Station, Green Pepper &amp; Tomato Salad, Lo Mein Noodle Salad], Cold Cereal=[Miscellaneous/Peripherals] Dessert=[Carnival Cookies, Sweet Cinnamon Brownies, Oreo Crumble Pudding Cup, Cherry Jell-O Parfait]} Now I have some pseudo-code about how to do this just not quite sure how to do it in code. So I want to have an array with the order of the keys I want. So it would be like String[] desiredOrder = {"Pizza","Salad","Cold Cereal"}; int destination = 0; And then have something like for (int i=0; i &lt; desiredOrder.length; i++) { //then find if the first desiredOrder object is in the data array //then check if it is in the right spot if (it is in right spot) { //do nothing } else { //move it to the right spot } } I would really appreciate it you could help me fill in the rest so that the key and its values are moved to the right spot. Thanks for the help in advance. EDIT To make this I am parsing xml from the web and here is what I am doing, notice I changed it to LinkedHashMap just now, so now it gets it in the order of the xml, but I still want to rearrange it to my own order. String currentDay = ""; String currentMeal = ""; String counter = ""; LinkedHashMap&lt;String, List&lt;String&gt;&gt; itemsByCounter = new LinkedHashMap&lt;String , List&lt;String&gt;&gt;(); List&lt;String&gt; items = new ArrayList&lt;S…
has comment: http://stackoverflow.com/comment/43426434
has comment: http://stackoverflow.com/comment/43426426
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27497540
has comment: http://stackoverflow.com/comment/43426704
type: Question
tagged with: hashmap
tagged with: arrays
has comment: http://stackoverflow.com/comment/43426317

http://stackoverflow.com/comment/95088967
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27572936
type: Comment
has text: @Brandon, see https://stackoverflow.com/a/54128870/4420094, if that's what you're looking for.

http://stackoverflow.com/a/72670528
has body: What I did was store a file that contains a value called isLoggedIn on the device using sharedPreferrences. When the user logs in, I set this value to true and then clear the value when he/she presses the loggout button. So anytime I start my app, I first check if the value is true. If true, move to the next activity, else, stay on the login page. Still trying to figure out how to solve the problem in a professional way. All the best.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27633388

http://stackoverflow.com/q/27595820
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27675887
has body: Imagine I have method like this: public int doSomething(String value) { this.value = value //calculation //based on value return the op return op; } This method does change the state of the object. While I was reading the book FP In Scala, author says, in such cases, we need to return the new state along with the new object. Something like this: public List&lt;Integer,AnClass&gt; doSomething(String value) { AnClass obj = new AnClass(); obj.value = value //calculation //based on value return the op //return List of op,new AnClass } The reason being is, doSomething is a side-effect method, which does modify the state of an object. Rather, the revised version, does create a new object and doesn't change the value of the old object. With respect to this, I have few questions: Imagine AnClass has loads of instance variables, if one should copy all of them into a new object, how should I do that? Is it always good that we shouldn't change the state of an object as author claims? In such cases, we need to take the similar approach, as I have done above? If we keep on creates the java objects, doesn't use loads of heap memory? Does that degrades my speed of the application?
downvote count: 0
score: 1
has title: How one should prevent changing the state of the object in Java ( with respect to FP)?
type: Question
tagged with: java
tagged with: functional-programming
upvote count: 1

http://stackoverflow.com/q/27496050
tagged with: android
has answer: http://stackoverflow.com/a/27496402
tagged with: java
tagged with: android-camera-intent
type: Question
has body: I was having some problem when trying to get the image path from captured image. When my camera button on click: takePickBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(Intent.createChooser(cameraIntent, "Select Picture"), REQUEST_IMAGE_CAPTURE); } }); And then the codes where I try to load the captured image to image view and get the string to pass it to Async Http Post: protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); try { // When an Image is picked if (requestCode == REQUEST_IMAGE_CAPTURE &amp;&amp; resultCode == RESULT_OK) { final ContentResolver cr = getContentResolver(); final String[] p1 = new String[] { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATE_TAKEN }; Cursor c1 = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, p1, null, null, p1[1] + " DESC"); if ( c1.moveToFirst() ) { String uristringpic = "content://media/external/images/media/" +c1.getInt(0); Uri uri = Uri.parse(uristringpic); try { Bitmap bm = android.provider.MediaStore.Images.Media.getBitmap(cr, uri); } finally { } params.put("filename", uristringpic); } } else { Toast.makeText(this, "You haven't picked Image", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG) .show(); } } However, by doing this, the captured image is already set to the image view. But then when I try to print out the uristringpic, it is empty. Any ideas? Thanks in advance.
score: 0
answer count: 2
tagged with: uri
has answer: http://stackoverflow.com/a/27496357
has title: Android get image path from captured image
type: UnansweredQuestion

keystore
tags question: http://stackoverflow.com/q/27632605
tag name: keystore
tags question: http://stackoverflow.com/q/27555859
tags question: http://stackoverflow.com/q/27562289
type: Tag

http://stackoverflow.com/comment/43689606
has text: if you are familiar Spring then you can use [Spring Hadoop](http://projects.spring.io/spring-hadoop/), you can [see sample example here](https://github.com/spring-projects/spring-hadoop-samples/tree/master/mapreduce) which will move the input files into hdfs using groovy file and runs your Map-Reduce as a job
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27634094
type: QuestionComment

http://stackoverflow.com/comment/50173951
has text: @RockyMM Sadly, no, I have not found a solution. Which means our code still inserts a csv string into the SQL string, instead of using parameters in a prepared statement.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27557411

http://stackoverflow.com/a/27558703
has comment: http://stackoverflow.com/comment/43558798
upvote count: 5
downvote count: 0
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27558612
answers question: http://stackoverflow.com/q/27558612
type: Answer
has body: Have you considered letter characters instead of using the \D token? String s = "abc4.5efg2hij89k.9"; String[] parts = s.split("(?&lt;=[a-z])(?=[\\d.])|(?&lt;=\\d)(?=[a-z])"); System.out.println(Arrays.toString(parts)); Output [abc, 4.5, efg, 2, hij, 89, k, .9]

http://stackoverflow.com/comment/77577376
comment on: http://stackoverflow.com/q/27622658
has text: did you find any solution to this problem. please write an answer if so. I'm having the same issue.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43644614
comment on: http://stackoverflow.com/a/27610780
type: AnswerComment
score: 0
has text: Your example shows a basic find query, and you reorganized my data... My question is related to finding documents based on searching nested arrays of objects against criteria. If you need a better idea of what my data is, imagine a collection of customer profiles, each document has an array of contact method objects. I want to search against those contact method objects using multiple criteria.
type: Comment

http://stackoverflow.com/q/27559680
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43545780
has comment: http://stackoverflow.com/comment/43545638
score: 0
has body: i have a list view withe data retrieved from database which suppose to navigate to another activity if i clicked on an item.. however im getting this error when i click on an item java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.anistat/com.example.anistat.MemberExercise}: java.lang.StringIndexOutOfBoundsException: length=0; index=9 and this is the list onItemClick function private boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null &amp;&amp; activeNetworkInfo.isConnected(); } Boolean net; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_member_exercise); setTitle("AniStat"); net=isNetworkAvailable(); if(net){ Button next = (Button) findViewById(R.id.membernextex); btnDownloadPDF = (Button) findViewById(R.id.memberexsavepdf); btnDownloadPDF.setVisibility(View.VISIBLE); // getting data Intent i = getIntent(); eid = i.getStringExtra("ID"); cha = i.getStringExtra("chapter"); lev = i.getStringExtra("level"); user = i.getStringExtra("user"); id = i.getStringExtra("eid");// 1 2 3 id = id.substring(9); if (!id.equals("")){ if (id.equals("1")) { nextid = "2"; } if (id.equals("2")) { nextid = "3"; } if (id.equals("3")) { next.setVisibility(View.GONE); }} what is the problem ?
has comment: http://stackoverflow.com/comment/43545798
has title: StringIndexOutOfBoundException when clicking on item from a list view
type: UnansweredQuestion
tagged with: android
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/43545912
has comment: http://stackoverflow.com/comment/43545568
tagged with: java
has comment: http://stackoverflow.com/comment/43545861

http://stackoverflow.com/q/27564623
tagged with: jaxb
type: Question
downvote count: 0
upvote count: 1
answer count: 1
has title: jaxb - xsd to java class for specified node
favorite count: 0
tagged with: xjc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27567341
tagged with: xsd
has comment: http://stackoverflow.com/comment/43559273
has body: I have an XSD file with many ComplexType defined in it. I'm using XJC to generate java classes from the XSD file. It will generate classes for all the CompleXType node defined in the schema file. Is there any way I can use a filter in xjc command so that I can get classes of the specified ComplexType only, Instead of generating classes for the whole XSD file?
score: 1
tagged with: java

http://stackoverflow.com/comment/43523462
score: 3
type: AnswerComment
has text: Set does not have a `next()` method either.
type: Comment
comment on: http://stackoverflow.com/a/27548649

http://stackoverflow.com/q/27518290
score: 0
answer count: 3
favorite count: 0
has title: Jmenu bar NullPoinerExpection
has answer: http://stackoverflow.com/a/27518438
accepted answer: http://stackoverflow.com/a/27518302
has answer: http://stackoverflow.com/a/27518311
tagged with: java
has body: I am having trouble on the jMeun bar and my code can compile but when i try to open it in display. The Null pointer Exception is appear. I don't know why it happens. The problem point out 3 lines that happen in my code. There are in the method of "createMenuBar" frame.setJMenuBar(menuBar); and the last 2 line which is frame.setSize(350, 250); frame.setVisible(true); import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.border.*; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import javax.swing.border.*; public class Game extends JFrame { private JFrame frame; JButton[][] grids = new JButton[9][9]; public Game() { createGrids(); } private void quit() { System.exit(0); } public void createGrids(){ frame = new JFrame("game"); createMenuBar(frame);; setTitle("game"); JPanel m = new JPanel(new GridLayout(9,9)); for(int i = 0; i &lt; 9; i++) { for(int j = 0; j &lt; 9; j++) { grids[i][j] = new JButton(); m.add(grids[i][j]); } } add(m, BorderLayout.CENTER); m = new JPanel(new GridLayout(1,2)); add(m, BorderLayout.NORTH); setSize(200, 240); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } private void createMenuBar(JFrame frame) { final int SHORTCUT_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu menu; JMenuItem item; menu = new JMenu("Option"); menuBar.add(menu); item = new JMenuItem("Quit"); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, SHORTCUT_MASK)); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quit(); } }); menu.add(item); frame.setSize(350, 250); frame.setVisible(true); } }
upvote count: 1
possible better answer: http://stackoverflow.com/a/27518311
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27518302

http://stackoverflow.com/a/27506783
has body: I also encounter this problem while ago, it looks like spring data does some kind lazy instantiation. So if you not access this fields inside of your transaction, they will stay null. Add annotation @Transactional on method where are you calling this request and problem will be solved.
has comment: http://stackoverflow.com/comment/43474640
answers question: http://stackoverflow.com/q/27485288
has comment: http://stackoverflow.com/comment/43569354
accepted answer of: http://stackoverflow.com/q/27485288
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/27492342
has comment: http://stackoverflow.com/comment/43416353
tagged with: infinite-loop
downvote count: 0
has comment: http://stackoverflow.com/comment/43416695
has title: How avoid infinite loop during Json Serialization in Java
linked to: http://stackoverflow.com/q/3325387
has comment: http://stackoverflow.com/comment/43416338
accepted answer: http://stackoverflow.com/a/27498102
type: AnsweredQuestion
score: 1
favorite count: 0
tagged with: serialization
type: Question
has comment: http://stackoverflow.com/comment/43417606
answer count: 1
has body: I retrieve a list of Brothers using hibernate public class Brother { public int brotherId; public string name; public List&lt;Brother&gt; brothers; public Brother() { brothers = new ArrayList&lt;Brother&gt;(); } //Getter Setter } Hibernate is configured using lazy select in brothers list, this in Java side works, But the problem is when I want to serialize a Brother object to JSON. I've got org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) for Example Bryan can have Mark as brother an viceversa... How I can solve it? is there any way to indicate max number of recursion to jackson libraries? my code, it is really simple. Brother brother = this.myservice.getBrother(4); ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writeValueAsString(brother));
has answer: http://stackoverflow.com/a/27498102
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
upvote count: 1

http://stackoverflow.com/comment/43458716
has text: List seems to me a terrible solution too, I mentioned it because I saw it suggested on the web.
comment on: http://stackoverflow.com/a/27514111
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/comment/43626191
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/27589642
type: Comment
has text: Can you please tell where we need to add the block of code

http://stackoverflow.com/comment/43633023
comment on: http://stackoverflow.com/q/27604932
has text: Why do you want to run from Maven when that project specifically ships with Gradle and has the ability to be run directly from the build script?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27608928
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/43640851
has title: Setting up Tomcat JDBC connection pool with the Spring JDBCTemplate
type: Question
possible better answer: http://stackoverflow.com/a/27617526
has answer: http://stackoverflow.com/a/27617526
has comment: http://stackoverflow.com/comment/43640648
has comment: http://stackoverflow.com/comment/43640804
has comment: http://stackoverflow.com/comment/43640113
accepted answer: http://stackoverflow.com/a/27617040
has body: I'm trying to setup a Tomcat connection pool (to MySQL) in my Java web app, while using the Spring JDBCTemplate. This is the Java class to create the connection pool: @Configuration public class DataAccessConfiguration { @Bean(destroyMethod = "close") public javax.sql.DataSource datasource() { org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(); ds.setDriverClassName("org.h2.Driver"); ds.setUrl("jdbc:h2:java-config"); ds.setUsername("sa"); ds.setPassword(""); ds.setInitialSize(5); ds.setMaxActive(10); ds.setMaxIdle(5); ds.setMinIdle(2); return ds; } @Bean public JdbcOperations tpl() { return new JdbcTemplate(datasource()); } } This is how I get the ApplicationContext (in the main method for example): public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); How should I define the DataAccessConfiguration class in the Beans.xml file so Spring knows to use it? ** Update: ** This is the actual configuration method: public javax.sql.DataSource datasource() { org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(); PoolProperties p = new PoolProperties(); p.setUrl("jdbc:mysql://localhost:3306/mysql"); p.setDriverClassName("com.mysql.jdbc.Driver"); p.setUsername("root"); p.setPassword(""); p.setJmxEnabled(true); p.setTestWhileIdle(false); p.setTestOnBorrow(true); p.setValidationQuery("SELECT 1"); p.setTestOnReturn(false); p.setValidationInterval(30000); p.setTimeBetweenEvictionRunsMillis(30000); p.setMaxActive(100); p.setInitialSize(10); p.setMaxWait(10000); p.setRemoveAbandonedTimeout(60); p.setMinEvictableIdleTimeMillis(30000); p.setMinIdle(10); p.setLogAbandoned(true); p.setRemoveAbandoned(true); p.setJdbcInterceptors( "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"+ "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"); ds.setPoolProperties(p); return ds; } Can you please help rewrite in the Beans.xml?
has comment: http://stackoverflow.com/comment/43642542
has comment: http://stackoverflow.com/comment/43640179
has comment: http://stackoverflow.com/comment/43642267
answer count: 2
has comment: http://stackoverflow.com/comment/43641202
has comment: http://stackoverflow.com/comment/43640414
has comment: http://stackoverflow.com/comment/43654545
has comment: http://stackoverflow.com/comment/43641062
upvote count: 1
tagged with: spring
tagged with: jdbctemplate
has comment: http://stackoverflow.com/comment/43642191
tagged with: java
has comment: http://stackoverflow.com/comment/43640759
tagged with: mysql
has comment: http://stackoverflow.com/comment/43641302
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27617040
has comment: http://stackoverflow.com/comment/43640996
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43641484

http://stackoverflow.com/q/27528290
tagged with: eclipse
type: Question
tagged with: debugging
answer count: 2
has title: How to keep highlighting of the executed Java lines in Eclipse Debug Mode?
linked to: http://stackoverflow.com/q/211500
has body: When i start Run Coverage in Eclipse, the executed (covered) lines are highlighted. How can i have this highlighting for Debug Mode? Maybe with an Eclipse plugin? Our application is so big, it is sometimes impossible to debug through all the lines, and eventually database timeout occurs anyway, so we have to start debugging from beginning. I would like to have the chance to see which lines were actually executed (after the execution). EDIT: I don't mean "current debugged line". I mean "debugged lineS". I want that the executed lines keep the highlighting also after debugging.
downvote count: 0
has answer: http://stackoverflow.com/a/27528450
tagged with: eclipse-plugin
favorite count: 0
tagged with: code-coverage
type: UnansweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27528381
upvote count: 3
tagged with: java

http://stackoverflow.com/a/27487291
answers question: http://stackoverflow.com/q/27486871
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27486871
type: Answer
downvote count: 0
score: 1
has body: There is a big difference between "unspecified" and "random." HashMap's order is unspecified, but not random. If you enter the same keys into a HashMap, in the same order, then you'll get the same result each time. This is (very) roughly analogous to how if you start with the same seed, a pseudorandom number generator will generate the same sequence each time. In this case, as Colonel Thirty Two pointed out in the comments, the order happened to be the same as the keys' natural ordering. With three key-value pairs, there are 6 possible orderings (the permutations of the set {1, 2, 3}), so there's about a 17% chance that you'd see this happen -- not too unlikely at all. What the "unspecified" means is essentially, "we can do whatever we want." It gives the implementers freedom to perform whatever hashing algorithm they want, resolve conflicts in whatever way is convenient, resize the HashMap's buckets without regard to maintaining order, etc. If they wanted to, they could explicitly add randomization and still be within the specs; but they didn't, because there's no need. So the code itself is deterministic, which means given the same inputs (for instance, a list of key-value pairs to be inserted) it will always produce the same output (a map whose toString looks the same each time).
type: AcceptedAnswer

http://stackoverflow.com/comment/43482187
type: Comment
type: QuestionComment
has text: *"Ignore the functionality. I am only interested about the GUI."* That's easy to do if you remove it before posting. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example).
score: 3
comment on: http://stackoverflow.com/q/27526014

http://stackoverflow.com/q/27576144
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43577726
has body: I have an arraylist method that I need to change to a linkedlist method. It's throwing a nullpointerexception at the int x line.It is throwing at another nullpointerexception to another line. But that line is where the method is called. Below is the code: Exception in thread "main" java.lang.NullPointerException at PlantList.analyzePlants(PlantList.java:303) at PlantList.main(PlantList.java:434) private void analyzePlants() { String text = ""; Node p = root; while(p!=null) { text = JOptionPane.showInputDialog(null,"Enter the string to analyze: " ); int x = analyze(p.plant.getName().toLowerCase(), analyzeText.getText().toLowerCase()); text += p.plant.getName() + " : " + x + "\n"; p =p.next; } JTextArea textArea = new JTextArea(text); JScrollPane scrollPane = new JScrollPane(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scrollPane.setPreferredSize(new Dimension(150, 300)); JOptionPane.showMessageDialog(null, scrollPane, "Analyzation Completed", JOptionPane.CANCEL_OPTION); analyzeText.setText(""); p = p.next; } /** * Recursive function to analyze the plants in the system. */ private int analyze(String name, String text) { if (!name.contains(text)) { return 0; } if (name.startsWith(text)) { return 1 + analyze(name.substring(1), text); } else { return 0 + analyze(name.substring(1), text); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/43577739
has answer: http://stackoverflow.com/a/27576183
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/43577699
tagged with: linked-list
tagged with: java
score: -1
has title: Changing an arraylist method to a linkedlist method
type: Question

http://stackoverflow.com/comment/43627571
score: 1
has text: but as you point out in question heading ,you have a embedded activeMQ, so I guess it will be starting when you run your web app
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27549226

http://stackoverflow.com/comment/43647056
type: Comment
type: QuestionComment
has text: I meant `--debug` for the Java launch, not the VM startup. I think you'd add that to the Dockerfile.
comment on: http://stackoverflow.com/q/27612209
score: 0

http://stackoverflow.com/a/27634429
has comment: http://stackoverflow.com/comment/43688348
downvote count: 0
score: 1
has body: isEmpty String having default method. if (expression.isEmpty()) instead of if (expression == "")
has comment: http://stackoverflow.com/comment/43688373
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27634413
accepted answer of: http://stackoverflow.com/q/27634413
type: Answer

http://stackoverflow.com/q/27608244
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I would like to implement a method analogical to subList(a,b), but that works when a>b. subList(a,b) and subList(b,a) should return List view of the same scope, however differently iterated and numerated. The view in case of a>b should be reversed. Is it possible? My solution as for now is pretty primitive. The first problem is that a subList(a,b) in case for a>b doesn't adjust numbering accordingly (for remove or get methods usage). But what is more important, the reversed List view is actually a copy here not an actual view and I have no idea how to fix even that. @SuppressWarnings("serial") class ReverseLinkedList &lt;T&gt; extends LinkedList&lt;T&gt; { ReverseLinkedList(final List&lt;T&gt; l) { super(l); // problem, I want a view not a copy } @Override public Iterator&lt;T&gt; iterator() { return new Iterator&lt;T&gt;() { ListIterator&lt;T&gt; listIter = listIterator(size()); public boolean hasNext() { return listIter.hasPrevious(); } public T next() { return listIter.previous(); } public void remove() { listIter.remove(); } }; } } @SuppressWarnings("serial") class CleverList&lt;T&gt; extends LinkedList&lt;T&gt; { @Override public List&lt;T&gt; subList(int fromIndex, int toIndex) { if ( fromIndex &lt; toIndex ) { return super.subList(fromIndex, toIndex); } else { return new ReverseLinkedList&lt;T&gt;(super.subList(toIndex-1,fromIndex-1)); } } } How it works as for now: CleverList&lt;Integer&gt; list = new CleverList&lt;Integer&gt;(); for ( int i=1; i&lt;=10; ++i ) { list.add(i); } List&lt;Integer&gt; listA = list.subList(2,8); printList(listA); // "3 4 5 6 7 8 " ok List&lt;Integer&gt; listB = list.subList(8,2); printList(listB); // "7 6 5 4 3 2 " ok listB.remove(2); printList(listB); // "7 6 5 3 2 " not ok, the point was to remove "5" printList(list); // "1 2 3 4 5 6 7 8 9 10 " not ok, nothing was removed
tagged with: collections
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43646339
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43638903
has answer: http://stackoverflow.com/a/27608617
downvote count: 0
has title: Is it possible to implement method analogical to subList(a,b) but that works when a>b?
tagged with: data-structures

http://stackoverflow.com/comment/43531832
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27552694
score: 0
has text: Then look at the data structures involved. For linux [inode](http://en.wikipedia.org/wiki/Inode)s are a good start.

http://stackoverflow.com/q/27481154
tagged with: android-camera
has title: Capture image in portrait but get an ouput of landscape in directory
has answer: http://stackoverflow.com/a/27482071
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I am making my own camera in android, then whenever I capture images the images orientation is okay. but when i open it in my external sdcard file it is like that: this is my code: public class CameraApp extends Activity implements SurfaceHolder.Callback { private static final String TAG = "IMG_"; private static final String IMAGE_FOLDER = "/PhoneController/"; private static final String EXTENTION = ".jpg"; private String pictureName = ""; public String picNameToshare = ""; static final int FOTO_MODE = 0; String speed; String imageFilePath; private Handler mHandler = new Handler(); public static String imageFilePath1; FileOutputStream fos = null; public Bitmap framebmpScaled; public Bitmap SelecedFrmae; public static Bitmap mergeBitmap; public static Bitmap bmpfULL; Camera camera; Button button; SurfaceView surfaceView; SurfaceHolder surfaceHolder; boolean previewing = false; LayoutInflater controlInflater = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.camera); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); getWindow().setFormat(PixelFormat.UNKNOWN); surfaceView = (SurfaceView) findViewById(R.id.camerapreview); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); button = (Button) findViewById(R.id.button); button.setOnClickListener(buttonListener); } private OnClickListener buttonListener = new OnClickListener() { public void onClick(View v) { Handler myHandler = new Handler(); if (previewing) { camera.stopPreview(); previewing = false; Log.e("", "one"); } if (camera != null) { try { camera.setPreviewDisplay(surfaceHolder); camera.startPreview(); previewing = true; myHandler.postDelayed(mMyRunnable, 2000); // called after 5 // seconds button.setText("Waiting..."); Log.e("", "two"); } cat…
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/90741423
has text: It's very disappointing Spring documentation on that side is still vague nowadays 4 years later even and people have to frantically search for blog posts and whatnot. Why would I waste my time and browse the code - as a device owner, you don't disassemble it unless it's broken or the docs are poor. For serious applications developers should 200% understand when, how many, etc transactions start and close. Spring doesn't want to tell it.
comment on: http://stackoverflow.com/a/27615246
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27512633
tagged with: android
score: 2
tagged with: java
tagged with: android-videoview
type: Question
tagged with: android-mediaplayer
has body: I have a VideoView in my Android project and whenever it is playing I get an unreasonable amount of LogCat messages. The video is playing fine, and I see no user facing errors, but I get an info/warning message every second or so. W/MediaPlayer﹕ info/warning (3, 0) W/MediaPlayer﹕ info/warning (36866, 100) W/MediaPlayer﹕ info/warning (702, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) W/MediaPlayer﹕ info/warning (36865, 0) ... I couldn't find any reference to error code 36865. Is this normal behaviour? If so, is there any way I can suppress this message for a more usable LogCat?
has answer: http://stackoverflow.com/a/27513160
tagged with: android-logcat
downvote count: 0
answer count: 1
has title: Android VideoView create excessive info/warning messages
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/43590739
has text: Here is a good question+answer: https://stackoverflow.com/questions/267953/managing-libraries-in-tomcat For deployment of the libraries, I'd just use your deployment process to move the needed libraries into the Tomcat *lib* directory, then set all the libraries in your POM to scope *provided* and not ship them at all. That way you have those 2 steps nicely separated and you can organize them as different deployment steps.
type: AnswerComment
comment on: http://stackoverflow.com/a/27583104
score: 0
type: Comment

http://stackoverflow.com/q/27518889
accepted answer: http://stackoverflow.com/a/27522913
upvote count: 3
has comment: http://stackoverflow.com/comment/43467670
has body: I want to create a layout which will have a scrollview, inside the srollview at the top of the layout there will be two Textviews. In the center there will be two Edittexts and at the bottom of the layout, there will be two buttons. But everything will be under the main scrollview. A visual description of my requirement: I have done some coding which scrolls the top content but keeps the buttons at the bottom out of the scrollview which is not the expected functionality. My layout coding: <TextView android:id="@+id/welcomeToStudy" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="Welcome to xxxxxxxxxxxxxxx!" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#54575A" android:textSize="28sp" /> <TextView android:id="@+id/pleaseEnter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/welcomeToStudy" android:layout_centerHorizontal="true" android:layout_marginTop="5dp" android:text="Please enter your details xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx." android:textSize="20sp" /> What should I do to get the expected output?
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/27519039
possible better answer: http://stackoverflow.com/a/27519351
tagged with: scrollview
favorite count: 0
has answer: http://stackoverflow.com/a/27519351
has comment: http://stackoverflow.com/comment/43467770
has answer: http://stackoverflow.com/a/27519335
has comment: http://stackoverflow.com/comment/43467756
score: 2
type: AnsweredQuestion
tagged with: java
has title: Scroll view with two buttons at the bottom of the layout
type: Question
has answer: http://stackoverflow.com/a/27519045
has comment: http://stackoverflow.com/comment/43467589
tagged with: xml-layout
has comment: http://stackoverflow.com/comment/43467774
has comment: http://stackoverflow.com/comment/43467809
answer count: 6
has answer: http://stackoverflow.com/a/27519152
has answer: http://stackoverflow.com/a/27522913

http://stackoverflow.com/comment/43591601
type: Comment
type: QuestionComment
score: 7
comment on: http://stackoverflow.com/q/27583560
has text: Did you override `hashcode` as well?

http://stackoverflow.com/comment/43740902
has text: so it means that if i make it as .jar file, will it work for .jar as well or just for the netbeans?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27655948

http://stackoverflow.com/a/27526648
upvote count: 26
type: Answer
answers question: http://stackoverflow.com/q/27525849
has comment: http://stackoverflow.com/comment/138821302
has comment: http://stackoverflow.com/comment/97970664
score: 23
has comment: http://stackoverflow.com/comment/86590243
has comment: http://stackoverflow.com/comment/138821022
has body: According to Mathias Doenitz at this point in time RxJava doesn't have back pressure unlike Akkas Reactive Streams implementation. But RxJava seems to be working on adding back pressure. Both frameworks will be able to interact through the reactive streaming spi. So you will be able to do very very similar things. According to Mathias the difference will be that the Akka implementation is based internally on actors, not on multi-threading. And as a result will be more performant. My source for this information is a talk that Mathias gave last week at the Dutch Scala user group. edit: I stand corrected wrt back pressure support in RxJava. If you follow Eriks link you can read what back pressure means.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27525849
has comment: http://stackoverflow.com/comment/129127845
downvote count: 3

http://stackoverflow.com/comment/43627951
type: Comment
comment on: http://stackoverflow.com/a/27595923
has text: @zjuventus14 Glad it helped. Please consider accepting this answer as correct, by ticking the check mark beneath the vote counter. And you can remove the first comment under this answer, because it is obsolete now :).
type: AnswerComment
score: 0

http://stackoverflow.com/q/27522588
tagged with: java
possible better answer: http://stackoverflow.com/a/27522745
type: Question
has title: Extract string from http response in java client
score: 0
answer count: 2
has body: I want to extract the string returned from java web service in java client. The string returned from java web service is as follows: {"Name":"Raj Johri","Email":"mailraj@server.com","status":true} Which is a Json string format. I have written client code to extract this string as follows: public static void main(String[] args) throws Exception{ DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://localhost:8080/JsonWebService/services/JsonWebService/getData"); post.setHeader("Content-Type", "application/xml"); HttpResponse httpres = httpClient.execute(post); HttpEntity entity = httpres.getEntity(); String json = EntityUtils.toString(entity).toString(); System.out.println("json:" + json); } I am getting following print on the console for json as: json:&lt;ns:getDataResponse xmlns:ns="http://ws.jsonweb.com"&gt;&lt;ns:return&gt;{"Name":"Raj Johri","Email":"mailraj@server.com","status":true}&lt;/ns:return&gt;&lt;/ns:getDataResponse&gt; Please tell me how to extract the string {"Name":"Raj Johri","Email":"mailraj@server.com","status":true} which is the actual message. Thanks in advance...
has answer: http://stackoverflow.com/a/27522802
tagged with: httpresponse
tagged with: web-services
has answer: http://stackoverflow.com/a/27522745
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27522802

http://stackoverflow.com/a/27486525
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43408333
type: Answer
has body: Most of it is based on Groovy runtime metaclass programming. Have a look at AbstractGormApi and its implementations in Grails , you can find there most of the methods injected in runtime to all domain classes to perform all the magic tricks Grails does.
answers question: http://stackoverflow.com/q/27485417
accepted answer of: http://stackoverflow.com/q/27485417

http://stackoverflow.com/comment/43550768
has text: I don't know for sure, but I would think that running on a previous version would allow for security vulnerabilities. If you want to ensure a certain level of security then you should compile to be compatible with _only_ the level of security (via the JRE version) that you are comfortable with. Specifically, you should _not_ allow your application to be run on previous JRE versions that have known security vulnerabilities even though your code may be compatible with such lower JREs.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27562499
score: 0

http://stackoverflow.com/comment/43641235
has text: Hi guys, I try to log the result but I even get a null pointer exception from that - Caused by: java.lang.NullPointerException: println needs a message . I presume nothing goes in the line.
comment on: http://stackoverflow.com/q/27609424
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43527713
comment on: http://stackoverflow.com/q/27550230
type: QuestionComment
score: 0
has text: @TayfunKarakaş - I have tried simplifying it for you. Take a look.
type: Comment

http://stackoverflow.com/comment/43402173
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27485111
has text: It is totally healthy.

http://stackoverflow.com/comment/43444723
type: QuestionComment
score: 0
has text: @user3257891 then what are you waiting for? Start working on a `Comparator<Object>` and use `instanceof` to check the type of the element, then move all to a single format (probably `String` or `int`) and do the comparison.
comment on: http://stackoverflow.com/q/27507175
type: Comment

http://stackoverflow.com/a/27632585
has body: A string in Java originally consisted of a backing array of characters and a start/length indication (or it may be start/end, I can't remember - suffice to say it had enough information to use the same actual character array in a backing store when doing substrings). This allowed strings (which are immutable) to share the same data, such as with: str1 = new String("Pax is great"); str2 = str1.substring(0,3); In memory, that would have looked something like: str1 (backing, 0, 12) str2 (backing, 0, 3) +------------+ backing = |Pax is great| (shared) +------------+ So creating a new string from a substring operation (which is itself a new string) was indeed redundant, as per the preceding diagram (except for one case, see below). If you modified one of the strings with something like str2 = new String("xyzzy"), or any other operation that means it can no longer use the same characters, then it would get a new backing value automatically. I believe this changed in later releases of the JVM (1.7.0_06, look for bug ID 6924259). This is the case I referred to earlier, the case where the original behaviour could cause troubles where you allocated a large string, took a small substring of it, then got rid of the original. In that case, the small string would have kept the large backing array despite the fact it didn't need it all. That was the reason for new String(str.substring(...)) "trick" in that it created a new backing array (a smaller one) for the new string when using the original method. With the changes made that removed the sharing, substring() now produces a new backing array regardless. Hence the new String(str.substring(...)) trick is no longer needed.
accepted answer of: http://stackoverflow.com/q/27632533
answers question: http://stackoverflow.com/q/27632533
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43685194
type: Answer
has comment: http://stackoverflow.com/comment/43685139
has comment: http://stackoverflow.com/comment/43685499
score: 7
upvote count: 7

http://stackoverflow.com/q/27550213
score: -1
accepted answer: http://stackoverflow.com/a/27550326
type: Question
tagged with: onitemclicklistener
answer count: 1
has answer: http://stackoverflow.com/a/27550326
tagged with: android
has title: Why is my setOnItemClickListener not working?
favorite count: 0
tagged with: android-studio
upvote count: 0
tagged with: listener
downvote count: 1
type: AnsweredQuestion
has body: I have a custom ListView. This is the source: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:layout_width="60dp" android:layout_height="60dp" android:focusable="false" android:clickable="false" android:id="@+id/image_view" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;TextView android:id="@+id/list_item_string" android:layout_width="wrap_content" android:focusable="false" android:clickable="false" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:paddingLeft="8dp" android:textSize="25sp" android:textStyle="bold" android:layout_marginLeft="90dp" /&gt; &lt;ImageButton android:id="@+id/edit_btn" android:layout_width="60dp" android:layout_height="60dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:focusable="false" android:clickable="false" android:layout_marginRight="5dp" android:src="@android:drawable/ic_menu_edit" android:layout_marginTop="30dp" android:layout_marginBottom="30dp" /&gt; &lt;ImageButton android:id="@+id/delete_btn" android:layout_width="60dp" android:layout_height="60dp" android:layout_toLeftOf="@id/edit_btn" android:layout_centerVertical="true" android:focusable="false" android:clickable="false" android:layout_marginRight="10dp" android:src="@android:drawable/ic_menu_delete" android:layout_marginTop="30dp" android:layout_marginBottom="30dp" /&gt; &lt;/RelativeLayout&gt; This is the XML code of my activity where the listView is defined: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:pad…
tagged with: java

http://stackoverflow.com/comment/43429811
type: Comment
comment on: http://stackoverflow.com/a/27499558
score: 0
type: AnswerComment
has text: @Thilo: True. Will add something about that.

http://stackoverflow.com/q/27586408
has title: Java multi client server program
has answer: http://stackoverflow.com/a/27586585
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43597284
upvote count: 1
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/27586585
answer count: 1
has comment: http://stackoverflow.com/comment/43597228
favorite count: 0
has body: so iv been programming for awhile and im trying for the first time to make a multiplayer game. The main problem im having right now is updating the data of multiple clients on the server side simultaneously. heres the concept behind my code: Client establishes connection with server-> client sends messages to the server based on what key is pressed on the client side-> server updates itself 60 times a second based off of what key is currently being pressed by the client my main problem is with step 3, and my problem is a syntax error in my main thread: public static void updatethings() { for (ServerSocket i : ssList) { i.calculatePos(); } } error message is:The method calculatePos() is undefined for the type ServerSocket. what I tried to do was to make an array of ServerSockets, and update them all 60 times a second. each socket is its own thread of the server class. Iv listed the entire server program below: This is the main class for the server. This class listens for client connections and makes a new thread each time a client connects. public class ServerMain { static ArrayList&lt;ServerSocket&gt; ssList = new ArrayList&lt;ServerSocket&gt;(); static int oh = 0; public static void main(String[] args) throws IOException { int portNumber = 9000; boolean listening = true; UpdaterThread update = new UpdaterThread(); update.start(); try (ServerSocket serverSocket = new ServerSocket(portNumber)) { while (listening) { new ServerThread(serverSocket.accept()).start(); ssList.add(serverSocket); } } catch (IOException e) { System.err.println("Could not listen on port " + portNumber); System.exit(-1); } } //does not work public static void updatethings() { for (ServerSocket i : ssList) { ServerSocket.calculatePos(); } } } server thread class: public class ServerThread extends Thread { private Socket socket = null; byte input; private float playery; private float playerx; public ServerThread(Socket socket) { this.socket = socket; } public void calculatepos() { if (input == 0)…
tagged with: sockets
tagged with: multithreading

http://stackoverflow.com/comment/43444462
comment on: http://stackoverflow.com/q/27507004
type: Comment
type: QuestionComment
score: 0
has text: what's the size of the data you read trying to read?

http://stackoverflow.com/comment/43560541
score: 0
comment on: http://stackoverflow.com/q/27567712
type: QuestionComment
type: Comment
has text: You could put trace code in there that changes the caption on your windows so that you know where it stops.

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/27628336
tags question: http://stackoverflow.com/q/27506177
tags question: http://stackoverflow.com/q/27524788
tags question: http://stackoverflow.com/q/27562951
tags question: http://stackoverflow.com/q/27585411
tags question: http://stackoverflow.com/q/27501806
tags question: http://stackoverflow.com/q/27482941
tags question: http://stackoverflow.com/q/27485377
tags question: http://stackoverflow.com/q/27602572
tags question: http://stackoverflow.com/q/27637225
tags question: http://stackoverflow.com/q/27598273
tags question: http://stackoverflow.com/q/27483762
tags question: http://stackoverflow.com/q/27557761

http://stackoverflow.com/q/27583587
downvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/43591815
upvote count: 1
possible better answer: http://stackoverflow.com/a/27583733
has comment: http://stackoverflow.com/comment/43591908
tagged with: java
has comment: http://stackoverflow.com/comment/43591840
has answer: http://stackoverflow.com/a/27583770
has body: in this code i want to take no. of testcases by keyboard input and rest is the same problem. only what i am doing is like. if i take 2 test cases then it shud be print the result based on both cases after taking the complete input. For example: INPUT testcases : 2 //case1// 5(no of building) 7 5 2 11 1 //case2// 3(no. of building) 1 2 3 OUTPUT 7//OUTPUT FOR 1ST CASE// 0//OUTPUT FOR 2ND CASE// HOPE, NOW PROBLEM IS CLEAR import java.util.Scanner; public class Komal { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); System.out.println("enter the test cases"); int T=sc.nextInt(); for(int i=1;i&lt;=T;i++) { System.out.println("total no of building"); int n=sc.nextInt(); int ar[]=new int[n]; for(int j=0;j&lt;n;j++) { System.out.println("enter the heights"); ar[j]=sc.nextInt(); } for(int j=1;j&lt;ar.length;j++) {int sum=0; if(ar[0]&lt;ar[i]) { break; }else { sum += (ar[0]-ar[i]); } System.out.println(sum); } } } }
has comment: http://stackoverflow.com/comment/43591852
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/27583770
tagged with: arrays
has comment: http://stackoverflow.com/comment/43591977
tagged with: arraylist
type: AnsweredQuestion
has title: comparision b/w elements of an array
has comment: http://stackoverflow.com/comment/43591821
has comment: http://stackoverflow.com/comment/43591804
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/43591887
has answer: http://stackoverflow.com/a/27583733
type: Question
has comment: http://stackoverflow.com/comment/43591764
has comment: http://stackoverflow.com/comment/43591863

http://stackoverflow.com/a/32960328
type: AcceptedAnswer
downvote count: 0
has body: Case B is not correct, because neither the Connection nor the PreparedStatement can ever get closed. Only the items which are declared in the try block are auto-closed.
type: Answer
accepted answer of: http://stackoverflow.com/q/27483494
answers question: http://stackoverflow.com/q/27483494
upvote count: 2
score: 2

http://stackoverflow.com/a/27854974
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27585622
has body: This issue is not related to your Application setup. it seems your Application setup is fine. This is related to Seed data. The data which requires to initialize the default theme. To load the theme data, execute the following ant command then strat the application. The error should be disappeared now. ant load-seed

http://stackoverflow.com/comment/76713292
type: Comment
has text: I'm voting to close this question as off-topic because SO is here to help with code you wrote but SO is not here to write code for you.
comment on: http://stackoverflow.com/q/27553005
score: 0
type: QuestionComment

http://stackoverflow.com/a/27517877
answers question: http://stackoverflow.com/q/27517786
type: Answer
has body: "Find in Path" is probably what you're looking for. It is probably bound to ctrl+shift+f or cmd+shift+f, depending on your key bindings and whether you are on Mac / Windows / or Linux. It can also be found under the "Edit", "Find" menu.
score: 0

http://stackoverflow.com/a/27610214
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Surround each entry of type TEXT in VALUES with single quotes. For example, " VALUES ('" + athlete.getFirstName() + "')" Or, written out: " VALUES ('Bob')"
answers question: http://stackoverflow.com/q/27610124

buffer-overflow
tags question: http://stackoverflow.com/q/27619038
tag name: buffer-overflow
type: Tag

http://stackoverflow.com/comment/43696461
type: QuestionComment
has text: Please look into `PreparedStatement` to save yourself from `SQL injection`.
comment on: http://stackoverflow.com/q/27638800
score: 0
type: Comment

http://stackoverflow.com/comment/43533012
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27533785
score: 0
has text: If you can, try submitting this issue at their issue tracker https://code.google.com/p/gwt-google-apis/issues/list If simple usage of MapTypeStyleFeatureType throws a NPE, there might be something wrong with their implementation itself :|

http://stackoverflow.com/a/27528377
has comment: http://stackoverflow.com/comment/43486395
has comment: http://stackoverflow.com/comment/43485972
answers question: http://stackoverflow.com/q/27528289
has comment: http://stackoverflow.com/comment/43486634
downvote count: 0
has body: If we can assume that in is System.in, your while-loop will never terminate since System.in never ends, so to say. Take this quick example: Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { //Never terminates System.out.println(scanner.nextLine()); } This while loop will never terminate. Instead, try using a keyword to end the loop, eg "continue": Scanner scanner = new Scanner(System.in); String s; while(!(s = scanner.nextLine()).equals("continue")) { System.out.println(s); } This will terminate as soon as the user types in "continue" and assign nextLine() to s, which can be worked with inside the loop. So in your case: String s; while(!(s = scanner.nextLine()).equals("continue")){ risks.add(s); }
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43486486
has comment: http://stackoverflow.com/comment/43486268
upvote count: 1
has comment: http://stackoverflow.com/comment/43486041

http://stackoverflow.com/comment/43388068
has text: 1- It worked because `setText` changes what is displayed. `setName` is used as a internal marker, mostly for GUI form editors, but sometimes other things (some layout managers use it). 2- Calling `setVisible` before the UI has been built can make the UI appear "empty" or only partially updated on some systems, we also recommend calling it last to avoid these issues...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27476972

http://stackoverflow.com/a/27487075
score: 0
type: Answer
has body: first try with slash @RequestMapping("/admin")
answers question: http://stackoverflow.com/q/27486606

http
tags question: http://stackoverflow.com/q/27487979
tags question: http://stackoverflow.com/q/27591465
tags question: http://stackoverflow.com/q/27613646
tags question: http://stackoverflow.com/q/27499650
tags question: http://stackoverflow.com/q/27542762
tags question: http://stackoverflow.com/q/27573871
tags question: http://stackoverflow.com/q/27567398
tags question: http://stackoverflow.com/q/27537703
tags question: http://stackoverflow.com/q/27638311
tags question: http://stackoverflow.com/q/27624936
tags question: http://stackoverflow.com/q/27547284
tags question: http://stackoverflow.com/q/27490959
tag name: http
tags question: http://stackoverflow.com/q/27631998
type: Tag
tags question: http://stackoverflow.com/q/27508828
tags question: http://stackoverflow.com/q/27554178
tags question: http://stackoverflow.com/q/27496096

dialog
tags question: http://stackoverflow.com/q/27608429
tag name: dialog
tags question: http://stackoverflow.com/q/27514338
type: Tag
tags question: http://stackoverflow.com/q/27537626
tags question: http://stackoverflow.com/q/27475861

http://stackoverflow.com/a/40602648
upvote count: 1
type: Answer
has body: We can use String.matches(String regex)1 to validate phone numbers using java. Sample code snippet package regex; public class Phone { private static boolean isValid(String s) { String regex = "\\d{3}-\\d{3}-\\d{4}"; // XXX-XXX-XXXX return s.matches(regex); } public static void main(String[] args) { System.out.println(isValid("123-456-7890")); } } P.S. The regex pattern we use extra '\' for escaping when we use in java string. (Try to use "\d{3}-\d{3}-\d{4}" in java program, you will get an error.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27631692

http://stackoverflow.com/comment/43433033
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27501310
has text: ...and this has length 8? Why aren't you using `s`?
type: Comment

http://stackoverflow.com/comment/92687503
type: Comment
comment on: http://stackoverflow.com/a/27522895
has text: that's not always correct. the x-forwarded-for header might contain a list of IP. so this code might return a list of IPs instead of a single IP address
type: AnswerComment
score: 0

http://stackoverflow.com/q/27481592
has answer: http://stackoverflow.com/a/27481719
has comment: http://stackoverflow.com/comment/43396017
tagged with: android
has title: Jackson: Convert JSON to object: ArrayList of objects with arraylist of objects with arraylist of objects
has body: I have an android app which makes a call do rest api. It returns a list of restaurants. Each restaurant has list of categories. Each category can have multiple dishes. When I deserialize this list, I have nice ArrayList of Restaurants, each Restaurant also has an ArrayList of Categories, but in Category class, ArrayList of Dishes is null. Does anyone has any idea how to solve this? JSON response: (it's actually a object of type ServiceResponse) { "requestToken" : 0, "responseCode" : 2, "objectType" : "com.test.Restaurant", "error" : null, "data" : [ { "id" : 1, "name" : "Name", "addressCity" : "Warszawa", "addressStreet" : "Kopernika", "addressStreetNumber" : "4", "addressApartmentNumber" : "17", "categories" : [ { "id" : 1, "restaurantId" : 1, "name" : "Breakfast", "description" : "Description", "dishes" : [ { "id" : 11, "categoryId" : 1, "name" : "Dish 1", "description" : "Descr", "price" : 8.99, "photoId" : 51 }, { "id" : 21, "categoryId" : 1, "name" : "Dish 2", "description" : "Descr", "price" : 6.99, "photoId" : 41 }, { "id" : 31, "categoryId" : 1, "name" : "Dish 3", "description" : "Descr", "price" : 14.99, "photoId" : 61 } ] }, { "id" : 2, "restaurantId" : 1, "name" : "Obiady", "description" : "Opis kategorii", "dishes" : [ { "id" : 41, "categoryId" : 2, "name" : "Danie 4", "description" : "Descr", "price" : 6.99, "photoId" : 0 }, { "id" : 61, "categoryId" : 2, "name" : "Danie 5", "description" : "Descr", "price" : 8.0, "photoId" : 0 }, { "id" : 101, "categoryId" : 2, "name" : "Nowy obiad", "description" : "", "price" : 111.0, "photoId" : 0 } ] }, { "id" : 3, "restaurantId" : 1, "name" : "Pasta", "description" : "Opis kategorii", "dishes" : [ ] }, { "id" : 4, "restaurantId" : 1, "name" : "Przystawki", "description" : "Opis kategorii", "dishes" : [ ] }, { "id" : 11, "restaurantId" : 1, "name" : "Some category", "description" : "test", "dishes" : [ ] }, { "id" : 51, "restaurantId" : 1, "name" : "Sushi", "description" : "", "dishes" : [ ] } ] }] } Parsing result…
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43396252
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/27481719
has comment: http://stackoverflow.com/comment/43396130
answer count: 1
tagged with: jackson
favorite count: 0

http://stackoverflow.com/a/32734199
has body: For me disabling JAX-RS in project properties wasn't enough. Uninstalling JAX-RS solved the problem though. Go to Help > About Eclipse, click Installation Details, find JAX-RS and uninstall. No side-effects so far.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27519957
type: Answer

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/27483228
type: Tag

http://stackoverflow.com/comment/43551290
has text: Your code has a compile time error: `allCookies` at the end is not defined.
comment on: http://stackoverflow.com/q/27561662
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27537411
has comment: http://stackoverflow.com/comment/43534676
has answer: http://stackoverflow.com/a/27550448
accepted answer: http://stackoverflow.com/a/27550448
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43503156
possible better answer: http://stackoverflow.com/a/27537461
tagged with: swing
type: AnsweredQuestion
has body: I have a java app to open the file in separate windows, but the menu bar and frame title doesn’t show on the second windows. As you can see when the file is open on the first windows that the title and menu bar appear. When I open the file by clicking the menu on the first windows. The file opens on the second windows but no frame title and menu bar. Would someone tell me how I can solve this problem? Thank in advance. The image is the first file opening on the windows The image is the second file opening on the separate window There is my code: package PDFAnnotationPackage; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; import javax.swing.filechooser.*; import java.util.*; import javax.swing.JButton; import java.awt.Color; import javax.swing.JTextField; import PDFAnnotationPackage.WindowMenu.ChildMenuItem; import com.qoppa.pdf.IEmbeddedFile; import com.qoppa.pdf.annotations.IAnnotSelectionListener; import java.io.File; public class Question extends JFrame implements ActionListener{ public final static String PDFEXTENSION= "pdf"; private ArrayList&lt;File&gt; fileList=new ArrayList&lt;File&gt;(); private PDFInternalFrame internalFrame=null; private ArrayList&lt;PDFInternalFrame&gt; lstInternalFrame=new ArrayList&lt;PDFInternalFrame&gt;(); public static void main(String[] args) { // TODO Auto-generated method stub if (args.length&gt;0){ Utility.DisplayTestMsg(args[0]); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Question(); } }); } public Question(File newFile) { String extension=getExtension(newFile); if ( PDFEXTENSION.equalsIgnoreCase(extension)){ AddJPDFNote(newFile); } else{ Utility.DisplayWarningMsg("Only PDF File"); } // TODO Auto-generated constructor stub } public Question(){ super("Question"); //it is equal to this.setDefaultClo…
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43503232
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/43503185
has comment: http://stackoverflow.com/comment/43527350
has answer: http://stackoverflow.com/a/27537461
has title: Open JFrame in second window lost menu bar
has comment: http://stackoverflow.com/comment/43534656
has comment: http://stackoverflow.com/comment/43503140

http://stackoverflow.com/q/27482547
tagged with: java
score: 6
has title: Eclipse bug? Java/Groovy visibility of private fields
type: Question
has body: I have two classes, an abstract Java class, and a Groovy subclass extending the Java class. They look something like this: (Java) public abstract class Testing1 { private static int myField = 0; //static not relevant to the issue. } (Groovy) class Testing2 extends Testing1 { public static void main(String[] args) { println myField; } } Now, as the field is declared private running Testing2 gives an exception. As expected. However, Eclipse doesn't give any warnings saying that this field is not visible, and even auto-completes the myField word should you type it! Is there an Eclipse setting I can activate so that I don't burn myself when coding Java and Groovy?
tagged with: eclipse
has answer: http://stackoverflow.com/a/27505017
tagged with: groovy
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43423119
type: UnansweredQuestion
upvote count: 6
has comment: http://stackoverflow.com/comment/43431462

http://stackoverflow.com/q/27594807
tagged with: java
type: Question
has title: transactions with spring 3 / jdbctemplate and postgresql 9.3
has body: I tried to enable transactions in my app and something is not going OK. app context: &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:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"&gt; &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; &lt;property name="driverClassName" value="org.postgresql.Driver"/&gt; &lt;property name="url" value="jdbc:postgresql://localhost/db"/&gt; &lt;property name="username" value="postgres"/&gt; &lt;property name="password" value="postgres"/&gt; &lt;property name="defaultAutoCommit" value="false" /&gt; &lt;/bean&gt; &lt;bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" &gt; &lt;constructor-arg name="dataSource" ref="dataSource" /&gt; &lt;/bean&gt; &lt;tx:annotation-driven transaction-manager="txManager" /&gt; &lt;/beans&gt; service class sample: @Service @Transactional public class ProviderManager { @Autowired private ProviderDao providerDao; @Autowired private ProvisionDao provisionDao; (...) public void save(BindingResult result, Provider provider){ try{ check(result,provider); if(!result.hasErrors()){ providerDao.save(provider); provisionDao.saveProvider(provider); } }catch(org.springframework.jdbc.CannotGetJdbcConnectionException e){ result.addError(new ObjectError("page", "Error!")); }catch(Exception e){ result.addError(new ObjectError("page","Error: " + ExceptionUtils.getStackTrace(e) )); } } dao class sample: @Repository public class ProvisionDao { @Autowired …
tagged with: postgresql
score: 0
has comment: http://stackoverflow.com/comment/43617614
has comment: http://stackoverflow.com/comment/43621408
has comment: http://stackoverflow.com/comment/43643079
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/43626401
tagged with: spring-mvc
answer count: 0

http://stackoverflow.com/q/27576566
has answer: http://stackoverflow.com/a/27576580
accepted answer: http://stackoverflow.com/a/27576580
has body: import java.util.Scanner; //this program test input validation yes or no program public class Fool { public static void main(String [] args) { String input; char first; Scanner keyboard=new Scanner(System.in); System.out.println("Enter yes or no "); input=keyboard.nextLine(); first=input.charAt(0); System.out.print(first); while( first !='y' || first !='n') { System.out.println("please enter yes or no"); } } } What is trying to get the program to is that the user has to remain in the while loop if the user does not put in yes or no.
has answer: http://stackoverflow.com/a/27576967
upvote count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/27576636
has title: Why is this java input validation loop not working
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27576733
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43578487
possible better answer: http://stackoverflow.com/a/27576636
has comment: http://stackoverflow.com/comment/43578607

http://stackoverflow.com/comment/43650330
type: QuestionComment
comment on: http://stackoverflow.com/q/27614131
has text: Add appcompact-v7 library & clean your project.
score: 0
type: Comment

http://stackoverflow.com/comment/43480767
type: Comment
score: 0
type: QuestionComment
has text: Specifically: I have have 2 @EFragment-annotated class (with different layouts files... one for the portrait and one for the landscape versions of my fragment), each one extends a base class with some common logic. Most of my fragments are equivalent, also with some @ViewById()-annotated Views. Ideally I wanted to put the logic in the base class, where I declare my Views and access to them, and insert the annotation in the child classes
comment on: http://stackoverflow.com/q/27524597

http://stackoverflow.com/q/27523276
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/27528074
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: I want to convert a dom nodelist to a json array and send the result to a rest client: Each node of the xml represents the following: I want that i i will have for the output an array of objects where each object looks like the following: {"NAME":"x", "COUNT":"y", "B": [ {"KEY": "z1, VALUE:"z2"}, {"KEY":"z3", VALUE:"z4"} ] } I tried to use the GSON library: package com.a; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class Test { private static final String XPATH = "/A/B"; public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { File f = new File("C:/Users/abc/Desktop/a.xml"); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(f); XPath xPath = XPathFactory.newInstance().newXPath(); NodeList nodeList = (NodeList) xPath.compile(XPATH).evaluate(xmlDocument, XPathConstants.NODESET); Gson gson = new GsonBuilder().setPrettyPrinting().create(); String jsonOutput = gson.toJson(nodeList); System.out.println(jsonOutput); } } but i am getting an error Exception in thread "main" java.lang.StackOverflowError at java.lang.StringBuffer.append(StringBuffer.java:224) at java.io.StringWriter.write(StringWriter.java:84) at com.google.gson.stream.JsonWriter.newline(JsonWriter.java:569) at c…
accepted answer: http://stackoverflow.com/a/27528074
has title: convert xpath expression result to json
linked to: http://stackoverflow.com/q/1823264
answer count: 1
downvote count: 0

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/27547171

http://stackoverflow.com/q/27524442
has body: I am trying to run a Jersey server on my local OS X machine. So far, I have executed these three commands as per the Jersey website instruction: mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \ -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \ -DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example \ -DarchetypeVersion=2.14 mvn clean test mvn exec:java It appears to be working fine, in that the last command prints this: Dec 17, 2014 12:05:15 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [localhost:8080] Dec 17, 2014 12:05:15 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Jersey app started with WADL available at http://localhost:8080/myapp/application.wadl Hit enter to stop it... However, when trying to call http://localhost:8080 in the browser, I get an address unreachable error. I have also tested it with telnet: telnet localhost 8080 Which returns a connection refused error. Clearly, the Jersey servlet "thinks" it's listening locally on port 8080, but it's definitely not. I have tried reaching it using 127.0.0.1 instead of localhost, and I have tried running Jersey on a different port. Nothing seems to be able to fix it. I'm running Jersey 2.1.4 with Maven 3.2.3 on OS X 10.10 and using Java 1.8.0. EDIT: There is no firewall blocking incoming connections. I have turned it off to eliminate that possibility.
has comment: http://stackoverflow.com/comment/43478511
answer count: 2
has answer: http://stackoverflow.com/a/27545828
has comment: http://stackoverflow.com/comment/43478548
downvote count: 0
has comment: http://stackoverflow.com/comment/43478648
favorite count: 0
has comment: http://stackoverflow.com/comment/43478762
has comment: http://stackoverflow.com/comment/43478792
tagged with: rest
has comment: http://stackoverflow.com/comment/43479468
has comment: http://stackoverflow.com/comment/43478677
has comment: http://stackoverflow.com/comment/43501226
has comment: http://stackoverflow.com/comment/43479419
tagged with: maven
has comment: http://stackoverflow.com/comment/43478708
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27545828
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/27530192
has comment: http://stackoverflow.com/comment/43478875
has title: Jersey RESTful Web Service Connection Refused
has comment: http://stackoverflow.com/comment/43478476
has answer: http://stackoverflow.com/a/27530192
tagged with: connection-refused
has comment: http://stackoverflow.com/comment/43480145
type: Question
score: 3
tagged with: jersey

http://stackoverflow.com/comment/43484793
comment on: http://stackoverflow.com/a/27527376
has text: @MarounMaroun Well, a use case is, that a return in `finally` would always return a specific value, no matter if an exception occurred or not. So you don't have to write the return statement in the `try`and every `catch` block. But I don't think that this was the main reason for this design decision.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27540408
answers question: http://stackoverflow.com/q/27539871
upvote count: 2
has comment: http://stackoverflow.com/comment/43509178
type: Answer
has body: It is perfectly fine from a language grammer - syntax perspective. The compiler does not mix Class name with a variable name, since both will be in different scope. Both mean different things to the compiler. So it is perfectly fine to have a variable name as the same as the Class name. The next aspect is the readability and maintainability. In this aspect, it is a very bad practice to have both the same. Because human beings mistake one for another. The very question you had asked itself is a sign that it will be difficult to maintain and manage such a piece of code. Moreover the program which you have provided will result in a compilation error saying test is not initialized.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43508397
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/27539871

http://stackoverflow.com/a/27613250
type: Answer
answers question: http://stackoverflow.com/q/27613141
score: 1
upvote count: 1
has body: It was a bug which got fixed in the later versions. I verified with 1.2.15 and it works as expected.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27613141

http://stackoverflow.com/a/27636534
downvote count: 0
has comment: http://stackoverflow.com/comment/43692556
type: Answer
has body: You said that getRolesByRoleNameTenant returns a Role You said that the exception occurs on roleList = (List&lt;Role&gt;) roleFunctionService.getRolesByRoleNameTenant(...)); The class cast exception is telling you that you cannot cast a Role to a List&lt;Role&gt;. Basically, either your findRoleByRoleNameTenant method is buggy, or the declaration for getRolesByRoleNameTenant is incorrect. Either way, you are attempting to do a class cast that won't and cannot work.
upvote count: 1
answers question: http://stackoverflow.com/q/27635859
score: 1

http://stackoverflow.com/comment/43631000
type: AnswerComment
comment on: http://stackoverflow.com/a/27574713
score: 0
has text: Well, post the code where you *populate* the map. Looks like you're not putting any values in there.
type: Comment

http://stackoverflow.com/comment/43455668
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27499572
type: Comment
has text: @user1675173 I'm not aware of a way to exclude this warning only for a single method, sorry.

http://stackoverflow.com/a/27587626
score: 0
has body: I guess this is one of those problems which are already solved efficiently by existing tools and shouldn't implement yourself. The interviewer probably wanted to hear about using unix tools like sed. If you are asked to write code though, then the simplest way would be to use another output file and read the file part-by-part in a buffer, find/replace, write to output.
type: Answer
answers question: http://stackoverflow.com/q/27587289

http://stackoverflow.com/q/27555002
has title: Delete A Specific Item In A MySQL Table JDBC
has body: I am trying to delete a specific item in my MySQL table: inventory, however I keep getting an SQLException when I try to do this. Here is my code: try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, root, password); statement = con.createStatement(); int count = statement.executeUpdate(sqlQuery); String sqlQuery = "DELETE FROM inventory WHERE inventory ='?'"; ps = con.prepareStatement(sqlQuery); ps.setString(1, item); count = ps.executeUpdate(); }catch(ClassNotFoundException e) { e.printStackTrace(); }catch(SQLException e) { e.printStackTrace(); }finally { try { con.close(); ps.close(); }catch(SQLException e) { e.printStackTrace(); } } and this is the error I get: java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870) at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3391) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3376) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3413) at com.mysql.jdbc.PreparedStatement.setNull(PreparedStatement.java:3452) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3954) at Inventory.deleteFromDatabase(Inventory.java:102) at Inventory$2.actionPerformed(Inventory.java:284) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java…
tagged with: prepared-statement
type: Question
upvote count: 1
answer count: 1
tagged with: jdbc
favorite count: 0
has comment: http://stackoverflow.com/comment/43536358
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27555039
downvote count: 0
score: 1
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/27565695
answers question: http://stackoverflow.com/q/27564967
score: 0
has comment: http://stackoverflow.com/comment/43567452
has body: May be this example will help you http://www.mkyong.com/hibernate/hibernate-one-to-many-relationship-example-annotation/ http://viralpatel.net/blogs/hibernate-one-to-many-annotation-tutorial/ Can you please remove cascade=CascadeType.PERSIST and try. Can you please write output of you query so I can help you.
type: Answer

http://stackoverflow.com/q/27492797
has comment: http://stackoverflow.com/comment/43417803
has comment: http://stackoverflow.com/comment/43417315
tagged with: http://stackoverflow.com/tag/jpeg
accepted answer: http://stackoverflow.com/a/27722997
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43417468
tagged with: java
type: Question
has body: i am working on a making a Multiframe DICOM player in java and here is the code that i have used: 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.image.BufferedImage; import java.io.File; import java.util.Vector; import javax.imageio.ImageReader; import javax.imageio.stream.FileImageInputStream; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import org.dcm4che2.imageioimpl.plugins.dcm.DicomImageReaderSpi; public class DicomMultiframePlayer extends JFrame implements ActionListener, Runnable { private static final long serialVersionUID = 1L; private JLabel fileLabel; private JTextField fileField; private JButton btnChoose; private JButton btnPlay; private JButton btnPause; private JButton btnStop; private JButton btnExit; private Vector&lt;BufferedImage&gt; images; private ImagePanel imagePanel; private boolean stop; private int currentFrame; public DicomMultiframePlayer() { super("DICOM Multiframe Player using dcm4che - by samucs-dev"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.getContentPane().setLayout(new BorderLayout()); images = new Vector&lt;BufferedImage&gt;(); imagePanel = new ImagePanel(); fileLabel = new JLabel("File:"); fileField = new JTextField(30); btnChoose = this.createJButton(25, 25, "..."); btnPlay = this.createJButton(80,25,"Play"); btnPause = this.createJButton(80,25,"Pause"); btnStop = this.createJButton(80,25,"Stop"); btnExit = this.createJButton(80,25,"Exit"); btnStop.setEnabled(false); JPanel panelNorth = new JPanel(); panelNorth.add(fileLabel); panelNorth.add(fileField); panelNorth.add(btnChoose); JPanel panelSouth = new JPanel(); panelSouth.add(btnPlay); panelSouth.add(btnPause); panelSouth.add(btnStop); panelSouth.add(btnExit); this.getContentPane().add(pan…
has comment: http://stackoverflow.com/comment/43418114
tagged with: image
has answer: http://stackoverflow.com/a/27722997
score: 0
has title: Dicom Multiframe Player
tagged with: dicom
answer count: 1

http://stackoverflow.com/q/27539112
tagged with: java
has comment: http://stackoverflow.com/comment/43521895
has comment: http://stackoverflow.com/comment/43511121
has comment: http://stackoverflow.com/comment/43529292
has title: LibGDX ScrollPane Showing Black Screen
answer count: 2
has comment: http://stackoverflow.com/comment/43543696
downvote count: 0
accepted answer: http://stackoverflow.com/a/27550903
has comment: http://stackoverflow.com/comment/69061590
favorite count: 0
has answer: http://stackoverflow.com/a/34925409
tagged with: android
has comment: http://stackoverflow.com/comment/68385717
score: 6
possible better answer: http://stackoverflow.com/a/34925409
upvote count: 6
has comment: http://stackoverflow.com/comment/43522234
has comment: http://stackoverflow.com/comment/43511210
type: AnsweredQuestion
has body: Situation: First of all, I'm newbie in LibGDX. I'm making a game where players may see all achievements in a screen, so I'm using a ScrollPane for this. The achievements are shown in a form of pop up (see image below). The list of achievements will be inside those red lines. Screenshot: Problem: The problem is: the screen only shows black screen when I added a widget to the ScrollPane. The weird thing is: - When I dragged the ScrollPane, everything is rendered properly. - But when I let go, the screen goes black again. What I've done: - I figured out that any actors (not just table) I put inside the ScrollPane parameter will result in black screen. - If I set it to null, it works fine. Code: public void show() { stage = new Stage(); roomScreenUI = new RoomScreenUI(); roomScreenUI.setName("RoomScreenUI"); stage.addActor(roomScreenUI); roomScreenButton = new RoomScreenButton[5]; for(int i=0; i&lt;roomScreenButton.length; i++){ roomScreenButton[i] = new RoomScreenButton(i+1, roomScreenUI.getScaleFactor()); roomScreenButton[i].setName("RoomScreenButton"); stage.addActor(roomScreenButton[i]); } roomScreenAchievementUI = new RoomScreenAchievementUI(roomScreenUI.getScaleFactor()); roomScreenAchievementUI.setName("RoomScreenAchievementUI"); stage.addActor(roomScreenAchievementUI); //----------------THE PROBLEM LIES HERE----------------// achievementContainer = new Table(); scrollPane = new ScrollPane(achievementContainer); // scrollPane = new ScrollPane(null); &lt;-- If I replace it with this line, it works fine //----------------THE PROBLEM LIES HERE----------------// achievementTable = new Table(); achievementTable.setSize(roomScreenAchievementUI.getWidth() * 0.9f, roomScreenAchievementUI.getHeight() * 0.8f); achievementTable.setPosition(roomScreenAchievementUI.getX() + roomScreenAchievementUI.getWidth() / 2 - achievementTable.getWidth() / 2, roomScreenAchievementUI.getY() + roomScreenAchievementUI.getHeight() * 0.48f - achievementTable.getHeight() / 2); achievementTable.…
tagged with: scrollpane
has answer: http://stackoverflow.com/a/27550903
type: Question
tagged with: libgdx

http://stackoverflow.com/a/27604295
score: 2
has comment: http://stackoverflow.com/comment/43630757
accepted answer of: http://stackoverflow.com/q/27604211
has comment: http://stackoverflow.com/comment/43630932
answers question: http://stackoverflow.com/q/27604211
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43630797
has body: stop condition in the for loop can't write as this for(int i = 0, j = 0; j &lt; list.length, i &lt; list.length; i++, j++) in this situation a simple for(int i = 0, j = 0; i &lt; list.length; i++, j++) is good enough or just: for(int i=0; i&lt;list.length; i++){ result[i] = list[i]; }
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43630993

http://stackoverflow.com/comment/43667601
score: 2
has text: What do you mean by *not able to access any .jar file*? Which error message do you get? Is this opened by another application?
comment on: http://stackoverflow.com/q/27623554
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43397585
type: AnswerComment
comment on: http://stackoverflow.com/a/27482466
type: Comment
has text: I've updated my question mate, sorry my bad I didn't mention enough details
score: 0

http://stackoverflow.com/a/27571655
type: Answer
answers question: http://stackoverflow.com/q/27571156
has comment: http://stackoverflow.com/comment/98347773
has comment: http://stackoverflow.com/comment/43569219
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/98398608
accepted answer of: http://stackoverflow.com/q/27571156
has body: You can do this in Java. try(FileChannel fc = new RandomAccessFile("myFile.bin", "rw").getChannel()) { FloatBuffer fb = fc.map(MapMode.READ_WRITE, 0, fc.size()) .order(ByteOrder.nativeOrder()).asFloatBuffer(); // use fb } This is quite a bit faster as it memory maps the file and avoids a memory copy (you can do the same in C++)

http://stackoverflow.com/comment/43512000
type: QuestionComment
type: Comment
score: 0
has text: Yes. the referenced column is not PK but a unique constrained column.
comment on: http://stackoverflow.com/q/27541894

http://stackoverflow.com/a/27588158
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27587892
upvote count: 1
answers question: http://stackoverflow.com/q/27587892
type: AcceptedAnswer
downvote count: 0
has body: It states in the documentation link you've provided Finally, you define any dependencies you might have. In this case, as the case with all JDBC data sources, we would be dependent on the Java JDBC API's, which in this case in defined in another module called javax.api, which you can find under modules/javax/api/main as you would expect. You can look in the highlighted directory you'll find another module.xml. This is the module definition for the named module "javax.api". Just as you have defined your module as "com.mysql", if any other modules in the system needed your module, it would also define a <dependencies> element with your module name. A module is simply defined as A Module is a logical grouping of classes used for class loading and dependency management... A module dependency is a declaration that one module requires the classes of another module in order to function. Modules can declare dependencies on any number of other modules. When the application server loads a module, the modular class loader parses the dependencies of that module and adds the classes from each dependency to its class path. If you are familiar with Maven, it's kind of the same thing. A dependency may depend on other dependencies. In the pom.xml an artifact will define its dependencies. If you depend on that artifact, then you will also require its dependencies. Further Reading: Module Descriptors Class Loadings and Modules

health-monitoring
tags question: http://stackoverflow.com/q/27616606
type: Tag
tag name: health-monitoring

http://stackoverflow.com/comment/43592599
has text: That's a good optimization, however my problem is that i can't fetch anything from KeyStore, so i won't be able to fetch PrivateKey, any clue ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27583789

http://stackoverflow.com/q/27560989
has answer: http://stackoverflow.com/a/27561013
answer count: 2
has comment: http://stackoverflow.com/comment/43547964
possible better answer: http://stackoverflow.com/a/27561013
has body: I want to logout automatically if app is idle for some time , like session time out , how it can be done in android app?
favorite count: 0
tagged with: session-timeout
tagged with: android
has title: Log-out app automatically if app is idle for some time
has answer: http://stackoverflow.com/a/27561018
has comment: http://stackoverflow.com/comment/43557313
has comment: http://stackoverflow.com/comment/43548074
type: AnsweredQuestion
tagged with: java
score: -4
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43548021
accepted answer: http://stackoverflow.com/a/27561018
downvote count: 5

http://stackoverflow.com/comment/43662617
type: QuestionComment
comment on: http://stackoverflow.com/q/27620960
type: Comment
has text: I'm not sure if it will fix it, but I think you have to add `con.commit` after the execution the statement
score: 0

http://stackoverflow.com/a/27790696
downvote count: 0
has comment: http://stackoverflow.com/comment/62878515
has body: Using Spring data's Specification interface I was able to approximate the use of query by example. Here's a PersonSpec class which implements Specification and requires an "example" person in order to setup the Predicate returned by the Specification: public class PersonSpec implements Specification&lt;Person&gt; { private final Person example; public PersonSpec(Person example) { this.example = example; } @Override public Predicate toPredicate(Root&lt;Person&gt; root, CriteriaQuery&lt;?&gt; cq, CriteriaBuilder cb) { List&lt;Predicate&gt; predicates = new ArrayList&lt;&gt;(); if (StringUtils.isNotBlank(example.getLastName())) { predicates.add(cb.like(cb.lower(root.get(Person_.lastName)), example.getLastName().toLowerCase() + "%")); } if (StringUtils.isNotBlank(example.getFirstName())) { predicates.add(cb.like(cb.lower(root.get(Person_.firstName)), example.getFirstName().toLowerCase() + "%")); } if (example.getEmployed() != null) { predicates.add(cb.equal(root.get(Person_.employed), example.getEmployed())); } if (example.getDob() != null) { predicates.add(cb.equal(root.get(Person_.dob), example.getDob())); } return andTogether(predicates, cb); } private Predicate andTogether(List&lt;Predicate&gt; predicates, CriteriaBuilder cb) { return cb.and(predicates.toArray(new Predicate[0])); } } The repository is simply: import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; public interface PersonRepository extends JpaRepository&lt;Person, Long&gt;, JpaSpecificationExecutor {} Usage example: Person example = new Person(); example.setLastName("James"); example.setEmployed(true); PersonSpec personSpec = new PersonSpec(example); List&lt;Person&gt; persons = personRepository.findAll(personSpec);
score: 28
answers question: http://stackoverflow.com/q/27626825
has comment: http://stackoverflow.com/comment/77525513
has comment: http://stackoverflow.com/comment/123583956
type: Answer
upvote count: 28
has comment: http://stackoverflow.com/comment/57633835

http://stackoverflow.com/q/27488567
answer count: 2
possible better answer: http://stackoverflow.com/a/27492484
has answer: http://stackoverflow.com/a/27492484
has answer: http://stackoverflow.com/a/27502424
tagged with: serialization
linked to: http://stackoverflow.com/q/23837215
tagged with: wicket
has comment: http://stackoverflow.com/comment/43419637
has title: Invalid lambda deserialization
has comment: http://stackoverflow.com/comment/43412523
downvote count: 0
tagged with: lambda
has body: The Eclipse JDT compiler appears to have a problem whereby, under certain circumstances, Java 8 lamdas are not deserializing correctly and instead throw an IllegalArgumentException. I'm using the most recently distributed maintenance build, as follows: Eclipse SDK Version: Luna SR2 (4.4.2) Build id: M20141210-0900 There are existing bugs / SO entries that report similar issues that have been (at least partially) resolved in Luna SR2 (4.4.2) M20141210-0900. I have personally verified that the following issues have been resolved. Java 8 lambdas that access instance fields and methods can&#39;t be deserialized https://bugs.eclipse.org/bugs/show_bug.cgi?id=449453 https://bugs.eclipse.org/bugs/show_bug.cgi?id=439889 To give some context to my problem, I'm using Apache Wicket which calls for the use of anonymous inner classes quite frequently. Since upgrading to Java 8, I've started re-factoring the anonymous inner classes into lamda expressions, which really helps reduce boiler plate code. Apache Wicket uses serialization to cache web pages that the user has visited, deserializing the pages when the uses navigates back to a previous page. Whilst my code is serializing quite happily, it will not deserialize. The posts linked above led me to focus my investigation; it transpires that compiling under javac resolves the issue. This demonstrates that this is another JDT compiler bug. It isn't however fixed alongside the other lamda deserialization bugs in the latest maintenance release. There are several areas from which I could benefit from a response: Is there anything obvious that I could be doing wrong that would lead to a successful serialization but unsuccessful deserialization? Is there an outstanding JDT compiler bug for this that I've missed? I'm finding debugging this one really tricky. Because the classes I'm having to debug aren't compiled for debug, all I can inspect is the stack, which I find very limiting. Without being able to reproduce the problem outside of …
type: AnsweredQuestion
score: 2
tagged with: java
favorite count: 0
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/27502424
type: Question
upvote count: 2

http://stackoverflow.com/q/27553389
upvote count: 1
has title: What are websocket clients available for Android?
type: Question
has comment: http://stackoverflow.com/comment/43533070
has comment: http://stackoverflow.com/comment/106543911
has body: I have implemented a prototype for Java based chat application. It uses jetty client and tomcat 8 server for websocket communication. I wanted to port the client to android. I am not sure Jetty is the best fit for android environment since I am getting errors like the following while I run the app: 12-18 23:43:59.016 2315-2315/com.example.root.chat_application I/art﹕ Rejecting re-init on previously-failed class java.lang.Class&lt;org.eclipse.jetty.util.log.JettyAwareLogger&gt; 12-18 23:43:59.016 2315-2315/com.example.root.chat_application I/art﹕ Rejecting re-init on previously-failed class java.lang.Class&lt;org.eclipse.jetty.util.log.JettyAwareLogger&gt; 12-18 23:43:59.032 2315-2315/com.example.root.chat_application W/System.err﹕ Defaulting Uptime to NOIMPL due to (java.lang.UnsupportedOperationException) Implementation not available Please suggest on options available for websocket clients for android. Thanks.
answer count: 1
downvote count: 0
tagged with: websocket
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/28449164
score: 1
tagged with: java

http://stackoverflow.com/q/27500119
has body: Has anyone ever met this kind of Exception before? I was trying deploying a App with Spring and RabbitMQ, however there is no idea to explain this exception thanks~ org.springframework.context.ApplicationContextException: Failed to start bean 'peopleStackQueueListenerContainer'; nested exception is org.springframework.amqp.UncategorizedAmqpException: java.util.concurrent.TimeoutException: Timed out waiting for startup at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:170) at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339) at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143) at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:945) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.j…
tagged with: spring
tagged with: rabbitmq
has answer: http://stackoverflow.com/a/27514864
tagged with: java
type: Question
has title: Nested exception is org.springframework.amqp.UncategorizedAmqpException: java.util.concurrent.TimeoutException
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27515269
downvote count: 1
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/27515297
linked to: http://stackoverflow.com/q/2279030
tagged with: arraylist
answer count: 2
tagged with: string
favorite count: 0
type: UnansweredQuestion
has body: String[] somestringarray = { "a","b","c"}; Also, List&lt;String&gt; A = new ArrayList&lt;String&gt;(Arrays.asList(somestringarray)); is Arrays.asList() a collection? And the statement is initializing a list of the size of somestringarray? Why can't I just have somestringarray? what is the point of declaring a list of strings, what is wrong having just somestringarray?
has comment: http://stackoverflow.com/comment/43461573
has title: Is there a difference between List<String> A = new ArrayList<String> ( ) and ArrayList<String> A = new ArrayList<String>()?
has answer: http://stackoverflow.com/a/27515323
upvote count: 2
has comment: http://stackoverflow.com/comment/43461180
score: 1
tagged with: java

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/27571120
type: Tag

http://stackoverflow.com/q/27517104
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27527916
tagged with: java
has title: Checking Checkboxes In Custom Listview From Parse.com
type: Question
score: 0
tagged with: android-listview
tagged with: android-checkbox
has comment: http://stackoverflow.com/comment/43465660
answer count: 1
has body: i'm facing a problem of logic. I'm getting data from Parse.com and i need to mark checkboxes as checked if the current user is liking a card. Everything works fine but i have to scroll down and up to change the status of the checkboxes here is my code public class CardsFragment extends ListFragment { public static final String TAG = CardsFragment.class.getSimpleName(); protected List&lt;ParseObject&gt; mCards; protected ParseRelation&lt;ParseObject&gt; mUserCategoriesRelation; protected ParseRelation&lt;ParseObject&gt; mCardsLikeRelation; protected ParseUser mCurrentUser; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_cards, container, false); return rootView; } @Override public void onResume() { super.onResume(); getActivity().setProgressBarIndeterminateVisibility(true); final List&lt;CardModel&gt; list = new ArrayList&lt;CardModel&gt;(); mCurrentUser = ParseUser.getCurrentUser(); mCardsLikeRelation = mCurrentUser.getRelation("cardLikesRelation"); mUserCategoriesRelation = mCurrentUser.getRelation(ParseConstants.KEY_CATEGORIES_RELATION); ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery(ParseConstants.CLASS_CARD); query.whereEqualTo(ParseConstants.KEY_DELETED, false); query.orderByDescending(ParseConstants.KEY_CREATED_AT); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { @Override public void done(List&lt;ParseObject&gt; cards, ParseException e) { getActivity().setProgressBarIndeterminateVisibility(false); if (e == null) { mCards = cards; for (final ParseObject card : mCards) { list.add(get(card.getString("title"), card.getString("content"), card.getString("background"), card.getBoolean("background_image"),card.getInt("likes"))); } if (getListView().getAdapter() == null) { ArrayAdapter&lt;CardModel&gt; adapter = new CardAdapter(getListView().getContext(), list); setListAdapter(adapter); } else { //refill the adapter ((CardAdapter) …
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/43465440

http://stackoverflow.com/comment/43516847
type: Comment
has text: @Vikram what do you exactly wanna know? the class name is mDateSetListener according to my activity. If you wanna change the way it is called you can do that.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27544613

http://stackoverflow.com/comment/43413097
type: AnswerComment
has text: No I want that web and task to be separated application I don't want web-context to see beans that are defined in task-context neither task-context to see beans defined in web-context
type: Comment
comment on: http://stackoverflow.com/a/27490137
score: 0

http://stackoverflow.com/a/27800361
has comment: http://stackoverflow.com/comment/44054089
type: Answer
has comment: http://stackoverflow.com/comment/44053592
accepted answer of: http://stackoverflow.com/q/27600166
answers question: http://stackoverflow.com/q/27600166
downvote count: 0
has body: Unfortunately the question and comments merely include (by running the sample project) the actual result for two source documents and the description The annotating text should be center aligned on the top and bottom marker, aligned to the left on the right marker and aligned to the right on the left marker. The alignment is not working for me, as the font.getSTringWidth( .. ) returns only a fraction of what it seems to be. And the discrepance seems to be different in both PDFs. but not a concrete sample discrepancy to repair. There are several issues in the code, though, which may lead to such observations (and other ones, too!). Fixing them should be done first; this may already resolve the issues observed by the OP. Which box to take The code of the OP derives several values from the media box: PDRectangle pageSize = page.findMediaBox(); float pageWidth = pageSize.getWidth(); float pageHeight = pageSize.getHeight(); float lineWidth = Math.max(pageWidth, pageHeight) / 1000; float markerRadius = lineWidth * 10; float fontSize = Math.min(pageWidth, pageHeight) / 20; float fontPadding = Math.max(pageWidth, pageHeight) / 100; These seem to be chosen to be optically pleasing in relation to the page size. But the media box is not, in general, the final displayed or printed page size, the crop box is. Thus, it should be PDRectangle pageSize = page.findCropBox(); (Actually the trim box, the intended dimensions of the finished page after trimming, might even be more apropos; the trim box defaults to the crop box. For details read here.) This is not relevant for the given sample documents as they do not contain explicit crop box definitions, so the crop box defaults to the media box. It might be relevant for other documents, though, e.g. those the OP could not include. Which PDPageContentStream constructor to use The code of the OP adds a content stream to the page at hand using this constructor: PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, t…
has comment: http://stackoverflow.com/comment/59464840
score: 10
upvote count: 10
type: AcceptedAnswer

http://stackoverflow.com/comment/43536560
type: AnswerComment
has text: @user2604052 [Here](http://stackoverflow.com/questions/21349030/how-to-create-a-custom-http-message-converter-spring-mvc-3-1-2) is a XML example. Look for the `WebMvcConfigurationSupport` class and how to use it. There are tons of examples online.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27554689

http://stackoverflow.com/comment/43399938
type: Comment
score: 1
has text: @flashdrive2049 it ignores the first element, which achieves the same thing.
comment on: http://stackoverflow.com/a/27483808
type: AnswerComment

http://stackoverflow.com/comment/43543365
comment on: http://stackoverflow.com/q/27558594
type: Comment
has text: Can you not include the other Jar as a library? This would be a much cleaner solution.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43528194
has text: You are executing the println() statements in the constructor. The constructors are being executed on the main thread.
comment on: http://stackoverflow.com/q/27550977
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/27613957
linked to: http://stackoverflow.com/q/20001427
has answer: http://stackoverflow.com/a/27614549
upvote count: 1
tagged with: java-8
type: Question
has comment: http://stackoverflow.com/comment/43650011
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43649948
answer count: 1
downvote count: 0
has body: Let me say that I have a single string concatenated uris. http://...[sp]http://...[sp]http://... I'm trying to convert each split string to URIs. Stream.of(string.split("\\s")).map(uri -&gt; URI::new); Compiler complains. Cannot infer type-variable(s) R What did I do wrong?
has title: How to map strings to URIs?
favorite count: 0
type: UnansweredQuestion
tagged with: lambda
tagged with: java-stream

http://stackoverflow.com/comment/43402370
type: Comment
has text: `class B` can still be `Serializable` despite non-`Serializable` field `o` if it implements `readObject()` and `writeObject()` to provide handling for the non-transient fields. For example, it could be a monitor object used for `synchronized`. It's often not necessary to serialize it, so you would usually find `private Object lock;` and `private void readObject(ObjectInputStream in) { in.defaultReadObject(); lock = new Object(); }` and `private void writeObject(ObjectOutputStream out) { out.defaultWriteObject(); }`.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27478471

http://stackoverflow.com/comment/43587941
has text: did you Get the file?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27549226

http://stackoverflow.com/q/27575974
has title: Running a java project in terminal with multiple .java files (multiple attempts described inside)
has comment: http://stackoverflow.com/comment/43577570
has body: I have been doing a coding exercise inside the IntelliJ IDEA Community Edition 14 IDE, using OpenJDK. The project is split over 4 .java files all in the same package. My end goal is to run this in the terminal/bash (I use System.console().readLine() which doesnt play nicely in the IDE's console). I've tried navigating to the directory where these 4 files reside (they all reside in the same dir) and tried: javac -classpath . BibliotecaApp.java Book.java BookManager.java LibraryDB.java This creates 4 corresponding .class files fine. The Main is in bibliotecaApp.java/class, so I try run it by: java BibliotecaApp But I get the error Exception in thread "main" java.lang.NoClassDefFoundError: BibliotecaApp (wrong name: com/twu/biblioteca/BibliotecaApp) Plus about 13 lines of specifics. Now googling this error seems to be a class path problem, and this is where I get stuck. From places I've read, usingecho $PATH gives me: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games This is still from the directory of the .java files above. That path means nothing to me. I have no idea what it is or what it does, or what even a classpath is! Theres alot of resources out there on setting a classpath, but they aren’t helping me because I don't know what it's meant for. That was a dead end for me. I tried to create a .jar instead using IDEA's Build Artifacts as seen HERE. It created a .jar file but when I navigate to that directory and try run it via: java -jar biblioteca_jar I get Error: Invalid or corrupt jarfile biblioteca_jar Another issue is that in the file explorer, the file actually comes out as biblioteca.jar, but ls on that dir shows biblioteca_jar. Is that normal? The code is on my GitHub if that helps anything https://github.com/botagar/twu-biblioteca-JohnGeddes
has comment: http://stackoverflow.com/comment/43577426
has comment: http://stackoverflow.com/comment/43577661
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27576018
accepted answer: http://stackoverflow.com/a/27576018
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/43577516
score: 0
tagged with: intellij-idea
answer count: 1
linked to: http://stackoverflow.com/q/2025607
tagged with: compilation
has comment: http://stackoverflow.com/comment/43577409
has comment: http://stackoverflow.com/comment/43577377
tagged with: bash

http://stackoverflow.com/comment/43434293
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27501714
has text: Note: `excludePattern` exists since `2.1.7`.

http://stackoverflow.com/comment/43582513
has text: Can you please tell me how to pass using POST
comment on: http://stackoverflow.com/a/27578923
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/27574427
score: 1
answers question: http://stackoverflow.com/q/27549075
upvote count: 1
has body: Stop doing: throw new UnsupportedOperationException("Not supported yet."); in the listener and that will work :-)
type: Answer
downvote count: 0

http://stackoverflow.com/a/27592968
accepted answer of: http://stackoverflow.com/q/27590138
answers question: http://stackoverflow.com/q/27590138
type: Answer
upvote count: 5
downvote count: 0
has body: JPA is not magic. As @Andy Dufresne suggested, remove the CascadeType.REMOVE annotation. Then you have to set Persona to null in the Telefono, and clear the Telefono collection of the Persona before removing the Persona from the persistence context. So you have to remove all associations. You can even combine this with the @PreRemove annotation.
has comment: http://stackoverflow.com/comment/43614131
has comment: http://stackoverflow.com/comment/43636290
score: 5
has comment: http://stackoverflow.com/comment/43658781
type: AcceptedAnswer

http://stackoverflow.com/a/27501620
upvote count: 1
has comment: http://stackoverflow.com/comment/43438278
has body: It is because you create all the threads with the same object, try it like this : PrintThread pr1 = new PrintThread(); Thread T1 = new Thread(pr1); PrintThread pr2 = new PrintThread(); Thread T2 = new Thread(pr2); PrintThread pr3 = new PrintThread(); Thread T3 = new Thread(pr3); T1.start(); T2.start(); T3.start(); And make i static something like this : static AtomicInteger i = 0 And change you for loop to while loop some thing like: while(i.getAndIncrement()&lt;101){ //DO your stuff }
downvote count: 0
has comment: http://stackoverflow.com/comment/43438583
has comment: http://stackoverflow.com/comment/43438319
has comment: http://stackoverflow.com/comment/43433878
answers question: http://stackoverflow.com/q/27501432
type: Answer
score: 1

http://stackoverflow.com/comment/43681521
type: AnswerComment
score: 0
type: Comment
has text: Huh? The OP specifically mentioned == and was wondering why hashCode was not being called. The reason is that java does not do operator overloading and that == does not call .equals.
comment on: http://stackoverflow.com/a/27630494

http://stackoverflow.com/a/27620283
answers question: http://stackoverflow.com/q/27620071
type: Answer
score: 0
has body: BufferReader readLine Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed. When you have multiply lines, you should put your code in a loop like this to read each line one by one: public static void main(String[] args) throws IOException { BufferedReader bufferedReaderToWrite = new BufferedReader( new FileReader(new File("D:/tmp/Z_Z_DELETE_ASAP/file.txt"))); while ((lineFromFile = bufferedReaderToWrite.readLine()) != null) { StringBuilder sb = new StringBuilder(); if (lineFromFile.startsWith(UTF8_BOM)) { lineFromFile = lineFromFile.substring(1); } lineFromFile = lineFromFile.substring(1, lineFromFile.length() - 1); //Convert bytes read back to String for (String s : lineFromFile.split(", ")) { //Split every byte on , sb.append((char) Integer.parseInt(s)); //Convert byte to char } String textToCheck = sb.toString(); //Convert StringBuilder to String System.out.println(textToCheck); System.out.println(); System.out.println(cardNumberStr); if (textToCheck.contains(cardNumberStr)) { System.out.println(lineFromFile); } System.out.println(); } } Then the output will be: Name test cardNo 189493284 Current Balance 94 overdraft false overDraftLimit 0 pin 2323 106382076 Name tedt cardNo 701725231 Current Balance 260 overdraft false overDraftLimit 0 pin 2222 106382076

http://stackoverflow.com/q/27475332
has title: How to post json with volley to php web service
tagged with: php
has answer: http://stackoverflow.com/a/31009174
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27475848
type: Question
answer count: 2
score: 0
has body: I am trying to Post Json to my restful API with volley but it doesn't work. So far i have tested my web service by sending a json payload through the Advance rest client app on chrome and it returns a json response.... but when i try it with Volley it returns onErrorResponse. Please can someone tell me how to solve this problem, thanks in advance. Json payLoad: {"country":"isreal","mobile":"009988778"} Code private void processLogin() { showProgressDialog(); JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.POST, Const.LOGIN_URL, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { Log.i("JSON response", "JSON Posting" + response.toString()); hideProgessDialog(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { VolleyLog.d(ERROR_TAG, "Error: " + volleyError.getMessage()); hideProgessDialog(); } }){ @Override public Map&lt;String, String&gt; getHeaders() throws AuthFailureError { HashMap&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;(); headers.put("Content-Type", "application/json"); return headers; } @Override protected Map&lt;String, String&gt; getParams(){ String country_value = country.getSelectedItem().toString(); String mobile_value = mobile.getText().toString(); Map&lt;String, String&gt; params = new HashMap&lt;&gt;(); params.put("country",country_value); params.put("mobile", mobile_value); return params; } }; AppController.getInstance().addToRequestQueue(jsonObjReq, login_tag); }
has comment: http://stackoverflow.com/comment/43385100
tagged with: android-volley
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/43665560
type: Comment
comment on: http://stackoverflow.com/a/27612109
type: AnswerComment
has text: I think the compiler inserts the cast to `Quod` because the compile time type of `test` says that should be done (it's an `ArrayList<Quod>`). In this *particular* case, we might hope that it would elide the cast because it's passing it to a method that accepts an `Object` anyway, but it doesn't. When you do a `get` on an `ArrayList<Foo>` it *always* inserts a cast to `Foo`.
score: 0

http://stackoverflow.com/q/27601526
has answer: http://stackoverflow.com/a/27601856
has body: I need an expert advise on following scenario. I have a string template (lets assume email templates) as follows. Dear {PERSON_NAME}, We would like to thank you on behalf of {CEO_NAME}, {COMPANY_NAME}. You have been selected for the position of {POSITION_NAME} in {DEPARTMENT_NAME} etc etc Here is replacement code String body = getTemplateBody(tempalteId); sendMail( body.replace("{PERSON_NAME}", personName ) .replace("{CEO_NAME}", ceoName), .replace("{COMPANY_NAME}", companyName), .replace("{POSITION_NAME}", positionName), .replace("{DEPARTMENT_NAME}", deptName), .replace("{X}", someVar1), .replace("{Y}", someVar2), .replace("{Z}", someVar3), .replace("{ETC_ETC}", "etc") ); What we have: 20 variables enclosed with { }, like {PERSON_NAME} These variables are fixed not changing in single template string. These variables are unique, none of the variables is repeated again in same template 10,000 instances of each template is used in one hour. do daily would be (10,000 * 24) Question: what is the efficient(not elegant) way to replace variables in a template string to get the actual resultant string Efficient in terms of memory first and then processing? Would there be any memory leakage or any problem in above code? Please note above code is just a sample to explain my requirements in simple words, and may not be checked for Variable or method names coding standards.
tagged with: replace
has answer: http://stackoverflow.com/a/27604461
tagged with: string
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/1326682
has comment: http://stackoverflow.com/comment/43625541
type: UnansweredQuestion
upvote count: 1
score: -2
has answer: http://stackoverflow.com/a/27601670
has title: Java replacing strings safely without leakage
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/27601675
has comment: http://stackoverflow.com/comment/43625721
type: Question

http://stackoverflow.com/comment/43710303
type: Comment
has text: Yes, I guess that helped me.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27645987

http://stackoverflow.com/a/27568710
has body: What you are trying to do is tricky because any array (except an array of primitives) is an Object[], so as you have noticed, the method will always accept any array and any object. One way around this could be to pass an explicit Class object, like this public static &lt;T&gt; boolean arrayContains(T[] array, T object, Class&lt;T&gt; clazz) Then you could write arrayContains(new String[]{"stuff"}, "more stuff", String.class) but not arrayContains(new String[]{"stuff"}, new Pig(), String.class)
downvote count: 1
score: 3
answers question: http://stackoverflow.com/q/27568248
upvote count: 4
has comment: http://stackoverflow.com/comment/43632869
type: Answer

http://stackoverflow.com/q/27615135
has answer: http://stackoverflow.com/a/27615198
tagged with: rest
type: UnansweredQuestion
has title: Jersey Classpathscanning example jersey.config.server.provider.classpath
has body: Can anyone give me example to use "jersey.config.server.provider.classpath". I want to try to lookuo my rest reources located in a java project. This project is added to [arent Dynamic web project in its class path. Follwoing it the web.xml where i have used this parameter for classpath scanning of rest resources: <?xml version="1.0" encoding="UTF-8"?> com.vogella.jersey.first Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages rest.resources jersey.config.server.provider.classpath rpi.resources 1 Jersey REST Service /rest/* Is something wrong in this, as I am not able to point to my resource. Thanks in advance!
score: 2
has comment: http://stackoverflow.com/comment/43651960
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/70313797
tagged with: jersey
answer count: 2
downvote count: 0
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/43653595

http://stackoverflow.com/comment/43694355
comment on: http://stackoverflow.com/q/27637643
type: QuestionComment
type: Comment
has text: Seems to be a duplicate indeed. Thanks Paul.
score: 0

http://stackoverflow.com/a/27615748
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: toString() creates a new string object every time and your code is actually checking if both references are the same, which is never the case so it runs the else case. If you try i.toString().equals(i.toString()) you'll get the desired output.
accepted answer of: http://stackoverflow.com/q/27615715
answers question: http://stackoverflow.com/q/27615715
type: AcceptedAnswer

http://stackoverflow.com/a/27514807
accepted answer of: http://stackoverflow.com/q/27504360
score: 0
type: Answer
has body: Apparently, you cannot copy from a browser's password field as @ankitkatiyar91 pointed out. I was mistaken. This question is meaningless until you can find a way to copy the password from the browser's password field.
answers question: http://stackoverflow.com/q/27504360
type: AcceptedAnswer

adobe-native-extensions
tags question: http://stackoverflow.com/q/27558729
tag name: adobe-native-extensions
type: Tag

http://stackoverflow.com/q/27581641
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27582184
type: Question
has answer: http://stackoverflow.com/a/27581825
has answer: http://stackoverflow.com/a/27581678
answer count: 6
has title: Moving recursively in arrays
upvote count: 2
has answer: http://stackoverflow.com/a/27582927
has comment: http://stackoverflow.com/comment/43587684
has answer: http://stackoverflow.com/a/27581685
has body: Does anybody know how to move "on the ones" and change them to 2? I think we need recursion, but I'm not very good at it, so I'm asking you for help. You can only move up, down, left or right. Here is an example: int[][] a = {{ 0, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1} }; recursiveFunction(a, 1, 1); // (&lt;array you're checking&gt;, &lt;x of the group&gt;, &lt;y of the group&gt; /* int a now contains: * { 0, 0, 0, * 2, 2, 0, * 2, 2, 2, * 2, 0, 2 } */ int[][] b = {{0, 0, 0, 0, 1}, {1, 1, 0, 0, 1}, {1, 1, 1, 0, 1}, {1, 0, 1, 0, 1} }; recursiveFunction(b, 0, 5); /* int b now contains: * { 0, 0, 0, 0, 2 * 1, 1, 0, 0, 2 * 1, 1, 1, 0, 2 * 1, 0, 1, 0, 2 } */
accepted answer: http://stackoverflow.com/a/27582184
tagged with: recursion
possible better answer: http://stackoverflow.com/a/27581666
has comment: http://stackoverflow.com/comment/43587613
has answer: http://stackoverflow.com/a/27581666
tagged with: java
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/43607694
has text: _`I got a problem that is Board.class can not run draw() and tick() method which I want`_ - What's the problem? Do you get an compile time error? Or an Exception?
comment on: http://stackoverflow.com/q/27591991
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/27480107
has body: I have a textbox where you enter a player name and it changes the label to the name entered. I want to store it so that when I reset the game (Just make a new board) it still says the player name in the label. These are the fields related to the name: private JTextField nameEnter = new JTextField("Enter name here"); private JButton saveName = new JButton("Play"); private JLabel namelabel = new JLabel("Player 1"); private static String playername; The reset method. public void reset(){ GameBoard.this.setVisible(false); GameBoard.this.dispose(); new GameBoard(); score = 0; } When I call a new GameBoard() the UpdateName() funtion is called: public void UpdateName() { saveName.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ playername = nameEnter.getText(); namelabel.setText(playername); } }); } 1.) Can anyone tell me how to carry the name over to the next game so it displays in the label? 2.) (a bit cheeky here) If you can spot why the reset method does not dispose of the last GameBoard window even though I asked it to? That would be a great help. Thanks.
has answer: http://stackoverflow.com/a/27480244
linked to: http://stackoverflow.com/q/19556932
has answer: http://stackoverflow.com/a/27480353
has comment: http://stackoverflow.com/comment/43394734
has answer: http://stackoverflow.com/a/27480155
score: 0
tagged with: user-interface
has answer: http://stackoverflow.com/a/27481492
linked to: http://stackoverflow.com/q/3114756
accepted answer: http://stackoverflow.com/a/27481492
has title: Java game not saving variable on reset
answer count: 4
has comment: http://stackoverflow.com/comment/43393957
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27480155
tagged with: java
has comment: http://stackoverflow.com/comment/43393969
tagged with: swing
type: Question

http://stackoverflow.com/a/27964437
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27622045
has body: This was fixed by placing the classes with the JPA annotations and enum classes into the domain-dir/lib/applib directory. You have to place these classes in a JAR in the domain-dir/lib/applib directory and then specify the jar on the deploy command with asadmin using the --libraries jar1,jar2,etc. Do not place a space after the comma when listing multiple JAR files. Also, I had a common JAR that had EJB remote interfaces, so I had to break out my JPA classes into a new JAR and place them in my applibs directory also. I then put the JAR with the EJB remote interfaces into my EAR\lib directory. The JARs in the lib/applibs directory are loaded by the URLClassLoader. The JARs in the EAR\lib are loaded by the EARLibClassLoader.
answers question: http://stackoverflow.com/q/27622045
type: Answer

http://stackoverflow.com/a/27475985
has comment: http://stackoverflow.com/comment/43390816
has comment: http://stackoverflow.com/comment/43386546
type: Answer
has body: Assuming you working with Java 1.7+, you could use Javas Non-Blocking I/O classes. The tutorial from Oracle covers all the basics working with files: https://docs.oracle.com/javase/tutorial/essential/io/fileio.html Basically you have to create a java.nio.file.Path instance which points to the folder you want to search, e.g // Microsoft Windows syntax Path path = Paths.get("C:\\home\\joe\\foo"); // Solaris syntax Path path = Paths.get("/home/joe/foo"); Note that you always get a Path instance, even if the specified path doesn't exist. The Files class has some static utility methods like exists() or isDirectory() to verify Path objects. With a valid Path object you can process the contents of a directory with a FileVisitor or via DirectoryStream. Reference: http://docs.oracle.com/javase/7/docs/api/java/nio/file/package-summary.html
downvote count: 0
answers question: http://stackoverflow.com/q/27475079
score: 1
upvote count: 1

http://stackoverflow.com/a/27522099
score: 13
has comment: http://stackoverflow.com/comment/43502373
upvote count: 14
downvote count: 1
accepted answer of: http://stackoverflow.com/q/27521672
has comment: http://stackoverflow.com/comment/59571693
answers question: http://stackoverflow.com/q/27521672
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/81853611
has comment: http://stackoverflow.com/comment/60511382
has body: The stacktrace suggest that you haven't defined the Bean which you will like to use for injecting in RedisTemplate.You can resolve it creating a configuration file, E.g. import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.GenericToStringSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class AppConfig { @Bean JedisConnectionFactory jedisConnectionFactory() { return new JedisConnectionFactory(); } @Bean RedisTemplate&lt; String, Long &gt; redisTemplate() { final RedisTemplate&lt; String, Long &gt; template = new RedisTemplate&lt; String, Long &gt;(); template.setConnectionFactory( jedisConnectionFactory() ); template.setKeySerializer( new StringRedisSerializer() ); template.setHashValueSerializer( new GenericToStringSerializer&lt; Long &gt;( Long.class ) ); template.setValueSerializer( new GenericToStringSerializer&lt; Long &gt;( Long.class ) ); return template; } } Once you have the configuration file then you need to pass it to SpringApplication.run E.g. Object[] sources = {AppConfig.class}; ApplicationContext ctx = SpringApplication.run(sources, args);
type: Answer

http://stackoverflow.com/a/27596758
type: Answer
has body: I tested your current code. Just changed in ScrollView From : android:layout_height="fill_parent" To : ` android:layout_height="wrap_content" If contents exceeds the current screen size then you can scroll. Thank you.
answers question: http://stackoverflow.com/q/27595913
score: 0

http://stackoverflow.com/a/31251148
upvote count: 1
answers question: http://stackoverflow.com/q/27581734
type: Answer
has body: First of all. First block of code doesn't seem to be standard C code at all or rather you use some libraries that I just simply doesn't know. There is no simple way to get actual time with less than a second accuracy in standard C. But here is the example with Java and C that actually works, so I hope this would help. Java package stackOverflow; import java.util.Date; public class Main { public static void main(String[] args) { long lDateTime = new Date().getTime(); System.out.println(lDateTime/1000); } } Output: 1436200408 C #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; #include&lt;sys/time.h&gt; #include&lt;time.h&gt; int main(void) { struct timeval tv; gettimeofday(&amp;tv, NULL); printf("%ld\n", tv.tv_sec); return 0; } Output: 1436200418
downvote count: 0
score: 1

http://stackoverflow.com/a/27516617
has body: A hashmap is probably the way to go here. It allows constant time access (some overhead required, but I'm assuming you want a solution that scales well) to any element in the map. HashMap&lt;String, String&gt; specificSolution = new HashMap&lt;String, String&gt;(); specificSolution.put("a", "b"); specificSolution.put("b", "c"); specificSolution.put("c", "a"); // To get all nodes in the graph Set&lt;String&gt; nodes = specificSolution.keySet(); I implemented with String here because you don't provide a definition for the Node Class in your question, but it can be easily swapped out. There are many different ways to represent a graph and each has their own limitations/advantages. Maybe another might be more appropriate but we would need more information about the problem.
answers question: http://stackoverflow.com/q/27516177
score: 0
type: Answer

http://stackoverflow.com/a/27618969
has body: white spaces may cos this error. try to trim() the input line while reading line, like, line = bufferedReader.readLine().trim();
type: Answer
answers question: http://stackoverflow.com/q/27618371
score: 0

http://stackoverflow.com/a/27577016
type: Answer
has comment: http://stackoverflow.com/comment/120033863
answers question: http://stackoverflow.com/q/27576985
has comment: http://stackoverflow.com/comment/43579581
has body: Try adding "Class.forName(): public void dbconnect(){ try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); Connection conn=DriverManager.getConnection("jdbc:ucanaccess://C:/Users/Ghazi/workspace/java w access/login.accdb"); Statement stment = conn.createStatement(); } catch(Exception err) { System.out.println(err); } } The basic problem is that earlier versions of Java/JDBC used ODBC to connect to MS-Access ... and the ODBC driver has been removed from Java 8. Two alternatives are to use: 1) UCanAccess: http://ucanaccess.sourceforge.net/site.html ... or ... 2) Jackcess (Jackcess 2.0: New crunchy outside, same yummy filling!): http://jackcess.sourceforge.net/ If that doesn't work: 3) Please specify what what IDE you're using (Eclipse, etc - if applicable) 4) Make sure your jackcess-2.0.7.jar is explicitly included in the CLASSPATH (how to do this depends on your IDE) 5) Consider using a directory without spaces in the name
has comment: http://stackoverflow.com/comment/43580157
has comment: http://stackoverflow.com/comment/43582877
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/120003462
has comment: http://stackoverflow.com/comment/43586963

http://stackoverflow.com/comment/48623369
comment on: http://stackoverflow.com/a/27565044
has text: >you can simulate popping from the sorted set by consuming the element, you mean get and zrem?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43606218
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27590967
has text: thanks for the code. I realized that the problem was another handler wasn't there to wait before changing another color
type: AnswerComment

http://stackoverflow.com/q/27521069
has body: I made a mistake and I flipped expected and actual in my assert assertEqual. Fortunately after importing project IntellijIdea detected problem and suggested flipping arguments. Unfortunately this problem is repeated in multiple assertEquals. Is it possible to accept multiple IntellijIdea's inspection suggestions at the same time? I found only way to accept it for a single instance of problem.
score: 2
type: AnsweredQuestion
upvote count: 2
has title: Accept multiple IntellijIdea's inspection suggestions at the same time (all of the same type)
tagged with: unit-testing
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27521216
tagged with: assert
tagged with: validation
tagged with: intellij-idea
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27521216

http://stackoverflow.com/a/61781420
answers question: http://stackoverflow.com/q/27628385
score: 8
has body: Well, roughly 5½ years later, it turned out, it wasn't the future... No JVMs on iOS. But you can definitely do it, i.e., call Swift APIs from Java. That said, it's quite cumbersome, because AFAIK, you have to take a detour via C/C++. Here's the deal: As you know, you can use JNI to call C code. From C you can call Swift. The following relies heavily on this question. Code Your Java code is in helloworld/SwiftHelloWorld.java: package helloworld; public class SwiftHelloWorld { static { System.loadLibrary("SwiftHelloWorld"); } public static native void printHelloWorldImpl(); public static void main(final String[] args) { printHelloWorldImpl(); } } Now write the native C code (file helloworld_SwiftHelloWorld.c): #include <jni.h> #include <stdio.h> #include "helloworld_SwiftHelloWorld.h" #include "helloworld_SwiftHelloWorld_swift.h" JNIEXPORT void JNICALL Java_helloworld_SwiftHelloWorld_printHelloWorldImpl (JNIEnv *env, jclass clazz) { int result = swiftHelloWorld(42); printf("%s%i%s", "Hello World from JNI! ", result, "\n"); } Which uses a header file named helloworld_SwiftHelloWorld_swift.h for our (yet to be written) Swift code: int swiftHelloWorld(int); Finally, our Swift code resides in SwiftCode.swift: import Foundation // force the function to have a name callable by the c code @_silgen_name("swiftHelloWorld") public func swiftHelloWorld(number: Int) -> Int { print("Hello world from Swift: \(number)") return 69 } Building To build all this, we first have to compile the Swift code to a dynamic library: swiftc SwiftCode.swift -emit-library -o libSwiftCode.dylib -Xlinker -install_name -Xlinker libSwiftCode.dylib We use the -Xlinker directives to ensure that the dylib's location is relative. Before we can create the C dylib, we first have to generate the Java headers: javac -h . helloworld/SwiftHelloWorld.java Now that we have the Java headers and the Swift dylib, we can compile the C dylib, which links against the Swift dylib: gcc -I"$JAVA_HOME/include" -I"$JAVA_HOME…
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/122832979
upvote count: 8

http://stackoverflow.com/a/74912851
type: Answer
answers question: http://stackoverflow.com/q/27571377
score: 0
has body: private final static DateTimeFormatter BIRTH_DAY_FORMATTER = DateTimeFormatter.ofPattern("yyyy-M-d"); public static LocalDate convertDate(String dateString) { return LocalDate.parse(dateString, BIRTH_DAY_FORMATTER); } You can use this way in your Utils class and since DateTimeFormatter is threadsafe, you can use it as a field in your Utils class

jvm
tags question: http://stackoverflow.com/q/27512569
tags question: http://stackoverflow.com/q/27582765
tags question: http://stackoverflow.com/q/27628170
tags question: http://stackoverflow.com/q/27557501
tags question: http://stackoverflow.com/q/27549912
tags question: http://stackoverflow.com/q/27542326
type: Tag
tags question: http://stackoverflow.com/q/27566677
tags question: http://stackoverflow.com/q/27525857
tags question: http://stackoverflow.com/q/27636829
tags question: http://stackoverflow.com/q/27507016
tags question: http://stackoverflow.com/q/27551031
tags question: http://stackoverflow.com/q/27478826
tags question: http://stackoverflow.com/q/27530403
tags question: http://stackoverflow.com/q/27569527
tags question: http://stackoverflow.com/q/27496870
tags question: http://stackoverflow.com/q/27527178
tags question: http://stackoverflow.com/q/27507008
tags question: http://stackoverflow.com/q/27566889
tags question: http://stackoverflow.com/q/27532309
tag name: jvm
tags question: http://stackoverflow.com/q/27507742
tags question: http://stackoverflow.com/q/27545627
tags question: http://stackoverflow.com/q/27605656
tags question: http://stackoverflow.com/q/27479385
tags question: http://stackoverflow.com/q/27628563
tags question: http://stackoverflow.com/q/27555349
tags question: http://stackoverflow.com/q/27616762
tags question: http://stackoverflow.com/q/27578586
tags question: http://stackoverflow.com/q/27493043
tags question: http://stackoverflow.com/q/27630451

http://stackoverflow.com/a/27484964
has comment: http://stackoverflow.com/comment/43402832
type: Answer
has comment: http://stackoverflow.com/comment/43405810
has comment: http://stackoverflow.com/comment/43424572
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27475034
has comment: http://stackoverflow.com/comment/43424431
has comment: http://stackoverflow.com/comment/43424612
has body: Iterator is not Synchronized in SynchronizedCollection. I have attached SynchronizedCollection code. static class SynchronizedCollection&lt;E&gt; implements Collection&lt;E&gt;, Serializable { private static final long serialVersionUID = 3053995032091335093L; final Collection&lt;E&gt; c; // Backing Collection final Object mutex; // Object on which to synchronize SynchronizedCollection(Collection&lt;E&gt; c) { this.c = Objects.requireNonNull(c); mutex = this; } SynchronizedCollection(Collection&lt;E&gt; c, Object mutex) { this.c = Objects.requireNonNull(c); this.mutex = Objects.requireNonNull(mutex); } public int size() { synchronized (mutex) {return c.size();} } public boolean isEmpty() { synchronized (mutex) {return c.isEmpty();} } public boolean contains(Object o) { synchronized (mutex) {return c.contains(o);} } public Object[] toArray() { synchronized (mutex) {return c.toArray();} } public &lt;T&gt; T[] toArray(T[] a) { synchronized (mutex) {return c.toArray(a);} } public Iterator&lt;E&gt; iterator() { return c.iterator(); // Must be manually synched by user! } public boolean add(E e) { synchronized (mutex) {return c.add(e);} } public boolean remove(Object o) { synchronized (mutex) {return c.remove(o);} } public boolean containsAll(Collection&lt;?&gt; coll) { synchronized (mutex) {return c.containsAll(coll);} } public boolean addAll(Collection&lt;? extends E&gt; coll) { synchronized (mutex) {return c.addAll(coll);} } public boolean removeAll(Collection&lt;?&gt; coll) { synchronized (mutex) {return c.removeAll(coll);} } public boolean retainAll(Collection&lt;?&gt; coll) { synchronized (mutex) {return c.retainAll(coll);} } public void clear() { synchronized (mutex) {c.clear();} } public String toString() { synchronized (mutex) {return c.toString();} } // Override default methods in Collection @Override public void forEach(Consumer&lt;? super E&gt; consumer) { synchronized (mutex) {c.forEach(consumer);} } @Override public boolean removeIf(Predicate&lt;? super E&gt; …
downvote count: 0

http://stackoverflow.com/q/27560667
has comment: http://stackoverflow.com/comment/43981201
score: 2
has title: Encoding JSON using ESAPI encoder
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43560064
answer count: 1
downvote count: 0
favorite count: 0
tagged with: esapi
upvote count: 2
has body: I have encoded JSON (using ESAPI encoder) in the server side.The client then retrieves the fields of the bean and does further processing. On the server side JSONBean bean=new JSONBean(); //populate the bean Gson gson=new Gson(); String jsonString = gson.toJson(bean); String JSEscapedStr=ESAPI.encoder().encodeForJavaScript(jsonString); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(JSEscapedStr); Encoded JSON string \x7B\x22name\x22\x3A\x22Sameer\x22,\x22company\x22\x3A\x22Company\x22,\x22designation\x22\x3A\x22Developer\x22\x7D On the client side var JSONObj=JSON.parse(data); var name=JSONObj["name"]; var company=JSONObj["company"]; var designation=JSONObj["designation"]; //process these variable in javascript I have also tried using response.setContentType("plain/text"); in the server side which also doesnot work. Error SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data when content type is "plain/text" If I hard code the json String then it works var jsonEncoded="\x7B\x22name\x22\x3A\x22Sameer\x22,\x22company\x22\x3A\x22Company\x22,\x22designation\x22\x3A\x22Developer\x22\x7D"; var JSONObj=JSON.parse(jsonEncoded); console.log(JSONObj); var name=JSONObj["name"]; var company=JSONObj["company"]; var designation=JSONObj["designation"]; console.log(name); console.log(company); console.log(designation);
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40376732

http://stackoverflow.com/q/27607199
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: primefaces
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/43636596
has comment: http://stackoverflow.com/comment/44593944
answer count: 1
downvote count: 0
tagged with: websocket
tagged with: tomcat
favorite count: 0
has body: I am working on primefaces datatable which has data from the database. This client side data is received when the refresh button is hit. If there is a database change, the client doesn't know about it and has to refresh the page often. I was looking for server side push technology and getting to know about WebSocket. However, I cant find or do not know how it will work in my situation. The database change is done through Hibernate. So how do I monitor the database change done by hibernate? and, after detection send that value to the client? I am using Java and tomcat.
has answer: http://stackoverflow.com/a/27607899
has title: Server side push technology - After a database change

http://stackoverflow.com/a/27616354
has body: To add row you need to call dtm.addRow(data); And add row to your DefaultTableModel instead of list. So the updated code will look like: ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { data = new Vector&lt;&gt;(); data.add(field1.getText()); data.add(field2.getText()); data.add(field3.getText()); dtm.addRow(data); } });
score: 0
has comment: http://stackoverflow.com/comment/43654294
has comment: http://stackoverflow.com/comment/43654424
type: Answer
has comment: http://stackoverflow.com/comment/43654185
answers question: http://stackoverflow.com/q/27616206

http://stackoverflow.com/comment/43487723
score: 0
type: AnswerComment
type: Comment
has text: Thanks, but i don't want the data. I search the json schema, the description of document structure. Look at [json-schema.org](http://json-schema.org/examples.html)
comment on: http://stackoverflow.com/a/27528912

http://stackoverflow.com/comment/43599993
has text: I checked with `-XX:+PrintAssembly` myself before posting the question. As you point out, this doesn't prove anything except possibly that even if it's allowed it's pointless. My question is whether or not it's legal. I can't see how two volatile reads, that introduce happens before relations, would be *violated* by being treated as one read. Could you describe an example execution in which such optimization would violate the JLS in terms of happens-before or program order?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27586267

http://stackoverflow.com/comment/43673905
score: 0
has text: See this question: http://stackoverflow.com/questions/685522/using-private-static-methods
type: Comment
comment on: http://stackoverflow.com/q/27621974
type: QuestionComment

http://stackoverflow.com/comment/43679704
has text: I reset the counter to 0
comment on: http://stackoverflow.com/a/27629346
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43596407
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27585845
score: 0
has text: depending on your system setup, you could just mark those files as read-only, or remove write access for the developer in that directory

http://stackoverflow.com/q/27561906
score: 1
tagged with: java
type: Question
upvote count: 2
tagged with: hashmap
has title: Trying to add Integers in HashMap but not working
accepted answer: http://stackoverflow.com/a/27561944
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43549718
favorite count: 0
has comment: http://stackoverflow.com/comment/43549777
has body: I am new to HashMaps and I was helped on understanding how to add and print integers in the map. HOWEVER, instead of getting what I want I get something weird and different that I'm not sure how to fix. OUTPUT Rick Grimes Rick Grimes rescued Carl 100pts! Rick Grimes rescued Carl 100pts!Rick Grimes rescued Michone 50pts! Characters rescued: Carl, Michone Total points: 10050 As you may notice, the total points is just a combination of the scores. This is what I want DESIRED OUTPUT Rick Grimes Rick Grimes rescued Carl 100pts! Rick Grimes rescued Michone 50pts! Characters rescued: Carl, Michone Total points: 150 Also another problem you might notice in my output is line 3 repeating the first rescue in line 2 but first I want to focus on the first problem. Here is my code GameDriver.java import java.io.*; import java.util.*; import java.awt.*; public class GameDriver { public static void main(String[] args) throws FileNotFoundException { Hero N = new Cop(); String s; File f = new File (args[0]); Scanner input = new Scanner(f); while (input.hasNext()) { s = input.next(); if (s.equalsIgnoreCase("h")) { System.out.println(N.getHeroName()); } if (s.equalsIgnoreCase("r")) { String cn = input.next(); int pts = input.nextInt(); N.newMap.put(cn, pts); System.out.println(N.rescue()); } if (s.equalsIgnoreCase("v")) { System.out.println(N.view()); } } } } The summation happens in this class Hero.java import java.util.*; import java.io.*; import java.awt.*; public abstract class Hero extends Character { private String heroname1; public Hero() { heroname1 = "Rick Grimes"; //the default player name } HashMap&lt;String, Integer&gt; newMap = new HashMap&lt;String, Integer&gt;(); public Hero(String newhero) { if (newhero.length() &gt; 0) { heroname1 = newhero; } else { heroname1 = "Rick Grimes"; } //defaulted as protagonist } public String getHeroName() { return heroname1; //return the name } public String rescue() { //class to rescue people or things String out = "".toString(); for(Stri…
has answer: http://stackoverflow.com/a/27561944
type: AnsweredQuestion

http://stackoverflow.com/q/27632162
has comment: http://stackoverflow.com/comment/43685507
tagged with: java
has comment: http://stackoverflow.com/comment/43684756
has title: App closes on insert query SQLlite
type: Question
has answer: http://stackoverflow.com/a/27632877
has comment: http://stackoverflow.com/comment/43685349
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
has body: My app closes when i insert this sample records for testing, i tried it in many ways. from activity class im sending string values to insert to the database. My MainInvoiceActivity Class public class MainInvoiceActivity extends Activity { private DBHelper mydb ; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_invoice); if ( mydb.insertsample( "one" , "two" , "3" )){ // LINE NO 67 Toast.makeText(getApplicationContext(), "Insert Success!", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getApplicationContext(), "not done", Toast.LENGTH_SHORT).show(); } } } My database SQLiteOpenHelper class public class DBHelper extends SQLiteOpenHelper { public static final String DATABASE_NAME = "MyDBName.db"; public static final String TABLE_SAMPLE = "sample"; public DBHelper(Context context) { super(context, DATABASE_NAME , null, 1); } public void onCreate(SQLiteDatabase db) { String CREATE_SAMPLE_TABLE = "CREATE TABLE sample ( " + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "one TEXT, "+ "two TEXT, "+ "three TEXT )"; db.execSQL(CREATE_SAMPLE_TABLE); } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS sample"); onCreate(db); } public boolean insertsample (String one, String two, String three) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues myValues = new ContentValues(); myValues.put(one, one); myValues.put(two, two); myValues.put(three, three); db.insert(TABLE_SAMPLE, null, myValues); return true; } } LOG message E/AndroidRuntime(1153): FATAL EXCEPTION: main E/AndroidRuntime(1153): Process: com.ezycode.pos, PID: 1153 E/AndroidRuntime(1153): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ezycode.pos/com.ezycode.pos.MainInvoiceActivity}: java.lang.NullPointerException E/AndroidRuntime(1153): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) E/AndroidRuntime(1153): at android.app.Activity…
has comment: http://stackoverflow.com/comment/43685529
score: 2
has comment: http://stackoverflow.com/comment/43685120
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43685562
has comment: http://stackoverflow.com/comment/43685519

http://stackoverflow.com/q/27616673
has comment: http://stackoverflow.com/comment/43654749
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27616878
has answer: http://stackoverflow.com/a/27616760
possible better answer: http://stackoverflow.com/a/27616760
tagged with: regex
has body: Oracle backup log file contains header and content like this: Starting backup at 14-JUL-13 channel d1: starting compressed incremental level 0 datafile backup set channel d1: specifying datafile(s) in backup set input datafile file number=00004 name=/oradata/reports1/qqq01.dbf input datafile file number=00001 name=/oradata/reports1/aaa01.dbf input datafile file number=00002 name=/oradata/reports1/xxx01.dbf input datafile file number=00003 name=/oradata/reports1/bbbs01.dbf &lt;...&gt; Starting backup at 15-JUL-13 current log archived channel d1: starting compressed archived log backup set channel d1: specifying archived log(s) in backup set input archived log thread=1 sequence=580 RECID=288 STAMP=820739223 input archived log thread=1 sequence=581 RECID=289 STAMP=820739223 &lt;...&gt; Starting backup at 16-JUL-13 &lt;...&gt; I tried to split it to header and content using RegExp and Java. My bad working regexp (non Java format): ^Starting backup at \d{2}-[A-Z]{3}-\d{2}$+((?:.|\\n)+?) Java flags DOTALL and MULTILINE enabled. It returns header but content is empty. Any help is appreciated.
type: AnsweredQuestion
has title: How to split text to header and content with regexp?
tagged with: java
has answer: http://stackoverflow.com/a/27616878
has comment: http://stackoverflow.com/comment/43654933
type: Question

http://stackoverflow.com/comment/137862746
type: AnswerComment
has text: @dev333 The comment section is not suitable to provide a detailled problem description nor to provide a useful answer. Maybe you want to [ask](https://stackoverflow.com/questions/ask) a new question.
type: Comment
comment on: http://stackoverflow.com/a/27605965
score: 1

http://stackoverflow.com/a/27638589
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27638568
score: 3
has comment: http://stackoverflow.com/comment/43697845
has comment: http://stackoverflow.com/comment/43697906
answers question: http://stackoverflow.com/q/27638568
type: AcceptedAnswer
downvote count: 0
has body: Define an interface and two implementations: one for MySQL and another for Redis only. Then, in your service layer, inject the proper implementation of the DAO interface. If you have a requirement where the data should be searched on Redis first, if it doesn't exist then look in MySQL, then you should implement this in your service layer, not in your DAO. Remember that DAO should only contain the necessary logic to communicate with the datasource.

http://stackoverflow.com/a/27535134
score: 1
has comment: http://stackoverflow.com/comment/43499805
answers question: http://stackoverflow.com/q/27534426
upvote count: 1
has comment: http://stackoverflow.com/comment/43500991
has body: If you eventually need all your entities as JSON your approach is fine otherwise as Robert already pointed out use default serialization according to those benchmarks, jackson is faster than java serialization: benchmark If you use jackson, only thing I recall is that the creation of the ObjectMapper is expensive. jackson To get the last bit out of it, you should mayber compare other json serializers/parsers with jackson, e.g. boon is quite fast. boon
type: Answer
has comment: http://stackoverflow.com/comment/43502240
downvote count: 0

http://stackoverflow.com/comment/43615738
score: 0
comment on: http://stackoverflow.com/a/27593310
type: Comment
has text: I want to create another class Ant.java which has different color to Bacteria and inherits Creature class and can draw it on the board with bacteria. How can I? Can you help me! Thank you!
type: AnswerComment

http://stackoverflow.com/q/27615358
possible better answer: http://stackoverflow.com/a/27615414
score: -1
has answer: http://stackoverflow.com/a/27615769
has body: I have a mobile number with some junk characters. I have to check whether the number contains the junk character [#EEE] in it, and if so, I should remove them: String mobile = "999#EEE99999999"; String junktobechecked ="#EEE"; My output should be 99999999999. Note: This junk character is not a constant value.I have to get it from db table and check.
has answer: http://stackoverflow.com/a/27615414
has answer: http://stackoverflow.com/a/27615478
has title: How to check if some specific characters present in the string and remove those characters in java
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/27615382
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7775364
upvote count: 2
has comment: http://stackoverflow.com/comment/43653014
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/27615382

http://stackoverflow.com/comment/43481373
has text: Predicting the indexes for an arbitrary Java program is possible by compiling the program and reading back the indexes.
type: AnswerComment
comment on: http://stackoverflow.com/a/27526071
score: 0
type: Comment

http://stackoverflow.com/comment/43466837
type: QuestionComment
comment on: http://stackoverflow.com/q/27518493
has text: you will need to iterate it and then compare value and return key
score: 0
type: Comment

http://stackoverflow.com/a/27604388
has comment: http://stackoverflow.com/comment/43660757
has comment: http://stackoverflow.com/comment/43650757
has comment: http://stackoverflow.com/comment/43688308
downvote count: 0
score: 1
has body: Databases are made to handle concurrency. Not sure what exactly mybatis brings into the picture (not a huge fan of ORM in general), but if it is using it, that makes you start thinking about hacks like intermediate files and single-threaded updates, you are probably much better off ripping it out and writing to db with plain jdbc, which should have no problem handling your use case, provided, you batch your updates adequately.
type: Answer
has comment: http://stackoverflow.com/comment/43692819
upvote count: 1
answers question: http://stackoverflow.com/q/27604235

http://stackoverflow.com/a/27624281
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27624073
answers question: http://stackoverflow.com/q/27624073
has body: If you just need to store them in memory for use later, you could use a HashMap with the cheque number being your key. Something like: Map&lt;Integer, Cheque&gt; chequeMap = new HashMap&lt;Integer, Cheque&gt;(); chequeMap.put(chequeNumber, new Cheque(chequeNumber, date, accountNumber, bank, amount); Then later to get them, you'd do something like: Cheque someCheque = chequeMap.get(chequeNumber); Or to get them all out, like when you go to store them in your database or print them, etc... you'd do something like: for (Cheque cheque : chequeMap.values()) { // do stuff here with your cheuqe objects }
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/a/27582883
has body: I would look into Making AJAX Applications Crawlable and A proposal for making AJAX crawlable In a nutshell these are the steps you should consider: Crawlers maps from pretty url to ugly url. i.e from http://examplegwtapp.com/app.html#View?hash=xyz to http://examplegwtapp.com/app.html?_escaped_fragment_=hash=xyz crawler requests the ugly url Server maps from ugly url to pretty url. you can do this by identifying on the apache level any _escaped_fragment_ request and redirect it to a certain server controller to handle the crawler call. i.e. check Apache rewrite condition for ajax crawling Server invokes headless browser(HtmlUnit or if just small portion of your code is js just generate the static html with your server code. i.e HtmlUnit Generate Page for GWT App Headless browser response returned to the crawler.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27582243
answers question: http://stackoverflow.com/q/27582243
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/27537582
score: 1
has comment: http://stackoverflow.com/comment/43573422
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27532309
has comment: http://stackoverflow.com/comment/43562279
has body: i have similar problem. i created a library that should be tested against different versions (all available in maven central) of other library and (but that's less important) jvm. my conclusions: doing this only in maven will be veeeery cumbersome and hard, if not impossible. you will also have to encode environment/system dependencies into your build tool as suggested, most integration servers support matrix tests. you can use it also to manually provide every single version (if you know them upfront) of library you need to test against. the library part should be doable much easier in gradle (but still no out-of-the-box support). regarding number of tests: yes will have to run x * y times. if your code is big think about isolating the part that uses other library and run only this small part x times for each jvm - it will be a bit faster. also you can run those tests in parallel ps: i'm thinking about writing a gradle plugin or at least a proof-of-concept build. but i don't think it will be soon. but i'm open for other contributors :)

http://stackoverflow.com/comment/43598359
type: Comment
type: QuestionComment
score: 0
has text: On rowData[row][col] = value;
comment on: http://stackoverflow.com/q/27587012

http://stackoverflow.com/q/27537626
tagged with: android
accepted answer: http://stackoverflow.com/a/27547740
score: 1
tagged with: android-activity
favorite count: 0
answer count: 3
upvote count: 1
tagged with: android-alertdialog
has answer: http://stackoverflow.com/a/27538233
tagged with: dialog
has body: I'm using a RecyclerView and want to open an AlertDialog whenever an item in the RecyclerView is long-clicked. In the RecyclerView's ViewHolder, i have implemented the clicklistener @Override public boolean onLongClick(View v) { //Open Alert dialog to delete item AlertDialog.Builder alert = new AlertDialog.Builder(context); ... } As i can read here: http://goo.gl/Kd1c7i one needs to pass "MyActivity.this" to the AlertDialog.Builder constructor but since the ViewHolder is a static part of the RecyclerView Adapter, i cannot refer to "MyActivity.this". Hence i still get the error: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application So how can i create an AlertDialog from class which does not extend Activity? @Edit: More code for more information: Here is my RecyclerView Adapter constructor: RecyclerViewCourseAdapter(ArrayList&lt;Course&gt; courses, Context context) { this.context = context; if (courses == null) { throw new IllegalArgumentException("courses ArrayList must not be null"); } mCourseArrayList = courses; } I store the given context as private in the Adapter class: private Context context; This is my ViewHolder: public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,View.OnLongClickListener { //Initialize views in Viewholder TextView mTextViewFirst; TextView mTextViewSecond; ImageView mImageView; TextView mEndPercentageTextView; //Context to refer to app context (for intent, dialog etc) Context context; //Adapter to notifiy data set changed RecyclerViewCourseAdapter mCourseAdapter; public ViewHolder(View itemView, Context context, RecyclerViewCourseAdapter mCourseAdapter) { super(itemView); this.context = context; this.mCourseAdapter = mCourseAdapter; itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); mTextViewFirst = (TextView) itemView.findViewById(R.id.course_firstLine); mTextViewSecond = (TextView) itemView.findViewById(R.id.course_secondL…
tagged with: java
has title: Build AlerDialog outside of an Activity (RecyclerView.Viewholder)
has answer: http://stackoverflow.com/a/27537786
has answer: http://stackoverflow.com/a/27547740
possible better answer: http://stackoverflow.com/a/27538233
downvote count: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43541503
score: 0
type: QuestionComment
type: Comment
has text: FYI, if you want to match a set of characters in a regex, there's a special notation for that: `string.matches("[aeiouAEIOU]")` which is more convenient and easier to read than `"a|e|i|o|u|A|E|I|O|U"`.
comment on: http://stackoverflow.com/q/27555895

servlets
tags question: http://stackoverflow.com/q/27541669
tags question: http://stackoverflow.com/q/27496448
tags question: http://stackoverflow.com/q/27551604
tags question: http://stackoverflow.com/q/27515560
tags question: http://stackoverflow.com/q/27548507
tags question: http://stackoverflow.com/q/27586296
tags question: http://stackoverflow.com/q/27617763
tags question: http://stackoverflow.com/q/27605778
tags question: http://stackoverflow.com/q/27567511
tags question: http://stackoverflow.com/q/27540011
tags question: http://stackoverflow.com/q/27481137
tags question: http://stackoverflow.com/q/27479306
tags question: http://stackoverflow.com/q/27560041
tags question: http://stackoverflow.com/q/27576782
tags question: http://stackoverflow.com/q/27617279
tags question: http://stackoverflow.com/q/27527751
tags question: http://stackoverflow.com/q/27580284
tags question: http://stackoverflow.com/q/27489969
tags question: http://stackoverflow.com/q/27577695
tags question: http://stackoverflow.com/q/27487543
tags question: http://stackoverflow.com/q/27494898
tags question: http://stackoverflow.com/q/27479374
tags question: http://stackoverflow.com/q/27523290
tags question: http://stackoverflow.com/q/27546965
tags question: http://stackoverflow.com/q/27567824
tags question: http://stackoverflow.com/q/27502774
tags question: http://stackoverflow.com/q/27549075
tags question: http://stackoverflow.com/q/27515525
tags question: http://stackoverflow.com/q/27548076
tags question: http://stackoverflow.com/q/27475536
tags question: http://stackoverflow.com/q/27565266
tags question: http://stackoverflow.com/q/27568522
tags question: http://stackoverflow.com/q/27499323
tags question: http://stackoverflow.com/q/27515572
tags question: http://stackoverflow.com/q/27552420
tags question: http://stackoverflow.com/q/27525841
tags question: http://stackoverflow.com/q/27579458
tags question: http://stackoverflow.com/q/27548862
tags question: http://stackoverflow.com/q/27606355
tags question: http://stackoverflow.com/q/27481847
tags question: http://stackoverflow.com/q/27603853
tags question: http://stackoverflow.com/q/27582167
tags question: http://stackoverflow.com/q/27516425
tags question: http://stackoverflow.com/q/27504508
tags question: http://stackoverflow.com/q/27528128
tags question: http://stackoverflow.com/q/27502579
tags question: http://stackoverflow.com/q/27531810
tags question: http://stackoverflow.com/q/27506584
tags question: http://stackoverflow.com/q/27569448
tags question: http://stackoverflow.com/q/27582689
tags question: http://stackoverflow.com/q/27539610
tags question: http://stackoverflow.com/q/27566561
tags question: http://stackoverflow.com/q/27617788
tags question: http://stackoverflow.com/q/27543562
tags question: http://stackoverflow.com/q/27503805
tags question: http://stackoverflow.com/q/27544973
tag name: servlets
tags question: http://stackoverflow.com/q/27487917
tags question: http://stackoverflow.com/q/27560376
tags question: http://stackoverflow.com/q/27602405
tags question: http://stackoverflow.com/q/27533888
tags question: http://stackoverflow.com/q/27565116
tags question: http://stackoverflow.com/q/27556869
tags question: http://stackoverflow.com/q/27487922
tags question: http://stackoverflow.com/q/27520087
type: Tag
tags question: http://stackoverflow.com/q/27517278
tags question: http://stackoverflow.com/q/27490460
tags question: http://stackoverflow.com/q/27503920
tags question: http://stackoverflow.com/q/27487468
tags question: http://stackoverflow.com/q/27479831
tags question: http://stackoverflow.com/q/27589046
tags question: http://stackoverflow.com/q/27525941
tags question: http://stackoverflow.com/q/27520145

http://stackoverflow.com/q/27530814
has title: Import and use a Maven managed Java library (CitySDK)
tagged with: maven
tagged with: dependency-management
has comment: http://stackoverflow.com/comment/43492659
has answer: http://stackoverflow.com/a/27541644
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43509156
tagged with: import
type: Question
accepted answer: http://stackoverflow.com/a/27541644
has comment: http://stackoverflow.com/comment/43509322
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43509801
has comment: http://stackoverflow.com/comment/43509864
has body: I am trying to build a web application based on the project library CitySDK, but i don't know how to import it properly into my own project. I have created a Maven Web Application and added the CitySDK library as a Dependency, and then Selected the Project, right-clicked and Selected Build with Dependencies. No errors appeared, and in the image below you can see it appeared as a dependency. However, whenever i try to use some of the classes specific to it, in my own Web Application(called TourismApplication's TestClass.java), the compiler displays an error, that the package is unknown. Could anyone suggest ideas as to what i have missed? I have followed a few Maven tutorials, but without any effects. The dependencies are as follows:

http://stackoverflow.com/comment/43570721
type: QuestionComment
has text: try rename getDataSource as dataSource
comment on: http://stackoverflow.com/q/27571887
type: Comment
score: 1

http://stackoverflow.com/q/27528900
has comment: http://stackoverflow.com/comment/43486551
has answer: http://stackoverflow.com/a/27530095
score: 3
has answer: http://stackoverflow.com/a/27529010
upvote count: 3
tagged with: java
has title: Is there an alternative to try/catch in Java for opening a file?
tagged with: file
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/43486465
has comment: http://stackoverflow.com/comment/43486513
has body: I remember in my c++ class we would use the following code to handle bugs when opening a file: ifstream in; in.open("foo.txt"); if(in.fail()){ cout &lt;&lt; "FAILURE. EXITING..." &lt;&lt; endl; exit(0); } Now that I'm learning java, I'm having trouble using try/catch statements, because when I create a scanner to read my input file, it isn't recognized outside of that try code block. Is there any equivalent to fail() and exit(0) in java, or is there a better method?
downvote count: 0
has answer: http://stackoverflow.com/a/27529004
tagged with: exception
answer count: 3
has comment: http://stackoverflow.com/comment/43486625
has comment: http://stackoverflow.com/comment/43486420
favorite count: 0
tagged with: c++
type: UnansweredQuestion

http://stackoverflow.com/q/27481773
upvote count: 2
type: UnansweredQuestion
has body: I'm writing JavaFX application on JDK 8. The application has a menu and toolbar with some buttons. The problem is, when ever menu opens and covers toolbar buttons, icons on tollbar buttons disappear. Button functionality remains unchanged, tooltips appear correctly, only icons are missing. The image bellow shows this: I create toolbar buttons off the UI thread, but add them to the toolbar on UI thread. // this is off UI thread newFileButton = new Button(); newFileButton.setId(JFXFileMenuConstants.NEW_FILE_TOOLBAR_BUTTON); newFileButton.setGraphic((Node) handler.getResource("jfx.gui.file.new.menuitem.icon")); newFileButton.setTooltip(new Tooltip(handler.getString("jfx.gui.toolbar.newfile.tooltip"))); ......... ToolBar filesToolbar = new ToolBar(newFileButton, openFileButton, separator, saveFileButton, saveasFileButton); Platform.runLater(() -&gt; { toolbarContainer.getChildren().add(toolbar); }); Any idea what could be causing this?
has answer: http://stackoverflow.com/a/27484320
has comment: http://stackoverflow.com/comment/43398745
score: 2
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/43398920
type: Question
has title: JavaFX - disappearing icons on toolbar buttons
downvote count: 0
favorite count: 0
tagged with: javafx-8
answer count: 1
has comment: http://stackoverflow.com/comment/43396461
has comment: http://stackoverflow.com/comment/43396594

http://stackoverflow.com/comment/43595489
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27585345
has text: g.drawOval(x,y, 20, 20); i put it global when click in the frame it gives me error Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

http://stackoverflow.com/comment/43782078
has text: Okay, I think I'm trying to do exactly the thing that you mentioned in the post above, i.e trying to store certificates my application is suppose to trust. But my application is such that it has two clients having their own respective certificates which uses the same services provided by my application, and I need to authenticate/encrypt/decrypt them on the fly, depending on where the request came from. Maybe my approach is wrong but I would very much appreciate if I could be pushed to the right direction since I'm still new to this WS security. Thanks a ton!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27657972

http://stackoverflow.com/comment/43512015
has text: http://stackoverflow.com/questions/12885247/why-is-httpurlconnection-throwing-an-sslexception-while-on-a-mobile-data-connect
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27542378
score: 0

http://stackoverflow.com/comment/43556479
has text: It's still unclear. Because the user will enter amount several times. And each the the amount is entered should be added to the arrayList. That means the history must be added automatically and dynamically. That was the main issue. So could you please modify please your code to show me the right track. I am not forcing you to do it, it's up to you. Thank you.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27564904

synchronous
tags question: http://stackoverflow.com/q/27574478
tag name: synchronous
type: Tag

http://stackoverflow.com/a/27635552
has body: Actually, the JPA providers let you define your mapping using annotations and override the settings using XML files. This is (almost) the default behaviour of any java EE spec. In you case, you can define the mapping using annotations for the new database, then define a persistence.xml by declaring only the JNDI location and the flag: &lt;exclude-unlisted-classes&gt;false&lt;/exclude-unlisted-classes&gt; Any other mapping will be handled on annotation level. For the old database, you can declare another persistence unit and override the behaviour declared in the annotations by using persistence.xml or orm.xml. In your code, you can refer to the appropriate persistence unit by name.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27635290
upvote count: 1
type: Answer

http://stackoverflow.com/comment/43669972
type: AnswerComment
type: Comment
has text: If I don’t extend it from activity I get `unable to resolve getSharedPreferences` error. This is the only reason I have extending it from there.
comment on: http://stackoverflow.com/a/27609111
score: 0

http://stackoverflow.com/comment/43586212
comment on: http://stackoverflow.com/a/27580864
type: AnswerComment
score: 0
type: Comment
has text: Thank you both! I changed the argument as suggested by rafalopez79 but didn't change the vector type. it all works perfectly!

http://stackoverflow.com/q/27616300
has title: Configuring Spring Batch Steps in Parallel (Split) using Annotations
accepted answer: http://stackoverflow.com/a/27623839
type: Question
has body: Where ever I look into Spring Batch documentation for executing steps in parallel, I only see the configuration of it via XML like given below. &lt;split id="split1" next="step4"&gt; &lt;flow&gt; &lt;step id="step1" parent="s1" next="step2"/&gt; &lt;step id="step2" parent="s2"/&gt; &lt;/flow&gt; &lt;flow&gt; &lt;step id="step3" parent="s3"/&gt; &lt;/flow&gt; I am writing an application using Spring Batch where I have used Spring Boot as well, and all of my configurations are done using Annotations. Is there a I can configure a Split Step using Java configuration? I checked the API documentation of Step interface in Spring Batch, but it doesn't have a default implementation for Split Step. Is there way I can implement it using the existing default implementations? Currently I have implemented my other jobs like this : @Bean public Step someStep() { return stepBuilderFactory.get("someStep") .&lt;A, B&gt; chunk(1-).reader(someReader) .processor(someProcessor).writer(someWriter).build(); } @Bean public Job historicalDataJob() { return jobBuilderFactory.get("someJOb") .incrementer(new RunIdIncrementer()).flow(someStep()).end() .build(); }
tagged with: spring-batch
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27623839
upvote count: 2
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java

http://stackoverflow.com/comment/43436889
comment on: http://stackoverflow.com/a/27496652
type: Comment
has text: Only thing this achieves is changing the GUI window to the previous GUI window when there is already another so it becomes 2 main GUI windows..
score: 0
type: AnswerComment

mybatis
tags question: http://stackoverflow.com/q/27568633
tags question: http://stackoverflow.com/q/27618710
tags question: http://stackoverflow.com/q/27519932
tags question: http://stackoverflow.com/q/27522589
type: Tag
tags question: http://stackoverflow.com/q/27604235
tags question: http://stackoverflow.com/q/27479210
tags question: http://stackoverflow.com/q/27481261
tag name: mybatis

http://stackoverflow.com/q/27637327
favorite count: 0
possible better answer: http://stackoverflow.com/a/27637423
tagged with: terminal
has answer: http://stackoverflow.com/a/27637423
upvote count: 2
has body: I have game server and I want to launch it on Asustor NAS Server. I have PuTTy and I write nohup java -jar server.jar &amp; Good, it launch in background, but now I want to close it. How to do it? And how to know if app is running or not?
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27637372
type: Question
answer count: 2
tagged with: server
downvote count: 0
has title: terminal - run java app in background and how to close it?
tagged with: linux
accepted answer: http://stackoverflow.com/a/27637372

http://stackoverflow.com/q/27557330
type: Question
has comment: http://stackoverflow.com/comment/43552727
tagged with: user-interface
answer count: 1
has body: I'am trying to create a tool for demonstrating graphs and algorithms. For that purpose I've found GraphStream library. I have read all of its documentation and tutorials but I cant make this one thing work. I am trying to put graph into my custom GUI (left menu with buttons and right graph space) and i managed to do that. Now when i enabled two buttons: generate - creates graph with random generator, and clear - clears graph, it all works fine but after clear when i press generate, i get following error: Exception in thread "Thread-2" org.miv.pherd.IdAlreadyInUseException: a particle with the same identifier already exists (0) I dont understand why this is a problem because in my simple test program without gui, i made simple code in main to do the same thing and it works: public class Test { public static void main(String[] args){ Graph graph = new SingleGraph("test"); graph.display(); Generator generator = new BarabasiAlbertGenerator(); generator.addSink(graph); generator.begin(); for (int i = 0; i &lt; 100; i++) { generator.nextEvents(); } generator.end(); graph.clear(); generator = new BarabasiAlbertGenerator(); generator.addSink(graph); generator.begin(); for (int i = 0; i &lt; 100; i++) { generator.nextEvents(); } generator.end(); } this code works but when i execute it within my GUI with buttons i throws error which I have mentioned above. I also checked how many threads are running in my program and it seems 3 of them are. I hope my problem is pretty clear and someone can help me. Thank you all!
score: 0
tagged with: graphstream
tagged with: multithreading
has title: GraphStream Thread synchronization
has answer: http://stackoverflow.com/a/27563773
accepted answer: http://stackoverflow.com/a/27563773
has comment: http://stackoverflow.com/comment/43552236
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27629802
tagged with: maven
type: Question
has title: DrawerLayout not found in Android Maven project at runtime
has body: Okay, so I've been trying to figure out this problem for a few weeks now and been on StackOverflow profusely viewing similar problems and trying to apply them to my own situation to no avail. I am worried I am just doing something incredibly stupid or forgetting something stupid and will waste someone's time but I'm out of options and ideas at this point, so apologies if that ends up being the case. I'm not using Eclipse or Android Studio, just CLI Maven. I need to use the DrawerLayout in my app, but the app crashes when attempting to instantiate it due to not being able to find the class (and presumably the rest of the support-v4 package) at runtime. So, step by step. Here's the line of code that creates the DrawerLayout: DrawerLayout drawer = new android.support.v4.widget.DrawerLayout(this); Here's the stack trace of how the app crashes when it tries to create a new instance of the DrawerLayout. E/AndroidRuntime( 2065): FATAL EXCEPTION: main E/AndroidRuntime( 2065): Process: com.patron.main, PID: 2065 E/AndroidRuntime( 2065): java.lang.NoClassDefFoundError: android.support.v4.widget.DrawerLayout E/AndroidRuntime( 2065): at com.patron.main.FlashMenu.onCreate(FlashMenu.java:120) E/AndroidRuntime( 2065): at android.app.Activity.performCreate(Activity.java:5933) E/AndroidRuntime( 2065): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) E/AndroidRuntime( 2065): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) E/AndroidRuntime( 2065): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) E/AndroidRuntime( 2065): at android.app.ActivityThread.access$800(ActivityThread.java:144) E/AndroidRuntime( 2065): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) E/AndroidRuntime( 2065): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 2065): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 2065): at android.app.ActivityThread.main(ActivityThrea…
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27630709
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/27630709
upvote count: 3
tagged with: java

http://stackoverflow.com/q/27610124
type: Question
has title: SQLite insert into error (Android)
possible better answer: http://stackoverflow.com/a/27610214
answer count: 2
has answer: http://stackoverflow.com/a/27610214
tagged with: sqlite
downvote count: 0
has comment: http://stackoverflow.com/comment/43642693
favorite count: 0
has answer: http://stackoverflow.com/a/27610219
accepted answer: http://stackoverflow.com/a/27610219
has body: Error 12-22 14:30:52.329 1261-1261/com.TrackApp.trackapp E/SQLiteLog﹕ (1) near "Throw": syntax error 12-22 14:30:52.329 1261-1261/com.TrackApp.trackapp D/AndroidRuntime﹕ Shutting down VM 12-22 14:30:52.339 1261-1261/com.TrackApp.trackapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40a13300) 12-22 14:30:52.389 1261-1261/com.TrackApp.trackapp E/AndroidRuntime﹕ FATAL EXCEPTION: main android.database.sqlite.SQLiteException: near "Throw": syntax error (code 1): , while compiling: INSERT INTO Athletes (ID, First_Name, Last_Name, Age, Gender, Event, Tier) VALUES (0, Joe, Richards, 20, Male, Discus Throw, 2); I keep getting this error when trying to add a new athlete to my database. Could someone please figure out what I am doing wrong. I am almost certain all of my sql statements are correct. I think it thinks that it is creating a new column under events for whatever is from the athlete object but I don't know private static final String DATABASE_NAME = "AthletesDB"; private static final int VERSION = 1; private static final String TABLE_NAME = "Athletes"; private static final String COLUMN_ID = "ID"; private static final String COLUMN_FIRST_NAME = "First_Name"; private static final String COLUMN_LAST_NAME = "Last_Name"; private static final String COLUMN_AGE = "Age"; private static final String COLUMN_GENDER = "Gender"; private static final String COLUMN_EVENT = "Event"; private static final String COLUMN_TIER = "Tier"; private static final String[] COLUMNS = {"ID", "First_Name", "Last_Name", "Age", "Gender", "Event", "Tier"}; private static final String TABLE_CREATE = "CREATE TABLE " + TABLE_NAME + "( " + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_FIRST_NAME + " VARCHAR(20), " + COLUMN_LAST_NAME + " VARCHAR(20), " + COLUMN_AGE + " INTEGER, " + COLUMN_GENDER + " VARCHAR(20), " + COLUMN_EVENT + " VARCHAR(20), " + COLUMN_TIER + " INTEGER " + ")"; public MySQLiteHelper(Context context, String name, SQLiteDatabase.CursorFactory fa…
tagged with: android
type: AnsweredQuestion
tagged with: android-studio
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/27625978
type: Answer
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27625293
has body: The message is: Main.java:14: error: ')' expected System.out.println(1 ++ 2); ^ The 1 ++ 2 statement is parsed as 1 followed by ++ followed by 2. This is interpreted as 1++ and 2 creating a syntax error (and not an unexpected type error; in fact, you will get the same error if you used variables e.g. i ++ j). The 1 + + 2 statement on the other hand is parsed as 1 followed by + followed by +2 which compiles as expected. The space between the two operators separates the two operators.

http://stackoverflow.com/q/27604978
favorite count: 0
has answer: http://stackoverflow.com/a/27616894
type: Question
has title: how to get null while parsing xml with geotools parser
has comment: http://stackoverflow.com/comment/43641957
upvote count: 2
tagged with: geotools
answer count: 1
accepted answer: http://stackoverflow.com/a/27616894
has body: I tried to get null value from my xml file such below &lt;top:kadastroParselFeature gml:id="KADASTRO_PARSEL.1"&gt; &lt;top:olcek xsi:nil="true" /&gt; &lt;/top:kadastroParselFeature&gt; but my parser throws such an exception : java.lang.RuntimeException: Parsing failed for kadastroParselFeature: java.lang.NullPointerException at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:164) at org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:220) at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:186) at org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java:236) at org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:719) My parser configuration like this : org.geotools.xml.Configuration configuration = new org.geotools.gml2.GMLConfiguration(); org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration ); parser.setFailOnValidationError(false); HashMap&lt;Object, Object&gt; parsedMap = (HashMap&lt;Object, Object&gt;) parser.parse( isx); if I remove xsi:nill="true" from element it returns ""(empty string) but i need null . there is a usage of my parser at http://docs.geotools.org/stable/userguide/library/xml/geometry.html
tagged with: java
has comment: http://stackoverflow.com/comment/43654696
tagged with: xml-parsing
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: xsi

http://stackoverflow.com/a/27539982
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27539748
downvote count: 0
has body: What @Pankaj Kumar said is right. And in case you don't want to mess with the structure of your Articles class you could store just the titles into a new String[] and use that to initialize the ArrayAdapter That is, after you have populated your lst containing all the Articles: String[] titles = new String[lst.size()]; int i = 0; for(Articles article: lst) { titles[i] = article.getTitle(); i++; } Then initialize your ArrayAdapter with titles as, ArrayAdapter&lt;Articles&gt; adapter = new ArrayAdapter&lt;Articles&gt;( activity, android.R.layout.simple_list_item_1, titles); activity.setListAdapter(adapter);
type: Answer

http://stackoverflow.com/comment/43584828
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27579627
score: 0
has text: Ya I understood now. And now I'm able to add new 'DrawingPanel' but how do I remove the old one? 'DrawingPanel.this.remove();' doesn't see to work.

http://stackoverflow.com/a/27618461
has comment: http://stackoverflow.com/comment/43659084
upvote count: 1
has body: One more approach is to create an "agument object" - this will be a POJO that is meant to hold all the required information to all methods, and pass only it. Each implementing method will recieve this object, and query the needed field in order to produce the relevant result.
type: Answer
has comment: http://stackoverflow.com/comment/43659382
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27618223

http://stackoverflow.com/comment/43517274
score: 0
comment on: http://stackoverflow.com/q/27544613
type: Comment
type: QuestionComment
has text: @Vikram I have edited the source code to include the import statements as well, please check them.

ejb
tags question: http://stackoverflow.com/q/27519075
tags question: http://stackoverflow.com/q/27624410
tags question: http://stackoverflow.com/q/27488529
tags question: http://stackoverflow.com/q/27618719
tags question: http://stackoverflow.com/q/27541349
tags question: http://stackoverflow.com/q/27494898
tags question: http://stackoverflow.com/q/27582962
tag name: ejb
tags question: http://stackoverflow.com/q/27481223
tags question: http://stackoverflow.com/q/27506727
tags question: http://stackoverflow.com/q/27526946
tags question: http://stackoverflow.com/q/27575071
tags question: http://stackoverflow.com/q/27482032
tags question: http://stackoverflow.com/q/27607806
type: Tag
tags question: http://stackoverflow.com/q/27620052

http://stackoverflow.com/q/27504107
linked to: http://stackoverflow.com/q/24873725
tagged with: text-extraction
upvote count: 0
tagged with: apache-poi
tagged with: java
has answer: http://stackoverflow.com/a/27507939
has comment: http://stackoverflow.com/comment/43438239
has comment: http://stackoverflow.com/comment/43441513
type: Question
has comment: http://stackoverflow.com/comment/43440391
has title: How do I extract data from pptx file using Apache POI?
downvote count: 3
has body: I am using XSLFPowerPointExtractor to extract text from a pptx file. However all the text in the pptx file is returned to me in a single string. Is there anyway i can get the text on each slide separately? I am completely new to this concept, so please give detailed answers..
answer count: 1
has comment: http://stackoverflow.com/comment/43439489
favorite count: 0
type: UnansweredQuestion
score: -3

http://stackoverflow.com/comment/43619878
type: QuestionComment
has text: I'm not observing the same issue as you are - using the same version of Java - 1.8.0_25.
comment on: http://stackoverflow.com/q/27597750
score: 0
type: Comment

http://stackoverflow.com/a/27500421
score: 0
accepted answer of: http://stackoverflow.com/q/27500271
has comment: http://stackoverflow.com/comment/43437633
answers question: http://stackoverflow.com/q/27500271
has body: Ok well you can for this modified code: public static void main(String[] args){ RandomAccessFile raf = null; try { String array[][] = new String[2][3]; raf=new RandomAccessFile("D:\\employee.txt","rw"); for (int i = 0; i &lt; array.length; i++) { String inputName=JOptionPane.showInputDialog("Please Insert First Name"); array[i][0]=inputName; String inputLName=JOptionPane.showInputDialog("Please Insert Last Name"); array[i][1]=inputLName; String inputMeliiC=JOptionPane.showInputDialog("Please Insert Melii Code"); array[i][2]=inputMeliiC; raf.writeChars(array[i][0]); raf.writeChar(':'); raf.writeChars(array[i][1]) ; raf.writeChar(':'); raf.writeChars(array[i][2]); raf.writeChars("\n"); } raf.seek(0); String str = raf.readLine(); while(str != null ){ System.out.println(str); String arr[] = str.split(":"); System.out.println(Arrays.asList(arr)); str = raf.readLine(); } raf.close(); } catch (FileNotFoundException e) { try { raf.close(); } catch (IOException ex) { Logger.getLogger(Ideone.class.getName()).log(Level.SEVERE, null, ex); } e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (IOException e) { try { raf.close(); } catch (IOException ex) { Logger.getLogger(Ideone.class.getName()).log(Level.SEVERE, null, ex); } e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43431319
has comment: http://stackoverflow.com/comment/43439481
type: Answer
has comment: http://stackoverflow.com/comment/43437816
has comment: http://stackoverflow.com/comment/43439110
has comment: http://stackoverflow.com/comment/43431637

http://stackoverflow.com/a/27559400
has comment: http://stackoverflow.com/comment/43546235
has comment: http://stackoverflow.com/comment/43545889
has comment: http://stackoverflow.com/comment/43545244
score: 0
has comment: http://stackoverflow.com/comment/43545137
answers question: http://stackoverflow.com/q/27559318
has comment: http://stackoverflow.com/comment/43546257
has comment: http://stackoverflow.com/comment/43546319
has comment: http://stackoverflow.com/comment/43545076
has comment: http://stackoverflow.com/comment/43545314
has comment: http://stackoverflow.com/comment/43545275
type: Answer
has comment: http://stackoverflow.com/comment/43544986
has body: Haven't tested, but it's most likely due to the fact that you are printing the Result object, which will print the toString. If you want the raw JSON, then use response.getEntity(String.class). When you use getEntity(Result.class), then the raw JSON is converted to a Result object.
has comment: http://stackoverflow.com/comment/43545778

http://stackoverflow.com/comment/43502033
has text: `EOF` = end of file. `BOF` = beginning of file. Pretty self explanatory.
comment on: http://stackoverflow.com/q/27536835
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/27577019
upvote count: 1
has body: The square brackets [] are only used when you declare an array, initialize an array or access an element of the array. When you just assign a value to the entire array you don't need them. Therefore, change your code to : String name[]; While (scanner.hasNextLine()){ String input = scanner.nexLine(); name = input.split(","); }
answers question: http://stackoverflow.com/q/27576978
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43580038

http://stackoverflow.com/q/27540727
linked to: http://stackoverflow.com/q/1239026
score: 0
tagged with: android
has title: How to add a file automatically when I install my android application on a device?
has comment: http://stackoverflow.com/comment/43508956
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27541015
tagged with: java
has comment: http://stackoverflow.com/comment/43509042
has body: I m developing an application. My application read some config parameters from: /data/data/package_name/shared_prefs. I have to create this file manually each time I install the application on a new deice. How I can make the file created automatically when I install my android application
type: Question
answer count: 1

http://stackoverflow.com/q/27537292
has comment: http://stackoverflow.com/comment/43502906
tagged with: java
has title: Change sprite image upon button press in Java
has comment: http://stackoverflow.com/comment/43503274
type: Question
has comment: http://stackoverflow.com/comment/43502891
score: 0
has comment: http://stackoverflow.com/comment/43503332
has body: I have been working on a Java game for school and i ran into a problem. When creating my menu (which is all I have right now) I was trying to create a button using sprites. I have it right now so that when the mouse is placed over the sprite, it will change the image but I want to make it show a different sprite when I press it. Then when the mouse is released the sprite will revert to the sprite when the mouse is over the image. Game Class: import java.awt.Canvas; import java.awt.Color; //import java.awt.Color; import java.awt.Dimension; //import java.awt.Font; //import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import javax.swing.JFrame; public class Game extends Canvas implements Runnable { private static final long serialVersionUID = 1L; // This is the width, height, scale and title of the window. public static int width = 1280 / 4; public static int height = 720 / 4; public static int scale = 4; public static String title = "Ultimate Defender 2"; // Mouse object created. private Mouse mouse = new Mouse(); // Creates all the SpriteSheet objects. public SpriteSheet menubackgroundimage = new SpriteSheet(); public SpriteSheet menutitle = new SpriteSheet(); public SpriteSheet playbutton[] = new SpriteSheet[3]; public SpriteSheet continuebutton[] = new SpriteSheet[3]; public SpriteSheet scoresbutton[] = new SpriteSheet[3]; public SpriteSheet settingsbutton[] = new SpriteSheet[3]; public SpriteSheet exitbutton[] = new SpriteSheet[3]; public SpriteSheet backgroundimage = new SpriteSheet(); public SpriteSheet mobs = new SpriteSheet(); public SpriteSheet turret = new SpriteSheet(); // Creates the thread, frame and graphics objects. private Thread thread; private JFrame frame; private Graphics2D graphics; // Running variable is created to see if the game is running or not. // Is used with the thread object. private boolean running …
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43503391

http://stackoverflow.com/comment/43696985
score: 1
comment on: http://stackoverflow.com/q/27638322
has text: You're using the wrong `executeUpdate` method, you should take the one without a string parameter.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43611241
type: Comment
type: QuestionComment
has text: Java is reliant on the availability of functionality which is derived from multiple different operating systems, the available AWT, Swing and JavaFX frameworks abstract the complexities and differences that occur between operating systems into a usable package where the developer no longer needs to care about how the window is created, only that it operates in a specific manner. The ONLY solution you would have to create your own frame would be to resort to JNI/JNA. This would then raise the question of "how would you paint to this window?".
score: 2
comment on: http://stackoverflow.com/q/27593719

http://stackoverflow.com/a/27613367
has body: Got it! Once I installed haveged on the host, the process immediately moved forward, and spring booted fine. I will post more once I do a bit more research into how docker interacts with haveged on the host. In summary the following command issued on the host will fix the the issue: apt-get install haveged -y If anyone has a detailed understanding of this, feel free to post! The thing that I don't understand at the moment, is why the host machine needed extra code, and everything wasn't isolated within the docker container.
has comment: http://stackoverflow.com/comment/55565932
has comment: http://stackoverflow.com/comment/110526143
score: 33
upvote count: 33
has comment: http://stackoverflow.com/comment/43652793
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43674509
type: Answer
has comment: http://stackoverflow.com/comment/48419880
has comment: http://stackoverflow.com/comment/48393363
accepted answer of: http://stackoverflow.com/q/27612209
answers question: http://stackoverflow.com/q/27612209
has comment: http://stackoverflow.com/comment/75073701

exception
tags question: http://stackoverflow.com/q/27476626
tags question: http://stackoverflow.com/q/27519241
tags question: http://stackoverflow.com/q/27628045
tags question: http://stackoverflow.com/q/27577311
tags question: http://stackoverflow.com/q/27613849
tags question: http://stackoverflow.com/q/27619851
tags question: http://stackoverflow.com/q/27502993
tags question: http://stackoverflow.com/q/27584274
tags question: http://stackoverflow.com/q/27600508
tags question: http://stackoverflow.com/q/27484495
tags question: http://stackoverflow.com/q/27528900
type: Tag
tags question: http://stackoverflow.com/q/27555340
tags question: http://stackoverflow.com/q/27475072
tags question: http://stackoverflow.com/q/27508188
tags question: http://stackoverflow.com/q/27637309
tags question: http://stackoverflow.com/q/27586237
tags question: http://stackoverflow.com/q/27531249
tags question: http://stackoverflow.com/q/27558399
tags question: http://stackoverflow.com/q/27568345
tags question: http://stackoverflow.com/q/27620899
tags question: http://stackoverflow.com/q/27586033
tags question: http://stackoverflow.com/q/27529802
tags question: http://stackoverflow.com/q/27517936
tags question: http://stackoverflow.com/q/27486932
tags question: http://stackoverflow.com/q/27565962
tags question: http://stackoverflow.com/q/27516340
tags question: http://stackoverflow.com/q/27556027
tags question: http://stackoverflow.com/q/27556503
tags question: http://stackoverflow.com/q/27538706
tag name: exception
tags question: http://stackoverflow.com/q/27565572
tags question: http://stackoverflow.com/q/27539273
tags question: http://stackoverflow.com/q/27551862
tags question: http://stackoverflow.com/q/27496876
tags question: http://stackoverflow.com/q/27591450
tags question: http://stackoverflow.com/q/27603570
tags question: http://stackoverflow.com/q/27633772
tags question: http://stackoverflow.com/q/27601029
tags question: http://stackoverflow.com/q/27485177

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/27612226
tags question: http://stackoverflow.com/q/27529411

http://stackoverflow.com/q/27495525
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27495568
has title: Why is this printing the memory address of array
has answer: http://stackoverflow.com/a/27495578
has body: So this first code returns the memory address of the integer array, but I want it to print out the actual array. import java.util.Arrays; public class FinalsReview{ int[] list = new int[]{12, 435,546, 7, 24, 4, 6, 45, 21, 1}; public static void main(String[]args){ FinalsReview hello = new FinalsReview(); System.out.print(hello.create()); } public int[] create(){ Arrays.toString(list); return list; } } However, the following code prints the actual array. import java.util.Arrays; public class FinalsReview{ int[] list = new int[]{12, 435,546, 7, 24, 4, 6, 45, 21, 1}; public static void main(String[]args){ FinalsReview hello = new FinalsReview(); hello.create(); } public void create(){ System.out.println(Arrays.toString(list)); } } Why does the first one return the memory address?
tagged with: java
has answer: http://stackoverflow.com/a/27495535
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27495583
tagged with: arrays
has answer: http://stackoverflow.com/a/27495786
favorite count: 0
answer count: 5

http://stackoverflow.com/a/27523636
has comment: http://stackoverflow.com/comment/43476199
has comment: http://stackoverflow.com/comment/43481800
has comment: http://stackoverflow.com/comment/43519606
has comment: http://stackoverflow.com/comment/43510434
score: 0
has body: The LoginFilter will be triggered on every request going to any target under /sp/. If you want a webpage does not trigger this Filter you must make sure that the page is not on a path that will trigger the filter. May be have a structure like this. / /sp/ /public/ and put the login page in public
has comment: http://stackoverflow.com/comment/43481499
answers question: http://stackoverflow.com/q/27522445
type: Answer
has comment: http://stackoverflow.com/comment/43482025

http://stackoverflow.com/q/27498009
score: 3
answer count: 0
upvote count: 3
tagged with: java
type: Question
tagged with: video-streaming
downvote count: 0
tagged with: html5-video
has title: What is the most efficient way to record video in a browser for purposes of storing on a server?
favorite count: 0
type: UnansweredQuestion
has body: I'm in the process of developing a java web application using Spring MVC that will (among other things) be capable of recording video from a camera on an Android based tablet and ultimately transfer that video to the server (dbase or filesystem). I see there are a number of tools available that might allow me to do this one of two ways: (1) record that video locally in the browser and potentially upload the final product as a single file to the server (i.e. RecordRTC) or (2) establish a connection to the server that enables me to stream the video direct, leaving it to the server side to manage the actual recording (i.e. Kurento, Jitsi). However, there are a few gotchas in all of this that are making it difficult for me to determine (1) which way makes sense and (2) which way is actually proven to work: must be capable of running in any browser on an Android based tablet (v 4.2+) recorded video can be anywhere from 15 sec to 15 min in duration users will be securely authenticated at login via Spring security; video streams/files need to be handled in that established session (which I don't think is possible with Kurento) must be open source I've been developing Java web applications for many years now, but the video capture and processing component is something new to me and I'm hoping those with experience in this arena could guide me in a direction that makes most logical sense. NOTE: I am open to other ideas that might make more sense than what I've mentioned already. Given the direction of HTML5, I thought WebRTC would be the best route. But given some of the Android based browser limitations, I'm not sure. Thanks!
tagged with: spring

http://stackoverflow.com/q/27613136
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27616515
type: Question
has body: Im working on spring hibernate project. Im getting an error "NoSuchBeanDefinitionException" if I didnt mention bean name together with @Repository or @Component. For example : @Repository("HibernateDaoImpl") works fine. @Repository gives an error. INFO: Building new Hibernate SessionFactory Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'HibernateDaoImpl' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1159) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:282) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) at com.amal.springdb.JdbcDemo.main(JdbcDemo.java:23) package com.amal.springdb.model; import javax.persistence.Entity; import javax.persistence.Id; @Entity public class Circle { @Id private int id; private String name; public Circle(int id, String name) { this.id = id; this.name = name; } public Circle() { // TODO Auto-generated constructor stub } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } package com.amal.springdb.dao; import org.hibernate.Query; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository //("HibernateDaoImpl") public class HibernateDaoImpl { @Autowired private SessionFactory sessionFactory; public int getCircleCount(){ String hql = "select count(*) from Circle"; Query query = getSessionFactory().openSession().createQuery(hql); int i = ((…
has comment: http://stackoverflow.com/comment/43664452
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27616515
has title: NoSuchBeanDefinitionException for @Repository @Component annotations
tagged with: spring
has comment: http://stackoverflow.com/comment/43648688

http://stackoverflow.com/q/27622800
has comment: http://stackoverflow.com/comment/43736948
answer count: 2
has comment: http://stackoverflow.com/comment/43688561
linked to: http://stackoverflow.com/q/1992213
favorite count: 0
possible better answer: http://stackoverflow.com/a/27660518
linked to: http://stackoverflow.com/q/7789547
has answer: http://stackoverflow.com/a/27660518
accepted answer: http://stackoverflow.com/a/27660559
has title: How to separate subproject classpaths in Eclipse?
tagged with: subproject
type: AnsweredQuestion
upvote count: 2
downvote count: 1
tagged with: classpath
tagged with: git
type: Question
score: 1
has answer: http://stackoverflow.com/a/27660559
tagged with: java
has body: I know that there is a Git plugin for Eclipse ("Egit"), but I like to do Git stuff on the command line, and I like to code in Eclipse, so I want to keep them separate. I cloned a Git repo (I don't think its important, but for good measure, it was https://github.com/spinscale/dropwizard-jobs.git). I then opened up Eclipse (Juno) and created a new Java project, and selected the root of the cloned repo as the base path to my project. Eclipse asked me if I wanted to associate the project with the Java facet, and I clicked 'OK'. This project has a large dependency tree (if you like, check out its 4 POM files). I don't use Maven to build (I use Gradle) so I just ran a script that resolves the dependencies of these POMs into a directory, and then I created a lib directory in this Eclipse project and copied all the JARs into it. I then added all these JARs to the project's classpath. I am now seeing 10 errors in the Problems view in Eclipse, and they're all similar errors: The type ApplicationStartTestJob is already defined ApplicationStartTestJob.java /dropwizard-jobs/dropwizard-jobs-core/src/test/java/de/spinscale/dropwizard/jobs line 10 Java Problem The type ApplicationStartTestJob is already defined ApplicationStartTestJob.java /dropwizard-jobs/dropwizard-jobs-guice/src/test/java/de/spinscale/dropwizard/jobs line 10 Java Problem 8 more all like this, etc. Sure enough, when I expand the entire project, I see it has the following structure: dropwizard-jobs/ dropwizard-jobs-core/ src/test/java/ de.spinscale.dropwizard.jobs ApplicationStartTestJob.java dropwizard-jobs-guice src/test/java/ de.spinscale.dropwizard.jobs ApplicationStartTestJob.java dropwizard-jobs-spring src/test/java/ de.spinscale.dropwizard.jobs ApplicationStartTestJob.java So it seems that the maintainers of this project like to rename their unit tests with the exact same package/class names, and for some reason, Eclipse sees them as all belonging inside the same package. To test this I renamed dropwizard-j…
tagged with: eclipse

http://stackoverflow.com/comment/43634170
comment on: http://stackoverflow.com/q/27605257
type: QuestionComment
has text: @javadev This is not what I'm looking for. I want to hide the password in the oauth2 url, not hiding passwords in a spring configuration...
type: Comment
score: 0

http://stackoverflow.com/q/27548562
tagged with: jsp
possible better answer: http://stackoverflow.com/a/27548753
upvote count: 2
has title: Can't hit wanted controller's POST method
has answer: http://stackoverflow.com/a/27548753
favorite count: 0
has body: When user enters new comment I want to save it, and I have a POST method in my controller that should handle that, but I have problem with targeting that method. When I debug the code, it won't even get to handleNewComment method in controller, but I get redirected to index.jsp page, although in address bar there is a valid address (http://localhost:8080/ycexams-web/showIssue). showIssue.jsp &lt;%@ include file="/common/taglibs.jsp"%&gt; &lt;form:form commandName="issue" id="issueForm"&gt; &lt;form:hidden path="id"/&gt; &lt;form:label path="headline" id="issueHeadline"&gt;${issue.headline}-&lt;/form:label&gt; &lt;form:label path="headline" id="issuePercentage"&gt;${percentage}%&lt;/form:label&gt; &lt;form:input cssClass="form-control" path="text" id="issueText" /&gt; &lt;form:errors path="text" cssClass="error"/&gt; &lt;input type="hidden" value="${issue.id}" name="issueId"/&gt; &lt;br/&gt; &lt;/form:form&gt; &lt;button id="addCommentButton" onclick="showAddCommentField()"&gt;&lt;fmt:message key="issue.addComment"/&gt;&lt;/button&gt; &lt;br/&gt; &lt;div id="addCommentField" style="display:none"&gt; &lt;form:form commandName="comment" method="post" action="showIssue" id="commentForm"&gt; &lt;fmt:message key="comment.nickname"/&gt;&lt;br/&gt; &lt;form:input path="nickname" id="commentNickname" /&gt;&lt;br/&gt;&lt;br/&gt; &lt;fmt:message key="comment.text"/&gt;&lt;br/&gt; &lt;form:input cssClass="form-control" path="text" id="commentText" /&gt; &lt;form:errors path="text" cssClass="error"/&gt; &lt;br/&gt; &lt;button type="submit" class="btn btn-primary" name="save"&gt; &lt;i class="icon-ok icon-white"&gt;&lt;/i&gt; &lt;fmt:message key="comment.button.save"/&gt; &lt;/button&gt; &lt;/form:form&gt; &lt;/div&gt; &lt;c:if test="${commentCount != 0 &amp;&amp; commentCount!= null}"&gt; &lt;fmt:message key="issue.comments"/&gt; &amp;nbsp;(${commentCount}) &lt;c:forEach var="comment" items="${allComments}" varStatus="status"&gt; &lt;div style="padding: 10px;"&gt; ${comment.nick…
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27548630
accepted answer: http://stackoverflow.com/a/27548630

http://stackoverflow.com/comment/43471880
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27521247
score: 0
has text: Possible duplicate of [What mechanism does println use](http://stackoverflow.com/questions/26583058/what-mechanism-does-println-use/26583069#comment41782483_26583069).

http://stackoverflow.com/comment/43566106
comment on: http://stackoverflow.com/a/27552149
score: 0
type: AnswerComment
type: Comment
has text: Would the two arrays in the above example be [7,4,2] and [10,6]?

http://stackoverflow.com/q/27622383
has body: I've a java application which I run using a batch file- start.bat Batch file: @echo off rem ( set JAVA_HOME=.\jre7 rem echo %JAVA_HOME% java.exe -jar app-0.0.1-SNAPSHOT.jar rem ) Manifest file has the name of class which has public static main(String[] args) method, and that's the start point of application. I run the application from command prompt by typing start.bat Now I need to give command line arguments to this bat file that can be received by main method. so the task is to pass command line parameters to batch file and then send those parameter to java class main method. I was exploring apache cli library but not sure if it can help me. Basically this should be the input: start.bat -a : if -a is there then do task A in java application start.bat -b : if -b is there then do task B in java application start.bat -a -b : do task A and B Help appreciated. Thanks !
type: Question
answer count: 2
has title: Command line options to batch file (Java application)
score: 0
tagged with: batch-file
tagged with: windows
tagged with: cmd
has comment: http://stackoverflow.com/comment/43730907
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27622460
has comment: http://stackoverflow.com/comment/43666252
has answer: http://stackoverflow.com/a/27622748
tagged with: java

http://stackoverflow.com/a/32768441
score: 1
has body: I can't say about all of your errors, but know that relative paths lead to boot sector says there are 0 sectors per FAT for me. Using C:\fullpath\dotest\ worked.
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27638969

http://stackoverflow.com/comment/43610038
comment on: http://stackoverflow.com/q/27592542
score: 0
has text: @GabeSechan mmm OK but what happens then when the callbacks get called? Do the code `Do soume stuff` or `Do some other stuff` get executed? Yes I would say
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43640414
comment on: http://stackoverflow.com/q/27608928
has text: What is in your `Beans.xml` if there is component-scanning make sure the `@Configuration` class is picked up, else just add it as a bean to your xml file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27577773
tagged with: java
tagged with: mysql
type: Question
possible better answer: http://stackoverflow.com/a/27578135
has body: I've been trying to create a HTML Page using Velocity which shows the names stored in a SQL Table named users. When I run my program, it prints the following stack trace: java.sql.SQLException at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:815) at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5528) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5448) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488) at com.sarvika.velocity.HelloWorld.CfNMHTMLParser.main(CfNMHTMLParser.java:41) I am sure that I did import all the required libraries and the Driver for MySQL Connectivity. I am using mysql-connector-java-5.1.6 for the purpose. My code is: package com.sarvika.velocity.dbtovelocity; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import org.apache.velocity.*; import org.apache.velocity.app.VelocityEngine; public class CfNMHTMLParser { private final static String URL = "jdbc:mysql://localhost/coffeenet"; private final static String USER = "root"; private final static String PASS = "root"; private static final String BOOL_EXC = "exception"; private static final String EXC = "exc"; private static final String USER_LIST = "usersArray"; public static void main (String [] args) throws IOException { VelocityEngine engine = new VelocityEngine(); Template template = engine.getTemplate("HTMLTemplate.vm"); VelocityContext context = new VelocityContext(); CfNMHTMLParser parser = new CfNMHTMLParser(); String [] data = null ; try { Connection conn = DriverManager.getConnection(URL, USER, PASS); Statement stmt = conn.createStatement(); String query = "SELECT count(*) FROM users ;"; ResultSet rs = stmt.executeQuery(que…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27578135
has answer: http://stackoverflow.com/a/27581538
accepted answer: http://stackoverflow.com/a/27581538
tagged with: velocity
type: AnsweredQuestion
has title: Velocity with MySQL DB Connectivity not working

http://stackoverflow.com/q/27610274
has comment: http://stackoverflow.com/comment/43643201
has answer: http://stackoverflow.com/a/27610293
tagged with: overloading
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27610306
tagged with: java
has answer: http://stackoverflow.com/a/27611014
type: Question
has comment: http://stackoverflow.com/comment/43643555
has comment: http://stackoverflow.com/comment/43643177
has comment: http://stackoverflow.com/comment/43642946
accepted answer: http://stackoverflow.com/a/27610306
score: 0
has answer: http://stackoverflow.com/a/27610463
has body: After reading overloaded constructors from a book, i tired the following code: public class Employee { String name; int idNumber; public Employee(){ this("JJ", 0); System.out.println(name +" "+ idNumber); } public Employee(String name, int num){ this.name = name; idNumber = num; System.out.println(name +" 2nd "+ idNumber); } } public class Object1 { public static void main(String[] args) { Employee emp = new Employee(); } } OUTPUT: JJ 2nd 0 JJ 0 I am really confused. Why "JJ 2nd 0" printed out first then "JJ 0"?? I created an employee object emp and did not pass any args in the parameter, isn't suppose to call the first constructor first?
has answer: http://stackoverflow.com/a/27610311
has comment: http://stackoverflow.com/comment/43643368
has title: Overloaded constructors
tagged with: constructor
answer count: 5
possible better answer: http://stackoverflow.com/a/27610311

http://stackoverflow.com/q/27510824
tagged with: division
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27510906
tagged with: java
has body: Got my head in spaghetti mode. Here is the question: (Check a number) Write a program that prompts the user to enter an integer and checks whether the number is divisible by both 3 and 7, or by neither of them, or by just one of them. Here are some sample runs for inputs, 9,21, and 25. 9 is divisible by 3 or 7, but not both 21 is divisible by both 3 and 7 25 is not divisible by either 3 or 7/ This is what I have so far. I know I'm wrong but do not think I am too far from solving the question. public class Quest12 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a number: "); int i = scan.nextInt(); if (i % 3 == 0 ^ 7 == 0) { System.out.println(i + " is divisible by 3 or 7. "); } else if (i % 3 == 0 || 7 == 0) { System.out.println(i + " is divisble by either 3 or 7. but not both "); } if (i % 3 == 0 &amp;&amp; 7 == 0) { System.out.println(i + " is divisble by both 3 and 7 "); } } }
has comment: http://stackoverflow.com/comment/43451822
type: Question
has answer: http://stackoverflow.com/a/79401297
answer count: 3
has comment: http://stackoverflow.com/comment/43451796
downvote count: 0
has answer: http://stackoverflow.com/a/27510906
favorite count: 0
possible better answer: http://stackoverflow.com/a/27510894
upvote count: 2
has title: Check whether the number is divisible by both 3 and 7, or by neither of them
has answer: http://stackoverflow.com/a/27510894

http://stackoverflow.com/a/27509495
has comment: http://stackoverflow.com/comment/43456533
type: Answer
answers question: http://stackoverflow.com/q/27508840
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27508840
has comment: http://stackoverflow.com/comment/43471844
has body: Depending on the Hibernate Session FLUSHMODE, your persistent objects may be synchronized with the persistence store before a query is executed by performing a flush() operation on the Session. The flush process synchronizes database state with session state by detecting state changes and executing SQL statements, but it does not commit the transaction. The default FLUSHMODE is AUTO, which is described as : The Session is sometimes flushed before query execution in order to ensure that queries never return stale state. This is the default flush mode. If you are getting stale data returned in your queries, flushing the Session manually should resolve your issue.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43457513

http://stackoverflow.com/q/27516204
type: Question
linked to: http://stackoverflow.com/q/11437203
tagged with: arrays
possible better answer: http://stackoverflow.com/a/63619171
has answer: http://stackoverflow.com/a/67650374
score: 0
answer count: 3
has title: ByteBuffer to int array (each byte)
has answer: http://stackoverflow.com/a/63619171
accepted answer: http://stackoverflow.com/a/27516232
type: AnsweredQuestion
tagged with: java
has body: Related to question byte array to Int Array, however I would like to convert each byte to an int, not each 4-bytes. Is there a better/cleaner way than this: protected static int[] bufferToIntArray(ByteBuffer buffer) { byte[] byteArray = new byte[buffer.capacity()]; buffer.get(byteArray); int[] intArray = new int[byteArray.length]; for (int i = 0; i &lt; byteArray.length; i++) { intArray[i] = byteArray[i]; } return intArray; }
has answer: http://stackoverflow.com/a/27516232

http://stackoverflow.com/comment/43513085
has text: I know I just meant that in java you work with exceptions so you "throw" them. I know it's not and exception just message you're right. OK I start putting perror more often. I didn't about it and I just wanted to know what's going on that's way the printf() s. Thanks. It's good to iprove programming in any way.
comment on: http://stackoverflow.com/q/27542629
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43605043
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27590275
score: 0
has text: Apologies, I jumped to conclusions. I'll try to edit a summary to the top of the post later, so that people who are interested can still see all of the info, but it's not too daunting for those without much time.

http://stackoverflow.com/comment/43413258
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27475069
has text: it works fine from the command line or MySQL Workbench. it is from java i have the the problem. I`m creating a Java application

http://stackoverflow.com/comment/43619386
type: Comment
has text: I mean, I know that something's wrong with the string including which line is creating the problem... in this case it's the line with `Long.parseLong()`, but I don't know what that is or how I can fix it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27597887

http://stackoverflow.com/comment/43593055
has text: @question: we have no idea since you don't show us the key parts of the DrawingPanel code.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27584038

http://stackoverflow.com/q/27579783
has comment: http://stackoverflow.com/comment/43584633
has comment: http://stackoverflow.com/comment/43584183
has title: getConstructor with no parameters
has body: I can't seem to use getConstructor for constructors with no parameters. I keep getting the following exception: java.lang.NoSuchMethodException: classname.&lt;init&gt;() Here is the code: interface InfoInterface { String getClassName(); String getMethodName(); String getArgument(); } class asa implements InfoInterface { @Override public String getClassName() { return ("jeden"); } @Override public String getMethodName() { return ("metoda"); } @Override public String getArgument() { return ("krzyk"); } } class Jeden { Jeden() { System.out.println("konstruktor"); } public void Metoda(String s) { System.out.println(s); } } class Start { public static void main(String[] argv) { if (argv.length == 0) { System.err.println("Uzycie programu: java Start nazwa_klasy nazwa_klasy2..."); return; } try { for (int x = 0; x &lt; argv.length; x++) { Class&lt;?&gt; c = Class.forName(argv[x]); InfoInterface d = (InfoInterface) c.newInstance(); String klasa = d.getClassName(); String metoda = d.getMethodName(); String argument = d.getArgument(); Class&lt;?&gt; o = Class.forName(klasa); // o.newInstance(); Constructor&lt;?&gt; oCon = o.getConstructor(); System.out.println("ASD"); Class&lt;?&gt; p = (Class&lt;?&gt;) oCon.newInstance(); } } catch (Exception e) { System.out.println(e); } } } o.newInstance(); prints "konstruktor" without problems.
favorite count: 0
has answer: http://stackoverflow.com/a/27580066
has comment: http://stackoverflow.com/comment/43584382
has answer: http://stackoverflow.com/a/27580029
has comment: http://stackoverflow.com/comment/43585040
has comment: http://stackoverflow.com/comment/93736423
has comment: http://stackoverflow.com/comment/43584417
answer count: 5
has comment: http://stackoverflow.com/comment/43584133
has comment: http://stackoverflow.com/comment/43584649
downvote count: 1
has comment: http://stackoverflow.com/comment/43585262
type: Question
linked to: http://stackoverflow.com/q/13541386
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/61276888
tagged with: getconstructor
tagged with: java
has comment: http://stackoverflow.com/comment/43584226
score: 17
possible better answer: http://stackoverflow.com/a/27580029
upvote count: 18
has answer: http://stackoverflow.com/a/58919112
has comment: http://stackoverflow.com/comment/43584521
has answer: http://stackoverflow.com/a/27580043
accepted answer: http://stackoverflow.com/a/27580043

http://stackoverflow.com/q/27557998
answer count: 1
has comment: http://stackoverflow.com/comment/43542176
has comment: http://stackoverflow.com/comment/43542331
tagged with: nullpointerexception
upvote count: 1
has comment: http://stackoverflow.com/comment/43542395
tagged with: user-interface
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has title: Null pointer exception for adding to a Jlist in Java
has body: I am trying to add a set of data called deliveryToAdd, however when I click the add button it will give the following error (it give a lot of lines in the output but this is the first few lines): Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at fastcourierservice.gui.AddDelivery.saveItem(AddDelivery.java:360) at fastcourierservice.gui.AddDelivery.btnAddDeliveryActionPerformed(AddDelivery.java:265) at fastcourierservice.gui.AddDelivery.access$100(AddDelivery.java:17) at fastcourierservice.gui.AddDelivery$2.actionPerformed(AddDelivery.java:101) When I click on the error it takes me to this line in the code: deliveryRecord.addDeliveryWithCost(deliveryToAdd, Cost); This is the full code for this method which is called in the add button: private void saveItem() { if (this.isSaveable()) { int packageCount = Integer.parseInt(txtNoOfPackages.getText()); double costPerKG = Double.parseDouble(txtCostPerKg.getText()); double weight = Double.parseDouble(txtWeight.getText()); double Cost = costPerKG * weight; String consignmentNumber = txtConsignmentNumber.getText(); Address colAddress = new Address(txtColAddressLine1.getText(), txtColAddressLine2.getText(), txtColCity.getText(), txtColPostcode.getText()); Address delAddress = new Address(txtDelAddressLine1.getText(), txtDelAddressLine2.getText(), txtDelCity.getText(), txtDelPostcode.getText()); Delivery deliveryToAdd = new Delivery(consignmentNumber, packageCount, weight, colAddress, delAddress); //Test results System.out.println(deliveryToAdd); System.out.println(packageCount); System.out.println(weight); System.out.println(colAddress); System.out.println(delAddress); System.out.println(Cost); deliveryRecord.addDeliveryWithCost(deliveryToAdd, Cost); System.out.println(deliveryToAdd); } } I used the System.out.println(); to test the results the deliveryToAdd shows the consignmentNumber and the rest show as expected. This is the start of this class where the deliveryRecord was declared: public class AddDe…
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27558183
type: Question

http://stackoverflow.com/a/27524302
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Thhis one will helpfull to you. DatePickerDialog dp = new DatePickerDialog(this, datePickerListener, year, month, day); long maxDate; Date newDate = c.getTime(); dp.getDatePicker().setMinDate(newDate.getTime()); dp.getDatePicker().setMaxDate(maxDate);
answers question: http://stackoverflow.com/q/27523639
has comment: http://stackoverflow.com/comment/43477272

http://stackoverflow.com/a/27591295
answers question: http://stackoverflow.com/q/27591276
has body: It appears you are not overriding the Object.equals method in your Card class by specifying the two desired Strings (rank and suit) as equality criteria, which in turn means the remove method will return false and won't remove the Card. I would also recommend overriding hashCode, although it isn't necessary in this context. Most IDEs (such as Eclipse) have functionalities to generate those methods based on your desired equality criteria. Here's a famous (yet debatable) SO question on the equals / hashCode contract in Java.
has comment: http://stackoverflow.com/comment/43606757
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/43606653
upvote count: 1
has comment: http://stackoverflow.com/comment/43606368
has comment: http://stackoverflow.com/comment/43606381
accepted answer of: http://stackoverflow.com/q/27591276

http://stackoverflow.com/a/27492145
answers question: http://stackoverflow.com/q/27492053
has body: Just change your while condition to while(k &lt; 40 &amp;&amp; j.hasNextInt()) and it should work properly.
downvote count: 0
score: 1
type: Answer
upvote count: 1

rsa
tags question: http://stackoverflow.com/q/27517883
tags question: http://stackoverflow.com/q/27575059
tag name: rsa
tags question: http://stackoverflow.com/q/27484254
tags question: http://stackoverflow.com/q/27582847
tags question: http://stackoverflow.com/q/27480753
type: Tag
tags question: http://stackoverflow.com/q/27577680

http://stackoverflow.com/comment/43409677
comment on: http://stackoverflow.com/q/27489033
has text: make sure you are initializing `nomi` in `RatingDetailsActivty` Activity?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43554081
type: Comment
comment on: http://stackoverflow.com/q/27563913
type: QuestionComment
has text: So if the exception is as *desktop.open(pdfFilepath)* then the problem is 'desktop' is not initialized. Try 'Desktop.getDesktop().open(pdfFilepath)' and see what happens.
score: 1

opencv
type: Tag
tags question: http://stackoverflow.com/q/27550773
tags question: http://stackoverflow.com/q/27527440
tags question: http://stackoverflow.com/q/27552251
tags question: http://stackoverflow.com/q/27630571
tag name: opencv
tags question: http://stackoverflow.com/q/27494592
tags question: http://stackoverflow.com/q/27490363
tags question: http://stackoverflow.com/q/27574615
tags question: http://stackoverflow.com/q/27613353
tags question: http://stackoverflow.com/q/27507217

http://stackoverflow.com/q/27613353
answer count: 0
has comment: http://stackoverflow.com/comment/43650531
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43650583
favorite count: 0
type: UnansweredQuestion
has body: I am trying to read a png image into OpenCV Mat, It's reading my image but I got 0 for row and column here's my code. obCast = Highgui.imread(getClass().getResource("/_0cast.png").getPath(),Highgui.CV_LOAD_IMAGE_COLOR);
has title: Can't load image into Mat OpenCV + Java
upvote count: 1
tagged with: opencv
has comment: http://stackoverflow.com/comment/43649614

http://stackoverflow.com/comment/43580235
type: Comment
comment on: http://stackoverflow.com/a/27576751
has text: well, can you tell me where is the code that does this, in those 277 itens inside the .apk?
type: AnswerComment
score: 0

http://stackoverflow.com/a/27594718
has comment: http://stackoverflow.com/comment/43617708
has body: Your type Parameter is generic. This Parameter p; is using Parameter as a raw type. Avoid using it. This //no warning Parameter&lt;?&gt; p2; is using Parameter with a type argument of ?, the wildcard. You can assign any value of type Parameter to the variable p2, regardless of its parameterization. This //error Parameter&lt;T&gt; p3; is attempting to use a type named T as a type argument to Parameter. If such a type doesn't exist or isn't in scope, a compiler error will occur. That's what seems to be happening. Then should I use the Wildcard everywhere when asked? No, use an appropriate type argument. This depends on what you want to do.
score: 0
has comment: http://stackoverflow.com/comment/43613428
answers question: http://stackoverflow.com/q/27594648
type: Answer

http://stackoverflow.com/comment/43567443
comment on: http://stackoverflow.com/a/27570939
score: 0
type: Comment
has text: Yes, it's a multirow table. I just included the row I was working with for brevity's sake.
type: AnswerComment

http://stackoverflow.com/comment/43491291
type: Comment
has text: Ok, but i don't have something general that Called "Error" like i have Exception so what should i do in order to catch all Errors?
type: AnswerComment
comment on: http://stackoverflow.com/a/27531306
score: 0

http://stackoverflow.com/q/27522466
answer count: 2
has answer: http://stackoverflow.com/a/32482518
has comment: http://stackoverflow.com/comment/43521214
score: 0
has title: JAVA POI DOCX replace text in paragraph
has answer: http://stackoverflow.com/a/40280559
has comment: http://stackoverflow.com/comment/43475612
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
type: UnansweredQuestion
type: Question
has body: Hi i m trying to replace some text in a docx file, but i got problemes with text to be replaced that can be on multiple runs. So i tried this : but it erase everything in the document :/ private void replaceText(XWPFParagraph p, String target, String replacement) { if (p.getRuns() != null) { String paragraph = p.getText(); for (int i = 0; i &lt; p.getRuns().size(); i++) { p.removeRun(i); } paragraph = paragraph.replace(target, replacement); XWPFRun r = new XWPFRun(CTR.Factory.newInstance(), p); r.setText(paragraph, 0); } }
tagged with: java

http://stackoverflow.com/comment/43439597
comment on: http://stackoverflow.com/q/27504715
has text: It's generally recommended to implement `Runnable` and not extend `Thread`. Implementing interfaces is always cleaner than inheriting implementations. If I had my way there'd be a school called 'Interface Oriented Programming' that tended to discourage implementation inheritance given it violates implementation hiding and abstraction. It has its uses but should only be used inside a implementation and with great caution as a way for others to extend functionality and integrate with your libraries.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43491089
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27531249
has text: OutOfMemeoryError is of type java.lang.Error, not Throwable..
type: QuestionComment

http://stackoverflow.com/comment/43616578
has text: thank you how can i do that please give me the instructions which i needed to do
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27596333

http://stackoverflow.com/q/27535145
tagged with: android
tagged with: plugins
tagged with: logging
type: AnsweredQuestion
has title: How to debug cordova plugin and Logging with "android.util.log"
tagged with: java
has answer: http://stackoverflow.com/a/27536342
score: 9
type: Question
upvote count: 9
has body: I'm developing a cordova app which make use of plugins. One of this use the method Log.v from android.util.log. Questions: 1) where does the plugin flush this logs? And how I can check them? 2) it's possibile to print something to console at runtime from the "java side"? I can only debug the javascript part through "crome://inspect" on Google Chrome or via adb running the command "adb logcat CordovaApp:D *:S" Important Note: I'm using netbeans 7.4 and I can't launch the run command from netbeans because it does not take into account the root config.xml file, causing a rewrite of my settings and also (don't know why), the process takes too much time to run because of undetected plugins (that peraphs are installed) and re-download them each time fetching from git. Thank you
accepted answer: http://stackoverflow.com/a/27536342
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cordova

http://stackoverflow.com/a/27605291
has comment: http://stackoverflow.com/comment/123808919
has comment: http://stackoverflow.com/comment/43632888
has comment: http://stackoverflow.com/comment/43633375
score: 11
has comment: http://stackoverflow.com/comment/43633856
has comment: http://stackoverflow.com/comment/43633501
answers question: http://stackoverflow.com/q/27605211
has comment: http://stackoverflow.com/comment/83020125
downvote count: 1
has comment: http://stackoverflow.com/comment/43633713
has body: The purpose of unit testing isn't to test statements but methods. The right thing to do is not to consider this line, but to consider the method that it appears in, and ask what you want that method to do: what sort of input does it take, and what sort of output should it produce? Then write tests that take some typical inputs, and check that they give correct outputs, and also some edge case inputs (like null, 0, Integer.MAX_VALUE, etc.) and check that you get the right outputs for those too. If this is your entire method (which actually it can't be, but if it's the essence of it), I'd test: a basket with a null customer ID; a null basket (unless you're certain this can never happen), because currently this code will give a NullPointerException; a basket that has a customer ID that should allow you to find a known exBasket; a basket that has a customer ID that will return an exBasket of null; a basket that has a customer ID that will return an exBasket that isn't null, but whose basket ID is null.
upvote count: 12
has comment: http://stackoverflow.com/comment/43633302
has comment: http://stackoverflow.com/comment/43632793
has comment: http://stackoverflow.com/comment/43633778
type: Answer
has comment: http://stackoverflow.com/comment/43657125

http://stackoverflow.com/a/27578051
answers question: http://stackoverflow.com/q/27577994
has body: I don't have a windows machine to test this on, but generally to get the output for those builtins you run cmd.exe as the program and pass it the command as an argument. Now, this has some limitations, because when the command finishes the executable stops. So if you do a cd command, it will work, but it only affect the subprocess, not your process. For those sorts of things, if you want them to change the state of your process, you'll need to use other facilities. This version works on a Mac: import java.io.*; public class cmd { public static void main(String[] argv){ String line; String[] cmd = {"bash","-c","ls"}; System.out.println("Hello, world!\n"); try { Process p = Runtime.getRuntime().exec(cmd); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (Exception e) { } return ; } }
accepted answer of: http://stackoverflow.com/q/27577994
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/27488008
favorite count: 0
has body: I am working on a sample project in Java, specifically Android, with OpenGL ES 2.0. I am looking to create a terrain for a player to move across. The player needs to move up and down the terrains hieght following the heightmap. The terrain is not flat. I am using Blender to create the terrain and heightmap. The terrain is being imported as an obj file. The import and the drawing is working fine but i am having issues making the coordinates follow the heightmap. It doesn't seem to follow it 100%. The player moves up or down too soon every so often or he drops below the terrain. What I Have So Far: 1)What I am doing is importing the OBJ file into project. Reading the farthest point from terrain object and using this as the object length ( this value * 2 ). This tells me how many vertices are in the object along one side. 2)I then get the difference in the players position to terrain origin in world coordinates. I take the x and z values and divide each by the OBJ object length*2 to give the region of the terrain the object is in. This will give me the percentage of where the x and z position the player is in reference to the terrain. 3) I open the heightmap and multiply the percentages above to the image of the heightmap to get the x and y position on the heightmap to read the height from. Below is what I am working with. public float getHeightOfTerrain(float worldX, float worldZ){ // worldX and worldZ are the players position // Currentmatrix is the matrix used for positioning the terrain float terrainX = worldX - CurrentMatrix[12] + objLength; float terrainZ = worldZ - CurrentMatrix[14] + objLength; return getHeight(terrainX, terrainZ); } ................ float MAX_HEIGHT = 20; float MAX_PIXEL_COLOR = 256*256*256; ................ public float getHeight(float x, float z){ float posX = x / (objLength*2); float posZ = z / (objLength*2); if(posX &lt; 0 || posX &gt; 1 || posZ &lt; 0 || posZ &gt; 1){ // if over 1 which is 100% of terrain then return return 0; } float img…
tagged with: heightmap
tagged with: android
has title: Android Height Mapping Imported OBJ file in OpenGL ES 2.0?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27594478
tagged with: coordinates
tagged with: java
type: Question
answer count: 1
downvote count: 0
score: 1
tagged with: opengl-es

http://stackoverflow.com/q/27476075
has comment: http://stackoverflow.com/comment/43386660
has answer: http://stackoverflow.com/a/27476136
has body: I downloaded the source code for Google Guava just out of curiosity to see what is backing the immutable collections. I was going through the ImmutableList and I noticed that it was still backed by an old-fashioned array, as in Object[] So I'm just curious, the Object[] array is probably mutable by its nature, and it is not threadsafe. I already knew that ArrayList and CopyOnWriteArrayList were backed by an Object[] array, but they are mutable. So is the ImmutableList only immutable and threadsafe because its internal properties are well encapsulated and protected? Is it also immutable and threadsafe because the encapsulation ensures nothing will modify it after construction? Will there ever be a day where low-level arrays like this will be switched out for something better and not of a legacy, and be inherently immutable and final rather than immutable by careful encapsulation?
tagged with: collections
has comment: http://stackoverflow.com/comment/43386612
type: AnsweredQuestion
tagged with: guava
accepted answer: http://stackoverflow.com/a/27476136
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43386568
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43386575
has title: Guava ImmutableList... what exactly is backing it?

http://stackoverflow.com/comment/43409429
has text: I tried doing so. But result is same, @jervine10
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27488471

http://stackoverflow.com/comment/43543999
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27541989
has text: @RemyLebeau I found that if I remove some code about the socket in `runnableUi`, the thread wouldn't freezing.
score: 0

http://stackoverflow.com/a/27603051
score: 1
has body: Acquiring the lock implies that you're trying to access a guarded section of code so it should block (if you're not lucky i.e. you should block at least in certain scenarios) If that's the behaviour you want, you should just use the lock method. The whole point of tryLock is that you use it when you don't want to block if the lock isn't available. In terms of how that's implemented, it's up to individual implementations - so you should look at whichever implementation you're interested in. I would personally think it reasonable for those to use synchronized internally, if they knew that no user-specified code was ever run inside the synchronized blocks - in other words, it could block briefly for internal house-keeping, but not for the duration of the lock itself. Or of course an implementation which had access to appropriate machine-level instructions could use compare-and-swap etc... heck, AtomicBoolean.compareAndSet could probably be used for a very simple version of this.
has comment: http://stackoverflow.com/comment/43628589
downvote count: 0
answers question: http://stackoverflow.com/q/27602914
type: Answer
has comment: http://stackoverflow.com/comment/43628524
upvote count: 1
has comment: http://stackoverflow.com/comment/43628394
has comment: http://stackoverflow.com/comment/43628521
has comment: http://stackoverflow.com/comment/43628642

http://stackoverflow.com/q/27639844
has comment: http://stackoverflow.com/comment/43698662
has title: Jackon deserialization : how to reference another property?
answer count: 1
type: UnansweredQuestion
tagged with: jackson
has comment: http://stackoverflow.com/comment/43712406
has answer: http://stackoverflow.com/a/27643257
has comment: http://stackoverflow.com/comment/43698598
has body: Given this example document: { "currency": "USD", "items": [{ "description": "foo", "price": 100 }, { "description": "bar", "price": 50 }] } And these Java classes class Order { Currency currency; List&lt;Item&gt; items; static class Item { String description; Money price; } static class Money { BigDecimal amount; @SomeDeserializationAnnotation("to reference currency from parent document Order") Currency currency } } Does something like @SomeDeserializationAnnotation("to reference currency from parent document Order") exist ? If not, is it even possible with custom deserializer ?
type: Question
has comment: http://stackoverflow.com/comment/43713616
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/27501998
upvote count: 2
has comment: http://stackoverflow.com/comment/43434339
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27501913
has body: You can delegate the Event to the Player and when the event terminates, you can use the terminated flag to determine if you are able to associate the player with another event. public class Player { private Event event; private int id; ... public void setEvent(Event event) throws Exception { if (!this.event.terminated) { throw new Exception("Player has an event to be associated with"); } else { this.event = event; } } } Note that there are also other ways to notify the Player that the Event has been terminated.
has comment: http://stackoverflow.com/comment/43434356
type: Answer
answers question: http://stackoverflow.com/q/27501913
has comment: http://stackoverflow.com/comment/43435994
score: 2
has comment: http://stackoverflow.com/comment/43434630
has comment: http://stackoverflow.com/comment/43434632

http://stackoverflow.com/comment/43469862
type: QuestionComment
comment on: http://stackoverflow.com/q/27519957
has text: I'm using Jboss Developer Studio too...
score: 0
type: Comment

http://stackoverflow.com/a/27488982
type: Answer
has comment: http://stackoverflow.com/comment/43409525
accepted answer of: http://stackoverflow.com/q/27487808
answers question: http://stackoverflow.com/q/27487808
score: 0
type: AcceptedAnswer
has body: I see a couple of issues in the code: Inside the second while() loop you are still splitting the string "line", but the while loop assigns the input to "checkLine". You don't reset "exit" to false - this should probably happen after the br.reset().

http://stackoverflow.com/comment/43403961
type: QuestionComment
has text: Sorry I cant help much with java but have you tried Googles examples they are normally very good https://code.google.com/p/google-api-java-client/wiki/OAuth2
comment on: http://stackoverflow.com/q/27485310
score: 0
type: Comment

http://stackoverflow.com/comment/43644814
type: Comment
has text: The remote client connects. I can see it in the server gui and on the local running client. The button clicks from the remote client are processed by the server and sent to the local client. No third party code was used.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27611160

http://stackoverflow.com/a/27618701
has body: JFrame by default never react to AlwaysOnTop or toFront correctly, isn't main functionality for primary Top-Level Container (without iconify and deiconify, but then flashing on the screen) you have to use JDialog for this job, set for parent and modality (if needed) exactly and also you can use JinternalFrame that makes you have some children frame in your main Jframe and you can iconify and deiconify or close which is don't needed and also make them resizable if you need. and if you want make them in front or back to others,you can make it easily by Drag&amp;Drop that Frame Children!
type: Answer
answers question: http://stackoverflow.com/q/27616405
score: 0

http://stackoverflow.com/comment/65274270
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27531335
type: Comment
has text: @Weishi Zeng: an unchecked cast may be fine or even unavoidable in some scenarios, but you won’t notice, if you are wrong as that’s why these casts are called *unchecked*. So if there is a simple way to avoid it, you should use it. If the solution is not that simple, well, then it’s a trade-off. Here, it was the actual question, how to avoid it.

http://stackoverflow.com/a/27616842
has comment: http://stackoverflow.com/comment/43816550
has comment: http://stackoverflow.com/comment/43698679
has comment: http://stackoverflow.com/comment/43674609
type: Answer
has comment: http://stackoverflow.com/comment/43687021
has comment: http://stackoverflow.com/comment/43655179
answers question: http://stackoverflow.com/q/27616762
has comment: http://stackoverflow.com/comment/43678661
has body: Add -XX:HeapDumpPath="/some/path/dump.out" to your JVM args explicitly set the heap dump file location
has comment: http://stackoverflow.com/comment/43677200
score: 0

http://stackoverflow.com/a/27550238
has comment: http://stackoverflow.com/comment/43526683
has comment: http://stackoverflow.com/comment/43526755
answers question: http://stackoverflow.com/q/27548862
has comment: http://stackoverflow.com/comment/43526794
score: 0
has body: IMHO, Container creates only one object for each servlet and then uses this object to server multiple requests by spawning thread for each. Since your servlet is successfully serving multiple request, there is a chance that the container is actually restricting number of request at a time, which you can configure. Servlets that make database transactions, sessions objects manipulation etc need to be implemented via synchronization to secure data from corruption and miss information. There is something we need to be careful here, the synchronization should be done on as minimal statements/method as possible so that the other threads don't have to wait long. There is possibility that the browser has decided that server is unresponsive, in case the request is waiting too long because of large synchronized code, and the request is crashing. Correct me if I am wrong.
type: Answer
has comment: http://stackoverflow.com/comment/43526629
has comment: http://stackoverflow.com/comment/43526913

http://stackoverflow.com/comment/61032913
type: Comment
type: QuestionComment
score: 0
has text: You can check this solution https://github.com/getintent/embedded-aerospike it uses dcoker and help us to write integration tests.
comment on: http://stackoverflow.com/q/27617698

http://stackoverflow.com/a/27522629
answers question: http://stackoverflow.com/q/27522428
upvote count: 2
has comment: http://stackoverflow.com/comment/43474597
type: Answer
accepted answer of: http://stackoverflow.com/q/27522428
score: 2
has comment: http://stackoverflow.com/comment/43475398
has body: I would say that you use the wrong data structure for this. I would totally rewrote it and use Map&lt;String, List&lt;String&gt;&gt; as it would be more appropriate as you need to map each id to a List of mails. Map&lt;String, List&lt;String&gt;&gt; map = new HashMap&lt;&gt;(); for(Bill b : billings) { List&lt;String&gt; list = map.get(b.getId()); //try to get the list with the specified id if(list == null) { //if the list is null, it means that there is no mapping yet in the map, so create one list = new ArrayList&lt;&gt;(); map.put(b.getId(), list); } list.add(b.getEmail()); //add the corresponding email to the list } which can be translated into the Java 8 style to Map&lt;String, List&lt;String&gt;&gt; map = billings.stream() .collect(groupingBy(Bill::getId, mapping(Bill::getEmail, toList())));
has comment: http://stackoverflow.com/comment/43475260
has comment: http://stackoverflow.com/comment/43474613
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43474491

http://stackoverflow.com/q/27522969
has comment: http://stackoverflow.com/comment/43475325
has body: I have Map like for (Emp emp: findAllEmp()) { Map&lt;String, String&gt; map = objectMapper.convertValue(emp, HashMap.class); } which has values as projects = {projectId=24, projectName=K245} I would like to add if projects is not null, then add this to map.put("projectId", map.get("projects.projectId}")); map.put("projectName",map.get("projects.projectName}")); When I see the output, projects.projectId and projects.projectName is always null. How do I resolve this? And how can I dynamically add values instead of hard coding projects.projectId?
has comment: http://stackoverflow.com/comment/43475295
has comment: http://stackoverflow.com/comment/43474953
tagged with: dictionary
accepted answer: http://stackoverflow.com/a/27523336
type: AnsweredQuestion
has title: Map String values processing
tagged with: java
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/43474993
tagged with: jackson
has answer: http://stackoverflow.com/a/27523336
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43475217

http://stackoverflow.com/comment/43500262
score: 0
type: Comment
type: QuestionComment
has text: Use `PreparedStatement` rather than plain `Statement`.
comment on: http://stackoverflow.com/q/27535758

http://stackoverflow.com/q/27617359
score: 0
has comment: http://stackoverflow.com/comment/43687124
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/43683365
tagged with: java
tagged with: hibernate
has body: I needed to have gape-less sequence for some tables Id's, so I create Sequence table,try to avoid selecting the Max with every insert, and total count will be used for other tasks @Id @TableGenerator(name="ProcedureTypeIdGen", table="REF_SEQUENCE_TABLE", pkColumnName="SEQ_NAME", valueColumnName="SEQ_COUNT", pkColumnValue="SEQ_PROCEDURE_TYPE", allocationSize=1, initialValue=0) @GeneratedValue(strategy=GenerationType.TABLE, generator="ProcedureTypeIdGen") @Column(name="PROCEDURE_TYPE_ID") private Long id; But sequence value always increment every time I insert a value to PROCEDURE_TYPE, although the transaction rolled back, because of an exception and no data were inserted in PROCEDURE_TYPE table!
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/43673961
has title: Sequence Table values increments although transaction is rolled back

http://stackoverflow.com/comment/43531373
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27552121
has text: @JoeInner: when i write int d1 = twodim[0].length; and d2 = twodim[1].length; I got the length of these two arrays..but you told length of first array is 4..

http://stackoverflow.com/q/27523455
tagged with: java
linked to: http://stackoverflow.com/q/9373103
has title: Passing params in Post method for webview
has comment: http://stackoverflow.com/comment/43476085
answer count: 1
accepted answer: http://stackoverflow.com/a/27524461
linked to: http://stackoverflow.com/q/13452289
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43476571
has answer: http://stackoverflow.com/a/27524461
has body: I am developing an application which load jsp page in webview.It send the parametres to the jsp oage using Post method.I am creating a string of parameter &amp; passing to post method like this w1.postUrl(protocol +"://"+host_ip+":"+portnumber+"/"+FOLDER+"/folder/data.jsp", EncodingUtils.getBytes(params, "BASE64")); params="?username="+uname+"&amp;password="+password; Now i have two questions Do i need to pass the '?' in params for POST method if i don't pass '?' then i get error. I get value null for password
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43476387
has comment: http://stackoverflow.com/comment/43476009
type: Question
tagged with: android-webview

http://stackoverflow.com/a/27619192
type: Answer
downvote count: 0
score: 1
has body: They are not the same, they just happen to produce the same output for your example. The 4 matches in the first regex: -7.00, 10.00, 0.00, -212.000 -1--- | | | | | | 11--- | | | | 1--- | | -111---- In each match, the capturing group captures the whole part of the decimal number, and all four matches are replaced by the content of the capturing group. The 6 matches in the second regex: -7.00, 10.00, 0.00, -212.000 -| | | | | | || | 1--- | | | | || | 11--- | | || | 1--- || | -| | 111---- The capturing group only captures some text in 4 matches. In the other 2 matches, the capturing group doesn't capture anything. In Oracle/OpenJDK, referring to a group that captures nothing in the replacement string will result in empty string. Therefore, the - are simply removed, and for this particular input, the end result is the same. However, for input such as --7.3, the result will be different. And in Android and GNU Classpath's implementation, a group that captures nothing is rendered as null when referred to in the replacement string, so your output string in the second case will contain null.
accepted answer of: http://stackoverflow.com/q/27618377
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27618377

http://stackoverflow.com/a/27506818
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27506730
has body: Correct, the order will be reversed. This means that if you repeat the algorithm yet again (all to S and back to Q) you will reverse it yet again, meaning you will get back to the original order of elements, which is what you want.
answers question: http://stackoverflow.com/q/27506730
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/comment/87663131
score: 0
type: AnswerComment
has text: The downvote happened on may 8th and you yourself said in your very first comment that your question was misleading. People put effort to answer your queries, its easy to just say oh i added addendum later (modified a bit or added clarity when someone asked you to) and then later people just come and downvote .. Anyway.. water under the bridge..
type: Comment
comment on: http://stackoverflow.com/a/27561025

http://stackoverflow.com/a/27487905
has comment: http://stackoverflow.com/comment/43409142
has comment: http://stackoverflow.com/comment/43408447
type: Answer
has body: if your addresses are separated by spaces , and the different elements of your address are also separated by spaces , then this line does not give you addresses , it gives you elements . List &lt; String &gt; list = new ArrayList &lt; String &gt; ( Arrays . asList ( line . split ( delimiter ) ) ) ;
has comment: http://stackoverflow.com/comment/43408935
has comment: http://stackoverflow.com/comment/43408220
answers question: http://stackoverflow.com/q/27487808
score: 0

http://stackoverflow.com/comment/43428202
type: QuestionComment
comment on: http://stackoverflow.com/q/27497753
has text: Use a library to process json: http://stackoverflow.com/questions/27347763/looking-for-a-straightforward-way-to-parse-json
score: 0
type: Comment

http://stackoverflow.com/comment/43444480
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27501365
has text: @Holger I thought awaitTermination() would just hang before we get to the end of the method

http://stackoverflow.com/comment/43441400
has text: hmm... and could you please tell, how can I do it?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27502856

http://stackoverflow.com/a/27599720
answers question: http://stackoverflow.com/q/27599607
type: Answer
upvote count: 6
has body: You get compilation error because numbers.remove method return you boolean value. Btw Guava wont allow you to add or remove the elements from Immutable set as the name suggests. You could do the following operation like: numbers = ImmutableSet.copyOf(Sets.difference(numbers, ImmutableSet.of(4)); its like set1-set2 and creating new numbers after removing 4. Output [2, 3, 5]
downvote count: 0
score: 6

http://stackoverflow.com/comment/43396661
comment on: http://stackoverflow.com/a/27481830
has text: This worked indeed, but the onClickListeners nwo dont work, they dont recognize "button1" and "button2"..should I add holder.button1 ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43420051
score: 0
has text: Sounds like you simply aren't viewing sysout
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27494153

http://stackoverflow.com/a/27515136
has comment: http://stackoverflow.com/comment/43485278
score: 0
has comment: http://stackoverflow.com/comment/43467743
has body: In your if condition, you are only totalling lines which have "x" at position 2 and position 3. This never happens in your sample input I think what you want is to skip scores where one or the other score is x. Therefore if (arrayStore[2].trim().indexOf("x") == -1 &amp;&amp; arrayStore[3].trim().indexOf("x") == -1) { total = Integer.parseInt(arrayStore[2] + arrayStore[3]); } You may also have further work for total.
answers question: http://stackoverflow.com/q/27510410
type: Answer
has comment: http://stackoverflow.com/comment/43467664

http://stackoverflow.com/comment/43603579
comment on: http://stackoverflow.com/a/27589830
type: AnswerComment
has text: This would call the toString(), but seems to bee really useless, because, he could directy write the line in that case.
score: 0
type: Comment

linux-mint
type: Tag
tags question: http://stackoverflow.com/q/27600224
tag name: linux-mint

http://stackoverflow.com/a/28022930
type: Answer
accepted answer of: http://stackoverflow.com/q/27506830
answers question: http://stackoverflow.com/q/27506830
score: 0
has body: Ok guys, I've figured out how to solve problem. Here is discussion about this: https://groups.google.com/forum/#!searchin/play-framework/Form$20bind/play-framework/MtjBV5YNQ3E/QumAmLbMl5sJ one of possible solution is here: https://gist.github.com/nraychaudhuri/10590943 import com.fasterxml.jackson.databind.ObjectMapper; private static Form&lt;Computer&gt; editableForm(final Computer obj) { ObjectMapper mapper = new ObjectMapper(); Form&lt;Computer&gt; form = Form.form(Computer.class); Map&lt;String,String&gt; data = mapper.convertValue(obj, Map.class); Map&lt;String, String&gt; submittedData = form.bindFromRequest().data(); data.putAll(submittedData); return form.bind(data); } and my solution is below: public T bind(T target, Map&lt;String, String&gt; newValues) { DataBinder binder = new DataBinder(target); binder.setAllowedFields(getAllowedFields()); binder.bind(new MutablePropertyValues(newValues)); return target; } =================EDIT Here is important disscussion about security issue: https://groups.google.com/forum/#!searchin/play-framework/Form$20bind/play-framework/uGrSlJMo48c/QnVjzP4ovqcJ Form.bindFromRequest without arguments. However, as probably most of you know, invoking that method without parameters will bind all fields of the corresponding model object to like-named request parameters, including fields holding internal state that must never be set from the outside (e.g. boolean isAuthenticated). That is, an attacker may set any field and circumvent security if they only know the name of the corresponding model object field. This is of course a catastrophic security vulnerability (similar to PHP's notorious and deprecated register_globals option: http://www.php.net/manual/en/security.globals.php).
type: AcceptedAnswer

http://stackoverflow.com/a/27511634
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27511111
has body: Well, the current solution I found is adding this two dependencies to build.sbt: "org.iq80.leveldb" % "leveldb" % "0.7" "org.fusesource.leveldbjni" % "leveldbjni-all" % "1.8" Nonetheless, I would be very happy to hear why such thing solves the issue and if it's well documented somewhere around the web.
downvote count: 0
type: Answer

http://stackoverflow.com/a/27522473
has body: Simply because input is 3 and the if sentence is executed only if standOrTerraceTickets == 1 || standOrTerraceTickets == 2
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27522370

web-services
type: Tag
tags question: http://stackoverflow.com/q/27591243
tags question: http://stackoverflow.com/q/27539196
tags question: http://stackoverflow.com/q/27503410
tags question: http://stackoverflow.com/q/27580666
tags question: http://stackoverflow.com/q/27502993
tags question: http://stackoverflow.com/q/27536196
tags question: http://stackoverflow.com/q/27601238
tags question: http://stackoverflow.com/q/27622705
tags question: http://stackoverflow.com/q/27516306
tags question: http://stackoverflow.com/q/27583938
tags question: http://stackoverflow.com/q/27502882
tags question: http://stackoverflow.com/q/27594439
tags question: http://stackoverflow.com/q/27636501
tags question: http://stackoverflow.com/q/27493765
tags question: http://stackoverflow.com/q/27634722
tags question: http://stackoverflow.com/q/27518510
tags question: http://stackoverflow.com/q/27484982
tags question: http://stackoverflow.com/q/27482140
tags question: http://stackoverflow.com/q/27524301
tags question: http://stackoverflow.com/q/27565451
tags question: http://stackoverflow.com/q/27478261
tags question: http://stackoverflow.com/q/27594473
tags question: http://stackoverflow.com/q/27499471
tags question: http://stackoverflow.com/q/27582621
tags question: http://stackoverflow.com/q/27580004
tags question: http://stackoverflow.com/q/27522588
tags question: http://stackoverflow.com/q/27506015
tag name: web-services
tags question: http://stackoverflow.com/q/27617543
tags question: http://stackoverflow.com/q/27486555
tags question: http://stackoverflow.com/q/27633653
tags question: http://stackoverflow.com/q/27567081
tags question: http://stackoverflow.com/q/27555378
tags question: http://stackoverflow.com/q/27491438
tags question: http://stackoverflow.com/q/27577922
tags question: http://stackoverflow.com/q/27622016
tags question: http://stackoverflow.com/q/27578134
tags question: http://stackoverflow.com/q/27525833
tags question: http://stackoverflow.com/q/27566700
tags question: http://stackoverflow.com/q/27520382
tags question: http://stackoverflow.com/q/27617792
tags question: http://stackoverflow.com/q/27531356
tags question: http://stackoverflow.com/q/27484844
tags question: http://stackoverflow.com/q/27488149
tags question: http://stackoverflow.com/q/27540443
tags question: http://stackoverflow.com/q/27563936
tags question: http://stackoverflow.com/q/27611838
tags question: http://stackoverflow.com/q/27519241

http://stackoverflow.com/a/27500437
downvote count: 0
answers question: http://stackoverflow.com/q/27497962
type: Answer
score: 1
has body: You can get this result by reflection: import java.lang.reflect.Field; public class Main { enum Fruit { APPLE } public static void main(String[] args) { try { Field field = Fruit.class.getSuperclass().getDeclaredField("ordinal"); field.setAccessible(true); field.set(Fruit.APPLE, -1); } catch (Exception e) { } System.out.println(Fruit.APPLE + ", " + Fruit.APPLE.ordinal()); } } However I doubt anyone could do this by mistake.
upvote count: 1

http://stackoverflow.com/comment/43512591
comment on: http://stackoverflow.com/q/27542333
score: 0
has text: @MihaiC yes. i knew it isn't the right way, so for that i asked this question.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27568537
upvote count: 1
type: AnsweredQuestion
tagged with: android-layout
has answer: http://stackoverflow.com/a/27568617
tagged with: java
has title: Change android drop down menu to a settings button
accepted answer: http://stackoverflow.com/a/27568617
type: Question
answer count: 2
has body: Currently in my app there is a dropdown menu containing one option Settings using this icon in the upper right corner I want to swap it out with this icon and instead of causing a drop down just calling a new view on tap. This is how i currently handle the settings menu @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(); Intent intent = new Intent(this, appSets.class); startActivity(intent); overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/27568623
has answer: http://stackoverflow.com/a/27568623
score: -1
downvote count: 2

http://stackoverflow.com/comment/43645370
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27611326
has text: So, since objects are passed by value as well, then I still don't understand why the value would be updated? (I don't get the analogy with c pointers)
score: 0

http://stackoverflow.com/comment/43608863
has text: yes ! It does. Please make sure that you are entering the date in right format . I mean for above example If I'll enter : 35-MAR-1992 then result will be : Sat Apr 04 00:00:00 PST 1992
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27580870

http://stackoverflow.com/a/28053058
type: Answer
has body: If there's a mismatch between the rJava version of java and the version used to compile the Cassandra jars, they may not actually be included in the classpath even if they're reported by .jclassPath().
score: 0
answers question: http://stackoverflow.com/q/27603306

http://stackoverflow.com/q/27576039
has answer: http://stackoverflow.com/a/27576050
type: Question
has title: What is the exact class of the ".in" static variable in the System class?
has comment: http://stackoverflow.com/comment/43577556
has comment: http://stackoverflow.com/comment/43577846
tagged with: class
tagged with: system
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27576250
has answer: http://stackoverflow.com/a/27576047
has body: The Oracle Java specification pages that are online list the " .in " static variable in the System class as being of type InputStream. However, the class InputStream is abstract. So, no instance of InputStream can exist. Therefore, the developers must have subclassed InputStream to create the ".in" instance. What is the exact type of the ".in" variable? Thanks.
tagged with: static
has comment: http://stackoverflow.com/comment/43577587
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43577668
tagged with: java
tagged with: inputstream

http://stackoverflow.com/a/27623021
answers question: http://stackoverflow.com/q/27623009
upvote count: 10
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: int is a primitive and doesn't support null value. The code you have there can be understood like this: Integer temp = hs.get(1); int value = temp.intValue(); ^null^ Since this Integer temp variable is null, when performing the auto unboxing to int you have a NullPointerException. To avoid this problem, use Integer variable, not int: Map&lt;Integer,Integer&gt; hs = new HashMap&lt;Integer,Integer&gt;(); Integer value = hs.get(1); System.out.println(value);
accepted answer of: http://stackoverflow.com/q/27623009
score: 10

http://stackoverflow.com/q/27631880
has answer: http://stackoverflow.com/a/27632002
score: 6
linked to: http://stackoverflow.com/q/5747803
answer count: 3
has comment: http://stackoverflow.com/comment/43684173
possible better answer: http://stackoverflow.com/a/27632002
has comment: http://stackoverflow.com/comment/43684330
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43684051
has comment: http://stackoverflow.com/comment/43684489
tagged with: static
has answer: http://stackoverflow.com/a/27631896
has title: Order of static initialization blocks
has comment: http://stackoverflow.com/comment/43684418
has body: I found a lot of posts on static initialization blocks, however I'm trying to get a little better picture about the execution order and the reason for it. The code below prints out the text in both the static blocks and "then" prints out the text in the main static block. I understand the way the compiler calls this is to do all the static blocks in order when the class is loaded and then access the main method. But since the main method itself is static, why not execute that in order of the other static blocks (Not even sure if its useful, just trying to understand a concept and if there's a pressing reason for it being done this way). What if there's static block we want to run after the main block? class Cat { static { System.out.println("This block welcomes you first"); } public static void main(String[] args) { System.out.println("Meow world "); } static { System.out.println("This block welcomes you after"); } } Actual Output This block welcomes you first This block welcomes you after Meow world Why not? This block welcomes you first Meow world This block welcomes you after
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27631924
tagged with: java
has comment: http://stackoverflow.com/comment/43683995
accepted answer: http://stackoverflow.com/a/27631896
type: Question

http://stackoverflow.com/a/27598202
has body: According to this 12-22 06:59:42.285: E/AndroidRuntime(1083): Caused by: java.lang.NullPointerException 12-22 06:59:42.285: E/AndroidRuntime(1083): at android.app.Activity.findViewById(Activity.java:1647) 12-22 06:59:42.285: E/AndroidRuntime(1083): at com.example.helloworld5.MainActivity.&lt;init&gt;(MainActivity.java:14) 12-22 06:59:42.285: E/AndroidRuntime(1083): at java.lang.Class.newInstanceImpl(Native Method) 12-22 06:59:42.285: E/AndroidRuntime(1083): at java.lang.Class.newInstance(Class.java:1409) You are calling findViewById in the constructor of your activity. However, by then, the layout hasnt been inflated. Move the method call to onCreate: public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_main); dest = (EditText)findViewById(R.id.y_editText2); //et cetera } EDIT: Also, you're setting String roomName = dest.getText().toString(); on a null reference now. set the onClickListener like this: openFloor.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ drawView.setRoomName(dest.getText().toString); startActivity(new Intent("com.example.helloworld5.FLOOR")); } }); EDIT2: Your second NPE is because DrawView is not initialized, initialize it as well: public void onCreate(Bundle b) { super.onCreate(b); //...your other stuff this.drawView = (DrawView) findViewById(R.id.myDrawView); }
score: 2
accepted answer of: http://stackoverflow.com/q/27598058
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27598058
type: Answer
has comment: http://stackoverflow.com/comment/43620826
upvote count: 2

http://stackoverflow.com/a/27635900
has comment: http://stackoverflow.com/comment/43808542
score: 0
type: Answer
has body: This is another object serializer. $.fn.serializeObject = function() { var o = {}; var a = this.serializeArray(); $.each(a, function() { if (o[this.name] !== undefined) { if (!o[this.name].push) { o[this.name] = [o[this.name]]; } o[this.name].push(this.value || ''); } else { o[this.name] = this.value || ''; } }); return o; };
answers question: http://stackoverflow.com/q/27630956

http://stackoverflow.com/comment/43677141
type: Comment
has text: Kamil, this was my first post and posting images is not allowed in the first few posts.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27594105

http://stackoverflow.com/comment/93915393
score: 1
has text: There is no certificate installed. This (old) code was used to dynamically load a certificate in a file embedded with the app.
comment on: http://stackoverflow.com/q/27562666
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43595321
comment on: http://stackoverflow.com/q/27585374
type: Comment
has text: Show the code where you call addItem() please
score: 0
type: QuestionComment

http://stackoverflow.com/q/27509209
type: Question
has body: In the above code, I've commented the line which should be preventing the JVM from exiting. However, when I execute this program using the command gradle run, the code doesn't do what I expect it to. What do I need to do to accomplish this? Pictured below are the results of the gradle run command:
has title: Prevent the JVM from terminating when executing gradle run
has answer: http://stackoverflow.com/a/27509378
score: 0
tagged with: vert.x
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43448885
tagged with: java
tagged with: gradle

http://stackoverflow.com/comment/43688111
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27630617
has text: Sorry but I don't understand, I change the code for every class, every "MyMain" change in the name of the class, if I copy code in class "Test" every MyMain will change in Test

timezone
tags question: http://stackoverflow.com/q/27511590
type: Tag
tag name: timezone
tags question: http://stackoverflow.com/q/27476798
tags question: http://stackoverflow.com/q/27616890

http://stackoverflow.com/comment/43413147
comment on: http://stackoverflow.com/q/27489314
type: Comment
has text: @Jean-BaptisteYunès The physics seem to work well, in other words the ball goes from one side to another in the same amount of time, weither the graphics lag or not. So, I don't think it's linked to my bad using of Thread or whatever. It goes with the same issue without JPanel or repaint, when I've tried with a blinking label text, so I assume it isn't neither linked to the repaint() properties.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27506766
type: Question
has answer: http://stackoverflow.com/a/27507645
score: 3
has title: Maven ignored maven archiver
possible better answer: http://stackoverflow.com/a/27507132
has answer: http://stackoverflow.com/a/27507132
answer count: 3
has body: I'm using maven-jar-plugin in pom.xml. org.apache.maven.plugins maven-jar-plugin 2.5 jar package jar true com.example.Manager dependency-jar/ I can see in logs that maven execute it: [INFO] [jar:jar {execution: default-jar}] [INFO] Building jar: example.jar [INFO] [jar:jar {execution: jar}] but it don't put main class to MANIFEST.MF: Manifest-Version: 1.0 Built-By: romkazanova Build-Jdk: 1.7.0_65 Created-By: Apache Maven Archiver-Version: Plexus Archiver i don't understand why. I work with Idea.
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/27507304
tagged with: maven
has comment: http://stackoverflow.com/comment/43471380
has comment: http://stackoverflow.com/comment/43444466
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27507645
downvote count: 0
tagged with: java

http://stackoverflow.com/a/27513656
has body: It should be quite simple, if you use the MVC pattern with a Java class as a controller have a look at the following example: ArrayList&lt;String&gt; columnEntries = new ArrayList&lt;String&gt;(); //populate the array list here, and then... Radiogroup radiogroup = new Radiogroup(); for(String entry: columnEntries){ radiogroup.appendItem(entry, entry); } The radiogroup.appendItem(entry, entry); adds automatically a radio button to the specified radiogroup. If you want that the radio button should contain a different value than its label, change the second parameter from entry to your desired value.
has comment: http://stackoverflow.com/comment/43466836
has comment: http://stackoverflow.com/comment/43579109
type: Answer
has comment: http://stackoverflow.com/comment/44553322
has comment: http://stackoverflow.com/comment/43465689
accepted answer of: http://stackoverflow.com/q/27497758
has comment: http://stackoverflow.com/comment/44580778
has comment: http://stackoverflow.com/comment/43471516
answers question: http://stackoverflow.com/q/27497758
upvote count: 1
has comment: http://stackoverflow.com/comment/44549738
has comment: http://stackoverflow.com/comment/43471634
has comment: http://stackoverflow.com/comment/43465814
has comment: http://stackoverflow.com/comment/44541595
score: 1
has comment: http://stackoverflow.com/comment/43545209
has comment: http://stackoverflow.com/comment/43554429
has comment: http://stackoverflow.com/comment/44552176
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43471520

http://stackoverflow.com/comment/43478813
type: Comment
comment on: http://stackoverflow.com/a/27524469
has text: Oh ... k how to use `DateFormat.setTimeZone` any sample .... i am not able to read the docs and imprint it (newbie to these concepts )
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43486734
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27526173
has text: thankyou so much for quick reply, i tried code in doPost method with some changes and it worked... also thank you for providing link of examples..that is really helpful...
score: 0

header
type: Tag
tags question: http://stackoverflow.com/q/27508828
tags question: http://stackoverflow.com/q/27507359
tag name: header

http://stackoverflow.com/comment/43663210
type: AnswerComment
has text: Great it worked but a little issue still it didn't follow the path as in the diagram i illustrated in my question. Instead of `Supervisor 1 (16) Manager 1 (6) Director Admin (2) CEO(1)` its returning `Supervisor 1 (16) Manager 3 (15) Director Finance (3) CEO(1)`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27620881

http://stackoverflow.com/comment/43683977
type: QuestionComment
comment on: http://stackoverflow.com/q/27623685
score: 0
type: Comment
has text: Yeah,it is been a little rush last night, I do something in a really unfamiliar area for me. So I ask this question here to see if I could get some useful messages and at the meantime I do more Googling..... Thank you for the tips. For a fresh hand, I still have a lot to learn.

http://stackoverflow.com/q/27532991
has title: EJB2 project migrating from JBoss4 to JBoss6. Exception: org.xml.sax.SAXParseException; Premature end of file
type: Question
tagged with: jboss
score: 0
has answer: http://stackoverflow.com/a/27540742
answer count: 1
has body: I'm trying to migrate an old EJB2 web service from JBoss AS4 to JBoss AS6. The first two or three times are fine, the jar files got deployed without any exceptions. But after a few times of restarting the JBoss6 server, I got this org.xml.sax.SAXParseException and don't have a clue what to do next. The stack trace is posted below: 12:51:59,368 INFO [DefaultEndpointRegistry] register: jboss.ws:context=statsws,endpoint=EbuildWS 12:51:59,370 ERROR [STDERR] [Fatal Error] :-1:-1: Premature end of file. 12:51:59,370 INFO [DefaultEndpointRegistry] remove: jboss.ws:context=statsws,endpoint=EbuildWS 12:51:59,371 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///localdisk/java/jboss-6.1.0.Final/server/ebuild65_primary/deploy/statsws.jar state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error during deploy: vfs:///localdisk/java/jboss-6.1.0.Final/server/ebuild65_primary/deploy/statsws.jar at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:185) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.2.GA] at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.2.GA] at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2] at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2] at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2] at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependen…
accepted answer: http://stackoverflow.com/a/27540742
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43609225
score: 0
comment on: http://stackoverflow.com/q/27592379
type: Comment
type: QuestionComment
has text: Thanks. Could you elaborate just a bit. From looking at it I am not sure how to make it compatible with the way that I am reading/using the external file.

http://stackoverflow.com/q/27539610
accepted answer: http://stackoverflow.com/a/27539967
linked to: http://stackoverflow.com/q/9016122
answer count: 4
has comment: http://stackoverflow.com/comment/43506971
favorite count: 0
tagged with: web.xml
has answer: http://stackoverflow.com/a/27539967
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3652090
score: 21
tagged with: java
possible better answer: http://stackoverflow.com/a/27539979
has answer: http://stackoverflow.com/a/27541165
type: Question
has comment: http://stackoverflow.com/comment/85297025
downvote count: 0
has answer: http://stackoverflow.com/a/27539979
linked to: http://stackoverflow.com/q/11815339
tagged with: servlets
has title: Order of loading contextConfigLocation in web.xml of Spring Servlet project
has body: Suppose that I have a Spring Java project and I am trying to configure it as a web server servlet. Here is a stripped-down version of the web.xml file: contextConfigLocation /WEB-INF/spring/generalApplicationContext.xml my-servlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/specificApplicationContext.xml 1 my-servlet /foo/* The key thing to note here is that I have specified two XML files to be loaded. One is general for my entire application, while the other is specific to the "my-servlet" servlet. For a setup with just one servlet-mapping, this wouldn't make sense. However, my project has multiple servlet-mappings and each one has specific Spring settings to them. My Question: Which contextConfigLocation is going to be loaded first by Spring? Will it be the generalApplicationContext.xml or will it be the specificApplicationContext.xml? More importantly, does the order of loading even matter? From my debugging efforts, it seems apparent that it does because I get different errors when I move some independent Spring configuration from one file to the other. NB: Whether or not using multiple spring configurations for multiple servlet mappings is a good practice is debatable. Same goes for using XML config instead of the new Java config. But that's not what I'm trying to ask here. Let's try to focus on my main question.
has answer: http://stackoverflow.com/a/30259091
has comment: http://stackoverflow.com/comment/43507815
upvote count: 21

http://stackoverflow.com/q/27551023
answer count: 1
has body: I am doing a project on text categorization using Stanford NLP in Java. To get the API, I added the dependencies in my POM file. edu.stanford.nlp stanford-corenlp 3.5.0 edu.stanford.nlp stanford-corenlp 3.5.0 models When I do maven update/install I am getting the below error message : Failure to transfer edu.stanford.nlp:stanford-corenlp:jar:models:3.5.0 from http://repo.maven.apache.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. Original error: Could not transfer artifact edu.stanford.nlp:stanford-corenlp:jar:models:3.5.0 from/to central (http://repo.maven.apache.org/maven2): No response received after 60000. I found a similar question here - Maven dependency:get does not download Stanford NLP model files . But, I am unable to find a solution anywhere. Any help please?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/14250476
has title: Getting Stanford Core NLP through Maven
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/27575435
tagged with: java
score: 0
tagged with: stanford-nlp

http://stackoverflow.com/comment/43466637
comment on: http://stackoverflow.com/q/27495516
score: 0
type: Comment
type: QuestionComment
has text: Is the log4j2 config file location specified with the `-Dlog4j.configurationFile=path/to/config` system property? I find it strange that the path has three dots in it...

http://stackoverflow.com/q/27508925
tagged with: eclipse
tagged with: webdriver
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27509159
favorite count: 0
accepted answer: http://stackoverflow.com/a/27509159
downvote count: 4
has title: Unit Testing (e.g.Specflow) vs Selenium
upvote count: 0
score: -4
tagged with: selenium
tagged with: unit-testing
type: AnsweredQuestion
has body: I'm currently learning about how to run automation tests through Selenium. Further on down the line, I'd also like to look at how Unit Testing works (through Specflow, Cucumber etc). My question is......in an ideal world, would both unit testing and GUI testing through Selenium be required? Or if I have unit tests build, for example, through Visual Studio, does this mean I no longer need to build any test scripts in Selenium? Hopefully someone can help my understanding of this.
tagged with: java

http://stackoverflow.com/q/27611638
has answer: http://stackoverflow.com/a/30489064
linked to: http://stackoverflow.com/q/26566954
tagged with: android
tagged with: gridlayoutmanager
has title: How to make a square to view a gallery?
type: UnansweredQuestion
has body: im using this metod LINK for generated a recyclerview with GridLayoutManager to autospan columns but i fail to make a square dummy layout for holderview, My intention is to imitate a gallery using recyclerview, <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="100dp" android:background="@color/white" android:orientation="vertical" android:padding="1dp"> <ImageView android:id="@+id/txt" android:layout_width="match_parent" android:layout_height="100dp" android:adjustViewBounds="true" android:scaleType="centerCrop"/> <TextView android:id="@+id/card_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:ellipsize="end" android:singleLine="true" android:text="folder" android:textSize="12dp" android:textStyle="bold"/>
upvote count: 1
linked to: http://stackoverflow.com/q/26666143
tagged with: android-recyclerview
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/27576050
has body: You can check it like this System.out.println(System.in.getClass()); Which will print java.io.BufferedInputStream
score: 1
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27576039

http://stackoverflow.com/q/27575566
score: 0
has title: Error: Could not find or load main class when JAVA_OPTS in setenv.sh
answer count: 2
has comment: http://stackoverflow.com/comment/43577208
tagged with: tomcat
has answer: http://stackoverflow.com/a/27580991
type: UnansweredQuestion
tagged with: java
has body: I get this error whenever I do anything even this simple with JAVA_OPTS in Tomcat's setenv.sh Error: Could not find or load main class #!/bin/sh export JAVA_OPTS="$JAVA_OPTS -Xmx1024m " Causes that error. Ideas?
type: Question
has comment: http://stackoverflow.com/comment/130051787
has answer: http://stackoverflow.com/a/27579386

http://stackoverflow.com/a/28343196
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27600342
type: Answer
has body: StringWriter writer = new StringWriter(); e.printStackTrace( new PrintWriter(writer,true )); System.out.println("exeption stack is :\n"+writer.toString()); Try this.
accepted answer of: http://stackoverflow.com/q/27600342
score: 2
upvote count: 2

http://stackoverflow.com/comment/43465295
comment on: http://stackoverflow.com/q/27517576
score: 0
has text: @fge Client is not expecting the generated JSON. Thanks
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27534794
answers question: http://stackoverflow.com/q/27534472
type: Answer
score: 0
has body: Consider using a more dynamic structure than a primitive array. I like ArrayLists: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html Reorganize your long code into while or for loops. An example: ArrayList&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;(); Scanner b = new Scanner(System.in); Integer c = null; while (a.size() != 10) { System.out.println("Please input a number in the range 1-19 :&gt; "); c = b.nextInt(); while (c &lt; 1 || c &gt; 19) { System.out.println("Not in the range 1-19, please try again :&gt; "); c = b.nextInt(); } a.add(c); } System.out.println("\nArray contents"); for (int i=0; i&lt;10; i++) { System.out.print((a.get(i) &lt; 10 ? " " : "") + a.get(i) + " "); } (And so on...)

http://stackoverflow.com/comment/43723969
score: 0
type: AnswerComment
has text: This usually occurs for eclipse IDE. Is it eclipse classic or something? You can change eclipse.
type: Comment
comment on: http://stackoverflow.com/a/27636515

http://stackoverflow.com/q/27550433
score: 0
tagged with: java
type: Question
tagged with: buttongroup
accepted answer: http://stackoverflow.com/a/27550591
answer count: 2
has body: I've got the following for loop creating JRadioButtons for the ButtonGroup btgrpDiff for each of the values in my Difficulty enum: private enum Difficulty { EASY("Easy"), MEDIUM("Medium"), HARD("Hard"), EXTRA_HARD("Extra Hard"); public final String name; private Difficulty(String name) { this.name = name; } } for (Difficulty diff : Difficulty.values()) { JRadioButton radDiff = new JRadioButton(diff.name); radDiff.setActionCommand(diff.name); btgrpDiff.add(radDiff); panDiff.add(radDiff, "align 50%, shrink 2, wrap"); } How can I setSelected for the ButtonGroup btgrpDiff outside of the for loop? I'd like to either set it straight after they're all selected or have a boolean parameter for each difficulty level in my enum to determine whether or not they get set as selected in the for loop, but I'm not sure which would be best, or how exactly to get the ButtonModel for the JRadioButtons.
has title: How can I setSelected for a ButtonGroup where all its JRadioButtons were created in a loop?
has answer: http://stackoverflow.com/a/27550591
possible better answer: http://stackoverflow.com/a/27554136
tagged with: jradiobutton
tagged with: swing
has answer: http://stackoverflow.com/a/27554136
has comment: http://stackoverflow.com/comment/43527149
type: AnsweredQuestion
tagged with: enums

http://stackoverflow.com/q/27494298
has answer: http://stackoverflow.com/a/27494407
type: Question
has comment: http://stackoverflow.com/comment/43420907
answer count: 2
has title: Empty array when calling function(java)
downvote count: 0
has comment: http://stackoverflow.com/comment/43420469
has answer: http://stackoverflow.com/a/27494423
has comment: http://stackoverflow.com/comment/43420311
tagged with: class
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43420502
has comment: http://stackoverflow.com/comment/43421803
has comment: http://stackoverflow.com/comment/43420484
has comment: http://stackoverflow.com/comment/43420368
favorite count: 0
type: UnansweredQuestion
has body: so I have this code that input stuff and store it to an listarray public class manage extends admin{ public ArrayList&lt;Game&gt; thegame = new ArrayList&lt;Game&gt;(); public List&lt;Game&gt; ajout_jeux() { boolean loop = true; while(loop) { Scanner agame = new Scanner(System.in); System.out.print("name: \n"); String Cgame = agame.nextLine(); Scanner qty = new Scanner(System.in); System.out.print("the qty: \n"); int CQty = qty.nextInt(); Console wertgame = new Console(Cgame,Cqty); thegame.add(new Game(Cgame,Cqty)); System.out.println("continue?"); Scanner autre = new Scanner(System.in); int continu = other.nextInt(); if(continu==1) { } else if(continu==2) { Main.menu(); } } return thegame; } and a method in this class that should print the array: public void information(List&lt;Game&gt; thegame) { System.out.print(thegame); }} And then,from another class I need to call it like this manage management = new manage(); //the instance manage.information(); Theres no erros,however,even if I take care of creating an object and putting it in array before trying to print the array, when I call manage.information(); it just return an empty [] list.I dont know why? heres the class that needs to calls it public class themenu{ public static void adminmenu(){ boolean loop=true; while(loop){ System.out.print("1:List items \n"); System.out.print("4:Add \n"); System.out.print("6:Infos \n"); System.out.print("7:Quit \n"); System.out.print("Choice:"); Scanner choiceuser = new Scanner(System.in); String userchoix = choiceuser.nextLine(); manage management = new manage(); if(userchoice.equals("1")){ manage.information(thegame); //here I get the error } else if(userchoice.equals("4")){ manage.ajout_jeux(); } thank you
tagged with: object
score: 1
tagged with: java
upvote count: 1
tagged with: methods

http://stackoverflow.com/a/27630494
has comment: http://stackoverflow.com/comment/43681537
type: Answer
has comment: http://stackoverflow.com/comment/43681521
answers question: http://stackoverflow.com/q/27630442
score: 0
has comment: http://stackoverflow.com/comment/43681640
has body: == does not call .equals. In fact, the two are completely different, overlapping only in objects that have not overriden Object's default (bad) implementation. == just checks to see if the too objects are equivalent pointers. .equals runs a method like the one you showed. Replacing == with .equals should solve your problem
has comment: http://stackoverflow.com/comment/43681666

http://stackoverflow.com/q/27560513
tagged with: printing
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18657427
tagged with: sockets
tagged with: android
has body: When i connect to Bluetooth device using mBTSocket.connect(); error message shown as 12-19 11:29:05.328: E/Class(6762): java.io.IOException: read failed, socket might closed or timeout, read ret: -1 12-19 11:29:05.328: E/Class(6762): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:505) 12-19 11:29:05.328: E/Class(6762): at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:516) 12-19 11:29:05.328: E/Class(6762): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:320) 12-19 11:29:05.328: E/Class(6762): at com.airtimeonline.Sales$12.run(Sales.java:1219) 12-19 11:29:05.328: E/Class(6762): at java.lang.Thread.run(Thread.java:841) My Code is public void printing() { try { BILL =""; Calendar c = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); String currentdate = df.format(c.getTime()); if(reprintchkbx.isChecked()) { BILL = BILL + " E RECHARGE"+ " " +currentdate; BILL = BILL + "\n "; BILL = BILL + "\n--------------------------------"; BILL = BILL + "\nNetWork :" + " " + networkprint; BILL = BILL + "\nDenomination :" + " " + denominationprint; BILL = BILL + "\nPin No :" + " " + pinnoprint; BILL = BILL + "\nSerial No :" + " " + serialnoprint; BILL = BILL + "\n--------------------------------"; BILL = BILL + "\n "; BILL = BILL + "\n www.prepaidzone.co.za"; BILL = BILL + "\n \n\n\n"; } else if(reprintchkbxall.isChecked()) { for(int i=0; i&lt; Networkprintout.length; i++) { BILL = BILL + " E RECHARGE"+ " " +currentdate; BILL = BILL + "\n "; BILL = BILL + "\n--------------------------------"; BILL = BILL + "\nNetWork :" + " " + Networkprintout[i]; BILL = BILL + "\nDenomination :" + " " + Denominationprintout[i]; BILL = BILL + "\nPin No :" + " " + Pinnoprintout[i]; BILL = BILL + "\nSerial No :" + " " + serialnoprintout[i]; BILL = BILL + "\n--------------------------------"; BILL = BILL + "\n "; BILL = BILL + "\n www.prepaidzone.co.za"; BILL = BILL + "\n \n\n\n"; } } else { for(int i=0; i&lt; …
has title: How to connect Buletooth socket to print data in bluetooth printer
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27569312
tagged with: bluetooth

http://stackoverflow.com/q/27524959
tagged with: class
score: 0
has body: Can anybody explain to me why this doesn't work and how I go about setting this class up to run with a specified parameter? (the intial balance) I wanted to run this class from my main program with a specific parameter passed as the initial balance. Do I need to setup start balance as a class variable? public class LoanAccount { static float interestRate = 0.006F; private float balance; public LoanAccount(float StartBalance) { balance = StartBalance; } public float getBalance(){ return balance; } public void addInterest(){ float interest = balance * interestRate; balance = balance + interest; } public void makePayment(float LPaid){ balance = balance - LPaid; } public static void main(){ LoanAccount BankLoan = new LoanAccount(StartBalance); } }
has comment: http://stackoverflow.com/comment/43478797
has answer: http://stackoverflow.com/a/27525040
has title: Setting up a class with a specific parameter
has answer: http://stackoverflow.com/a/27524994
answer count: 4
accepted answer: http://stackoverflow.com/a/27524994
tagged with: parameters
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27525049
has answer: http://stackoverflow.com/a/27525138
type: Question
possible better answer: http://stackoverflow.com/a/27525040

http://stackoverflow.com/comment/43550958
has text: @Rahulray yes, it's the default Maven central repository. Something really must be blocking it in your network.
comment on: http://stackoverflow.com/q/27546473
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43529646
score: 0
type: AnswerComment
type: Comment
has text: Yes, I've tried but it still exists. And the login with 'http://username:password@example.com/'stoped working
comment on: http://stackoverflow.com/a/27551662

http://stackoverflow.com/comment/43558563
comment on: http://stackoverflow.com/a/27566357
type: Comment
has text: Webcontent/web-Inf/libs/encore.jar and then add them in the nsf build path. Encore might have other dependencies
score: 0
type: AnswerComment

http://stackoverflow.com/q/27610066
has title: My CSS doesn't show if i put my CSS folder inside the WEB-INF folder
tagged with: http://stackoverflow.com/tag/html
tagged with: spring
tagged with: css
accepted answer: http://stackoverflow.com/a/27610809
has comment: http://stackoverflow.com/comment/43642501
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27610106
possible better answer: http://stackoverflow.com/a/27610106
has body: I'm working in a Spring MVC project and I have the following problem: This is my folders hierarchy --src --main --webapp --WEB-INF --views --css --mystyle.css ---myview.html and this is how I call mystyle.css in myview.html href="css/mystyle.css" but my CSS doesn't show up. But if I put my views folder outside of WEB_INF, my CSS does show up and it works like this: --src --main --webapp --views --css --mystyle.css --myview.html --WEB-INF And I call my CSS the same way like before href="css/mystyle.css" Is there something different that I didn't notice? Why doesn't my CSS works outside of the WEB-INF folder and it does not work inside?
has answer: http://stackoverflow.com/a/27610809
answer count: 2
linked to: http://stackoverflow.com/q/26463168
favorite count: 0

http://stackoverflow.com/a/27622612
has comment: http://stackoverflow.com/comment/43666264
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27622582
has comment: http://stackoverflow.com/comment/43666309
has body: program must be running on the main thread without thread Well that's the problem. You're performing an expensive operation (getFromLocation) on the UI thread. Don't do that, basically. You're stopping the UI from being updated because the UI thread is busy calling getFromLocation. You should use another thread for this operation - marshalling back to the UI thread where appropriate to update the UI.
score: 2
answers question: http://stackoverflow.com/q/27622582
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/39673751
upvote count: 2
has body: First I tried @beerbajay 's way , but it not helps。 Finally I resolve it by below way RestTemplate template = new RestTemplate(); // template.getMessageConverters() // .add(0, new StringHttpMessageConverter(Charset.forName("UTF-8"))); HttpHeaders headers = new HttpHeaders(); headers.setAccept(newArrayList(MediaType.APPLICATION_JSON)); ResponseEntity&lt;String&gt; response = template.exchange(url, HttpMethod.GET, new HttpEntity&lt;String&gt;(headers), String.class);
downvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27603782

http://stackoverflow.com/comment/43684330
type: QuestionComment
has text: @aparna - Right. But keep in mind that the *static initializers* are executed in order i.e, as and how they appear.
comment on: http://stackoverflow.com/q/27631880
score: 0
type: Comment

http://stackoverflow.com/q/27479140
answer count: 5
type: UnansweredQuestion
tagged with: datetime
linked to: http://stackoverflow.com/q/2201925
has comment: http://stackoverflow.com/comment/43391701
has comment: http://stackoverflow.com/comment/43391668
has answer: http://stackoverflow.com/a/27479213
downvote count: 6
has title: simpledateformat getting parsing exceptiong using java
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/43391672
upvote count: 1
has comment: http://stackoverflow.com/comment/43391693
type: Question
has body: My input is 2014-12-12T10:39:40Z. I want output like 12//11/2014 8:58:15 AM. here i am using SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy'T' HH:mm:ss 'a'"); But i am geting parsing exception. let me know how to write simpledateformat. Advance Thanks Srinivas B
has comment: http://stackoverflow.com/comment/43391725
tagged with: simpledateformat
tagged with: date
has answer: http://stackoverflow.com/a/27479233
has answer: http://stackoverflow.com/a/27479166
has answer: http://stackoverflow.com/a/27479227
favorite count: 0
has comment: http://stackoverflow.com/comment/43391686
has answer: http://stackoverflow.com/a/27479252

http://stackoverflow.com/comment/43458714
type: QuestionComment
has text: Also, here is a [relevant discussion talking about introducing `Pair` into Java](https://groups.google.com/forum/#!topic/comp.lang.java.help/-LY_xkXBtIc)
score: 0
comment on: http://stackoverflow.com/q/27513970
type: Comment

http://stackoverflow.com/comment/43715683
type: Comment
has text: As far as I know `setGridLinesVisible(true)`is supposed to be used for developing purposes only, therefore I wouldn't use it to do anything with it, like `snapshot()`. I think this is a rendering problem by JavaFX, I'm not too sure about it though, thus only a comment.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27612113

http://stackoverflow.com/a/27559992
answers question: http://stackoverflow.com/q/27559960
score: 17
has comment: http://stackoverflow.com/comment/43546150
type: AcceptedAnswer
upvote count: 17
has comment: http://stackoverflow.com/comment/140113532
type: Answer
accepted answer of: http://stackoverflow.com/q/27559960
has body: As Brian Goetz (project lead for Java lambdas) says, "Lambda expressions have no intrinsic type" (which applies to method references too). This is why you need to cast (or assign) to type Function before its methods become available. The reason Eclipse shows different error messages from the JDK compiler (javac) is that Eclipse uses its own Java compiler, called ecj, which is a totally different program from javac. This is, BTW, why Eclipse can run on the JRE, without needing a full JDK install.
downvote count: 0

http://stackoverflow.com/a/27583396
upvote count: 1
type: Answer
has body: You have 2 options Change private to protected in order to allow the sub classes to have direct access to parent fields but yet preventing other classes to have direct access. private String salary; private int deptID; to protected String salary; protected int deptID; Or You can create getter/setter (with proper access modifier) in parent class and invoke them from child class E.g. super.getFoo()
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27583354

http://stackoverflow.com/comment/43498378
has text: @Kerooker To write a List of a custom classes, you need to make PlayerKills class implement ConfigurationSerializable interface. For more information, read this: http://wiki.bukkit.org/Configuration_API_Reference#Serializing_and_Deserializing_Objects
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27519167

http://stackoverflow.com/q/27544613
has title: Datepicker divider color change according to application theme
tagged with: java
has comment: http://stackoverflow.com/comment/43519350
has comment: http://stackoverflow.com/comment/43517164
has comment: http://stackoverflow.com/comment/43517482
has comment: http://stackoverflow.com/comment/43518135
tagged with: customization
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/43545332
tagged with: android
tagged with: datepicker
linked to: http://stackoverflow.com/q/20148671
has comment: http://stackoverflow.com/comment/43516682
has comment: http://stackoverflow.com/comment/43517274
has comment: http://stackoverflow.com/comment/43516847
has comment: http://stackoverflow.com/comment/43545308
answer count: 0
type: UnansweredQuestion
has body: I know this question has already been asked and even answered, but I was unable to figure out much from the solution provided. I was trying to follow this tutorial but I could not figure out exactly what I need to do. I have already downloaded the Android-DatePicker library and changed the image in the drawable folder, but after that I could not perform the steps required. I have this sample activity: import java.util.Calendar; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.View; import android.widget.Button; import net.simonvt.datepicker.DatePickerDialog; import net.simonvt.datepicker.DatePickerDialog.OnDateSetListener; import net.simonvt.datepicker.DatePicker; public class SettingsActivity extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings_portrait); Button pickDate = (Button) findViewById(R.id.button1); pickDate.setOnClickListener(new View.OnClickListener() { public void onClick(View v){ Calendar c = Calendar.getInstance(); int mYear = c.get(Calendar.YEAR); int mMonth = c.get(Calendar.MONTH); int mDay = c.get(Calendar.DAY_OF_MONTH); System.out.println("the selected " + mDay); DatePickerDialog dialog = new DatePickerDialog(SettingsActivity.this, new mDateSetListener(), mYear, mMonth, mDay); dialog.show(); } }); }; class mDateSetListener implements DatePickerDialog.OnDateSetListener { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub // getCalender(); int mYear = year; int mMonth = monthOfYear; int mDay = dayOfMonth; // v.setText(new StringBuilder() // // Month is 0 based so add 1 // .append(mMonth + 1).append("/").append(mDay).append("/") // .append(mYear).append(" ")); // System.out.println(v.getText().toString()); } } } What I want to do is that, I want the datepicker to open up when the user clicks on the pickDate button. Plea…
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43518275
type: Question

http://stackoverflow.com/q/27484982
has body: i need to create a project which read/consume a jersey impl service and get i/o methods specs, like this example: on the request with jersey api through this uri https://portal.com/security/rest/users?fullname=name%20surname uri response: [{"username":"username","fullname":"name surname"}] i have to know which in the other side is like that: @GET @Path("/users") @Produces({ MediaType.APPLICATION_JSON }) public User getUsers(@QueryParam("fullname") fullname) { return null; } And have to write a XML or JSON approximately: <parameters type="QueryParam" name="fullname"/> username name surname PS: the response of my api may be in json also What method u have for me? Read WADL ? Swagger or other api can do that for me? (Describe a rest webservice in runtime getting a description of all methods)
score: 0
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/27509568
type: UnansweredQuestion
tagged with: java
tagged with: swagger
has title: Consume Jersey WebService I/O
has comment: http://stackoverflow.com/comment/43440956
tagged with: web-services
type: Question
tagged with: jersey

http://stackoverflow.com/comment/43480768
type: QuestionComment
comment on: http://stackoverflow.com/q/27525369
score: 0
has text: Thank you very much @MihaiC , I am reading that article but question is that `isEmpty()` function call internally `size()` function so how can possible that difference in performance?
type: Comment

http://stackoverflow.com/a/27503912
type: Answer
has body: When you try to parse a string that is enclosed in redundant double quotes, like this: JSON.parse('"[{"author": "Pete Hunt", "text": "This is one comment"}]"'); instead of: JSON.parse(' [{"author": "Pete Hunt", "text": "This is one comment"}] '); then you get SyntaxError: Unexpected token a because it tries to parse "[{" as a string and doesn't expect to get a character a next. You have to show the exact command that prints the JSON string but you definitely get the extra double quotes somewhere and Unexpected token a will become Unexpected token X if you change "author" to "X". What you are probably doing (though this is only my speculation because you haven't shown any actual code) is building the JSON string manually which is never a good idea. You should use a library like Google Gson or json-io to do it for you. See also: Java JSON serialization - best practice question.
score: 1
has comment: http://stackoverflow.com/comment/43442801
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27502744
answers question: http://stackoverflow.com/q/27502744
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43471455
type: Comment
has text: problem is how to convert Json Array to a stream, because String variable holds data upto certain limit.
comment on: http://stackoverflow.com/a/27520798
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43673493
has text: True. I fixed it by removing the last `,`
type: Comment
comment on: http://stackoverflow.com/a/27626329
score: 0
type: AnswerComment

http://stackoverflow.com/q/27495669
tagged with: java
tagged with: aws-java-sdk
has body: I'm trying to use the Java SDK to programmatically stop an EC2 instance. I'm very new the AWS api, but what I'm trying to do should be very basic: BasicAWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY); AmazonEC2Client ec2 = new AmazonEC2Client(credentials); //ERROR caused by this line I've seen several examples of this, for example here. I know the better way to do this is by using IAM roles, but I'm just trying to get something to work first. The line that creates the AmazonEC2 throws this error java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper at com.amazonaws.util.json.Jackson. I can't figure out why it's throwing a class definition not found error.
answer count: 1
tagged with: amazon-ec2
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/43424041
has title: Access EC2 Instance using Basic Credentials
score: 0
has comment: http://stackoverflow.com/comment/43424502
has comment: http://stackoverflow.com/comment/43424346
has comment: http://stackoverflow.com/comment/43424909
has answer: http://stackoverflow.com/a/27515455
has comment: http://stackoverflow.com/comment/43425142
has comment: http://stackoverflow.com/comment/43424433
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43424364
has comment: http://stackoverflow.com/comment/43424389
type: Question

http://stackoverflow.com/q/27619497
score: 0
has comment: http://stackoverflow.com/comment/43660481
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/43660381
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: rendering
tagged with: java
has answer: http://stackoverflow.com/a/27619962
has body: public void renderPanels(){ for(int i = 1; i&lt;4; i++){ for(int j = 1; j&lt;4; j++){ panels[i][j] = new JPanel(); frame.add(panels[i][j]); buttons[i][j] = new JButton(); panels[i][j].add(buttons[i][j]); panels[i][j].setBounds(i*50, j*50, 50, 50); panels[i][j].setLayout(null); buttons[i][j].setBounds(0, 0, 50, 50); System.out.println(panels[i][j].getBounds()); } } } Ok so this is my code to render a 3x3 grid of panels with buttons inside them. the frame variable contains a JFrame object but sadly my output is like in the following screenshot: the frame in the last iteration seems to be rendered at a location as if i and j are 1 unit below the initial values. Any Ideas?
tagged with: loops
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/43660514
type: Question
has answer: http://stackoverflow.com/a/27619911
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/43659964
tagged with: jpanel
has comment: http://stackoverflow.com/comment/43660010
has comment: http://stackoverflow.com/comment/43659994
has title: Swing not rendering my JPanels properly

http://stackoverflow.com/q/27602499
has answer: http://stackoverflow.com/a/27603609
score: 3
tagged with: timeout
has title: elasticsearch create TransportConnection timeout
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27603609
tagged with: elasticsearch
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/63409916
has answer: http://stackoverflow.com/a/63409916
upvote count: 3
tagged with: java
has body: I am creating a Elasticsearch Connection with Java API. I am using TransportConnection and I need to set the timeout for the connection. I haven't configured any property and the connect takes three minutes to give me a timeout. Anybody know if any property exists to set the value of timeout? Thaks.
type: Question

http://stackoverflow.com/comment/43496879
type: Comment
type: QuestionComment
has text: Your error happens inside FragmentAsig, inside onCreateView. Make sure your cursor is not null and it has elements as @vembutech described above.
comment on: http://stackoverflow.com/q/27534003
score: 2

http://stackoverflow.com/comment/43638608
score: 0
has text: I also deleted the folders under .m2 and tried building and deploying, still the same error.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27607961

http://stackoverflow.com/comment/43636934
score: 0
has text: What should the output be?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27607421

http://stackoverflow.com/comment/43658995
type: Comment
score: 1
type: AnswerComment
has text: This is a solid answer, avoids unnecessarily checking all files like the other answers, and probably the way to go.
comment on: http://stackoverflow.com/a/27618961

http://stackoverflow.com/comment/43530340
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27549984
has text: You said -> Create jable objects in for loop and add in Jpanel components. ., what do u mean by jable ,(may be u mean jtable) , how i should write for loop
score: 0

javafx-2
tags question: http://stackoverflow.com/q/27587572
tags question: http://stackoverflow.com/q/27585867
type: Tag
tags question: http://stackoverflow.com/q/27633022
tags question: http://stackoverflow.com/q/27535087
tag name: javafx-2

jackson
tags question: http://stackoverflow.com/q/27494461
tags question: http://stackoverflow.com/q/27509937
tags question: http://stackoverflow.com/q/27620058
tags question: http://stackoverflow.com/q/27543072
tags question: http://stackoverflow.com/q/27550376
tags question: http://stackoverflow.com/q/27534426
type: Tag
tags question: http://stackoverflow.com/q/27571380
tags question: http://stackoverflow.com/q/27627799
tags question: http://stackoverflow.com/q/27574192
tags question: http://stackoverflow.com/q/27629216
tags question: http://stackoverflow.com/q/27630956
tags question: http://stackoverflow.com/q/27558929
tags question: http://stackoverflow.com/q/27495841
tags question: http://stackoverflow.com/q/27639844
tags question: http://stackoverflow.com/q/27506241
tags question: http://stackoverflow.com/q/27522969
tags question: http://stackoverflow.com/q/27517576
tag name: jackson
tags question: http://stackoverflow.com/q/27487159
tags question: http://stackoverflow.com/q/27503174
tags question: http://stackoverflow.com/q/27505374
tags question: http://stackoverflow.com/q/27566066
tags question: http://stackoverflow.com/q/27481592
tags question: http://stackoverflow.com/q/27574528
tags question: http://stackoverflow.com/q/27529616
tags question: http://stackoverflow.com/q/27608341
tags question: http://stackoverflow.com/q/27532206
tags question: http://stackoverflow.com/q/27494911
tags question: http://stackoverflow.com/q/27561735
tags question: http://stackoverflow.com/q/27595981
tags question: http://stackoverflow.com/q/27551766
tags question: http://stackoverflow.com/q/27482835
tags question: http://stackoverflow.com/q/27536551
tags question: http://stackoverflow.com/q/27523186
tags question: http://stackoverflow.com/q/27577701
tags question: http://stackoverflow.com/q/27511738

http://stackoverflow.com/a/27487458
answers question: http://stackoverflow.com/q/27487385
has body: You could use the System.exit(); to exit the application. Also, you should set a default close operation on your Jframe. Something like worldFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
type: Answer
score: 0

http://stackoverflow.com/a/27625407
has body: ArrayList gives us many function which are not possible on simple arrays , we have to write big methods to things which we can do in one step in Arraylist. So ArrayList requires more memory consumption than simple Arrays, but you can continue to use then in small programs that wont make much of a difference but when dealing with large ammout of data and performance issues, if you can go with simple arrays dont use ArrayList as Arrays are much faster.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27625161
type: Answer
upvote count: 2

http://stackoverflow.com/q/27635740
has body: I'm trying to run a test that just opens whatsapp messenger using appium. I'm getting the error: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT) Here is my code: import io.appium.java_client.AppiumDriver; import io.appium.java_client.MobileElement; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.Test; public class WhatsApp{ public static void main(String[] args) throws MalformedURLException, InterruptedException { WebDriver dr; String contact="1jyot"; File app = new File("C:\\Users\\ppantouveris\\workspace\\Downloading and Running Appium\\apk\\WhatsApp.apk"); DesiredCapabilities capabilities= new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); capabilities.setCapability("deviceName", "Vodafone Smart 4G"); capabilities.setCapability("platformVersion", "4.2.2"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("app", app.getAbsolutePath()); capabilities.setCapability("appium-version", "1.3.4.1"); capabilities.setCapability("appPackage", "com.whatsapp"); //capabilities.setCapability("appActivity", "com.whatsapp.Main"); capabilities.setCapability("appActivity", ".Main"); dr = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities) ; dr.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); } } Any ideas? Thanks!
upvote count: 1
has answer: http://stackoverflow.com/a/27669111
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27648723
has answer: http://stackoverflow.com/a/27689159
tagged with: appium
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27648723
type: Question
downvote count: 0
has title: A new session could not be created. (Original error: 'java -version' failed. Error: spawn ENOENT)
favorite count: 0
accepted answer: http://stackoverflow.com/a/27689159
answer count: 3
tagged with: android

http://stackoverflow.com/comment/43459713
has text: Since I'm used to and therefore more comfortable with Eclipse, I hope there is another solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27514145
score: 0

http://stackoverflow.com/q/27599847
favorite count: 0
has answer: http://stackoverflow.com/a/27600572
has comment: http://stackoverflow.com/comment/43638663
upvote count: 30
has answer: http://stackoverflow.com/a/27600428
has answer: http://stackoverflow.com/a/36907902
has comment: http://stackoverflow.com/comment/43622759
has title: convert comma separated string to list without intermediate container
score: 30
possible better answer: http://stackoverflow.com/a/32246254
has answer: http://stackoverflow.com/a/32246254
has comment: http://stackoverflow.com/comment/43635354
has answer: http://stackoverflow.com/a/27599895
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8894258
tagged with: java
has body: I need to convert comma separated string to list of integers. For example if I have following string String numbersArray = "1, 2, 3, 5, 7, 9,"; Is there a way how to convert it at once to List&lt;Integer&gt;? Now i see only one way to do it. List&lt;String&gt; numbers = Arrays.asList(numbersArray.split(",")); And then List&lt;Integer&gt; numbersInt = new ArrayList&lt;&gt;(); for (String number : numbers) { numbersInt.add(Integer.valueOf(nubmer)); } I'm curious is there a way how to miss part with List&lt;String&gt; and at the first onset convert it to List&lt;Integer&gt;
has answer: http://stackoverflow.com/a/27600128
type: Question
has answer: http://stackoverflow.com/a/27600919
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/27391028
accepted answer: http://stackoverflow.com/a/27599895

http://stackoverflow.com/comment/43433616
type: AnswerComment
score: 0
type: Comment
has text: @Lucas Which version of PowerMock, Mockito and JUnit?
comment on: http://stackoverflow.com/a/27501605

http://stackoverflow.com/q/27554432
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27554479
accepted answer: http://stackoverflow.com/a/27555633
has comment: http://stackoverflow.com/comment/43535181
has body: To help me learn Java and programming concepts, I'm writing a bot that will solve the puzzles in the game PuzzleFreak . I've made the controller for the game a singleton, since there should be only one. However, now I have Controller.getInstance() peppered everywhere. How can I make this less verbose? Is a Singleton even the way to go here? I could wrap the controller methods in default methods so that I could just call click(x,y) in the Player implementations, but that feels wrong. Below I have the Player interface and an example implementation. Player.java: public interface Player { default void giveUp() { Controller.getInstance().click(new Rectangle(704, 545, 64, 18)); Controller.getInstance().delay(0.1); Controller.getInstance().click(new Rectangle(704, 545, 64, 18)); } default void play() { giveUp(); } } StartupPlayer.java: public class StartupPlayer implements Player { public void play(){ Controller.getInstance().click(60, 278); Controller.getInstance().delay(0.5); Controller.getInstance().type("KevinBot"); Controller.getInstance().delay(0.5); Controller.getInstance().click(400, 463); } }
answer count: 4
has title: Java: Making singleton less verbose
tagged with: singleton
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27554495
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27554483
type: Question
tagged with: interface
tagged with: design-patterns
tagged with: oop
possible better answer: http://stackoverflow.com/a/27554479
has answer: http://stackoverflow.com/a/27555633

http://stackoverflow.com/comment/43669483
score: 0
type: AnswerComment
has text: Except that the second version does compile
type: Comment
comment on: http://stackoverflow.com/a/27624504

http://stackoverflow.com/q/27548148
has comment: http://stackoverflow.com/comment/43522722
has title: define EntityManageFactory and Transactional beans in separate contex
has body: I have a context by name dao-context.xml as following: <property name="dataSource" ref="dataSource"/> </beans> and load this context as following: public class DaoFactory { private static ApplicationContext dao_ctx = new ClassPathXmlApplicationContext("dao-context.xml"); public static ApplicationContext getDaoCtx() { return dao_ctx; } } then I define Biz Layer context as following with name "biz_layer.xml": <constructor-arg index="0" value="entityManagerFactory"/> <property name="entityManagerFactory" ref="emf"/> <tx:annotation-driven transaction-manager="transactionManager" /> and BizObject define as following: @Transactional public class BizObject { @Transactional public void issueDoc() { ((DaoObject)DaoFactory.getDaoCtx().getBean("Dao_Obj")).save(new DaoEntity('Arture')); } } and in end I have a main method as following: Public class Main { public static void main(String[] args) { ApplicationContext biz_ctx = new ClassPathXmlApplicationContext("biz_layer.xml"); BizObject bizObj = (BizObject)biz_ctx.getBean("biz_obj"); bizObj.issueDoc(); } } I with test by several scenarios. When I run Main class any exception not raise but any record not committed on data base. When I debug Main class, bizObj variable is not a proxy. When I define biz_obj bean to dao_context.xml and in Main class initialize it , bizObj is proxy and @Transactional worked fine and committed into data base. When I programmatically manage Transaction all thing worked fine. My question is: What when define all of bean contain Dao layer bean and Biz layer beans in same context all thing worked fine but when separate then in separate context @Transactional annotation not worked and any exception not raise so.
has comment: http://stackoverflow.com/comment/43526256
score: 0
tagged with: applicationcontext
answer count: 0
has comment: http://stackoverflow.com/comment/43532045
type: UnansweredQuestion
tagged with: spring
tagged with: java
tagged with: spring-transactions
type: Question

http://stackoverflow.com/q/27618812
linked to: http://stackoverflow.com/q/4648341
answer count: 1
has title: Create Executable Jar for Selenium Code
downvote count: 0
tagged with: jar
score: 4
has comment: http://stackoverflow.com/comment/43659174
has comment: http://stackoverflow.com/comment/43659150
has comment: http://stackoverflow.com/comment/50766165
has comment: http://stackoverflow.com/comment/43658838
has comment: http://stackoverflow.com/comment/43658664
favorite count: 0
type: UnansweredQuestion
has body: I need to create a Executable Jar file for the Selenium Webdriver Project (TestNG) using Eclipse. After crawling various website I understand we need to create a Main Class to execute the Test Suite. I have created a Main Class with below code. package com.testcases; import java.util.ArrayList; import java.util.List; import org.testng.TestListenerAdapter; import org.testng.TestNG; import org.testng.xml.XmlClass; import org.testng.xml.XmlSuite; import org.testng.xml.XmlTest; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub TestListenerAdapter tla = new TestListenerAdapter(); TestNG testng = new TestNG(); Class[] classes = new Class[]{ Abc.class, PQR.class, XYZ.class }; testng.setTestClasses(classes); testng.addListener(tla); testng.run(); } } When, I have created a runnable Jar using Export->Java->Runnable Jar from Selenium, and after running through jar file using command prompt with below command: java -jar AbcXyz.jar Program Execution get into the Infinite loop Please help for creating such Executable Jar file. Below are some References: Testng
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/51224657
tagged with: java
has comment: http://stackoverflow.com/comment/43663991
has answer: http://stackoverflow.com/a/43892673
tagged with: eclipse
type: Question
upvote count: 4

http://stackoverflow.com/comment/43476387
score: 0
has text: Create an HttpPost request object and use the setParameter() method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27523455

http://stackoverflow.com/q/27559066
tagged with: pam
upvote count: 3
has comment: http://stackoverflow.com/comment/43557890
has title: Send byte[] in a String from Java to a C program
favorite count: 0
has answer: http://stackoverflow.com/a/27568404
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43544272
linked to: http://stackoverflow.com/q/19288713
has comment: http://stackoverflow.com/comment/43544675
score: 3
tagged with: java
has body: I need to put my Java information in a String so I use the String(byte[] arrB) constructor. Now this information is sent to the C program as a char* type. Now I need to get back original bytes since, from my understanding, they were encoded in the process of creating a Java String. How can I do that in the C program? So, on the C side I have these bytes: 7e 53 e9 94 d4 46 f5 7c 66 cf 85 34 18 5a ff 6 2d a3 89 48 d2 e4 46 b8 6b 43 ec 64 3a 67 f9 2 6d 12 ac e7 0 c4 99 52 68 76 76 77 12 2 de 7d 5b e7 4e 5 6 73 f4 fc 91 54 12 71 64 7a 25 3d They are in a char* but the reach Java as a String and the String is: 7E 53 EF BF BD EF BF BD 46 EF BF BD 7C 66 CF 85 34 18 5A EF BF BD 06 2D EF BF BD EF BF BD 48 EF BF BD EF BF BD 46 EF BF BD 6B 43 EF BF BD 64 3A 67 EF BF BD 02 6D 12 EF BF BD EF BF BD As you can see there many similarities...
type: Question
tagged with: encoding
answer count: 1
has comment: http://stackoverflow.com/comment/43544279
downvote count: 0
has comment: http://stackoverflow.com/comment/43544346
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/comment/43392050
type: QuestionComment
score: 0
has text: Why use regexes? Consider using Joda Time and its `DateTimeFormatter` instead (or the Java 8 datetime API if you have Java 8; or threetenbp)
comment on: http://stackoverflow.com/q/27479387
type: Comment

http://stackoverflow.com/a/27489846
answers question: http://stackoverflow.com/q/27489692
upvote count: 2
has body: Put initialization into onCreate method public class MainActivity extends ActionBarActivity { public static int homeGoalsCounter ; public static int homePointsCounter; public static int awayGoalsCounter; public static int awayPointsCounter; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); homeGoalsCounter = 0; homePointsCounter = 0; awayGoalsCounter = 0; awayPointsCounter = 0; } }
score: 2
has comment: http://stackoverflow.com/comment/43411265
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43411311
accepted answer of: http://stackoverflow.com/q/27489692
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43411393

http://stackoverflow.com/comment/43643177
type: Comment
type: QuestionComment
has text: @Qix Thanks. Never heard of debugger before but I did google it and i m going to learn how to use it now.
comment on: http://stackoverflow.com/q/27610274
score: 0

http://stackoverflow.com/comment/43642772
comment on: http://stackoverflow.com/q/27605736
has text: That's correct, the configuration I need for the legacy stuff is segmented, so for jar1 I need a specific configuration and for jar2 I need a different configuration, both uses Commons Configuration, Spring needs both, your answer looks like it would do the job, will test in a bit and get back your answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43667300
type: AnswerComment
comment on: http://stackoverflow.com/a/27574783
type: Comment
has text: @Dima, if you make a copy, that is iterating and adding to another collection. That's what the loop is doing except for a very simple and quick condition. Therefore, making a copy in this situation does not help.
score: 0

http://stackoverflow.com/comment/43568912
comment on: http://stackoverflow.com/q/27561765
has text: @Mailkov you mean stack one over the other? But I need the two canvases separate. I just want to copy a part of one into the other without stacking them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27484909
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: I think what you want is Address defaultColAddress = new Address(addrLine1, addrLine2, city, postcode);
score: 1
has comment: http://stackoverflow.com/comment/43402009
accepted answer of: http://stackoverflow.com/q/27484474
answers question: http://stackoverflow.com/q/27484474

http://stackoverflow.com/q/27505137
has answer: http://stackoverflow.com/a/27505284
has comment: http://stackoverflow.com/comment/43440252
downvote count: 3
upvote count: 1
type: Question
score: -2
has answer: http://stackoverflow.com/a/27505191
tagged with: java
tagged with: bluej
answer count: 3
favorite count: 0
has body: I'm trying to implement a stack with an Array List. BlueJ tells me that "size" has private access in java.util.ArrayList even though the Array List is public, when I'm compiling. int stackLength = stackStorage.size; System.out.println(+stackLength); And if I change the line to.. int stackLength = stackStorage.size(); the program compiles and I get a nullPointerExcetion when I run the function. I don't understand why this is happening because a value cannot be manually assigned because the value needs to come from the stack size. Any help appreciated, cheers.
tagged with: arraylist
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/48953798
has answer: http://stackoverflow.com/a/27506084
type: UnansweredQuestion
has title: Checking size of stack (ArrayList) in Java?

http://stackoverflow.com/q/27577812
score: 0
answer count: 1
tagged with: android-fragments
has title: Error with fragments in Android development
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27577840
type: Question
has body: I am in the early stages of developing an app that will have a single activity with 4 fragments navigated by swiping. Currently all I'm trying to do is get the activity to load/display the first fragment Splash. I have added the fragment to the activity in the main.xml as shown below. main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;fragment android:name="com.cdw.ddb.Splash" android:id="@+id/splashfrag" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/FrameLayout&gt; MainActivity.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Check that the activity is using the layout version with // the fragment_container FrameLayout if (findViewById(R.id.splashfrag) != null) { // However, if we're being restored from a previous state, // then we don't need to do anything and should return or else // we could end up with overlapping fragments. if (savedInstanceState != null) { return; } // Create a new Fragment to be placed in the activity layout Splash fragment = new Splash(); // In case this activity was started with special instructions from an // Intent, pass the Intent's extras to the fragment as arguments fragment.setArguments(getIntent().getExtras()); // Add the fragment to the 'fragment_container' FrameLayout getSupportFragmentManager() .beginTransaction() .add(R.id.splashfrag, fragment) .commit(); } } I'm getting an error: Cannot resolve method 'add(int, com.cdw.ddb.Splash)' on this line .add(R.id.splashfrag, fragment) From searching online it seems that the most common issues associated with this are not declaring "extends FragmentActivity" for the activity or using t…
accepted answer: http://stackoverflow.com/a/27577840

http://stackoverflow.com/q/27520288
has title: 'Constructor not found....' error
has body: H. I am getting an error on this piece of code and don't have a clue what to do. Can anyone tell me what the problem could be and how to resolve it. Error: No suitable constructor found for Transaction (int, String, double, double( Code underlined: Transaction transaction = new Transaction(bankAccount.getTransactions().size(), "Deposit", depositAmount, currentBalance); /* * 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 mainsample; /** * * @author Khalid */ public class TransactionProcess { public void deposit(BankAccount bankAccount, double depositAmount) { //Get the CurrentBalance double currentBalance = bankAccount.getCurrentBalance(); //First Argument : set the Id of transaction //Second Argument : set the Type of Transaction //Third Argument : set the TransactionAmount //Fourth Argument : set the Balance Before the transaction (for record purposes) Transaction transaction = new Transaction(bankAccount.getTransactions().size(), "Deposit", depositAmount, currentBalance); if (depositAmount &lt;= 0) { System.out.println("Amount to be deposited should be positive"); } else { //Set the updated or transacted balance of bankAccount. bankAccount.setCurrentBalance(currentBalance + depositAmount); //then set the MoneyAfterTransaction bankAccount.addTransaction(transaction); // adds a transaction to the bank account System.out.println(depositAmount + " has been deposited."); } } // Explanation same as above public void withdraw(BankAccount bankAccount, double withdrawAmount) { double currentBalance = bankAccount.getCurrentBalance(); Transaction transaction = new Transaction(bankAccount.getTransactions().size(), "Withdraw", withdrawAmount, currentBalance); if (withdrawAmount &lt;= 0) { System.out.println("Amount to be withdrawn should be positive"); } else { if (currentBalance &lt; withdrawAmount) { System.out.println("Insufficient balance…
answer count: 3
has answer: http://stackoverflow.com/a/27520312
score: 1
has comment: http://stackoverflow.com/comment/43470062
favorite count: 0
downvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27520312
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/27520340
type: Question
has answer: http://stackoverflow.com/a/27520340
has answer: http://stackoverflow.com/a/27520356

http://stackoverflow.com/comment/43665697
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27622582
has text: You're freezing your UI. That's why your order of execution is out of whack. Android is single-threaded by default. Have a read [here](http://developer.android.com/guide/components/processes-and-threads.html).
score: 0

http://stackoverflow.com/comment/43678130
score: 0
type: QuestionComment
has text: @aioobe Already looked at Fork/Join and it doesn't solve the problem. Map reduce framework like Hadoop is not an option due to internal project managment
type: Comment
comment on: http://stackoverflow.com/q/27628538

http://stackoverflow.com/comment/43639820
type: QuestionComment
score: 1
has text: How do you know that it doesn't run? If you are double clicking on the jar from Explorer/Finder then any console output will be swallowed by the OS. What do you expect to see?
type: Comment
comment on: http://stackoverflow.com/q/27608738

http://stackoverflow.com/comment/43609926
has text: Couldn't you simply invoke: `String newName = scanner.nextLine();` again (for a new name) and set `floor[i] = newName;`? If you do the `System.exit` call the program will terminate. If the operations are to be repeated some kind of loop is required.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27592950
type: AnswerComment

http://stackoverflow.com/comment/43678819
comment on: http://stackoverflow.com/q/27565451
score: 0
type: Comment
type: QuestionComment
has text: In your code I still can see the post

http://stackoverflow.com/q/27522264
has comment: http://stackoverflow.com/comment/43474155
has answer: http://stackoverflow.com/a/27522299
has comment: http://stackoverflow.com/comment/43473592
has title: My JAR file won't execute even if i double clicked or export as an exe file
has body: I tried to execute my program which i made with netbeans but the executable JAR file won't run. i cleaned and build the project and tried but nothing happens. does anybody know how to fix this?
has comment: http://stackoverflow.com/comment/43473628
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
score: -3
tagged with: swing
tagged with: executable
tagged with: java
downvote count: 3
type: Question
upvote count: 0
answer count: 1
tagged with: jar

build
tags question: http://stackoverflow.com/q/27634773
tags question: http://stackoverflow.com/q/27610644
tags question: http://stackoverflow.com/q/27585299
tags question: http://stackoverflow.com/q/27527288
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/27535041
tags question: http://stackoverflow.com/q/27632424
tags question: http://stackoverflow.com/q/27603173
tags question: http://stackoverflow.com/q/27530901
tags question: http://stackoverflow.com/q/27541712
tags question: http://stackoverflow.com/q/27566949
tags question: http://stackoverflow.com/q/27577449

http://stackoverflow.com/comment/43677682
comment on: http://stackoverflow.com/q/27628373
score: 0
type: Comment
type: QuestionComment
has text: anyway - pretty sure results will be same for Java itself, so it's not a question about Scala (even regardless that Scala compiles very slooow in comparison with Java)

http://stackoverflow.com/q/27549912
has title: Java argument is unrecognized
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27549994
tagged with: jvm
type: Question
has body: I'm trying to start another Java process from my jar, and I'm using a ProcessBuilder: File javaHome = new File(System.getProperty("java.home"), "bin"); List&lt;String&gt; javaList = new ArrayList&lt;String&gt;(); ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.redirectErrorStream(true); processBuilder.directory(serverDir); { javaList.add(javaHome + File.separator + "java"); javaList.add("-XX:MaxPermSize=512m"); javaList.add("-Xmx2048M"); // -Djava.library.path="natives-win-x64/" javaList.add( String.format( "-Djava.library.path=\"natives-%s-%s/\"", //Get system os, //Get system arch ) ); { String classPath = new String(); for (File library : scanLibrary(new File(serverDir, "libraries"))) { String libPath = library.getPath(); classPath += libPath + ";"; } classPath += new File(new File(serverDir, "binary"), "MainJar.jar").getPath(); javaList.add("-classpath \\\"" + classPath + "\\\" "); } javaList.add("my.other.jar.main.class"); } processBuilder.command(javaList); processBuilder.start(); Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Unrecognized option: -classpath "C:\Absoulte\Path\Library.jar;C:\Absoulte\Path2\Library2.jar;C:\Absoulte\Path3\Library3.jar"
tagged with: arguments
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/27549994

http://stackoverflow.com/comment/43668848
type: AnswerComment
has text: But that was stated in your answer so I figured the OP would be smart enough to read and change that (maybe I have too high of expectations), I was saying "really" at the scanner initialization.
type: Comment
comment on: http://stackoverflow.com/a/27623764
score: 0

http://stackoverflow.com/comment/43604539
comment on: http://stackoverflow.com/a/27590201
type: AnswerComment
type: Comment
has text: protected static volatile int counter = 0;
score: 0

http://stackoverflow.com/a/27512594
has comment: http://stackoverflow.com/comment/43455605
answers question: http://stackoverflow.com/q/27512583
type: Answer
has comment: http://stackoverflow.com/comment/43455367
score: 5
upvote count: 5
has body: You can't declare a class inside a method (unless it's an anonymous class). public class AbstractCar { public static final void main(String args[]) { abstract class Vehicle { // move this class definition outside your main method
downvote count: 0

http://stackoverflow.com/a/27608323
upvote count: 5
has body: Look at: Caused by: java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver It probably means you don't put the MySQL's driver in classpath. So, download the jar and add it. Obs: For Glassfish, like the tutorial you following, put the mysql-connector-java-*-bin.jar in the yourdomain/lib directory of your installation.
has comment: http://stackoverflow.com/comment/43638870
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27608228
answers question: http://stackoverflow.com/q/27608228
score: 5

http://stackoverflow.com/q/27617043
tagged with: swing
has answer: http://stackoverflow.com/a/27617199
has body: I have written the following code, Please check it: import javax.swing.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class Example{ public static void main(String[] args) { System.out.println("Hello StackOverflow"); System.out.println("Press any key to exit"); try{ getCh(); } catch(Exception e) { System.out.println("Error"+e); } } public static void getCh() { final JFrame frame = new JFrame(); synchronized (frame) { frame.setUndecorated(true); frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); frame.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { synchronized (frame) { frame.setVisible(false); frame.dispose(); frame.notify(); } } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } }); frame.setVisible(true); try { frame.wait(); } catch (InterruptedException e1) { } } } } It is working partially, but not working properly. I need to exit on any key press after printing Hello StackOverflow. Please guide me guys. I need a simple program. This code looks so lengthy and have heavy components such as Swing. Please help guys!!
tagged with: java
has comment: http://stackoverflow.com/comment/43655579
tagged with: keylistener
type: Question
has comment: http://stackoverflow.com/comment/43655469
answer count: 1
score: 0
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has title: press any key exit not working properly

http://stackoverflow.com/q/27581734
score: 1
tagged with: winapi
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/43588365
answer count: 1
has comment: http://stackoverflow.com/comment/43587896
has answer: http://stackoverflow.com/a/31251148
favorite count: 0
has title: Get actual time (java, c) synchronized
has comment: http://stackoverflow.com/comment/43588049
has comment: http://stackoverflow.com/comment/43587949
has body: i am working on easy game(just for fun). I have server in c and client in java. I want get actual time on server and on client, but I can not come to the same results time. On server i am using: // the system time SYSTEMTIME systemTime; GetSystemTime(&amp;systemTime); // the current file time FILETIME fileTime; SystemTimeToFileTime(&amp;systemTime, &amp;fileTime); // filetime in 100 nanosecond resolution ULONGLONG fileTimeNano100; fileTimeNano100 = (((ULONGLONG) fileTime.dwHighDateTime) &lt;&lt; 32) + fileTime.dwLowDateTime; //to milliseconds and unix windows epoche offset removed ULONGLONG posixTime = fileTimeNano100 / 10000 - 11644473600000; return posixTime; And i am getting time in format(output): 1750721123 On client i am using long lDateTime = new Date().getTime(); System.out.println("Date() - Time in milliseconds: " + lDateTime); Calendar lCDateTime = Calendar.getInstance(); System.out.println("Calender - Time in milliseconds :" + lCDateTime.getTimeInMillis()); And i am gettin format(output): Calender - Time in milliseconds :1419089968022 Date() - Time in milliseconds: 1419089968022 Why? Where is the problem? How can i get the same TIME? Both programs run on the same pc(win 8.1)
has comment: http://stackoverflow.com/comment/43587985
tagged with: synchronization
upvote count: 2
tagged with: time
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/43589151
type: Question

http://stackoverflow.com/comment/43494236
type: QuestionComment
has text: can you help me fix/reprogram it? please.. i really don't know what to do. :'( i keep on modifying and modifying my code but i still don't get it.. :'( i've been scouring the internet for solutions but no luck
score: 0
comment on: http://stackoverflow.com/q/27532691
type: Comment

http://stackoverflow.com/comment/43556354
score: 2
type: AnswerComment
has text: You're right, I didn't, thanks for clarifying, I've removed the -1
comment on: http://stackoverflow.com/a/27549948
type: Comment

http://stackoverflow.com/comment/98339850
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28742831
has text: Prabal, this error is because you´re trying to add to the messageConverters list concurrently with other threads reading from it. The correct approach would be to add this converter in the @Configuration class you use to set your RestTemplate

http://stackoverflow.com/comment/43431315
has text: Changed it, now it says: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: URI scheme is not "mailto" at "desktop.mail(uri);"
type: Comment
comment on: http://stackoverflow.com/a/27500391
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43550582
comment on: http://stackoverflow.com/q/27557810
has text: I found the reason why the code above doesn't work: [What is the difference between a.getClass() and A.class in Java?](https://stackoverflow.com/questions/10947768/what-is-the-difference-between-a-getclass-and-a-class-in-java). I guess I need to use reflection somehow?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43679501
type: AnswerComment
score: 0
has text: In addition to what @Dave said, adding a print statement for a unit test is a big no-no. This means you have to manually check if your test passed or not
type: Comment
comment on: http://stackoverflow.com/a/27490876

http://stackoverflow.com/a/27523086
has body: Let write it in the same terms long o11 = 1210738; long o12 = 67360790; long o21 = 1871676; long N = 1024908267229L The first equation is XandY = o11 / N; X = o12 / N; Y = o21 / N; so XandY / (X * Y) is (o11 / N) / (o12 / N * o21 / N) or o11 * N / (o12 * o21) Note there is no adding going on. The second equation is rather different. c1 = o11 + o21; r1 = o11 + o12; e11 = ((double) r1 * c1 / N); frac = (double) o11 / e11; so e11 = (o11 + o21) * (o11 + o12) /N; frac = (o11 * N) / (o11^2 + o11 * o12 + o21 * o11 + o21 * o12); I would expect these to be different as mathematically they are not the same. I suggest you write what you want as maths first, and then find the most efficient way of coding it.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43475606
has comment: http://stackoverflow.com/comment/43487274
accepted answer of: http://stackoverflow.com/q/27522830
score: 1
answers question: http://stackoverflow.com/q/27522830
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27541390
has comment: http://stackoverflow.com/comment/43510097
answers question: http://stackoverflow.com/q/27541254
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43510302
has comment: http://stackoverflow.com/comment/43510121
has body: You can add the date to a file name, like so: private static final String DATE_FORMAT_NOW = "yyyyMMddHHmmss"; private String now() { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); return sdf.format(cal.getTime()); } (...) String backupDBPath = sd + "/MyBudget-"+now()+".db"; To retrieve last file only get the first file when sorting files by date (new to old) or by name (because date is in name).

http://stackoverflow.com/q/27550773
tagged with: opencv
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43531337
has comment: http://stackoverflow.com/comment/43529527
tagged with: svm
has comment: http://stackoverflow.com/comment/43560312
type: Question
has title: How to combine the result of 2 svm classifiers optimaly?
downvote count: 0
has body: I am completely new to SVM I have trained 2 SVM classifiers with same data set and different features extracted from it. I am using opencv ml package in java. and i get the predict result with featureResults[i][j] = features[i][j].predict(newOutput, true); now i need to combine the results. How can i do that optimally with less error?
has comment: http://stackoverflow.com/comment/53995839
favorite count: 0
has comment: http://stackoverflow.com/comment/43530943
answer count: 0
type: UnansweredQuestion
tagged with: machine-learning
upvote count: 1

http://stackoverflow.com/comment/43590491
comment on: http://stackoverflow.com/q/27583014
has text: Do you know what a 401 error code is?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43435016
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27502393
type: QuestionComment
has text: Which line you getting null pointer exception?

http://stackoverflow.com/comment/43536285
has text: @SotiriosDelimanolis `{@resourceId}` should be present in the url as it is, meaning it will appear literally in the uri as it is.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27537766

http://stackoverflow.com/q/27592828
possible better answer: http://stackoverflow.com/a/27592891
tagged with: generics
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/27592872
accepted answer: http://stackoverflow.com/a/27592872
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/27592858
score: 5
has answer: http://stackoverflow.com/a/53250355
has answer: http://stackoverflow.com/a/27592891
favorite count: 0
has title: How can I get generics in javadoc code block displayed?
has body: I have a javadoc code block where I want to write a code sample that includes generics like this: public interface SomeInterface &lt;T&gt; { } public interface SomeInterface extends SomeOtherInterface&lt;T&gt; { } Here is my javadoc block: /** * Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype: * &lt;pre&gt; * {@code * public interface SomeInterface &lt;T&gt; { } * public interface SomeInterface extends SomeOtherInterface&lt;T&gt; { } * } * &lt;/pre&gt; * @param implType * @param parentType * @return */ public static JClassType findGenericType(JClassType implType, JClassType parentType) { ... } The javadoc output is: Get the Generic Type T of a Type (Class/Interface) or extended/inherited Subtype: public interface SomeInterface { } public interface SomeInterface extends SomeOtherInterface { } } Parameters: implType parentType Returns: The Generic is missing in the output. How can I get javadoc to display the generics correctly?
upvote count: 5

http://stackoverflow.com/comment/43467434
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27518800
has text: As an aside, if `getX()` and `setX()` should do exactly the same thing for *all* shape types then you might want to consider inheriting from an abstract class rather than creating an interface. Alternatively, if using Java 8, make them default methods (http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html)

http://stackoverflow.com/a/27603790
score: 1
answers question: http://stackoverflow.com/q/27603747
has body: its a bug with drools eclipse and java 8 https://bugzilla.redhat.com/show_bug.cgi?id=1078146
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43484646
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27527578
type: QuestionComment
has text: I would try to put a breakpoint on `TimeZone.setDefault` and run all tests. Good chance it will break and you'll have your culprit.

http://stackoverflow.com/q/27533727
accepted answer: http://stackoverflow.com/a/27533833
type: Question
tagged with: recursion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27533833
has comment: http://stackoverflow.com/comment/43496056
has comment: http://stackoverflow.com/comment/43495862
answer count: 2
has comment: http://stackoverflow.com/comment/43496136
upvote count: 1
tagged with: function
tagged with: string
possible better answer: http://stackoverflow.com/a/27533828
has title: recursive expand of strings
favorite count: 0
tagged with: expand
has answer: http://stackoverflow.com/a/27533828
has comment: http://stackoverflow.com/comment/43495890
has comment: http://stackoverflow.com/comment/124556629
type: AnsweredQuestion
downvote count: 0
has body: I want to create a method which recursively expands the input string with another string. public class StringTest { public static String addZeichenkette(String out, int i) { out += "bla"; if (i &gt; 0) { i--; addZeichenkette(out, i); } return out; } public static void main(String[] args) { String out = "Hello"; out = addZeichenkette(out, 7); System.out.println(out); } } The output should be : Helloblablablablablablabla instead it is Hellobla The main method has to be untouched (except the method calling).

http://stackoverflow.com/comment/43544171
has text: nevermind I just looked at the documentation for mathContext and it says 'precision'
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27557617

http://stackoverflow.com/q/27619566
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/43660189
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27619708
tagged with: java
has body: I was having some problem when trying to customize the share dialog of Facebook in Android. Basically what I am trying to do is get the drawable image from ImageView component then pass it as params into my share dialog. Here is the codes where I set image to my ImageView: ivEventDtl.setImageDrawable(EventDrawableImage.resizeEventDetailImage( eventModel.getEventPic(), context)); This one was done in onCreate(). the eventModel.getEventPic() was a string. Then when my facebook button on click, I am executing this: @SuppressWarnings("deprecation") public void postToWall() { Bundle params = new Bundle(); params.putString("name", txtEventDtlName.getText().toString()); params.putString("caption", "Date: " + txtEventDtlDate.getText().toString()); params.putString("link", ""); params.putString("description", txtEventDtlDesc.getText().toString()); //params.putString("picture", "http://twitpic.com/show/thumb/6hqd44"); try { params.putByteArray("picture", EventDrawableImage.extractBytes(ivEventDtl.getDrawable())); } catch (IOException e1) { e1.printStackTrace(); } facebook.dialog(getActivity(), "feed", params, new DialogListener() { public void onFacebookError(FacebookError e) { } public void onError(DialogError e) { } public void onComplete(Bundle values) { } public void onCancel() { } }); } And the method to convert drawable to byte array: public static byte[] extractBytes(Drawable image) throws IOException { Bitmap bitmap = ((BitmapDrawable) image).getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] bitmapdata = stream.toByteArray(); return bitmapdata; } It was working fine if I hardcode the picture with the URL. When I changed it to the convert drawable to byte array one, all the params in share dialog does not show. Any ideas? Thanks in advance. EDIT I modified the codes to take in the picture string and resize to larger than 200x200 then convert it into bitmap before passing it as param…
tagged with: bitmap
has title: Java convert drawable to bytearray
type: Question
possible better answer: http://stackoverflow.com/a/27624718
accepted answer: http://stackoverflow.com/a/27619708
has answer: http://stackoverflow.com/a/27624718
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/19145375
has comment: http://stackoverflow.com/comment/43660136

http://stackoverflow.com/comment/43393607
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27479986
type: QuestionComment
has text: did you tried compression using Apache?

http://stackoverflow.com/comment/92058464
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27588444
has text: doing this creates the flyway_schema_history table in each schema - basically tracking each schema in separate tables. is this right?
score: 0

http://stackoverflow.com/q/27579251
has comment: http://stackoverflow.com/comment/89460235
has body: I have the following database schema: create table country ( id integer primary key ); create table city ( id integer primary key, country_id integer references country ); and mappings: @Entity class Country { @Id private Integer id; ... } @Entity class City { @Id private Integer id; @ManyToOne private Country country; ... } Now I have countryId and cityId. I need to update table city and change it's country. I would do in SQL something like that: update city set country_id = :countryId where id = :cityId. I can update simple properties with JPQL with similar syntax. But how can I update foreign key reference in the example above? Of course I can get corresponding entities by id and update java entities, something like City city = em.find(cityId, City.class); Country country = em.find(countryId, Country.class); city.setCountry(country); but this code will issue 2 unnecessary selects. I would like to avoid that.
has answer: http://stackoverflow.com/a/27824483
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27579475
has answer: http://stackoverflow.com/a/27579475
upvote count: 5
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27824483
type: Question
has title: JPQL - update foreign key id without unnecessary selects
answer count: 2
score: 5
tagged with: jpa
downvote count: 0
tagged with: jpql
favorite count: 0

http://stackoverflow.com/q/27535087
downvote count: 0
favorite count: 0
tagged with: javafx-8
tagged with: javafx-2
has comment: http://stackoverflow.com/comment/43629381
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23458067
has title: Tab to next row in TreeTableView after last editable cell in one row
type: Question
has comment: http://stackoverflow.com/comment/43596115
has comment: http://stackoverflow.com/comment/43534994
tagged with: java
tagged with: javafx
has body: I'm working with a JavaFx TreeTableView in Java. Most of my cells are editable, but some are not. When editing a cell, pressing tab jumps to the next editable cell - as expected, but when at the end of a row, it just exits editing. Is there a way to change this behavior, so that the next row is selected with its first editable cell? Custom factories when adding a new column: /** * Create a column. The column is also added to the billing table. * * @param columnName * Name of the column. * @return Created column. */ public TreeTableColumn&lt;BillingTableRow, Double&gt; addColumn(String columnName) { TreeTableColumn&lt;BillingTableRow, Double&gt; column = new TreeTableColumn&lt;&gt;(columnName); // Bind column data column.setCellValueFactory(new Callback&lt;TreeTableColumn.CellDataFeatures&lt;BillingTableRow, Double&gt;, ObservableValue&lt;Double&gt;&gt;() { @Override public ObservableValue&lt;Double&gt; call(CellDataFeatures&lt;BillingTableRow, Double&gt; param) { return new ObservableValueBase&lt;Double&gt;() { @Override public Double getValue() { if (param.getValue().getValue().getType() == BillingTableRow.TYPE_SERVICE) { if (param.getValue().getValue().getService().getAll().containsKey(columnName)) { return param.getValue().getValue().getService().getAll().get(columnName).getTime(); } } return null; } }; } }); // Cell editing column.setCellFactory(new Callback&lt;TreeTableColumn&lt;BillingTableRow, Double&gt;, TreeTableCell&lt;BillingTableRow, Double&gt;&gt;() { @Override public TreeTableCell&lt;BillingTableRow, Double&gt; call(TreeTableColumn&lt;BillingTableRow, Double&gt; p) { return new EditableTreeTableDoubleCell() { @Override public void updateItem(Double item, boolean empty) { super.updateItem(item, empty); BillingTableRow row = getTreeTableRow().getItem(); if (!empty &amp;&amp; row != null) { // Styling if (row.getType() == BillingTableRow.TYPE_CLIENT) { setStyle("-fx-font-weight: bold;"); } else { setStyle(""); } // Update total values BillingTableRow pare…
tagged with: treetableview

http://stackoverflow.com/a/27595975
downvote count: 0
has comment: http://stackoverflow.com/comment/43615866
has body: The Oracle docs say that this is just for future use: The FileAttributes vararg enables you to specify initial file attributes that are set atomically when the link is created. However, this argument is intended for future use and is not currently implemented. (source; emphasis mine) On a Mac, permissions seem to be settable, though they don't seem to have much of an effect. I created a file readable only by root, and two symlinks to it: one world-readable, one readable only by root. I could cat the file using all three, but ls -l only listed the link target for the world-readable link when I ran it as my user: -rwxrwxrwx 1 root wheel 7 Dec 21 21:32 actual lrwxrwxrwx 1 root wheel 6 Dec 21 21:33 link_for_all -&gt; actual lrwx------ 1 root wheel 6 Dec 21 21:34 link_for_root I couldn't find any other differences in behavior, but it's something, so perhaps you'll be able to use createSymbolicLink to create such a symlink in the future.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27595842

http://stackoverflow.com/comment/43433946
type: Comment
type: QuestionComment
score: 2
has text: I cannot understand your requirement.... :(
comment on: http://stackoverflow.com/q/27501628

http://stackoverflow.com/a/27563457
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27563353
accepted answer of: http://stackoverflow.com/q/27563353
score: 2
has body: Add a word boundary to the start and make the ; at the first as optional. And also you must need to add the patterns to match () opening and closing parentheses. (.*?)\\b;?GRAYSCALE=\\(([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\)(?:;\\w*)?$ DEMO String[] inputs = { "GRAYSCALE=(120)",// -- Expected output: True "GRAYSCALE=(120);",// -- Expected output: True "GRAYSCALE=(120);abcd",// -- Expected output: True "GRAYSCALE=(120)abcd",// -- Expected output: False "abGRAYSCALE=(120)",// -- Expected output: False "abc;GRAYSCALE=(120);acx" // --&gt; Expected output: true }; Pattern p = Pattern.compile("(.*?)\\b;?GRAYSCALE=\\(([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\)(?:;\\w*)?$"); for (String input: inputs) { Matcher m = p.matcher(input); System.out.printf("%s found? %b%n", input, m.find()); } Output: GRAYSCALE=(120) found? true GRAYSCALE=(120); found? true GRAYSCALE=(120);abcd found? true GRAYSCALE=(120)abcd found? false abGRAYSCALE=(120) found? false abc;GRAYSCALE=(120);acx found? true DEMO
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43524601
type: Comment
has text: @NEPat10 wait you should change `ArrayList<FourLetterWords>` to `ArrayList<String>` I just noticed it...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27549140

http://stackoverflow.com/q/27492161
has title: Convert FloatBuffer to ByteBuffer
upvote count: 8
type: Question
tagged with: java
tagged with: nio
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/7298997
has body: ByteBuffer offers asFloatBuffer() function. However, there is no equivalent FloatBuffer.asByteBuffer() I am trying to do: float[] array = ... try( ByteChannel channel = Files.newByteChannel( path, WRITE, CREATE, TRUNCATE_EXISTING ) ) { channel.write (FloatBuffer.wrap (array) .asByteBuffer()); } Is there a way of efficiently doing this, or do I have to resort to allocating a ByteBuffer as in: ByteBuffer buffer = ByteBuffer.allocate( array.length * 4 ); buffer .asFloatBuffer() .put (array); channel.write (buffer);
has comment: http://stackoverflow.com/comment/43416212
has answer: http://stackoverflow.com/a/28076245
accepted answer: http://stackoverflow.com/a/28076245
score: 8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43416663
has comment: http://stackoverflow.com/comment/43416717
has comment: http://stackoverflow.com/comment/77473285

http://stackoverflow.com/comment/43408490
type: QuestionComment
comment on: http://stackoverflow.com/q/27487313
has text: Apparently this application also compiles said .java files? As what you post is a compile error, not a warning of any kind. A valid compile error too, given that there is a typo in there ("EMeausre").
score: 0
type: Comment

http://stackoverflow.com/comment/43699151
type: AnswerComment
has text: if you explain comparator vs comparable and why the op should use comparator I gladly vote u up. if you like you can see **parallel sort in Java 8**
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27639846

http://stackoverflow.com/comment/43494528
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27526233
has text: I made a Runnable jar file and a jar file as well, and when i run the app the messageBox don't appear?? It appears under development!! What is wrong with this?

http://stackoverflow.com/comment/43416651
comment on: http://stackoverflow.com/q/27492477
type: Comment
type: QuestionComment
score: 0
has text: you just need to multiply by the dp/px coefficient.

http://stackoverflow.com/q/27588154
favorite count: 0
tagged with: jdialog
has body: Is it possible to remove the title bar from a JDialog, but keeping the border? The base SSCCE looks like this: package test; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.SwingUtilities; public class SSCCE extends JFrame { private JDialog dialog; public SSCCE() { dialog = new JDialog(); dialog.setSize(100, 100); dialog.add(new JList&lt;&gt;(new String[] { "One", "Two", "Three" })); dialog.setUndecorated(true); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void showDialog() { dialog.setLocationRelativeTo(this); dialog.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { SSCCE ex = new SSCCE(); ex.setVisible(true); ex.showDialog(); } }); } } Running it I see this: But I don't want the title bar on the JDialog. The standard answer is to use setUndecorated(true). But then I lose the window borders as well, and I don't want that. Looks like this: What I want is something like this mockup: How do I achieve that? EDIT: I tried going with one of the LaF borders, but I'm getting some strange results. Just for testing I went with "RootPane.errorDialogBorder" and expected to get a fat red border around my dialog. But instead I got this: That looks to me like the unfocused version of the "RootPane.frameBorder" border. Why did I get that one instead?
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43600450
has answer: http://stackoverflow.com/a/27598156
tagged with: swing
has comment: http://stackoverflow.com/comment/43600476
type: Question
has comment: http://stackoverflow.com/comment/43600489
accepted answer: http://stackoverflow.com/a/27598156
type: AnsweredQuestion
has title: JDialog: Remove titlebar, keep border
tagged with: java
tagged with: border
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/43694533
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27632605
has text: if it is user certificate, then each user should have its own certificate (not shared). These certificates must be installed in Current User\Personal (CurrentUser\My).

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/27614682

http://stackoverflow.com/a/27555221
has comment: http://stackoverflow.com/comment/43536916
type: Answer
upvote count: 1
has body: You almost had it. I just tried: Sub IE_Navigate() 'Declare Dim IE As Object 'Use IE Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.navigate ("Website URL") 'Wait for Load to finish While IE.readyState &lt;&gt; 4 DoEvents Wend Application.Wait (Now + TimeValue("0:00:01")) Both of these approaches worked for me. Select data from dropmenu by ClassName: IE.document.getElementsByClassName("clsInputArea")(0).Value = 1 Or Select data from dropmenu by Name IE.document.getElementsByName("dateSelector0")(0).Value = 1 Which returned the first item from the drop down menu. EDITED
has comment: http://stackoverflow.com/comment/43537743
has comment: http://stackoverflow.com/comment/43539632
has comment: http://stackoverflow.com/comment/43540241
has comment: http://stackoverflow.com/comment/43537296
score: 1
has comment: http://stackoverflow.com/comment/43538552
has comment: http://stackoverflow.com/comment/43537617
answers question: http://stackoverflow.com/q/27554613
has comment: http://stackoverflow.com/comment/43538840
has comment: http://stackoverflow.com/comment/43538315
downvote count: 0
has comment: http://stackoverflow.com/comment/43540144

http://stackoverflow.com/a/27503687
score: 0
type: Answer
has body: You haven't assigned a value to your byte[] b, hence resulting in a NullPointerException, since you later reference it by index. Try this instead: String a="100100"; byte[] b = new byte[a.length()]; // here for (int i = 0; i &lt; a.length(); i++) { b[i]=a.charAt(i)=='1'? (byte) 1: (byte) 0; } System.out.println(Arrays.toString(b)); // easier print once finished Output [1, 0, 0, 1, 0, 0]
answers question: http://stackoverflow.com/q/27503637

http://stackoverflow.com/comment/43686332
comment on: http://stackoverflow.com/a/27632766
score: 0
has text: @eatSleepCode `book.book[50]` is a reference of type book which contains null when the array is initialized. Even if personName stays static (which is a bad idea, as mentioned in my answer), dereferencing a null reference always leads to a NullPointerException
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27483350
has body: I know very little of bytecode and compiled code. I have a method that is in a path where performance is very critical. There is an alternative way of doing the same with java's API and an apache library. But I'm concerned that involving two extra classes will render the method slower. So my question is, regarding performance, is there any advantage in using your own code? These are the method with my own code and using libraries: public final static List&lt;Long&gt; longArrayToLongList(long[] array) { if (array == null) { return null; } List&lt;Long&gt; list = new ArrayList&lt;Long&gt;(array.length); for (long value : array) { list.add(Long.valueOf(value)); } return list; } public final static List&lt;Long&gt; longArrayToLongListWithLib(long[] array) { return Arrays.asList(ArrayUtils.toObject(array)); }
has comment: http://stackoverflow.com/comment/43399356
tagged with: java
has comment: http://stackoverflow.com/comment/43399147
has comment: http://stackoverflow.com/comment/43400544
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43400870
linked to: http://stackoverflow.com/q/4970015
has answer: http://stackoverflow.com/a/27483412
score: 0
has comment: http://stackoverflow.com/comment/43399199
has comment: http://stackoverflow.com/comment/43411521
linked to: http://stackoverflow.com/q/504103
accepted answer: http://stackoverflow.com/a/27483412
favorite count: 0
has comment: http://stackoverflow.com/comment/43400203
possible better answer: http://stackoverflow.com/a/27483500
has comment: http://stackoverflow.com/comment/43399222
has comment: http://stackoverflow.com/comment/43400250
has answer: http://stackoverflow.com/a/27483500
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/43399895
has title: Is invoking a library slower than using your own code?
has comment: http://stackoverflow.com/comment/43399343
has comment: http://stackoverflow.com/comment/43403483
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/comment/43591151
type: QuestionComment
type: Comment
has text: @SotiriosDelimanolis I tried that and it didn't work for me. I have updated the question with the URL I have tried. Any other thoughts?
score: 0
comment on: http://stackoverflow.com/q/27537766

http://stackoverflow.com/comment/43576319
has text: @kuriouscoder 1.5? Haven't you found an older version? :D
type: AnswerComment
comment on: http://stackoverflow.com/a/27575369
type: Comment
score: 2

http://stackoverflow.com/q/27547445
type: Question
has body: I am using selenium webdriver. I am writing to excel file using POI API. I am getting following error: org.apache.xmlbeans.impl.values.XmlValueDisconnectedException at org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1258) at org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTXfImpl.getXfId(Unknown Source) at org.apache.poi.xssf.model.StylesTable.getStyleAt(StylesTable.java:183) at org.apache.poi.xssf.usermodel.XSSFCell.getCellStyle(XSSFCell.java:427) at org.apache.poi.xssf.usermodel.XSSFCell.getCellStyle(XSSFCell.java:63) at org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(DateUtil.java:280) at com.bcatman.util.Xls_Reader.getCellData(Xls_Reader.java:149) at com.bcatman.base.TestBase.readExcelData(TestBase.java:159) at com.bcatman.suite.CatalogImportExport.ImportSimpleExcel.testcaseImportSimpleExcel(ImportSimpleExcel.java:89) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.Invoker.invokeMethod(Invoker.java:714) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) at org.testng.SuiteRunner.run(SuiteRunner.java:240) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRun…
tagged with: selenium-webdriver
has title: Error while using POI API
has comment: http://stackoverflow.com/comment/43526295
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/43539839
score: 0
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43521239
answer count: 0
linked to: http://stackoverflow.com/q/8253653

http://stackoverflow.com/comment/43665429
comment on: http://stackoverflow.com/a/27620816
type: AnswerComment
score: 0
type: Comment
has text: Additional info: In case above, I don't now what result will be in the variable. So, I want get only 3rd word.

http://stackoverflow.com/comment/43394014
type: Comment
type: QuestionComment
has text: @dev Both options would be okay for me. If there is any option to handle this error of the QuartzInitializerListener it also would be suitable.
comment on: http://stackoverflow.com/q/27480324
score: 0

http://stackoverflow.com/a/27515443
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43461198
upvote count: 1
answers question: http://stackoverflow.com/q/27515406
has body: Move the array initialization outside the loop, inputArray = new int[Covert.length]; for (a = 0; a&lt;Covert.length; a++){ // inputArray = new int[Covert.length]; inputArray[a] = Integer.parseInt(Covert[a]); } Or you'll throw away the previous instance (with its values) on every iteration. And only have a value in the last position (as you describe in your question).

http://stackoverflow.com/a/27590711
downvote count: 0
has body: Use something like sort by id, then name then salary: public class EmployeeComparator implements Comparator&lt;Employee&gt; { public int compare(Employee e1, Employee e2) { if (e1 == e2) { return 0; } if (e1 == null &amp;&amp; e2 != null) { return -1; } if (e1 != null &amp;&amp; e2 == null) { return -1; } if (e1.getId().equals(e2.getId())) { if (e1.getName().equals(e2.getName())) { if (e1.getSalary() == e2.getSalary()) { return 0; } else { return int(e1.getSalary() - e2.getSalary()); } } else { return e1.getName().compareTo(e2.getName()); } } else { return e1.getId().compareTo(e2.getId()); } } } If you need concise version of above, you will need to either use Guava's ComparisonChain as below: @Override public int compare(Employee e1, Employee e2) { return ComparisonChain.start() .compare(e1.getId(), e2.getId(), Ordering.natural().nullsLast()) .compare(e1.getName(), e2.getName(), Ordering.natural().nullsLast()) .compare(e1.getSalary(), e2.getSalary(), Ordering.natural().nullsLast()) .result(); } or apache's CompareToBuilder as below: public int compare(Employee e1, Employee e2) { return new CompareToBuilder().append(e1.getId(), e2.getId()).append(e1.getName(), e2.getName()).append(e1.getSalary(), e2.getSalary()).toComparison(); }
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/27590669
score: 5

http://stackoverflow.com/a/27595212
answers question: http://stackoverflow.com/q/27587871
type: Answer
has body: Like you said, everytime the Java code is ran, you reinitialize the variable to 0. You can solve this by having the id variable fetched from the datastore instead of just being a Java variable. This way it will stay the updated version even after you restart the instance or boot up another one.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27587871

http://stackoverflow.com/a/27627007
type: Answer
score: 0
type: AcceptedAnswer
has body: I eventually had success using the second approach: using spring scheduling. As I was using a Configuration class for my bean definitions instead of xml namespaces or bean definitions in xml configuration files, I removed the &lt;task:annotaion-driven&gt;&lt;/task:annotaion-driven&gt; xml namespace from the web.xml file and replaced it with an annotation in my WebAppConfig class, my @Configuration class in this case. I then proceeded to move the ApiExpirationTask() method from the Service class/layer below to the its Controller class. I removed the @Transactional annotation from the code snippet and fixed some logical control flow issues. @Service public class ApiServiceImpl implements ApiService { The final method with the job tasks/steps that works and is currently declared in a Controller class is @Scheduled(fixedDelay=60000) public void ApiExpirationTask() { // Beginning of the ApiKeyExpirationJob Workflow List&lt;Api&gt; apiList = apiService.findAll(); for(Api api1 : apiList) { //logger.info(api.getApiKey()); //final SimpleDateFormat df = new SimpleDateFormat( "dd/MM/yyyy HH:mm:ss" ); final java.util.Calendar cal = GregorianCalendar.getInstance(); cal.setTime( api1.getCreatedDate() ); cal.add( GregorianCalendar.MINUTE, 1 ); // date manipulation Date dateExpectedExpiryDate = cal.getTime(); Date dateNow = new Date(); if ((dateNow.compareTo(dateExpectedExpiryDate) &gt;= 0) &amp;&amp; (api1.getIsExpired() == false)) { api1.setIsExpired(true); try { //TODO: Fix apache commons logging to work with SLF4J. Then remove the out.println statements. //logger.info("Updating API"); System.out.println("Updating API"); apiService.update(api1); //post the entity as JSON String postUrl=api1.getUrl();// put in your url Gson gson= new Gson(); HttpPost post = new HttpPost(postUrl); StringEntity postingString = new StringEntity(gson.toJson(api1));//convert your pojo to json //logger.info("API Entity in json representaton is: " + gson.toJson(api1)); System.out.println("API Entity in …
answers question: http://stackoverflow.com/q/27589086
accepted answer of: http://stackoverflow.com/q/27589086

http://stackoverflow.com/q/27603657
tagged with: xstream
has answer: http://stackoverflow.com/a/27622303
has title: Java xStream processAnnotations concurrency
answer count: 2
linked to: http://stackoverflow.com/q/11072262
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: Actually I want only one XStream instance. So I have below class: public class XSteamTool{ private static XStream xStream = new XStream(); static{ xStream.ignoreUnknownElements(); xStream.registerConverter(new DateConverter(TimeZone.getDefault())); } public static String objToXml(Object obj){ xStream.processAnnotations(obj.getClass()); return xStream.toXML(obj); } public static &lt;T&gt; T xmlToObj(String xmlString, Class&lt;T&gt; clazz){ xStream.processAnnotations(clazz); return(T)xStream.fromXML(xmlString); } } But this encounter issues in multi-thread environment. I find the note in official document:XStream is not thread-safe while it is configured. Unfortunately an annotation is defining a change in configuration that is now applied while object marshalling is processed I try to synchronized before processAnnotations and that looks fine: public static String objToXml(Object obj){ synchronized (obj.getClass()) { xStream.processAnnotations(obj.getClass()); } return xStream.toXML(obj); } public static &lt;T&gt; T xmlToObj(String xmlString, Class&lt;T&gt; clazz){ synchronized (clazz) { xStream.processAnnotations(clazz); } return(T)xStream.fromXML(xmlString); } I wonder if the use is correct. Any suggestions are appreciated.
score: 1
has answer: http://stackoverflow.com/a/27613505
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question

http://stackoverflow.com/q/27550036
tagged with: admob
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27574267
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I am fairly new to Android programming, and I have created an app with many Fragments. I've followed Google's instructions on how to set up the Google Ad Mobs. I've got this working for the very first time when you click on a particular fragment. However, if I return to that fragment, the app crashes and doesn't hit the Ad Fragment class... My Java class: public class ContactsListFragment extends BaseFragment { ArrayList&lt;Contact&gt; allContacts = new ArrayList&lt;Contact&gt;(); ... 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_ad, container, false); return rootView; } } public static class AdFragment extends Fragment { private AdView mAdView; public AdFragment() { } @Override public void onActivityCreated(Bundle bundle) { super.onActivityCreated(bundle); // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in // values/strings.xml. mAdView = (AdView) getView().findViewById(R.id.adView); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. e.g. // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device." AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); // Start loading the ad in the background. mAdView.loadAd(adRequest); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_ad, container, false); } /** Called when leaving the activity */ @Override public void onPause() { if (mAdView != null) { mAdView.pause(); } super.onPause(); } /** Called when returning to the activity */ @Override public void onResume() { super.onResume(); if (mAdView != null) { mAdView.resume(); } } /** Called before the activity is de…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43536235
tagged with: android-fragments
tagged with: java
has title: Ad Mob crashes when returning to Fragment Android

http://stackoverflow.com/comment/43665534
has text: ortis, Can I do this with Java Reflection?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27622438

http://stackoverflow.com/comment/55981788
comment on: http://stackoverflow.com/a/27532493
type: AnswerComment
score: 0
type: Comment
has text: I've tried the method #4 for XLS and it works. However, the generated file has no extension. How to set the file name as well as the extension of the generated file using method #4?

http://stackoverflow.com/comment/43393969
has text: *"If you can spot why the reset method does not dispose of the last GameBoard window"* - You do create a brand new one after it, but you could also be using `static` references...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27480107

http://stackoverflow.com/a/27601386
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43625361
has comment: http://stackoverflow.com/comment/43625274
type: Answer
has comment: http://stackoverflow.com/comment/43625238
has body: You can use this regex in replaceAll: ^ *| +(?= *\S) RegEx Demo Code: String classCssSelector = classProp.replaceAll("^ *| +(?= *\\S)", "."); Explanation: ^ - Match beginning ^ * - Match 0 or more spaces at start | - Alternation in regex | + - Match 1 more spaces after `|` (?= *\\S) - Lookahead to make sure there is at least one non-space character after matching space in previous match
accepted answer of: http://stackoverflow.com/q/27601279
downvote count: 0
answers question: http://stackoverflow.com/q/27601279
score: 1

http://stackoverflow.com/comment/43556648
has text: I removed all the spaces on the method that constructs the Query String and the result is exactly the same. =/
score: 0
comment on: http://stackoverflow.com/q/27565360
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27630501
score: 5
accepted answer of: http://stackoverflow.com/q/27630442
type: AcceptedAnswer
downvote count: 0
has body: A hash code, by definition, contains less information than the source data. This means that collisions are possible, and in that case you will have two objects with same hash code but which are not equal. The general requirement of Java hashCode() are in the opposite direction: two objects for which equals relation holds must produce same hash code (the opposite is not true) if two objects are different, they are not required to produce a different hash code at all Basically the point is that you can't use the hash code as an unique identifier (indeed JDK data structures manage collisions internally). This nothing has to do with == since it compares just references (memory addresses) of the object, for which hashCode() and equals will be trivially the same. If you take a look at your hashCode() you can see that if all fields but one are null, but which field is different, the hash code computed is the same, which clearly proves the fact that you can easily generate collision. If you want something stronger you should consider using MessageDigest which produces digests much longer than an int (so able to hold more information = less likely to have a collision). But you won't have any guarantees even with them.
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/43682202
has comment: http://stackoverflow.com/comment/43681958
answers question: http://stackoverflow.com/q/27630442

http://stackoverflow.com/q/27590080
has comment: http://stackoverflow.com/comment/43604220
score: 0
tagged with: android
has body: I am trying to open certain part of this page in a webview using Jsoup, http://www.theregister.co.uk/2014/12/20/heads_up_if_tor_goes_down_over_the_weekend_this_is_why/ The problem with the page is, the text inside &lt;pre&gt; tag is showing in a single line thus causing horizontal scroll bar. Even though I managed to disable Horizontal scrolling in webview, but this is not what I want. I want the text inside &lt;pre&gt; tag to be shown how it is originally displaying on the page, This is the text, IP address Who owns the block containing this IP? 128.31.0.39 AS3 Massachusetts Institute of Technology 86.59.21.38 AS8437 Tele2 Telecommunication GmbH 194.109.206.212 AS3265 XS4ALL Internet BV 82.94.251.203 AS3265 XS4ALL Internet BV 131.188.40.189 AS680 Verein zur Foerderung eines Deutschen Forschungsnetzes e.V. 193.23.244.244 AS50472 Chaos Computer Club e.V. 208.83.223.34 AS40475 Applied Operations, LLC 171.25.193.9 AS198093 Foreningen for digitala fri- och rattigheter 154.35.32.5 AS14987 Rethem Hosting LLC 199.254.238.52 AS16652 Riseup Networks The above text is displaying in a single line in Webview. When I see the source code of this part of the page, there is no &lt;br&gt; tags used to break lines and I guess this is why it is displaying in a single line in a Webview. How am I supposed to break it into lines in WebView when there is no &lt;br&gt; tag used for line break in original page ?
has comment: http://stackoverflow.com/comment/43604254
has answer: http://stackoverflow.com/a/27590810
type: UnansweredQuestion
tagged with: webview
has comment: http://stackoverflow.com/comment/43604269
tagged with: java
type: Question
has title: how to break lines in Webview using Jsoup if no is used to break text in original page
answer count: 1

http://stackoverflow.com/comment/43566238
has text: Anyway, if insisting on using Swing for a "fast 2D game", a simple approach is to keep requesting repaints and then in the repaint handle the motion (and the drawing to graphics) based on *delta time calculations*. This will run at the "maximum repaint speed" supported and the delta time calculations will ensure smoother / more consistent overall movement.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27569859

http://stackoverflow.com/a/27581338
type: Answer
has comment: http://stackoverflow.com/comment/43587107
has comment: http://stackoverflow.com/comment/43587492
upvote count: 1
has body: Try something like this (is an aproximation), with LineListener to detect the end of playing: import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineEvent.Type; import javax.sound.sampled.LineListener; public class Sound { private Clip c; public Sound(final String filename) { try { c = AudioSystem.getClip(); final AudioInputStream inputStream = AudioSystem.getAudioInputStream(Sound.class.getResourceAsStream(filename)); c.open(inputStream); c.addLineListener(new LineListener() { @Override public void update(final LineEvent event) { if (event.getType().equals(Type.STOP)) { System.out.println("Do something"); } } }); } catch (final Exception e) { e.printStackTrace(); } } public void play() { c.start(); } public static void main(final String[] args) throws InterruptedException { final Sound s = new Sound("/cash.wav"); s.play(); Thread.sleep(100000); final Sound p = new Sound("/cash.wav"); p.play(); Thread.sleep(10000); } }
score: 1
answers question: http://stackoverflow.com/q/27580973
downvote count: 0

http://stackoverflow.com/a/27509321
has comment: http://stackoverflow.com/comment/66547938
has comment: http://stackoverflow.com/comment/66618471
upvote count: 1
type: AcceptedAnswer
has body: Spring Batch provides java based configuration for the building of jobs via java code instead of XML. By using the provided builders, you can dynamically construct jobs as you need. I'd strongly suggest using this method instead of wiring a ChunkOrientedTasklet by hand since there is quite a bit going on in that particular Tasklet. The best place to get started with Spring Batch's java configuration is in the Spring Batch guide: http://spring.io/guides/gs/batch-processing/. It's a 15 minute walk through on getting started with Spring Batch using tools like Spring Boot and java configuration.
has comment: http://stackoverflow.com/comment/43451019
has comment: http://stackoverflow.com/comment/43451258
type: Answer
has comment: http://stackoverflow.com/comment/43449972
answers question: http://stackoverflow.com/q/27508675
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27508675
has comment: http://stackoverflow.com/comment/43450408
has comment: http://stackoverflow.com/comment/43449189
has comment: http://stackoverflow.com/comment/66547024

jts
tags question: http://stackoverflow.com/q/27623620
tags question: http://stackoverflow.com/q/27605270
type: Tag
tag name: jts

http://stackoverflow.com/q/27592407
has body: I'm coding a Spring aspect in order to intercept methods annotated with @Transactional to replicate the behavior of Liferay. So, in my aspect the code looks like: @Aspect class TransactionAspect extends TransactionSynchronizationAdapter { private final Logger logger = LoggerFactory.getLogger(TransactionAspect.class); @Pointcut("within(@org.springframework.transaction.annotation.Transactional *)") public void beanAnnotatedWithTransactional() {} @Pointcut("execution(public * *(..))") public void publicMethod() {} @Pointcut("within(foo.bar.services..*)") public void beanInsidePackage(){} @Before("publicMethod() &amp;&amp; beanAnnotatedWithTransactional() &amp;&amp; beanInsidePackage()") public void publicMethodInsideAClassMarkedWithTransactional() { if ( TransactionAspectSupport.currentTransactionStatus().isNewTransaction() ) { TransactionSynchronizationManager.registerSynchronization(this); TransactionalPortalCacheHelper.begin(); } } @Override public void afterCompletion(int status) { switch (status) { case STATUS_COMMITTED : TransactionalPortalCacheHelper.commit(); logger.info( "Commit!" ); break; case STATUS_ROLLED_BACK : TransactionalPortalCacheHelper.rollback(); logger.info( "Rollback!" ); break; case STATUS_UNKNOWN : logger.info( "Upps!" ); break; //TODO throw runtime exception? } } } Using this code, the methods are intercepted as expected. However the result of call to getCount of an entity, add one element, and counting again is not correct. This is normal if we see the code from Liferay: try { session = openSession(); BatchSessionUtil.update(session, foo, merge); foo.setNew(false); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); Here is clearing the cache after commit, but at the end, this call to clearCache arrives to: @Override public void removeAll() { if (_log.isTraceEnabled()) { _log.trace(getAbbreviatedCacheName() + " DEL ALL"); } if (TransactionalPor…
downvote count: 0
score: 1
tagged with: liferay-6
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: java
has title: What is the flow of Liferay for blocking and transactional cache?
type: Question
tagged with: liferay

http://stackoverflow.com/a/27593310
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27591991
has body: Your draw() and tick() functions are part of Bacteria.java. They cannot be used from Board.java unless you create an instance of Bacteria and then invoke the methods using that.
has comment: http://stackoverflow.com/comment/43615738
has comment: http://stackoverflow.com/comment/43610708

http://stackoverflow.com/q/27561765
has comment: http://stackoverflow.com/comment/43571103
has comment: http://stackoverflow.com/comment/43571461
upvote count: 2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43550176
score: 2
answer count: 0
downvote count: 0
has body: Have two JavaFX canvases. Is it possible to draw the contents of one into the other? One canvas is the composition of several images and shapes, and I'd like to draw a portion of such composition into the other without re-doing all the draws for the images and shapes.
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/43568912
has title: Draw on a Canvas the contents of another
type: Question
has comment: http://stackoverflow.com/comment/43580701

http://stackoverflow.com/comment/43641151
comment on: http://stackoverflow.com/q/27609348
type: Comment
has text: _Neither_ version should require the final.
type: QuestionComment
score: 7

http://stackoverflow.com/comment/43628841
type: AnswerComment
type: Comment
has text: Thats not exactly what I want because I would like to see the files. In Netbeans for example it is even possible to lock some code-blocks with GEN-BEGIN:initComponents. It's not that I don't want to see them, I just don't want to be able to edit them.
comment on: http://stackoverflow.com/a/27586293
score: 0

http://stackoverflow.com/comment/43775962
comment on: http://stackoverflow.com/a/27641686
score: 0
type: Comment
has text: You don't "set" a bitmap to it as if it were an ImageView. You grab it's Canvas object and draw the bitmap on it (like I show in the last block of code). Now, about the touch events, `MotionEvent.ACTION_UP` is usually important to tell you that the "gesture" started by `MotionEvent.ACTION_DOWN` has ended. It may or may not be important for you. Let's say, for example, you have a game in which the user has to drag pieces in a board. `MotionEvent.ACTION_UP` is the event that tells you the user just finished the dragging so it's time to place the piece in the nearest valid board position.
type: AnswerComment

http://stackoverflow.com/comment/43429571
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27499307
has text: as long as the server is running, the port will be open, until someone stops the server. you should close the sockets from both server and client with socket.close() after you are done reading or writing; but the line ServerSocket serverSocket = new ServerSocket(chatPort); will always keep that port used by the server
type: Comment

http://stackoverflow.com/comment/43521925
has text: Thanks for the tip, Saifur :-)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27546946

http://stackoverflow.com/comment/43549025
has text: I don't understand your question. If the string ends with then what is removing a comma at the end supposed to do?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27561302

http://stackoverflow.com/comment/43613273
type: Comment
type: QuestionComment
has text: And some helpful implementation can be found [here](http://stackoverflow.com/questions/20906214/permutation-algorithm-for-array-of-integers-in-java)
score: 0
comment on: http://stackoverflow.com/q/27594831

byte
tags question: http://stackoverflow.com/q/27618371
tags question: http://stackoverflow.com/q/27625139
tag name: byte
tags question: http://stackoverflow.com/q/27591676
tags question: http://stackoverflow.com/q/27519967
tags question: http://stackoverflow.com/q/27616918
tags question: http://stackoverflow.com/q/27620071
tags question: http://stackoverflow.com/q/27566031
type: Tag

http://stackoverflow.com/comment/43461325
type: QuestionComment
has text: what is the point of running the same Test classe twice in the same test suite? Remember changes made to your java class need to be compiled for the test class to consider them.
comment on: http://stackoverflow.com/q/27515368
score: 0
type: Comment

http://stackoverflow.com/comment/43399302
type: AnswerComment
has text: "serialize map to string and put into the form hidden field" Can you provide me some example of it ???
comment on: http://stackoverflow.com/a/27480075
type: Comment
score: 0

http://stackoverflow.com/comment/43544460
score: 0
comment on: http://stackoverflow.com/a/27550903
type: Comment
has text: @Jay Kazama was my mistake confused with stage actor, I just corrected
type: AnswerComment

http://stackoverflow.com/a/27507774
upvote count: 1
has body: In your code you run n*n on same entry set named 'wordsWithWeight', and on each iteration you call toLowerCase() and trim(). You can prepare your entry set before and then remove toLowerCase() and trim() calls on each iteration.This should increase performance.
answers question: http://stackoverflow.com/q/27501996
accepted answer of: http://stackoverflow.com/q/27501996
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/37520674
answers question: http://stackoverflow.com/q/27478924
score: 0
type: Answer
has body: I had the same error. After trying out everything I found on stack overflow to no avail, I realised I had my controller in folder src/main/resources/com/controllers, where com.controllers was meant to be a package. Creating another source folder src/main/java and moving the com/controllers folder there did the trick. (It detected the com/controller folder as a package whereas in src/main/resources it was treated as an ordinary directory.)
has comment: http://stackoverflow.com/comment/62537972

http://stackoverflow.com/comment/43594948
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27581119
has text: STL tag is referenced for C++ Standard Template Library. IMHO STL here has nothing to do with this tag.
score: 0

http://stackoverflow.com/a/27604881
type: Answer
score: 3
upvote count: 3
has body: Your long running task is executed in Event Dispatcher Thread which locks the thread where update should be performed. Thus the real update is perfomed only after the task is finished. Run it in SwingWorker See e.g. http://www.javacreed.com/swing-worker-example/ or How do I use SwingWorker in Java?
answers question: http://stackoverflow.com/q/27604470
downvote count: 0

http://stackoverflow.com/comment/47251166
type: Comment
has text: Hi Jonah! Sorry I took so long to reply. Its been a while since I last checked my account. Anyway, all you need to do in your MainView is to create a `backup` bitmap from `operation` bitmap and two distinct modes of operation: "drawing" and "erasing" meant to tell the app to either use `bmp2` or `backup`, respectively, as the source of pixels to draw. The new version of MainView (https://drive.google.com/file/d/0B-xnSRS5FRKZdlp6NVFyWWtBZWs/view?usp=sharing) will provide you with a simple implementation. Click the top left corner of the image to switch between modes.
type: AnswerComment
comment on: http://stackoverflow.com/a/27641686
score: 0

http://stackoverflow.com/q/27600586
tagged with: filenames
has body: I want to check the community opinion about best practices for naming in Android: Id name in xml: &lt;TextView android:id="@+id/addressId" /&gt; What's better, to name the ID "addressId" or "address" or maybe "addressTextView"? variable naming: TextView addressTextView = (TextView) findViewById(R.id.addressId); The var name here is "addressTextView", and I think it's the best practice, unless there is better practice. XML file name I used to use snack_case for my XML layout files this way, "activity_home.xml" or "activity_login.xml" for activity and "cell_contact_xml" "cell_address" for custom cell, so is that the best way or there is better? Java file name: I think here everybody agree to add significant suffix for the class name, and use CamelCase, the best would be like this "HomeActivity" "DetailsFramgment" "ContactAdapter".
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43624100
has comment: http://stackoverflow.com/comment/43624514
tagged with: optimization
upvote count: 3
score: 0
downvote count: 3
has answer: http://stackoverflow.com/a/27601104
tagged with: android
accepted answer: http://stackoverflow.com/a/27601104
possible better answer: http://stackoverflow.com/a/27600849
favorite count: 0
has title: Android coding best practices
has answer: http://stackoverflow.com/a/27600849
has comment: http://stackoverflow.com/comment/43624178
type: AnsweredQuestion

http://stackoverflow.com/comment/43404910
comment on: http://stackoverflow.com/q/27486281
has text: Use `UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());` Or rather, what @kiheru beat me to - +1.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27490699
answer count: 3
tagged with: hamcrest
has title: Is there a Hamcrest matcher to check that a Collection is neither empty nor null?
has comment: http://stackoverflow.com/comment/66155085
has comment: http://stackoverflow.com/comment/43420830
upvote count: 20
has answer: http://stackoverflow.com/a/27499282
has answer: http://stackoverflow.com/a/27494625
accepted answer: http://stackoverflow.com/a/27499282
has comment: http://stackoverflow.com/comment/83323161
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/55721816
tagged with: java
tagged with: matcher
type: Question
score: 20
possible better answer: http://stackoverflow.com/a/27494625
tagged with: junit
downvote count: 0
has body: Is there a Hamcrest matcher which checks that the argument is neither an empty Collection nor null? I guess I could always use both(notNullValue()).and(not(hasSize(0)) but I was wondering whether there is a simpler way and I missed it.
favorite count: 0
has comment: http://stackoverflow.com/comment/43418939

http://stackoverflow.com/comment/43576530
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27575473
has text: possible duplicate of [Hibernate 4 ConnectionProvider Class not found](http://stackoverflow.com/questions/23018179/hibernate-4-connectionprovider-class-not-found)
type: Comment

http://stackoverflow.com/q/27579942
has comment: http://stackoverflow.com/comment/43584484
has title: Square number in java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27579981
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/27579990
type: Question
has comment: http://stackoverflow.com/comment/43585014
score: -2
has body: I have to do the method, that I give a number in, if it is a Square number, it will get me true back if it's not it will get me false back, I wrote the code: public class Aufgabe { static boolean x; public static boolean istQuadratzahl(int zahl){ int n = (int) Math.sqrt(zahl); if (zahl%n == 0){ x = true; } else { return x=false; } return x; } public static void main(String []args){ System.out.println(istQuadratzahl(6)); } } but when I give 6 or 8 in, it gives me true back, where did I go wonge here?
accepted answer: http://stackoverflow.com/a/27579981
has answer: http://stackoverflow.com/a/27580168
has answer: http://stackoverflow.com/a/27579995
has answer: http://stackoverflow.com/a/27579993
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27580168
answer count: 5

http://stackoverflow.com/comment/43455316
score: 0
type: AnswerComment
type: Comment
has text: You ought to learn about this "fun" thing. It often involves kittens... and it's fun.
comment on: http://stackoverflow.com/a/27512385

http://stackoverflow.com/q/27487901
possible better answer: http://stackoverflow.com/a/27488198
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27488198
has comment: http://stackoverflow.com/comment/43408652
tagged with: java
has body: So I wanted to be a good friend and help someone I know with their Java classes, since I have had experience writing a few networking apps. (Java Not Being My First Language) So he handed me a bonus assignment he wanted help on. Everything else we seemed to nail down just fine, but the bonus assignment handed to my friend pretty much went against everything I was thought in any programming language. Obviously if you extend a class in any programming language. C++, Java, PHP, you can only access the sub class variables if they are protected OR public. Obviously if you are trying to access ANY thing that is private or trying to break the rules, you need to take a step back. ... Right? Apparently the assignment was like this: You need to modify this program called the "InvoicePrinter" So that you can print the invoice in HTML and YOU CANNOT modify any of the classes ECXEPT for InvoiceFormatter Here is how the program summed up. //Address.java class Address { private String m_name; private String m_street; Address(String name, String street) { m_name = name; m_street = street; } } //Invoice.java class Invoice { private Address m_location; private Products m_products; Invoice(Address addr) { m_location = addr; } public void format() { //Print data here... } } //InvoicePrinter class InvoicePrinter { int main(//...) { Invoice myInvoice = new Invoice(new Address("My company", "12345 n Street Way")); myInvoice.addProduct(new Product("box", 1.20)); myInvoice.addProduct(new Product("glasses", 5.00)); //Print Invoice on screen... myInvoice.format(); //Add your invoice printer here here... } } //InvoiceFormater.java class InvoiceFormater { private Invoice myInv; InvoiceFormater(Invoice invoice) { myInv = invoice; } public static void format() { //Print your HTML formatter here. } } So unless I'm slowly turning into a Java beginner or something, but the only thing I see how to be able to extract data from Invoice is extending "InvoiceFormatter" and using Super, but you still woul…
linked to: http://stackoverflow.com/q/1196192
tagged with: class
type: Question
accepted answer: http://stackoverflow.com/a/27488303
answer count: 2
has comment: http://stackoverflow.com/comment/43408436
favorite count: 0
tagged with: private
score: -2
has answer: http://stackoverflow.com/a/27488303
linked to: http://stackoverflow.com/q/37628
downvote count: 3
has title: Access Private Members In Private Members Using Java
has comment: http://stackoverflow.com/comment/43407546
upvote count: 1

http://stackoverflow.com/comment/61044587
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/109601/discussion-between-solti-and-fadden).
comment on: http://stackoverflow.com/a/27551071
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43620081
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27598151
has text: Thanks for the comment, actually, when I right-click on the folder and do 'Use as Source Folder', the packages are created correctly, but it doesn't include the .class files. Adding them manually doesn't seem to help
score: 0

http://stackoverflow.com/comment/43571064
score: 0
has text: I can't find the 'throughout' part in the documentation, but indeed, it seems to be the way to go. Thanks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27568983

http://stackoverflow.com/comment/43495251
has text: hint - InputMismatchException might mean input mismatch
comment on: http://stackoverflow.com/q/27533382
score: 0
type: Comment
type: QuestionComment

junit
type: Tag
tags question: http://stackoverflow.com/q/27482585
tags question: http://stackoverflow.com/q/27558284
tags question: http://stackoverflow.com/q/27604727
tags question: http://stackoverflow.com/q/27621516
tags question: http://stackoverflow.com/q/27605714
tags question: http://stackoverflow.com/q/27590860
tags question: http://stackoverflow.com/q/27549575
tags question: http://stackoverflow.com/q/27494302
tags question: http://stackoverflow.com/q/27608145
tags question: http://stackoverflow.com/q/27625995
tags question: http://stackoverflow.com/q/27625644
tags question: http://stackoverflow.com/q/27605109
tags question: http://stackoverflow.com/q/27512983
tags question: http://stackoverflow.com/q/27564075
tags question: http://stackoverflow.com/q/27635859
tags question: http://stackoverflow.com/q/27551952
tags question: http://stackoverflow.com/q/27537240
tags question: http://stackoverflow.com/q/27603472
tags question: http://stackoverflow.com/q/27565460
tags question: http://stackoverflow.com/q/27478240
tags question: http://stackoverflow.com/q/27593743
tags question: http://stackoverflow.com/q/27487917
tag name: junit
tags question: http://stackoverflow.com/q/27515020
tags question: http://stackoverflow.com/q/27564563
tags question: http://stackoverflow.com/q/27564215
tags question: http://stackoverflow.com/q/27607949
tags question: http://stackoverflow.com/q/27536078
tags question: http://stackoverflow.com/q/27610539
tags question: http://stackoverflow.com/q/27574874
tags question: http://stackoverflow.com/q/27506971
tags question: http://stackoverflow.com/q/27549843
tags question: http://stackoverflow.com/q/27529897
tags question: http://stackoverflow.com/q/27486932
tags question: http://stackoverflow.com/q/27630162
tags question: http://stackoverflow.com/q/27507498
tags question: http://stackoverflow.com/q/27529120
tags question: http://stackoverflow.com/q/27617301
tags question: http://stackoverflow.com/q/27561391
tags question: http://stackoverflow.com/q/27598491
tags question: http://stackoverflow.com/q/27579906
tags question: http://stackoverflow.com/q/27531281
tags question: http://stackoverflow.com/q/27533692
tags question: http://stackoverflow.com/q/27490799
tags question: http://stackoverflow.com/q/27605211
tags question: http://stackoverflow.com/q/27619521
tags question: http://stackoverflow.com/q/27485449
tags question: http://stackoverflow.com/q/27524357
tags question: http://stackoverflow.com/q/27511062
tags question: http://stackoverflow.com/q/27621266
tags question: http://stackoverflow.com/q/27490699
tags question: http://stackoverflow.com/q/27624975
tags question: http://stackoverflow.com/q/27640278

http://stackoverflow.com/q/27591276
has comment: http://stackoverflow.com/comment/43606258
has comment: http://stackoverflow.com/comment/43606361
possible better answer: http://stackoverflow.com/a/27591530
type: AnsweredQuestion
has title: Arraylist removing objects
accepted answer: http://stackoverflow.com/a/27591295
has comment: http://stackoverflow.com/comment/43606271
downvote count: 2
has answer: http://stackoverflow.com/a/27591318
type: Question
linked to: http://stackoverflow.com/q/27581
score: -2
tagged with: java
has body: I'm not sure why this code isn't working: so we have a Card array : Card[] hand = new Card[2]; Which contains two cards like: hand[0]=new Card("King","Hearts"); hand[1]=new Card("Ace","Hearts"); however, when I try : ArrayList&lt;Card&gt; deck = new ArrayList&lt;Card&gt;(); // other method here that fills the deck with 52 cards then: deck.remove(hand[0]); deck.remove(hand[1]); then the hand is not removed
has comment: http://stackoverflow.com/comment/43606261
has comment: http://stackoverflow.com/comment/43606438
has comment: http://stackoverflow.com/comment/43606272
has answer: http://stackoverflow.com/a/27591295
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27591530
answer count: 3
has comment: http://stackoverflow.com/comment/43606385

http://stackoverflow.com/q/27620800
has body: I'm trying to import a (25x25 BMP 32-bit color) to an ImageView. The icon is in good state in android studio preview. but when I run the app on my phone, the icon seems like it got corrupted! The images in the attachment shows when the icon is displayed on android studio and on my phone so you can see the difference. and this is the xml code for my imageView: https://i.sstatic.net/H4Gry.png https://i.sstatic.net/lyTYp.png
downvote count: 0
tagged with: icons
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: imageview
has title: my icon is corrupted when the app run on the phone?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43663522
type: Question

http://stackoverflow.com/a/27599424
has comment: http://stackoverflow.com/comment/43622752
has comment: http://stackoverflow.com/comment/43622096
has comment: http://stackoverflow.com/comment/43622260
has comment: http://stackoverflow.com/comment/43622189
type: Answer
has comment: http://stackoverflow.com/comment/43622160
answers question: http://stackoverflow.com/q/27599380
has comment: http://stackoverflow.com/comment/43622123
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27599380
has body: Correct your query String sqlQuery = "SELECT imid FROM "+ ImagesTableData.TABLE_NAME +" WHERE imid ='"+idmod+"'"; There is no Column Name ImageID available in your Table. You defined ImageID=imid. OR another way String sqlQuery = "SELECT "+ ImagesTableData.ImageID +" FROM "+ ImagesTableData.TABLE_NAME +" WHERE "+ ImagesTableData.ImageID + " = '"+idmod+"'";
has comment: http://stackoverflow.com/comment/43622449
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27639882
upvote count: 3
has body: Simply set a boolean and toggle it whenever the user clicks on the image. Check the boolean each time and display the appropriate image. private boolean mClicked = false; public void act1 (View view) { if(mClicked) { ic1.setBackground(ic1dark); } else { ic1.setBackground(ic1light); } mClicked = !mClicked; }
score: 3
answers question: http://stackoverflow.com/q/27639710
accepted answer of: http://stackoverflow.com/q/27639710
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/27490460
has title: Submit action does not take me to the Servlet
has comment: http://stackoverflow.com/comment/43412646
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/27490822
has body: I have got a JSP page, It has button AddTile with value = submit, When this button is pressed I want to take the control to servlet Here is the Form Section of the JSP Page Initial tile Length Direction x-coordinate y-coordinate Longitudinal tile Length Curved tile Radius Angle Clear AddTile My Servlet is located src > webservlets(package name)> DatabaseConnector here is the code of my servlet @WebServlet("/DatabaseConnector") public class DatabaseConnector extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public DatabaseConnector() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Servlet now connected"+request.getParameter("name")); // TODO Auto-generated method stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/43413440
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/43684020
has text: When exactly does that exception occur - on deployment of the application or some piece of code in your application that you might think of the culprit of the exception?
comment on: http://stackoverflow.com/q/27631826
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27484118
has comment: http://stackoverflow.com/comment/43402387
upvote count: 3
has comment: http://stackoverflow.com/comment/43435334
linked to: http://stackoverflow.com/q/16623276
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43436178
linked to: http://stackoverflow.com/q/25252127
has body: Want to use JXLayer to lock up my GUI while some worker thread is executing.Thought that is was as simple as this: JPanel panel = getMyPanel(); LockableUI lockableUI = new LockableUI(); JXLayer l = new JXLayer(panel, lockableUI); lockableUI.setLocked(false); add(l); first error is that getMyPanel() function is undefined for some reason. i have added the jxlayer3-0.jar I need the panel that i want to lock.... so if i switch the first line with: JPanel p =(JPanel) getContentPane(); but then i get the warning that i am adding container's parent to it self.can't find any documentation for JXLayer
has comment: http://stackoverflow.com/comment/43400538
has comment: http://stackoverflow.com/comment/43431300
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12982863
has comment: http://stackoverflow.com/comment/43429843
has answer: http://stackoverflow.com/a/68613877
has comment: http://stackoverflow.com/comment/43400502
linked to: http://stackoverflow.com/q/19324918
linked to: http://stackoverflow.com/q/14324460
tagged with: java
linked to: http://stackoverflow.com/q/29145472
has title: JXLayer implementation
tagged with: swing
type: Question
score: 3
has comment: http://stackoverflow.com/comment/43400560

http://stackoverflow.com/a/27552804
answers question: http://stackoverflow.com/q/27526654
accepted answer of: http://stackoverflow.com/q/27526654
has comment: http://stackoverflow.com/comment/43580637
score: 0
has body: Unfortunately, the ISerializable interface is not available for Windows Phone 8.x. :( Check out the Platforms section here. This thread has additional info as well. Is the liblinear NuGet package supposed to be supported on Windows Phone? If so, I would get in contact with the author of the package directly.
type: AcceptedAnswer
type: Answer

jtextarea
tags question: http://stackoverflow.com/q/27559334
type: Tag
tags question: http://stackoverflow.com/q/27608797
tags question: http://stackoverflow.com/q/27556266
tag name: jtextarea
tags question: http://stackoverflow.com/q/27584069
tags question: http://stackoverflow.com/q/27504581

http://stackoverflow.com/q/27487385
has answer: http://stackoverflow.com/a/27487458
has answer: http://stackoverflow.com/a/27487457
has title: Ending program properly
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27487457
has body: I have a game, ConnectFour that plays and what not. But when the user is finished with a game, there is a prompt that says "would you like to play again? If the user types yes, then it works. But if the user types no, it prints, "Thanks for playing." But the output in the terminal window is: Congrats Red won the game. Would you like to play again? Y/N n Thanks for playing. It does not reload the line that you can use to input stuff back into the terminal. This line Jacks-MacBook-Pro:Cs124 Jack_XXX$ I don't know if that's a function of the main program using a GUI and how it wont close. But I have to hit control C every time to end the program this way and I want to know if there is a way to stop that. The code for main is: public static void main(String[] args) { ConnectFour connectFour= new ConnectFour(); BoardView view = connectFour.getView(); JFrame worldFrame = new JFrame(); JPanel buttonPanel = new JPanel(); view.repaint(); worldFrame.setContentPane(view); worldFrame.add(buttonPanel); worldFrame.validate(); worldFrame.pack(); worldFrame.setVisible(true); Scanner input = new Scanner(System.in); System.out.println("Welcome to Connect Four. The object of the game is to get four of the same colored pieces in a row."); System.out.println("Red will go first."); //sets up the gameboard and then draws it for (int i = 0; i &lt; connectFour.getGameBoard().length; i++) { for (int j = 0; j &lt; connectFour.getGameBoard()[0].length; j++) { connectFour.getGameBoard()[i][j] = 0; } } view.repaint(); connectFour.printGameBoard(); String pwon = ""; boolean playgame=true; //actual gamecode while(playgame=true){ boolean game=false; while (game == false) { System.out.println("Red, which column would you like to move into?"); System.out.println("Note Column Numbers 1 to 7 are accepted."); int x = input.nextInt(); connectFour.move1(x, connectFour.getGameBoard()); if ((connectFour.getGameBoard()[0][x-1]==1)||(connectFour.getGameBoard()[0][x-1]==2)){ System.out.println("Invalid move. Y…
answer count: 4
possible better answer: http://stackoverflow.com/a/27487445
has answer: http://stackoverflow.com/a/27487461
score: 2
has answer: http://stackoverflow.com/a/27487445
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43406519
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43653752
comment on: http://stackoverflow.com/a/27606117
type: AnswerComment
score: 0
type: Comment
has text: Works 100%, this is what I used in the end: LegacyCode.init(new File(this.getClass().getClassLoader().getResource( "META-INF/spring/application.properties").toURI()).getPath()); Thanks yunandtidus!!

http://stackoverflow.com/comment/43469061
comment on: http://stackoverflow.com/a/27517884
type: AnswerComment
score: 0
type: Comment
has text: Thank Paul for the help you the best, I think I think I finally have the code together let me show you new pseudocode

http://stackoverflow.com/comment/43499521
score: 0
type: Comment
has text: Perhaps "bad" was the wrong word to use, but since I've never seen it in actual use before I was wondering if I should really use it over regular setting. Thanks, the example is clear and logical too :)
comment on: http://stackoverflow.com/a/27535436
type: AnswerComment

http://stackoverflow.com/a/27522120
has comment: http://stackoverflow.com/comment/43473735
upvote count: 0
has comment: http://stackoverflow.com/comment/43473549
has comment: http://stackoverflow.com/comment/43473425
has body: You're not calling: bankAccount = bank.getAccount(accountN); to point your bank account in point 4 (deposit) and 5 (withdraw). FIX: case 4: System.out.println("[4] Deposit has been selected"); System.out.println("Enter account ID: "); int accountNumber = scan.nextInt(); System.out.println("Enter deposit amount: "); double depositAmount = scan.nextDouble(); ---&gt; bankAccount = bank.getAccount(accountN); transactionProcess.deposit(bankAccount, depositAmount); break; case 5: System.out.println("[5] Withdraw has been selected"); System.out.println("Enter account ID: "); int accountNu = scan.nextInt(); System.out.println("Enter withdraw amount: "); double withdrawAmount = scan.nextDouble(); ---&gt; bankAccount = bank.getAccount(accountN); transactionProcess.withdraw (bankAccount, withdrawAmount); break;
type: Answer
has comment: http://stackoverflow.com/comment/43473684
has comment: http://stackoverflow.com/comment/43473856
downvote count: 1
has comment: http://stackoverflow.com/comment/43474128
answers question: http://stackoverflow.com/q/27521776
has comment: http://stackoverflow.com/comment/43474098
score: -1

http://stackoverflow.com/a/27608403
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Your @PrepareForTest annotation probably isn't being run, since you're using the Robolectric test runner and not the PowerMock runner. The example doesn't show any Android code -- if this really is a standalone test, then switch to the PowerMock runner. If you really do use Android code in the test you'll have to look into how to properly initialize PowerMock without the annotation.
accepted answer of: http://stackoverflow.com/q/27608145
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27608145
has comment: http://stackoverflow.com/comment/43639083

http://stackoverflow.com/comment/43593677
has text: Try this : make your each menu item to have a textview and a black dark horizontal bar, then when you inflate your menu, hide the black dark bar for the cases where you don't want it. This should make such a grouping.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27489695

http://stackoverflow.com/q/27512362
possible better answer: http://stackoverflow.com/a/27512496
score: 3
has answer: http://stackoverflow.com/a/27512532
tagged with: hashmap
tagged with: null
has answer: http://stackoverflow.com/a/27512496
accepted answer: http://stackoverflow.com/a/27512532
answer count: 2
downvote count: 0
favorite count: 0
has title: Implementation independent way to see if a map contains null key
type: AnsweredQuestion
has body: I have an API that receives a parameter which implements the Map interface. I need to check to see if this Map contains any null key. The problem is there are certain implementations of Map, such as ConcurrentHashMap which throw NPE if you call contains(null) on them. What is a good, implementation independent way to see if an object that adheres to the Map interface contains a null key or not? Note that I can't use keySet and check to see if that contains a null, because ConcurrentHashMap actually just wraps the keySet onto itself and ends up calling contains again underneath. Any ideas would be much appreciated. I would rather not use instanceOf since that tends to look ugly when you have to corner case so many different types of Maps
upvote count: 3
tagged with: java
tagged with: concurrenthashmap
tagged with: collections
type: Question

http://stackoverflow.com/comment/43494578
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27532532
has text: Field hiding isn't the culprit in this question. With field hiding, B.value would hide A.value. Instead, the OP is getting A.value, and expecting B.value.

http://stackoverflow.com/comment/43467263
has text: :Could you show me an example that has two classes in a single file and has no packages so it uses the default package(current directory) and accesses an member from another class.The reason why I'm asking this since as you stated in your answer since variables defined in methods are `local variables` and it's mandatory to place variable in a method in java is it possible to access an member from another class which is public?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27504637
type: Comment

http://stackoverflow.com/q/27626864
answer count: 2
has answer: http://stackoverflow.com/a/27626907
tagged with: java
has title: Java: formatting numbers error?
accepted answer: http://stackoverflow.com/a/27626907
tagged with: number-formatting
tagged with: numberformatexception
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/27627316
favorite count: 0
has answer: http://stackoverflow.com/a/27627316
has body: I am encountering a problem regarding a class which converts number formats with String input and output: public class Conversion{ static int result; public static String fromHexToDec (String clientInput) { result= Integer.parseInt(clientInput, 10); return Integer.toString(result); } public static String fromDecToHex (String clientInput) { result= Integer.parseInt(clientInput, 16); return Integer.toString(result); } public static String fromOctTo4 (String clientInput) { result= Integer.parseInt(clientInput, 4); return Integer.toString(result); } public static String from4ToOct(String clientInput) { result= Integer.parseInt(clientInput, 8); return Integer.toString(result); } public static String formBinToDec(String clientInput) { result= Integer.parseInt(clientInput, 10); return Integer.toString(result); } public static String fromDecToBin(String clientInput) { result= Integer.parseInt(clientInput, 2); return Integer.toString(result); } public static String from5To7(String clientInput) { result= Integer.parseInt(clientInput, 7); return Integer.toString(result); } public static String from7To5(String clientInput) { result= Integer.parseInt(clientInput, 5); return Integer.toString(result); } } I am receiving this error trying to run fromHexToDec in the the main method: Exception in thread "main" java.lang.NumberFormatException: For input string: "C" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Konverzija.fromHexToDec(Conversion.java:9) at Test.main(Test.java:5) Can somebody help, please?
type: Question
upvote count: 2

http://stackoverflow.com/comment/43593775
type: QuestionComment
has text: @MeetTitan So I create an instance of ColonyHutDrag but if I do it the way you said in your comment it won't work. getType is in the ColonyHutOneDrag class. It makes me think that you mean that I need to create an instance of the ColonyHutOneDrag class that way i can access the getType method in that class like so: ColonyHutDrag.setType(colonyHutOneListen.getType()); This requires it to be static as well. I am sorry if I am missing something that you are trying to say.
score: 0
comment on: http://stackoverflow.com/q/27515974
type: Comment

http://stackoverflow.com/q/27548942
tagged with: file-io
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43524481
has comment: http://stackoverflow.com/comment/43524404
has title: How do I read a populated array from a .txt file?
type: Question
has answer: http://stackoverflow.com/a/27549890
score: 0
has comment: http://stackoverflow.com/comment/43524175
has body: I have a .txt file that is filled with 87 four letter words. I am essentially making a hangman game in which the user starts the game, and a random number is generated between 0 and 86 and then the program goes to the .txt file and picks out that word for the user to guess. This is the first time I am trying to do this because I am a new programming student and the book I am using is little to of no help at all. SO...here is what I have been doing for this: class ReturnRandomInteger { public int randomInteger() { int randomInt = 0; for (int i = 0; i &lt; 1; i++) { randomInt = (int) (Math.random() * 86) + 0; } return randomInt; } public static String getWord(int randomInt, String line) { FourLetterWords newObject = new FourLetterWords(); if (randomInt == String line) } } class FourLetterWords { public static void readFile() { try { String fileName = "C//FourLetterWords.txt"; File fourLetterWords = new File(fileName); Scanner in = new Scanner(fourLetterWords); ArrayList&lt;FourLetterWords&gt; words = new ArrayList&lt;&gt;(); while (in.hasNextLine()) { String line = in.nextLine(); } } catch (FileNotFoundException ex) { System.out.println("File not found."); } } } For starters, I don't know if my try and catch is correct. The name of the file is FourLetterWords.txt. If it is wrong I want to know what the correct way to read each line in the .txt file is. Now in my ReturnRandomInteger class, I created the new object from my FourLetterWords class and you could see that what I am trying to do is have it so that if the random integer the user generated equals the corresponding line in the .txt file then it will return that word in that line. Obviously, int can not equal a String so how am I supposed to correspond the integer generated with the word in the .txt file I have? I would greatly appreciate any help that I can get.
has comment: http://stackoverflow.com/comment/43524122
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/43524325
tagged with: try-catch
accepted answer: http://stackoverflow.com/a/27549890
has answer: http://stackoverflow.com/a/27549140
tagged with: arrays
has answer: http://stackoverflow.com/a/27549037
possible better answer: http://stackoverflow.com/a/27549140
has comment: http://stackoverflow.com/comment/43524337

http://stackoverflow.com/q/27634438
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27635156
score: -2
tagged with: pentaho
tagged with: business-intelligence
has body: I would like to use JDBC connection paramters - when setting a new datasource. I.e. here: (Instead of using constant values) http://infocenter.pentaho.com/help/topic/config_ba_server/images/ssbaPdiDialogConnect.png How can I use them (syntax)? (${db_host} ? @db_host ?etc) Also, can I use such parameters from a mondrian cube ? I.e. set which db host/ db user dynamically from the cube (parameters files ?) Thanks
downvote count: 2
answer count: 1
favorite count: 0
has title: Pentaho bi server (ce) JDBC connect with parameters
type: UnansweredQuestion
tagged with: jdbc
upvote count: 0

http://stackoverflow.com/comment/43587219
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27581429
has text: "Even if check statement returns that the object isn't null?" -- the `Bitmap` is not `null`. Otherwise, you would not have even gotten into line 647 of `Bitmap.java`.
score: 0

http://stackoverflow.com/q/27489314
has comment: http://stackoverflow.com/comment/43446038
has comment: http://stackoverflow.com/comment/43431537
tagged with: linux
has comment: http://stackoverflow.com/comment/43420290
has comment: http://stackoverflow.com/comment/43420222
has comment: http://stackoverflow.com/comment/43412598
has comment: http://stackoverflow.com/comment/43414720
favorite count: 0
has comment: http://stackoverflow.com/comment/43445986
has comment: http://stackoverflow.com/comment/43412298
has title: Why java is slow if I don't move mouse over the window on linux?
has comment: http://stackoverflow.com/comment/43430582
has comment: http://stackoverflow.com/comment/43410276
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43416497
linked to: http://stackoverflow.com/q/18684220
tagged with: swing
has body: I'm in front of a big issue and I find any explanation. I'm currently playing a little with Java and it seems that my programs are very slow (like 5-10 FPS even if I specify my thread to run at 60 FPS), unless I move my mouse over the window, even if my window doesn't have the focus. I had the same issue with several examples and I give to you a very short one within my issue occurs. package com.coukaratcha; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; public class BouncingBall extends JFrame { private int x; private int y; private int vx; private int vy; public BouncingBall(){ super("Bouncing Ball"); this.x = 300; this.y = 200; this.vx = 5; this.vy = -2; this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setResizable(false); final JPanel content = new JPanel(){ protected void paintComponent(Graphics g){ super.paintComponent(g); g.setColor(Color.WHITE); g.fillOval(x-10, y-10, 10, 10); } }; content.setPreferredSize(new Dimension(600, 400)); content.setBackground(Color.BLACK); this.setContentPane(content); Thread thread = new Thread(new Runnable(){ public void run(){ while(true){ updatePhysics(); content.repaint(); try{ Thread.sleep(1000/60); } catch (InterruptedException e){ ; } } } }); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); thread.start(); } public void updatePhysics(){ if (x &gt; 595 || x &lt; 10){ vx*= -1; } if (y &gt; 395 || y &lt; 10){ vy*= -1; } x+=vx; y+=vy; } public static void main(String[] args) { BouncingBall ball = new BouncingBall(); } } I tried this code on some Windows and it works perfectly, but on my Fedora 20/21 or the Ubuntu of a friend, the slowing strikes again. It's compiled with Java 1.8. Thank you in advance for your help. [EDIT] After @jtahlborn invite me to use the so called EDT, without clearly explaining how to do that by the way, I've made some modifications in my code and here is the last version where exactly the same issu…
has comment: http://stackoverflow.com/comment/43444080
score: 2
tagged with: performance
has comment: http://stackoverflow.com/comment/43442358
tagged with: frame-rate
tagged with: java
has comment: http://stackoverflow.com/comment/43451121
has comment: http://stackoverflow.com/comment/43414807
type: Question
has comment: http://stackoverflow.com/comment/43411580
has comment: http://stackoverflow.com/comment/43412208
has comment: http://stackoverflow.com/comment/43413147
downvote count: 0
has comment: http://stackoverflow.com/comment/43410196

http://stackoverflow.com/a/27584382
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27571120
has body: I managed to resolve this issue by writing a simple class which allow for what I want, see code below. import java.io.IOException; import java.net.URL; import org.apache.avro.ipc.HttpTransceiver; import org.apache.avro.ipc.Responder; import org.apache.avro.ipc.ResponderServlet; import org.apache.avro.ipc.reflect.ReflectRequestor; import org.apache.avro.ipc.reflect.ReflectResponder; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.ServletHolder; /** * * @author bennyl */ public class MultiResponderHttpServer { private final Context context; private final Server server; private final int port; public MultiResponderHttpServer(int port) { this.port = port; server = new Server(port); context = new Context(server, "/", Context.SESSIONS); } public void addResponder(String baseUri, Responder responder) throws IOException { ResponderServlet servlet = new ResponderServlet(responder); ServletHolder holder = new ServletHolder(servlet); context.addServlet(holder, baseUri); } public int getPort() { return port; } public void close() throws Exception { server.stop(); } public void start() throws Exception { server.start(); } public void join() throws InterruptedException { server.join(); } public static void main(String[] args) throws IOException, InterruptedException { MultiResponderHttpServer server = new MultiResponderHttpServer(8888); server.addResponder("/test_a/*", new ReflectResponder(TestProtocol.class, (TestProtocol) why -&gt; "a received a message: '" + why + "'")); server.addResponder("/test_b/*", new ReflectResponder(TestProtocol.class, (TestProtocol) why -&gt; "b received a message: '" + why + "'")); server.start(); HttpTransceiver atrans = new HttpTransceiver(new URL("http://localhost:" + server.getPort() + "/test_a/")); HttpTransceiver btrans = new HttpTransceiver(new URL("http://localhost:" + server.getPort() + "/test_b/")); System.out.println(ReflectRequestor.getClient(TestProtocol.class, atrans).go("messa…
accepted answer of: http://stackoverflow.com/q/27571120
score: 0
type: Answer

http://stackoverflow.com/a/27484049
has body: You should have a controller method return ModelAndView, e.g. @RequestMapping(value = "/small", method = RequestMethod.GET) public ModelAndView smallJSP() { ModelAndView modelAndView = new ModelAndView("small"); return modelAndView; } the controller will search for the view with the name small, on the default location and with the default suffix (depending on your configuration e.g. /WEB-INF/views/small.jsp). Than you should simply call the method with an appropriate ajax call, e.g. via jquery $.ajax({ url:"/small", dataType: "html", type: "GET", success: function (msg) { $(".responseDiv").html(msg);// place your response to some div } });
has comment: http://stackoverflow.com/comment/43403148
type: Answer
answers question: http://stackoverflow.com/q/27483574
score: 0
has comment: http://stackoverflow.com/comment/43403065

http://stackoverflow.com/a/29551613
type: Answer
score: 14
upvote count: 14
answers question: http://stackoverflow.com/q/27559543
has comment: http://stackoverflow.com/comment/69479692
downvote count: 0
has comment: http://stackoverflow.com/comment/90081333
has body: Thanks to Reza. I found this webpage. It introduces how to convert a Json string into an avro object. http://rezarahim.blogspot.com/2013/06/import-org_26.html The key of his code is: static byte[] fromJsonToAvro(String json, String schemastr) throws Exception { InputStream input = new ByteArrayInputStream(json.getBytes()); DataInputStream din = new DataInputStream(input); Schema schema = Schema.parse(schemastr); Decoder decoder = DecoderFactory.get().jsonDecoder(schema, din); DatumReader&lt;Object&gt; reader = new GenericDatumReader&lt;Object&gt;(schema); Object datum = reader.read(null, decoder); GenericDatumWriter&lt;Object&gt; w = new GenericDatumWriter&lt;Object&gt;(schema); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Encoder e = EncoderFactory.get().binaryEncoder(outputStream, null); w.write(datum, e); e.flush(); return outputStream.toByteArray(); } String json = "{\"username\":\"miguno\",\"tweet\":\"Rock: Nerf paper, scissors is fine.\",\"timestamp\": 1366150681 }"; String schemastr ="{ \"type\" : \"record\", \"name\" : \"twitter_schema\", \"namespace\" : \"com.miguno.avro\", \"fields\" : [ { \"name\" : \"username\", \"type\" : \"string\", \"doc\" : \"Name of the user account on Twitter.com\" }, { \"name\" : \"tweet\", \"type\" : \"string\", \"doc\" : \"The content of the user's Twitter message\" }, { \"name\" : \"timestamp\", \"type\" : \"long\", \"doc\" : \"Unix epoch time in seconds\" } ], \"doc:\" : \"A basic schema for storing Twitter messages\" }"; byte[] avroByteArray = fromJsonToAvro(json,schemastr); Schema schema = Schema.parse(schemastr); DatumReader&lt;Genericrecord&gt; reader1 = new GenericDatumReader&lt;Genericrecord&gt;(schema); Decoder decoder1 = DecoderFactory.get().binaryDecoder(avroByteArray, null); GenericRecord result = reader1.read(null, decoder1);

http://stackoverflow.com/comment/43619736
score: 0
type: Comment
type: QuestionComment
has text: Have tried simply using `Map<String, Object>`? This should work for unknown structures. You will of course need to make sure you have the json support enabled. That requires the `jersey-json` dependency, along with a simple configuration, as seen [here](http://stackoverflow.com/a/27355016/2587435)
comment on: http://stackoverflow.com/q/27597890

http://stackoverflow.com/a/27502008
score: 2
downvote count: 0
upvote count: 2
has body: If you're running your app in IDE, the /webapp/resources used for running app will differ from the /webapp/resources in your IDE. Try to log full path to file and check there.
type: Answer
answers question: http://stackoverflow.com/q/27501843

http://stackoverflow.com/a/27510528
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: Yes String is an object in Java. The fact that it can be used similar to primitives does not contradict Please refer - Strings are objects in Java, so why don't we use 'new' to create them?
answers question: http://stackoverflow.com/q/27510494

http://stackoverflow.com/a/27538072
downvote count: 0
has body: BufferedImages have a method called getRGB(int x, int y) which returns an int where each byte is the components of the pixel (alpha, red, green and blue). If you dont want to do the bitwise operators yourself you can use Colors.getRed/Green/Blue methods by creating a new instance of Java.awt.Color with the int from getRGB. You can do this in a loop to fill the three-dimensional array.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27537867
score: 2

http://stackoverflow.com/comment/43452767
comment on: http://stackoverflow.com/q/27511334
has text: http://en.wikipedia.org/wiki/Shunting-yard_algorithm
type: QuestionComment
type: Comment
score: 1

loops
tags question: http://stackoverflow.com/q/27624024
tags question: http://stackoverflow.com/q/27485794
tags question: http://stackoverflow.com/q/27564670
tags question: http://stackoverflow.com/q/27570935
tags question: http://stackoverflow.com/q/27636052
tags question: http://stackoverflow.com/q/27496216
tags question: http://stackoverflow.com/q/27632511
tags question: http://stackoverflow.com/q/27619497
tags question: http://stackoverflow.com/q/27591410
tags question: http://stackoverflow.com/q/27634946
type: Tag
tags question: http://stackoverflow.com/q/27516510
tags question: http://stackoverflow.com/q/27533551
tags question: http://stackoverflow.com/q/27587309
tags question: http://stackoverflow.com/q/27595546
tag name: loops
tags question: http://stackoverflow.com/q/27574490
tags question: http://stackoverflow.com/q/27501743
tags question: http://stackoverflow.com/q/27507632
tags question: http://stackoverflow.com/q/27607498
tags question: http://stackoverflow.com/q/27503105
tags question: http://stackoverflow.com/q/27595110
tags question: http://stackoverflow.com/q/27578118
tags question: http://stackoverflow.com/q/27498021
tags question: http://stackoverflow.com/q/27557922
tags question: http://stackoverflow.com/q/27612302

http://stackoverflow.com/q/27508730
favorite count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: jaxb
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27509119
answer count: 1
has title: JAXBContext compatibility issues
has body: I am migrating our team from JAXB 1.x to JAXB 2.1 which is part of JAVA1.6 (rt.jar). Everything was going swimingly till it started complaining during run time. Here is the line of code thats causing the issue. String jaxbPackageName = "com.acme.retail.fuel.ifp"; context = JAXBContext.newInstance(jaxbPackageName, new JAXBClassLoader()); I have removed all JAXB 1.x libraries and assets from the project and its build path. Yet the issue persists. Below is the exception message SEVERE: JAXBContext creation failed for context path com.acme.retail.fuel.ifp Throwable occurred: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.ContextFactory_1_0_1 not found - with linked exception: [java.lang.ClassNotFoundException] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:158) at javax.xml.bind.ContextFinder.find(ContextFinder.java:260) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:383) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:348) at com.acme.sureview.fuel.ifsf.application.IFPTranslator.&lt;init&gt;(IFPTranslator.java:167)

instagram
tags question: http://stackoverflow.com/q/27561917
tag name: instagram
type: Tag

http://stackoverflow.com/q/27507450
has comment: http://stackoverflow.com/comment/43451678
favorite count: 0
has body: This is what I'm doing to load the log4j2.xml file, specifying the log file location from another property file to keep configuration simple for support purposes: MyProperties props = MyProperties.getInstance(); System.setProperty(MyConstants.AUDIT_LOG_ENV_VAR, props.getAuditLogFileName()); ConfigurationSource source = new ConfigurationSource(new FileInputStream(new File( System.getProperty(MyConstants.PROPERTIES_FILE_ENV_VAR) + "/log4j2.xml"))); Configurator.initialize(null, source); and log4j2 will pick up and use my file name because I've specified it in the Appender using envvar substitution: &lt;File name="AuditLogger" fileName="${sys:AUDIT_LOG}"&gt; &lt;PatternLayout pattern="DATETIME %d{yyyy-MM-dd HH:mm:ss:SSS zzz}%n%msg%n" /&gt; &lt;/File&gt; However I don't like it because there's a smell about pushing the file name value out to the system environment before reading it back in again on the next line of code. I like Configure log4j2 programmatically using ConfigurationFactory but there doesn't seem to be a similar way to build more on top of a log4j2.xml file - or is there?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20886717
has comment: http://stackoverflow.com/comment/43452244
tagged with: log4j2
tagged with: logging
type: Question
tagged with: configuration
tagged with: java
score: 4
upvote count: 4
has title: Better way to initialize log4j2 (TWO) programmatically
has answer: http://stackoverflow.com/a/27518576
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43445216

http://stackoverflow.com/q/27504136
score: 7
tagged with: java
upvote count: 7
type: Question
has title: struts2 2.3.20 ognl allowStaticMethodAccess
possible better answer: http://stackoverflow.com/a/27505604
has comment: http://stackoverflow.com/comment/43438473
tagged with: ognl
has answer: http://stackoverflow.com/a/28029282
has comment: http://stackoverflow.com/comment/43440071
accepted answer: http://stackoverflow.com/a/28029282
tagged with: struts2
tagged with: static-methods
answer count: 3
has comment: http://stackoverflow.com/comment/43678373
downvote count: 0
has answer: http://stackoverflow.com/a/28960844
has comment: http://stackoverflow.com/comment/44435930
favorite count: 0
has answer: http://stackoverflow.com/a/27505604
has body: I updated my project to Struts2 version 2.3.20 . Now all cases in my JSPs that uses static method access do not work. ie. &lt;s:set var="linkEscaped" value="@org.apache.commons.lang.StringEscapeUtils@escapeHtml(#attr.myObject.link)" /&gt; I already have set in my struts.properties -> struts.ognl.allowStaticMethodAccess=true and tried in struts.xml -> &lt;constant name="struts.ognl.allowStaticMethodAccess" value="true"/&gt; with no success. Does anyone know what has changed and what do I need to do to enable them again?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/28018861
has comment: http://stackoverflow.com/comment/43442789

http://stackoverflow.com/comment/43603746
comment on: http://stackoverflow.com/q/27585913
score: 0
has text: I am not sure if those are the snippets I was thinking about. In `new PageFragSanningellerKonsekvens().newInstance(getViewPager(), getVerticalViewPager());` you call the methods `getViewPager()` and `getVerticalViewPager()`. I assume it is here that you pass the references? Just wanted to know 1) how you obtain those references and 2) at exactly what point in 'lifecycle' time you ask for those references.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27520132
has body: The -D switch is for setting system properties rather than for passing arguments to your program. In fact the two approaches don't even send information to the same place: the String[] arguments are sent to your program, whereas the switch gets sent to the virtual machine (from which your program can access the properties if it needs to). Use arguments unless you have a clear idea of why you need a command line switch.
upvote count: 6
accepted answer of: http://stackoverflow.com/q/27520096
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27520096
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/54878167
score: 6

http://stackoverflow.com/q/27628721
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27629663
score: 0
has body: I have two simple classes for testing a rest call on a neo4j server. I have placed the .jar file in the plugins directory with the path included such as: gov/lanl/graphing/execute/rest/HelloWorldResource.class I have modified the neo4j-server.properties file such as: org.neo4j.server.thirdparty_jaxrs_class= gov.lanl.graphing.execute.rest=/gov/lanl/graphing/execute/rest I think I have a lack of understanding regarding the above property. Here are two classes, the HelloWorldResrource class is the one in the plugins direcotry. Note: there is some cooky cutter syntax so disregard the weird variable names and such. This is extremely simple, and I think the problem is I don't understand how the path in the server.properties file is supposed to be represented in the Main class. Thanks for any help. public class Resting { public static String URI = "http://localhost:7474/gov/lanl/graphing/execute/rest/helloworld/"; public static void main (String[] args) { Client client = Client.create(); client.addFilter(new LoggingFilter(System.out)); WebResource cypher = client.resource(URI + "rico"); ClientResponse cypherResponse = cypher.accept(MediaType.TEXT_PLAIN).get(ClientResponse.class); cypherResponse.close(); System.out.println(cypherResponse); } } @Path("/helloworld") public class HelloWorldResource { @GET @Produces(MediaType.TEXT_PLAIN) @Path("/{name}") public Response hello(@PathParam("name") String name) { return Response.status(Status.OK).entity( ("hello there , " + name).getBytes(Charset.forName("UTF-8"))).build(); } }
answer count: 1
tagged with: neo4j
has answer: http://stackoverflow.com/a/27629663
tagged with: rest
has title: Need assistance with simple neo4j rest proof of concept
type: AnsweredQuestion

http://stackoverflow.com/q/27628943
possible better answer: http://stackoverflow.com/a/27629031
has answer: http://stackoverflow.com/a/27629031
type: Question
has answer: http://stackoverflow.com/a/27629034
accepted answer: http://stackoverflow.com/a/27629034
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 2
answer count: 2
favorite count: 0
tagged with: android
has body: So I'm trying to parse a JSONObject but I keep getting the error: Error parsing data org.json.JSONException: Expected ':' after n at character 5 of {n "24h_avg": 334.22,n "ask": 335.96,n "bid": 335.7,n "last": 335.84,n "timestamp": "Tue, 23 Dec 2014 22:13:55 -0000",n "volume_btc": 30328.82,n "volume_percent": 82.62n}n I'm able to get the json I need from the server but it's not being parsed right for some odd reason. Here is my MainActivity.java import android.app.ProgressDialog; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.widget.TextView; import org.json.JSONObject; public class MainActivity extends ActionBarActivity { public static final String URL = "https://api.bitcoinaverage.com/ticker/global/USD/"; TextView mPriceText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if(isNetworkAvailable()) { JSONParse parse = new JSONParse(); parse.execute(); } } private boolean isNetworkAvailable() { ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = manager.getActiveNetworkInfo(); boolean isAvailable = false; if(networkInfo != null &amp;&amp; networkInfo.isConnected()) { isAvailable = true; } return isAvailable; } private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Getting price ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected JSONObject doInBackground(String... args) { JSONParser jParser = new JSONParser(); // Getting JSON from URL JSONObject json = jParser.getJsonFromUrl(URL); return json;…
tagged with: parsing
score: 2
type: AnsweredQuestion
has title: Error parsing data org.json.JSONException: Expected ':' after n
downvote count: 0

http://stackoverflow.com/q/27636486
tagged with: spock
score: 0
has title: How to Mock ProceedingJoinPoint
answer count: 1
has answer: http://stackoverflow.com/a/27636808
accepted answer: http://stackoverflow.com/a/27636808
type: AnsweredQuestion
tagged with: java
has body: I am trying to writing a Spock specification that test an AspectJ advice class. Therefore I need a mock instance of org.aspectj.lang.ProceedingJoinPoint class. void "Verify client capability mechanism"() { given: def pointCut = Mock(ProceedingJoinPoint) and: 'the method calls would have the following arguments' pointCut.getArgs() &gt;&gt; ['xxx', 1L, 44] as Object[] // this is where the error happens when: 'the advice gets called' def retVal = new ClientCapabilitySecurityAdvice().verifyUserCanPerformActionOnCurrentClient(pointCut) then: 'the call may proceed' 1 * pointCut.getArgs() 1 * pointCut.proceed() &gt;&gt; 'Hello' retVal == 'Hello' } For some reason I am not able to define a return value on getArgs() on my mock instance. I get this error message. java.lang.NullPointerException: Cannot invoke method rightShift() on null object What is the proper way to mock the ProceedingJointPoint interface? Can someone help me on this? PS: Merry christmas to you :) Update (Solution according Peter) void "Verify client capability mechanism"() { given: def pointCut = Mock(ProceedingJoinPoint) when: 'the advice gets called' def retVal = new ClientCapabilitySecurityAdvice().verifyUserCanPerformActionOnCurrentClient(pointCut) then: 'the method calls would have the following arguments' 1 * pointCut.getArgs() &gt;&gt; ['xxx', 1L, 44] and: 'the actual return value is set' 1 * pointCut.proceed() &gt;&gt; 'Hello' and: 'the call may proceed' retVal == 'Hello' }
tagged with: unit-testing
type: Question
tagged with: aspectj

http://stackoverflow.com/a/27528721
type: Answer
upvote count: 1
score: 1
has body: The question "Properly pass arguments to Go Exec" mentions: exec.Command(...) adds double quotes to the parameters if there is spaces in them, so you only need to escape \" where you need them. In your case, -cp "/minecraft/bin/*" would be passed to exec.Command as two separate parameters. If you need quotes within one parameter, you could use a string literal to keep them (as commented in "How do you add spaces to exec.command in golang"). But if, in your case, you need the cp (classpath) to be expended by the shell (as mentioned in "double quotes escaping in golang exec"), then remove the quotes: exec.Command(..., "-cp", `/minecraft/bin/*`, ...)
answers question: http://stackoverflow.com/q/27528430
downvote count: 0

http://stackoverflow.com/a/27608484
has body: If possible change getId to return a Long object rather than a primitive long. The automatic conversion to primitive long causes your null pointer exception.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27608249

http://stackoverflow.com/q/27479169
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/27479415
has body: In my project, I used JSON to pass readed data from database to client side.In this code I put JSONObject in to JSONArray and pass to client side. This my code for JsonProcessing.java servlet: JSONObject obj = new JSONObject(); JSONArray objarr = new JSONArray(); //read from DB sql = "SELECT id, name FROM test"; ResultSet rs = stmt.executeQuery(sql); while (rs.next()) { // Retrieve by column name int id = rs.getInt("id"); String first = rs.getString("name"); obj.put("name", first); obj.put("id", id); objarr.add(obj); System.out.print("\nobj: "+obj); } response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.print(objarr); out.flush(); And this is my javascript code: $.ajax({ url : "/test/JsonProcessing", type : "get", data : { id : 30 }, success : function(info) { //alert(info.name); console.log(info); for (var i = 0; i &lt; info.length; i++) { alert(i + ": " + info[i].name + " " + info[i].id); } // data: return data from server }, error : function() { alert('Faild'); // if fails } }); I don't know why I take duplicate same result in alert ?
tagged with: javascript
has title: JSONArray duplicate same result
downvote count: 2
upvote count: 10
answer count: 1
score: 8
has comment: http://stackoverflow.com/comment/43392151
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27479415

http://stackoverflow.com/q/27502536
accepted answer: http://stackoverflow.com/a/36065482
upvote count: 8
possible better answer: http://stackoverflow.com/a/27518235
has answer: http://stackoverflow.com/a/27518235
tagged with: logging
type: AnsweredQuestion
tagged with: java
tagged with: log4j2
type: Question
answer count: 2
tagged with: configuration
has answer: http://stackoverflow.com/a/36065482
tagged with: pattern-layout
has body: In log4j 2, I would like to trim the end of messages written to the console appender when size is above a specified threshold. I looked at the http://logging.apache.org/log4j/2.0/manual/layouts.html#PatternLayout docs but can see no option to truncate the end of the "msg" field. "%.1000msg" will leave only the last 1000 chars of the message. This is not good for me because in Java the most inner frames in stack trace are printed at the beginning of the message. Any idea?
downvote count: 0
has title: Limit max message size in log4j2 pattern
score: 8
favorite count: 0

http://stackoverflow.com/comment/43477308
type: Comment
comment on: http://stackoverflow.com/a/27492555
has text: Is it a requirement that it can be used in a switch? (ErrorCodeAuthority.ENTITY_NOT_FOUND) because that is making it pretty hard with the java enum style in TypeScript.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27504993
has comment: http://stackoverflow.com/comment/43440138
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: sparql
upvote count: 3
has answer: http://stackoverflow.com/a/27505275
has body: This is my first question here on StackOverflow. I'm using Apache Jena in order to query DBPedia and the results i got are pretty strange. Here's my code, with a simple query : String sparqlQuery = "PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; select ?o where { &lt;http://dbpedia.org/ontology/Agent&gt; rdfs:subClassOf ?o}"; System.out.println("Query : " + sparqlQuery); Query query = QueryFactory.create(sparqlQuery); QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query); ResultSet results = qexec.execSelect(); ResultSetFormatter.out(System.out, results, query); qexec.close(); And this is what i got in response : &lt;http://www.w3.org/2002/07/owl#Thing&gt; &lt;http://www.w3.org/2002/07/owl#Thing&gt; &lt;http://www.w3.org/2002/07/owl#Thing&gt; Any idea why i don't get a single Resource ? I tried with other Resources, same problem. Thanks for your help and have a nice day !
has answer: http://stackoverflow.com/a/27507989
type: Question
score: 3
tagged with: jena
tagged with: java
has title: Apache Jena - got 3 identical results for one query
answer count: 2

http://stackoverflow.com/comment/43656796
has text: I tried `file` with jcef_helper because according to error as i posted in question libcef.so file is not found while loding of jcef_helper `file /home/ubuntu/Desktop/bin/jcef_helper` so gives `/home/ubuntu/Desktop/bin/jcef_helper: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x3cc71c45cf3d5d9e27f89cab9c5ea6b04165343a, not stripped`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27617081

http://stackoverflow.com/q/27600508
type: Question
has body: Consider the following code: public class ThreadT implements Runnable { public void run() { System.out.println("run."); throw new RuntimeException("Problem"); } public static void main(String[] args) { Thread t = new Thread(new ThreadT()); t.start(); System.out.println("End of method."); } } The output I get is: End of method. run. Exception in thread "Thread-0" java.lang.RuntimeException: Problem Why the output is not like this: run. Exception in thread "Thread-0" java.lang.RuntimeException: Problem End of method.
possible better answer: http://stackoverflow.com/a/27600567
has answer: http://stackoverflow.com/a/27600567
linked to: http://stackoverflow.com/q/20563287
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27600568
has comment: http://stackoverflow.com/comment/43623822
tagged with: exception
tagged with: multithreading
has title: Exception in java thread
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27600607
tagged with: java
accepted answer: http://stackoverflow.com/a/27600607

http://stackoverflow.com/a/27539228
downvote count: 0
answers question: http://stackoverflow.com/q/27539196
has body: You can set the response code in the HTTPServletResponse returned form the webservice. response.setStatus(Response.Status.Forbidden) If the webservice doesnot return the Servlet response directly,you need to add this piece of code to the handler which creates the final response before it is wired to the client.
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43506276

http://stackoverflow.com/comment/43496537
type: QuestionComment
comment on: http://stackoverflow.com/q/27534062
type: Comment
has text: the classes are in a different file in the same folder I forgot to mention it
score: 0

http://stackoverflow.com/comment/43526422
comment on: http://stackoverflow.com/q/27549969
has text: @hfontanez In method evalGame(): `if(checkWin(b, p)) { return 1; } else if(checkWin(b, p == X ? O : X)) { return -1; } else { return 0; }` I think `return 0` means that it's a draw.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43665799
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27622205
has text: @kha You can cancel the task even from inside the doInBackground method.
type: Comment

http://stackoverflow.com/q/27620050
has comment: http://stackoverflow.com/comment/43661260
tagged with: methods
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43660875
tagged with: java
accepted answer: http://stackoverflow.com/a/27620624
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43661077
has title: Parameter class like a class
answer count: 1
has comment: http://stackoverflow.com/comment/43661581
has body: I want do a GenericDao pass by parameter Entity but I don´t know how to convert Entidad to Object. I tried put GenericDaoWithOrder&lt;Entidad extends Object&gt; but does not work. public abstract class GenericDao&lt;Entidad&gt; { @PersistenceContext private EntityManager em; public List&lt;Entidad&gt; findAll(Integer start, Integer maxResult) { TypedQuery&lt;Entidad&gt; query = em.createNamedQuery(Entidad.class.getCanonicalName() + ".findAll", Entidad.class); query.setFirstResult(start); query.setMaxResults(maxResult); return query.getResultList(); } }
has comment: http://stackoverflow.com/comment/43661130
tagged with: generics
has answer: http://stackoverflow.com/a/27620624

http://stackoverflow.com/comment/43532924
type: QuestionComment
score: 3
has text: Please check if `ConfigurationBean` or some of the return values are generic as well. Not providing generic parameters here might cause the compiler to deactivate them in the method call as well.
comment on: http://stackoverflow.com/q/27553258
type: Comment

http://stackoverflow.com/q/27563721
answer count: 2
has comment: http://stackoverflow.com/comment/43553113
has comment: http://stackoverflow.com/comment/43553412
score: 0
tagged with: matrix
has answer: http://stackoverflow.com/a/27563987
has title: How to correctly do matrices input in java
has comment: http://stackoverflow.com/comment/43553140
has answer: http://stackoverflow.com/a/27564052
has comment: http://stackoverflow.com/comment/43552990
tagged with: multidimensional-array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43553085
has comment: http://stackoverflow.com/comment/43553501
has comment: http://stackoverflow.com/comment/43553838
has body: I have a problem. I am trying to make a program where a user will type in r=row c=column and after that 0's and 1's as long as the matric is full So it will create a picture .... r*v ...., filled with char's 1's and 0's. Those 1's represent blocks. Now the program should output how many blocks are in that picture? (00010011110 - example for the first row of random matrix)- that would print out 2 I am struggling to correctly do the input of that program and after that count the number of those blocks. This is what I had been trying so far. import java.util.Scanner; class Blocks{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int rowNum=sc.nextInt(); //number of rows int columnNum=sc.nextInt(); //number of columns int blocks=0; char[][] matrix=new char[rowNum][columnNum]; for (int a = 0; a &lt; rowNum; a++) { for (int b = 0; b &lt; columnNum; b++) { char[] row= sc.next().toCharArray(); for(int i=0; i&lt;matrix.length;i++) { if(row[i]=='1'){ blocks++; if(row[i+1]=='1') { blocks--; } } } } } }
tagged with: java
has comment: http://stackoverflow.com/comment/43553290
type: Question
has comment: http://stackoverflow.com/comment/43553207

http://stackoverflow.com/a/27511211
has comment: http://stackoverflow.com/comment/43490569
has comment: http://stackoverflow.com/comment/43490376
has comment: http://stackoverflow.com/comment/43490330
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27509961
type: Answer
has comment: http://stackoverflow.com/comment/43490209
accepted answer of: http://stackoverflow.com/q/27509961
has body: in c:forEach... tag use the Set's .toArray() method. or instead of returning a Set in the getter, you can return the Set's array return chosenLessons.entrySet().toArray();

http://stackoverflow.com/a/27485493
has body: When you don't select any 'basicEducation' in the form and you are saving form then there is new object there with empty id. So you have: jobseekerDetails.basicEducation = new JobseekerFormBasicEducation () This causes TransientObjectException To avoid it you have to set jobseekerDetails.basicEducation=null before saving.
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43406422
accepted answer of: http://stackoverflow.com/q/27484985
answers question: http://stackoverflow.com/q/27484985
score: 0

http://stackoverflow.com/comment/43465173
score: 0
has text: @MadProgrammer how would i know the min and max values? and what would i use as a variable to use in the graph in reading the wav file?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27517265

http://stackoverflow.com/q/27571189
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43572147
has title: Convert a JavaScript string array into a Java string array
linked to: http://stackoverflow.com/q/17440164
linked to: http://stackoverflow.com/q/8853986
has comment: http://stackoverflow.com/comment/43568315
has comment: http://stackoverflow.com/comment/43568089
tagged with: java
duplicate of: http://stackoverflow.com/q/8853986
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/43567890
score: 0
has body: I'm using Apache Tomcat for my study project and I want to convert a JavaScript array into a Java array. Is that possible? I saw some questions before but that didn't really answer my question. If there's a way to do that, would you like to give a little explanation?

http://stackoverflow.com/comment/43593895
score: 0
type: AnswerComment
has text: Exactly. This is the output I want.
type: Comment
comment on: http://stackoverflow.com/a/27584584

http://stackoverflow.com/comment/43576194
score: 0
type: Comment
type: QuestionComment
has text: You are looking for [Bounded Type Parameters](http://docs.oracle.com/javase/tutorial/java/generics/bounded.html).
comment on: http://stackoverflow.com/q/27575353

http://stackoverflow.com/q/27517529
tagged with: java
has body: I am trying to install Maven on a Mac following the instructions here; http://maven.apache.org/download.cgi#Installation_Instructions. However I couldn't figure out how to Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.7.0_51 and that $JAVA_HOME/bin is in your PATH environment variable. My Java JDK is stored on desktop, so should I use the command? export JAVA_HOME=/users/alex/desktop/jdk1.7.0_45 After I've done that, should the JAVA_HOME/bin be in my path environment variable? It did work. The error message when I run maven --version says Error: JAVA_HOME is not defined correctly. We cannot execute /users/alex/desktop/jdk1.7.0_45/bin/java I am quite confused with the whole process. Many thanks for your help in advance. Really appreciate it.
type: Question
score: 0
answer count: 1
tagged with: variables
has answer: http://stackoverflow.com/a/27517585
linked to: http://stackoverflow.com/q/7501678
has comment: http://stackoverflow.com/comment/43465323
type: UnansweredQuestion
tagged with: path
tagged with: maven
has title: Problems with Maven installation
tagged with: installation

http://stackoverflow.com/a/27629028
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27628954
has body: From Class SimpleDateFormat Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes. A pattern containing any invalid pattern letter will result in a thrown exception during formatting or parsing. Thus your line of code df = new SimpleDateFormat("MM/dd/yy HH:mm"); will throw an exception because of the /. Try putting the / in single quotes. df = new SimpleDateFormat("MM'/'dd'/'yy HH:mm"); Also like @DavidColer's answer states, you never initialize your Date object. Update After testing it turns out that df = new SimpleDateFormat("MM/dd/yy HH:mm"); will work without the single quotes. I should have taken a look at Oracle's documentation here. You need to either create an instance of your BankAccount class by passing a double, like so BankAccount ba = new BankAccount(100.0); or add a default constructor in your class. Like the following. public BankAccount() { this(0.25); }

http://stackoverflow.com/a/27541165
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27539610
has body: If you are having ContextLoaderListener in your web.xml spring will load the generalApplicationContext.xml first. This will create beans and provide them all Servlets and Filters. This xml should have the common classes, beans which are used in your application. Later spring container will load the specificApplicationContext.xml, because you have load on startup in the servlet config. If you don't specify the load on start up, this specificApplicationContext.xml will load when the first request comes to your application with the specific url-pattern. As your question when you move you springconfig from one config to another this will change the application resource availability to the container. If you specify the Controller beans in generalApplicationContext.xml and you don't specify them in specificApplicationContext.xml then your DispatcherServlet wont find the mappings, so you will see 404 error. If you want to create some bean objects on-demand you can create one more servlet-config to load that specific specificConfigurationFile2.xml, and map to the url-pattern.

http://stackoverflow.com/comment/43608205
type: AnswerComment
has text: Actually, the URL with the parameters she passed is not formatted as HTML but as CSV. Well, nearly.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27591898

http://stackoverflow.com/a/27495578
score: 2
answers question: http://stackoverflow.com/q/27495525
downvote count: 0
upvote count: 2
type: Answer
has body: It's because you're returning the array from the method create, and when you attempt to print it, the display is what Jigar Joshi described. Simply calling Arrays.toString(list) will not reformat the array so that it will give the output that you expect when you try to print it. If you want it to print the elements of the array, have your method return String instead, and use return Arrays.toString(list).

http://stackoverflow.com/a/27602058
type: Answer
has body: @Vivek has aptly answered your question. But, if you still want to open a link in a new window, you can try the below code for that: Actions act = new Actions(); WebElement link = driver.findElement(By.xpath("//xpath of the link")); //Opening the link in new window (works in FF and Chrome) act.contextClick(link).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform(); And you can switch in between them accordingly, with the use of handles. Furthermore, this link will help you handle two windows simultaneously.
answers question: http://stackoverflow.com/q/27601227
score: 0

http://stackoverflow.com/comment/43403101
comment on: http://stackoverflow.com/q/27484339
has text: you can also see it follows the PECS principle. Coll is a provider of T, so it uses extends
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27561957
favorite count: 0
tagged with: anonymous-class
tagged with: anonymous-inner-class
accepted answer: http://stackoverflow.com/a/27622961
has body: When I attempt to create a new anonymous Action subclass inside the initialization of an anonymous subclass of its containing class's containing class, Netbeans suddenly fails to find the main class when running, despite being able to clean+build with no problem and to run with this code commented out. Code structure: Main package: Main class &lt;-- currently looking at this file public void run(...) (called in main(String[] args)) Actor a = new Actor() { Script script = new Script(); { (Actor instance initiation code) script.new Action(0) {...} causes breakage Package actor public abstract class Actor public class Script public abstract class Action Replicated in a simple class: package tests; public class ClassTester { public static void main(String[] args) { ClassTester tester = new ClassTester(); tester.run(); } public void run() { final Inner1 A = new Inner1() { { B = this.new Inner2() { @Override public void run() { System.out.println("Hello, world!"); } }; } }; A.B.run(); } public class Inner1 { public Inner2 B; public abstract class Inner2 implements Runnable { } } } --&gt; Error: Could not find or load main class tests.ClassTester Java Result: 1 Interestingly, -XX:+PrintCompilation reveals that something runs before the crash: 50 1 java.lang.String::hashCode (55 bytes) 50 2 java.lang.String::charAt (29 bytes) Error: Could not find or load main class tests.ClassTester Java Result: 1 Product Version: NetBeans IDE 7.3.1 (Build 201306052037) Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Cleaning and building and restarting Netbeans have not resolved the problem. Is this fixable or a bug in Netbeans?
has comment: http://stackoverflow.com/comment/43549743
score: 4
has comment: http://stackoverflow.com/comment/43550029
type: AnsweredQuestion
tagged with: netbeans
tagged with: inner-classes
has comment: http://stackoverflow.com/comment/43550298
has comment: http://stackoverflow.com/comment/43550450
has comment: http://stackoverflow.com/comment/43550714
has comment: http://stackoverflow.com/comment/43576802
has title: Netbeans fails to find main class when creating anonymous subclass of inner class of anonymous subclass
type: Question
has comment: http://stackoverflow.com/comment/43550061
tagged with: java
has comment: http://stackoverflow.com/comment/43571742
has comment: http://stackoverflow.com/comment/43550751
upvote count: 4
has answer: http://stackoverflow.com/a/27622961
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/43684847
has text: Ok Can you please help me with that actually I want to print that on TSC printer how can I do that ?
score: 0
comment on: http://stackoverflow.com/q/27632323
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43412530
score: 2
has text: Change your String[] to ArrayList<String>
comment on: http://stackoverflow.com/a/27475899
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/47076191
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28718588
type: AnswerComment
has text: It is hackish. Unfortunately it's the only way I got it to work :C

http://stackoverflow.com/comment/43465619
has text: Firstly you must have an collection to use foreach. Please look at this; http://stackoverflow.com/questions/85190/how-does-the-java-for-each-loop-work and also this; http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html
comment on: http://stackoverflow.com/q/27517803
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/43798641
type: AnswerComment
has text: Thank you man, this is it.. i didn't even look to the xml in a WEEK
type: Comment
comment on: http://stackoverflow.com/a/27692709
score: 0

http://stackoverflow.com/a/27640805
score: 0
answers question: http://stackoverflow.com/q/27638490
type: Answer
has body: actually you don't really need the play/activator bloat to create and compile play apps. Install sbt Create a new folder for your app &amp; a sub folder called project $ mkdir -p newapp/project Create a sbt build script in the newapp/project folder $ vi newapp/project/plugins.sbt Add the play framework repos (shown below) to your plugins.sbt file be sure to update the x in the addSbtPlugin version number to your desired version. Example: "2.2.3" // The Typesafe repository resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" // Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.x") Create a new file called build.sbt in the root of yournewapp folder $ vi build.sbt Add the following build information to your build.sbt file but remember to update some of the parameter values to match your app's values: import play.Project._ name := "My first application" version := "1.0" playScalaSettings Launch your new play app $ cd newapp $ sbt After the project is loaded &amp; dependencies are fetched you will have a fully functional play app with out having to download the bloated Activator packages.
has comment: http://stackoverflow.com/comment/43713288
has comment: http://stackoverflow.com/comment/43914802

http://stackoverflow.com/a/27481892
type: Answer
has comment: http://stackoverflow.com/comment/43397437
has comment: http://stackoverflow.com/comment/43397341
answers question: http://stackoverflow.com/q/27481284
has comment: http://stackoverflow.com/comment/43396872
has comment: http://stackoverflow.com/comment/43396526
score: 4
upvote count: 4
has body: You can use method sheet.addMergedRegion(rowFrom,rowTo,colFrom,colTo); find its doc on offical site. Example: sheet.addMergedRegion(new CellRangeAddress(1,1,4,1)); This will merge from B2 to E2 Rough Estimate for you try this A2:A8: sheet.addMergedRegion(new CellRangeAddress(1,9,0,0);
downvote count: 0

http://stackoverflow.com/comment/43654633
has text: Okay, I just http://kalblogs.blogspot.in/2009/01/java.html this article, now understand why j.l.p is not enough for linux sys. Its like `jcef_helper` needs `libcef.so` but as we are setting j.l.p which resolves library (jcef_helper) but this library references or is dynamically linked another file (libcef.so) which is not loaded by setting j.l.p THOUGH BOTH FILES ARE IN SAME DIR I.E /home/ubuntu/Desktop/bin, where as L_L_P loads all the libraries with its referenced or dynamically linked files.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27615955

http://stackoverflow.com/q/27534426
has body: we are currently writing a REST service with jax-rs where we are caching the DB entities(javax.persistence.Entity) i.e.object representation of a table in database, in the redis server. Before even putting the objects to redis we serialize the objects to json via jackson and when we need the entity object we deserialize it after fetching from redis. I want to know whether there is a faster/more performant way of doing serialization and deserialization. I am ok if somebody suggest a more performant way without converting the object to human readable format like json and also i don't want the intra language interoperability. Please let me know if somebody needs some more details on this. Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/27535134
has comment: http://stackoverflow.com/comment/43497393
downvote count: 1
type: Question
has title: High performance serialization and deserialization to cache objects in redis
has answer: http://stackoverflow.com/a/27542529
upvote count: 5
tagged with: jackson
score: 4
has answer: http://stackoverflow.com/a/27537010
answer count: 3
has comment: http://stackoverflow.com/comment/43498600
has comment: http://stackoverflow.com/comment/43501594
has comment: http://stackoverflow.com/comment/43499746
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/135997150
tagged with: redis
type: UnansweredQuestion

http://stackoverflow.com/comment/43429021
has text: It seems I had accidentally assumed ~ resolved to home when opening files. That should have been obvious. Thanks you for your replies
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27498954

http://stackoverflow.com/q/27584431
tagged with: playframework
has answer: http://stackoverflow.com/a/27671604
upvote count: 1
accepted answer: http://stackoverflow.com/a/27671604
has title: Java Play2.3: object controllers.Map is not a value
answer count: 1
favorite count: 0
has body: Building a java application using Playframework 2.3.6 with jdk1.8 When attempting to compile my application (using "activator ~run"), the following error is thrown: /website/conf/routes:12: object controllers.Map is not a value [error] GET /assets/*file controllers.Assets.at(path="/public", file) [error] one error found [error] (compile:compile) Compilation failed My routes file is the following: # Home page GET / controllers.Application.home() POST / controllers.Application.resultsPage() # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.at(path="/public", file) I've tried adjusting things all over the application and searching the web, but have had no luck figuring out what seems to be a fairly basic issue. Not really sure where to begin, so please let me know if more information is needed. UPDATE: The closest I've found to "information" about this on the internet is that a similar "object Map is not a value" error shows up when someone is importing the Java Map function into a scala file. And while I am using the Map function in certain controllers, I can't see where that would be conflicting with Scala or where I'm wrong importing the map.
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/43465630
has text: Come on, you've got to try to solve it yourself first, else you're just cheating yourself out of what matters the most -- the opportunity to learn something, to challenge yourself. So please let's see a post of your best attempt before someone spoon feeds you an answer.
score: 6
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27517803

http://stackoverflow.com/a/27596099
has comment: http://stackoverflow.com/comment/43616176
answers question: http://stackoverflow.com/q/27595913
upvote count: 1
has comment: http://stackoverflow.com/comment/43616399
score: 1
has comment: http://stackoverflow.com/comment/43616196
has comment: http://stackoverflow.com/comment/43616388
has body: A ScrollView can only have one child.
downvote count: 0
has comment: http://stackoverflow.com/comment/43616303
has comment: http://stackoverflow.com/comment/43616054
type: Answer
has comment: http://stackoverflow.com/comment/43616319

http://stackoverflow.com/a/27582892
type: Answer
answers question: http://stackoverflow.com/q/27582822
score: 0
has body: Java deals with Object reference, if you need to copy the object, you need to consider cloning (a.k.a deep copy). Also, Favour interfaces over implementations, so use List instead of ArrayList.

http://stackoverflow.com/q/27600188
has title: TestNG code compliling error
tagged with: eclipse
score: 0
has body: I'm new to java/testNg I'm trying to run code that you enter a persons number and then that user will be added into the database via the webpage. Although the code allows me to enter the msisdn the actions are not executed via the webpage. The following is my code : package firsttestng1; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; //adding subscriber class public class subscribers { public String baseUrl = "http://testpage.ie"; public WebDriver driver = new FirefoxDriver(); public String msisdn; //set members number public void setSubscriber(String subscribrNmbr){ msisdn=subscribrNmbr; } //get subscribers number public String getSubscriber(){ return msisdn; } //adding subscriber method which should enter the subscribers number once it is entered public void addMembers(){ waitForElement("[title=\"Run\"]",false); driver.findElement(By.linkText("Policy")).click(); waitForElement("[title=\"SPCM\"]",false); driver.findElement(By.linkText("Memebers")).click(); waitForElement("[title=\"Memembers Mgmt\"]",false); driver.findElement(By.linkText("MemberMgmt")).click(); waitForElement("[title=\"Subscribers\"]",false); driver.findElement(By.linkText("Members Page")).click(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.id("add_label")).click(); driver.findElement(By.id("subscriberIdentifier.msisdn")).click(); driver.findElement(By.id("subscriberIdentifier.msisdn")).sendKeys(""+getSubscriber()); driver.findElement(By.id("subscriberIdentifier.imsi")).click(); driver.findElement(By.id("subscriberIdentifier.imsi")).sendKeys(""+getSubscriber()); driver.findElement(By.id("subscriberIdentifier.imsi")).click(); driver.manag…
has comment: http://stackoverflow.com/comment/43623336
has comment: http://stackoverflow.com/comment/43624904
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: selenium
type: Question
has comment: http://stackoverflow.com/comment/43623525

http://stackoverflow.com/q/27561213
has title: removing last char comma not working
has answer: http://stackoverflow.com/a/27561302
answer count: 2
has comment: http://stackoverflow.com/comment/43548980
favorite count: 0
has comment: http://stackoverflow.com/comment/43548920
upvote count: 1
has comment: http://stackoverflow.com/comment/43549135
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43548992
has answer: http://stackoverflow.com/a/27561734
score: 0
tagged with: java
downvote count: 1
has body: I am trying to remove last char of comma from a string using java.Here is my code, //String feature=rs.getString("getvaluesfromDB"); String feature="Games-About Myself,Intro About Myself"; String [] b = feature.split("[\\-:\\;:\\,]"); for(int i=0;i<b.length;i++) { ResultSet rs2 = st2.executeQuery("select * from videonameslist where videoname='"+b[i]+"'"); if(rs2.next()) { sbf.append("").append(b[i]).append(",").append("").append(" "); } else { sbf.append(b[i]).append(",").append(" "); } System.out.println("befor remove comma :"+sbf1); String sbf1 = sbf.toString(); if (sbf1.endsWith(",")) { sbf1 = sbf1.substring(0, sbf1.length() - 1); System.out.println("after removing comma, the string is :"+sbf1); } else { System.out.println("Sorry there some proble in removing! :"+sbf1); } Actually i am creating href tag to which data found from DB values.finally i am getting out put is, before remove comma :About Myself, Intro About Myself, or sometimes output comes like this, before remove comma :Five senses, Sense of touch, and condition always goes to else part. Evan i tried String sbf1 = sbf.toString(); sbf1 = sbf1.substring(0, sbf1.length() - 1); and if (sbf1.endsWith("")) { sbf1 = sbf1.substring(0, sbf1.length() - 2); } else { } But no use where i am wrong and how to fix this? (I am new to java)
type: Question
possible better answer: http://stackoverflow.com/a/27561302
accepted answer: http://stackoverflow.com/a/27561734

http://stackoverflow.com/a/46545788
score: 8
has comment: http://stackoverflow.com/comment/124718389
has body: Here is my implementation by using LinkedHashMap in AccessOrder. It will move the latest accessed element to the front which only incurs O(1) overhead because the underlying elements are organized in a doubly-linked list while also are indexed by hash function. So the get/put/top_newest_one operations all cost O(1). class LRUCache extends LinkedHashMap&lt;Integer, Integer&gt;{ private int maxSize; public LRUCache(int capacity) { super(capacity, 0.75f, true); this.maxSize = capacity; } //return -1 if miss public int get(int key) { Integer v = super.get(key); return v == null ? -1 : v; } public void put(int key, int value) { super.put(key, value); } @Override protected boolean removeEldestEntry(Map.Entry&lt;Integer, Integer&gt; eldest) { return this.size() &gt; maxSize; //must override it if used in a fixed cache } }
answers question: http://stackoverflow.com/q/27475797
downvote count: 0
upvote count: 8
type: Answer

http://stackoverflow.com/a/27627077
has comment: http://stackoverflow.com/comment/43755355
has comment: http://stackoverflow.com/comment/43677263
answers question: http://stackoverflow.com/q/27626959
upvote count: 3
has comment: http://stackoverflow.com/comment/43760577
accepted answer of: http://stackoverflow.com/q/27626959
has comment: http://stackoverflow.com/comment/43797389
has comment: http://stackoverflow.com/comment/43755446
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/44648567
has comment: http://stackoverflow.com/comment/43764877
has body: First do not use Workbench this is an internal class and must not be used. Use PlatformUI to get the workbench. IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); if (editor instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor)editor; IDocumentProvider provider = textEditor.getDocumentProvider(); IEditorInput input = editor.getEditorInput(); IDocument document = provider.getDocument(input); String text = document.get(); ... } Note: Not all editors are text editors so this needs to be checked (the ITextEditor instance check above).
has comment: http://stackoverflow.com/comment/43796732
type: Answer
has comment: http://stackoverflow.com/comment/43696313
has comment: http://stackoverflow.com/comment/43801672
has comment: http://stackoverflow.com/comment/43686625
downvote count: 0
has comment: http://stackoverflow.com/comment/43802357
score: 3

http://stackoverflow.com/comment/43499862
has text: by android version you mean the version to which I am compiling to, because there is no box for those exact words
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27535660

http://stackoverflow.com/comment/43411740
type: Comment
comment on: http://stackoverflow.com/a/27490068
has text: No need to use `SimpleDateFormat`. `Calendar#get` is fine and faster.
type: AnswerComment
score: 1

http://stackoverflow.com/a/28302363
score: 0
has body: I finally managed to solved it by editing the jar class in question (added few extra whitespaces) so it won't be the same with the similar deleted class in the main program. I saved the edited library jar and recompiled it (not the jar but the program that depends on the api. I also restarted the machine. This difference, finally recognize the class in library.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27579411
accepted answer of: http://stackoverflow.com/q/27579411

http://stackoverflow.com/comment/43547432
score: 0
type: QuestionComment
type: Comment
has text: Those will definitely help you, as well as probably some looping construct like a `for` loop.
comment on: http://stackoverflow.com/q/27560699

http://stackoverflow.com/a/27483636
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27483494
score: 0
has body: Yes you are using try with resource (using JDK 7 or above) so your prepared statement would be closed automatically. See this page for your reference. PreparedStatement/Connection does implement AutoCloseable interface internally which makes perfect sense to use it with try with resource block. You could try something like: public void doDbOperation(int id) { try (Connection con = DriverManager.getConnection(myConnectionURL); PreparedStatement ps = createStatement(con, userId); ResultSet rs = ps.executeQuery()) {//auto close processResults(rs); } catch (SQLException e) { e.printStackTrace(); } return users; } private PreparedStatement createStatement(Connection con, int id) throws SQLException { String sql = "SELECT myid FROM table WHERE id = ?"; PreparedStatement ps = con.prepareStatement(sql); ps.setInt(1, id); return ps; } private void processResults(ResultSet rs) { // business logic }

http://stackoverflow.com/q/27585212
has body: I have a java .jar library, and from there i'm trying to access a file of my Android project with: InputStream inputStream = getClass().getResourceAsStream("/folder/data.txt"); someMethod(inputStream); // inputStream is null But the inputStream is always null. I'm confused about where should i put my /folder/data.txt in order to be able to find it from the .jar. From within the .jar project i can find the data.txt, doing the following in eclipse: MyProject &gt; properties &gt; java build path &gt; libraries &gt; Add class folder and this code: InputStream inputStream = getClass().getResourceAsStream("/data.txt"); // without the folder This is the structure of the Java Project: MyJavaProject - src - com.example - something.java - folder - data.txt Now, inside the Android Project i try to do the same but i keep getting null (inputStream): MyAndroidProject - src - several packages - folder - data.txt - libs - my jar Where should i put my data.txt? or should i change something in my .jar I've read a lot of similar questions but i haven't found a solution. I've also read about getResourceAsStream() but i'm obviously not getting it.
accepted answer: http://stackoverflow.com/a/27585293
has title: getResourceAsStream() returning null
has comment: http://stackoverflow.com/comment/43594909
answer count: 2
tagged with: jar
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/27585231
has answer: http://stackoverflow.com/a/27585231
tagged with: android
has answer: http://stackoverflow.com/a/27585293
tagged with: getresource
has comment: http://stackoverflow.com/comment/43595564
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43595055
downvote count: 1
type: Question

http://stackoverflow.com/q/27508151
answer count: 1
has comment: http://stackoverflow.com/comment/43446881
has title: How does Maven manage duplicate artifactIds when they belong to a different group?
favorite count: 0
type: UnansweredQuestion
tagged with: maven
score: 2
has comment: http://stackoverflow.com/comment/43451517
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43447344
has body: I'm building some different web projects with Maven and thinking about how to name their artifacts. For the REST API layer, it's convenient to share some classes, so I want to create exchange-api.jar files which will be shared among different projects. Let's suppose I've got a web application which has it's own exchange-api module. The groupId would be com.mycompany.app1 so the whole maven id for the artifact should be com.mycompany.app1:exchange-api:1.0. Now let's suppose I want to access other app's API from this application. I have to include the dependency com.mycompany.app2:exchange-api:1.0. artifactIds are the same, but the groupId is different. However, both should end up as exchange-api-1.0.jar in the classpath. How does Maven take care of this? Should I use a unique artifactId for each of them?
has answer: http://stackoverflow.com/a/27509822
upvote count: 2

http://stackoverflow.com/a/27779902
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27589941
upvote count: 2
has body: You need to set the center point of the image- tapping on an annotation will depend on this value. // add an annotation with an image file SKAnnotation annotation = new SKAnnotation(13); annotation.setLocation(new SKCoordinate(-122.434516, 37.770712)); annotation.setMininumZoomLevel(5); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); if (metrics.densityDpi &lt; DisplayMetrics.DENSITY_HIGH) { // set the center point of the image - tapping on an annotation will depend on this value . Also the actual gps coordinates of the annotation will be in the center of the image. annotation.getOffset().setX(16); annotation.getOffset().setY(16); annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().getMapResourcesPath() + "/.Common/poi_marker.png"); // set the size of the image in pixels annotation.setImageSize(32); } else { // set the center point of the image - tapping on an annotation will depend on this value . Also the actual gps coordinates of the annotation will be in the center of the image. annotation.getOffset().setX(32); annotation.getOffset().setY(32); annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().getMapResourcesPath()+ "/.Common/poi_marker_retina.png"); // set the size of the image in pixels annotation.setImageSize(64); } mapView.addAnnotation(annotation,SKAnimationSettings.ANIMATION_NONE);
type: Answer

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/27505807
tags question: http://stackoverflow.com/q/27572836
tags question: http://stackoverflow.com/q/27595425
type: Tag

http://stackoverflow.com/q/27554016
favorite count: 0
accepted answer: http://stackoverflow.com/a/27554190
score: 0
has title: Objects override each other
has comment: http://stackoverflow.com/comment/43534488
possible better answer: http://stackoverflow.com/a/27554189
has comment: http://stackoverflow.com/comment/43534693
has comment: http://stackoverflow.com/comment/43534353
has comment: http://stackoverflow.com/comment/43534357
tagged with: extends
has comment: http://stackoverflow.com/comment/43534443
has comment: http://stackoverflow.com/comment/43534685
has comment: http://stackoverflow.com/comment/43534384
has comment: http://stackoverflow.com/comment/43534789
downvote count: 1
type: Question
tagged with: object
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43534362
has answer: http://stackoverflow.com/a/27554189
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43534563
has body: I have the class GameObject: public class GameObject{ private Coordinate coordinates; public GameObject(){ coordinates = new Coordinate(); } public void setCoordinates(int x, int y){ coordinates.x = x; coordinates.y = y; } //More methods here } public class Coordinate{ public int x, y; public Coordinate(){ } public Coordinate(int x, int y){ this.x = x; this.y = y; } public void setCoordinate(int x, int y){ this.x = x; this.y = y; } And two classes Champion and Spell: public class Spell extends GameObject{ //Some methods } public class Champion extends GameObject{ //Some methods public Spell fireBall = new Spell(); } And in my main class: Champion character = new Champion(); If I call character.setCoordinates(200, 300); (just random numbers), the character goes to these exact coordinates. But the Spell fireBall also goes to (200, 300). So the coordinates in Spell are overriden by the setCoordinates(int x, int y) call to character. How is this possible? TL;DR - Two classes from GameObject, Spell extends GameObject and Champion extends GameObject, override eachother coordinates. Why? For full source code: GameObject.java Spell.java Champion.java Coordinate.java
has answer: http://stackoverflow.com/a/27554190

http://stackoverflow.com/comment/43691133
has text: Try to send: `System.getProperty("line.separator");`.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27635928

http://stackoverflow.com/a/27597004
has comment: http://stackoverflow.com/comment/43617698
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43617805
has comment: http://stackoverflow.com/comment/43621624
has comment: http://stackoverflow.com/comment/43617788
has comment: http://stackoverflow.com/comment/43617729
type: Answer
answers question: http://stackoverflow.com/q/27596904
upvote count: 2
has body: You could use the below regex to get the key value pair. ([a-zA-Z0-9]+):"(.*?)(?&lt;!\\)" OR ([a-zA-Z0-9]+):"(.*?)"(?=,[a-zA-Z0-9]+:"|$) DEMO Java regex would be, "([a-zA-Z0-9]+):\"(.*?)(?&lt;!\\\\)\"" (?&lt;!\\)" negative lookbehind asserts that the double quotes won't be preceeded by a backslash character. In java, to match a backslash character, you need to escape the backslash in your pattern exactly three times, ie, \\\\ DEMO String s = "joe:\"Look over there\\, it's a shark!\",sam:\"I like fish.\""; Matcher m = Pattern.compile("([a-zA-Z0-9]+):\"(.*?)(?&lt;!\\\\)\"").matcher(s); while(m.find()) { System.out.println(m.group(1) + " --&gt; " + m.group(2)); } } Output: joe --&gt; Look over there\, it's a shark! sam --&gt; I like fish. OR String s = "joe:\"Look over there\\, i\\\"t's a shark!\",sam:\"I like fish.\""; Matcher m = Pattern.compile("([a-zA-Z0-9]+):\"((?:\\\\\"|[^\"])*)\"").matcher(s); while(m.find()) { System.out.println(m.group(1) + " --&gt; " + m.group(2)); } } Output: joe --&gt; Look over there\, i\"t's a shark! sam --&gt; I like fish.

linear-equation
tags question: http://stackoverflow.com/q/27613188
tag name: linear-equation
type: Tag

http://stackoverflow.com/comment/43509729
type: AnswerComment
has text: If you want to watch cmd, you should pause cmd.
type: Comment
comment on: http://stackoverflow.com/a/27540667
score: 0

http://stackoverflow.com/q/27595425
favorite count: 0
has title: Error when setting a click listener to a button
tagged with: android
score: -3
type: AnsweredQuestion
upvote count: 0
tagged with: onclicklistener
tagged with: java
has comment: http://stackoverflow.com/comment/43614650
type: Question
has body: I'm trying to add an onClick() for a button declared in my activity_main layout but when I try to declare a button in the MainActivity.java, I get the error: The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (MainActivity) I've searched the error and found solutions stating to import the following import android.view.View.OnClickListener; but that didn't fix the problem. Can anyone spot what is wrong with my implementation? Here is the code to declare the button and the accompanying case statement: protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button mClickButton1 = (Button)findViewById(R.id.cameraBtn); mClickButton1.setOnClickListener(this); Button mClickButton2 = (Button)findViewById(R.id.searchBtn); mClickButton2.setOnClickListener(this); } //handle button clicks public void onClick(View v) { switch (v.getId()) { case R.id.cameraBtn: { // start camera intent Toast.makeText(this, "camera clicked", Toast.LENGTH_SHORT).show(); break; } case R.id.searchBtn: { // search tree for matching debri Toast.makeText(this, "search clicked", Toast.LENGTH_SHORT).show(); break; } } }
has answer: http://stackoverflow.com/a/27595462
accepted answer: http://stackoverflow.com/a/27595462
downvote count: 3
answer count: 1

http://stackoverflow.com/comment/43660757
type: AnswerComment
has text: I mean if a thread is updating, say, 50 rows per second, or if it is updating the same row multiple times in a short period of time, then you should accumulate those updates, rather than making a separate sql call each time a row needs to be updated, which is what it sounds like you are doing, because your db updates are taking more time than data processing. Also inspect your schema for inefficiencies. It is very suspicious that your updates take this long. Are you using a connection pool? You should. Check it's configuration too.
type: Comment
comment on: http://stackoverflow.com/a/27604388
score: 0

http://stackoverflow.com/q/27634005
score: -1
has comment: http://stackoverflow.com/comment/43687744
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43687580
has comment: http://stackoverflow.com/comment/43687846
has comment: http://stackoverflow.com/comment/43687778
has title: Get the value of count for the duplicate string
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/27634047
type: Question
upvote count: 0
has body: I want to count the value of distinct user. This is my logfile. In log file if remote address is same for the two request then it will count it as one request because it comes from one user. So how can I check the duplicate value of remote address in java. Request Date: Wed Dec 24 06:01:46 IST 2014 LATITUDE: 22.3007861 LONGITUDE: 73.1426661 remote address: 106.78.195.239 Remote Host: 106.78.195.239 Case1 :Response sent Request Date: Wed Dec 24 06:01:55 IST 2014 LATITUDE: 22.3007861 LONGITUDE: 73.1426661 remote address: 106.78.195.239 Remote Host: 106.78.195.239 Case1 :Response sent Request Date: Wed Dec 24 07:20:26 IST 2014 LATITUDE: 22.2828575 LONGITUDE: 73.180606 remote address: 49.14.205.199 Remote Host: 49.14.205.199 Case1 :Response sent Request Date: Wed Dec 24 07:20:37 IST 2014 LATITUDE: 22.2828575 LONGITUDE: 73.180606 remote address: 49.14.205.199 Remote Host: 49.14.205.199 Case1 :Response sent

http://stackoverflow.com/q/27639620
favorite count: 0
has answer: http://stackoverflow.com/a/27639872
has body: I compile the list: titleList.add(0, title), apply it in sharedpreferences: prefs.putString(TITLES, title).apply() and now need to retrieve it. I have looked at a lot of the solutions here and none seem to fit my problem well. The program is suppose to take text a user inputs and save it using SharedPreferences, so it can be used in a ListActivity later. This list is currently an ArrayList (I believe I need it in an array list because I am using AutoCompleteEditText for suggestions from the array list, so I need the adapter). Based on the above logic,prefs is a sharedpreference object full of string objects. I have tried using prefs.getAll().values.toArray(new String[0...100]). I found that in an "Android" book. It works, but only gets the first item. After trying methods, Set&lt;?&gt; and a few others, that was the method that got anything at all. It is all I need to have the program working PERFECTLY. Can someone please help getting this list to save in sharedpreferences, retrieving it as a complete, split, list (that can be indexed) and passing it to a ListActivity? ArrayList&lt;String&gt; titleList = new ArrayList&lt;&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_make_lyric); autoCompleteAdapter = new ArrayAdapter&lt;&gt;( this, android.R.layout.simple_list_item_1, titleList ); lyricTitle.setAdapter(autoCompleteAdapter); lyricTitle.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // load in song when selected from auto-complete list lyricHolder.setText(openSongFile(lyricTitle.getText().toString())); } }); saveBtn = (Button) findViewById(R.id.saveBtn); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { performSave(); } }); titlePref = getSharedPreferences(titlePrefFile, MODE_PRIVATE); //titleList = titlePref.getAll()…
has title: How to use ArrayList<String> for saving/retrieving in sharedpreferences
upvote count: 1
has answer: http://stackoverflow.com/a/27639807
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43697968
has comment: http://stackoverflow.com/comment/43698336
tagged with: java
linked to: http://stackoverflow.com/q/11640122
downvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27639807
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/27639872

http://stackoverflow.com/q/27603400
score: 1
has title: Changing image of ImageView using file chooser
tagged with: java
tagged with: javafx
type: Question
has body: I'm trying to change the Image of the ImageView by using a FileChooser here is my code: import java.io.File; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; import javafx.stage.FileChooser; public class MainController implements Initializable { @FXML private AnchorPane anchorPane; @FXML private ImageView imageView; private FileChooser fileChooser = new FileChooser(); @Override public void initialize(URL location, ResourceBundle resources) { fileChooser.setInitialDirectory(new File(System.getProperty("user.home"))); } @FXML public void onButton() { File file = fileChooser.showOpenDialog(anchorPane.getScene().getWindow()); if(file != null) { System.out.println(file.getAbsolutePath()); imageView.setImage(new Image(file.getAbsolutePath())); } } } And the path is right when i choose an image it will print out from where i choose it. But im getting this error: Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1762) at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1645) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.…
has comment: http://stackoverflow.com/comment/43629045
has comment: http://stackoverflow.com/comment/43629036
upvote count: 1
has comment: http://stackoverflow.com/comment/43629130
favorite count: 0
type: UnansweredQuestion
answer count: 0
downvote count: 0

http://stackoverflow.com/a/27526848
has comment: http://stackoverflow.com/comment/43511005
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/43483352
answers question: http://stackoverflow.com/q/27526670
has comment: http://stackoverflow.com/comment/43488262
score: 3
has body: Your code doesn't compile, because you are trying to re-assign a val. A val can only be initialized once and cannot be re-assigned. Also, your code is not very Scala-like, because you are using null and return. You should use Option instead of null for values that can potentially be empty. null really only exists for interoperability with Java and should be avoided in pure Scala code. You do not need to use the return keyword; the last expression that's executed in a method is automatically the method's return value. This would be a better implementation (still using null - you'll need to modify your Node class to get rid of that): def inorder(node: Node): String = if (node == null) "" else inorder(node.leftChild) + node.label + inorder(node.rightChild) When using Option: case class Node(leftChild: Option[Node], label: String, rightChild: Option[Node]) def inorder(node: Option[Node]): String = node map { n =&gt; inorder(n.leftChild) + n.label + inorder(n.rightChild) } getOrElse "" Example use: scala&gt; val tree = Node(Some(Node(None, "left", None)), "root", Some(Node(None, "right", None))) tree: Node = Node(Some(Node(None,left,None)),root,Some(Node(None,right,None))) scala&gt; inorder(Some(tree)) res2: String = leftrootright
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27526670

http://stackoverflow.com/a/27550169
type: Answer
answers question: http://stackoverflow.com/q/27530800
has body: What about adding a new field to the Command object, create a field for this, and then use JavaScript to populate this value on what value is selected?
score: 0

http://stackoverflow.com/comment/43557320
type: QuestionComment
has text: @kamino dont really understand what you are tellign me im afraid
score: 0
comment on: http://stackoverflow.com/q/27565458
type: Comment

http://stackoverflow.com/comment/43508389
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27538960
has text: Oh I see.could you provide SourceFilter.java and PFGeneralFilter.java full source??
type: AnswerComment

http://stackoverflow.com/a/27606598
type: Answer
has comment: http://stackoverflow.com/comment/43640224
answers question: http://stackoverflow.com/q/27606506
has comment: http://stackoverflow.com/comment/43635367
has comment: http://stackoverflow.com/comment/43635541
has comment: http://stackoverflow.com/comment/43635381
score: 0
has body: You can call start from LAST static block.
has comment: http://stackoverflow.com/comment/43635569
has comment: http://stackoverflow.com/comment/43635474

http://stackoverflow.com/a/27605897
answers question: http://stackoverflow.com/q/27603141
has body: You can mark a bean with the @Primary annotation to specify, that it should have priority as an autowire candidate. The javadoc is for Spring 4, but the documentation for Spring 3.2 also mentions that annotation.
has comment: http://stackoverflow.com/comment/43634397
score: 0
type: Answer

http://stackoverflow.com/comment/43636987
comment on: http://stackoverflow.com/a/27607166
score: 0
type: Comment
type: AnswerComment
has text: Ok. Updated. Hope it will be everythink needed. Compilation error came when method configureMessageConverters was protected. Making it public resolve it.

http://stackoverflow.com/comment/43682997
comment on: http://stackoverflow.com/q/27631316
type: Comment
type: QuestionComment
has text: Why are you doing an if/else with 'true' as the condition?
score: 5

http://stackoverflow.com/comment/43531513
type: AnswerComment
has text: Thanks @forgivenson, and why we add for(int j = 0; j < twodim[i].length; j++) for second inner array, i mean twodim[i].length?
score: 0
comment on: http://stackoverflow.com/a/27552272
type: Comment

http://stackoverflow.com/a/27616645
score: 1
has body: Yes, In byte code you can create an instance of a object and call any constructor in the hierarchy. In truth, a constructor is a special method and it is even call it more than once. Many deserializers just use Unsafe.allocateInstance() and don't call any constructors. This is done to minimise side effects when deserializing.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27616585
answers question: http://stackoverflow.com/q/27616585
type: AcceptedAnswer
downvote count: 0

spring-hateoas
tags question: http://stackoverflow.com/q/27531634
tag name: spring-hateoas
tags question: http://stackoverflow.com/q/27494779
type: Tag

http://stackoverflow.com/q/27565697
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/43556474
has answer: http://stackoverflow.com/a/27565979
downvote count: 0
score: 1
tagged with: java
has title: Errors after building project using maven
type: Question
has answer: http://stackoverflow.com/a/27565923
answer count: 2
upvote count: 1
has body: I followed the following tutorial (https://github.com/kolorobot/spring-mvc-quickstart-archetype) and imported the project to eclipse. However, i am getting the following errors in my pom.xml file, and also in all the java classes. I have attached the screenshot. POM.xml Java classes I have updated my Post PROBEM VIEW
has comment: http://stackoverflow.com/comment/43556839
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43556586
tagged with: maven
tagged with: spring
linked to: http://stackoverflow.com/q/6352208

http://stackoverflow.com/comment/43407546
comment on: http://stackoverflow.com/q/27487901
type: QuestionComment
type: Comment
score: 2
has text: The assignment seems self contradictory; you said that `InvoicePrinter` is the only class you can modify, but the `Invoice.format` and `InvoiceFormatter.format` methods are asking you to implement them.

http://stackoverflow.com/q/27600226
has comment: http://stackoverflow.com/comment/43624294
has comment: http://stackoverflow.com/comment/43623409
favorite count: 0
has answer: http://stackoverflow.com/a/27600482
type: Question
has body: I am trying to run some unit tests on a project that has already been developed. I pulled it on to my system into the git repositories and then built it on the command line. It all succeeded and all the tests run, however, inside eclipse I seem to be getting an error (I think a data error rather than a Java error). This is what I think the error message is: org.springframework.dao.DataIntegrityViolationException: Duplicate entry '11' for key 'line_item_ref_number_unique'; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Duplicate entry '11' for key 'line_item_ref_number_unique' I am not very good at debugging and would struggle to get to the problem that way. I will post more code on at request but do not want to bombard the question area with potential unnecessary code. This might not be very helpful what I have said so far but anyone got any solutions or advice?
has comment: http://stackoverflow.com/comment/43624099
score: 0
answer count: 3
upvote count: 1
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27600312
type: UnansweredQuestion
tagged with: eclipse
has answer: http://stackoverflow.com/a/27600339
has title: Eclipse gives errors I can't understand

http://stackoverflow.com/comment/43556299
type: Comment
has text: Doesn't work, if I remove the (') SQL assumes - is a subtraction signal. I'm trying with (\') now
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27565551

http://stackoverflow.com/q/27618862
type: UnansweredQuestion
tagged with: java
tagged with: wikipedia
tagged with: mysql
type: Question
score: 0
tagged with: wikipedia-api
has answer: http://stackoverflow.com/a/27625565
has body: E.g. Here is a link http://en.wikipedia.org/wiki/Brad_Pitt_filmography which lists all the films of brad Pitt in table format. I want grab the table content. Query-> http://en.wikipedia.org/w/api.php?action=query&amp;titles=Brad_Pitt_filmography&amp; what other parameters will come in the query ? How can I store it in MySQL Database using Java
answer count: 1
has title: Interacting with Wikipedia's API: grabbing the content of the table present on a page
tagged with: mediawiki-api

http://stackoverflow.com/a/27582184
has body: Ok, so if you want to change value of the connected component you start out in this should work. public class Example { public static void main(String[] args) { int[][] b = { {0, 0, 0, 0, 1}, {1, 1, 0, 0, 1}, {1, 1, 1, 0, 1}, {1, 0, 1, 0, 1} }; rec(b, 0, 4); for (int[] row : b) { System.out.println(Arrays.toString(row)); } } public static void rec(final int[][] grid, final int row, final int col) { if (grid[row][col] != 1) return; grid[row][col]++; if (row-1 &gt;= 0) rec(grid, row-1, col); if (row+1 &lt; grid.length) rec(grid, row+1, col); if (col-1 &gt;= 0) rec(grid, row, col-1); if (col+1 &lt; grid[0].length) rec(grid, row, col+1); } } Note that depending of how big your components are you might run out of stack. Either you'd then have to manage your own stack explicitly in the code or you would need to increase the stack space available to the JVM.
type: Answer
accepted answer of: http://stackoverflow.com/q/27581641
has comment: http://stackoverflow.com/comment/43593254
answers question: http://stackoverflow.com/q/27581641
has comment: http://stackoverflow.com/comment/43594136
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43669642
type: QuestionComment
has text: Post a minimal, complete, verifiable example. Post the full exception stack trace. Are you having trouble registering the click? Or creating the jFrame? What is `this`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27624526

http://stackoverflow.com/comment/43455674
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27512418
has text: I don't see where your `Person` objects are initialized, but it's possible that you used the no-arg constructor and you didn't call the setter methods. But if that's not the case, then you can ask another question outside of this one.
type: Comment

http://stackoverflow.com/q/27604220
score: 0
answer count: 1
tagged with: powermock
type: UnansweredQuestion
has body: im trying to use power mocking to test my class this is my class: public Basket createBasket(Basket basket) { if (LOGGER.isInfoEnabled()) { LOGGER.info("In BasketInformationServiceImpl.createBasket : [" + basket.toString() + "]"); } try { if (StringUtils.isBlank(basket.getBasketAdditionsAllowedInd())) { basket.setBasketAdditionsAllowedInd("Y"); } this is my test: public void testCreateBasketCallsSetBasketAdditionsAllowedIndInBasket(){ PowerMockito.mockStatic(StringUtils.class); when(StringUtils.isBlank(mockBasket.getBasketAdditionsAllowedInd())).thenReturn(true); basketInformationServiceImpl.createBasket(mockBasket); verify(mockBasket,times(1)).setBasketAdditionsAllowedInd(anyString()); } and the error i get is: org.mockito.exceptions.missing.WrongTypeOfReturnValue; Boolean cannot be returned by getBasketAdditionsAllowedInd() getBasketAdditionsAllowedInd() should return string does anyone know why i am getting this error and how to overcome it? p.s. using power mock as StringUtils is a static class
has answer: http://stackoverflow.com/a/27605401
tagged with: java
has title: Why will this powermock not work even though it is syntactically correct?
type: Question
tagged with: mocking
tagged with: mockito

http://stackoverflow.com/comment/43597588
type: Comment
comment on: http://stackoverflow.com/a/27586475
score: 1
type: AnswerComment
has text: I understand where you're coming from, but it's not a question of whether it's possible to make the cache operation (which is essentially what you're imitating here) safe. It's a question of how much it costs in terms of time and energy to write it that way, and then make sure no one ever changes it. At this point, I'd say the calculation would have to be phenomenally expensive to justify the amount of work that's required simply to not have to run it twice.

http://stackoverflow.com/a/27577310
has body: name = input.split(","); By calling the above line for each line you read in the file you will be overwriting the contents of your array each time. If this is not what you want to do then I suggest using an ArrayList (which will scale in size dynamically). ArrayList&lt;String[]&gt; name = new ArrayList&lt;String[]&gt;(); Then simply call name.add(input.split(",")); for each line read from file.
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27576978
downvote count: 0
answers question: http://stackoverflow.com/q/27576978
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/43521967
type: Comment
comment on: http://stackoverflow.com/a/27524659
score: 0
type: AnswerComment
has text: You can search, there are several free fonts sites available. like https://www.google.com/fonts

http://stackoverflow.com/comment/43658755
score: 0
has text: Yes basically that. If there's a better way to do it then what I have been doing it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27618767

http://stackoverflow.com/a/27566247
score: 2
has body: Try this (explanations are in the code) public static void main(String[] args) { //assuming the stringbuilder has the contents below (each line ending in space followed by a newline character) final StringBuilder sb = new StringBuilder(); sb.append("0 1 1 1 0 0 0 0 \n"); sb.append("1 0 0 0 0 0 0 0 \n"); sb.append("1 0 0 0 0 0 0 0 \n"); sb.append("1 0 0 0 1 0 1 0 \n"); sb.append("0 0 0 1 0 1 0 0 \n"); sb.append("0 0 0 0 1 0 0 0 \n"); sb.append("0 0 0 1 0 0 0 1 \n"); sb.append("0 0 0 0 0 0 1 0 \n"); //extract each line from the sb by splitting after the newline character \n final String[] rows = sb.toString().split("\n"); //each line represent a row, so the numbers of lines is the number of rows in our matrix final int totalRows = rows.length; //the lenght of each line, if we replace space with nothing, represents the number of columns //columns have the same number of elements for each line so we can read it from the first row, row[0]. it will be the same for all the others final int totalColumns = rows[0].replace(" ", "").length(); //create matrix with proper size final int[][] matrix = new int[totalRows][totalColumns]; //initialize first row index int currentRow = 0; //initialize first column index int currentColumn = 0; for (String row : rows) { //for each row row = row.substring(0, row.length() - 1); //remove last space character final String[] elements = row.split(" "); //store each element of the row in an array by splitting after the space character for (final String element : elements) { //for each element //add element in matrix at correct position matrix[currentRow][currentColumn] = Integer.parseInt(element); //convert string to int //increment column count for the next element currentColumn++; } //increment row count for the next row currentRow++; //reset column counter for the next row currentColumn = 0; } //display the matrix for (int i = 0; i &lt; totalRows; i++) { for (int j = 0; j &lt; totalColumns; j++) { if (j == 7) { //if last column add a newline …
has comment: http://stackoverflow.com/comment/43557639
answers question: http://stackoverflow.com/q/27565668
has comment: http://stackoverflow.com/comment/43557835
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43557751
has comment: http://stackoverflow.com/comment/43557928
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27565668
has comment: http://stackoverflow.com/comment/43557701
type: Answer

http://stackoverflow.com/q/27582822
tagged with: hashtable
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43590132
accepted answer: http://stackoverflow.com/a/27582867
has comment: http://stackoverflow.com/comment/43590111
has body: I have the following code: podmienky.put(key, podmienkyOblast); podmienkyOblast.clear(); podmienky is HashTable&lt;String, ArrayList&lt;String&gt;&gt; and podmienkyOblast is ArrayList&lt;String&gt;. If I put podmienky.get("index").size() before podmienkyOblast.clear() it returns 6 as it should. However if I put podmienky.get("index").size() after podmienkyOblast.clear() it returns 0. I thought that if I put something to hashtable I actualy add content of it to it. But as I can see it is storing only reference to arrayList. Am I wrong? How should I make this work? Thanks in forward
tagged with: arraylist
has title: Arraylist.clear() deletes content of hashTable
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27582892
has answer: http://stackoverflow.com/a/27582867
has answer: http://stackoverflow.com/a/27582892
type: Question
answer count: 2

http://stackoverflow.com/q/27489344
has answer: http://stackoverflow.com/a/27490070
accepted answer: http://stackoverflow.com/a/27490070
has answer: http://stackoverflow.com/a/27489718
type: Question
upvote count: 1
has title: Single database connection for web application
favorite count: 0
has body: I am developing a simple CRUD application, using JDBC to establish connection and perform basic CRUD operations. In that process, created a DatabaseListener to create a connection object at startup and storing it in the context attribute for reuse. Below is the code. import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.log4j.Logger; public class DatabaseInitListner implements ServletContextListener { private static final Logger LOG = Logger.getLogger(DatabaseInitListner.class); private DBUtil databaseUtil = null; @Override public void contextDestroyed(ServletContextEvent event) { databaseUtil.closeConnection(); } @Override public void contextInitialized(ServletContextEvent contextinitEvent) { ServletContext servletContext = contextinitEvent.getServletContext(); String database = servletContext.getInitParameter("db_name"); String url = servletContext.getInitParameter("db_url") + database; String username = servletContext.getInitParameter("db_user"); String password = servletContext.getInitParameter("db_password"); String driverName = servletContext.getInitParameter("db_driver"); databaseUtil = new DBUtil(url, username, password, driverName); servletContext.setAttribute("databaseSingleConnectionObject", databaseUtil.getConnection()); } } public class DBUtil { private Connection connection = null; private static final Logger LOG = Logger.getLogger(DatabaseUtil.class); public DatabaseUtil(String url, String username, String password, String driver) { try { Class.forName(driver); this.connection = DriverManager.getConnection(url, username, password); LOG.debug("Connection Established... "); } catch (ClassNotFoundException | SQLException e) { LOG.error("Could not create connection... ", e); } } public Connection getConnection() { return connection; } public void closeConnection() { if (connection != null) { try { connection.close(); } catch (SQLException e) { LOG.error("Unable to clos…
answer count: 3
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/27489718
tagged with: listener
downvote count: 0
has answer: http://stackoverflow.com/a/27489707
tagged with: web-applications
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/27513072
has comment: http://stackoverflow.com/comment/43457381
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27515321
type: Question
tagged with: jstl
accepted answer: http://stackoverflow.com/a/27515321
answer count: 1
downvote count: 0
tagged with: jsp
has title: JSTL c:set a bean property with an array, wrong setter method being called
favorite count: 0
tagged with: el
has body: So I am using &lt;c:set&gt; to set the value of an object. The problem is there are two setter methods with the same name, the wrong one is being called. In my JSP i have this: &lt;c:when test="${not empty paramValues.tag }"&gt; &lt;c:set target="${listing }" property="tags" value="${paramValues.tag }" /&gt; &lt;/c:when&gt; Now, we know that ${paramValues.tag} is a string array as defined here (http://docs.oracle.com/javaee/1.3/api/javax/servlet/ServletRequest.html#getParameterValues(java.lang.String)). I have verified this by outputting ${paramValues.tag} and was able to iterate over the values using a foreach loop &lt;c:forEach var="test" items="${paramValues.tag}"&gt; In my java class i have the following: public void setTags(final String tagName) { LOG.debug("Setting tags from single tag string"); this.setTags(Arrays.asList(tagName)); } public void setTags(final String[] tagNames) { LOG.debug("Settings tags from tag array"); this.setTags(Arrays.asList(tagNames)); } The result i am seeing is that the log message "Setting tags from a single tag string" is called. So c:set is calling the setTags(String) method not the setTags(String[]) method. The "tagName" parameter that is passed is along the lines of "[Ljava.lang.String;@73f9e088" Why would it do this? Have i done something wrong? Thanks for your input.
type: AnsweredQuestion

http://stackoverflow.com/comment/43607916
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27583478
has text: @Gagravarr can you see my latest update i have tried as you told but i am getting nullpointer in header
type: Comment

http://stackoverflow.com/q/27478924
has comment: http://stackoverflow.com/comment/43391306
favorite count: 0
has comment: http://stackoverflow.com/comment/43391340
has body: I get some problem using spring MVC Here is my web.xml config contextConfigLocation /WEB-INF/classes/applicationContext.xml, /WEB-INF/classes/xfire-servlet.xml, /WEB-INF/classes/mvc-servlet.xml, classpath:org/codehaus/xfire/spring/xfire.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.util.IntrospectorCleanupListener mvc org.springframework.web.servlet.DispatcherServlet mvc *.do My controller is following @Controller @RequestMapping("/searchCase.do") public class SearchCaseController { public String getCaseDetailInfo() { return "forward:caseDetail"; } } and my mvc config is <context:component-scan base-package="com.thunisoft.shxt.webservice.model.searchCase.logic" /> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /> <property name="prefix" value="/WEB-INF/jsp/case" /> <property name="suffix" value=".jsp" /> Then I request through the url:http://{address:port}/{application-name}/searchCase.do,But it can't find the controller to resolve my request with No handler found in getLastModified DispatcherServlet with name 'mvc' processing request for [/{application-name}/searchCase.do] No mapping found for HTTP request with URI [/{application-name}/searchCase.do] in DispatcherServlet with name 'mvc' Successfully completed request My spring MVC version is 2.5.6 I'm waiting for your questions to help me solve this problem,thank you!
answer count: 5
has comment: http://stackoverflow.com/comment/43395251
has comment: http://stackoverflow.com/comment/43391958
has answer: http://stackoverflow.com/a/37520674
has comment: http://stackoverflow.com/comment/43392149
has answer: http://stackoverflow.com/a/27480523
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27479687
tagged with: spring
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27479822
upvote count: 5
tagged with: java
has title: Spring MVC - No mapping found for request URI?
has comment: http://stackoverflow.com/comment/62538215
has answer: http://stackoverflow.com/a/27488938
score: 5
has comment: http://stackoverflow.com/comment/43391347
has comment: http://stackoverflow.com/comment/43392284
downvote count: 0

terminate
tags question: http://stackoverflow.com/q/27475384
tags question: http://stackoverflow.com/q/27547555
tag name: terminate
type: Tag
tags question: http://stackoverflow.com/q/27505368

http://stackoverflow.com/a/27634519
score: 0
has body: For getting unique elements for your custom class you can just add all elements to something like HashSet. For using this you need to override the Object#hashCode() method to let it return the same hashCode() value x and y of MyObject instance. Don't forget to override Object#equals() as well. You can refer here for more on overriding hashCode() and equals().
type: Answer
has comment: http://stackoverflow.com/comment/43689635
answers question: http://stackoverflow.com/q/27634428

http://stackoverflow.com/comment/43531454
type: Comment
has text: @lbalazscs understood. So your saying the first way cannot possibly optimize to one of the later two ways assuming the foo1 and foo2 are completely independent of each other?
comment on: http://stackoverflow.com/a/27552450
type: AnswerComment
score: 0

http://stackoverflow.com/q/27516470
tagged with: android
possible better answer: http://stackoverflow.com/a/27516686
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43463418
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43463294
has comment: http://stackoverflow.com/comment/43463283
has comment: http://stackoverflow.com/comment/43463142
has answer: http://stackoverflow.com/a/27516686
score: 0
has comment: http://stackoverflow.com/comment/43463311
has body: I have three formats of text: Dan 3:52-56 Acts 6:8-10, 7:54-59 2 Sam 15:13-30, 16:5-13 Ideally, I want to be able to extract all the groups e.g. Dan, 3, 52 and 56 in any of the cases and I currently have: /(\S*)\s(\d*):(\d*)-(\d*)($|,\s(\d*):(\d*)-(\d*))/gmix ..which works, but doesn't capture the second case very well. Is there a better/more efficient way to do this?
has title: How to improve this Java regex?
has comment: http://stackoverflow.com/comment/43463347
has answer: http://stackoverflow.com/a/27516700
accepted answer: http://stackoverflow.com/a/27516700

http://stackoverflow.com/a/27581666
upvote count: 1
score: 1
has body: You dont need recursion for this .It is pretty straightforward.Also notice the way I have created a 2d array char[][] a = { {0, 0, 0}, {1, 1, 0}, {1, 1, 1}, {1, 0, 1 }}; for(int i = 0; i &lt; a.length; i++) for(int j = 0; j &lt; a[i].length; j++) { if(a[i][j] == 1) a[i][j] = 2; } } Would this work ?
downvote count: 0
has comment: http://stackoverflow.com/comment/43587681
answers question: http://stackoverflow.com/q/27581641
has comment: http://stackoverflow.com/comment/43588324
type: Answer

http://stackoverflow.com/q/27619951
tagged with: java
possible better answer: http://stackoverflow.com/a/27621143
tagged with: poi-hssf
has answer: http://stackoverflow.com/a/27621143
accepted answer: http://stackoverflow.com/a/27620096
score: 0
answer count: 2
has title: Using findSimilarColor to set a Background on Excel file
tagged with: hssf
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27620096
tagged with: palette
tagged with: excel
type: Question
has body: I'm having a little problem using the findSimilarColor on my java code. I already read some articles from the stackoverflow that helps me get to the following code. HSSFCellStyle style = wb.createCellStyle(); HSSFPalette palette = wb.getCustomPalette(); // get the color which most closely matches the color you want to use HSSFColor myColor = palette.findSimilarColor(226, 0, 116); //java don't recognize this color // get the palette index of that color short palIndex = myColor.getIndex(); // code to get the style for the cell goes here style.setFillForegroundColor(palIndex); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); style.setAlignment(HSSFCellStyle.ALIGN_CENTER_SELECTION); With that, I have no problem setting a color, except with the RGB color that I'm trying to use (226, 0, 116). For some reason, the color that show up when I open my excel file at the end is RGB (128, 0, 128). Does anybody have any ideas why is this happening? Or an alternative solution? Thanks for the help.

http://stackoverflow.com/comment/43852632
type: AnswerComment
comment on: http://stackoverflow.com/a/27599695
type: Comment
score: 0
has text: Thank you lowagie! It is working.Now we are using addParagraphWithTwoParts2(document,font,string1,string2),I want to know Is there any possibility to use the above function with Pragraph or phrase i.e addParagraphWithTwoParts2(Paragraph/Phrase,font,string1,string2).Please let me know!

http://stackoverflow.com/comment/43439497
type: QuestionComment
comment on: http://stackoverflow.com/q/27504186
score: 0
has text: Sorry I fotgot to mention.. I have corrected schemaLocation
type: Comment

http://stackoverflow.com/q/27504356
score: 3
has title: HibernateTemplate query with list
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/27514880
possible better answer: http://stackoverflow.com/a/27504546
has answer: http://stackoverflow.com/a/27504546
has body: Hibernate beginner here, this is probably a basic question. Say I have two hibernate objects: Employee and Department in a one-to-many relationship. One department can have many Employees. I have a List of Department objects and want to to retrieve all Employees that are in those departments. For example, in SQL it's easy: Select * from Employee where Employee.deptID in (1, 2, 6, 19); What is the correct and proper way to do this in a HibernateTemplate find? The example I've seen seems hopelessly verbose and involves creating a List of departmentIDs and then overriding executeFind(). Can I do this directly using the List&lt;Department&gt; instead of creating a list of object ids? //Verbose example List Employees = getHibernateTemplate().executeFind(new HibernateCallback&lt;List&gt;() { @Override public List doInHibernate(Session session) throws HibernateException, SQLException { Query query = session.createQuery( "select employee" + "from employee e " + "where e.deptID in (:ids) " ); query.setParameterList("ids", ids); return query.list(); } });
tagged with: sql
favorite count: 0
accepted answer: http://stackoverflow.com/a/27514880
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/27549336
possible better answer: http://stackoverflow.com/a/27549488
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27549715
favorite count: 0
accepted answer: http://stackoverflow.com/a/27549715
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43524943
has comment: http://stackoverflow.com/comment/43525129
upvote count: 3
tagged with: java
downvote count: 3
type: Question
has title: array reference expected exception in java
has body: Im just trying to create a new 2d array using existing 2d array call properties and new two values which is sourceURL and fetchURL. public static String[][] setProperties(String[][] properties, String sourceURL, String fetchURL) { String[][] propertyArray = new String[properties.length][]; for (int i = 0; i &lt;= properties.length; i++) { if (i &lt; properties.length) { propertyArray[i][0] = properties[i][0]; propertyArray[i][1] = properties[i][1]; } else { propertyArray[properties.length][0] = sourceURL; propertyArray[properties.length][1] = fetchURL; return propertyArray; } } return new String[0][]; } while I'm doing this I'm getting an exception saying "array reference expected" in the propertyArray[i][0] = properties[i][0]; line. Can some one help me to create this function?
has answer: http://stackoverflow.com/a/27549488
has answer: http://stackoverflow.com/a/27549493
tagged with: arrays

http://stackoverflow.com/comment/43469869
has text: it didn't work :(, Thanks for helping
score: 0
comment on: http://stackoverflow.com/q/27519932
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27556536
has body: I'm having trouble when trying to switch from a scene to another scene. The scenario is this: Current View and Controller: login.fxml and LoginController Next step View and Controller: loggedWindow.fxml and UserPanelController. Now, I'm in LoginController and trying to switch the scene to loggedWindow.fxml sending to UserPanelController a parameter, but when I'm using my code I get: javafx.scene.layout.Pane cannot be cast to javafx.fxml.FXMLLoader LoginController: FXMLLoader loggedWindow = null; loggedWindow = FXMLLoader.load(getClass().getResource("loggedWindow.fxml")); // here crashes! Pane root = loggedWindow.load(); UserPanelController controller = loggedWindow.getController(); controller.initData(customer); Stage switchScene = (Stage)((Node)event.getSource()).getScene().getWindow(); switchScene.setResizable(false); switchScene.setTitle("Welcome " + customer.FirstName + " " + customer.LastName); switchScene.setScene(new Scene(root, 800, 500)); switchScene.show(); LoggedWindow.fxml &lt;Pane maxHeight="500.0" maxWidth="800.0" minHeight="500.0" minWidth="800.0" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Main.UserPanelController"&gt; &lt;children&gt; &lt;ToolBar prefHeight="40.0" prefWidth="831.0"&gt; &lt;items&gt; . . stuff (buttons/labels and so on). . . &lt;/Pane&gt; I would appreciate any help! Thanks in advance. Update 1 Also took in consideration this reference: Accessing FXML controller class
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: javafx
linked to: http://stackoverflow.com/q/10751271
type: Question
has title: javafx.scene.layout.Pane cannot be cast to javafx.fxml.FXMLLoader
accepted answer: http://stackoverflow.com/a/27556698
has comment: http://stackoverflow.com/comment/43539518
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/27556698

http://stackoverflow.com/q/27504172
has comment: http://stackoverflow.com/comment/43439487
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43439385
possible better answer: http://stackoverflow.com/a/27504437
tagged with: java
tagged with: mysql
has body: i have a table called timesheet.In that i has below rows ID Status ProjId ActId Date 1 pending 1 1 2014-aug-07 2 denied 1 2 2014-aug-08 3 saved 1 3 2014-aug-09 4 approved 1 4 2014-aug-10 i have used below query for getting the desired result. SELECT * from tblTimesheet WHERE DATEPART(wk,spentDate) = 32 AND ((timesheetstatus = 'Pending' or timesheetstatus = 'Approved') and (timesheetstatus &lt;&gt; 'Saved' or timesheetstatus &lt;&gt; 'Denied')) My expected result for the above query is 0.But i get the result is 1. 5 pending 1 1 2014-aug-11 6 pending 1 2 2014-aug-12 7 approved 1 3 2014-aug-13 8 approved 1 4 2014-aug-14 this case my query works. SELECT * from tblTimesheet WHERE DATEPART(wk,spentDate) = 32 AND ((timesheetstatus = 'Pending' or timesheetstatus = 'Approved') and (timesheetstatus &lt;&gt; 'Saved' or timesheetstatus &lt;&gt; 'Denied')) My expected result for the above query is 1.I get the result is 1. How to write the query for above requirement in mssql. Scenario 1 is worked.But scenario2 is not worked. How to acheive the desired result. Any help will be greatly appreciated!!!
type: Question
has answer: http://stackoverflow.com/a/27504772
tagged with: sql-server
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/27504772
has comment: http://stackoverflow.com/comment/43439409
has title: How to check all values for a particular column in a week
has comment: http://stackoverflow.com/comment/43439330
tagged with: hibernate3
has answer: http://stackoverflow.com/a/27504437
has answer: http://stackoverflow.com/a/27505062
tagged with: spring

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/27544242
tag name: restful-architecture

http://stackoverflow.com/comment/43517182
comment on: http://stackoverflow.com/q/27544507
has text: Nope I've added, I checked it again
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43590447
type: Comment
type: QuestionComment
has text: This does not make use of XML,"then XMLWriter needs to write XML. There are many ways of doing that in Android" please provide me with one of these other ways to write XML files on android. Thanks in advance ...
score: 0
comment on: http://stackoverflow.com/q/27581005

paintcomponent
tags question: http://stackoverflow.com/q/27511977
tag name: paintcomponent
tags question: http://stackoverflow.com/q/27523920
tags question: http://stackoverflow.com/q/27640167
type: Tag
tags question: http://stackoverflow.com/q/27583800

http://stackoverflow.com/comment/43445385
type: QuestionComment
type: Comment
has text: Please ensure your Stack Overflow question is self-contained - incorporate that same information here, don't just link to another question website.
comment on: http://stackoverflow.com/q/27485069
score: 1

ssl
tags question: http://stackoverflow.com/q/27586088
tags question: http://stackoverflow.com/q/27597508
type: Tag
tags question: http://stackoverflow.com/q/27501819
tags question: http://stackoverflow.com/q/27633653
tags question: http://stackoverflow.com/q/27562289
tags question: http://stackoverflow.com/q/27639194
tags question: http://stackoverflow.com/q/27520572
tag name: ssl
tags question: http://stackoverflow.com/q/27556649
tags question: http://stackoverflow.com/q/27573192
tags question: http://stackoverflow.com/q/27499233
tags question: http://stackoverflow.com/q/27555859
tags question: http://stackoverflow.com/q/27559697
tags question: http://stackoverflow.com/q/27505954
tags question: http://stackoverflow.com/q/27576763
tags question: http://stackoverflow.com/q/27545644
tags question: http://stackoverflow.com/q/27518475
tags question: http://stackoverflow.com/q/27601467
tags question: http://stackoverflow.com/q/27614900
tags question: http://stackoverflow.com/q/27492367

http://stackoverflow.com/comment/43646579
type: Comment
has text: Thats where jscrollpane will come into picture . Add 10-11 elements and check
comment on: http://stackoverflow.com/a/27599789
type: AnswerComment
score: 0

aes
tags question: http://stackoverflow.com/q/27530102
type: Tag
tag name: aes

http://stackoverflow.com/a/27619939
score: 0
answers question: http://stackoverflow.com/q/27619785
type: Answer
has body: You need build the JAR with all Libs (dependences) includes. When you build your project in Eclipse, use the option 'Build with dependences'

http://stackoverflow.com/comment/43615488
score: 0
has text: And you can try also `telnet 10.0.0.27 20222` just to be sure there's no surprises. And if they don't work, try dumping your network config via `ifconfig -a` and paste it here. :)
comment on: http://stackoverflow.com/q/27536254
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43494581
type: Comment
comment on: http://stackoverflow.com/a/27515164
type: AnswerComment
score: 0
has text: Thanks for the update, that answered my question. And I think what u mentioned about keeping the application & pool mgt implementation separate is very important. So I might as well add a wrapper component. So if I get you right I should provide a service with interface 'DataSource' and the wrapper component class as an implementation. And bind this interface in the new instances of the classes I am creating & use the DataSource interface to create connections.

http://stackoverflow.com/q/27542297
favorite count: 0
has comment: http://stackoverflow.com/comment/43513537
accepted answer: http://stackoverflow.com/a/27542633
tagged with: android
tagged with: android-actionbar
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: I'm creating a MediaPlayer button in the ActionBar, wherein it is playing automatically when the app started and when I clicked it should be off. The problem now is that the sound is not playing and when I click the button there is an error in logcat saying... UPDATED LOGCAT. 12-18 19:04:57.812: E/MediaPlayer(5673): attachNewPlayer called in state 32 Here is the code.. public class MainActivity extends Activity{ private MediaPlayer mp; Item btnplay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mp = new MediaPlayer(); mp.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer arg0) { // TODO Auto-generated method stub isPlaying=false;//when the media file playing is completed isPlaying=false; is must } }); play(null);//you are calling play by launching } //inflate items in actionbar @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } boolean isPlaying = false; @Override public boolean onOptionsItemSelected(MenuItem item) { // toggle nav drawer on selecting action bar app icon/title if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } if (item.getItemId() == R.id.btnplay) //whatever you named in xml { play(item); } return super.onOptionsItemSelected(item); } public void play(MenuItem menuItem) { if (!isPlaying) { try { AssetFileDescriptor afd = getAssets().openFd("caketown.mp3"); mp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); mp.prepare(); mp.start();//play sound } catch(Exception e) { e.printStackTrace(); } isPlaying = true; } else if (isPlaying) { mp.pause(); isPlaying = false; } } Here is the menu &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context="com.example.xxx.MainActivity" &gt; &lt;item android:id="@+id/btnplay…
has title: Mediaplayer : pause called in state 1 - Android Eclipse
has answer: http://stackoverflow.com/a/27543338
type: Question
has comment: http://stackoverflow.com/comment/43512373
tagged with: android-mediaplayer
has answer: http://stackoverflow.com/a/27542633
possible better answer: http://stackoverflow.com/a/27543338
tagged with: eclipse
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/43559740
has text: I am facing following exception when I tried to execute query mentioned by you:java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode . I have added full stack-trace in question.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27526779
type: Comment

http://stackoverflow.com/comment/43555288
has text: I tried to put your words into code above to make it easier for others to follow.
comment on: http://stackoverflow.com/q/27564979
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27551793
tagged with: java
has comment: http://stackoverflow.com/comment/43536681
accepted answer: http://stackoverflow.com/a/27552149
has answer: http://stackoverflow.com/a/27574835
type: Question
answer count: 2
has body: Got this question during an interview. Wanted to know if there was a better solution: Given a sequence of prices of a stock as [p1, p2, p3, p4, …. pN]. Trader Joe is asked to buy 1 share of the stock at time i, and sell the same share at time j. His goal is maximize the time gap between the buy time and sell time but still profitable. For example, Trade Joe is given a sequence of prices in time order: Time,Price 10:00,10.3 10:01,10.1 10:02,11 10:03,13 10:04,9.5 10:05,7.3 10:06,8 10:07,10.2 10:08,9.8 If he buys the stock at 10:01, price = 10.1, and sells it at 10:07, price 10.2. He will make a profit of 0.1 and the time between the buy and sell would be 6 minutes. And this is the maximum time for this example. Input The first line contains the length of the sequence N. The next N lines contains the (time, price) pair: N Time1,price1 Time2,price2 … Output The maximum time between a profitable buy-then-sell pair of actions using the price sequence given Sample input (using either a file or stdin): 7 10:01,7 10:02,4 10:03,5 10:04,10 10:05,5 10:06,2 10:07,6 Sample output: 5 (This is using a buy at 10:02 ($4) and a sell at 10:07 ($6), the time delta is 10:07 – 10:02 = 5 minutes) The solution I proposed was O(N2), with a small optimization: for(int i = 0; i &lt; lines.size(); i++){ for(int j = lines.size()-1; j &gt;= 0; j--){ try { String[] partsFirst = lines.get(i).split(","); String[] partsLast = lines.get(j).split(","); String firstPriceString = partsFirst[1]; String lastPriceString = partsLast[1]; String firstDateString = partsFirst[0]; String lastDateString = partsLast[0]; double firstPriceInt = Double.parseDouble(firstPriceString); double lastPriceInt = Double.parseDouble(lastPriceString); Date date1 = format.parse(firstDateString); Date date2 = format.parse(lastDateString); long difference = date2.getTime() - date1.getTime(); //optimization if(difference &lt;= maxDuration) continue; if(lastPriceInt &gt; firstPriceInt &amp;&amp; (difference) &gt; maxDuration) maxDura…
linked to: http://stackoverflow.com/q/16849072
has answer: http://stackoverflow.com/a/27552149
favorite count: 0
has title: Longest Profitable Trade Algorithm
upvote count: 3
possible better answer: http://stackoverflow.com/a/27574835
downvote count: 0
type: AnsweredQuestion
score: 3
tagged with: algorithm

http://stackoverflow.com/comment/43598019
has text: Thanks for your reply. It looks like some lib in Intellij 13 didn't support the latest commit in golang plugin. I checkout the commit on previous version then it works. I'll try GoClipse later.
comment on: http://stackoverflow.com/q/27586785
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/66010704
score: 2
has comment: http://stackoverflow.com/comment/120202865
type: Answer
answers question: http://stackoverflow.com/q/27526941
has body: Example: android:name="com.google.android.gms.oss.licenses.OssLicensesActivity" android:screenOrientation="portrait" android:theme="@style/LicensesTheme" tools:ignore="MissingClass"/> You need to add tools:ignore="MissingClass"
upvote count: 3
downvote count: 1

http://stackoverflow.com/q/27498536
has answer: http://stackoverflow.com/a/27543431
type: Question
tagged with: abstract-syntax-tree
downvote count: 0
has title: Remove All Methodinvocation from JAVA Source AST
linked to: http://stackoverflow.com/q/22317911
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: eclipse-jdt
has body: Hi i find all Methodinvocation with ASTVisitor and will remove the all with ASTRewrite but when use "for loop" for remove methods, only remove first method invocation on ever call event. i guess problem reason don't refresh AST , CompiliationUnit , ICompilationUnit or ASTRewrite but i don't know when and how can refresh that for remove all in first event. static void createAST(ICompilationUnit unit) throws JavaModelException { // now create the AST for the ICompilationUnits CompilationUnit parse = parse(unit); MethodVisitor visitor = new MethodVisitor(); parse.accept(visitor); for (MethodInvocation metInv : visitor.getMethods1()) { try { //if declarated by user. if (metInv.resolveMethodBinding().getDeclaringClass().isFromSource()) { methodInvocRemove(unit, metInv); } } catch (Exception e) { System.out.println("EXCEPOTION:" + e.getMessage()); } } } this method for remove all MethodInvocations. private static void methodInvocRemove(ICompilationUnit unit, MethodInvocation met) { try { IProject project = unit.getJavaProject().getProject(); CompilationUnit astRoot = parse(unit); // create a ASTRewrite AST ast = astRoot.getAST(); ASTRewrite rewriter = ASTRewrite.create(met.getParent().getParent().getAST()); rewriter.remove(met.getName().getParent(), null); TextEdit edits; edits = rewriter.rewriteAST(); Document document = new Document(unit.getSource()); edits.apply(document); // this is the code for adding statements unit.getBuffer().setContents(document.get()); unit.getBuffer().close(); } catch (MalformedTreeException e) { System.out.println("EXP!!!" + e.getMessage()); } catch (BadLocationException e) { System.out.println("EXP!!!" + e.getMessage()); } catch (JavaModelException e) { System.out.println("EXP!!!" + e.getMessage()); } catch (IllegalArgumentException e) { System.out.println("EXP!!!" + e.getMessage()); } } this method for find method invocation with ASTVisitor. after every event on eclipse JDT call this method. public static void findMethod(IProject project) { …
tagged with: eclipse

http://stackoverflow.com/comment/114758202
has text: Thanks, I used your solution. I removed the sort not needed in my case.
type: AnswerComment
comment on: http://stackoverflow.com/a/50385938
type: Comment
score: 1

http://stackoverflow.com/q/27509701
has body: Basically I want change the JLabel's Label text during on-click the button 'Generate PDF Record Book' From the previous example says: label.setText("new value"); when I do that, the label value doesn't change at all, please give me some directions, thanks initialize(); JLabel lblNewLabel = new JLabel("513 k bytes"); lblNewLabel.setBounds(407, 713, 151, 14); frmViperManufacturingRecord.getContentPane().add(lblNewLabel); On button Generate PDF Record Book click JButton btnGeneratePdfHeader = new JButton("Generate PDF Record Book"); btnGeneratePdfHeader.setMnemonic('G'); btnGeneratePdfHeader.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { final JLabel lblNewLabel = new JLabel("513 k bytes"); //java.io.File file = new java.io.File(strdfile); //lblNewLabel.setSize(file.length()); //System.out.println(file.length()); String fileSize = file.length() + " k bytes"; System.out.println("I am here"); lblNewLabel.setText("new value"); } });
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/27509754
tagged with: swing
accepted answer: http://stackoverflow.com/a/27509754
type: AnsweredQuestion
score: 2
has title: Update the JLabel's label text during the event - Swing
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/comment/43519869
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27546036
type: Comment
has text: and what about entity classes (Person, Course, Attends)? Do I need them? And where would you say that they belong to? Model, View or Controller? Is there any possibility to be a DAO instead of MVC?

http://stackoverflow.com/a/27603587
answers question: http://stackoverflow.com/q/27602984
has comment: http://stackoverflow.com/comment/43629771
type: Answer
has comment: http://stackoverflow.com/comment/43629566
upvote count: 1
has body: How about: Find what: ^(\w+) (\w+) (\d+) Replace with: new ColumnData\(\U$1_$2_$3\E, "$1\\n $2\\n $3", String.class\); Check Regular expression and click on Replace all
downvote count: 0
score: 1

http://stackoverflow.com/q/27625611
has comment: http://stackoverflow.com/comment/43671695
has comment: http://stackoverflow.com/comment/43857768
score: 140
has answer: http://stackoverflow.com/a/27625722
has answer: http://stackoverflow.com/a/27625796
tagged with: random
has answer: http://stackoverflow.com/a/27626033
downvote count: 0
has body: Edit: So basically what I'm trying to write is a 1 bit hash for double. I want to map a double to true or false with a 50/50 chance. For that I wrote code that picks some random numbers (just as an example, I want to use this on data with regularities and still get a 50/50 result), checks their last bit and increments y if it is 1, or n if it is 0. However, this code constantly results in 25% y and 75% n. Why is it not 50/50? And why such a weird, but straight-forward (1/3) distribution? public class DoubleToBoolean { @Test public void test() { int y = 0; int n = 0; Random r = new Random(); for (int i = 0; i &lt; 1000000; i++) { double randomValue = r.nextDouble(); long lastBit = Double.doubleToLongBits(randomValue) &amp; 1; if (lastBit == 1) { y++; } else { n++; } } System.out.println(y + " " + n); } } Example output: 250167 749833
possible better answer: http://stackoverflow.com/a/27625796
upvote count: 140
favorite count: 0
has comment: http://stackoverflow.com/comment/43678547
has comment: http://stackoverflow.com/comment/43678891
answer count: 3
tagged with: double
has comment: http://stackoverflow.com/comment/43840948
accepted answer: http://stackoverflow.com/a/27625722
has comment: http://stackoverflow.com/comment/43678902
has comment: http://stackoverflow.com/comment/43847380
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43851209
tagged with: bit-manipulation
tagged with: probability
has comment: http://stackoverflow.com/comment/43857673
type: Question
has title: Why does this random value have a 25/75 distribution instead of 50/50?
tagged with: java

http://stackoverflow.com/q/27556919
accepted answer: http://stackoverflow.com/a/27557009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43540251
downvote count: 7
has body: I have doubt in using functions in java. I have wrote code for sum of natural numbers using a recursive function but I don't understand the error I am getting. I know it's a silly question though I'm a beginner and I need a brief explanation. Here is the code import java.util.Scanner; public class natural { public static int main(String args[]){ int a, s = 0,y; Scanner in = new Scanner(System.in); System.out.print("Enter the number:"); int x = in.nextInt(); public static int SN(y) { if(x==1) { return 1; } else{ int N = SN(x-1) + x; return N; System.out.println("THE SUM IS :"+x); } }
type: Question
has comment: http://stackoverflow.com/comment/43540006
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27557009
tagged with: function
upvote count: 0
score: -7
has title: Using functions in Java Programming
favorite count: 0
has answer: http://stackoverflow.com/a/27556938
has comment: http://stackoverflow.com/comment/43540030
possible better answer: http://stackoverflow.com/a/27556938

http://stackoverflow.com/q/27583623
has comment: http://stackoverflow.com/comment/138520423
has answer: http://stackoverflow.com/a/77782148
tagged with: chunking
has comment: http://stackoverflow.com/comment/43595372
has answer: http://stackoverflow.com/a/76388404
has title: Is there an elegant way to process a stream in chunks?
linked to: http://stackoverflow.com/q/39020335
has comment: http://stackoverflow.com/comment/138951101
answer count: 15
favorite count: 0
has answer: http://stackoverflow.com/a/73881323
has answer: http://stackoverflow.com/a/59164175
tagged with: java-stream
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78171997
has answer: http://stackoverflow.com/a/57695681
has answer: http://stackoverflow.com/a/38574499
linked to: http://stackoverflow.com/q/45649990
has answer: http://stackoverflow.com/a/50385938
has answer: http://stackoverflow.com/a/77782073
tagged with: java-8
has answer: http://stackoverflow.com/a/50367718
has answer: http://stackoverflow.com/a/68913656
has answer: http://stackoverflow.com/a/77390105
tagged with: java
has answer: http://stackoverflow.com/a/66669037
linked to: http://stackoverflow.com/q/30641383
type: Question
score: 93
has answer: http://stackoverflow.com/a/27595803
upvote count: 93
has body: My exact scenario is inserting data to database in batches, so I want to accumulate DOM objects then every 1000, flush them. I implemented it by putting code in the accumulator to detect fullness then flush, but that seems wrong - the flush control should come from the caller. I could convert the stream to a List then use subList in an iterative fashion, but that too seems clunky. It there a neat way to take action every n elements then continue with the stream while only processing the stream once?
downvote count: 0
has answer: http://stackoverflow.com/a/50386337

http://stackoverflow.com/comment/43633773
comment on: http://stackoverflow.com/a/27605688
type: AnswerComment
has text: Request Call Back is defined in my project. and i implement it in my activity
score: 0
type: Comment

http://stackoverflow.com/comment/43419637
type: QuestionComment
has text: Thanks @biziclop, I have several lamdas in there and all of them fail deserialisation when triggered individually. My problem is that the objects are so deep and that the exception is thrown from the core java libraries, which are tricky to debug. I've tried to recreate the problem using non wicket to no avail. There's something in the Wicket code that's highlighting the bug. I'll try and whittle it down tomorrow and perhaps provide a minimal example to see if others can get to the root and trigger the bug in core java code, with an end towards a good Eclipse bug report.
score: 1
comment on: http://stackoverflow.com/q/27488567
type: Comment

http://stackoverflow.com/q/27594032
accepted answer: http://stackoverflow.com/a/27594058
has answer: http://stackoverflow.com/a/27594054
downvote count: 0
possible better answer: http://stackoverflow.com/a/27594120
has title: Manipulating BigIntegers in Java
favorite count: 0
has answer: http://stackoverflow.com/a/27594120
answer count: 3
has answer: http://stackoverflow.com/a/27594058
type: AnsweredQuestion
has body: I have been working on a java program in which I need to calculate and store immense values into an array. So far, I get the value by plugging in an entered variable into an exponential function: Math.pow(7,x); I've decided to store the value into a BigInteger array, but I do not know how to store these regular manipulated values with the provided constructors BigInteger provides. For the 'x' value, I am actually using quite large numbers which launch the specified value over what longs can store. I seem to come full circle with every solution I think of...simply doing: bigArray[i] = new BigInteger((long)Math.pow(7,x)); Does not work, since I am dealing with values larger than 100 as x. What can I do?
tagged with: biginteger
upvote count: 3
type: Question
score: 3
tagged with: java

http://stackoverflow.com/comment/43662843
score: 0
comment on: http://stackoverflow.com/q/27621062
type: Comment
type: QuestionComment
has text: how are you sending the notification?

http://stackoverflow.com/q/27529411
tagged with: android
linked to: http://stackoverflow.com/q/17221381
duplicate of: http://stackoverflow.com/q/17221381
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27529538
score: -1
has title: how to round up currency to the nearest 50 cent in java?
tagged with: decimal
answer count: 2
has body: I created a simple android currency converter app where the user enters the value in euro and the converted price is displayed in other currencies. But how do I round up the numbers to the nearest 50 cent? so if 1 euro is equal to 1.3395 dollars how do I get the app to display 1.50 dollars? protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText editEuro = (EditText) findViewById(R.id.editEuro); final EditText editAud = (EditText) findViewById(R.id.editAud); final EditText editCad = (EditText) findViewById(R.id.editCad); final EditText editNzd = (EditText) findViewById(R.id.editNzd); final EditText editGbp = (EditText) findViewById(R.id.editGbp); final EditText editUsd = (EditText) findViewById(R.id.editUsd); Button buttonConvert = (Button)findViewById(R.id.buttonConvert); buttonConvert.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { double euro = Double.valueOf( editEuro.getText().toString()); double aud = euro * 1.4471 ; double cad = euro * 1.4635 ; double nzd = euro * 1.5835 ; double gbp = euro * 0.7965 ; double usd = euro * 1.3395 ; editAud.setText(String.valueOf(aud)); editCad.setText(String.valueOf(cad)); editNzd.setText(String.valueOf(nzd)); editGbp.setText(String.valueOf(gbp)); editUsd.setText(String.valueOf(usd)); } }); }
upvote count: 0
has comment: http://stackoverflow.com/comment/43487746
favorite count: 0
has comment: http://stackoverflow.com/comment/43487541
tagged with: currency
has answer: http://stackoverflow.com/a/27529550
linked to: http://stackoverflow.com/q/153724
type: UnansweredQuestion

http://stackoverflow.com/q/27595546
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27595574
tagged with: java
has title: Returning two integers with loops?
type: Question
score: 0
has answer: http://stackoverflow.com/a/27595553
favorite count: 0
has body: I'm a beginner doing a loop tutorial, and I've been given the below task "A battleship board is a 2-dimensional grid with coordinates like (0,0), (0,1), (0,2), etc. Create a method called PrintCoordinates(int x, int y),where x and y define the size of the board. Print all the possible coordinates in the board. Hint: loops can contain loops" DESIRED OUTPUT (9, 9): (0, 0) (0, 1) (0, 2) (0, 3) ... (0, 9) (1, 0) (1, 2) (1, 3) ... (9, 9) My code is below public class Ex3_PrintGrid { public static void main(String[] args) { int grid = printcoordinates(4, 7); System.out.println(grid); } public static int printcoordinates(int x, int y){ int n = 0; while ( n &lt; x){ int m = 0; while (m &lt; y){ m = m + 1; return m; } n = n + 1; } return n; } My rationale is to achieve the below steps 1) Get y coordinate value to increase by 1 until it is equal to the declared value in the method 2) In the meantime, the x value waits for the y value to increase before it increases on its own by one 3) The whole thing loops again with the new (x+1) value. Problem is I'm very confused on how I can do a loop within a loop that returns 2 integers within a single method? Do let me know if my question isn't clear UPDATE: I made a change to code based on the tips below and still got an error at the System.out.println line. Does anyone know what is wrong? public static void main(String[] args) { printcoordinates (4, 5); } public static int printcoordinates(int x, int y){ int n = 0; int m = 0; while ( n &lt; x){ while (m &lt; y){ m = m + 1; } n = n + 1; } System.out.println( n, m); }
accepted answer: http://stackoverflow.com/a/27595574
answer count: 3
possible better answer: http://stackoverflow.com/a/27595553
tagged with: integer
has answer: http://stackoverflow.com/a/27595583
upvote count: 1
tagged with: loops
has comment: http://stackoverflow.com/comment/43614951
downvote count: 1

facebook
tags question: http://stackoverflow.com/q/27581160
type: Tag
tags question: http://stackoverflow.com/q/27476581
tags question: http://stackoverflow.com/q/27617696
tags question: http://stackoverflow.com/q/27616501
tags question: http://stackoverflow.com/q/27591767
tags question: http://stackoverflow.com/q/27558346
tags question: http://stackoverflow.com/q/27520324
tag name: facebook
tags question: http://stackoverflow.com/q/27498576
tags question: http://stackoverflow.com/q/27578470
tags question: http://stackoverflow.com/q/27619566
tags question: http://stackoverflow.com/q/27633388
tags question: http://stackoverflow.com/q/27585271
tags question: http://stackoverflow.com/q/27558729
tags question: http://stackoverflow.com/q/27614545

http://stackoverflow.com/q/27585668
has body: I am using JavaFX 8 and specifically the TextArea control. In that control I can enter free form text including "tab" characters. When I enter a tab, the data is spaced in units of 8 characters. For example. In the following, the ! character is where I enter a tab: 1234567890123456789012345678901234567890 ! Data here ABC! Data here !! Data Here My puzzle is how to change the tab spacing/sizing for the visual so that instead of the tab size being 8 characters it will only be 4 characters. To further illustrate, here is an actual screen shot showing tabs in my text area: I want to leave the data as containing tab characters and not replace tabs with spaces. This Stack Exchange question does not apply as it talks exclusively about changing tabs to space: JavaFX TextArea: how to set tabulation width
type: Question
has answer: http://stackoverflow.com/a/71721347
has title: Setting the tab spacing/size visualization for a JavaFX TextArea
score: 4
has answer: http://stackoverflow.com/a/27595205
accepted answer: http://stackoverflow.com/a/27595205
tagged with: javafx-8
answer count: 3
possible better answer: http://stackoverflow.com/a/65173675
has comment: http://stackoverflow.com/comment/43609582
favorite count: 0
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/65173675
linked to: http://stackoverflow.com/q/13773483
has comment: http://stackoverflow.com/comment/43610032

http://stackoverflow.com/q/27558756
has answer: http://stackoverflow.com/a/27558961
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43543758
has comment: http://stackoverflow.com/comment/43543777
has comment: http://stackoverflow.com/comment/43543879
linked to: http://stackoverflow.com/q/7528045
score: 0
has comment: http://stackoverflow.com/comment/43543931
linked to: http://stackoverflow.com/q/4212675
accepted answer: http://stackoverflow.com/a/27558961
has title: Java parsing long lines of text into multiple lines
has comment: http://stackoverflow.com/comment/43543810
has body: I am new to programming and I would like some tips. I have a program that reads from a text file using the the following method: BufferedReader reader = new BufferedReader(new FileReader(file)); ..... This works but the problem is that some lines are long and I can't see all the text in the GUI. How should I tell Java to go to next line if length is equal to a certain amount? Example text: A week after Mozart died, his ghost was discovered trying to erase his music. When asked why, it said "I'm decomposing. Instead of two lines, I want to parse it into four lines. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/43543683
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27559649
has comment: http://stackoverflow.com/comment/43543806
tagged with: java
has comment: http://stackoverflow.com/comment/43543921
has answer: http://stackoverflow.com/a/27559649

http://stackoverflow.com/q/27571645
tagged with: post
type: Question
has answer: http://stackoverflow.com/a/27572337
downvote count: 0
answer count: 1
favorite count: 0
has title: HttpURLConnection getInputStream to read page, and then make POST request
tagged with: httpurlconnection
accepted answer: http://stackoverflow.com/a/27572337
upvote count: 3
has body: I trying to get page (HTML), read special token from it (it's different each time), and then send POST request, but that give me java.lang.IllegalStateException: connect in progress final URL url = new URL("&lt;...&gt;"); String token = null; final HttpURLConnection con = (HttpURLConnection) url.openConnection(); try (final InputStreamReader isr = new InputStreamReader(con.getInputStream())) { try (final BufferedReader in = new BufferedReader(isr)) { String str; while ((str = in.readLine()) != null) { if (str.contains("__token")) { token = str.replace("&lt;...&gt;", "").replace("&lt;...&gt;", ""); System.out.println(token); break; } } in.close(); } isr.close(); } con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setDoOutput(true); try (final DataOutputStream wr = new DataOutputStream(con.getOutputStream())) { final String params = getParams("par1", "par2", token); wr.writeBytes(params); wr.flush(); wr.close(); final int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + params); System.out.println("Response Code : " + responseCode); try (final BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) { String inputLine; final StringBuilder response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } } And this same if I try get this token from cookie: final String token=con.getHeaderField("Set-Cookie").replace("__Token=", "").replace("; path=/; HttpOnly", ""); How to do that properly?
type: AnsweredQuestion
score: 3
tagged with: cookies
tagged with: java

http://stackoverflow.com/comment/43463174
score: 2
has text: Yup, `KeyListener` does that. If you're using a `JApplet`, you can use the Key Bindings API instead, which resolves many of the issues revolving around `KeyListener`. See [How to Use Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) for more details...
comment on: http://stackoverflow.com/q/27516492
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/72275947
comment on: http://stackoverflow.com/a/27488808
type: AnswerComment
type: Comment
has text: @Zzz finally i modified it explicitly after job completion .and its working just fine for me now without any delay ,I have added code my answer also .Thanks
score: 1

http://stackoverflow.com/comment/43547549
has text: Are you having `googleplayservices` library project in your dependency list as well as `libGoogleAnalyticsServices.jar` in you dependencies list?
score: 0
comment on: http://stackoverflow.com/q/27560774
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27492795
has comment: http://stackoverflow.com/comment/43418090
tagged with: java
tagged with: file
type: Question
has body: I'm trying to get all .mp3 files from sdcard, even from the subfolders.. Here is the code I use.. final String MEDIA_PATH = Environment.getExternalStorageDirectory().getPath() + "/"; File home = new File(MEDIA_PATH); protected void onCreate(Bundle savedInstanceState) { ArrayList&lt;File&gt; songs = walkdir(home); } public ArrayList&lt;File&gt; walkdir(File dir) { String pattern = ".mp3"; File listFiles[] = dir.listFiles(); ArrayList&lt;File&gt; songs = new ArrayList&lt;File&gt;(); response.setText("listFiles : " + listFiles.length); if(listFiles != null) { for(File file : listFiles) { if(file.isDirectory()) { walkdir(file); } else { /////// Toast \\\\\\\\\\\\ Toast.makeText(MainActivity.this, "File : " + file.getName(), Toast.LENGTH_LONG).show(); if(file.getName().endsWith(pattern)) { songs.add(file); ////// This doesn't happen... response.setText("Found Song : " + file.getName()); } } } } return songs; } The weird thing that listFiles.length returns 10 and when I Toast files under the comment "Toast", I get more than 50 Toast, also.. I have a folder that contains more than 40 songs Arabic-English.. In In the Toast, I get the names of arabic songs.. but I don't get the English ones.. Thanks :)
score: 0
has answer: http://stackoverflow.com/a/27493544
answer count: 1
has comment: http://stackoverflow.com/comment/43420980
has title: Get Files From Sdcard
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/27611292
type: Answer
has body: The author uses IntWrapper instead of an int because he wants to achieve persistent state for a value between the callers and callees. A modification to the int member of an IntWrapper instance in a callee will be visible to a caller. With a plain int, that's not possible because it's a primitive type, and hence it will be passed by value (it will be 'copied' if I may).
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27611253
upvote count: 2

http://stackoverflow.com/a/27591696
has comment: http://stackoverflow.com/comment/43607361
has comment: http://stackoverflow.com/comment/43607176
has comment: http://stackoverflow.com/comment/43607107
has comment: http://stackoverflow.com/comment/43607228
type: Answer
has body: Do not use the settings from MainActivity, create a new SharedPrefs instance and call getString method.
score: 0
answers question: http://stackoverflow.com/q/27591503

http://stackoverflow.com/comment/43432942
comment on: http://stackoverflow.com/q/27501221
has text: First of all, `currentTimeMillis` isn't even remotely random... I think your premise is basically flawed, but you only need to generate a random string and check for existence against the DB, which is a lot more light weight than reading the DB into a set. Have a look at [UUID](https://docs.oracle.com/javase/7/docs/api/java/util/UUID.html)'s - they might work for you.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/27597602
has comment: http://stackoverflow.com/comment/43621691
has comment: http://stackoverflow.com/comment/43619040
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43637164
upvote count: 2
has comment: http://stackoverflow.com/comment/43626849
downvote count: 2
answers question: http://stackoverflow.com/q/27597346
has body: Because there are several different ways to write most statements, that all boil down to the same object code. There is in general no single correct decompilation.
has comment: http://stackoverflow.com/comment/43640571

http://stackoverflow.com/a/27480841
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27480634
has body: In addition to Naveen's comment, you can try- Document doc = Jsoup.connect(&lt;YOUR URL&gt;).get(); Elements elements= doc.select("div[class=dojoxGridSortNode]"); String str = elements.text(); You can download Jsoup jars from here - http://jsoup.org/download

http://stackoverflow.com/comment/43438871
score: 0
type: Comment
type: QuestionComment
has text: @shekharsuman, I know that! But I thought you would be able to help?!
comment on: http://stackoverflow.com/q/27504360

email
tags question: http://stackoverflow.com/q/27534411
tags question: http://stackoverflow.com/q/27633260
tags question: http://stackoverflow.com/q/27526854
tags question: http://stackoverflow.com/q/27511985
tags question: http://stackoverflow.com/q/27616880
tags question: http://stackoverflow.com/q/27525585
tags question: http://stackoverflow.com/q/27607874
tags question: http://stackoverflow.com/q/27475079
tags question: http://stackoverflow.com/q/27487115
tags question: http://stackoverflow.com/q/27498183
tags question: http://stackoverflow.com/q/27498213
tags question: http://stackoverflow.com/q/27614793
tags question: http://stackoverflow.com/q/27474984
type: Tag
tag name: email

http://stackoverflow.com/comment/43507863
type: QuestionComment
comment on: http://stackoverflow.com/q/27540084
has text: you have only one TestClass instance. you can create a clone of obj, and you can get then different sizes.
score: 0
type: Comment

http://stackoverflow.com/a/27589434
has comment: http://stackoverflow.com/comment/43602929
has body: You could use a negative lookahead based regex like below to get the part before the [% ^(?:(?!\[%).)* (?:(?!\[%).)* matches any character but not of [% zero or more times. DEMO String s = "tro[tro%tro[%trololo"; Pattern regex = Pattern.compile("^(?:(?!\\[%).)*"); Matcher matcher = regex.matcher(s); while(matcher.find()){ System.out.println(matcher.group()); // output : tro[tro%tro } OR A lookahead based regex, ^.*?(?=\[%) DEMO Pattern regex = Pattern.compile("^.*?(?=\\[%)"); OR You could split the input string based on the regex \[% and get the parts you want. String s = "tro[tro%tro[%trololo"; String[] part = s.split("\\[%"); System.out.println(part[0]); // output : tro[tro%tro
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27589417
type: Answer
accepted answer of: http://stackoverflow.com/q/27589417

http://stackoverflow.com/a/27520425
type: Answer
score: 1
upvote count: 1
has body: You dont have method like BufferedWriter.write(Long); Instead of this you could convert it into String and write it like: out.write(size_list.get(i).toString() + "\n"); You could get rid of newline (you have type there you should have used newLine note L in caps) method as well.
downvote count: 0
answers question: http://stackoverflow.com/q/27520396

http://stackoverflow.com/q/27601535
has answer: http://stackoverflow.com/a/27601640
has body: I am trying to replace parts of String starting with $ (I manually use parameters in String) but for some reason it fails. Here's what I have: public void sendNotificationOfAcceptedMeeting(String candidateName, DateTime dateTime) { Map&lt;String,String&gt; params = new HashMap&lt;String,String&gt;(); params.put("date", dateTime.toString(DATETIME_FORMAT)); params.put("candidate", candidateName); sendEmailWithTemplate(TEMPLATE_ALL_ACCEPTED, params); } then: private void sendEmailWithTemplate(String templateName, Map&lt;String, String&gt; params) { EmailTemplate template = emailTemplateDao.getEmailTemplate(templateName); String subject = applyTemplateParameters(template.getSubject(), params); String body = applyTemplateParameters(template.getTetxBody(), params); sendEmail(subject, body); } and finally: private String applyTemplateParameters(String templateText, Map&lt;String, String&gt; params) { String toReturn = templateText; if (params != null) { System.out.println("map size: " + params.size()); for (Entry&lt;String, String&gt; entry : params.entrySet()) { System.out.println("********************"); System.out.println(toReturn + " ***BEFORE"); toReturn.replace("$" + entry.getKey(), entry.getValue()); System.out.println("$" + entry.getKey() + " ***KEY"); System.out.println(entry.getValue() + " ***VALUE"); System.out.println(toReturn + " AFTER"); } } return toReturn; } As you probably figured, the second method calls the third method with String that I want to modify and map of parameters and their values. Second method sets the vlue of template String to: The meeting request at $date with $candidate was accepted by all interviewers. However the sysouts in third method print: map size: 2 ******************** The meeting request at $date with $candidate was accepted by all interviewers. ***BEFORE $candidate ***KEY Acceeedsasd Stetfghfghasd ***VALUE The meeting request at $date with $candidate was accepted by all interviewers. AFTER ******************** The meeting requ…
possible better answer: http://stackoverflow.com/a/27601640
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27601597
answer count: 4
has answer: http://stackoverflow.com/a/27601674
has answer: http://stackoverflow.com/a/27601644
has title: Problems with String's replace() method
type: AnsweredQuestion
tagged with: string
has answer: http://stackoverflow.com/a/27601597
type: Question

http://stackoverflow.com/comment/43390642
has text: But any change you know why those spaces and \n are being added?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27478425

http://stackoverflow.com/comment/43606886
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27591565
has text: Thank you @khelwood I will try to figure it out

http://stackoverflow.com/q/27489980
linked to: http://stackoverflow.com/q/344380
downvote count: 0
has answer: http://stackoverflow.com/a/27490241
favorite count: 0
tagged with: java.util.date
tagged with: cassandra
linked to: http://stackoverflow.com/q/136419
answer count: 4
upvote count: 13
has answer: http://stackoverflow.com/a/27490080
has comment: http://stackoverflow.com/comment/43411874
score: 13
type: AnsweredQuestion
tagged with: deprecated
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27490080
has body: I have a date column in a Cassandra column family. When I retrieve data from this CF using datastax java API, this date object can be taken as a java.util.Date object. It has a getYear() method but it is deprecated. The corresponding javadoc says: As of JDK version 1.1, replaced by Calendar.get(Calendar.YEAR) - 1900. How can I get the year, month, day attributes from this date object properly?
has title: get Year from java.util.Date
possible better answer: http://stackoverflow.com/a/27490068
has comment: http://stackoverflow.com/comment/43412127
has answer: http://stackoverflow.com/a/40201166
tagged with: datastax
has answer: http://stackoverflow.com/a/27490068

http://stackoverflow.com/comment/49429747
comment on: http://stackoverflow.com/a/27517678
type: Comment
has text: int sample = getSixteenBitSample(high, low); This line trows a error,because the method doesn't exist. Could you help mi with this, please =)
score: 0
type: AnswerComment

http://stackoverflow.com/a/27600182
has comment: http://stackoverflow.com/comment/43667328
has comment: http://stackoverflow.com/comment/43673279
answers question: http://stackoverflow.com/q/27533105
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/51363782
has body: I'm facing the same &lt;Warning&gt; on weblogic server 12.1.3 and primefaces 5.1.x JSF webapplication. WebApp has no errors. It is working with no problems. On wls 12.1.2 there are no such Warnings.
has comment: http://stackoverflow.com/comment/43959332
has comment: http://stackoverflow.com/comment/43802189
has comment: http://stackoverflow.com/comment/44519685
has comment: http://stackoverflow.com/comment/43667303
has comment: http://stackoverflow.com/comment/44698171
upvote count: 2
type: Answer

http://stackoverflow.com/comment/51247152
comment on: http://stackoverflow.com/a/29634389
type: AnswerComment
has text: Excellent and elegant solution! This should be the accepted answer.
type: Comment
score: 3

http://stackoverflow.com/comment/43794109
score: 0
type: Comment
has text: Try to modify `catalina.sh` and add in `CATALINA_OPTS` `-Xmx2048m`
type: QuestionComment
comment on: http://stackoverflow.com/q/27614824

http://stackoverflow.com/comment/43467520
type: QuestionComment
has text: i had try it but non of ths are help me i try the telegram proj from github
comment on: http://stackoverflow.com/q/27518840
score: 0
type: Comment

http://stackoverflow.com/comment/43639132
has text: He , is, a , "man '\"of " his bar", bar"words\ always
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27608196
type: Comment

http://stackoverflow.com/a/27532500
upvote count: 4
downvote count: 0
has body: Your JSON String is not a valid JSON Object. It needs to start and end with { and }. You can run it through a JSON validator like JSONLint and see your problem. { "x":{ ... }
score: 4
accepted answer of: http://stackoverflow.com/q/27531590
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27531590
type: Answer

http://stackoverflow.com/a/27528160
has comment: http://stackoverflow.com/comment/43486387
has comment: http://stackoverflow.com/comment/43485098
has comment: http://stackoverflow.com/comment/43485223
has comment: http://stackoverflow.com/comment/43485905
upvote count: 1
has comment: http://stackoverflow.com/comment/43486266
type: Answer
answers question: http://stackoverflow.com/q/27527955
has comment: http://stackoverflow.com/comment/43486196
has comment: http://stackoverflow.com/comment/43485401
downvote count: 0
has comment: http://stackoverflow.com/comment/43485654
score: 1
has body: I think stockss.getListSt() returns a list of String. So casting an element of the list to a Stock cannot possibly work. And that's what you're trying to do in Stock s =lists.next();
has comment: http://stackoverflow.com/comment/43485940
has comment: http://stackoverflow.com/comment/43486048
has comment: http://stackoverflow.com/comment/43485168

http://stackoverflow.com/q/27519322
has comment: http://stackoverflow.com/comment/43468450
tagged with: fileinputstream
has comment: http://stackoverflow.com/comment/43468304
answer count: 1
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/43468491
has answer: http://stackoverflow.com/a/27519693
has comment: http://stackoverflow.com/comment/43468552
has comment: http://stackoverflow.com/comment/43468473
has comment: http://stackoverflow.com/comment/43468384
score: 0
has title: Java - Reading a file and loading in HashMap - How to reduce time?
has comment: http://stackoverflow.com/comment/43468694
has body: I'm reading files of sizes around 20 MB with around 500,000 records in it. I'm loading the records into a HashMap with a particular field as key and another field as the value. This Map's Key-values are used in the subsequent process. The time to simply read the file is negligible. But, parsing the field and load into HashMap seems to take hours. The code looks somewhat likes this, InputStream in = new FileInputStream(new File(file)); br = new BufferedReader(new InputStreamReader(in), 102400); if (br != null) { for (String record; (record = br.readLine()) != null;) { sb = new StringBuilder(record); map.put(sb.substring(findStartIndex(fieldName1),findEndIndex(fieldName1)), sb.substring(findStartIndex(fieldName2),findEndIndex(fieldName2))); } } where findStartIndex() and findEndIndex() are methods to parse an record format xml and find the start and end indexes of the field. I need to repeat this process for a bunch of files. Suggest me someway to reduce the runtime. Any help is appreciated. Thanks. Edit: I implemented the findStartindex and findEndindex as below, Input is xml with field names and index values. I used SaxParser, getters and setters for each.. found the values of start and end.
has comment: http://stackoverflow.com/comment/43468604
has comment: http://stackoverflow.com/comment/43468724
has comment: http://stackoverflow.com/comment/43468323
type: Question
has comment: http://stackoverflow.com/comment/43468660
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/43468762
tagged with: inputstream
accepted answer: http://stackoverflow.com/a/27519693
has comment: http://stackoverflow.com/comment/43468339
has comment: http://stackoverflow.com/comment/43468315
has comment: http://stackoverflow.com/comment/43468569

http://stackoverflow.com/q/27578083
tagged with: keylistener
score: 0
tagged with: handler
answer count: 1
tagged with: key
tagged with: input
has title: InputHandler not working
type: AnsweredQuestion
has body: In my game, I have an InputHandler class that handles my action listeners. I have it working for other parts of my game code, but for some reason the key listener does not respond to my inventory class. In my InputHandler class (it extends JPanel): public InputHandler(InventoryGUI i) { i.addKeyListener(this); } In my InventoryGUI constructor: this.input = new InputHandler(this); The tick method in the inventory class (the Key i is properly created in my InputHandler): if (input.i.isPressed() &amp;&amp; canChange) { canChange = false; tickCount = 0; Game.removeInventory(); } canChange is true. For some reason, the input does not seem to be working. The inventory screen is ticking, but no response from the key listener. Any help would be greatly appreciated! Edit: Since this class is a JPanel, I tried using KeyBindings, but that still didn't work. I added this to the constructor: this.getInputMap().put(KeyStroke.getKeyStroke("I"), "pressed"); this.getActionMap().put("pressed", pressedAction); And pressedAction is created outside: Action pressedAction = new AbstractAction() { private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { System.out.println(e.getActionCommand()); Game.removeInventory(); } };
type: Question
has answer: http://stackoverflow.com/a/27583111
accepted answer: http://stackoverflow.com/a/27583111
tagged with: java

http://stackoverflow.com/q/27552555
has answer: http://stackoverflow.com/a/27586116
type: Question
answer count: 2
has title: Weird behaviour while trying to get picture from DCIM
upvote count: 1
tagged with: android
favorite count: 0
tagged with: picturegallery
linked to: http://stackoverflow.com/q/19805966
has body: I am trying to load a picture in my activity from DCIM. I use the following code : int BROWSE_PICTURES = 0; public void openBrowsePictures() { Intent i = new Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, BROWSE_PICTURES); } and in onActivityResult : @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == BROWSE_PICTURES &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { // we have bitmap from filesystem! Uri selectedImage = data.getData(); Log.d("CAMERA","____"+selectedImage.toString()); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query( selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); Log.d("CAMERA", " column : " + columnIndex); String filePath = cursor.getString(columnIndex); cursor.close(); Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath); Log.d("CAMERA", "----" + filePath); } } The situation becomes strange when I try to load a taken picture from filesystem. It works as expected when a. I choose a picture from EasyScreenshot file but when b. I choose picture from DCIM/Camera path it does not work. If I run the code the Log.d at the a. case prints : CAMERA﹕ ____content://media/external/images/media/27487 and the second Log.d : CAMERA﹕ ----/storage/emulated/0/Pictures/Screenshots/Screenshot_2014-12-18-15-14-22.png but , in case b it prints the following : the first log.d : CAMERA: ____content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%2F7tUacBA_4oYS2Q8CmkINWHa93B_n7heNyt3OyVZgkY8%3Ds0-d and the second log.d : CAMERA﹕ ----null I test the application in a nexus 4 device running Android 5.0.1 Thank you in advance
tagged with: android-intent
possible better answer: http://stackoverflow.com/a/27585977
accepted answer: http://stackoverflow.com/a/27586116
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27585977

http://stackoverflow.com/a/27501673
type: Answer
answers question: http://stackoverflow.com/q/27501628
has body: You can simply change the argument in the if statement to not equals. if (intarrNumeros != entero)
has comment: http://stackoverflow.com/comment/43433827
score: 0
has comment: http://stackoverflow.com/comment/43433954

http://stackoverflow.com/a/27566713
answers question: http://stackoverflow.com/q/27565556
score: 0
type: AcceptedAnswer
type: Answer
has body: You need to make sure that all your fields in your class are Serializable as this tutorial suggests. Of particular note are the requirements for a class to be Serializable: Notice that for a class to be serialized successfully, two conditions must be met: The class must implement the java.io.Serializable interface. All of the fields in the class must be serializable. If a field is not serializable, it must be marked transient. This means you'll have to do some digging in the Javadocs for all the fields in your GameBoard class. For instance, I did a quick search on JFrame, and there seems to be a bit of a nuance when it comes to saving a JFrame. When you retrieve the state of your saved game, it might be better just to recreate the GUI from scratch rather than to rely upon Serialization to do it for you. This thread also seems to concur that it's not a good idea to rely on Java to restore a GUI for you, but gives a suggestion as to how to possibly make it work: once deserialised, you will need to show the frame with frame.setVisible(true);
accepted answer of: http://stackoverflow.com/q/27565556

http://stackoverflow.com/a/27487696
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27487543
accepted answer of: http://stackoverflow.com/q/27487543
type: Answer
upvote count: 1
has body: You have to first understand that doPost and doGet are just methods. is it ineficient (hitting the server twice for a no good reason) You're not hitting the server. You're invoking a method. It'd be the same as writing a separate method foo(..) and invoking that. The doPost and doGet (and others) are part of the Servlet API which tries to simplify your life by giving you entry points to handle specific request types. If both the handlers do the exact same thing, don't repeat the same code. Put it one method and call it from the other. Or better yet, extract the logic to a completely different method and invoke that from both. Flow of a Servlet container (YMMV): Server accepts Socket connection. Server dispatches thread to handle request Thread parses request headers and bodies and prepares ServletRequest and ServletResponse objects. Thread determines Servlet/Filter route. (This is where it would determine your Servlet is appropriate.) Thread invokes HttpServlet#service(..). That invocation delegates to the appropriate doXYZ method in your subtype. Stack rewinds as invocations complete, thread does cleanup of request and commits response.

http://stackoverflow.com/comment/43461499
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27514529
has text: I went back and looked over the wildcard implementation and the inheritance concept and now it makes complete sense to me. Thank You.

http://stackoverflow.com/comment/43461016
comment on: http://stackoverflow.com/q/27515347
type: Comment
type: QuestionComment
has text: Please share some code. What do you have so far, and what errors exactly are you getting?
score: 4

http://stackoverflow.com/comment/43470521
has text: `trim` only remove spaces at the start and the end of a string (in your case a line). Try to parse the XML remove the spaces and rewrite the XML.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27520515

http://stackoverflow.com/comment/44559591
score: 0
has text: I confirm that this doesn't work as expected. To make the hotkey work requires using jframe.setJMenuBar(), which defeats the purpose of using application.setDefaultMenuBar(). I checked for uncaught exception using Thread.setDefaultUncaughtExceptionHandler() and didn't see any.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27600035

http://stackoverflow.com/comment/43509258
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27540808
has text: so how can i convert 05:39:04 +0530 into 11:09 minutes.
type: Comment

http://stackoverflow.com/comment/43559500
comment on: http://stackoverflow.com/q/27566626
type: Comment
has text: 1.GridBagLayout will not work in this case. Use BorderLayout. 2. If you expecting to resizing the image too .., then you have to use a Panel instead of the label.
type: QuestionComment
score: 0

http://stackoverflow.com/a/27584893
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27584832
answers question: http://stackoverflow.com/q/27584832
score: 3
has comment: http://stackoverflow.com/comment/43595041
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The model will have a state field, perhaps an enum, that would reflect the view. You could make this a bound property using a SwingPropertyChangeSupport object. Then the view could listen to the state of this property and swap the Card based on its state. In fact the toString() of each enum constant could be used to add card views to the CardLayout-using container. Edit You ask: Could you elaborate on the usage of SwingPropertyChangeSupport? You can find examples of this here, here, and especially here. I've attempted using addPropertyChangeListener in the model. And how would the View control the card change when the CardLayout is in MathsGame.java? The view would be notified of the state change of the model, and then when this happens, the view would call its code to swap cards. I've had problems with doing that inside View for "calling a static method from a non-static context". This is a completely different unrelated issue, a basic core Java issue, that I'm sure with a little work, you'll be able to solve. In brief -- don't try to call instance code in a static way. Always call it on a proper reference, not on the class.

http://stackoverflow.com/comment/43494562
type: Comment
type: AnswerComment
has text: still noSuchFileException.. =\
comment on: http://stackoverflow.com/a/27532521
score: 0

http://stackoverflow.com/q/27542322
has body: I configured a "question-tag" Many-to-Many relationship.in Hibernate When I test it with a small program, it has the follwing error: (My Hibernate version is 3.1) log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). log4j:WARN Please initialize the log4j system properly. Hibernate: insert into javaqa2.qa_tag (creator_id, name, description, create_date, used_cnt) values (?, ?, ?, ?, ?) Hibernate: insert into javaqa2.qa_tag (creator_id, name, description, create_date, used_cnt) values (?, ?, ?, ?, ?) Hibernate: insert into javaqa2.qa_question (creator_id, subject, content, creator_ip, question_tags, upvote_cnt, downvote_cnt, visit_cnt, answer_cnt, comment_cnt, istopmost, islocked, isanonym, create_date) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into qa_question_tags (question_id, tag_id) values (?, ?) Hibernate: insert into qa_question_tags (question_id, tag_id) values (?, ?) Exception in thread "main" org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at test.Test1.main(Test1.java:49) Caused…
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43604918
type: Question
tagged with: many-to-many
has comment: http://stackoverflow.com/comment/43602225
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43602278
has comment: http://stackoverflow.com/comment/43545990
has answer: http://stackoverflow.com/a/27590725
has title: I get an error message "Could not execute JDBC batch update" when using hibernate "Many to Many"
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43605038
has comment: http://stackoverflow.com/comment/43604348

http://stackoverflow.com/comment/43507873
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27538938
has text: @Gingerbread, please take another look at my answer. I have edited it since answering and feel it has some information you should take a look at.
score: 0

http://stackoverflow.com/comment/43660618
has text: You might need to add the JSON support. See [here](https://jersey.java.net/documentation/1.18/user-guide.html#json.low.level.approach.section). There is an example you can download
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27520905
score: 0

http://stackoverflow.com/q/27477305
answer count: 1
has body: I am new to android programming. I was trying to create a simple x and zero game. As a first step I have divided the screen into nine blocks.But For adding the symbols into the cell, the object is only appearing in the first cell. I am adding the code for further details Game.java import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.view.MotionEvent; import android.view.View; import android.os.Handler; import android.os.Message; import android.widget.Toast; /** * Created by b on 11/27/2014. */ public class Game extends View { private Cell[][] board = null; int x=3; int y=3; int l; int w; boolean whatdrawn; Paint gallery; Canvas canvas; Handler handler = new Handler() { // @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: Toast.makeText(getContext(), "You Win!", Toast.LENGTH_SHORT).show(); case 1: Toast.makeText(getContext(), "You Win!", Toast.LENGTH_SHORT).show(); break; case 2: Toast.makeText(getContext(), "Computer Win!", Toast.LENGTH_SHORT).show(); break; case 3: Toast.makeText(getContext(), "Loose!", Toast.LENGTH_SHORT).show(); break; default: break; } super.handleMessage(msg); } }; public Game(Context context) { super(context); gallery = new Paint(); this.gallery.clearShadowLayer(); this.gallery.setStrokeWidth(3); l = this.getWidth(); w = this.getHeight(); board = new Cell[x][y]; int xshort = l / x; int yshort = w / y; for (int a = 0; a &lt; x; a++) { for (int b = 0; b &lt; y; b++) { board[a][b] = new Empty(a * xshort,b * yshort); } } } protected void onDraw(Canvas canvas) { for (int i = 0; i &lt;x; i++) { //(int i = 0; i &lt; board.length; i++) for (int j = 0; j &lt; y; j++) {//for (int j = 0; j &lt; board[0].length; j++) board[i][j].draw(canvas, (this .getWidth() + 3) / board.length, this.getHeight() / board[0].length); String st="We reached board events"; System.out.println(st+i+j); } } int xs = this.getWidth() / x; int ys = this.getHeight() /…
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/43394931
type: Question
has title: drawings in android canvas not appearing as expected
has answer: http://stackoverflow.com/a/27496964
tagged with: android-canvas
score: 0

http://stackoverflow.com/q/27476891
possible better answer: http://stackoverflow.com/a/27502165
has answer: http://stackoverflow.com/a/27508419
accepted answer: http://stackoverflow.com/a/27508419
has comment: http://stackoverflow.com/comment/43425543
tagged with: swing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43388708
has answer: http://stackoverflow.com/a/27502165
has title: How to resize edit area in JEditorPane?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43422717
score: 0
has body: This is a question about Java and Swing. I put two JEditorPane into two JScrollPane, and then put the two JScrollPane into a JSplitPane. The problem is that when I drag to resize the JScrollPane, one JEditorPane is extended, but when I drag back, the view shrinks but the edit area doesn't, the horizontal scroll bar appeared. The code looks like this: import javax.swing.*; import java.awt.*; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.*; public class Main { private static final int DEFAULT_WIDTH = 800; private static final int DEFAULT_HEIGHT = 600; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); JEditorPane editor = new JEditorPane(); JEditorPane preview = new JEditorPane(); System.out.println(DEFAULT_WIDTH / 2); // editor.setSize(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT); editor.setMinimumSize(new Dimension(0, 0)); // preview.setSize(DEFAULT_WIDTH / 2, DEFAULT_HEIGHT); preview.setMinimumSize(new Dimension(0, 0)); final JScrollPane scrollEditor = new JScrollPane(editor); final JScrollPane scrollPreview = new JScrollPane(preview); final JSplitPane innerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollEditor, scrollPreview); innerPane.setContinuousLayout(false); frame.add(innerPane, BorderLayout.CENTER); innerPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { editor.setSize(innerPane.getLeftComponent().getBounds().width, editor.getHeight()); scrollEditor.setSize(innerPane.getLeftComponent().getBounds().width, editor.getHeight()); } }); frame.setVisible(true); } }); } } I try to use JEditorPane.setSize, but it doesn't work. How can I fix it? Thanks.
has comment: http://stackoverflow.com/comment/43429077

http://stackoverflow.com/comment/43575224
score: 1
comment on: http://stackoverflow.com/a/27573356
has text: "__Stat_Total__" and "__Stat_Kind__" doesn't work in local development server. Only works in App Engine Server.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43511777
has text: Okay, I try to understand what you mean. Meanwhile I have edited my post with the GeofenceRequester class to give you information, how the acitivity parameter is used.
comment on: http://stackoverflow.com/q/27542103
score: 0
type: QuestionComment
type: Comment

objectify
tags question: http://stackoverflow.com/q/27595327
tags question: http://stackoverflow.com/q/27561082
tag name: objectify
tags question: http://stackoverflow.com/q/27512404
type: Tag
tags question: http://stackoverflow.com/q/27575569

http://stackoverflow.com/comment/43431372
type: QuestionComment
score: 0
has text: In the code sample above, the `MainActivity` is injected using `@Inject`, it's not provided by any module, dagger will just use the default constuctor. I've also tried to created it in my `setup()` method by just doing `MainActivity sut = new MainActivity()` it doesn't make any difference. In the MainActivity, myObjected is injected by Dagger : `public class MainActivity extends BaseActivity { @Inject MyObject myObject; ...`
comment on: http://stackoverflow.com/q/27485669
type: Comment

http://stackoverflow.com/q/27493451
has comment: http://stackoverflow.com/comment/43418884
has title: Does finally() get called when the stop button is pressed in eclipse?
has comment: http://stackoverflow.com/comment/43418670
has comment: http://stackoverflow.com/comment/43418643
tagged with: java
has comment: http://stackoverflow.com/comment/43418744
possible better answer: http://stackoverflow.com/a/27493776
tagged with: eclipse
linked to: http://stackoverflow.com/q/1410951
has answer: http://stackoverflow.com/a/27493776
has answer: http://stackoverflow.com/a/27493673
answer count: 2
has comment: http://stackoverflow.com/comment/43418737
downvote count: 0
favorite count: 0
has body: I'm sure this question has been asked before on here, but after searching around google and here I couldn't find anything. Here's my situation, I've got multiple threads writing to a file, and a main thread that creates a print writer and handles creating the file and closing the print writer inside a finally block in a try/catch loop. When I run the application inside eclipse, I would press the stop/terminate button, and the file doesn't have anything written to it. I want to ensure that I'm doing everything correct here, or if there's a better way to handle closing a print writer whenever execution is terminated. Heck, if there's a better way to handle multiple threads writing to a file, I'm welcome to that advice (I'm pretty terrible at multithreaded programming right now).
upvote count: 8
accepted answer: http://stackoverflow.com/a/27493673
has comment: http://stackoverflow.com/comment/43418941
score: 8
tagged with: multithreading
tagged with: printwriter
has comment: http://stackoverflow.com/comment/43418758
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/27498104
has comment: http://stackoverflow.com/comment/43427387
has comment: http://stackoverflow.com/comment/43427942
has title: Java image zooming japplet
favorite count: 0
type: Question
downvote count: 2
has answer: http://stackoverflow.com/a/27498381
score: -2
answer count: 1
linked to: http://stackoverflow.com/q/11959758
linked to: http://stackoverflow.com/q/14115950
tagged with: java
has comment: http://stackoverflow.com/comment/43427554
tagged with: swing
upvote count: 0
has body: Im trying to make an applet that will allow me to open, zoom in and out of an image. Ive got a working applet going, but am having trouble with the zoom. Any ideas on where to head from here? This is what I have so far ImageZoom import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.image.*; import java.io.*; public class ImageZoom extends JApplet implements ActionListener { JPanel jpanel, pane2; JLabel image; JButton open_file, zoom_in, zoom_out; Image img; JFileChooser fc; Zoom zP; @Override public void init() { setSize(450,450); buttonLayout(); filechooser(); imgLayout(); zP = new Zoom(); } public void imgLayout() { pane2 = new JPanel(); pane2.setLayout(new BorderLayout()); image = new JLabel(""); pane2.add(image,BorderLayout.CENTER); } public void buttonLayout() { jpanel = new JPanel(new FlowLayout()); open_file = new JButton("Open file"); open_file.addActionListener(this); jpanel.add(open_file); zoom_in = new JButton("Zoom In"); zoom_in.addActionListener(this); jpanel.add(zoom_in); zoom_out = new JButton("Zoom Out"); zoom_out.addActionListener(this); jpanel.add(zoom_out); add( jpanel, BorderLayout.NORTH ); } public void filechooser() { fc = new JFileChooser(); fc.setCurrentDirectory(new File( System.getProperty("user.home"))); } @Override public void actionPerformed(ActionEvent ae) { if(ae.getSource() == open_file) { int result = fc.showOpenDialog(null ); if(result == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); String sname = file.getAbsolutePath(); image = new JLabel("", new ImageIcon(sname), JLabel.CENTER); jpanel.add(image, BorderLayout.CENTER); jpanel.revalidate(); jpanel.repaint(); } } else if(ae.getSource() == zoom_in) { zP.increaseSize(); } else if(ae.getSource() == zoom_out) { zP.decreaseSize(); } } } Zoom import java.awt.*; import java.awt.event.*; import java.applet.*; class Zoom extends Panel { MediaTracker tracker; Image img; Dimension imgSize,iniSize; public Zoom() { setSize(400,275); img =Toolkit.get…
type: UnansweredQuestion

http://stackoverflow.com/a/27627525
has body: Check out Apache Commons PearsonsCorrelation! (http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27627349

http://stackoverflow.com/q/27625686
has body: I'm running into below exception while trying to persist Many-to-Many relationship. Any clues would be really appreciated. I'm using hibernate's @ManyToMany annotation as shown below. If I remove houses from the construction entity and then persist it works ok. The problem occurs only when I say construction.setHouses(houses) before calling persist. And I have 3 tables: Construction, House, and Construction_houses. Where Construction_houses stores mapping between construction and house using their primary keys. @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name="construction_houses", joinColumns={@JoinColumn(name="construction_id", referencedColumnName = "id")}, inverseJoinColumns={@JoinColumn(name="house_id", referencedColumnName = "id")}) private List&lt;House&gt; houses = new ArrayList&lt;&gt;(); Exception: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.construction.domain.House.id javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.construction.domain.House.id at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:291) at com.sun.proxy.$Proxy46.persist(Unknown Source) at com.construction.domain.B…
has answer: http://stackoverflow.com/a/27627647
tagged with: orm
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43672268
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27627647
tagged with: database
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
has title: PropertyAccessException while persisting Many to Many relationship
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43672562
type: Question
has comment: http://stackoverflow.com/comment/43672861

http://stackoverflow.com/q/27639283
possible better answer: http://stackoverflow.com/a/27639320
has title: Should I be using lambdas in TDD?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27639423
has comment: http://stackoverflow.com/comment/43698119
has body: In TDD, wouldn't lambda's be detrimental? How do we test the functionality of a lambda that is encapsulated within another function? It would seem to me that you wouldn't be able to test that lambda to ensure that it was working as expected. The point of unit tests is to test small units of code. Lambdas are small units of code that seem to me, untestable. Any help, opinions, clarification, or links would be appreciated.
tagged with: lambda
accepted answer: http://stackoverflow.com/a/27639345
has answer: http://stackoverflow.com/a/27639320
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27639345
tagged with: unit-testing
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/43698060

http://stackoverflow.com/a/27604567
answers question: http://stackoverflow.com/q/27604535
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/50379520
has body: As long as you know that you'll only ever need one instance of each class, this is okay. This is called a singleton and is a pretty well-known design pattern. The problem is that you probably can't guarantee that you only need one instance of your classes. Singletons are good for things like data connections or file readers, where there is a built-in limit to the number of instances that should access the data. You're misusing the static keyword as a lazy way to gain access to an instance of a class, and it's going to come back and bite you when you expand your program to include multiple instances of those classes. And if you think you'll only ever need one instance- you can't guarantee that will never change.
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27604535
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/50379234

http://stackoverflow.com/comment/43711846
type: Comment
has text: @BuhakeSindi I am able to login using MS SQL server Management Studio. Only problem is with the java code and when I tried this java code on a different machine it worked, which means my installation might have some issue but I am not able to figure that out. I am using windows 7 64 bit machine, with 64 bit java and 64 bit SQL server 2008 Express.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27635877

http://stackoverflow.com/a/27605567
downvote count: 0
answers question: http://stackoverflow.com/q/27604551
type: Answer
has body: As others have already said, there is no utility and creating one yourself wouldn't be hard, for example using old school for loops: public List&lt;Object&gt; flatten( List&lt;Object[]&gt; source ) { // if ( source == null ) return null; // which check you use it up to you List&lt;Object&gt; result = new ArrayList&lt;Object&gt;(); if ( source == null ) return result; // Personally I like this check for ( Object[] array: source ) { if ( array == null ) continue; // skip nulls for ( Object object: array ) { result.add(object); } } return result; }
score: 1
upvote count: 1

http://stackoverflow.com/comment/43682127
comment on: http://stackoverflow.com/q/27619030
has text: @pacinpm yes email field should be the link.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43667535
score: 0
has text: I suspect a different instance is being used. Instantiating with `new` isn't a problem for an `@Bean`; Spring autowires them.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27622183

http://stackoverflow.com/q/27525029
has title: passing json reply from webservice to variables
tagged with: android
has answer: http://stackoverflow.com/a/27525184
has comment: http://stackoverflow.com/comment/43479254
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43478713
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43478922
type: Question
score: -2
linked to: http://stackoverflow.com/q/2591098
tagged with: arrays
downvote count: 2
has body: i'm posting some data to a web service and i'm getting a json reply which i want to pass to a jsonobject. The reply of the web service is: { "ValidateLoginResult": [ { "ErrorMessage": "Wrong username pass", "PropertyName": null } ] } and i want to pass the error message and the property name to variables. I tried using JSONobject and JSONarray but didnt have any luck HttpClient httpclient = new DefaultHttpClient(); // 2. make POST request to the given URL HttpPost httpPost = new HttpPost(serverURL); StringEntity se = new StringEntity(data); httpPost.setEntity(se); // 7. Set some headers to inform server about the type of the content httpPost.setHeader("Accept", "application/json"); httpPost.setHeader("Content-type", "application/json"); // 8. Execute POST request to the given URL HttpResponse httpResponse = httpclient.execute(httpPost); // 9. Getting Reply inputStream = httpResponse.getEntity().getContent(); ... ... JSONArray json = new JSONArray(convertInputStreamToString(inputStream)); JSONObject json_LL = json.getJSONObject(0); String str_value=json_LL.getString("ErrorMessage");
accepted answer: http://stackoverflow.com/a/27525184
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43450568
type: AnswerComment
comment on: http://stackoverflow.com/a/27503400
type: Comment
score: 1
has text: @Falco Excellent point. I've improved my answer following your advice, except i've gone for static factories rather than multiple constructors.

http://stackoverflow.com/comment/43471179
score: 0
type: AnswerComment
has text: Ok, this is only a part of it that I can hadle, but I was meaning the validation of the response, to understand better: if the payment was ok or not.
comment on: http://stackoverflow.com/a/27520576
type: Comment

http://stackoverflow.com/comment/43678441
type: Comment
has text: nope... android-studio tells mit that the explicit Array initialisation is not needed because the vargs Parameter
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27628690

http://stackoverflow.com/comment/43444640
has text: what are you trying get?
type: Comment
comment on: http://stackoverflow.com/a/27506713
score: 0
type: AnswerComment

http://stackoverflow.com/a/27641339
has body: You must call ParseObject.registerSubclass(YourClassName.class); before calling Parse.initialize(). In addition, you need to annotate your custom class like this: @ParseClassName("YourClassName") public class YourClassName extends ParseObject { } Finally, your custom class needs a default no-args constructor in order to be registered by ParseObject. Reference: Subclassing Parse Object
upvote count: 15
score: 15
has comment: http://stackoverflow.com/comment/43704167
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43731958
has comment: http://stackoverflow.com/comment/43715529
accepted answer of: http://stackoverflow.com/q/27635352
answers question: http://stackoverflow.com/q/27635352
type: Answer

http://stackoverflow.com/comment/43487330
type: QuestionComment
has text: Watch where you put that first `nextLine` after a `nextInt`.
comment on: http://stackoverflow.com/q/27529387
score: 0
type: Comment

http://stackoverflow.com/a/27591484
type: Answer
has body: Your UI class have all static fields, that's why you need to mark prepareGUI() method as static. Beware! each time you create object of UI class, you just overwrite existing mainFrame. If you are creating only single instance of your UI class, then it is better to use Singleton pattern to avoid confusion.
score: 2
answers question: http://stackoverflow.com/q/27591348
upvote count: 2
downvote count: 0

http://stackoverflow.com/q/27604708
has title: neo4j org.neo4j.server.ServerStartupException with authentication-extension plugin
answer count: 0
score: 0
tagged with: java
type: Question
has body: The server started fine without the plugin. Then I stopped it, and followed the instructions here using the latest version (2.1.5-1.0-SNAPSHOT.jar). When I try to start ne04j, I get a org.neo4j.server.ServerStartupException: 2014-12-22 14:15:41.817+0000 DEBUG [API] org.neo4j.server.ServerStartupException: Starting Neo4j Server failed: Found class org.neo4j.server.database.Database, but interface was expected at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:211) ~[neo4j-server-1.9.4.jar:1.9.4] at org.neo4j.server.Bootstrapper.start(Bootstrapper.java:86) [neo4j-server-1.9.4.jar:1.9.4] at org.neo4j.server.Bootstrapper.main(Bootstrapper.java:49) [neo4j-server-1.9.4.jar:1.9.4] Caused by: java.lang.IncompatibleClassChangeError: Found class org.neo4j.server.database.Database, but interface was expected at org.neo4j.server.extension.auth.AuthenticationExtensionInitializer.start(AuthenticationExtensionInitializer.java:78) ~[authentication- extension-2.1.5-1.0-SNAPSHOT.jar:2.1.5-1.0-SNAPSHOT] at org.neo4j.server.modules.ExtensionInitializer.initializePackages(ExtensionInitializer.java:60) ~[neo4j-server-1.9.4.jar:1.9.4] at org.neo4j.server.modules.ThirdPartyJAXRSModule.start(ThirdPartyJAXRSModule.java:61) ~[neo4j-server-1.9.4.jar:1.9.4] at org.neo4j.server.AbstractNeoServer.startModules(AbstractNeoServer.java:254) ~[neo4j-server-1.9.4.jar:1.9.4] at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:185) ~[neo4j-server-1.9.4.jar:1.9.4] ... 2 common frames omitted
has comment: http://stackoverflow.com/comment/44002738
has comment: http://stackoverflow.com/comment/43781925
tagged with: neo4j
type: UnansweredQuestion

http://stackoverflow.com/comment/43444955
type: QuestionComment
comment on: http://stackoverflow.com/q/27507392
has text: Which JPA version are you using?
score: 0
type: Comment

size
type: Tag
tags question: http://stackoverflow.com/q/27476691
tags question: http://stackoverflow.com/q/27525369
tag name: size
tags question: http://stackoverflow.com/q/27503924
tags question: http://stackoverflow.com/q/27504581

http://stackoverflow.com/q/27630379
has answer: http://stackoverflow.com/a/27630520
has title: How to save and delete multiple String[] data in Android with SharedPreference?
type: UnansweredQuestion
tagged with: android
has body: I'm new to android development and I would be glad if I can have some help here. The problem I'm having right now is about the SharedPreference in android. What I want to do is I want to save the ArrayList strings into Shared preference and keep appending to the existing sharedpreference data with a comma like ( 123,23,56 ). I want to delete only the selected string data from the sharedpreference. Currently, I tried to save string data and append to a single sharedpreference like the sample below public String[] getStringList(Activity activity){ String favoriteList = getStringFromPreferences(activity,null,"favorites"); return convertStringToArray(favoriteList); } public boolean putStringInPreferences(Activity activity,String nick,String key){ SharedPreferences sharedPreferences = activity.getPreferences(Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(key, nick); editor.commit(); return true; } public String getStringFromPreferences(Activity activity,String defaultValue,String key){ SharedPreferences sharedPreferences = activity.getPreferences(Activity.MODE_PRIVATE); String temp = sharedPreferences.getString(key, defaultValue); return temp; } @SuppressLint("CommitPrefEdits") public void remover(Activity activity){ SharedPreferences sharedPreferences = activity.getPreferences(Activity.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.remove(); //editor.clear(); editor.commit(); mainSwitch = false; } //method to convert string into array private String[] convertStringToArray(String str){ String[] arr = str.split(","); return arr; } I want to delete only a part of the string data ,however, the method remover() in the sample will delete all the data in the Sharedpreference so I was wondering how can I delete only a part of the selected data ? Or are there some better way save and manipulate data with Arrays ?
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43681513
score: -1
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43525585
type: AnswerComment
score: 0
type: Comment
has text: Thanks for your response. You mean to say, even if GC has thrown away 6.4G of data, resident memory will still show 8G since i allocated so much? Is there a way to find out the exact memory used then, live + unreachable, excluding the unused memory?
comment on: http://stackoverflow.com/a/27549333

http://stackoverflow.com/comment/66060272
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27548956
type: Comment
has text: See http://stackoverflow.com/questions/26041117/growing-resident-memory-usage-rss-of-java-process

http://stackoverflow.com/a/27546978
answers question: http://stackoverflow.com/q/27546781
has comment: http://stackoverflow.com/comment/43520298
has body: Probably creating a new future with allAsList might be an option. (I assume you do not mind starting both a and b together.) //No idea how A and B are related, so I assume Object ListenableFuture&lt;List&lt;? extends Object&gt;&gt; futureAB = Futures.allAsList(futureA, futureB); Futures.addCallback(futureAB, ...); Following the update: ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)); ListenableFuture&lt;A&gt; futureA = service.submit(() -&gt; a.doSomething()); Futures.addCallback(futureA, new FutureCallback&lt;A&gt;() { @Override public void onSuccess(final A result) { ListenableFuture&lt;B&gt; futureB = service.submit(() -&gt; b.doSomething(result); Futures.addCallback(futureB, new FutureCallback&lt;B&gt;() { ©Override public void onSuccess(final B resultB) { //Do something with result and resultB. } }); } });
has comment: http://stackoverflow.com/comment/43520745
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43578304
has comment: http://stackoverflow.com/comment/43698231
type: Answer
accepted answer of: http://stackoverflow.com/q/27546781
score: 2
upvote count: 2

http://stackoverflow.com/comment/43621181
score: 0
comment on: http://stackoverflow.com/q/27591313
has text: Thank you for your reply Bruno, In my case I am generating challans which contains some dynamic values, and as you said I have added String1.length()+string2.length(),But as per requirement I need to add spaces after adding string2 value
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43442687
type: QuestionComment
has text: i did try that and no improvement i still get the error
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27506184

http://stackoverflow.com/comment/43564479
comment on: http://stackoverflow.com/q/27569448
type: Comment
type: QuestionComment
has text: The main problem is the second one, injecting a static value. I can leave with autowiring, but I need this string injected.
score: 0

http://stackoverflow.com/q/27488412
has comment: http://stackoverflow.com/comment/43415417
has comment: http://stackoverflow.com/comment/43408815
has comment: http://stackoverflow.com/comment/43411638
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43411838
has comment: http://stackoverflow.com/comment/43414835
type: Question
has title: Persist an entity after another entity ~ Netbeans, J2E, bean, EntityManager
tagged with: persist
has comment: http://stackoverflow.com/comment/43414498
upvote count: 1
answer count: 1
tagged with: j2ep
tagged with: entitymanager
tagged with: javabeans
favorite count: 0
has body: I'm doing a project of software engineering with Java EE, Glassfish and Netbeans and I have a problem due to lack of java experience. I'm developing a website that offers to users the possibility to create some events. I was able to save in a table event the information about the events (ID, name, place, date, creator) and now the problem is to populate another table calendar. In this table there are only 3 attributes: an ID (generated automatically and sequentially), the creator e-mail and the event ID. The aim of this calendar table is to collect all the couple user-event: an event can be coupled not only to its creator but also to other users that are invited. When I try to make persistent the data in the calendar table a I get a NullPointerException because in the event table the ID is generated automatically and i think that when i call the getEventID method, this value is still null. How can I activate a CalendarManager that has simply to take the creator and the ID of the event and write them in the calendar table? I hope that I was clear, here there are some files: The EventManager works fine: @Stateless public class EventManager { @PersistenceContext public EntityManager em; @Inject Principal principal; public void saveEvent(Event event) { em.persist(event); } public void deleteEvent(Event event) { em.remove(event); } } The CalendarEventsManager is fine but doesn't receive the correct parameters: @Stateless public class CalendarEventsManager { @PersistenceContext public EntityManager cm; @Inject Principal principal; public void saveCalendarEvents(CalendarEvents calendarevents) { cm.persist(calendarevents); } public void deleteCalendarEvents(CalendarEvents calendarevents) { cm.remove(calendarevents); } } Below there is the CRITICAL PART in the Bean that is activated when a user click on "Create Event": public String saveEvent() { /* obtain the creator's email */ creator = um.getLoggedUser().getEmail(); this.event.setCreator(creator); /* save information in d…
has comment: http://stackoverflow.com/comment/43412075
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27491898

http://stackoverflow.com/comment/43673714
comment on: http://stackoverflow.com/q/27626367
type: Comment
type: QuestionComment
has text: @martijnn2008, thanks I was hoping not to do that...
score: 0

http://stackoverflow.com/a/27505191
downvote count: 0
upvote count: 2
has body: You can't directly call for the variable (because it's a private field). You should use stackStorage.size() instead. Also make sure stackStorage is actually instantiated. You most probably have: ArrayList&lt;Object&gt; stackStorage; However you must instantiate it somewhere like so: stackStorage = new ArrayList&lt;Object&gt;(); This may also be done on the same line: ArrayList&lt;Object&gt; stackStorage = new ArrayList&lt;Object&gt;(); Once you have created this ArrayList do note that it still doesn't have any elements in it. In order to actually add an Integer to the array simply do: stackStorage.add(number); And after you do that, if you call stackStorage.size() it should return 1, meaning there's one element in the ArrayList. If you wish to add more, simply use the add() method. Also make sure you add the same object as you instantiated it with. You can't store String in ArrayList&lt;Integer&gt; for example. Full-code example: ArrayList&lt;Integer&gt; stackStorage = new ArrayList&lt;Integer&gt;(); stackStorage.add(10); //Now has value `10` in `index[0]` System.out.println("index[0]: " + stackStorage.get(0)); //Prints 10 System.out.println("stackStorage.size() = " + stackStorage.size()) //Prints 1 In your case replace Object with Integer if you wish to store integers. NullPointerException means your object is still null when you tried to call size(). This should solve your issue. If you're not sure what null is or don't quite understand what NPE(NullPointException) is I suggest reading about it and if you have further difficulties, posting it here.
has comment: http://stackoverflow.com/comment/43440845
has comment: http://stackoverflow.com/comment/43442706
answers question: http://stackoverflow.com/q/27505137
type: Answer
score: 2

http://stackoverflow.com/comment/43468491
has text: cant you just implement the parser on the file itself instead on the StringBuilder?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27519322

http://stackoverflow.com/comment/43425043
score: 2
type: Comment
type: QuestionComment
has text: Doesn't look like Newton-Raphson to me.
comment on: http://stackoverflow.com/q/27496475

http://stackoverflow.com/q/27554340
has comment: http://stackoverflow.com/comment/43537509
has comment: http://stackoverflow.com/comment/43537840
has comment: http://stackoverflow.com/comment/43538267
upvote count: 3
has comment: http://stackoverflow.com/comment/43536977
answer count: 1
has comment: http://stackoverflow.com/comment/43674674
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/43537876
has comment: http://stackoverflow.com/comment/43538160
has comment: http://stackoverflow.com/comment/43563347
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43537728
has comment: http://stackoverflow.com/comment/43536584
has comment: http://stackoverflow.com/comment/43537527
has comment: http://stackoverflow.com/comment/43537683
downvote count: 0
has comment: http://stackoverflow.com/comment/43537492
has answer: http://stackoverflow.com/a/27558795
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43536889
has comment: http://stackoverflow.com/comment/43535069
has title: Long running multi threaded application runs 4x slower when deployed to tomcat than when run from command line
has comment: http://stackoverflow.com/comment/43537340
type: Question
score: 3
has body: When I run this long running process from the command line it takes about 30 seconds to complete. When I deploy this same code to tomcat7 and call the same function from a simple Vaadin web application it takes almost 150 seconds. This is the time for a specific function to execute, not anything related to interface slowing it down. Here's is a simple example that illustrates the problem: public static void main(String[] args) { try { multiCounter(800); } catch (InterruptedException | ExecutionException e) {e.printStackTrace();} System.out.println("Completed"); } public static void multiCounter(int numberOfCounters) throws InterruptedException, ExecutionException { //estimate the number of available processors int maxNumberOfThreads = Runtime.getRuntime().availableProcessors(); //create thread pool and queue for future jobs ExecutorService pool = Executors.newFixedThreadPool(maxNumberOfThreads); ArrayList&lt;Future&lt;Integer&gt;&gt; futureJobs = new ArrayList&lt;Future &lt;Integer&gt;&gt;(); for(int index=0; index&lt;numberOfCounters; index++) { Callable&lt;Integer&gt; callable = new dummyCalculator(); Future&lt;Integer&gt; future = pool.submit(callable); futureJobs.add(future); } //placeholder for results ArrayList &lt;Integer&gt; results= new ArrayList &lt;Integer&gt;(0); //pull completed jobs from queue and extract results, //adding to results container for(Future&lt;Integer&gt; future : futureJobs) {results.add(future.get());} for(Integer res : results) {System.out.println("Count:" + res);} //close thread pool pool.shutdown(); } final static class dummyCalculator implements Callable&lt;Integer&gt; { @Override public Integer call() throws Exception { Integer counter = 0; for(int p1Index=0; p1Index&lt;800; p1Index++) { for(int p2Index=p1Index; p2Index&lt;800; p2Index++) { for(int markerIndex=0; markerIndex&lt;200; markerIndex++) {counter++;} } } return(counter); } } The server I'm running this on has 48 available cores. When I run this code from the command line …
has comment: http://stackoverflow.com/comment/43537041

http://stackoverflow.com/a/27507106
has body: So given your edit, with corrected JSON of {"timestamp":1418739904470, "list": ["Fred","Flintstone"]} you have to ask yourself where the key list comes from. What if your collection was a Set? What if it was something else? Gson doesn't have such defaults. The most appropriate solution, in my opinion, is to use composition over inheritance (obviously, only if that's possible). class EnrichedList { long timestamp = System.currentTimeMillis(); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); } Gson will have no trouble serializing that to the JSON you want.
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27506989
accepted answer of: http://stackoverflow.com/q/27506989
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/43467666
type: Comment
has text: Will this not cause IllegalStateException, i know in Java, trying to start a thread twice before the completion of the first will result in IllegalStateException, i am excepting the same behaviour. Love to try that and see the result..
type: AnswerComment
comment on: http://stackoverflow.com/a/27518743
score: 0

http://stackoverflow.com/a/32246254
score: 26
has body: Using java 8 Streams: List&lt;Integer&gt; longIds = Stream.of(commaSeperatedString.split(",")) .map(Integer::parseInt) .collect(Collectors.toList());
has comment: http://stackoverflow.com/comment/52376685
answers question: http://stackoverflow.com/q/27599847
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/112308034
upvote count: 27

http://stackoverflow.com/comment/43599030
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27587394
has text: Yes, for sure. I'm looking at some code on GitHub https://github.com/gaylemcd/ctci/blob/master/java/Chapter%204/Question4_4/QuestionDFS.java
score: 0

http://stackoverflow.com/q/27534790
tagged with: java
has answer: http://stackoverflow.com/a/27534841
accepted answer: http://stackoverflow.com/a/27534841
type: Question
has title: CMD compile using jar files
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27534900
tagged with: cmd
linked to: http://stackoverflow.com/q/2096283
has body: How can I add two or more jar file in the compile step using cmd? using one jar file: javac -g -cp YOUR_JAR.jar YOUR_FILE_NAME.java Any ideas how to compile two jar files?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27534900

http://stackoverflow.com/comment/43575730
type: QuestionComment
has text: Do you have some code?
score: 3
comment on: http://stackoverflow.com/q/27575159
type: Comment

http://stackoverflow.com/a/27622271
has body: I'm agreeing to the contract which is specified by the Filter interface right? Nope. The interface lets callers pass any implementation of IFilterData. Your class only accepts one specific implementation.
score: 10
has comment: http://stackoverflow.com/comment/43665120
has comment: http://stackoverflow.com/comment/43666131
upvote count: 10
accepted answer of: http://stackoverflow.com/q/27622237
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27622237
has comment: http://stackoverflow.com/comment/43665637
has comment: http://stackoverflow.com/comment/43665355
type: Answer

http://stackoverflow.com/q/27622770
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27622903
tagged with: java
has comment: http://stackoverflow.com/comment/43666013
tagged with: eclipse
type: Question
upvote count: 0
has title: app cannot run after adding some listeners for three buttons
downvote count: 5
has answer: http://stackoverflow.com/a/27622903
score: -5
has comment: http://stackoverflow.com/comment/43666168
answer count: 1
has comment: http://stackoverflow.com/comment/43681462
favorite count: 0
has body: I just started studying Androdid programming and have come up with some problems. I was trying to implement an app with a textview and three buttons(true_button, false_button, next_question). This project runs well on AVD. Later I added a prev_button and its listener for linking to the previous question. I also added a listener for the textview question_text_view. The Eclipse Indigo reported no error, but when running on an AVD, this program stops immediately after it is launched. Where is the problem? Or, how can I find the problems in programs when using such an IDE? Thank you. Below are some of the programs for this project. (MainActivity.java, activity_main.xml, TrueFalse.java, strings.xml) MainActivity.java package com.example1.geoquiz; import android.app.Activity; import android.os.Bundle; 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 Activity { private Button mTrueButton; private Button mFalseButton; private Button mNextButton; private TextView mQuestionTextView; private Button mNextButton2; private Button mPrevButton; private TrueFalse[] mQuestionBank = new TrueFalse[] { new TrueFalse(R.string.question2, true), new TrueFalse(R.string.question3, false), new TrueFalse(R.string.question4, false), new TrueFalse(R.string.question5, true), new TrueFalse(R.string.question6, true), }; private int mCurrentIndex = 0; private void updateQuestion() { int question = mQuestionBank[mCurrentIndex].getQuestion(); mQuestionTextView.setText(question); } private void checkAnswer(boolean userPressedTrue) { boolean answerIsTrue = mQuestionBank[mCurrentIndex].isTrueQuestion(); int messageResId = 0; if(userPressedTrue == answerIsTrue) { messageResId = R.string.correct_toast; } else { messageResId = R.string.incorrect_toast; } Toast.makeText(this, messageResId, Toast.LENGTH_SHORT).show(); } @Override protected void onCreate(…

http://stackoverflow.com/q/27483004
answer count: 0
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43471997
has comment: http://stackoverflow.com/comment/43469652
linked to: http://stackoverflow.com/q/21718900
type: Question
has comment: http://stackoverflow.com/comment/43405581
has comment: http://stackoverflow.com/comment/43451109
has title: hadoop while running my program following message displayed. what does it mean?
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43429606
downvote count: 0
has body: I was running hadoop program and I got following message. what does it mean? should I need to worry about this message? INFO hdfs.DFSClient: Exception in createBlockOutputStream java.io.EOFException: Premature EOF: no length prefix available at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:531) 14/12/15 16:39:36 WARN hdfs.DFSClient: Error Recovery for block BP-1435953827-192.168.33.125-1417678953955:blk_1073749097_67711 in pipeline 192.168.33.199:50010, 192.168.33.125:50010, 192.168.33.123:50010: bad datanode 192.168.33.199:50010
favorite count: 0
has comment: http://stackoverflow.com/comment/43429589
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43401125
score: 2

http://stackoverflow.com/comment/43447851
score: 4
comment on: http://stackoverflow.com/q/27508886
type: Comment
type: QuestionComment
has text: What is your question?

http://stackoverflow.com/a/27478591
has comment: http://stackoverflow.com/comment/43390832
has body: When you call methodB(b) from methodA when b is false, it triggers a new call to methodA. Once the execution of that call to methodA and then the execution of the call to methodB both end, control returns to the instance of methodA that called methodB, and therefore your line is printed. Here's a possible scenario : methodA calls methodB(false) calls methodA calls methodB(false) calls methodA calls methodB(true) prints "'b' is true!" and returns prints "Why is this being processed when b is false?" prints "Why is this being processed when b is false?" prints "Why is this being processed when b is false?"
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/43390803
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27478557
answers question: http://stackoverflow.com/q/27478557

http://stackoverflow.com/comment/66732445
type: Comment
comment on: http://stackoverflow.com/a/27633536
score: 0
type: AnswerComment
has text: Oh that's just to generically state a strategy. You would ideally have a name of a concrete strategy there.

task
type: Tag
tags question: http://stackoverflow.com/q/27552262
tag name: task
tags question: http://stackoverflow.com/q/27609525

http://stackoverflow.com/a/28937749
has comment: http://stackoverflow.com/comment/66112754
answers question: http://stackoverflow.com/q/27604811
has comment: http://stackoverflow.com/comment/51620501
has comment: http://stackoverflow.com/comment/66892750
has comment: http://stackoverflow.com/comment/66892376
score: 0
has comment: http://stackoverflow.com/comment/49983940
type: Answer
has body: We discarded the sqljdnc4.jar and used jtds jar instead and everything works like a charm.

http://stackoverflow.com/q/27531844
tagged with: java
has answer: http://stackoverflow.com/a/52814580
linked to: http://stackoverflow.com/q/6627289
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27532320
has body: I have a field in postgres Column | Type created_at | timestamp without time zone I have a unix timestamp stored in long in Java long createdAtTime = data.getcreatedAtTime(); I want to convert it to timestamp in java so that I can store with activejdbc into postgres I tried the following Date convertedTime = new Date(createdAtTime*1000L); record.set("created_at", convertedTime); record.saveIt(); But I get the following error: Can't infer the SQL type to use for an instance of java.util.Date. Use setObject() with an explicit Types value to specify the type to use. Should I be using a different way to convert the date first?
linked to: http://stackoverflow.com/q/18132219
tagged with: postgresql
score: 0
has title: convert a unix timestamp to a postgres equivalent timestamp in java
has comment: http://stackoverflow.com/comment/43497197
answer count: 3
has comment: http://stackoverflow.com/comment/43492204
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/52807672
has comment: http://stackoverflow.com/comment/43497252

http://stackoverflow.com/comment/43464807
has text: What exactly do you want to sort by?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27517097
score: 0

http://stackoverflow.com/a/27574699
type: Answer
score: 2
downvote count: 0
has body: If you look closely at the tutorials for Jackson, you will see that the JSON this library produces itself for empty arrays uses this notation: { "empty" : [ ]} Therefore you may try replacing any singular null value in an array with just an empty array before sending your JSON to Jackson, it should accept without throwing any exceptions. Canonically, a ' null' member of an array is actually valid JSON syntax. See also http://en.wikipedia.org/wiki/JSON. Members of an array can be of any type, thus they can be: Strings Numbers Booleans Arrays Objects null For your usage scenario however, I would recommend using the empty array instead, because it is simply far easier to program with. For example, consider a usage case where you call some function f() on each of your 'years' which wants an integer input. Code like foreach(x in array){f(x);} will fail because you will call f() with a 'null' type instead of an integer, causing errors. If you instead used the empty array, the correct behaviour will happen without having to treat the case where there are no years diffrently by explicitly looking for the null. Just makes your life easier that way.
upvote count: 2
answers question: http://stackoverflow.com/q/27574528

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/27492797

http://stackoverflow.com/comment/43624664
score: 0
type: Comment
type: QuestionComment
has text: All the four what? The question was: is there any way for you to know intelligently what kind of keys the other process is looking for? E.g. if it is only looking for numbers that start with "101", then only load such numbers from the file to the map. And by the way, if the file contains only numbers, it's better to store them in memory as numbers (4 bytes), than as strings, assuming that the most of the numbers are longer than two digits.
comment on: http://stackoverflow.com/q/27600812

http://stackoverflow.com/comment/43463703
comment on: http://stackoverflow.com/a/27516657
score: 0
type: AnswerComment
type: Comment
has text: Thanks Gas. That is what I wanted!:)

http://stackoverflow.com/a/27568701
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Take a look at this post in particular. I've experienced similar issues with imread and with Java's ImageIO class and for the longest time, I could not find this link as proof that other people have experienced the same thing... until now. Similarly, someone experienced related issues in this post but it isn't quite the same at what you're experiencing. Essentially, the reason why images loaded in both Java and MATLAB are different is due to enhancement purposes. MATLAB scales the intensities so the image isn't mostly black. Essentially, the maximum intensity in your PGM gets scaled to 255 while the other intensities are linearly scaled to suit the dynamic range of [0,255]. So for example, if your image had a dynamic range from [0-100] in your PGM file before loading it in with imread, this would get scaled to [0-255] and not be the original scale of [0-100]. As such, you would have to know the maximum intensity value of the image before you loaded it in (by scanning through the file yourself). That is very easily done by reading the third line of the file. In your case, this would be 156. Once you find this, you would need to scale every value in your image so that it is rescaled to what it originally was before you read it in. To confirm that this is the case, take a look at the first pixel in your image, which has intensity 21 in the original PGM file. MATLAB would thus scale the intensities such that: scaled = round(val*(255/156)); val would be the input intensity and scaled is the output intensity. As such, if val = 21, then scaled would be: scaled = round(21*(255/156)) = 34 This matches up with the first pixel when reading it out in MATLAB. Similarly, the sixth pixel in the first row, the original value is 18. MATLAB would scale it such that: scaled = round(18*(255/156)) = 29 This again matches up with what you see in MATLAB. Starting to see the pattern now? Basically, to undo the scaling, you would need to multiply by the reciprocal of the scaling factor. As …
has comment: http://stackoverflow.com/comment/43575585
downvote count: 0
answers question: http://stackoverflow.com/q/27567406
score: 1
has comment: http://stackoverflow.com/comment/43574888
accepted answer of: http://stackoverflow.com/q/27567406

http://stackoverflow.com/q/27484486
has comment: http://stackoverflow.com/comment/43401475
has comment: http://stackoverflow.com/comment/43401355
has title: Android view layout component on top of each other
tagged with: layout
downvote count: 0
has comment: http://stackoverflow.com/comment/43401288
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27484656
favorite count: 0
accepted answer: http://stackoverflow.com/a/27484656
upvote count: 1
has comment: http://stackoverflow.com/comment/43401219
has body: I was having some problem with the layout of Android Activity. So basically I have a navigation drawer and two Activity. The layout was working perfectly when I wrap all of them with a frame layout. However, because of the navigation drawer issues, I have to remove the frame layout into another xml layout. And then from there, my layouts were all messed up. Here is my layout.xml: <com.esri.android.map.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="100dp" initExtent="21801.3, 25801.0, 33218.7, 44830.0" > </com.esri.android.map.MapView> <ImageView android:id="@+id/ivEventGuide" android:layout_width="230dp" android:layout_height="100dp" android:layout_gravity="center" android:src="@drawable/event_create_guide" android:visibility="gone" /> <ImageView android:layout_width="0dp" android:layout_height="30dp" android:layout_gravity="right" android:layout_weight="1" android:adjustViewBounds="true" android:src="@drawable/food" /> <ImageView android:layout_width="0dp" android:layout_height="30dp" android:layout_gravity="right" android:layout_weight="1" android:adjustViewBounds="true" android:src="@drawable/sport" /> <ImageView android:layout_width="0dp" android:layout_height="30dp" android:layout_gravity="right" android:layout_weight="1" android:adjustViewBounds="true" android:src="@drawable/races" /> <ImageView android:layout_width="0dp" android:layout_height="30dp" android:layout_gravity="right" android:layout_weight="1" android:adjustViewBounds="true" android:src="@drawable/discussion" /> <EditText android:id="@+id/searchAddrET" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_weight="0.8" android:hint="Enter search address, eg. postal code" android:textSize="12dp" /> When it was working fine, I wrapped the map view and the rests of the layout with a frame layout. And then inside the class where I extended the navigation drawer: public class EventMain extends NavigationDraw…
type: AnsweredQuestion
tagged with: android-layout
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/43764677
comment on: http://stackoverflow.com/q/27614824
score: 0
type: Comment
type: QuestionComment
has text: I'm working with Java 7 and I don't think the problem is in `file.length()`, though thx anyway.

http://stackoverflow.com/comment/43593176
type: Comment
comment on: http://stackoverflow.com/a/27583296
score: 0
type: AnswerComment
has text: jtable by default is editable... it has user input. just as in textfeilds.

http://stackoverflow.com/comment/43470242
score: 0
has text: If the SQL statement completed quicker (in a couple of seconds), does your code work? It does sound like it is a browser timeout and not an SQL connection issue!?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27520145

http://stackoverflow.com/a/27628608
score: 2
downvote count: 0
upvote count: 2
has body: Try something like this: public static DateTimeIterator createDateTimeIterator( final String repeatRules, final DateTime scheduleStart, final DateTimeZone timeZone) throws ParseException { DateTime start = scheduleStart; String exdate = ""; final RRule rrule = new RRule(repeatRules); if (rrule.getFreq().ordinal() &gt; Frequency.DAILY.ordinal()) { start = start.minusDays(1); exdate = "\nEXDATE:" + ISODateTimeFormat.basicDateTimeNoMillis().print(start.withZone(timeZone).toLocalDateTime()); } final DateTimeIterable dateIterable = DateTimeIteratorFactory.createDateTimeIterable( repeatRules + exdate, start, timeZone, true); return dateIterable.iterator(); } The idea is to start the sequence one day earlier and to exclude the first date by using EXDATE rule.
answers question: http://stackoverflow.com/q/27486705
type: Answer

http://stackoverflow.com/q/27541951
downvote count: 0
tagged with: sql
has title: statement.executeBatch() vs statement.updateQuery() when there is only one query to be executed
answer count: 1
tagged with: connection
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: mysql
type: Question
has body: OK, I know that Batch Processing allows to group related SQL statements into a batch and submit them with one call to the database. When you send several SQL statements to the database at once, you reduce the amount of communication overhead, thereby improving performance. In this particular situation (see code below) I don't think batching does it's sole purpose. Cause stmt.executeBatch() is called straight away after adding a batch(?) Wouldn't stmt.executeUpdate() do the same thing? public void tableChanged(TableModelEvent e) { int row = e.getFirstRow(); int col = e.getColumn(); model = (MyTableModel) e.getSource(); String stulpPav = model.getColumnName(col); Object data = model.getValueAt(row, col); Object studId = model.getValueAt(row, 0); System.out.println("tableChanded works"); try { new ImportData(stulpPav, data, studId); bottomLabel.setText(textForLabel()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (SQLException e1) { e1.printStackTrace(); } } public class ImportData { public ImportData(String a, Object b, Object c) throws ClassNotFoundException, SQLException { Statement stmt = null; try { connection = TableWithBottomLine.getConnection(); String stulpPav = a; String duom = b.toString(); String studId = c.toString(); System.out.println(duom); connection.setAutoCommit(false); stmt = connection.createStatement(); stmt.addBatch("update finance.fin set " + stulpPav + " = " + duom + " where ID = " + studId + ";"); stmt.executeBatch(); connection.commit(); } catch (BatchUpdateException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } finally { if (stmt != null) stmt.close(); connection.setAutoCommit(true); System.out.println("Data was imported to database"); } } }
has answer: http://stackoverflow.com/a/27542035
accepted answer: http://stackoverflow.com/a/27542035

http://stackoverflow.com/q/27576912
score: 1
tagged with: java
has body: I want to know why I did not need to specify a URL for a datasource object. This is maybe the other way round since most questions here seem to be why something did not work, but in this case, it did work, but I don't understand why. I wrote this code: import javax.sql.DataSource; import org.apache.derby.jdbc.ClientDataSource; ... public class DataSourceFactory { private static final transient Logger scribe = Logger.getLogger(MyUI.class.getName()); public static DataSource getDataSource() throws Exception { ClientDataSource ds = null; try { ds = new ClientDataSource(); ds.setDatabaseName("capitalism"); ds.setUser("alan"); ds.setPassword("insecure"); } catch (Exception e) { scribe.log(Level.SEVERE, "Mr Developer, you messed up", e); } return ds; } } then I used the new class thus, expecting something to go wrong: public class MyUI extends UI { transient private FileHandler handler; private static final transient Logger scribe = Logger.getLogger(MyUI.class.getName()); transient private DataSource ds; transient private Connection conn; protected void init(VaadinRequest vaadinRequest) { ... try { ds = DataSourceFactory.getDataSource(); } catch (Exception ex) { scribe.log(Level.SEVERE, "DataSource Didn't work", ex); } try { conn = ds.getConnection(); } catch (SQLException ex) { scribe.log(Level.SEVERE, "Connection Didn't work", ex); } try { statement = conn.createStatement(); } catch (SQLException ex) { scribe.log(Level.SEVERE, "Statement creation didn't work", ex); } String createSQL = "CREATE TABLE MYTABLE (FIRSTTHING VARCHAR(20), SECONDTHING VARCHAR(20))"; try { statement.executeUpdate(createSQL); } catch (SQLException ex) { scribe.log(Level.SEVERE, "Statement didn't work", ex); } But it didn't go wrong. It worked first time. Before I started working on datasources, ie when I just used DriverManager, I could not establish a connection without the URL of the database. I was expecting to go through a long learning curve finding out how to get the DataSource to recognise…
tagged with: derby
has comment: http://stackoverflow.com/comment/43581588
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/27578469
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27578469
has title: Why does datasource work correctly without a URL to the database?
upvote count: 1
type: Question

garbage-collection
tags question: http://stackoverflow.com/q/27634308
tags question: http://stackoverflow.com/q/27546046
tags question: http://stackoverflow.com/q/27625784
tags question: http://stackoverflow.com/q/27541787
tags question: http://stackoverflow.com/q/27507371
tag name: garbage-collection
tags question: http://stackoverflow.com/q/27502080
type: Tag
tags question: http://stackoverflow.com/q/27561735
tags question: http://stackoverflow.com/q/27587219
tags question: http://stackoverflow.com/q/27477967
tags question: http://stackoverflow.com/q/27577401
tags question: http://stackoverflow.com/q/27579185
tags question: http://stackoverflow.com/q/27599934
tags question: http://stackoverflow.com/q/27535191
tags question: http://stackoverflow.com/q/27543081
tags question: http://stackoverflow.com/q/27572324
tags question: http://stackoverflow.com/q/27497725

http://stackoverflow.com/q/27549176
upvote count: 3
downvote count: 0
tagged with: spring-test-mvc
favorite count: 0
has comment: http://stackoverflow.com/comment/43527400
type: UnansweredQuestion
has body: I am trying to test localization. My configuration is as given below @Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); String[] resources = {"/WEB-INF/i18n/messages"}; messageSource.setBasenames(resources); messageSource.setFallbackToSystemLocale(true); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } @Bean public LocaleChangeInterceptor localeChangeInterceptor() { LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); localeChangeInterceptor.setParamName("lang"); return localeChangeInterceptor; } @Bean public LocaleResolver localeResolver() { CookieLocaleResolver localeResolver = new CookieLocaleResolver(); localeResolver.setDefaultLocale(Locale.ENGLISH); return localeResolver; } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(localeChangeInterceptor()); } The test method looks like the one below @Test public void testParamLang() throws Exception { log.info("Param Test"); HttpHeaders headers = new HttpHeaders(); mockMvc .perform( get(URL).contentType(MediaType.APPLICATION_JSON) .param("lang", locale.getLanguage()).param(MSG_KEY, MSG_KEY_VAL)) .andExpect(status().isOk()).andDo(print()) .andExpect(content().string(messageSource.getMessage(MSG_KEY_VAL, null, locale))); } I am able to successfully change the locale via request but the test does not seem to work. Can someone please guide me as to what am I missing here.
has comment: http://stackoverflow.com/comment/43524871
tagged with: spring
score: 3
answer count: 0
tagged with: java
type: Question
has title: Spring Rest locale test not working

http://stackoverflow.com/comment/43470415
type: Comment
comment on: http://stackoverflow.com/q/27520145
has text: yes when I run for lesser number of records it works fine.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43499533
comment on: http://stackoverflow.com/a/27535330
type: AnswerComment
score: 0
has text: http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html Thank you Louis Wasserman I used the information you gave me and found the link above that explained my issue.
type: Comment

http://stackoverflow.com/comment/43595279
score: 0
comment on: http://stackoverflow.com/a/27585041
has text: Test complete. Results are on my answer. Strangly enough, the results say it took about 9000 seconds. While this is not true, the results are probably able to judge the faster method. Does the decimal show on the println method?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43581383
score: 0
type: Comment
has text: its worked. Thanks, I have done changes and finally it worked for me.
type: AnswerComment
comment on: http://stackoverflow.com/a/27577929

http://stackoverflow.com/comment/43514055
has text: How do you prevent id from clashing with an existing one if you're not generating them? Is there a particular reason you don't want to use a generated id and a separate id for programming use?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27526255

http://stackoverflow.com/q/27610950
has answer: http://stackoverflow.com/a/27610980
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/43644366
linked to: http://stackoverflow.com/q/2244387
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43644290
tagged with: java
upvote count: 1
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/27610986
answer count: 2
has title: what is 0xffffffff and << in java
has body: I'm wondering about this part of a code (it's an IP mask code) int mask = 0xffffffff &lt;&lt; (32 - prefix); System.out.println("Prefix=" + prefix); System.out.println("Address=" + ip); int value = mask; byte[] bytes = new byte[]{ (byte)(value &gt;&gt;&gt; 24), (byte)(value &gt;&gt; 16 &amp; 0xff), (byte)(value &gt;&gt; 8 &amp; 0xff), (byte)(value &amp; 0xff) }; try { InetAddress netAddr = InetAddress.getByAddress(bytes); System.out.println("Mask=" + netAddr.getHostAddress());

http://stackoverflow.com/comment/43642134
comment on: http://stackoverflow.com/q/27609818
has text: @CosminMihai A HTML parser is able to remove all tags in a much cleaner way than with regexes.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43497779
has text: But we clearly can't use a LinkedStack without instantiation? So isn't it pointless (or otherwise meaningless) to have static nodes here?
type: Comment
comment on: http://stackoverflow.com/a/27534580
score: 1
type: AnswerComment

http://stackoverflow.com/q/27564963
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43559417
accepted answer: http://stackoverflow.com/a/27573907
type: Question
has body: A load of tasks are submitted to my application but it keeps hanging and I track it down to this code: uk.ac.shef.wit.simmetrics.tokenisers.TokeniserWhitespace.tokenizeToArrayList(TokeniserWhitespace.java:133) uk.ac.shef.wit.simmetrics.similaritymetrics.CosineSimilarity.getSimilarity(CosineSimilarity.java:142) com.jthink.songkong.match.Scorer.compareValues(Scorer.java:74) com.jthink.songkong.match.Scorer.calculateTitle(Scorer.java:704) com.jthink.songkong.match.Scorer.matchRecordingOrTrackTitle(Scorer.java:652) com.jthink.songkong.match.Scorer.calculateTrackScoreWithinRelease(Scorer.java:538) com.jthink.songkong.match.Scorer.scoreMatrix(Scorer.java:396) com.jthink.songkong.match.Scorer.calculateReleaseScore(Scorer.java:1234) It is basically an string matching algorithm in a 3rd party library but it does not throw ThreadInterruptedException so does this mean I cannot interrupt it, but is certainly a long running process having run for 30 minutes. I have a reference to the thread monitoring this code but is there any way to stop it. Of course I am looking to fix the 3rd party library but in the meantime I need a way to stop my application hanging by cancelling these hanging tasks. What makes it worse for me is that I use Hibernate, and a hibernate session is created in this stack and then because this TokeniserWhitespace method never finishes my session (and hence database connection) is never released therefore eventually I ran out of database connections and the application completely hangs.
has comment: http://stackoverflow.com/comment/43562763
possible better answer: http://stackoverflow.com/a/27572814
has comment: http://stackoverflow.com/comment/43555254
has comment: http://stackoverflow.com/comment/43557583
has comment: http://stackoverflow.com/comment/43573471
has answer: http://stackoverflow.com/a/27572814
tagged with: concurrency
has comment: http://stackoverflow.com/comment/43561011
has answer: http://stackoverflow.com/a/27573907
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43569875
has comment: http://stackoverflow.com/comment/43581238
has comment: http://stackoverflow.com/comment/43555578
has comment: http://stackoverflow.com/comment/43562844
has comment: http://stackoverflow.com/comment/43560106
has comment: http://stackoverflow.com/comment/43562490
has title: How do I interrupt Java code that doesnt finish and doesnt throw ThreadInterruptionException

http://stackoverflow.com/q/27569859
tagged with: timer
has comment: http://stackoverflow.com/comment/43566238
has comment: http://stackoverflow.com/comment/43585518
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43565118
tagged with: swing
linked to: http://stackoverflow.com/q/1245388
score: 2
has comment: http://stackoverflow.com/comment/43565049
has comment: http://stackoverflow.com/comment/43565988
tagged with: java
has body: I am developing a shoot'em up type video game using Java Swing and I'm using a Java Swing Timer to control all of the screen updating. The main screen uses a BorderLayout, and I perform my graphics on a Panel contained within the BorderLayout, and use the AWT Graphics calls to draw. Now as my game progresses, I would like to speed up the movement of my screen objects (ships), yet I still want them to smoothly cross the screen. I thought I could speeed things up by dropping the timeout value for the Java Swing Timer, down to around 5ms. But, I've noticed when I set it to anything less than 15ms, there does not seem to be much difference. Once you cross that threshold, there is almost no noticeable difference in performance. -Why is that?- Another option would be to increase how many pixels each ship moves per update, but anything beyond 3 or 4 pixels, and things start to look jumpy. Any ideas? And really want to keep the game in Swing, would prefer at this point not porting to a 3rd party library. Thanks.
type: Question
answer count: 2
downvote count: 0
has title: Java 2D Game Performance with Java Swing Timer
has comment: http://stackoverflow.com/comment/43565385
upvote count: 2
tagged with: graphics2d
has answer: http://stackoverflow.com/a/27570059
has answer: http://stackoverflow.com/a/27571024
favorite count: 0

http://stackoverflow.com/comment/43605905
type: QuestionComment
has text: `how does this work?` It **doesn't**. The launcher Activity is stored in the Manifest. BUT! You can use a fake "Splash-Screen" to launch this or that Activity, based on a string you can store in the Preferences. THIS is possible.
comment on: http://stackoverflow.com/q/27591053
score: 0
type: Comment

http://stackoverflow.com/comment/43418090
type: QuestionComment
comment on: http://stackoverflow.com/q/27492795
score: 0
has text: Note that `getExternalStorageDirectory()` is for [external storage](http://commonsware.com/blog/2014/04/08/storage-situation-external-storage.html), which is not usually an "sdcard". You may have better luck using the `MediaStore` `ContentProvider` to find your MP3 streams.
type: Comment

http://stackoverflow.com/comment/43670038
type: Comment
type: QuestionComment
has text: It should be checked, if the moved file in the new location is completely on the disc and e.g. writtable
comment on: http://stackoverflow.com/q/27623933
score: 0

http://stackoverflow.com/comment/43387847
score: 0
has text: Can you tell me how to fix it in the future so I don't do it again?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27476892

http://stackoverflow.com/comment/43694613
type: Comment
comment on: http://stackoverflow.com/a/27636936
has text: @Kurtt.Lin - Check my edit. Also, check *Marko Toplonik's* answer. He is the one who taught me *Escape Analysis* :P
score: 0
type: AnswerComment

http://stackoverflow.com/comment/53797596
comment on: http://stackoverflow.com/a/28331991
type: AnswerComment
has text: Shutdown is a good option. But, what I'm experiencing, is that Tomcat gives 30 sec to shutdown. When calling `Unirest.shutdown()` the `SyncIdleConnectionMonitorThread` (one of the 3 services `shutdown` shuts down) will wait for 5 sec, then may wait for another 30 sec. Do you know how to: force a faster shutdown, or increase the 30 sec Tomcat allowed shutdown time (or war stop time)?
score: 1
type: Comment

http://stackoverflow.com/comment/43651117
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27614557
has text: I require this byte array from string elliot..[149,229,240 ,182 ,152 ,142 ,199, 3 ,232 ,50, 23, 47, 112, 206 ,125, 199]

http://stackoverflow.com/q/27540390
answer count: 0
has title: Cannot open file using Runtime.getRuntime().exec when file name contains special character on Window 8.1
tagged with: runtime.exec
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43540600
has body: I try to use the following code to open a specific file on Window 8.1 public static void main(String[] args) throws Exception { if (args.length &gt; 0) { File file = new File(args[0]); if (file.exists()) { try { Runtime.getRuntime().exec(new String[]{"rundll32", "url.dll,FileProtocolHandler", file.getAbsolutePath()}); } catch(Exception e) { e.printStackTrace(); } } else { System.out.println("File does not exist"); } } } The file cannot be opened if there are special characters in file name. For example: args[0] = 新正如意 新年发财.txt How can I fix this problem? Thanks in advance
score: 0
tagged with: windows-8.1
linked to: http://stackoverflow.com/q/7660651
tagged with: rundll32
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43508698

http://stackoverflow.com/comment/43676767
comment on: http://stackoverflow.com/a/27627738
type: Comment
has text: Nice,I was bit lazy,but you did the hard work,cheers.. :) +1,Add some code example,will be helpful to him
score: 0
type: AnswerComment

http://stackoverflow.com/q/27490285
type: UnansweredQuestion
has title: Maven Pax Runner cannot parse provision file
tagged with: maven
tagged with: war
has body: if I have a profile defined as follows in the Maven plugin: org.ops4j maven-pax-plugin --log=debug --platform=felix --profiles=compendium,web,war then I get the following error: Caused by: org.ops4j.pax.scanner.UnsupportedSchemaException: Provisioning scheme is not specified at org.ops4j.pax.scanner.ProvisionSpec.<init>(ProvisionSpec.java:87) at org.ops4j.pax.scanner.composite.internal.CompositeScanner.scan(CompositeScanner.java:156) ... 41 more The plugin does not understands web an war profile. Why??
score: 1
tagged with: java
type: Question
tagged with: pax-runner
upvote count: 1
favorite count: 0
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/43473623
score: 0
type: Comment
type: QuestionComment
has text: "it is not working in the right way": What was the input, what should it have done, and what did it do instead?
comment on: http://stackoverflow.com/q/27522131

http://stackoverflow.com/q/27494862
has comment: http://stackoverflow.com/comment/43421643
downvote count: 1
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43421490
type: Question
has answer: http://stackoverflow.com/a/27494914
has title: how do I convert 32 bit java programs to 64 bit
upvote count: 0
answer count: 1
favorite count: 0
has body: I have been in a programming class for a semester of school and we have been developing a game now for a while. we recently finished and i wanted to play it with my friend. The issue my friend and i had is that the game was programmed for java 32 bit and we both use java 64 bit. I understand a reasonable solution would be to install java 32 bit but having this messes up a mod manager my friend is using. I would like to know if there is any way to convert a 32 bit java program to 64 bit. I've searched for hours now and have found nothing. Please tell me is there is a way to convert the program instead of recoding the entire game.
linked to: http://stackoverflow.com/q/783662
has comment: http://stackoverflow.com/comment/43421808
has comment: http://stackoverflow.com/comment/43421678
has comment: http://stackoverflow.com/comment/43421529
duplicate of: http://stackoverflow.com/q/783662
has comment: http://stackoverflow.com/comment/43421587
has comment: http://stackoverflow.com/comment/43421494
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43421708
tagged with: 64-bit

arraylist
tags question: http://stackoverflow.com/q/27539923
tags question: http://stackoverflow.com/q/27635637
tags question: http://stackoverflow.com/q/27583587
tags question: http://stackoverflow.com/q/27505137
tags question: http://stackoverflow.com/q/27486442
tags question: http://stackoverflow.com/q/27519966
tags question: http://stackoverflow.com/q/27501994
tags question: http://stackoverflow.com/q/27483321
tags question: http://stackoverflow.com/q/27631088
tags question: http://stackoverflow.com/q/27623679
tags question: http://stackoverflow.com/q/27616651
tags question: http://stackoverflow.com/q/27631280
tags question: http://stackoverflow.com/q/27475324
tags question: http://stackoverflow.com/q/27604551
tags question: http://stackoverflow.com/q/27492660
tags question: http://stackoverflow.com/q/27635757
tags question: http://stackoverflow.com/q/27493983
tags question: http://stackoverflow.com/q/27492636
tags question: http://stackoverflow.com/q/27594436
tags question: http://stackoverflow.com/q/27518247
tags question: http://stackoverflow.com/q/27631648
tags question: http://stackoverflow.com/q/27581220
tags question: http://stackoverflow.com/q/27582822
tags question: http://stackoverflow.com/q/27587394
tags question: http://stackoverflow.com/q/27577193
tags question: http://stackoverflow.com/q/27545416
tags question: http://stackoverflow.com/q/27560286
tags question: http://stackoverflow.com/q/27485794
tags question: http://stackoverflow.com/q/27531893
tags question: http://stackoverflow.com/q/27564670
tags question: http://stackoverflow.com/q/27489796
tags question: http://stackoverflow.com/q/27606449
tags question: http://stackoverflow.com/q/27637371
tags question: http://stackoverflow.com/q/27491761
tags question: http://stackoverflow.com/q/27515269
tags question: http://stackoverflow.com/q/27572836
tags question: http://stackoverflow.com/q/27520396
tags question: http://stackoverflow.com/q/27613841
tags question: http://stackoverflow.com/q/27515347
tags question: http://stackoverflow.com/q/27503949
tags question: http://stackoverflow.com/q/27514459
tags question: http://stackoverflow.com/q/27588448
tags question: http://stackoverflow.com/q/27494298
tags question: http://stackoverflow.com/q/27584608
tags question: http://stackoverflow.com/q/27631183
tags question: http://stackoverflow.com/q/27632511
tags question: http://stackoverflow.com/q/27533374
tags question: http://stackoverflow.com/q/27567125
tags question: http://stackoverflow.com/q/27539419
tags question: http://stackoverflow.com/q/27565172
tags question: http://stackoverflow.com/q/27560359
tags question: http://stackoverflow.com/q/27634946
tags question: http://stackoverflow.com/q/27524394
tags question: http://stackoverflow.com/q/27596464
tags question: http://stackoverflow.com/q/27625161
tags question: http://stackoverflow.com/q/27497005
tags question: http://stackoverflow.com/q/27561743
tags question: http://stackoverflow.com/q/27525404
tags question: http://stackoverflow.com/q/27507266
tags question: http://stackoverflow.com/q/27482528
tags question: http://stackoverflow.com/q/27634428
tags question: http://stackoverflow.com/q/27493402
tags question: http://stackoverflow.com/q/27569964
tags question: http://stackoverflow.com/q/27509421
tags question: http://stackoverflow.com/q/27558264
tags question: http://stackoverflow.com/q/27557918
tags question: http://stackoverflow.com/q/27639439
tags question: http://stackoverflow.com/q/27628096
tags question: http://stackoverflow.com/q/27626652
tags question: http://stackoverflow.com/q/27547908
type: Tag
tags question: http://stackoverflow.com/q/27535895
tags question: http://stackoverflow.com/q/27523292
tags question: http://stackoverflow.com/q/27481282
tags question: http://stackoverflow.com/q/27628229
tag name: arraylist
tags question: http://stackoverflow.com/q/27547151
tags question: http://stackoverflow.com/q/27488336
tags question: http://stackoverflow.com/q/27512052
tags question: http://stackoverflow.com/q/27600975

http://stackoverflow.com/comment/43490520
has text: @chr911 You're welcome :) Please do click the tick to mark as accepted answer if you found it useful (gets you some rep too).
type: Comment
comment on: http://stackoverflow.com/a/27530423
score: 0
type: AnswerComment

mbeans
tags question: http://stackoverflow.com/q/27585534
tags question: http://stackoverflow.com/q/27564719
type: Tag
tag name: mbeans

http://stackoverflow.com/a/27565101
has body: Once you get your array, you can iterate through all the elements of it. for(JsonElement e : array) { System.out.println(e); } which will output "foo" ["foot mercato","football","foot center","foorzik","footao"] If you only want the values in the nested array, you can do: JsonArray nestedArray = parser.parse(jsonStr).getAsJsonArray().get(1).getAsJsonArray(); for(JsonElement e : nestedArray) { System.out.println(e); } which will output "foot mercato" "football" "foot center" "foorzik" "footao"
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27564958
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27564958

http://stackoverflow.com/comment/43619772
type: QuestionComment
type: Comment
has text: config file means tomcat config files?
score: 0
comment on: http://stackoverflow.com/q/27502882

geotools
type: Tag
tags question: http://stackoverflow.com/q/27605270
tags question: http://stackoverflow.com/q/27623620
tags question: http://stackoverflow.com/q/27604978
tags question: http://stackoverflow.com/q/27599673
tag name: geotools

http://stackoverflow.com/a/52976082
downvote count: 0
type: Answer
has body: Just to update on All. You can download the bundle certificate which contains many certificates of Amazon from here https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem. If you see the content of that pem it contains many certificates. Split it to multiple PEM files where each file will contain like this -----BEGIN CERTIFICATE----- [main content] -----END CERTIFICATE----- Then run this command for every cert file that you created keytool -import \ -keystore $JAVA_HOME/jre/lib/security/cacerts \ -storepass changeit -noprompt \ -alias $ALIAS -file $YOUR_INDIVIDUAL_PEM_FILE Just for making your life easy somebody has just created bash script for this : https://gist.github.com/shareefhiasat/dabe5e96dbd7123c7b101aac1c0eca8a
score: 4
answers question: http://stackoverflow.com/q/27536380
upvote count: 4

http://stackoverflow.com/comment/43587648
comment on: http://stackoverflow.com/q/27580888
type: Comment
type: QuestionComment
has text: Your code works fine at me. Check your authentication.
score: 0

http://stackoverflow.com/comment/43550061
score: 0
comment on: http://stackoverflow.com/q/27561957
type: Comment
type: QuestionComment
has text: Hmm. I don't have Netbeans installed so can't reproduce it myself - but it works fine with `javac`. Out of interest, can you find the compiled `.class` files? Can you launch it from the command line without any problems?

http://stackoverflow.com/a/27547136
type: Answer
answers question: http://stackoverflow.com/q/27547030
has body: you can try; s.clear(); s.insert(0,"60");
score: 0

http://stackoverflow.com/a/27618495
has body: Accessing a file on a Windows share will not work directly. See connecting to shared folder in windows with java for more info on how to do that.
answers question: http://stackoverflow.com/q/27617786
score: 0
type: Answer

http://stackoverflow.com/q/27620570
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43661909
has answer: http://stackoverflow.com/a/27620999
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/43661900
has comment: http://stackoverflow.com/comment/43661829
has title: can't get bean to show on jsp
tagged with: java
has comment: http://stackoverflow.com/comment/43662291
has body: I've got a bean called User.java. In the DAO, (from the database) it pulls a field called classRegistrationDate, and sets it to User.classRegistrationDate. I created a Boolean called isRegistrationLocked, and if the registrationDate is before 12/20/2014, I set it to true, else it's set to false. Bean: public Boolean isRegistrationLocked= false; public boolean getIsRegistrationLocked() { return isRegistrationLocked; } public void setRegistrationLocked(boolean isRegistrationLocked) { this.isRegistrationLocked= isRegistrationLocked; } DAO: DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); Date classRegistrationDate= user.getClassRegistrationDate(); Date releaseDate= df.parse("12/20/2014"); if(classRegistrationDate.before(releaseDate)) { fi.setRegistrationLocked(true); } else { fi.setRegistrationLocked(false); } Data has been verified, and the values are being passed and set correctly. In the jsp, I need to show and hide a based on the value of isRegistrationLocked. JSP: &lt;html:hidden property="user.isRegistrationLocked" value="${user.isRegistrationLocked}" /&gt; &lt;c:if test="${user.isRegistrationLocked eq false}"&gt; &lt;tr&gt; &lt;td class="text"&gt; FALSE &lt;/td&gt; &lt;/tr&gt; &lt;/c:if&gt; &lt;c:if test="${user.isRegistrationLocked ne true}"&gt; &lt;tr&gt; &lt;td class="text"&gt; TRUE &lt;/td&gt; &lt;/tr&gt; &lt;/c:if&gt; But the value comes across as false all the time, so it's not being accessed properly. I've tried just outputting the value using and nothing even shows; it appears in the html as a blank. Where am I going wrong, and how can I get the value over to be evaluated?
type: Question
has comment: http://stackoverflow.com/comment/43662219
tagged with: jsp
has comment: http://stackoverflow.com/comment/43661993

http://stackoverflow.com/a/74500772
score: 1
answers question: http://stackoverflow.com/q/27604251
upvote count: 1
type: Answer
has body: You can fit Normal (Gaussian) distribution between ~[0,1] with adjusting mean and std. For example, use mean = 0.5, std = 0.15, and you will get value between [0,1] with total probability of 99.91%. In the end, you can ensure that value is strictly between [0,1]. Supplier&lt;Double&gt; alphaSupplier = new Supplier&lt;Double&gt;() { @Override public Double get() { double value = new Random().nextGaussian() * 0.15 + 0.5; return Math.max(0, Math.min(1, value)); } }; double random value = alphaSupplier.get();
downvote count: 0

http://stackoverflow.com/comment/43465136
comment on: http://stackoverflow.com/q/27517265
type: QuestionComment
type: Comment
has text: You'll also need to parse the wav file to extract the audio samples. http://stackoverflow.com/questions/8754111/how-to-read-the-data-in-a-wav-file-to-an-array
score: 0

http://stackoverflow.com/comment/43426005
type: Comment
has text: Have done as you said ArrayList list = new ArrayList(); ArrayList list1 = new ArrayList(); Created two arraylist--list.add(rs.getString("path")); list1.add(rs.getString("name")); added value to arraylists.. Thanks sir
comment on: http://stackoverflow.com/a/27497054
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43497934
has text: @Vladimir I just posted an example of a clone() method you could use that returns a clone of the object but changes the address of the returned clone while it leaves everything else the same...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27534476

http://stackoverflow.com/comment/43431236
comment on: http://stackoverflow.com/a/27498166
has text: yes your assumption is correct.but i am gettig this error DummyPinnedKey cannot be cast to org.hibernate.cache.QueryKey.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43611947
comment on: http://stackoverflow.com/q/27594052
type: Comment
type: QuestionComment
has text: You can easily create a new class that "looks like" your serialized class to the VM. For starters, 1) Make sure your "new class" is as similar as possible to the original class, 2) Make sure the serialVersionUID is the same. Check out this article: http://www.ibm.com/developerworks/library/j-5things1/. And be sure to get the [JD-GUI](http://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip) to analyze your class in greater detail.
score: 0

http://stackoverflow.com/a/27614370
downvote count: 0
score: 1
has body: This should be enough: List&lt;URI&gt; uris = Stream.of(string.split("\\s+")).map(URI::create).collect( Collectors.toList()); It will throw an exception if any invalid input is encountered, but I'm of the opinion that errors should be exposed, not quietly suppressed.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27614119
answers question: http://stackoverflow.com/q/27614119
type: Answer

http://stackoverflow.com/comment/43698152
type: Comment
score: 3
has text: Do you have some code to start with?
comment on: http://stackoverflow.com/q/27639710
type: QuestionComment

http://stackoverflow.com/q/27484109
type: Question
tagged with: sax
answer count: 1
has body: I'm building a process that creates XML (from a variety of sources and for a variety of purposes that I don't know in advance) and I want to pump the resulting XML directly into standard XML processing like SAX, StAX, and DOM. I've already done a StAX implementation that first produces an XML file and the StAX process reads the file. But I'd really like to skip the intermediate file creation and read. It seems like SAX is the right choice because a push parser is well suited for the job; processing the XML as it becomes available. I don't quite see how to set up simply passing strings from one Java component into the SAX parser process. Most examples I've found read files and there are some that use URLConnection in support of service type applications. The source in this case will be another Java component that is part of the same system.
has answer: http://stackoverflow.com/a/27714026
score: 0
tagged with: java
has title: Java Passing Strings to SAX
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/27714026
tagged with: saxparser
type: AnsweredQuestion

http://stackoverflow.com/a/27623605
has body: The issue is resolved, the problem is, doInBackground() method returns a String return description.toString(); and the value of that String is set inside if block, but when else block is executed, the value of description.toString() isn't set and thus remains null, which caused doinBackground method to return a null value when else block is executed. I am not sure why it caused the onCancelled() method to not execute and not throw any error or exception. I returned another String inside else block and it fix the problem. else { mProgressDialog.dismiss(); Log.e("Status",isCancelled() + ", before cancel"); cancel(true); Log.e("Status",isCancelled() + ", after cancel"); return "Something"; }
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/27622205
has comment: http://stackoverflow.com/comment/43669562
answers question: http://stackoverflow.com/q/27622205
score: 1

http://stackoverflow.com/comment/43670740
type: AnswerComment
has text: Sweet, I'll check this out as well. I mostly wanted to get some different perspectives, to help me think outside my python mindset. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/27625119
score: 0

http://stackoverflow.com/comment/43698271
score: 0
type: QuestionComment
type: Comment
has text: any difference between `which` and `wich`? which you are using on Positive Button Click
comment on: http://stackoverflow.com/q/27639727

http://stackoverflow.com/q/27585299
has comment: http://stackoverflow.com/comment/43595305
favorite count: 0
accepted answer: http://stackoverflow.com/a/27663807
has title: Android NDK (with SDL) build infrastructure clarification
has answer: http://stackoverflow.com/a/27663807
score: 2
tagged with: build
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I'm relatively new to building stuff with Android, Java, NDK, and SDL. But I've been futzing around in an example project I'm building and there's a lot that I find very confusing. Here's a printout of my file structure- for reference: MyProj -android-project //I created this to dump android-specific junk into --src //java source files --jni //"java native interface" - c/c++ source files --AndroidManifest.xml //packaged with .apk to inform OS of various details of app --bin //binary files? ---AndroidManifest.xml //Copy of AndroidManifest.xml in above dir? ---AndroidManifest.xml.d ---SDLActivity-debug-unaligned.apk ---SDLActivity-debug-unaligned.apk.d ---SDLActivity-debug.apk ---SDLActivity.ap_ ---SDLActivity.ap_.d ---build.prop ---classes ---classes.dex ---classes.dex.d ---dexedLibs ---proguard.txt ---res ---rsLibs ---rsObj --gen //no idea --libs //no idea --obj //no idea --res //no idea --build.xml //points to files regarding build config --default.properties //auto-generated? --local.properties //auto-generated? --project.properties //auto-generated? So, I have a few specific questions, but if I'm wrong about any assumptions or there's a tidbit of info that you think I might be missing I'd really appreciate hearing about it! Anyways- The 'bin' folder: I'd assume "bin" is for binaries... right? But it seems like it isn't. It contains a copy of AndroidManifest.xml (why?), a couple other text-y things, my project's .apk, and a bunch of folders I also don't understand. It also has a bunch of copies of things with '.d' appended to it ('AndroidManifest.xml.d', for example). Why? Also, if I wipe this folder, ndk-build fails. So it seems like there are build-relevant config files in here? (edit: this was due to a faulty makefile on my part- thank god too. that part REALLY didn't make sense...) I guess my questions are these: What is the role of the bin folder? What are the .d files? What files are safe to delete (get generated during build)? 'gen', 'libs', 'obj', 'res' fo…
tagged with: android-ndk
type: Question
upvote count: 2
tagged with: sdl
answer count: 1

http://stackoverflow.com/comment/43690278
has text: whart error reponse you are getting???
comment on: http://stackoverflow.com/q/27635392
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27593003
has title: Unable to execute multiple SQL queries with Data Source connection
tagged with: java
tagged with: executequery
has answer: http://stackoverflow.com/a/27593453
tagged with: mysql
has comment: http://stackoverflow.com/comment/43609672
type: Question
tagged with: datasource
has comment: http://stackoverflow.com/comment/43610353
score: 0
has comment: http://stackoverflow.com/comment/43611277
has comment: http://stackoverflow.com/comment/43610129
answer count: 1
has comment: http://stackoverflow.com/comment/43610481
has comment: http://stackoverflow.com/comment/43609782
type: UnansweredQuestion
has body: I am trying to execute multiple queries but only a part of the queries gets executed. Here is my code: public class PostPrReqDaoImpl implements PostPrReqDaoInterface { @Override public boolean validate(PostPrReqBean pprb1,PostPrReqBean pprb2,PostPrReqBean pprb3,PostPrReqBean pprb4) { System.out.println("Inside PostPrReq Dao"); int resstat=1; //snuname,snuusrname,snupass,snuempid,snuemail,snudob,snuskill,snuexp,snudesg; java.io.PrintWriter out = null; try { out = pprb1.getBeanresponse().getWriter(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } pprb1.getBeanresponse().setContentType("text/html"); try { /* get the DataSource from using the JNDI name */ Class.forName("com.mysql.jdbc.Driver"); InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/Test"); //username, pass,name, id,dob ,skillset, exp,designation ,email //Create connection and then continue as usual other JDBC calls Connection conn=ds.getConnection(); System.out.println("Connection succesful!"); Statement s1= conn.createStatement(); Statement s2= conn.createStatement(); Statement s3= conn.createStatement(); Statement s4= conn.createStatement(); if(resstat == 1) { String sqlproj = "INSERT INTO tblproject (name,code,location,type,lastdate) " + "VALUES ('" + pprb1.getBeanprojname() + "' , " + "'" + pprb1.getBeanprojcode() +"' ," + "'" + pprb1.getBeanprojlocation() +"' ," + "'" + pprb1.getBeanprojtype() +"' ," + "'" + pprb1.getBeanprojlastdate() +"')"; String sqlreq1="INSERT INTO tblrequirements (code,designation,skillset,exp,ncand)" + "VALUES ('" + pprb1.getBeanprojcode() + "' , " + "'" + pprb2.getBeandesg() +"' ," + "'" + pprb2.getBeanskill() +"' ," + "'" + pprb2.getBeanexp() +"' ," + "'" + pprb2.getBeanncand() +"')"; String sqlreq2="INSERT INTO tblrequirements (code,designation,skillset,exp,ncand)" + "VALUES ('" + pprb1.getBeanprojcode() + "' , " + "'" + pprb3.getBeandesg() +"' ," + "'" + pprb3.getBeanskill() +"' ," + "'…
has comment: http://stackoverflow.com/comment/43609640

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/27622754
type: Tag

http://stackoverflow.com/comment/43524574
comment on: http://stackoverflow.com/a/27548288
score: 0
type: AnswerComment
type: Comment
has text: Thanks, Jon Skeet! Exactly what I was looking for.

http://stackoverflow.com/q/27568294
score: 1
has comment: http://stackoverflow.com/comment/43562058
tagged with: java
accepted answer: http://stackoverflow.com/a/27568665
type: Question
tagged with: encoding
has title: UTF-8 characters in header in HTTPURLConnection Java
answer count: 1
downvote count: 0
has body: urlConnection.setRequestProperty("content-type", "application/x-www-form-urlencoded"); urlConnection.setRequestProperty("something", "***UTF-8 characters here***"); In the server side (nodejs), something == ?????. How can we send those characters in header in UTF-8?
has comment: http://stackoverflow.com/comment/43562461
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/27568665
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/43517997
has text: @AvinashRaj you are correct, it won't. I don't think that matters here. If I interpret the OP's question correctly, the importance is whether `;` is present or not. If so, whichever character follows is irrelevant. If not, the input must end. My interpretation might be wrong though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27545388
type: Comment

http://stackoverflow.com/q/27565998
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43557752
favorite count: 0
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/27566059
has answer: http://stackoverflow.com/a/27566059
accepted answer: http://stackoverflow.com/a/27566092
has comment: http://stackoverflow.com/comment/43557193
has comment: http://stackoverflow.com/comment/43557164
tagged with: java
has body: By mistake i have entered the below line in my JAVA code and got a surprising output. Can anyone please help me to understand how it is happening. Code: System.out.printf("Value :"+0.40+010+0.60); Output: value :0.480.6
score: 2
downvote count: 0
has title: Unexpected number formatting in printed String
tagged with: number-formatting
tagged with: printf
has answer: http://stackoverflow.com/a/27566092
type: Question

http://stackoverflow.com/comment/43403690
type: Comment
has text: @EladBenda Runtime exception are unchecked exception . Thats why no need to declare
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27485870

http://stackoverflow.com/comment/43676454
type: Comment
has text: Use of `while(true)` and `break` is bad practice; instead you should put your `if` condition as the `while` condition.
type: AnswerComment
comment on: http://stackoverflow.com/a/27627698
score: 0

http://stackoverflow.com/q/27559780
has comment: http://stackoverflow.com/comment/43546732
score: 0
has title: Some unknown exception in Android - App crashed with nothing in Logcat
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32199710
tagged with: android
tagged with: android-studio
has comment: http://stackoverflow.com/comment/43545733
type: Question
tagged with: java
has body: This exception spent me lots of time. When user press a button , app will send two http request. PMNetworkOperation.getSourceDataAppList() and PMVendorNetWork.getInstance().getVendorDownloadedAppList(), both of them are async request. After request completing, they will use the below methods to save the data. static public void setVendorAppList(ArrayList appList) { MixAppListHandler.vendorAppList = appList; mixAppList(); } static public void setSourceAppList(ArrayList appList) { MixAppListHandler.sourceAppList = appList; mixAppList(); } The method mixAppList() : static private synchronized void mixAppList() { if (requestFlag != 1 ) { requestFlag ++; } else { requestFlag = 0; // mix data ... } } When the requestFlag is equal to 1, MixAppListHandler will execute datas. These all data are static. The question is when first request complete , after requestFlag modified to 1, the variables window show Collecting data and then Disconnect …. After that my app closed on my mobile with nothing output in Logcat. My IDE is Android Studio 1.0.1. Is there any one can help me to solve this question? Thanks.

http://stackoverflow.com/comment/43686607
comment on: http://stackoverflow.com/a/27632766
type: AnswerComment
score: 0
has text: So the primary problem is that the members are declared static. If they are not static it will work... and then the reference needs an initialized book object ;-)... eatSleepCode you are completely right.
type: Comment

http://stackoverflow.com/comment/43742105
has text: One thing I am learning about "merge()" and the dirty flag for detached objects, is that first hibernate loads the full object (and all members) then it sees that the one thing that does not match is the digitizer which client 2 has updated (see test 2, updated in my post), then it issues that single dynamic-update statement: Hibernate: /* update com.richardsoncap.ews.model.Order */ update Orders set digitizer_id=? where Id=? So how would hibernate (or I for that mater) know that order.digitizer has not changed for the current client so should not get the dirty flag/update?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27605198
type: Comment

http://stackoverflow.com/comment/43400185
score: 2
has text: Maybe take a look at [`ProgressMonitor`](https://docs.oracle.com/javase/7/docs/api/javax/swing/ProgressMonitor.html) or [`ProgressMonitorInputStream`](https://docs.oracle.com/javase/7/docs/api/javax/swing/ProgressMonitorInputStream.html)
comment on: http://stackoverflow.com/q/27483947
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43475603
type: Comment
comment on: http://stackoverflow.com/a/27523320
has text: I see, so why don't you stick to the respective javadoc? `"The select list of the query must contain only a single item, which must be assignable to the type specified by the resultClass argument."`
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43657292
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27596820
has text: I mean to say if i select one employee getemployeeData that i have mention is called only one times,If i select two employee it is two times,Here even if i select only one employee getemployeeData function called multiple times,I meant to say getemployeeData goes in looping
score: 0

http://stackoverflow.com/q/27481622
type: Question
has body: I want to create a tool for automatically search on google some keyword defined by the user and give back the results list to the user. As i don't want to use any proxy or pre-built anonymous networks, i choose to drive this searches through the TOR browser. So, i need to build my tool and let him "drive" the TOR browser to: - open the TOR browser; - insert data in Google search box; - extract the result list and show it to the user; - refresh the IP address of TOR browser and proceed with the following search. Do i have to build something in Java and let the tool interfacing with TOR browser? Is there any other way to control TOR browser, simulating a user who open it, open Google, search the keywords, etc? Many thanks for your time.
has comment: http://stackoverflow.com/comment/43395936
answer count: 1
accepted answer: http://stackoverflow.com/a/27481718
tagged with: java
downvote count: 5
has title: Software to control TOR browser
tagged with: tor
type: AnsweredQuestion
upvote count: 0
score: -5
favorite count: 0
has answer: http://stackoverflow.com/a/27481718

http://stackoverflow.com/comment/43665498
score: 0
type: Comment
has text: you like to insert data into customer/supplier or need to create those tables?
type: QuestionComment
comment on: http://stackoverflow.com/q/27622228

http://stackoverflow.com/q/27622536
has comment: http://stackoverflow.com/comment/43673215
has answer: http://stackoverflow.com/a/27622707
type: Question
has comment: http://stackoverflow.com/comment/43677684
has body: In swing I made a JLabel (for a chronometer). I am using a thread that loops and sleeps every second, so every second I write the seconds. Code: new thread(){ public void run(){ int i=0; while(true){ try{ sleep(1000); }catch(Exception e){} i++; jlabel1.settext(i); } } }.start(); Then I use another thread for a moving panel jpanel1 new thread(){ public void run(){ while(true){ try{ sleep(100); }catch(Exception e){} j+=15; j=j%400; jpanel1.setLocation(j,50); } } }.start(); How do I fix this code because when the setText() of the label is done for every second the panel acts weirdly (he starts from the origin then he go back to it current point) all my research says that Java's swing and awt are not a safe methods when it comes to paint components. Can someone help me fix this?
has title: How to make a JLabel's setText a safe method
answer count: 1
has comment: http://stackoverflow.com/comment/43687079
accepted answer: http://stackoverflow.com/a/27622707
score: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43666544
tagged with: swing
has comment: http://stackoverflow.com/comment/43666846
has comment: http://stackoverflow.com/comment/43665824
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43666555
tagged with: java

http://stackoverflow.com/q/27616100
answer count: 2
has answer: http://stackoverflow.com/a/27616155
accepted answer: http://stackoverflow.com/a/27616155
tagged with: sql
upvote count: 1
tagged with: sqlite
favorite count: 0
has body: I am getting this exception at runtime: SQLite Exception: near "=": syntax error (code 1): , while compiling: UPDATE person_table SET person_name=? WHERE _id = Below I am posted the codes related to that.I am mentioned the error line 51 and 56th line in below codes. Stacktrace: 12-23 02:02:19.060: E/SQLiteLog(3011): (1) near "=": syntax error 12-23 02:02:19.060: D/AndroidRuntime(3011): Shutting down VM 12-23 02:02:19.060: W/dalvikvm(3011): threadid=1: thread exiting with uncaught exception (group=0xb3a8bba8) 12-23 02:02:19.100: E/AndroidRuntime(3011): FATAL EXCEPTION: main 12-23 02:02:19.100: E/AndroidRuntime(3011): Process: com.android.timesheet, PID: 3011 12-23 02:02:19.100: E/AndroidRuntime(3011): android.database.sqlite.SQLiteException: near "=": syntax error (code 1): , while compiling: UPDATE person_table SET person_name=? WHERE _id = 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1572) 12-23 02:02:19.100: E/AndroidRuntime(3011): at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1520) 12-23 02:02:19.100: E/AndroidRuntime(3011): at com.android.timesheet.database.PersonDatabaseHelper.updateData(PersonDatabaseHelper.java:51) 12-…
linked to: http://stackoverflow.com/q/17230049
tagged with: android
tagged with: android-sqlite
has title: SQLite Exception: near "=": syntax error (code 1): , while compiling: UPDATE person_table SET person_name=? WHERE _id =
has comment: http://stackoverflow.com/comment/43653954
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/27616165
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27616165
has comment: http://stackoverflow.com/comment/43654361
type: Question

http://stackoverflow.com/a/27603602
has comment: http://stackoverflow.com/comment/43629867
score: 0
has body: you can create different Beans for Storage Object and inject with there reference. <property name="storage" ref="storageA" />
type: Answer
answers question: http://stackoverflow.com/q/27603431

http://stackoverflow.com/comment/43503025
score: 1
comment on: http://stackoverflow.com/q/27537269
has text: It's not a bug. The Build Tool doesn't recognize the package name change and reuses the cache. "Clean Project" forces to rebuild all the classes.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43691398
has text: Sorry but this is not working as expected. It is just adding a new line instead of handling escape sequences.
comment on: http://stackoverflow.com/q/27635928
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27511066
has comment: http://stackoverflow.com/comment/43453385
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/43454960
accepted answer of: http://stackoverflow.com/q/27510768
type: Answer
has comment: http://stackoverflow.com/comment/43454065
has comment: http://stackoverflow.com/comment/43453327
has comment: http://stackoverflow.com/comment/43453067
has body: You do not need the temporary file. As a rule of thumb I only write to files if I'm going to close my program, reopen it and expect said data. I would make out a StringBuilder and append each line to it instead of the file. Then use the string builder to write back to the file. StringBuilder fileOutput = new StringBuilder(); //your per line logic //instead of out.write() use fileOutput.append() System.out.println(String.format("File.canWrite() says %s", inputFile.canWrite()); PrintWriter fileToWrite = new PrintWriter(inputFile); fileToWrite.println(fileOutput.toString()); fileToWrite.close(); If you want to save the previous content of the file, write the previous contents to your StringBuilder before you write anything. Use this if you'd like the previous data saved. String current line = ""; StringBuilder fileOutput = new StringBuilder(); while((currentLine = reader.readLine()) != null) { fileOutput.append(currentLine) } //the rest of the code above (obviously don't set `fileOutput` twice though)
has comment: http://stackoverflow.com/comment/43453133
answers question: http://stackoverflow.com/q/27510768
has comment: http://stackoverflow.com/comment/43453639

http://stackoverflow.com/a/27630437
has comment: http://stackoverflow.com/comment/43681877
score: -1
has body: Use array[0] = array[array.length - 1]; to access the last item in the Array.
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/27630178
upvote count: 0

http://stackoverflow.com/q/27533551
favorite count: 0
has answer: http://stackoverflow.com/a/27533594
has answer: http://stackoverflow.com/a/27533584
has title: My for loop fails to check correctly if there is a 0 or a 1 in an array
has comment: http://stackoverflow.com/comment/43495493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43495717
score: 1
tagged with: java
tagged with: loops
tagged with: methods
has comment: http://stackoverflow.com/comment/43495494
possible better answer: http://stackoverflow.com/a/27533584
type: Question
has comment: http://stackoverflow.com/comment/43495532
has comment: http://stackoverflow.com/comment/43497148
tagged with: arrays
has comment: http://stackoverflow.com/comment/43495709
accepted answer: http://stackoverflow.com/a/27533594
has body: So I have gotten this assignment, where we have to check create an array and fill it with 0s and 1s. Now, the purpose of the program is to find how many 1s are in the array, so the output should be the number of 1s. I have thus created a method, that searches the array in hot pursuit of the 1s, but somehow fails to find them. I have checked through eclipse and the input numbers are assigned correctly into the array, but somehow, the method fails to find the dreaded 1s. public static int finding1s (int array[][]){ for (int i = 0; i &lt; array.length; i++){ for ( int j =0; j &lt; array[i].length; j++){ if (array[i][j] != 0){ value++; } } } return value; } So for instance, if the input of the two dimensions of the array are 5 and 4, and the numbers assigned in the array to their respective integers are 0100 1000 0010 1101 1111 the method will not output 10 as it should because there are 10 ones, but will rather output 20, because that is the 5 x 4, the total number of 0 and 1s in the array.
answer count: 2
has comment: http://stackoverflow.com/comment/43496235
upvote count: 1
has comment: http://stackoverflow.com/comment/43497809
downvote count: 0

http://stackoverflow.com/q/27629216
downvote count: 1
type: Question
score: -1
tagged with: jackson
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27629287
has answer: http://stackoverflow.com/a/27629345
has body: My input is JSON data. It looks like: [ { "shortName": "av", "longName": "average", "Color": "black", "fromValue": "45", "toValue": "59" }, { "shortName": "g", "longName": "good", "Color": "red", "fromValue": "35", "toValue": "68" } ] I need to convert this data to a list of objects (PerfLevel class). How can I do this?
has title: Convert this JSON data to list of objects in Java
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/27536078
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27536135
tagged with: java
tagged with: eclipse
type: Question
score: 0
has body: I am currently writing JUnit test cases using the Selenium-RC API. I am writing my scripts like: //example JUnit test case public class myScripts extends SeleneseTestCase { public void setUp() throws Exception { SeleniumServer newSelServ = new SeleniumServer(); newSelServ.start(); setUp("https://mySite.com", "*firefox"); } public void insert_Test_Name throws Exception { //write test code here } } And for each test, I have a new JUnit file. Now, since the beginning of my JUnit files will all basically be the same, just with minor variations towards the end, I was thinking about creating a pre-formatted Java template to write create a file with the redundant code already written. However, I can't find any information on whether this is possible. Does Eclipse allow you to create file templates for certain packages?
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/43501162
accepted answer: http://stackoverflow.com/a/27536135
has title: How do I create pre-formatted Java files in Eclipse?

http://stackoverflow.com/comment/43648548
comment on: http://stackoverflow.com/q/27613188
score: 0
type: Comment
type: QuestionComment
has text: You have to narrow down your problem. No one wants to look through all 600+ lines.

http://stackoverflow.com/comment/43605174
comment on: http://stackoverflow.com/q/27590669
score: 1
has text: Un-neat code that does the trick should look something like that: `if (o1.field1 < o2.field2) return -1; else if (o1.field1 > o2.field1) return 1; else if (o1.field2 < o2.field2) return -1; else if (o1.field1 > o2.field2) return 1; else if (o1.field3 < o2.field3) return -1 else (o1.field3 > o2.field3) return 1; else return 0;` The idea is to use multiple if-else condition in the desired comparison order (most important field first)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43639718
type: Comment
comment on: http://stackoverflow.com/q/27608738
has text: How did you create the Jar? Did you create an executable jar ?
type: QuestionComment
score: 4

http://stackoverflow.com/q/27565460
type: UnansweredQuestion
has title: Jenkins Cobertura build - NoClassDefFoundError
tagged with: unit-testing
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/27983135
type: Question
has answer: http://stackoverflow.com/a/35271204
answer count: 3
tagged with: junit
favorite count: 0
upvote count: 3
has body: I have a test class ProcessorTest with the lines JSONObject jsonObj = XML.toJSONObject(convert); DBOb = (DBObject) JSON.parse(jsonObj.toString()); The XML class is from json.org. The class is used else where in the code without a problem. Everything runs fine on localhost (i.e., all Maven and JUnit tests execute). When I pushed to Jenkins I get this error: Jenkins Error Error Details net/sourceforge/cobertura/coveragedata/TouchCollector Stack Trace java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector at org.json.XML.__cobertura_init(XML.java) at org.json.XML.&lt;clinit&gt;(XML.java) at ProcessorTest.classSetup(ProcessorTest.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe…
has answer: http://stackoverflow.com/a/27923057
tagged with: cobertura
downvote count: 0
tagged with: jenkins

http://stackoverflow.com/comment/43402626
comment on: http://stackoverflow.com/q/27485288
type: Comment
score: 0
has text: Repository method will return an empty list (not null, but no entities) if no results are found. Are you sure you are getting real entities? What is the result list size?
type: QuestionComment

http://stackoverflow.com/comment/43478512
has text: @clankill3r your sqrt() function seems to be dividing by 2 which must mean your sq() function is multiplying by 2.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27524811

http://stackoverflow.com/comment/43446250
score: 0
type: Comment
type: QuestionComment
has text: JDK: 1.7.0_07. One more thing is that this error occurs frequently but once in a while it just works!!
comment on: http://stackoverflow.com/q/27507004

http://stackoverflow.com/a/27579739
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43586685
upvote count: 3
has body: Try this; SimpleDateFormat parserSDF=new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); Date d = parserSDF.parse("Tue Dec 16 07:01:31 CET 2014");
accepted answer of: http://stackoverflow.com/q/27579727
answers question: http://stackoverflow.com/q/27579727

http://stackoverflow.com/comment/43534129
type: AnswerComment
has text: I've made an edit to my post, I added my start method if it helps.
comment on: http://stackoverflow.com/a/27553697
type: Comment
score: 0

jsoup
tags question: http://stackoverflow.com/q/27481876
tags question: http://stackoverflow.com/q/27552808
tags question: http://stackoverflow.com/q/27538936
tags question: http://stackoverflow.com/q/27638996
tags question: http://stackoverflow.com/q/27541032
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/27615447
tags question: http://stackoverflow.com/q/27584378
tags question: http://stackoverflow.com/q/27506584
tags question: http://stackoverflow.com/q/27478541
tags question: http://stackoverflow.com/q/27520324

http://stackoverflow.com/q/27494775
tagged with: spring
has answer: http://stackoverflow.com/a/27495292
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
has comment: http://stackoverflow.com/comment/43422243
has comment: http://stackoverflow.com/comment/65982698
type: Question
has title: Spring Conditional Bean creation based on another bean
has body: I'm trying to find a way to only create a bean if the value of another bean/property is true, using Spring 3.2 and XML configurations. <util:constant static-field="org.code.ConfigurationKeys.ENABLED"/> ..... create some beans I've seen some slightly similar examples using Spring EL but nothing that does this exactly...
has comment: http://stackoverflow.com/comment/50145752
score: 4
upvote count: 4
answer count: 2
tagged with: spring-el
has answer: http://stackoverflow.com/a/31450952
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43564013
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27565199
type: AnswerComment
has text: @user3572079 - I have updated my answer with some additional information.

http://stackoverflow.com/q/27617222
tagged with: resume
upvote count: 2
has comment: http://stackoverflow.com/comment/43655746
has title: Suspend Resume Threads: Java
has comment: http://stackoverflow.com/comment/43655694
answer count: 1
tagged with: suspend
favorite count: 0
has answer: http://stackoverflow.com/a/27617266
accepted answer: http://stackoverflow.com/a/27617266
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43656279
tagged with: multithreading
tagged with: thread-synchronization
has body: When I run this code, it displays the following output: One : 15 Two : 15 One : 14 Two : 14 Two : 13 One : 13 Two : 12 One : 12 One : 11 Two : 11 Thread 1 suspended Two : 10 Two : 9 Two : 8 Two : 7 Two : 6 Thread 1 resumed Thread 2 suspended Thread 2 resumed The output doesn't continue till the end that is One:1 Two:1 Is the myresume method of NewThread1 class not executed? What is the reason behind this? Following is the code of NewThread1: class NewThread1 implements Runnable{ String name; Thread t; boolean suspendFlag; NewThread1(String threadname){ name = threadname; t = new Thread(this, name); suspendFlag = false; t.start(); } @Override public void run(){ try{ for(int i=15; i&gt;0; i--){ System.out.println(name+ " : " +i); Thread.sleep(200); synchronized(this){ while(suspendFlag){ wait(); } } } }catch(InterruptedException e){ System.out.println("New thread1 Interrupted"); } } synchronized void myresume(){ suspendFlag = false; } void mysuspend(){ suspendFlag = true; } } Following is the code of NewThread1:(main() method is defined here) public class Suspend_ResumeThreads { public static void main(String args[]){ NewThread1 ob1 = new NewThread1("One "); NewThread1 ob2 = new NewThread1("Two "); try{ Thread.sleep(1000); ob1.mysuspend(); System.out.println("Thread 1 suspended"); Thread.sleep(1000); ob1.myresume(); System.out.println("Thread 1 resumed"); ob2.mysuspend(); System.out.println("Thread 2 suspended"); Thread.sleep(1000); ob2.myresume(); System.out.println("Thread 2 resumed"); }catch(InterruptedException e){ System.out.println("Main Interrupted"); } try{ ob1.t.join(); ob2.t.join(); }catch(InterruptedException e){ System.out.println("Main interrupeted in join()"); } System.out.println("Main exiting.."); } }
type: Question
tagged with: java

http://stackoverflow.com/comment/43670793
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27625161
has text: when you say list, are you talking about List interface ?
type: Comment

http://stackoverflow.com/comment/43667233
has text: Thanks Richard. I added the field as you specified. It shows up as "***true" in the lotus notes client however does not show up when generating the document using the remote Java API.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27492281
type: Comment

http://stackoverflow.com/comment/43700055
comment on: http://stackoverflow.com/q/27640101
score: 0
has text: Please describe your problem. Tell us what you expected to happen and what happens, in details.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/104914151
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/57775773
has text: on a MAC it should work, but only because curl for Mac supports p12 ... on other platforms you have to use .pem - I think it's due to the specific build and the security libraries used (netscape vs others)

http://stackoverflow.com/q/27546955
tagged with: sd-card
has body: Just a quick point here. Although my code seems to be okay storing String data etc. in a new file using the standard techniques of writing to a mytext.txt file in an internal or external (SD Card) storage, it is of more use to me for my App to add more data to the same file in the same directory by repeating allowing the user to repeat the process (e.g. a user input and button save) or closing the App and starting over again, so the data permanently remains unless the user chooses to manually delete that data. Using conditional statements to check if the file or directory exists appears to make no difference to the situation and I get the same result as before (one answer). Also changing a writing method such as osw.write(myStr); to osw.append(myStr); remains the same. There are no errors in the code or application. Here is typical code in part of the MainActivity Java file //earlier code try { File sdCard = Environment.getExternalStorageDirectory(); File directory = new File (sdCard.getAbsolutePath() + "/MyFiles"); if (!directory.exists()) { directory.mkdirs(); } File file = new File(directory, "mytext.txt"); if (!file.exists()) { file.createNewFile(); } FileOutputStream fOut = new FileOutputStream(file); OutputStreamWriter osw = new OutputStreamWriter(fOut); //---write the string to the file--- osw.write(myStr); osw.flush(); osw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } // continued code ... ps. On my device, the mytext.txt file is stored in Internal storage (possible name sdcard0 ?) rather than expecting it to be in the the accessible/removable SD Card.
has answer: http://stackoverflow.com/a/27547037
has title: Append (add) String data to an SD Card text file in an Android application
downvote count: 0
tagged with: string
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: append
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/27547061
type: Question
answer count: 2

http://stackoverflow.com/comment/43690106
type: QuestionComment
comment on: http://stackoverflow.com/q/27628735
has text: Can you please provide me an example?
score: 0
type: Comment

http://stackoverflow.com/comment/43672644
has text: What is wrong with "hotel-something"? Why is that not good?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27626107

http://stackoverflow.com/q/27604170
upvote count: 3
score: 0
answer count: 2
tagged with: prime-factoring
tagged with: string
favorite count: 0
tagged with: encryption
has title: Assigning letters to prime numbers using strings in Java
has body: I'm pretty new to programming and I'm having a bit of trouble with my homework. This is what I was given in the instructions: Encrypting: “hi” => h->23, i->29 => h*i => 23*29 = 667 Decrypting: 667 => (prime factorization) 23*29 => 23->h 29->i => “hi” Error Handling What if someone enter a number that factorizes to other primes (out of list)? Please choose the mode (Encrypt [e] / Decrypt [d]): d Please enter an integer: 234234 null And I have a code given: import java.util.Scanner; public class Homework3 { static int[] primes = {3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103}; static String alphabet = "abcdefghijklmnopqrstuvwxyz"; public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Please choose the mode (Encrypt [e] / Decrypt [d]): "); String mode = scan.next(); String s = ""; if (mode.equals("e")) { System.out.print("Please enter a String: "); s = scan.next(); System.out.println("&gt;&gt; " + encrypt(s)); } else if (mode.equals("d")) { System.out.print("Please enter an integer: "); s = scan.next(); System.out.println("&gt;&gt; " + decrypt(s)); } } // Examples: // for s = "hi", return "667" public static String encrypt(String s) { // Fill in the blanks return ""; } // Examples: // for x = "667", return "hi" // for x = "327", return null public static String decrypt(String x) { // Fill in the blanks return ""; } }
type: UnansweredQuestion
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/27605716
has answer: http://stackoverflow.com/a/27604621
type: Question
tagged with: arrays

http://stackoverflow.com/comment/43449007
type: AnswerComment
has text: I'll review our configuration using the links you provided. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/27508180
score: 0

http://stackoverflow.com/comment/43396476
has text: I think you are inflating wrong xml file in adapter. change `view = inflater.inflate(R.layout.layout_listview,null);` to `view = inflater.inflate(R.layout.layout_listview_buttons,null);`
comment on: http://stackoverflow.com/q/27481609
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43420144
score: 2
comment on: http://stackoverflow.com/a/27494108
has text: @yazan here's the related javadoc's that explain what they do and what they return: http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Hex.html#decodeHex(char[]) -- and -- http://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html#decodeBase64(byte[])
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43521433
type: AnswerComment
type: Comment
has text: @kruti did you changed GET method to POST ?
comment on: http://stackoverflow.com/a/27546682
score: 0

http://stackoverflow.com/q/27639559
has comment: http://stackoverflow.com/comment/43697926
downvote count: 1
type: Question
tagged with: broadcastreceiver
answer count: 2
has title: Disable Media Button receiver (in other app), or send intent to a specific app
upvote count: 0
has answer: http://stackoverflow.com/a/27639719
tagged with: android
has answer: http://stackoverflow.com/a/27641336
favorite count: 0
type: UnansweredQuestion
tagged with: android-intent
has body: I need to either disable ACTION_MEDIA_BUTTON receiver for some time (less than 1 second, actually), or send ACTION_MEDIA_BUTTON to specific app. Is it possible, if I have class names of receivers?
tagged with: java
score: -1

http://stackoverflow.com/a/27612239
has comment: http://stackoverflow.com/comment/43681407
score: 0
has comment: http://stackoverflow.com/comment/43651220
has body: Holding the button is something else than long clicking it. You need an onTouchListener In the onPressed method check if the MotionEvent is UP or DOWN and then start/stop counting. EDIT: Try Counting up in a Thread, something like that: Final Thread t = new Thread(new Runnable(){ @Override public void run(){ while(!t.isInterrupted(){ setTempo(mTempo++); } } switch (event){ case ACTION_DOWN: t.start(); break; case ACTION_UP: t.interrupt(); break }
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43669512
accepted answer of: http://stackoverflow.com/q/27612117
has comment: http://stackoverflow.com/comment/43688686
answers question: http://stackoverflow.com/q/27612117

http://stackoverflow.com/comment/43504858
has text: So i need to put it to other layout?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27538317

http://stackoverflow.com/q/27609167
type: Question
possible better answer: http://stackoverflow.com/a/37406493
answer count: 2
accepted answer: http://stackoverflow.com/a/27611380
has answer: http://stackoverflow.com/a/37406493
tagged with: extjs
score: 0
has comment: http://stackoverflow.com/comment/43640578
tagged with: user-interface
has answer: http://stackoverflow.com/a/27611380
tagged with: gwt
type: AnsweredQuestion
tagged with: java
tagged with: gxt
has body: I am working with the com.sencha.gxt(3.0) grid widget. I am trying to write a Java function that searches for a string in a row(across all columns) and only display the rows that contain this string. Is there a built in, or easy method in which I can do this? Thanks
has title: GXT 3.0 Grid widget search

http://stackoverflow.com/a/27863036
score: 0
accepted answer of: http://stackoverflow.com/q/27562938
type: Answer
has body: The solution was Jira webworks. But apparently all Tutorials are a bit vague at some points. I recommend using the atlassian example code that they provide. It is much more useful than any tutorial out there including their own. JiraWebActionSupport is very important (implement a class deriving from it for example) where you define http responses and/or the use of a velocity script in the doExecute(). All methods from that class can be called from the velocity script by "$action.myMethod()". This is also possible with other fields though i guess a String return type or simple return types are the only usable types. These were for me the relevant problems/questions. I hope someone else will find this useful. Regards Chris
answers question: http://stackoverflow.com/q/27562938
type: AcceptedAnswer

http://stackoverflow.com/comment/43650176
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27614047
has text: @lonesome The string literal 'test' is not a valid pattern. a Pattern is a java RegEx. You need to read up on the syntax. [Java RegEx Pattern](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
score: 0

http://stackoverflow.com/q/27583357
upvote count: 0
favorite count: 0
has title: Add class via command line
has answer: http://stackoverflow.com/a/27583423
tagged with: android
tagged with: command-line
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27583423
has body: Classes can be added to an Android project in Eclipse via New -> Class, and this will supposedly add it to the project somehow, but how can I do this via the command line? I set up the class in src/(reverse.dns.path)/CLASS.java, but I couldn't find anything in http://developer.android.com/tools/building/building-cmdline.html, but I would appreciate any guidance
has answer: http://stackoverflow.com/a/27584679
score: -1
answer count: 2
tagged with: sdk
possible better answer: http://stackoverflow.com/a/27584679

http://stackoverflow.com/comment/43610430
type: Comment
comment on: http://stackoverflow.com/a/27593354
has text: ou, you are right, signature contains only parameters and the method name
type: AnswerComment
score: 0

http://stackoverflow.com/q/27617763
has answer: http://stackoverflow.com/a/27617940
type: UnansweredQuestion
has title: Validation for user, email and password doesn't works
tagged with: jakarta-ee
upvote count: 0
tagged with: java
tagged with: database
score: -1
tagged with: servlets
type: Question
tagged with: validation
has body: I am having a problem on validating email and password, whether it belongs to a registered member or not. I'm using NetBeans, and created a database with table members. I have set up the connection pool and filled my members table. After having implemented the code, solved errors and watched few videos about NetBeans tutorial, I still can't figure out where I am missing it. I'am Stuck there since 4 days and kinda lost now. Hope you guys could help me with it, thanks in advance. This is my members table data: # | id | email | password | name ------------------------------------------------ 1 | 1 | what@what.com | what | Number 1 2 | 2 | fireup@fire.com | fire | Number 2 This is the code for my LoginServlet: @WebServlet("/login") public class LoginServlet extends HttpServlet{ @Resource(name = "jdbc/jed") private DataSource dsMembers; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String strName = request.getParameter("memberName"); String strPassword = request.getParameter("memberPassword"); String strEmail = request.getParameter("memberEmail"); Connection conn = null; Statement stmt = null; ResultSet rs = null; try { conn = dsMembers.getConnection(); String sql = "SELECT * FROM members"; stmt = conn.createStatement(); rs = stmt.executeQuery(sql); while (rs.next()){ if((isValidEmail(strEmail))&amp;&amp; (strEmail.equals(rs.getString("email")))&amp;&amp; (strPassword.equals(rs.getString("password")))&amp;&amp;(strName.equals(rs.getString("name")))){ System.out.println("Success"); HttpSession session = request.getSession(); session.setAttribute("name", strName); session.setAttribute("email", strEmail); response.sendRedirect(this.getServletContext().getContextPath() + "/account.jsp"); } else { request.getSession().invalidate(); response.sendRedirect(this.getServletContext().getContextPath()); } } } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); } } private…
answer count: 1
has comment: http://stackoverflow.com/comment/43660531
has comment: http://stackoverflow.com/comment/43667735
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/27586785
has comment: http://stackoverflow.com/comment/43597945
has body: I want to use Intellij 13.1.6 as my go app IDE, but there are some problem I can't sovle yet. The default version of go support plugin installed on Intellij is 0.9.15, but in this version, there are some bugs so that I can build project successfully. So I try to build the go-plugin jar by myself follow this article: https://content.pivotal.io/blog/setting-up-the-google-go-plugin-with-intellij-idea-13-on-os-x-10-8-5 But when I click Prepare Plugin Module 'google-go-language' For Deployment, it shows errors cause some method can't be found. As the following figure I think the problem is the version of my Intellij lack of some lib so that I can't build go-plugin jar successfully. How do I fix this? Appreciate any replies. Intellij Version: 13.1.6 JDK Version: 1.7 Go-plugin on GitHub: the latest commit on master branch (0261ffa)
type: UnansweredQuestion
tagged with: java
has title: Golang plugin on Intellij
type: Question
has comment: http://stackoverflow.com/comment/43601972
has comment: http://stackoverflow.com/comment/43598019
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27599288
tagged with: go
score: 0
answer count: 1

http://stackoverflow.com/comment/43502145
score: 0
has text: I was compiling with JDK7. Turns out this limits the theme options to Caspian. Updated Eclipse and JDK8 which now displays the new Modena theme. (The old ones were both indeed pictures of the Caspian theme)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27530403

http://stackoverflow.com/a/27522024
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/43473658
type: Answer
accepted answer of: http://stackoverflow.com/q/27521875
has body: What you are trying to do is called "downcast", and the compiler won't let you do it implicitly. That's because the compiler does not know whether an instance of ObjA is an instance of ObjB too. Let's take this as example: class Animal { //... } class Dog extends Animal { //... } class Cat extends Animal { //... } Dog is-an Animal, Cat is-an Animal. So you will be able to do: Cat cat = new Cat(); Animal animal = c; But you won't be able to do: Animal animal = new Animal(); Cat cat = animal; In fact, try to think about it. If I tell you "I have an animal", how can you know for sure it is a cat? If you want to downcast you have to do it explicitly: /* * Here myAnimal is an Animal. In order to cast, * I **must** be sure that myAnimal is a cat. */ Cat cat = (Cat) myAnimal; In order to be really sure that myAnimal is a Cat: if(myAnimal instanceof Cat) { Cat cat = (Cat) myAnimal; // do whatever you need to do with that cat object }
answers question: http://stackoverflow.com/q/27521875
has comment: http://stackoverflow.com/comment/43473397
has comment: http://stackoverflow.com/comment/43473489

http://stackoverflow.com/comment/43681701
comment on: http://stackoverflow.com/q/27630484
score: 0
type: QuestionComment
type: Comment
has text: Right, that doesn't answer my question. Why can't your method be in your fragment class and you just pass in the data from the MainActivity. alpha and beta are in your fragment layout, correct?

http://stackoverflow.com/comment/43451005
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27507333
type: AnswerComment
has text: About selectBeforeUpdate = true, i don't think you should use it but it would be good to see what happens practically if you specify it. About dynamic-update, the column numbers is what matters not the column value.

http://stackoverflow.com/q/27578249
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has title: How get TextView id from table row
score: -1
tagged with: android-tablelayout
has comment: http://stackoverflow.com/comment/43581666
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43581358
favorite count: 0
has answer: http://stackoverflow.com/a/27578305
accepted answer: http://stackoverflow.com/a/27578305
tagged with: android
has body: I draw table top and then table body. In each table cell I have TextView, so how can I get it's id or another number, when user clicked on it? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TableLayout lTableLayout; lTableLayout = (TableLayout) findViewById(R.id.tbLayout); /*Draw table top*/ TableRow trTop = new TableRow(this); trTop.setPadding(0, 5, 0, 0); trTop.setBackgroundColor(Color.rgb(102, 178, 255)); lTableLayout.addView(trTop, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); String[] str = new String[]{"Time", "Room1", "Room2"}; for(int j=0; j&lt;3; j++){ TextView tv1 = new TextView(this); tv1.setPadding(2, 2, 2, 2); tv1.setTextSize(14); tv1.setText(str[j]); trTop.addView(tv1,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); } /*Draw table body*/ for(int i=0; i&lt;5; i++){ final TableRow tr1 = new TableRow(this); tr1.setPadding(0, 5, 0, 0); if((i%2) == 0) tr1.setBackgroundColor(Color.WHITE); lTableLayout.addView(tr1, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); for(int j=0; j&lt;3; j++){ final TextView tv1 = new TextView(this); tv1.setPadding(2, 2, 2, 2); tv1.setTextSize(12); if(j==0){ tv1.setText(8+i + ":00"); }else{ tv1.setText("reserved"); } tr1.addView(tv1,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Toast.makeText(getApplicationContext(), "id = " + tv1.getId(), Toast.LENGTH_LONG).show(); Log.e("TAG", " clicked ID: " + tr1.getId()); } }); } } Here I'm looking for id: public void onClick(View arg0) { Toast.makeText(getApplicationContext(), "id = " + tv1.getId(), Toast.LENGTH_LONG).show(); Log.e("TAG", " clicked ID: " + tr1.getId()); } }); But TOAST says : "id = -1" for each textview.

http://stackoverflow.com/a/51590745
has comment: http://stackoverflow.com/comment/135997630
has body: As isRunning() may be true even if cluster is down, I'd go for the following approach (a mixture of @konstantin-zyubin's answer and this). This doesn't need an event-listener, which is an advantage in my setup: if (!hazelcastInstance.getLifecycleService().isRunning()) { return Health.down().build(); } int parameterCount; LocalTopicStats topicStats; try { parameterCount = hazelcastInstance.getMap("parameters").size(); topicStats = hazelcastInstance.getTopic("myTopic").getLocalTopicStats(); } catch (Exception e) { // instance may run but cluster is down: Health.Builder builder = Health.down(); builder.withDetail("Error", e.getMessage()); return builder.build(); } Health.Builder builder = Health.up(); builder.withDetail("parameterCount", parameterCount); builder.withDetail("receivedMsgs", topicStats.getReceiveOperationCount()); builder.withDetail("publishedMsgs", topicStats.getPublishOperationCount()); return builder.build();
upvote count: 2
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136003921
answers question: http://stackoverflow.com/q/27567485
has comment: http://stackoverflow.com/comment/136022285

http://stackoverflow.com/q/27610145
has answer: http://stackoverflow.com/a/27610902
linked to: http://stackoverflow.com/q/3315681
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43646911
tagged with: java
tagged with: jtextpane
has title: JTextPane resizing in a JPanel
tagged with: swing
has comment: http://stackoverflow.com/comment/43647177
type: Question
has comment: http://stackoverflow.com/comment/43651177
score: 3
tagged with: resize
tagged with: jpanel
answer count: 1
has comment: http://stackoverflow.com/comment/43642871
downvote count: 0
has comment: http://stackoverflow.com/comment/43642842
has body: I'm attempting to create an IM program as a sort of hobby project. I've been experimenting with UI designs and have been trying to get this prototype for the actual message display working. Currently, the frame is set up like so; The JFrame content pane is set to a JPanel which utilizes a BoxLayout using Y_AXIS. The content panel contains the TextMessage objects which I would like to display, added to the content pane individually. The TextMessage object is setup like so; The message and sender string are stored inside of a TextMessage object extending JTextPane and utilizing a StyledDocument for formatting. The TextMessage is placed inside of a JPanel in order to allow proper placement of the object within the BoxLayout. The JPanel is set to a FlowLayout which pins the TextMessage object against either edge of the JPanel, depending on a boolean value. Thus far, everything is working as I would like it to, with one notable exception. When I resize the JFrame, the TextMessage objects do not resize and instead simply disappear off the edge of the screen. Expected Result: The actual Result: The JFrame Class: public class NewMain extends JFrame { public NewMain() { setTitle("SparrowIM Chat Bubble"); setPreferredSize(new Dimension(880, 550)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setResizable(true); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); setContentPane(panel); add(new TextMessage("Hey, man. What's up?", "Jnk1296", true)); add(new TextMessage("Eh, nothing much.", "KeepJ96", false)); add(new TextMessage("Wbu? Anything new going on with you?", "KeepJ96", false)); add(new TextMessage("Nah, not really. Got a job interview coming up in a few " + "days, though. Sorta excited for that, but sorta not. " + "Other than that, life as usual. xD", "Jnk1296", true)); add(new TextMessage("lol Sounds good.", "KeepJ96", false)); add(new TextMessage("Yeah. How's the wife and kids, though?", "Jnk1296", tru…
favorite count: 0
has comment: http://stackoverflow.com/comment/43697393

http://stackoverflow.com/comment/43468508
comment on: http://stackoverflow.com/a/27519351
score: 0
type: AnswerComment
type: Comment
has text: @kittu88 you mean that `450dp` was not enough? If that's the case then do it programatically.

http://stackoverflow.com/comment/43512664
comment on: http://stackoverflow.com/a/27542542
type: Comment
score: 1
type: AnswerComment
has text: you sir are a life savor, I wish I could kiss you or something :*

http://stackoverflow.com/a/27576817
answers question: http://stackoverflow.com/q/27576782
type: Answer
has comment: http://stackoverflow.com/comment/43579011
has body: You can write a cookie to the client side on submit and then you check if that cookie is there you show the message if not you go through normal processing
has comment: http://stackoverflow.com/comment/43591699
score: 0

http://stackoverflow.com/comment/43521487
type: QuestionComment
has text: @BuhakeSindi: Your first comment is true, but it implies, a prepareStatement will send the sql to the dbms (depending on the driver).
score: 0
comment on: http://stackoverflow.com/q/27547386
type: Comment

static
tags question: http://stackoverflow.com/q/27614274
tags question: http://stackoverflow.com/q/27581948
tags question: http://stackoverflow.com/q/27553994
tags question: http://stackoverflow.com/q/27631880
tags question: http://stackoverflow.com/q/27506053
tags question: http://stackoverflow.com/q/27552922
tags question: http://stackoverflow.com/q/27591348
tags question: http://stackoverflow.com/q/27590183
tags question: http://stackoverflow.com/q/27635816
tags question: http://stackoverflow.com/q/27577727
tag name: static
tags question: http://stackoverflow.com/q/27589810
tags question: http://stackoverflow.com/q/27592700
tags question: http://stackoverflow.com/q/27576039
tags question: http://stackoverflow.com/q/27616696
type: Tag
tags question: http://stackoverflow.com/q/27589534
tags question: http://stackoverflow.com/q/27582703
tags question: http://stackoverflow.com/q/27561501

http://stackoverflow.com/q/27611026
accepted answer: http://stackoverflow.com/a/27611057
has body: I have a multithreaded program that includes data structures like ConcurrentHashMap and ConcurrentLinkedList, however I also need every thread to access a shared integer value. The threads themselves are custom thread classes I've made that extend class Thread. My two concerns here are: How can I make each thread see the same integer value? I don't think a primitive int would work as it would not be "passed by reference" (or rather passed by value of the object pointer). The integer needs to be mutable and any changes to one integer by a thread needs to be seen by all the other threads. Would using an Integer Object fix this, what about AtomicInteger? What should I use to preserve thread safety? Each thread will check the integer everytime a loop in them runs but it will change the integer when a thread has finished it's task and is about to return. Thanks in advance!
has comment: http://stackoverflow.com/comment/43644595
has comment: http://stackoverflow.com/comment/43646141
favorite count: 0
has comment: http://stackoverflow.com/comment/43645537
has answer: http://stackoverflow.com/a/27611139
tagged with: multithreading
has answer: http://stackoverflow.com/a/27611057
has comment: http://stackoverflow.com/comment/43646588
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/43646609
has comment: http://stackoverflow.com/comment/43646313
type: Question
possible better answer: http://stackoverflow.com/a/27611132
has answer: http://stackoverflow.com/a/27611132
tagged with: algorithm
has title: Sharing an int or an integer object between multiple threads in Java
upvote count: 3
answer count: 3

http://stackoverflow.com/comment/43766886
type: Comment
score: 0
has text: Similar issue here: http://security.stackexchange.com/questions/49543/java-applet-need-code-signing-certificate-vs-ssl-certificate
type: AnswerComment
comment on: http://stackoverflow.com/a/27623987

http://stackoverflow.com/q/27477222
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43389547
linked to: http://stackoverflow.com/q/16804093
has body: I had to change my package name from com.example.chris.myapplication to com.tamaritz.chris.myapplication so that my app could be properly loaded and distributed via Google Play Store. To do this, I used the approach Android Studio Rename Package which was to basically create a new directory, copy contents, update Manifest. I got those steps down but I am having trouble with "change/rename the R file imports in whole project". When I made my package name change, my line of code(below) said "R cannot be resolved". submit = (Button) v.findViewById(com.example.chris.myapplication.R.id.submitButton); When I went to the imports part of the java source code(below) package com.tamaritz.chris.myapplication; import android.app.Activity; import android.app.DialogFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; Everything seemed to be line place, the right package name. Do I have to put a manual R import? The person said to change/rename the import but I don't even see the original R import. And this something else I did which I am not sure. A possible solution I found was just to do alt enter, and import the class. That line of code suddenly turned into submit = (Button) v.findViewById(R.id.submitButton); Is this a valid approach. Does the package name explictly need to be there? After I did this, i did not see any changes in the import section either.
has comment: http://stackoverflow.com/comment/43388665
tagged with: android-resources
type: Question
tagged with: android
has title: How to regenerate R imports in Android Studio 1.0?
has comment: http://stackoverflow.com/comment/43389436
score: 0
tagged with: java
tagged with: android-package-managers
has comment: http://stackoverflow.com/comment/43393030

http://stackoverflow.com/comment/43475110
score: 0
type: Comment
has text: when you create a new account current balance should be 0. also you made some mistakes in Transaction Process constrctor.check it
comment on: http://stackoverflow.com/a/27522664
type: AnswerComment

http://stackoverflow.com/comment/43558798
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27558703
type: Comment
has text: Thanks! to match uppercase as well String[] parts = s.split("(?<=[A-Za-z])(?=[\\d.])|(?<=\\d)(?=[A-Za-z])");

encapsulation
tags question: http://stackoverflow.com/q/27510671
type: Tag
tag name: encapsulation
tags question: http://stackoverflow.com/q/27595616
tags question: http://stackoverflow.com/q/27534476

http://stackoverflow.com/a/27617107
has comment: http://stackoverflow.com/comment/43667519
upvote count: 1
type: AcceptedAnswer
has body: In general, using JOIN to materialise object graphs won't really work well, as you're denormalising your database entities into a table (with duplicates) before you try to normalise the data again in a mapping algorithm. JPA hides these things from you by offering an alternative query language that doesn't expose so many SQL features. In your particular case, however, you can get this to run via the jOOQ API by using the Result.intoGroups() methods. Thus: Map&lt;Record, Result&lt;Record&gt;&gt; result = dsl.selectFrom(...).fetch().intoGroups(CHEST.fields()); List&lt;Chest&gt; list = new ArrayList&lt;&gt;(); for (Entry&lt;Record, Result&lt;Record&gt;&gt; entry : result.entrySet()) { Record chest = entry.getKey(); Result&lt;Record&gt; drawers = entry.getValue(); list.add(new Chest( chest.into(Id.class), // These into(Class&lt;?&gt;) methods assume that you drawers.into(Drawer.class) // want to use jOOQ's DefaultRecordMapper )); } The above algorithm is probably incomplete, or not exactly what you need. But it'll give you a general idea of what's possible out-of-the-box via jOOQ API.
has comment: http://stackoverflow.com/comment/43666440
type: Answer
has comment: http://stackoverflow.com/comment/43669982
accepted answer of: http://stackoverflow.com/q/27611604
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27611604

http://stackoverflow.com/q/27585622
has title: Apache Ofbiz installation trouble
has answer: http://stackoverflow.com/a/27854974
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/46804824
type: Question
tagged with: apache
tagged with: ant
has answer: http://stackoverflow.com/a/28521047
answer count: 3
has body: I have been trying to install Apache Ofbiz on my 32-bit processor computer, with Windows 7 as the operating system. I have downloaded Java\jdk1.8.0_25: and apache-ant-1.9.4: and :apache-ofbiz-13.07.01. I made two environmental variables, JAVA_HOME and ANT_HOME; in addition, I included both Java and Ant Apache Bin addresses respectively into the environmental the PATH variable. Then I ran the CMD and entered the Ofbiz directory' cd [apache ofbiz address], thenceforward, I resumed into entering the the 'ant run-install' command, followed by 'ant run-install-seed', I received a 'build successful' message for both of the commands I entered. After the foregone commands were executed I proceeded into clicking the startofbiz located inside the apache ofbiz folder. A cmd screen opened listing all sorts of commands. Once all these were carried out I typed the following address into my internet search bar: https://localhost:8443/webtools Notwithstanding, I constantly received the following error message that says THE TEMPLATE LOCATION IS EMPTY even after a numberless amount of permutations, deleting java, re-installing Ant Apache, etc: :ERROR MESSAGE: org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#GlobalDecorator]: java.lang.IllegalArgumentException: Template location is empty (Template location is empty) I have not been able to come to grasps with this issue. I don't believe things should be this difficult to install. I stand ready for any guidance, thank you.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: ofbiz

http://stackoverflow.com/a/27576920
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27576901
has body: Is a bit hard to frame this answer but let me try: How many string we can store in string.xml file ? First at all, resources id are compiled as constants in R class. That said, in Limitations of the Java Virtual Machine say: The per-class or per-interface constant pool is limited to 65535 entries by the 16-bit constant_pool_count field of the ClassFile structure (§4.1). This acts as an internal limit on the total complexity of a single class or interface. So, 50k string resources seems possible. As skeptic, after a bit of experimenting, it seems that you can have up ~33k string resources in a new blank project. Beyond this limit, it produces a compile-time error "too many constants". Searching Cost of string by name ? In linked project I did basic comparision between getResources().getIdentifier(..); (by name) and getResources().getString(id); (by id). Get by id is 13x faster than get by name. I've also compared it with SQLite. getResources().getIdentifier(..); is 1.5x faster than SELECT * FROM table WHERE name = 'string_x' Is it a good approach to store lots of string in string.xml file ? IMHO, no. Pros: GetResurceByName it's just 1.5x faster than SQLite. Cons: Increase compile time significantly. Guaranteed that at some point you will receive 'too many constants'. It's hard to localize. The 2^16 limit involves all translations. Another Approach? This post could help you to ship the application with a pre populated database with your app: Ship an application with a database
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27576901

http://stackoverflow.com/comment/43667606
has text: @Mark Rotteveel - That was it is. I just selected the value (com.microsoft.jdbc.sqlserver.SQLServerDriver") from the iReport dropdown without even noticing the issue t you pointed out. Thanks!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27622313

http://stackoverflow.com/q/27553827
type: Question
has body: I have a piece of code and i am not sure why i am getting the concurrentModificationException import java.util.*; import java.util.LinkedList; import java.util.Scanner; public class CreateList{ List&lt;Integer&gt; nestedList; public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.println("Enter the Nested List"); CreateList obj = new CreateList(); System.out.println(obj.createNestedList(sc.next())); } public List&lt;Integer&gt; createNestedList(String str){ List&lt;Object&gt; aux = new LinkedList&lt;Object&gt;(); nestedList = new LinkedList&lt;Integer&gt;(); for(int itr=0; itr&lt;str.length();itr++){ char c = str.charAt(itr); if(c != ']' &amp;&amp; c != ',') aux.add(c); else if(c == ']'){ Object o = aux.subList(aux.lastIndexOf('[')+1,aux.size()); aux = aux.subList(0,aux.lastIndexOf('[')); aux.add(o);// THIS LINE IS THROWING THE EXCEPTION System.out.println(o); System.out.println(aux); } } System.out.println(aux); return nestedList; } } There is no thread using this code other then the main thread. Any idea what am i missing
has title: Concurrent ModificationException
has answer: http://stackoverflow.com/a/27553969
answer count: 3
has answer: http://stackoverflow.com/a/27553967
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27553969
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27553953
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27553953
upvote count: 1

http://stackoverflow.com/a/27500391
downvote count: 0
has comment: http://stackoverflow.com/comment/43433432
has comment: http://stackoverflow.com/comment/43435178
has comment: http://stackoverflow.com/comment/43431315
type: Answer
answers question: http://stackoverflow.com/q/27500351
has comment: http://stackoverflow.com/comment/43435017
has comment: http://stackoverflow.com/comment/43431430
has comment: http://stackoverflow.com/comment/43431397
has comment: http://stackoverflow.com/comment/43433492
upvote count: 3
has comment: http://stackoverflow.com/comment/43434437
accepted answer of: http://stackoverflow.com/q/27500351
has body: You're calling URLEncoder.encode, but ignoring the result. I suspect you were trying to achieve something like this: String encoded = URLEncoder.encode(message, "UTF-8"); URI uri = URI.create(encoded); ... although at that point you'll have encoded the colon after the mailto part as well. I suspect you really want something like: String query = "subject=ThePDFFile&amp;attachment=\""+path; String prefix = "mailto:recipient@mailserver.com?"; URI uri = URI.create(prefix + URLEncoder.encode(query, "UTF-8")); Or even encoding just the values: String query = "subject=" + URLEncoder.encode(subject, "UTF-8"); + "&amp;attachment=" + URLEncoder.encode(path, "UTF-8")); URI uri = URI.create("mailto:recipient@mailserver.com?" + query); ... or create the URI from the various different parts separately, of course.
score: 3
has comment: http://stackoverflow.com/comment/43433522
has comment: http://stackoverflow.com/comment/43431702
has comment: http://stackoverflow.com/comment/43435088
type: AcceptedAnswer

http://stackoverflow.com/q/27629195
possible better answer: http://stackoverflow.com/a/27629209
has comment: http://stackoverflow.com/comment/43679085
has answer: http://stackoverflow.com/a/27629209
favorite count: 0
has comment: http://stackoverflow.com/comment/43679052
has title: What happens when I reassign some class variable to a new Object?
upvote count: 1
downvote count: 1
has body: SomeClass classvar = new SomeClass(); --&gt; Object classvar = new SomeClass(); --&gt; Object 2 So what I understand about JAVA is that , in the first line, classvar object of SomeClass is created. In the next line, there is another object created of classvar. My Question - What will be changed here? Will the reference of classvar object be updated due to second line ORR the object created in line 1 will be garbage collected? EDIT: adding code tags
type: AnsweredQuestion
tagged with: oop
has answer: http://stackoverflow.com/a/27629241
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43679128
score: 0
accepted answer: http://stackoverflow.com/a/27629241

http://stackoverflow.com/comment/78771788
score: 0
type: Comment
type: QuestionComment
has text: You can google BFS and find the pseudo code of the algorithm you are interested to use, but you'll have to translate that pseudo code to the language you are programming, i.e. java in your case. Also if your edges are positively weighted then you can use Dijkstra's algorithm instead of BFS. If some of your edges are positive weighted and some negative weighted then you can use Bellman Ford algorithm or Floyd Warshall algorithm instead of BFS.
comment on: http://stackoverflow.com/q/27601708

http://stackoverflow.com/comment/43694311
has text: thanks. different question: how do you mock a list in mockito? i know it's bad practice but needs must
comment on: http://stackoverflow.com/q/27635859
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43501162
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27536078
has text: Yes, you can create that template, but the advice to subclass is a better option.
score: 0

http://stackoverflow.com/comment/43563230
type: QuestionComment
comment on: http://stackoverflow.com/q/27568903
has text: You should take a look at : http://stackoverflow.com/questions/1088550/spring-how-to-call-a-method-after-bean-initialization-is-complete
score: 0
type: Comment

http://stackoverflow.com/q/27519927
tagged with: java
has comment: http://stackoverflow.com/comment/43469645
has answer: http://stackoverflow.com/a/33853389
type: UnansweredQuestion
has title: Making ModelAttribute optional in Spring Controller method
downvote count: 0
favorite count: 0
type: Question
score: 7
has comment: http://stackoverflow.com/comment/71915928
has body: I have a controller method defined as follows - @RequestMapping(method = RequestMethod.POST, value="/callMe") public String myMethod(@ModelAttribute MyClass myObj, Model model) { //Do something } How can I make the above controller method to be called even when I do not passed the ModelAttribute myObj. I do not want to create another controller without it and duplicate the functionality.
upvote count: 7
tagged with: spring
answer count: 1
tagged with: spring-mvc
tagged with: model-view-controller

http://stackoverflow.com/a/27563990
type: Answer
score: 1
upvote count: 1
has body: Regarding Topic 1: Just a sidenote: Please do not confuse expiry and eviction. Expiry means the entry may not returned by the cache any more and may happen at a specified point in time or after a duration. Eviction is the action to free resources, the entry is removed from the cache. After expiry, eviction may happen at the same time or later. All common cache products do not have support for exact, aka "point in time", expiry. We need that usecase very often in our applications so I spent some effort with cache2k to support this. Here is a blueprint for cache2k: static class MetricsEntry { long nextUpdate; List&lt;Metrics&gt; metrics; } static class MyEntryExpiryCalculator implements EntryExpiryCalculator&lt;Integer, MetricsEntry&gt; { @Override public long calculateExpiryTime(Integer _key, MetricsEntry _value, long _fetchTime, CacheEntry _oldEntry) { return _value.nextUpdate; } } Cache createTheCache() { Cache&lt;Integer, MetricsEntry&gt; cache = CacheBuilder.newCache(Integer.class, MetricsEntry.class) .sharpExpiry(true) .entryExpiryCalculator(new MyEntryExpiryCalculator()) .source(new MySource()) .build(); return cache; } If you have a time reference in the metrics objects, you can use that and you can omit the additional entry class. sharpExpiry(true) instructs cache2k for exact expiry. If you leave this out, the expiry may be a few milliseconds off, but the access time is slightly faster. Regarding Topic 2: The straight forward approach would be to use the interval minutes as cache key. Here is a cache source (aka cache loader) that strictly returns the metrics of the previous interval: static class MySource implements CacheSource&lt;Integer, MetricsEntry&gt; { @Override public MetricsEntry get(Integer interval) { MetricsEntry e = new MetricsEntry(); boolean crossedIntervalEnd; do { long now = System.currentTimeMillis(); long intervalMillis = interval * 1000 * 60; long startOfInterval = now % (intervalMillis); e.metrics = calculateMetrics(startOfInterval, inter…
accepted answer of: http://stackoverflow.com/q/27556216
answers question: http://stackoverflow.com/q/27556216
type: AcceptedAnswer
downvote count: 0

communication
tag name: communication
tags question: http://stackoverflow.com/q/27479374
type: Tag

http://stackoverflow.com/a/27537103
has body: In the String.join method, the first parameter is the delimiter, and the rest of the arguments are the strings to join using the delimiter. So your code is basically saying "join B and C using the A delimiter". Perhaps you are going for something like this: System.out.println(String.join("", "A", "B", "C")) // ABC
answers question: http://stackoverflow.com/q/27537091
score: 7
upvote count: 7
downvote count: 0
type: Answer

java-8
tags question: http://stackoverflow.com/q/27639792
tags question: http://stackoverflow.com/q/27495493
tags question: http://stackoverflow.com/q/27626148
tags question: http://stackoverflow.com/q/27632564
tags question: http://stackoverflow.com/q/27575862
tags question: http://stackoverflow.com/q/27583623
tags question: http://stackoverflow.com/q/27534684
tags question: http://stackoverflow.com/q/27572594
tags question: http://stackoverflow.com/q/27539594
tags question: http://stackoverflow.com/q/27577138
tags question: http://stackoverflow.com/q/27616490
tags question: http://stackoverflow.com/q/27547519
tags question: http://stackoverflow.com/q/27576763
tags question: http://stackoverflow.com/q/27621017
tags question: http://stackoverflow.com/q/27480403
tags question: http://stackoverflow.com/q/27602141
tags question: http://stackoverflow.com/q/27572859
tags question: http://stackoverflow.com/q/27614119
tags question: http://stackoverflow.com/q/27587672
tags question: http://stackoverflow.com/q/27559960
tags question: http://stackoverflow.com/q/27577475
tags question: http://stackoverflow.com/q/27609348
tags question: http://stackoverflow.com/q/27559231
tags question: http://stackoverflow.com/q/27503284
tags question: http://stackoverflow.com/q/27570295
tags question: http://stackoverflow.com/q/27571377
tags question: http://stackoverflow.com/q/27636711
tags question: http://stackoverflow.com/q/27575353
tags question: http://stackoverflow.com/q/27602758
tags question: http://stackoverflow.com/q/27602031
tags question: http://stackoverflow.com/q/27611896
tags question: http://stackoverflow.com/q/27547643
tags question: http://stackoverflow.com/q/27606778
tags question: http://stackoverflow.com/q/27491438
tags question: http://stackoverflow.com/q/27522741
tags question: http://stackoverflow.com/q/27611617
tag name: java-8
tags question: http://stackoverflow.com/q/27634539
tags question: http://stackoverflow.com/q/27589621
tags question: http://stackoverflow.com/q/27550314
tags question: http://stackoverflow.com/q/27612165
tags question: http://stackoverflow.com/q/27500279
tags question: http://stackoverflow.com/q/27577337
tags question: http://stackoverflow.com/q/27613957
tags question: http://stackoverflow.com/q/27524445
tags question: http://stackoverflow.com/q/27594262
type: Tag
tags question: http://stackoverflow.com/q/27497386
tags question: http://stackoverflow.com/q/27606185
tags question: http://stackoverflow.com/q/27508869
tags question: http://stackoverflow.com/q/27522710
tags question: http://stackoverflow.com/q/27522563

http://stackoverflow.com/comment/43500856
has text: Thanks, works great! Completely forgot about super classes, haha. Testing all day creates bad habits :) Will mark as answer when I can!
type: Comment
comment on: http://stackoverflow.com/a/27536135
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43401323
comment on: http://stackoverflow.com/a/27483395
score: 0
type: AnswerComment
type: Comment
has text: Thanks, Got the problem. We hafta mask the integer to the required length. This removes all the errors between Py and Java. Sorry for taking your time, but had a good and fruitful experience. Thanks again.

http://stackoverflow.com/a/27517513
type: Answer
answers question: http://stackoverflow.com/q/27476662
has body: Scanner input = new Scanner(System.in); // requesting user input System.out.println("Enter x and y : "); String x = input.next(); String y = input.next(); try { double d1 = Double.parseDouble(s1); double d2 = Double.parseDouble(s2); if(d1 &gt; 0 &amp;&amp; d2 &gt; 0) { //Call for the hypotenuse method double z = hypotenuse(d1,d2); } } catch (NumberFormatException e) { System.out.println("Invalid Input!"); }
score: 0

http://stackoverflow.com/a/27498952
has body: class TestClass { public static Node newnode(int a , Node root){ root = new Node(a); System.out.println(root.data); // Printing out 22 return root; } public static void main(String args[] ) throws IOException { Node root = null; root = newnode(22,root); System.out.println(root.data); // Giving NullPointerException } } try this
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27498915

http://stackoverflow.com/q/27510677
score: 0
tagged with: java
tagged with: regedit
has comment: http://stackoverflow.com/comment/43452458
has comment: http://stackoverflow.com/comment/43452420
has comment: http://stackoverflow.com/comment/43452013
downvote count: 1
has comment: http://stackoverflow.com/comment/43452141
linked to: http://stackoverflow.com/q/23318109
tagged with: runtime
has answer: http://stackoverflow.com/a/27511359
type: AnsweredQuestion
answer count: 1
favorite count: 0
has title: Why am I getting cannot find Java SE Runtime Environment again?
type: Question
has comment: http://stackoverflow.com/comment/43452603
tagged with: registry
has body: I thought i fixed this issue last night.......... Last night I had this issue, Why am I still getting a cannot find Java SE Runtime Environment?, reinstalled the jdk and everything was working fine. This is the output I got last night when I ran java -version(correct output) However when I turned on my pc today, heres what I got, This is extremely frustrating..... From that last thread, first I made sure that C:\Program Files\Java\jdk1.7.0_71\jre\bin contained the java.dll library file which it did after i did a search.(this was why it was previously broken.) Afterwards, I tried Ye Win said in the answers to my last question which was to "Delete all previous versions of Java" and "Clean up your registry(delete your java key)" by going to https://java.com/en/download/help/manual_regedit.xml I checked over my path variables which were JAVA_HOME - C:\Program Files\Java\jdk1.7.0_71 Path - C:\Program Files\Java\jdk1.7.0_71\bin At this point, I really don't what to do ........ I don't know if this helps but my pc runs 64 bit windows operating system. has a x64-based processor. I would go out and buy a new pc but this is a new pc...
upvote count: 1
accepted answer: http://stackoverflow.com/a/27511359
linked to: http://stackoverflow.com/q/27499607
tagged with: environment

http://stackoverflow.com/a/27583235
downvote count: 0
type: Answer
upvote count: 1
has body: Inside the method setNumber you are declaring a new variable with name phoneNumber and then assigning it the value "4321". The case is similar like void setNumber(){ String foo; foo = "4321"; } You can correct your method by using the proper variable or using this before the variable name void setNumber(){ phoneNumber = "4321"; // this.phoneNumber = "4321" }
score: 1
answers question: http://stackoverflow.com/q/27583192

http://stackoverflow.com/q/27525369
has answer: http://stackoverflow.com/a/27525432
linked to: http://stackoverflow.com/q/3255
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/11152536
has body: I have read so many article as on difference between isEmpty() and size() > 0 for check that collection is empty or not and found that isEmpty() have perfomance over size() but I could not understand easily why perfomance of isEmpty() is good even though inside isEmpty() is only size == 0 ? My questions are : Can any one explain easily in which scenario isEmpty() is faster as well as when to use isEmpty() and size() function for checking if collection is empty or not? Can any one explain this, using code or other way(Diagrams,graphs etc) so that any beginner can understand easily?
tagged with: is-empty
tagged with: size
has comment: http://stackoverflow.com/comment/43479273
has comment: http://stackoverflow.com/comment/43479423
linked to: http://stackoverflow.com/q/11152536
tagged with: performance
linked to: http://stackoverflow.com/q/1508975
tagged with: java
tagged with: collections
has comment: http://stackoverflow.com/comment/43479984
score: 9
type: Question
upvote count: 9
has answer: http://stackoverflow.com/a/27525394
has comment: http://stackoverflow.com/comment/43479502
linked to: http://stackoverflow.com/q/9341740
has comment: http://stackoverflow.com/comment/43479610
answer count: 3
has title: Understanding the difference between Collection.isEmpty() and Collection.size() == 0?
has comment: http://stackoverflow.com/comment/43480768
downvote count: 0
duplicate of: http://stackoverflow.com/q/1508975
has comment: http://stackoverflow.com/comment/43481961
favorite count: 0
has answer: http://stackoverflow.com/a/27525511

http://stackoverflow.com/q/27634150
has comment: http://stackoverflow.com/comment/43687902
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43689148
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43688163
has body: I want to search some data from database and set it to jtable. So far I have written this code: try { String sql="select * from hotelinfo where Hotel_Name=?; pst=conn.prepareStatement(sql); pst.setString(1,searchtxt.getText()); rs=pst.executeQuery(); hotelinfo.setModel(DbUtils.resultSetToTableModel(rs)); } catch(Exception ex) { JOptionPane.showMessageDialog(null, ex); } this code is working but gives only one row i want whole rows which is related to my search
has comment: http://stackoverflow.com/comment/43687850
tagged with: java
type: Question
has title: Having Difficulty In Searching on My JAva Program
favorite count: 0
score: 0
tagged with: sql
answer count: 1
linked to: http://stackoverflow.com/q/10347148
has answer: http://stackoverflow.com/a/27634217

http://stackoverflow.com/comment/43583920
score: 0
comment on: http://stackoverflow.com/q/27579434
type: Comment
type: QuestionComment
has text: @pbabcdefp You mean by making the validation a private method as suggested in the answer?

http://stackoverflow.com/comment/43646234
type: Comment
has text: I believe I tried that, I guess I messed it up, it works now. Thanks!
comment on: http://stackoverflow.com/a/27611962
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43505225
type: QuestionComment
comment on: http://stackoverflow.com/q/27520905
type: Comment
has text: Can you see the server log? It might show something that is causing the exception.
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/27498702
tags question: http://stackoverflow.com/q/27542629
tags question: http://stackoverflow.com/q/27474825
tags question: http://stackoverflow.com/q/27621645
tags question: http://stackoverflow.com/q/27531092
tags question: http://stackoverflow.com/q/27507754
tags question: http://stackoverflow.com/q/27479101
tags question: http://stackoverflow.com/q/27620754
tag name: tcp
tags question: http://stackoverflow.com/q/27482717
tags question: http://stackoverflow.com/q/27484844

http://stackoverflow.com/q/27604656
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43652763
score: 1
tagged with: java
has title: Add image to location where user click on Layout
linked to: http://stackoverflow.com/q/9050996
type: Question
has answer: http://stackoverflow.com/a/27608320
answer count: 2
has answer: http://stackoverflow.com/a/27605397
downvote count: 0
possible better answer: http://stackoverflow.com/a/27608320
tagged with: android
has comment: http://stackoverflow.com/comment/43631688
favorite count: 0
accepted answer: http://stackoverflow.com/a/27605397
has body: I am trying to add image to the point (X,Y) on Layout i have created dynamicaly. I want to add the imageview on exact user clicked location. But the image is not placed on correct location when clicked. here is my code final LinearLayout layoutColumnBoxes = new LinearLayout(getParent()); layoutColumnBoxes.setBackgroundColor(Color.GREEN); layoutColumnBoxes.setId(counterIdForBoxes); layoutColumnBoxes.setLayoutParams(layoutParamsColumns); layoutColumnBoxes.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Toast.makeText(getParent(),"Event="+event.getX()+"Event Y = "+event.getY(),Toast.LENGTH_SHORT).show(); return false; } }); layoutColumnBoxes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView imageView = new ImageView(getParent()); imageView.setImageResource(R.drawable.crack); LinearLayout lay = (LinearLayout) view.findViewById(v.getId()); lay.addView(imageView); // Toast.makeText(getParent(),"Clicked View Id is="+v.getId(),Toast.LENGTH_SHORT).show(); } }); Please help.
upvote count: 1
has comment: http://stackoverflow.com/comment/43632896

http://stackoverflow.com/q/27594087
has title: GWT compilation fails due to SimpleDateFormat [LIBGDX]
score: 0
has answer: http://stackoverflow.com/a/27603810
has answer: http://stackoverflow.com/a/27594108
type: UnansweredQuestion
type: Question
tagged with: gwt
tagged with: libgdx
tagged with: java
linked to: http://stackoverflow.com/q/10284564
has body: As you may know SimpleDateFormat is not support by GWT. However I could not find an any alternative so far. public Player(String name, int score, Date dateScore){ this.name = name; this.score = score; this.dateScore = dateScore; if(dateScore != null){ this.dateScoreFormatted = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(dateScore); } } This guy here says to import com.google.gwt.i18n.client.DateTimeFormat, but I have no idea how to import it. Will this work on native Android and Desktop app as well with Libgdx?
answer count: 2

scala
tags question: http://stackoverflow.com/q/27518111
tags question: http://stackoverflow.com/q/27526670
tags question: http://stackoverflow.com/q/27476861
tags question: http://stackoverflow.com/q/27591709
tags question: http://stackoverflow.com/q/27632554
tags question: http://stackoverflow.com/q/27625476
tags question: http://stackoverflow.com/q/27499132
tags question: http://stackoverflow.com/q/27568901
tags question: http://stackoverflow.com/q/27549671
tags question: http://stackoverflow.com/q/27591279
tags question: http://stackoverflow.com/q/27533923
tags question: http://stackoverflow.com/q/27536380
tags question: http://stackoverflow.com/q/27481508
tags question: http://stackoverflow.com/q/27584966
tags question: http://stackoverflow.com/q/27559449
tags question: http://stackoverflow.com/q/27638934
tags question: http://stackoverflow.com/q/27613704
tags question: http://stackoverflow.com/q/27620889
tags question: http://stackoverflow.com/q/27621939
tags question: http://stackoverflow.com/q/27629968
tags question: http://stackoverflow.com/q/27628373
tag name: scala
tags question: http://stackoverflow.com/q/27611133
tags question: http://stackoverflow.com/q/27588588
type: Tag
tags question: http://stackoverflow.com/q/27603348
tags question: http://stackoverflow.com/q/27549070

http://stackoverflow.com/comment/43593856
has text: @harold_finch Edited. Your code wasn't doing that. And you needed to pass in input.
comment on: http://stackoverflow.com/a/27584584
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27632564
type: AnsweredQuestion
has body: I am working on this project currently. It works surprisingly well. Yet, after re-reading the README again, I started to wonder about how to document something that is bugging me... To quote the example, and forgetting for a moment that exceptions can be thrown, it reads: Files.list(somePath).map(Path::toRealPath).forEach(System.out::println) OK. Now, the method of Path involved is this one. Of course, we do not pass any LinkOption. Again: let's forget for a moment that it throws any exception. Stream's .map() takes a Function as an argument. This interface, for Function&lt;T, R&gt;, is defined as: R apply(T t); But the method I am using accepts no arguments. At a first glance, it does not seem to match a Function, right? Except that... It can be written as: path -&gt; path.toRealPath() It therefore looks like the mechanism used is somewhat able to invoke a method on the "stream object" if the method reference has no argument, or something like that... I'd like to document this accordingly, and I am missing something here. What am I missing?
tagged with: java
has answer: http://stackoverflow.com/a/27632604
type: Question
score: 5
upvote count: 5
downvote count: 0
tagged with: invokedynamic
accepted answer: http://stackoverflow.com/a/27632604
has title: Lambda matches signature of a FunctionalInterface, yet "does not". How do you explain that the argument is passed at all?
answer count: 1
favorite count: 0
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/comment/43650792
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27601781
has text: Thanks for ur reply @Panther. I am unable understand your point, because of my less knowledge on aspectj. Can you please clarify more. Thanks

http://stackoverflow.com/q/27593581
tagged with: spring-io
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27655074
downvote count: 2
accepted answer: http://stackoverflow.com/a/27655074
score: 5
has body: I'm following this simple tutorial http://beanio.org/ Toward the end says you can use an annotated class instead of an XML file. I did that and in my factory.load() I pass the value with the name of my annotated class. and I get am org.xml.sax.SAXParseException. I believe this is caused because its expecting an XML file. What method I need to use to pass my annotated class instead of an XML?
upvote count: 7
answer count: 1
favorite count: 0
tagged with: bean-io
tagged with: spring
has title: Using an annotated class in BeanIO instead of an XML for mapping
type: AnsweredQuestion

http://stackoverflow.com/comment/43635305
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27591734
has text: I noticed that I receive another error when I try to persist a Profile entity object: java.lang.IllegalArgumentException: out of field index :9 at xxx.Profile.jdoCopyField(Profile.java) at xxx.Profile.jdoCopyFields(Profile.java) ... I think there is a connection between two problems. Could it be related some how to JPA entity enhancement process?

http://stackoverflow.com/q/27553637
favorite count: 0
tagged with: generics
upvote count: 2
has body: I'm trying to write an interface that is iterable and supports multiple levels of abstraction. I'm having trouble correctly defining the interface. I've declared the following interfaces and classes (a toy example): public interface A {} public class B implements A {} public interface C &lt;T extends A&gt; extends Iterable&lt;T&gt; {} public class D implements C&lt;B&gt; { public Iterator&lt;B&gt; iterator() { ... } } The following works: D d = new D(); for (A a : d) {} for (B b : d) {} But the following does not compile. Java says the for-each loop variable should be of type Object. C c = new D(); for (B b : c) {} I know I can cast to appease the compiler in the second example, but that seems yucky. Is there any way to declare interface C and subclass D so that I can support both iteration scenarios, or is that not possible? Thanks!
accepted answer: http://stackoverflow.com/a/27553661
has title: Supporting both interfaces and classes in generic iterable
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27553661

http://stackoverflow.com/comment/43684010
score: 0
type: Comment
type: QuestionComment
has text: The `else` within your `while` causes it to loop forever. You never modify `i`.
comment on: http://stackoverflow.com/q/27631830

http://stackoverflow.com/a/27584633
answers question: http://stackoverflow.com/q/27584608
score: 3
has body: Iterating a list and modifying it simultaneously causes a ConcurrentModificationException. In order to avoid that, you may add the new items into a new List and when you're done traversing the original list - combine both lists into the original. For example: private static List&lt;Tile&gt; tiles = new ArrayList&lt;Tile&gt;(); private static List&lt;Tile&gt; tmpTiles = new ArrayList&lt;Tile&gt;(); tiles.add(new Tile(mapsize/2*tilesize, mapsize/2*tilesize)); for(Tile tile: tiles){ if(!tile.spread){ tile.spread=true; tmpTiles.add(new Tile(tile.position.x-tilesize, tile.position.y)); } } tiles.addAll(tmpTiles);
downvote count: 0
type: Answer
upvote count: 3

tomcat8
tags question: http://stackoverflow.com/q/27552692
tags question: http://stackoverflow.com/q/27583271
type: Tag
tag name: tomcat8
tags question: http://stackoverflow.com/q/27499800
tags question: http://stackoverflow.com/q/27526714

http://stackoverflow.com/a/27629241
score: 2
upvote count: 2
has body: I think you might be asking about: SomeClass classvar = new SomeClass();// --&gt; Object 1 classvar = new SomeClass();// --&gt; Object 2 And if that is the case, then the first SomeClass object that was created will lose its reference and will eventually be garbage collected (this means that the object is destroyed to free up memory). And the classvar variable will now reference the second SomeClass object that was created.
accepted answer of: http://stackoverflow.com/q/27629195
answers question: http://stackoverflow.com/q/27629195
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43679107
type: Answer

http://stackoverflow.com/comment/43631454
type: Comment
comment on: http://stackoverflow.com/a/27604603
score: 0
type: AnswerComment
has text: @Tom: True, modified it. In C#, `List<T>` is a class :(. Sometimes one starts mixing up std-libs... :s

http://stackoverflow.com/a/27572910
score: 2
has body: You're using an array of primitives for one thing, not Integer. I suggest you use Arrays.asList(T...) like Integer[] values={4,5,2,3,42,60,20}; List&lt;Integer&gt; al = new ArrayList&lt;&gt;(Arrays.asList(values));
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/27572859
type: Answer

http://stackoverflow.com/a/27566611
answers question: http://stackoverflow.com/q/27566289
score: 0
type: Answer
has body: You are doing 1,700,000 * 900,000 queries to the data base. Try downloading sets of rows from the tables and iterating over them. I suggest an example in pseudocode: set1 = getNext5000RowsFromTable1 set2 = getNext5000RowsFromTable2 while (set1.isNotEmpty() &amp;&amp; set2.isNotEmpty()) { foreach (row1 : set1){ foreach (row2 : set2) { if (row1.getString("field").equals(row2.getString("field")){ ..... } } set1 = getNext5000RowsFromTable1 set2 = getNext5000RowsFromTable2 }

http://stackoverflow.com/a/27569833
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27569735
answers question: http://stackoverflow.com/q/27569735
has body: I'd probably select the items in one go. Something like this pseudocode: int max = Integer.MIN_VALUE; Set&lt;Item&gt; maxItems = new LinkedHashSet&lt;&gt;(); for( Item item : items ) { //if the item has a greater value clear the set and set the new max value if( item.value &gt; max ) { maxItems.clear(); max = item.value; } //due to the code above value should always be &lt;= max here, so we just need to check == if( item.value == max ) { maxItems.add( item ); } }

http://stackoverflow.com/a/27625796
has comment: http://stackoverflow.com/comment/43672403
has comment: http://stackoverflow.com/comment/43672030
has comment: http://stackoverflow.com/comment/43684198
score: 48
type: Answer
downvote count: 0
upvote count: 48
has comment: http://stackoverflow.com/comment/43672128
has comment: http://stackoverflow.com/comment/43684158
answers question: http://stackoverflow.com/q/27625611
has comment: http://stackoverflow.com/comment/43671996
has body: From the docs: The method nextDouble is implemented by class Random as if by: public double nextDouble() { return (((long)next(26) &lt;&lt; 27) + next(27)) / (double)(1L &lt;&lt; 53); } But it also states the following (emphasis mine): [In early versions of Java, the result was incorrectly calculated as: return (((long)next(27) &lt;&lt; 27) + next(27)) / (double)(1L &lt;&lt; 54); This might seem to be equivalent, if not better, but in fact it introduced a large nonuniformity because of the bias in the rounding of floating-point numbers: it was three times as likely that the low-order bit of the significand would be 0 than that it would be 1! This nonuniformity probably doesn't matter much in practice, but we strive for perfection.] This note has been there since Java 5 at least (docs for Java &lt;= 1.4 are behind a loginwall, too lazy to check). This is interesting, because the problem apparently still exists even in Java 8. Perhaps the "fixed" version was never tested?
has comment: http://stackoverflow.com/comment/43672199

http://stackoverflow.com/comment/43595280
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27585357
has text: Please read the Java info on conditional operators here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html

http://stackoverflow.com/q/27482634
has title: Share session between HTTPURLConnection with webview in Android
has body: I am developing an app which send request to server for login authentication when login is success then I set the username in session &amp; my session is created. I show the jsp pages of server on the webview so my jsp page require the session but they don't found any session because it was created by the HTTPURLConnection. So I want to know how can I share the session of HTTPURLConnection to webview. Code for setting session String uname=request.getparameter("Username"); if(LoginSucesss) { session.setAttribute("uid",uname); } Please don't mark this question as duplicate it is orignal. Thanks in advance
tagged with: android
has comment: http://stackoverflow.com/comment/43398614
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27483229
tagged with: android-webview
has comment: http://stackoverflow.com/comment/43398582
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27483229
tagged with: session
tagged with: jsp
has comment: http://stackoverflow.com/comment/43398645
score: 0
has comment: http://stackoverflow.com/comment/43398705
answer count: 1

http://stackoverflow.com/comment/43676704
type: AnswerComment
has text: This is why I check for the object again in the synchronized block. That way, you can have the best of both worlds - ensure it is fetched just once, but shortcut the synchronized block if its already there
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27627558

http://stackoverflow.com/a/27536984
has body: Typically you create a class that extends JPanel to override the paintComponent method: public class Test extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // code here } public void doStuff() { repaint(); } } You might consider creating a nested class like so: public class Test { public class MyPanel extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // code here } } JPanel panel = new MyPanel(); panel.repaint(); } Or you can do this without creating a class that extends JPanel: JPanel panel1 = new JPanel() { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // code here } }; panel1.repaint();
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27536818
accepted answer of: http://stackoverflow.com/q/27536818
has comment: http://stackoverflow.com/comment/43502338
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43700650
comment on: http://stackoverflow.com/a/27640480
score: 0
has text: Still forceclosing on line `response = httpClient.execute(get);`.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/43610271
score: 1
comment on: http://stackoverflow.com/q/27593211
type: Comment
type: QuestionComment
has text: You need to run test classes with a dedicated runner class; it is very unclear what your environment is

http://stackoverflow.com/comment/43615951
comment on: http://stackoverflow.com/q/27536254
type: Comment
type: QuestionComment
score: 0
has text: here is my ifconfig `pi@raspberrypi ~ $ ifconfig -a wlan0 Link encap:Ethernet HWaddr 00:0f:55:a8:c7:e4 inet addr:10.0.0.27 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6983 errors:0 dropped:0 overruns:0 frame:0 TX packets:3554 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7389019 (7.0 MiB) TX bytes:386523 (377.4 KiB)` The other ports are not active... Thanks for the help @DimitryK!!

http://stackoverflow.com/q/27582610
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43596893
has comment: http://stackoverflow.com/comment/43590456
has comment: http://stackoverflow.com/comment/43589780
has body: I am trying to create a header in word file using Apache POI but i am getting, Package should contain a content type part [M1.13] exception.I am using the following jars dom4j-1.7-2.jar poi-ooxml-3.9-2.jar poi-3.9.jar poi-scratchpad-3.9.jar xmlbeans-2.4.0.jar openxml4j.jar poi-ooxml-schemas-3.9.jar the code i am trying to run is public class TestHeader { /** * @param args * @throws IOException * @throws XmlException */ public static void main(String[] args) throws IOException, XmlException { InputStream input = new FileInputStream("D:\\test.docx"); XWPFDocument document = new XWPFDocument(input); XWPFHeaderFooterPolicy headerPolicy = new XWPFHeaderFooterPolicy( document); XWPFHeader header = headerPolicy.getDefaultHeader(); List&lt;XWPFTable&gt; table = header.getTables(); for (XWPFTable xwpfTable : table) { xwpfTable.getRow(1).getCell(0).setText("aaa"); // document.setTable(0, // xwpfTable); // header.insertTable(1, xwpfTable); } // System.out.println(header.getTables()); FileOutputStream out = new FileOutputStream("D:\\test.docx"); document.write(out); out.close(); } } This is the exception i am getting Exception in thread "main" org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13] at org.apache.poi.util.PackageHelper.open(PackageHelper.java:41) at org.apache.poi.xwpf.usermodel.XWPFDocument.&lt;init&gt;(XWPFDocument.java:120) at com.core.poi.TestHeader.main(TestHeader.java:24) Caused by: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13] at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:178) at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:662) at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:269) at org.apache.poi.util.PackageHelper.open(PackageHelper.java:39) ... 2 more Somebody please help me.
tagged with: apache-poi
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43589908
has comment: http://stackoverflow.com/comment/43589862
has answer: http://stackoverflow.com/a/37854714
type: Question
has comment: http://stackoverflow.com/comment/59674551
has comment: http://stackoverflow.com/comment/43590363
has title: How to solve Package should contain a content type part [M1.13] in Word Document
has answer: http://stackoverflow.com/a/29939778
answer count: 2
has comment: http://stackoverflow.com/comment/43589758

http://stackoverflow.com/comment/43432893
type: QuestionComment
score: 0
has text: check this url your will find your answer http://stackoverflow.com/questions/6087728/what-is-difference-between-setmaxresults-and-setfetchsize-in-org-hibernate-query
comment on: http://stackoverflow.com/q/27501119
type: Comment

http://stackoverflow.com/comment/43625562
type: QuestionComment
type: Comment
has text: Look at these questions: http://stackoverflow.com/questions/4367539/what-is-the-difference-between-reader-and-inputstream http://stackoverflow.com/questions/5764065/the-difference-between-inputstream-and-inputstreamreader-when-reading-multi-byte
score: 2
comment on: http://stackoverflow.com/q/27601520

http://stackoverflow.com/q/27609720
tagged with: java
has body: I already checked similar questions but I couldn't solve my problem. The most relevant one is Elliptic curve addition in Jacobian coordinates but there is no solution. I have a helper class called Jacobian which will have the three Jacobian coordinates X, Y &amp; X I followed the algorithm published on http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html#addition-add-2007-bl The algorithm is: Z1Z1 = Z12 Z2Z2 = Z22 U1 = X1*Z2Z2 U2 = X2*Z1Z1 S1 = Y1*Z2*Z2Z2 S2 = Y2*Z1*Z1Z1 H = U2-U1 I = (2*H)2 J = H*I r = 2*(S2-S1) V = U1*I X3 = r2-J-2*V Y3 = r*(V-X3)-2*S1*J Z3 = ((Z1+Z2)2-Z1Z1-Z2Z2)*H When I checked the result it's not on the defined curve. I also checked it with Sage but I got a different result. public Jacobian pointAddition(Jacobian jp1, Jacobian jp2){ /* Reference: http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html#addition-add-2007-bl Z1Z1 = Z12 Z2Z2 = Z22 U1 = X1*Z2Z2 U2 = X2*Z1Z1 S1 = Y1*Z2*Z2Z2 S2 = Y2*Z1*Z1Z1 H = U2-U1 I = (2*H)2 J = H*I r = 2*(S2-S1) V = U1*I X3 = r2-J-2*V Y3 = r*(V-X3)-2*S1*J Z3 = ((Z1+Z2)2-Z1Z1-Z2Z2)*H */ if(arePointsInverse(jp1, jp2)){ return P0; } if(arePointsEqual(jp1, jp2)){ return pointDoubling(jp1); } if(jp1.isInfinity(getGf())){ return jp2; } if(jp2.isInfinity(getGf())){ return jp1; } BigInteger X1 = jp1.getX(); BigInteger Y1 = jp1.getY(); BigInteger Z1 = jp1.getZ(); BigInteger X2 = jp2.getX(); BigInteger Y2 = jp2.getY(); BigInteger Z2 = jp2.getZ(); BigInteger X3,Y3,Z3; BigInteger Z1Z1 = Z1.multiply(Z1); //BigInteger Z1Z1 = Z1.pow(2).mod(getGf()); BigInteger Z2Z2 = Z2.multiply(Z2); //BigInteger Z2Z2 = Z2.pow(2).mod(getGf()); BigInteger U1 = X1.multiply(Z2Z2); BigInteger U2 = X2.multiply(Z1Z1); BigInteger S1 = Y1.multiply(Z2.multiply(Z2Z2)); BigInteger S2 = Y2.multiply(Z1.multiply(Z1Z1)); BigInteger H = U2.subtract(U1); BigInteger I = (TWO.multiply(H)).pow(2); BigInteger J = H.multiply(I); BigInteger r = TWO.multiply(S2.subtract(S1)); BigInteger V = U1.multiply(I); X3 = ((r.multiply(r)).subtract(J).subtract(TWO.multipl…
has comment: http://stackoverflow.com/comment/43641860
upvote count: 4
linked to: http://stackoverflow.com/q/21463018
has comment: http://stackoverflow.com/comment/43651444
has comment: http://stackoverflow.com/comment/43648011
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/27623734
has comment: http://stackoverflow.com/comment/43651326
type: Question
has comment: http://stackoverflow.com/comment/43641800
has title: Elliptic Curve Point Addition in Jacobian Coordinates
score: 3
tagged with: elliptic-curve
tagged with: cryptography
accepted answer: http://stackoverflow.com/a/27623734
downvote count: 1
answer count: 1
tagged with: coordinate-systems
has comment: http://stackoverflow.com/comment/43641924

http://stackoverflow.com/comment/43458112
comment on: http://stackoverflow.com/a/27508714
score: 0
type: AnswerComment
has text: Yes, in documentation for `computeWithForm` http://www-01.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_COMPUTEWITHFORM_METHOD.html?lang=en says "Validates a document by executing the default value, translation, and validation **formulas**, if any are defined in the document form." Similar for `renderToRTItem`: http://www-01.ibm.com/support/knowledgecenter/SSVRGU_9.0.1/com.ibm.designer.domino.main.doc/H_RENDERTORTITEM_METHOD.html?lang=en
type: Comment

http://stackoverflow.com/a/27516071
type: Answer
has comment: http://stackoverflow.com/comment/44039079
has comment: http://stackoverflow.com/comment/43513522
has comment: http://stackoverflow.com/comment/43472451
has comment: http://stackoverflow.com/comment/44039153
score: 0
answers question: http://stackoverflow.com/q/27508936
has body: The class you have nominated as the message emitter is the standard Saxon message emitter, but what you want to do is to implement your own. Something like this: public static class MyMessageEmitter extends net.sf.saxon.serialize.MessageEmitter { StringWriter writer = new StringWriter(); public MyMessageEmitter() { setWriter(writer); } public void close() { super.close(); String message = writer.toString(); // now do what you want with the message writer = new StringWriter(); // ready for the next message } } then... transFact.setAttribute(FeatureKeys.MESSAGE_EMITTER_CLASS, "MyMessageEmitter"); This would actually be a bit easier using Saxon's s9api interface rather than JAXP, and if you were a more experienced Java programmer I would point you in that direction, but as you're new to the game it's probably easier to take small steps.

http://stackoverflow.com/comment/43460048
type: AnswerComment
score: 0
type: Comment
has text: After you changed this, also exchange the third line in this onCreate Method with the second one
comment on: http://stackoverflow.com/a/27514502

http://stackoverflow.com/a/27605195
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43632650
type: AcceptedAnswer
downvote count: 0
has body: When marshalled as the root object an instance of String needs to be wrapped in a JAXBElement to provide the root element information (same as for any class without an @XmlRootElement annotation. When marshalled as a field or property value the containing element is normally derived from the containing field/property so a JAXBElement by default is not required.
type: Answer
accepted answer of: http://stackoverflow.com/q/27605000
has comment: http://stackoverflow.com/comment/43632546
has comment: http://stackoverflow.com/comment/43635680
answers question: http://stackoverflow.com/q/27605000

http://stackoverflow.com/comment/43555606
has text: The server version is 9.0.1 which is the same as other installations, so I'm afraid that is not the problem here. I'm never saving the context document - do you think that could cause the problem? I also tested compiling the project with 1.5 and 1.6 but it did not make a difference either
comment on: http://stackoverflow.com/a/27565100
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43698769
type: QuestionComment
comment on: http://stackoverflow.com/q/27639715
type: Comment
has text: for me this worked in case somebody will need it: "javac -classpath /home/seba/Desktop/programming_Ubuntu HelloDate.java" after that "java -classpath /home/seba/Desktop/programming_Ubuntu:/home/seba/Desktop HelloDate"
score: 0

http://stackoverflow.com/comment/43567521
comment on: http://stackoverflow.com/q/27570885
type: Comment
has text: That unix command is correct, I guess your problem is in the code. How are you reading from stdin? `System.in`? (please paste the relevant code)
score: 1
type: QuestionComment

http://stackoverflow.com/a/27519268
has comment: http://stackoverflow.com/comment/43526559
answers question: http://stackoverflow.com/q/27508856
accepted answer of: http://stackoverflow.com/q/27508856
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: The statements checking the 'hits' array are very poorly formatted. the &amp; operator is a bitwise AND. I expect you mean this to be '&amp;&amp;` which is logical AND. Also, in general, you don't need to compare a boolean value to true or false. So your comparisons should read something like: if ( hist[1] &amp;&amp; hist[2] &amp;&amp; ... &amp;&amp; hist[9]) { ... } else { ... } Secondly, you are running these checks 9 times per row or column (I think that's right - the indenting is mixed up so it's hard to tell). You should be running these checks outside your j for loop. In other words, it should build the hist array completely for a row or column and then check whether all 9 values are accounted for. There are many other stylistic errors and possible logic errors but these seem to me to be the first things to fix.
upvote count: 1

http://stackoverflow.com/a/27621915
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27621454
answers question: http://stackoverflow.com/q/27621454
type: Answer
upvote count: 5
has body: You need add this as programmatically like this in your code: toast.setGravity(Gravity.TOP|Gravity.LEFT, 0, 0);

http://stackoverflow.com/comment/43677305
type: Comment
type: QuestionComment
score: 1
has text: And you shouldn't be using null layouts....
comment on: http://stackoverflow.com/q/27628229

http://stackoverflow.com/comment/71095117
type: AnswerComment
has text: It would be useful when migrating an existing set of rules to DRL files. That is what I am currently trying to accomplish.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/29560383

lucene
tags question: http://stackoverflow.com/q/27507089
tags question: http://stackoverflow.com/q/27567498
tags question: http://stackoverflow.com/q/27564011
tags question: http://stackoverflow.com/q/27622181
tags question: http://stackoverflow.com/q/27634276
type: Tag
tag name: lucene
tags question: http://stackoverflow.com/q/27498455
tags question: http://stackoverflow.com/q/27509077
tags question: http://stackoverflow.com/q/27547483
tags question: http://stackoverflow.com/q/27624859

http://stackoverflow.com/comment/43451181
has text: What type is `delta`. If it is an integer type then `deltas` will probably always be zero and at very high frame rates `deltams` will lose significant time.
comment on: http://stackoverflow.com/q/27483228
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27550862
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43527929
has answer: http://stackoverflow.com/a/27562889
has comment: http://stackoverflow.com/comment/43528245
has comment: http://stackoverflow.com/comment/43597192
type: Question
linked to: http://stackoverflow.com/q/8600972
has comment: http://stackoverflow.com/comment/44078026
tagged with: eclipse
score: 0
accepted answer: http://stackoverflow.com/a/27562889
has body: I'm looking for a solution of the problem of java heap space memory error. It begans to make me tired, so I'd like to help me to find where can I set the value of the heap space java .. I'm working on the project of rabbithole and I dont know where I could find the specified java heap space memory. I'm also developing on eclipse and I already moved the value of max memory but nothing seems to be working. Is there anyone who can help me as soon as possible ? Thank you all
answer count: 1
has title: Java heap space error in rabbithole project (Neo4j console)
tagged with: neo4j
tagged with: console
has comment: http://stackoverflow.com/comment/43528010
linked to: http://stackoverflow.com/q/7899221
has comment: http://stackoverflow.com/comment/43550994

http://stackoverflow.com/q/27589311
score: 0
has comment: http://stackoverflow.com/comment/43602707
tagged with: vector
tagged with: arrays
has body: public static void main(String[] args) { // TODO Auto-generated method stub Vector fullVector = new Vector(); Vector simpleVector = new Vector(); String[] fullVectorData = new String[2]; fullVectorData[0] = "MAP0003"; fullVectorData[1] = ","; fullVector.add(fullVectorData); String[] fullVectorData1 = new String[2]; fullVectorData1[0] = "MAP0004"; fullVectorData1[1] = ","; fullVector.add(fullVectorData1); String[] simpleData = new String[2]; simpleData[0] = "MAP0003"; simpleData[1] = ","; simpleVector.add(simpleData); int i = 0 ; for (Iterator iterator = fullVector.iterator(); iterator.hasNext();) { String[] object = (String[]) iterator.next(); System.out.println(object); if(!simpleVector.contains(object)){ System.out.println("test"+ i); i++; } } } I want to find out the simplevector object findout fullVectorData object or not? why the contains method not giving desired result here?
has answer: http://stackoverflow.com/a/27589433
answer count: 3
has answer: http://stackoverflow.com/a/27589370
has title: java code to search specified string array contains in vector or not
has comment: http://stackoverflow.com/comment/43602804
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27589373
has comment: http://stackoverflow.com/comment/43634928
tagged with: java
type: Question

http://stackoverflow.com/comment/43500991
type: AnswerComment
score: 0
type: Comment
has text: i was but i am not sure anymore.
comment on: http://stackoverflow.com/a/27535134

http://stackoverflow.com/a/27548649
answers question: http://stackoverflow.com/q/27548524
has comment: http://stackoverflow.com/comment/43523462
has body: A Set does not have an get() method, because its not array like. you normaly can iterate through an Set with its iterator: set.iteraor().next() The iterator interface implements the folowing methods: public boolean hasNext() public E next() public void remove() you can use it like here (in this case is an Set): Iterator it = set.iterator(); while (it.hasNext()) { String setText = (String) it.next(); System.out.println(setText); }
score: 0
type: Answer

http://stackoverflow.com/a/27478857
has comment: http://stackoverflow.com/comment/43391546
type: Answer
upvote count: 1
score: 1
has body: What would you expect when converting 1:70:00 to a Date object? The Date can hold only valid values and 1:70:00 is not valid. This is the expected. If you need something different behavior then you should write your own formatter which converts a String to a String.
answers question: http://stackoverflow.com/q/27478815
downvote count: 0

http://stackoverflow.com/comment/43617319
comment on: http://stackoverflow.com/q/27596345
score: 1
has text: I didn't follow much of the error trace since its not in English :) but can you post the code that does save?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/63673339
type: AnswerComment
score: 3
comment on: http://stackoverflow.com/a/27659935
type: Comment
has text: @spencergibb `loadbalance` does not seem to be available in `@FeignClient` any more (Spring Boot 1.3.5, Brixton SR1 release). Any alternatives?

http://stackoverflow.com/a/27536407
downvote count: 0
upvote count: 3
has body: Alright false alarm guys, guava is not actually broken (surprise surprise). The reason is cause the code that was instantiating the DAO was instantiating a new object every time, so a new cache was also instantiated every time. I made the cache a static variable and it now works.
answers question: http://stackoverflow.com/q/27534697
type: Answer
score: 3

bit-manipulation
tags question: http://stackoverflow.com/q/27625611
type: Tag
tags question: http://stackoverflow.com/q/27509855
tag name: bit-manipulation

http://stackoverflow.com/comment/43490488
has text: `Interface1 listener = (Interface1) subClassObject;` ← this works just fine on my end. You should post the stack trace and perhaps more of your code.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27530897

http://stackoverflow.com/comment/43685531
type: AnswerComment
has text: You done great job. Yeah because of that it gives an error.
score: 0
comment on: http://stackoverflow.com/a/27632795
type: Comment

http://stackoverflow.com/q/27614545
has comment: http://stackoverflow.com/comment/43651204
tagged with: facebook
has comment: http://stackoverflow.com/comment/43651021
has title: Android Integrate Facebook NullPointerException
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/43651023
has comment: http://stackoverflow.com/comment/43651099
type: Question
has body: Basically I am trying to integrate Facebook sharing into my Android project. I followed this Tutorial. And I am currently working on the Facebook login when button onClickListener is triggered: ivFacebookShare.setOnClickListener(new OnClickListener(){ public void onClick(View v){ AndroidFacebookConnectActivity.loginToFacebook(getActivity()); } }); And in my another class, I am executing loginToFacebook(): @SuppressWarnings("deprecation") public static void loginToFacebook(Activity context) { mPrefs = context.getPreferences(MODE_PRIVATE); String access_token = mPrefs.getString("access_token", null); long expires = mPrefs.getLong("access_expires", 0); if (access_token != null) { facebook.setAccessToken(access_token); } if (expires != 0) { facebook.setAccessExpires(expires); } if (!facebook.isSessionValid()) { facebook.authorize(context, new String[] { "email", "publish_stream" }, new DialogListener() { public void onCancel() { } public void onComplete(Bundle values) { // Function to handle complete event // Edit Preferences and update facebook acess_token SharedPreferences.Editor editor = mPrefs.edit(); editor.putString("access_token", facebook.getAccessToken()); editor.putLong("access_expires", facebook.getAccessExpires()); editor.commit(); } public void onError(DialogError error) { } public void onFacebookError(FacebookError fberror) { } }); } } However, I am getting error message as the stacktrace: 12-23 13:23:05.938: D/AndroidRuntime(29010): Shutting down VM 12-23 13:23:05.938: W/dalvikvm(29010): threadid=1: thread exiting with uncaught exception (group=0x40c561f8) 12-23 13:23:05.954: E/AndroidRuntime(29010): FATAL EXCEPTION: main 12-23 13:23:05.954: E/AndroidRuntime(29010): java.lang.NullPointerException 12-23 13:23:05.954: E/AndroidRuntime(29010): at nyp.edu.eneighbourhood.AndroidFacebookConnectActivity.loginToFacebook(AndroidFacebookConnectActivity.java:49) 12-23 13:23:05.954: E/AndroidRuntime(29010): at nyp.edu.eneighbourhood.EventDetail$3.onClick(EventDetail.…
score: 0
has comment: http://stackoverflow.com/comment/43651003
tagged with: android
has comment: http://stackoverflow.com/comment/43650985
has comment: http://stackoverflow.com/comment/43651407
has comment: http://stackoverflow.com/comment/43651025
has comment: http://stackoverflow.com/comment/43651078
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43661051
type: QuestionComment
comment on: http://stackoverflow.com/q/27620071
has text: your file needed to be break into lines in order to read just first line, I am sure your entire file is just a single line of text without any line breaks. You can first load the file, break it into lines ac to your requirement and then read the first line from that.
type: Comment
score: 1

http://stackoverflow.com/q/27484348
score: 0
has answer: http://stackoverflow.com/a/27484597
has body: I would like to write a regular expression that catch Encoded Words parts from email MIME message string (eml). for example, this is part of email: ------------- =D7=91=D7=91=D7= =A8=D7=9B=D7=94, =D7=90=D7=91=D7=99=D7=A2= =D7=93 =D7=9B=D7=94=D7=9F --20cf3003bc2e044e980500f755dc-- --20cf3003bc2e044e9d0500f755de Content-Type: text/plain; charset=US-ASCII; name="EhudBanay.txt" Content-Disposition: attachment; filename="EhudBanay.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hz0z4us30 [binary] --20cf3003bc2e044e9d0500f755de-- i would like to catch only this part: [binary] I wrote the folowing regular expression: (?<=\r\n\r\n)(.+\r\n)+(?=--) which provide the results i want. i assume that: * the regular expression should return all the occurrences of such parts. multiple * before the wanted part there is always an empty line. * the wanted part is always followed by a line start with "--" (there might be a seperation line between them). The problem with this solution is that i get Exception in thread "main" java.lang.StackOverflowError when the input string is long, what makes me think of the regular expression efficiency. I would like to make the regular expression more precise. we can make use of the fact that somewhere before the empty line that comes before the wanted part, there is always a line starting with "Content-Transfer-Encoding:". Can someone please help?
answer count: 1
type: UnansweredQuestion
tagged with: regex
has title: Java Regular Expression to catch email encoded attachments string
tagged with: java
type: Question

http://stackoverflow.com/a/68913656
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/122901365
type: Answer
has comment: http://stackoverflow.com/comment/122901321
upvote count: 7
answers question: http://stackoverflow.com/q/27583623
has comment: http://stackoverflow.com/comment/125979089
has comment: http://stackoverflow.com/comment/122900261
has body: Here is simple wrapping spliterator implementation that groups source elements into chunks: public class ChunkedSpliterator<T> implements Spliterator<List<T>> { private static final int PROMOTED_CHARACTERISTICS = Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SIZED | Spliterator.IMMUTABLE | Spliterator.CONCURRENT; private static final int SELF_CHARACTERISTICS = Spliterator.NONNULL; private final Spliterator<T> src; private final int chunkSize; public ChunkedSpliterator(Spliterator<T> src, int chunkSize) { if (chunkSize < 1) throw new IllegalArgumentException("chunkSize must be at least 1"); this.src = src; this.chunkSize = chunkSize; } public static <E> Stream<List<E>> chunkify(Stream<E> src, int chunkSize) { ChunkedSpliterator<E> wrap = new ChunkedSpliterator<>(src.spliterator(), chunkSize); return StreamSupport.stream(wrap, src.isParallel()); } @Override public boolean tryAdvance(Consumer<? super List<T>> action) { List<T> result = new ArrayList<>((int) Math.min(src.estimateSize(), chunkSize)); for (int i = 0; i < chunkSize; ++i) { if (!src.tryAdvance(result::add)) break; } if (result.isEmpty()) return false; action.accept(result); return true; } @Override public Spliterator<List<T>> trySplit() { Spliterator<T> srcSplit = src.trySplit(); return srcSplit == null ? null : new ChunkedSpliterator<>(srcSplit, chunkSize); } @Override public long estimateSize() { long srcSize = src.estimateSize(); if (srcSize <= 0L) return 0L; if (srcSize == Long.MAX_VALUE) return Long.MAX_VALUE; return (srcSize - 1) / chunkSize + 1; } @Override public int characteristics() { return (src.characteristics() & PROMOTED_CHARACTERISTICS) | SELF_CHARACTERISTICS; } } There is handy chunkify shortcut method to make things easier: Stream<T> input = ...; Stream<List<T>> chunked = ChunkedSpliterator.chunkify(input, 1000); Despite the call Stream.spliterator() is terminal operation it actually does not forcibly exhaust the stream's source. So, it can be processed via its spliterator gradua…
has comment: http://stackoverflow.com/comment/122897365

http://stackoverflow.com/a/27624217
downvote count: 0
type: Answer
has body: This isn't specific to Tomcat it seems. After searching some more I found that cglib_nodep dependency has some class loading issues. I excluded this library from the tree, explicitly defined cglib version 2.2 and it cleared things up. http://forum.spring.io/forum/spring-projects/web/flex/65337-an-strange-error-with-net-sf-cglib-core-keyfactory
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27610788
answers question: http://stackoverflow.com/q/27610788
type: AcceptedAnswer

http://stackoverflow.com/q/27578986
has title: Searching in google using image
has body: I have an android app that should search in google using image.. User should upload photo and search using it.. I have that code to choose photo to search.. Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), GALLERY_CODE); I searched in google, and I found only that.. ImageSearch But that searches for images using keyword.. I don't want that.. Also I tried to search in Bing using image but I couldn't. Any Idea ?
answer count: 1
downvote count: 0
tagged with: google-image-search
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27580203
tagged with: google-custom-search
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/a/27585089
has body: Use this pattern \s*,\s*(?=(?:(?:[^"]*"){2})*[^"]*$) Demo and I guess in your case, replace \s with \\s \s*,\s* # your pattern (?= # look-ahead (?:(?:[^"]*"){2})* # optional pairs of double quotes [^"]*$ # followed by optional anything but double quotes to the end )
answers question: http://stackoverflow.com/q/27584983
type: Answer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/27584983
has comment: http://stackoverflow.com/comment/43594743
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43594739

http://stackoverflow.com/a/27583208
has body: The local variable phoneNumber shadows the instance variable with the same name. void setNumber(){ String phoneNumber; phoneNumber = "4321"; } So this code sets the local variable, doesn't change the instance variable. If you wanted to change the instance variable, you would have to disambiguate, using the this. prefix, like this: void setNumber(){ String phoneNumber; this.phoneNumber = "4321"; } ... or better yet, just remove the pointless local variable entirely... (like you said @RobP!)
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/27583192
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27583192

http://stackoverflow.com/comment/43581996
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27578460
type: AnswerComment
has text: I know that will work, but In order to make that work I should deserialize the json string manually and set properties according to which field it contains using reflect(may be?), some job `gson.fromJson()` has already done.

http://stackoverflow.com/comment/43654237
has text: possible duplicate of [How to add one day to a date?](http://stackoverflow.com/questions/1005523/how-to-add-one-day-to-a-date)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27614322
type: QuestionComment

http://stackoverflow.com/q/27581292
has body: I'm tring to create a table in mysql from java desktop program but I obtain a MySqlSyntaxErrorException. The query is : CREATE TABLE FileXFascia(fila0 Integer,fila1 Integer,fila2 Integer,fila3 Integer) VALUES ('3','4','3','3') Anyone knows where I'm wrong? 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 'VALUES ('3','4','3','3')' at line 1
has comment: http://stackoverflow.com/comment/43586917
score: 0
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/27581561
tagged with: java
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/43586915
accepted answer: http://stackoverflow.com/a/27581314
downvote count: 1
type: Question
type: AnsweredQuestion
has title: MySqlSyntaxErrorException wrong Query
tagged with: database
has answer: http://stackoverflow.com/a/27581561
has answer: http://stackoverflow.com/a/27581314

http://stackoverflow.com/q/27494827
answer count: 2
has comment: http://stackoverflow.com/comment/43421640
upvote count: 0
favorite count: 0
has title: Learning Java - function returns 0
has answer: http://stackoverflow.com/a/27494878
has body: I'm just learning Java... I have three classes which creates bank account My first class; public class Banka { protected static int pocetUctu = 0; public Ucet vytvorUcet(Clovek maj, double pocatecni) { Ucet uc = new Ucet(maj, pocatecni); pocetUctu++; System.out.println("Ucet " + uc + " vytvoren"); System.out.println("Pocet uctu " + pocetUctu); return uc; } public static void main(String[] args) { Banka b1 = new Banka(); Clovek pn = new Clovek("Petr Novotny", 1949); Clovek jv = new Clovek("Jan Vesely", 1970); Ucet pu1 = b1.vytvorUcet(pn, 1000); Ucet pu2 = b1.vytvorUcet(pn, 50000); Ucet ju = b1.vytvorUcet(jv, 3000); pu2.prevedNa(ju, 1000); ju.prevedNa(pu1, 500); pu1.vypisInfo(); pu2.vypisInfo(); ju.vypisInfo(); } } My second class; public class Clovek { protected String jmeno; protected int rokNarozeni; protected static int pocetLidi = 0; public Clovek(String j, int rN) { jmeno = j; rokNarozeni = rN; pocetLidi++; } public void vypisInfo() { System.out.println("Clovek:"); System.out.println("Jmeno="+jmeno); System.out.println("Rok narozeni="+rokNarozeni); } } My third class; public class Ucet { static double zustatek; static Clovek majitel; public Ucet(Clovek maj, double zus) { maj = majitel; zus = zustatek; } public void pridej(double pocatecni) { zustatek += pocatecni; } public void vypisZustatek() { System.out.println(zustatek); } public Ucet prevedNa(Ucet kam, float castka) { zustatek -= castka; // nebo také vhodné je: pridej(-castka); kam.pridej(castka); return this; } public void vypisInfo() { System.out.println("Vlastník" + majitel); System.out.println("Zůstatek" + zustatek); } } pu1.vypisInfo(); should output account owner and his money on it, but It shows owner null and balance 0. Where can be problem ?
possible better answer: http://stackoverflow.com/a/27494964
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27494964
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/27494878
score: -1

http://stackoverflow.com/comment/43658141
type: Comment
has text: 1. I thought that your database was updated as you said that all your records are of the form "xxx.xxx@0000" when you opens the DB in a SQLite browser... please be really precise about your problem. 2. We are not here to make your homeworks... we will answer you only when we have time to do it ;)
score: 0
comment on: http://stackoverflow.com/q/27616438
type: QuestionComment

http://stackoverflow.com/q/27608890
has comment: http://stackoverflow.com/comment/43640630
favorite count: 0
has title: java changing value in for loop
has comment: http://stackoverflow.com/comment/43640586
possible better answer: http://stackoverflow.com/a/27609006
has answer: http://stackoverflow.com/a/27608924
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43640027
has answer: http://stackoverflow.com/a/27609006
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43640754
has comment: http://stackoverflow.com/comment/43640701
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43640050
accepted answer: http://stackoverflow.com/a/27608924
has body: I tested my algorithm in python and it does exactly what I want it to do. Now I just want to write the same code in java. I am running into two issues. One with line 7 and one with line 8. I would like to know why i is not detected even though I have int i inside the for loop. I am taking Java next semester, so sorry if this is a really easy bug to deal with. public class HelloWorld{ public static void main(String []args){ int[] a = {1, 0, 12, 11}; int max = a[0]; for (int i:a); { if (max &lt; i); { max = i; } } System.out.print("max"); // if method is void, then cannot return value } }
answer count: 2

http://stackoverflow.com/comment/44593944
type: Comment
has text: You can use [entityListeners](http://mdshannan1.blogspot.nl/2011/06/how-to-use-jpa-hibernate-lifecycle.html) for monitoring changes/actions and use PF push to notify the frontend
score: 0
comment on: http://stackoverflow.com/q/27607199
type: QuestionComment

http://stackoverflow.com/comment/43609135
type: AnswerComment
score: 0
has text: thanks! that's good to know. Do you know why it keeps using the old version though? when my dependency tree says joda-time v2.2 is installed?
type: Comment
comment on: http://stackoverflow.com/a/27591274

http://stackoverflow.com/comment/43492020
type: QuestionComment
score: 1
has text: Did you check http://stackoverflow.com/questions/363681/generating-random-integers-in-a-range-with-java ?
type: Comment
comment on: http://stackoverflow.com/q/27531759

http://stackoverflow.com/a/27574783
downvote count: 0
has comment: http://stackoverflow.com/comment/43578480
answers question: http://stackoverflow.com/q/27574684
type: Answer
has comment: http://stackoverflow.com/comment/43667402
has comment: http://stackoverflow.com/comment/43575377
has body: The problem is that somebody in another thread changes the updates set while it is being copied in new HashSet&lt;Updated&gt;(updates). You cannot do this without synchronization. Or use ConcurrentHashMap instead of HashSet
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27574684
has comment: http://stackoverflow.com/comment/43575129
has comment: http://stackoverflow.com/comment/43667300
type: AcceptedAnswer

jaxb
tags question: http://stackoverflow.com/q/27605000
tags question: http://stackoverflow.com/q/27537064
tags question: http://stackoverflow.com/q/27508730
tags question: http://stackoverflow.com/q/27562194
tags question: http://stackoverflow.com/q/27531356
tags question: http://stackoverflow.com/q/27506299
tags question: http://stackoverflow.com/q/27564623
tags question: http://stackoverflow.com/q/27504774
tags question: http://stackoverflow.com/q/27528148
tags question: http://stackoverflow.com/q/27506381
tags question: http://stackoverflow.com/q/27543072
tags question: http://stackoverflow.com/q/27613952
tags question: http://stackoverflow.com/q/27629575
tags question: http://stackoverflow.com/q/27549171
tags question: http://stackoverflow.com/q/27529494
tags question: http://stackoverflow.com/q/27563936
tags question: http://stackoverflow.com/q/27583938
type: Tag
tags question: http://stackoverflow.com/q/27530299
tag name: jaxb
tags question: http://stackoverflow.com/q/27560402
tags question: http://stackoverflow.com/q/27508037
tags question: http://stackoverflow.com/q/27582095
tags question: http://stackoverflow.com/q/27550821
tags question: http://stackoverflow.com/q/27621403
tags question: http://stackoverflow.com/q/27563207
tags question: http://stackoverflow.com/q/27478029
tags question: http://stackoverflow.com/q/27528698
tags question: http://stackoverflow.com/q/27549348

http://stackoverflow.com/comment/59043180
type: AnswerComment
type: Comment
has text: Thaks for your reply. I finally used spring mvc in order to not get stuck into this point. Probably within a couple of weeks I will have to use this solution again. If so, I will test this and will let you know the outcome.
comment on: http://stackoverflow.com/a/35679700
score: 0

http://stackoverflow.com/q/27603571
possible better answer: http://stackoverflow.com/a/27603671
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43631605
has body: Recently I've got a problem with simple Spring MVC Application, particularly with controller. Here is my controller code snippet: @Controller public class MyController { @RequestMapping(value="/", method=RequestMethod.GET) public String m1(Model model){ return "form"; } } Here is my web.xml dispatcherServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/config/config.xml dispatcherServlet / And here is bean configuration file: <context:component-scan base-package="ua.macko.controller"/> <mvc:annotation-driven/> <mvc:resources location="/resources/" mapping="/resources/**"/> <property name="prefix" value="/WEB-INF/jsps/"/> <property name="suffix" value=".jsp"/> In the jsps folder I've got two jsp files: hello.jsp and form.jsp. When I'm trying to achieve root page of application, such as http://localhost:8080/WebTest/ I'm ALWAYS getting hello.jsp REGARDLESS of what value I return in m1 method...whether it is "hello", "nothello", "iamnotapage" etc. I am using Eclipse and Spring 3.2.8.
has comment: http://stackoverflow.com/comment/43629511
has comment: http://stackoverflow.com/comment/43630273
has comment: http://stackoverflow.com/comment/43630337
has comment: http://stackoverflow.com/comment/43631572
tagged with: spring
has title: Spring Controller Issue
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43629636
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27603671
has comment: http://stackoverflow.com/comment/43658756
has comment: http://stackoverflow.com/comment/43631686
has answer: http://stackoverflow.com/a/27604389
has comment: http://stackoverflow.com/comment/43637106
accepted answer: http://stackoverflow.com/a/27604389

http://stackoverflow.com/q/27638198
type: Question
has comment: http://stackoverflow.com/comment/43697023
downvote count: 0
tagged with: nio
has comment: http://stackoverflow.com/comment/43695352
linked to: http://stackoverflow.com/q/6918022
duplicate of: http://stackoverflow.com/q/6918022
has comment: http://stackoverflow.com/comment/43696860
has title: Java. Reading exe/dll attributes
favorite count: 0
has body: I'm trying to read attributes of an .exe file (specifically - product name and product version) in java but have a slight problem with that. From what i read it should be doable with Java.NIO but this code (suggested in all examples and in different questions here) UserDefinedFileAttributeView userView = Files.getFileAttributeView(file, UserDefinedFileAttributeView.class); List&lt;String&gt; attribList = userView.list(); returns empty list which means it can't find any attributes (as i understand it). I also tried to use Apache Tika's ExecutableParser to read metadata of a file but it didn't have those attributes either. Can somebody please explain how to do such thing, in details?
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1
tagged with: java
tagged with: file-attributes

http://stackoverflow.com/q/27631587
upvote count: 15
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27631863
tagged with: android
favorite count: 0
has body: I created an App that uses Fragment. From my MainActivity I set the ActionBar. But in one of my Fragment I need to modify the action icons and on click. So With the code below, when I load the my Fragment, it still display the action bar menu from MainActivity here is my MainActivity : public void restoreActionBar() { actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(mTitle); // enable ActionBar app icon to behave as action to toggle nav drawer actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { if (!mNavigationDrawerFragment.isDrawerOpen()) { // Only show items in the action bar relevant to this screen // if the drawer is not showing. Otherwise, let the drawer // decide what to show in the action bar. getMenuInflater().inflate(R.menu.main, menu); //Handle the Search Menu SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); searchView.setQueryHint(this.getString(R.string.action_search)); ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)) .setHintTextColor(getResources().getColor(R.color.white)); searchView.setOnQueryTextListener(OnQuerySearchView); mSearchCheck = false; restoreActionBar(); return true; } return super.onCreateOptionsMenu(menu); }//end onCreateOptionsMenu @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { /** CAMERA **/ case R.id.action_camera: //openCamera(); Utils.makeToast(getApplicationContext(), "Implement Camera", false); return true; /** SEARCH **/ case R.id.action_search: //openSearch(); mSearchCheck = true; Utils.makeToast(getApplicationContext(), "Implement Search", false); return true; /** SETTINGS **/ case R.id.action_settings: //openSettings(); Utils.makeToast(getApplicationContext(), "Implement Settings", fal…
score: 15
tagged with: android-actionbar
type: Question
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
tagged with: java
has title: Android How to edit the Action bar menu from Fragment
has comment: http://stackoverflow.com/comment/43683692
has answer: http://stackoverflow.com/a/27631863

http://stackoverflow.com/a/58852525
answers question: http://stackoverflow.com/q/27617158
has body: Steps to install Apache tomcat new version on raspberry pi: 1)sudo apt-get update 2)sudo apt-get install default-jdk 3)sudo wget http://mirrors.estointernet.in/apache/tomcat/tomcat-8/v8.5.47/bin/apache-tomcat-8.5.47.zip 4)sudo apt-get install unzip 5)sudo unzip apache-tomcat-8.5.47.zip 6)cd apache-tomcat-8.5.47/bin/ 7)sudo chmod 700 *.sh 8)sudo ./startup.sh In case you are getting a 404 error or if you want to install apache tomcat on port 80 then please visit the below link to know how to do that. http://www.bytesofgigabytes.com/raspberrypi/install-apache-tomcat-on-raspberry-pi/
type: Answer
upvote count: 0
score: -1
downvote count: 1

http://stackoverflow.com/a/27530412
has body: if(!(obj instanceof Pizza)) throw new IllegalArgumentException ("Parameter must be a Pizza"); Pizza temp = (Pizza) obj; return Double.valueOf(this.cost).compareTo(Double.valueOf(temp.cost)); cost is primitive double. CompareTo is a method in object. So you can use Double object instead of double or You simple use arithmetic operation.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43524851
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27530332
answers question: http://stackoverflow.com/q/27530332

http://stackoverflow.com/a/27567729
answers question: http://stackoverflow.com/q/27567697
score: 0
type: Answer
has body: Call the methods from main by moving the following in main: SayMyName(name1); SayMyName(name2); SayMyName(name3); So that your program looks like this: public class Ex2_SayMyName { public static void main(String[] args) { String name1 = "Billy"; String name2 = "Jake"; String name3 = "Michael"; SayMyName(name1); SayMyName(name2); SayMyName(name3); } //note the static in the below line public static void SayMyName(String name){ System.out.println("Hello " + name + ", it's good to meet you!"); } } If you want to call your methods directly without making an instance of the class,then you need the static keyword in the declaration of the method. This is what I have done in the above program.

http://stackoverflow.com/a/27476082
has body: In your for cycle the condition is wrong. You have 2 &lt; 10 instead of a &lt; 10
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/27476067

code-templates
tags question: http://stackoverflow.com/q/27561842
tag name: code-templates
type: Tag

http://stackoverflow.com/comment/43572485
comment on: http://stackoverflow.com/q/27572410
score: 0
type: Comment
type: QuestionComment
has text: @luis.espinal You are assuming that one character = one byte. In UTF-16, it's 16 bits per character (2 bytes).

http://stackoverflow.com/a/27496505
has comment: http://stackoverflow.com/comment/43424939
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27496448
type: Answer
has body: Try this. Runtime.getRuntime().exec("MyBat.bat"); No need to give cmd to execute bat file in windows. Because bat file is executable in windows.
answers question: http://stackoverflow.com/q/27496448
score: 0

http://stackoverflow.com/q/27622045
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/27679739
has answer: http://stackoverflow.com/a/27679739
score: 12
type: Question
upvote count: 12
accepted answer: http://stackoverflow.com/a/27964437
downvote count: 0
has title: Parameter value did not match expected type
favorite count: 0
linked to: http://stackoverflow.com/q/766299
has answer: http://stackoverflow.com/a/78264570
linked to: http://stackoverflow.com/q/2160700
answer count: 4
linked to: http://stackoverflow.com/q/16140282
tagged with: classloader
has answer: http://stackoverflow.com/a/63690537
tagged with: glassfish-4
has comment: http://stackoverflow.com/comment/43665440
has answer: http://stackoverflow.com/a/27964437
has comment: http://stackoverflow.com/comment/43665363
has body: I have an enum with a list of states (e.g.) enum State { UP, DOWN, RETRY }; The column in my database is of type enum. When I try to execute a Hibernate query by setting the parameter in the query using setParameter("keyword", State.RETRY);, I receive the error of Parameter value [RETRY] did not match expected type [package.name.State (n/a)] In my Glassfish 4.1 server.log for my domain. I am using Hibernate 4.3.6. In looking at the source code for Hibernate, I see the error occurs because of lines 958-960 in org.hibernate.jpa.spi.BaseQueryImpl: private static boolean isValidBindValue(Class expectedType, Object value, TemporalType temporalType) { if ( expectedType.isInstance( value ) ) { return true; } ... return false; } isValidBindValue returns false and thus I get the message. It prints out the String equivalent of the enum value because of this line: String.format("Parameter value [%s] did not match expected type [%s (%s)]", bind, parameterType.getName(), extractName( temporalType ) ) The bind object is implicitly converted to the String value by calling the toString method on the Object which represents the enum State.RETRY. So how I can I convince Hibernate that State.RETRY is an instance of State? It looks like Hibernate updated to the JPA 2.1 spec which is more strict in this commit from April 2013: https://github.com/hibernate/hibernate-orm/commit/84520cd6e36e9207c41528cf9311cae905a86425 The entity is annotated as follows: @Basic(optional = false) @Column(name = "state") @Enumerated(EnumType.String) private State state; Edit: My RetryState enum is loaded by the EarLibClassLoader. Whereas Query is loaded by the URLClassLoader and the EntityManager is loaded by a different class loader.

http://stackoverflow.com/comment/43526040
type: AnswerComment
comment on: http://stackoverflow.com/a/27546036
type: Comment
has text: @VassilisDe you can try and PM me but I can't guarantee to read the messages quite quickly. If there are specific problems you're facing and can't find anything on the net you could also ask here at SO or, especially if you just want to check whether you're doing it correctly, at http://codereview.stackexchange.com/
score: 0

http://stackoverflow.com/comment/43522054
has text: You will have problems if `filePath`is an existing directory : your program will try to create a new file with the same name!
score: 0
comment on: http://stackoverflow.com/q/27547658
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43650383
has text: But the thing is android project build target is android 4.4.2
score: 0
comment on: http://stackoverflow.com/q/27614131
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27525086
type: Answer
has body: In addition to the things pointed out by Eran there is also an unmatched curly brace in stockItems. The for loop is missing a final brace. public stockItem(String Catagory, double price, boolean delivery){ for (int i =0; i &lt; catagoryArray.length; i++){ if (Catagory.equalsIgnoreCase(catagoryArray[i])){ this.Catagory = catagoryArray[i]; } else { System.out.println("This is not a valid catagory!"); } } // This one. // Variables overwrite old variables from default stockItem // ... code ... }
answers question: http://stackoverflow.com/q/27524894
score: 0

buttonclick
type: Tag
tag name: buttonclick
tags question: http://stackoverflow.com/q/27560022

http://stackoverflow.com/comment/43652943
comment on: http://stackoverflow.com/a/27611346
score: 0
type: AnswerComment
type: Comment
has text: oh it does, i just linked too deeply sry. https://github.com/RichardHightower/json-parsers-benchmark

sqoop
tags question: http://stackoverflow.com/q/27572527
type: Tag
tag name: sqoop

http://stackoverflow.com/comment/43416903
comment on: http://stackoverflow.com/a/27492571
has text: whatever view you are trying to set the background on. textview in your case. ill update my answer
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27498702
has title: How to solve java.net.SocketException: Software caused connection abort: socket write error exception
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has body: I have this error SEVERE: SEVERE: Servlet.service() for servlet [jsp] in context with path [/firstjsp] threw exception [ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error] with root cause when I run my application sometimes . The error messages are java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:216) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:460) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:368) at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:241) at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:119) at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:192) at org.apache.coyote.Response.doWrite(Response.java:533) at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:373) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:373) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:403) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:391) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:84) at ChartDirector.GetSessionImage.a(SourceFile:90) at ChartDirector.WebChartViewer.streamChart(SourceFile:301) at org.apache.jsp.AutomaticAlarm_jsp._jspService(AutomaticAlarm_jsp.java:157) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.jasper.servlet.JspServletWrapper.service(JspServlet…
has comment: http://stackoverflow.com/comment/43430010
has comment: http://stackoverflow.com/comment/43430126
answer count: 0
score: 1
tagged with: tcp
tagged with: java
tagged with: socketexception
upvote count: 1
type: Question
tagged with: network-programming
linked to: http://stackoverflow.com/q/2126607
downvote count: 0

http://stackoverflow.com/q/27501994
answer count: 4
tagged with: collections
has answer: http://stackoverflow.com/a/27502057
accepted answer: http://stackoverflow.com/a/27502057
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27502055
tagged with: java
has title: Strange Java ArrayList behavior
has answer: http://stackoverflow.com/a/27502054
type: Question
has body: I am working on my beginners project for learning java. The project is to a add, list and delete person. like type 1 to add a person type 2 to list all person type 3 to delete a person. I am using ArrayList collections to work on this project. The first question is is using the collections is a good aproach? if yes i am declaring the ArrayList globally but while iterating it I can see it's not storing any data. my code is as follows. import java.util.*; public class OperationClass implements OperationInterface { String id; String fname; String lname; ArrayList&lt;String&gt; Person=new ArrayList&lt;String&gt;(); public static void main(String args[]) { new OperationClass().operation(); } public static void operation() { int a; Scanner in = new Scanner(System.in); System.out.println("Enter 1 for Adding new Record"); System.out.println("Enter 2 to see List of Records"); System.out.println("Enter 3 to Delete a record"); System.out.println("Enter 4 to Exit!!"); a = in.nextInt(); if (a == 1) { new OperationClass().addPerson(); } if (a == 2) { new OperationClass().listPerson(); } if (a == 3) { new OperationClass().deletePerson(); } if (a == 4) { System.out.println("Thanks for using the program"); } } /** * adds a new Person and stores in the collection */ @Override public void addPerson() { Scanner in = new Scanner(System.in); new OperationClass().operation(); System.out.println("Enter a the id"); id = in.next(); System.out.println("Enter a the First Name"); fname = in.next(); System.out.println("Enter a the Last Name"); lname = in.next(); Person.add(id); Person.add(fname); Person.add(lname); new OperationClass().operation(); } @Override public void listPerson() { Iterator itr=Person.iterator(); while(itr.hasNext()){ System.out.println(itr.next()); } new OperationClass().operation(); } @Override public void deletePerson() { System.out.println("Delete under construction"); } @Override public void quit() { } } first output is Enter 1 for Adding new Record. Enter 2 to see Lis…
has answer: http://stackoverflow.com/a/27502130
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/27502055

http://stackoverflow.com/q/27630306
possible better answer: http://stackoverflow.com/a/27630530
has answer: http://stackoverflow.com/a/27630325
answer count: 2
has title: How do I start a Thread but keep it alive for a certain time?
has body: I don't really want to start a thread then put it to sleep, such as: Thread.start(); Thread.sleep(3000); //*Example* Instead, I want to this something like this (And I apologize for this amateur illustration): Thread.start(3000) //*thread will be given a certain amount of time to execute* //*After 3000 milliseconds, the thread stops and or sleeps* I'm doing this because I'm making a program/ mini-game that times user input for a certain time. Basically, the user has 5 seconds to input a certain character/number/letter and after that time, the input stream is cut off. Kind of like: Scanner kb = new Scanner(System.in); int num = kb.nextInt(); kb.close() //*Closes kb and input stream in turn*
has answer: http://stackoverflow.com/a/27630530
has comment: http://stackoverflow.com/comment/43681166
accepted answer: http://stackoverflow.com/a/27630325
favorite count: 0
tagged with: java.util.scanner
upvote count: 2
tagged with: multithreading
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43681330
downvote count: 1
type: Question

http://stackoverflow.com/comment/43530172
comment on: http://stackoverflow.com/q/27551904
type: Comment
type: QuestionComment
score: 1
has text: Which compiler do you mean (javac or the JIT)? And are `foo1` and `foo2` "constant," even if they're not formally constants by the JLS? Can you elaborate a bit more on what goes into them? And why wouldn't you just expect it to optimize all the way to just `if (false)`, and then remove the dead code? If you're worried about performance, note that even if the optimizer doesn't handle it, this could be very easy for a branch predictor.

http://stackoverflow.com/a/27485553
type: Answer
has comment: http://stackoverflow.com/comment/43403162
downvote count: 1
has comment: http://stackoverflow.com/comment/43402970
score: 3
upvote count: 4
has body: You can use a Set, which doesn't allow duplicates. Add all the elements of the array to the Set. Compare the size of the Set with the size of the array. if they are equal, then there are no duplicates otherwise, there are duplicates. For example: int[] array = ... Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); for (int i : array) { set.add(i); } if (set.size() == array.length) { System.out.println("There are no duplicates"); } else { System.out.println("There are duplicates"); }
answers question: http://stackoverflow.com/q/27485489

http://stackoverflow.com/a/27580936
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27580590
has body: You need to use two different length measurements because there are two different lengths. You're array is effectively a 2x4 grid of numbers: 56 78 967 7878 4774 5757 78 98 If you're talking about rows, you only have two of them (indexes 0 and 1). To loop over all of them, you should use the length of your array. This is how your outer loop works. To access each inner element, you need to loop over your row lengths. To find out how big a row is, you need to take the length of an inner array. This is what you're inner loop does.

http://stackoverflow.com/comment/43576314
has text: If you are going to downvote me, please say why. that's just courtesy
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27575353

http://stackoverflow.com/q/27586552
has answer: http://stackoverflow.com/a/27586732
has comment: http://stackoverflow.com/comment/43597711
accepted answer: http://stackoverflow.com/a/27586732
upvote count: 0
has title: how do I reference a list array I created in a different class into a another
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43597569
has comment: http://stackoverflow.com/comment/43597596
has comment: http://stackoverflow.com/comment/43597658
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/43597529
has body: I am new to Java, and this is project I need to deliver today. :( I am not sure how to reference the array objects I created in another class. It works if i do a normal array, but not with arraylist. When I do this: for(Integer k=0; k &lt; run.accounts.length; k++) { if((run.accounts[k][0].compareTo(id) == 0) &amp;&amp; (run.accounts[k[1].compareTo(p)== 0)) It just doesn't know anything about my accounts array. public class Users { public List&lt;List&lt;String&gt;&gt; accounts = new ArrayList&lt;List&lt;String&gt;&gt;(); public Users(){ accounts.add(Arrays.asList("207860830", "0171", "active","admin")); // [ ... ] accounts.add(Arrays.asList("110000200", "1270", "active","regular")); } public void DatosUsers() { } } // end class Users // IN A DIFFERENT CLASS public class LOGINING { public void login() { Users run = new Users(); run.DatosUsers(); for (Integer k = 0; k &lt; run.accounts.length; k++) { if ((run.accounts[k][0].compareTo(id) == 0) &amp;&amp; (run.accounts[k][1].compareTo(p) == 0)) { auth = true; System.out.println(auth); break; } { auth = false; System.out.println(auth); } } [ ... ]
type: Question
answer count: 2
downvote count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/27586691
possible better answer: http://stackoverflow.com/a/27586691

http://stackoverflow.com/a/27522353
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27522306
has body: Because IEEE-754 double-precision floating point numbers are not perfectly precise.

http://stackoverflow.com/a/27530433
answers question: http://stackoverflow.com/q/27527819
downvote count: 0
score: 3
upvote count: 3
type: Answer
has body: By Gradle: error: you mean compilation error? You should probably put parentheses between query and .subscribe(urls -&gt; { as this is not a variable or class filed but method instead, so you should call it to get Observable to subscribe to. Well, also you need to implement query method to return Observable, for example like this: private Observable&lt;String&gt; query() { return Observable.just("one", "two", "three"); } You'll get another build error because of Java 8 but as already mentioned in comments you can easily use retrolamda with gradle to fix the problem. Otherwise you can use Android Studio quick fixes to convert java 8 lambdas into java 6 anonymous classes.

http://stackoverflow.com/comment/43412828
comment on: http://stackoverflow.com/q/27490533
score: 0
type: QuestionComment
type: Comment
has text: you can write factory to get connections.

http://stackoverflow.com/q/27495018
has comment: http://stackoverflow.com/comment/43422111
has body: I'm currently working on my bubble and selection sorts and ran into a couple problems. I've received help from a couple of fellow friends and now on my own, I'm stuck. I already have the bubble sort, so I brought the following code into my selection code. But had a different algorithm for the selection part. import java.util.Arrays; import java.io.*; public class SelectionSort { int a[]; int n; public static void main(String[] args) { int array[] = { 5,3,9,7,1,8 }; System.out.println(""+Arrays.toString(Sort(array))); } public static int[] Sort(int[] arr) { int t, min; for(int i=0;i&lt;n-1;i++) { min = i; for(int j=i+1;j&lt;n;j++) { if(a[min]&gt;a[j]) min = j; } if(min!=i) { t = a[min]; a[min] = a[i]; a[i] = t; } System.out.println(""+Arrays.toString(arr)); } return arr; } } The bubble code works perfectly, I also have to output every change that happens throughout the code. [3, 5, 7, 1, 8, 9] [3, 5, 1, 7, 8, 9] [3, 1, 5, 7, 8, 9] [1, 3, 5, 7, 8, 9] [1, 3, 5, 7, 8, 9] [1, 3, 5, 7, 8, 9] Thanks in advance for anyone who assists me!
tagged with: bubble-sort
favorite count: 0
has title: Bubble and Selection Sort
tagged with: selection-sort
has comment: http://stackoverflow.com/comment/43423725
has comment: http://stackoverflow.com/comment/118509063
upvote count: 0
type: UnansweredQuestion
score: -4
downvote count: 4
has comment: http://stackoverflow.com/comment/43423181
has answer: http://stackoverflow.com/a/67045552
has answer: http://stackoverflow.com/a/27497945
has comment: http://stackoverflow.com/comment/43421775
tagged with: java
has comment: http://stackoverflow.com/comment/43423611
type: Question
answer count: 2

http://stackoverflow.com/comment/43649614
has text: try without the `getClass().getResource("/_0cast.png").getPath()` thing, i.e with an absolute path like: "/home/my/_0cast.png". also, imread() can't read from a jar.
score: 0
comment on: http://stackoverflow.com/q/27613353
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33604885
downvote count: 0
has body: Using the same aggregation names used in the previous answer, I would do the following: public void yourSearch(String indexName, String typeName) { SearchResponse sr = client.prepareSearch(indexName) .setTypes(typeName) .addAggregation(AggregationBuilders.dateHistogram("date_hist_agg") .field("timestamp") .interval(DateHistogram.Interval.hours((1))) .minDocCount(0) .subAggregation(AggregationBuilders.terms("status_agg").field("status"))) .execute().actionGet(); DateHistogram componentsAgg = sr.getAggregations().get("date_hist_agg"); for (DateHistogram.Bucket entry : componentsAgg.getBuckets()) { Terms statusAgg = entry.getAggregations().get("status_agg"); for (Terms.Bucket entry2 : statusAgg.getBuckets()) { String key = entry2.getKey(); long cnt = entry2.getDocCount(); // use the key,cnt } } } }
type: Answer
answers question: http://stackoverflow.com/q/27623665
score: 1
upvote count: 1

http://stackoverflow.com/a/27528450
score: 0
has body: You could print the debug information using ANSI control characters. You probably need to install a plugin to Eclipse in order this to work. You can try this for example.
type: Answer
answers question: http://stackoverflow.com/q/27528290

http://stackoverflow.com/a/27614972
has comment: http://stackoverflow.com/comment/43651862
has comment: http://stackoverflow.com/comment/43651969
answers question: http://stackoverflow.com/q/27614900
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: I also faced same error. On my case it happened because there were mismatched with the JDK versions with my end and the 3rd party URL which I was hitting to get JSON data.

http://stackoverflow.com/a/27530397
downvote count: 0
upvote count: 11
accepted answer of: http://stackoverflow.com/q/27528278
answers question: http://stackoverflow.com/q/27528278
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43489972
type: Answer
score: 11
has body: Like Greg says, everything after -vmargs are VM args which are supplied to the JVM when an application starts. -Xmx is the maximum heap size, -Xms is the initial heap size, and the launcher.XXMaxPermSize is presumably an argument to the eclipse executable. This increases the size of the permagen space. I suspect this argument only really works pre java 8, as permagen was eliminated in 8.

http://stackoverflow.com/comment/43662472
comment on: http://stackoverflow.com/a/27620950
has text: @KedarKholiya - Check *Eran's* answer. The line `chars[numbers.length + 4] = 'y';` is *suicidal*.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43637768
type: Comment
has text: [It's still not that simple.](http://ideone.com/F2tKST) (with sun-jdk-7)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27606449

http://stackoverflow.com/q/27610675
has comment: http://stackoverflow.com/comment/43644318
has comment: http://stackoverflow.com/comment/43643701
favorite count: 0
has comment: http://stackoverflow.com/comment/43643881
score: -4
has comment: http://stackoverflow.com/comment/43644428
has answer: http://stackoverflow.com/a/27610842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43644418
has comment: http://stackoverflow.com/comment/43643700
tagged with: java
has comment: http://stackoverflow.com/comment/43643933
type: Question
has title: Beginner's Java - Help Needed Using Eclipse
downvote count: 4
has comment: http://stackoverflow.com/comment/43643867
upvote count: 0
answer count: 1
has body: I have been busting my brain for days trying to complete this Java project and for the life of me I cannot get it to run. Here is what I am supposed to do: Write a program that calls each of the methods of the Math class from the list below and provides output showing the method called, values sent to the method, and the returned results. Each listed method will tell you which values to use. For example: Listed method: double pow(double a, double b): use 2.0 and 3.0. Your program would display: Math.pow(2.0, 3.0) = 8.0. When calling a method that accepts doubles, use numbers with at least one decimal digit like the example above, even if it's a zero. Remember that numbers with decimals are double literals. Try to use values that will produce easily verifiable results. Here is the list: double pow(double a, double b): Use 3.0 and 2.0 double sqrt(double x): Use 25.0 int max(int a, int b): Use 6 and 2 double max(double a, double b): Use -50.0 and 7.0 static double random() Sample output: Math.pow(3.0, 2.0) = 9.0 Math.sqrt(25.0)=5.0 Math.max(6,2)=6 Math.max(-50.0,7.0)=7.0 Math.random()= -random value- Test your program with the values shown in the examples, fix any errors. Add a method to your program called randomStudy that has no parameters and returns no value. In this method, do the following: a. Declare three int variables: total, min, and max. Set total to 0, min to 11, andmax to -1. b. Create a loop that will run 1,000 times. In the body of the loop, generate a random int value between 1 and 10, inclusive. Add this number to your total. If this number is less than min, update min with the new number. If it is greater than max, update max with the new number. c. After the loop, display the following: Min value: x Max value: y Average: z Replace x and y with your min and max values. Calculate z by dividing your total by 1000d. Call your new randomStudy method from the main method. Highlight and copy the output shown in Eclipse. Paste the output at the bottom of you…
accepted answer: http://stackoverflow.com/a/27610842
has comment: http://stackoverflow.com/comment/43644097
has comment: http://stackoverflow.com/comment/43643698

http://stackoverflow.com/comment/43698336
score: 0
comment on: http://stackoverflow.com/q/27639620
has text: You are passing the title string only in the sharedpreferences , is that what you are trying to do? You can pass the complete list to sharedpreferences and then get the complete list back. Also you are adding in the list at 0 position only.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27590419
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27590436
score: 0
has answer: http://stackoverflow.com/a/27590436
answer count: 1
has body: I have a military like game and there is a bar at the top that tells the time.(example) when it is 4:06 in the morning it says 4:6 is there a way I can change that to say 04:06 but also say (example) 11:45 and not 011:045. Here is the time class: public class Hud { public int x, y; public int money = 1000; public int reputation = 5; public int wifi = 3; public int time = 0; public int timer = 10; public int minute = 50; public int hour = 10; public Hud(int x, int y) { this.x = x; this.y = y; } public void tick() { if (time &gt;= timer) { time = 0; minute++; } else if (time &lt;= timer) { time++; } if (minute &gt;= 60) { minute = 0; hour++; } if (hour &gt;= 24) { hour = 0; } } public void render(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); g2.setRenderingHints(rh); g.setColor(Color.LIGHT_GRAY); g.fillRect(x, y, Comp.size.width + 9, 20); g.setColor(Color.DARK_GRAY); g.drawRect(x, y, Comp.size.width + 9, 20); // money g.setColor(Color.yellow); g.setFont(new Font("italic", Font.BOLD, 15)); g.drawString("€ " + money, 10, 17); // reputation g.setColor(Color.black); g.setFont(new Font("italic", Font.BOLD, 15)); g.drawString("Rep: " + reputation, 100, 16); // time g.setColor(Color.black); g.setFont(new Font("italic", Font.BOLD, 15)); g.drawString("" + hour + ":" + minute, Comp.size.width / 2 - 20, 16); } }
favorite count: 0
has title: Java Formating a string to have a decimal place
upvote count: 1
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/43444363
score: 0
type: Comment
type: QuestionComment
has text: @CommonsWare all right, I've included the one with ImageView.
comment on: http://stackoverflow.com/q/27500682

http://stackoverflow.com/a/27522527
upvote count: 2
answers question: http://stackoverflow.com/q/27522339
type: Answer
has body: Well,the thing that is overlooked here is how you are reading in the XML file.you are using the method fromXML which is expecting the actual XML input and not the file name. So when it parses your xml (which is "Xmloutput.xml" not the actual xml) I suggest you to use a FileReader/BufferedReader in order to get the contents of the XML back. Something like this should work: XStream instream = new XStream(); BufferedReader br = new BufferedReader(new FileReader("Xmloutput.xml")); StringBuffer buff = new StringBuffer(); String line; while((line = br.readLine()) != null){ buff.append(line); } EurexMessageObject eurexflowMsg = (EurexMessageObject)instream.fromXML(buff.toString()); I hope it will help you, best regards.
score: 2
downvote count: 0

http://stackoverflow.com/comment/43655639
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27615889
has text: Is that working now?

http://stackoverflow.com/comment/43625777
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27601537
type: Comment
has text: create an empty or abstract method `public int convolusion()` in `Base` class and override in `Derived` class.

http://stackoverflow.com/comment/43665811
comment on: http://stackoverflow.com/a/27619014
type: Comment
has text: "Wed Dec 31 00:00:00 IST 2014". this is the value of date object, it is not string. I am not able to cast date to string.
score: 0
type: AnswerComment

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/27576985
type: Tag

http://stackoverflow.com/comment/43626720
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27600800
type: Comment
has text: calling `join()` doesn't end a thread, it allows the caller to wait till the thread being joined "ends"

http://stackoverflow.com/q/27587070
linked to: http://stackoverflow.com/q/8153744
has comment: http://stackoverflow.com/comment/43598540
has comment: http://stackoverflow.com/comment/43598430
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43598574
has answer: http://stackoverflow.com/a/27587166
has body: I am building an application that can calculate the screen on time of a day. This is my implementation i can't figure out what could be the part in do-while loop PowerManager powerManager=(PowerManager) getSystemService(POWER_SERVICE); boolean isScreenOn= powerManager.isScreenOn(); do{ }while(isScreenOn);
type: UnansweredQuestion
has title: how to Calculate the screen on time of android device
tagged with: android
tagged with: java
type: Question
tagged with: do-while

http://stackoverflow.com/q/27532351
has comment: http://stackoverflow.com/comment/43540639
tagged with: awt
upvote count: 3
has body: I'm trying to open an image when the user clicks a certain button in my JMenu. I have to configure the m5 and m6 from this code: import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; public class Menu extends JMenuBar implements ActionListener { Interface map; JMenu m1; JMenu m2; JMenu m3; JMenu m4; JMenu m5; JMenu m6; JMenuItem m12; JMenuItem m121; JMenuItem m122; JMenuItem m123; JMenuItem m222; JMenuItem m331; JMenuItem m332; JMenuItem m441; JMenuItem m442; JMenuItem m551; JMenuItem m661; public Menu(Interface map) { super(); this.map = map; m1 = new JMenu("Nouvelle grille"); m2 = new JMenu("Solutionner"); m3 = new JMenu("Générer une grille"); m4 = new JMenu("Fonctions supplémentaires"); m5 = new JMenu("Edition"); m6 = new JMenu("Aide"); m121 = new JMenuItem("Niveau fort"); m122 = new JMenuItem("Niveau moyen"); m123 = new JMenuItem("Niveau faible"); m12 = new JMenuItem("Sélectionner dans une liste"); m121.addActionListener(this); m122.addActionListener(this); m123.addActionListener(this); m12.addActionListener(this); m222 = new JMenuItem("Vider la Grille"); m222.addActionListener(this); m1.add(m222); m331 = new JMenuItem("Afficher la solution"); m331.addActionListener(this); m2.add(m331); m332 = new JMenuItem("Cacher la solution"); m332.addActionListener(this); m2.add(m332); m332.setEnabled(false); m441 = new JMenuItem("Copier grille dans le presse-papier"); m441.addActionListener(this); m4.add(m441); m442 = new JMenuItem("Imprimer Grille+Solution"); m442.addActionListener(this); m4.add(m442); m551 = new JMenuItem("Annuler déplacement"); m551.addActionListener(this); m5.add(…
has comment: http://stackoverflow.com/comment/43499124
has comment: http://stackoverflow.com/comment/43497652
favorite count: 0
linked to: http://stackoverflow.com/q/1242581
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48632389
tagged with: swing
tagged with: jmenu
has comment: http://stackoverflow.com/comment/43498533
score: 3
answer count: 0
downvote count: 0
tagged with: java
has title: How to open an image from JMenu in Java?
type: Question
has comment: http://stackoverflow.com/comment/43501005
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/43498622

http://stackoverflow.com/comment/43656502
comment on: http://stackoverflow.com/q/27617713
score: 0
type: Comment
type: QuestionComment
has text: Have you debugged and checked the value of memberID? Maybe it's null.

http://stackoverflow.com/q/27522936
has comment: http://stackoverflow.com/comment/43474999
score: 2
type: AnsweredQuestion
upvote count: 2
linked to: http://stackoverflow.com/q/17359047
type: Question
accepted answer: http://stackoverflow.com/a/27523060
tagged with: stringbuilder
linked to: http://stackoverflow.com/q/14161050
tagged with: java
has body: do like the below code, to read each line and perform a concatenation based on an input list listValues. BufferedReader br = null; StringBuilder sb = new StringBuilder(""); InputStream in = new FileInputStream(new File(file)); br = new BufferedReader(new InputStreamReader(in), 102400); for (String input; (input= br.readLine()) != null;) { for (int i = 0; i &lt; listValues.size(); i++) { sb.append(input.substring(1, 5)); } map.put(sb.toString(), someOtherValue); sb.delete(0, sb.length()); } Using the same StringBuilder for each iteration by setting deleting the contents each time. Still throws Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.lang.String.substring(Unknown Source) What is the mistake I have done? Edit: I have corrected as per Bathsheba's suggestion. But now throws, Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Unknown Source) at java.lang.String.&lt;init&gt;(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at java.io.BufferedReader.readLine(Unknown Source) at for (String input; (input= br.readLine()) != null;) What's the problem now?
has comment: http://stackoverflow.com/comment/43476601
has comment: http://stackoverflow.com/comment/43474786
has title: Using single StringBuilder - throws OutofmemeoryException
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43474917
favorite count: 0
has comment: http://stackoverflow.com/comment/43475101
has comment: http://stackoverflow.com/comment/43474840
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/43474984
has answer: http://stackoverflow.com/a/27523060

http://stackoverflow.com/q/27591503
has comment: http://stackoverflow.com/comment/43606817
accepted answer: http://stackoverflow.com/a/27591716
has comment: http://stackoverflow.com/comment/43606879
has comment: http://stackoverflow.com/comment/43606799
tagged with: android
has comment: http://stackoverflow.com/comment/43606919
type: AnsweredQuestion
has title: Get attributes from SharedPreferences in android
tagged with: sharedpreferences
linked to: http://stackoverflow.com/q/5946135
type: Question
has answer: http://stackoverflow.com/a/27591696
has answer: http://stackoverflow.com/a/27591716
tagged with: java
has comment: http://stackoverflow.com/comment/43607446
possible better answer: http://stackoverflow.com/a/27591696
score: 0
answer count: 3
has body: This is my MainActivity.java where I instanciate static SharedPreferences and it's editor: public static SharedPreferences settings; public static SharedPreferences.Editor editor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); settings = PreferenceManager.getDefaultSharedPreferences(this); editor = settings.edit(); Then I make an AsyncTask call to another java class where I try to store a token in onPostExecute method to this SharedPreferences. @Override protected void onPostExecute(String result) { MainActivity.editor.putString("auth_token", result); MainActivity.editor.commit(); Log.d("token", MainActivity.settings.getString("auth_token", "Nothing")); } This Log.d() method outprints the token value in the console, which is "OK". But then I start an acitivity Next.java where I try to get this token on a screen using this: TextView text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_next); String auth_token_string = MainActivity.settings.getString("auth_token", "Nothing"); text = (TextView) findViewById(R.id.logintxt); text.setText(auth_token_string); And the result on the screen is the default String "Nothing". What am I doing wrong here? ...and is this the right way to use SharedPreferences? I got this idea here in this topic. EDIT: Code from AuthorizeActivity.java where I call the asyncTask: public void getToken(String code){ AsyncTask&lt;String, Void, String&gt; tsk = new Api().execute(code); Intent i = new Intent(this.getBaseContext(), Next.class); dialog.dismiss(); startActivity(i); }
has answer: http://stackoverflow.com/a/27591788

http://stackoverflow.com/a/27757878
has body: def check( x: Int, y: Int) (z: Int) When you use the syntax sugar above to create curried functions, you have to use the _ assign the partially applied function to a value. This way you are not invoking the function, but creating a function value instead. val z = curried(0,0) _ However, if you do not use the syntax sugar: def check( x: Int, y: Int) = (z:Int) =&gt; x+y+z Then you can call it the way you want it: check(1,2) //res2: Int =&gt; Int = &lt;function1&gt; z(3) // res3: Int = 6 check(1,2)(3) // res4: Int = 6 Note that you do not have to use _ to, for example, pass the result of the partially applied function as a parameter to another function. def filter(xs: List[Int], p: Int =&gt; Boolean): List[Int] = if (xs.isEmpty) xs else if (p(xs.head)) xs.head :: filter(xs.tail, p) else filter(xs.tail, p) def modN(n: Int)(x: Int) = ((x % n) == 0) filter(List(1,2,3,4,5), modN(2)) //res6: List[Int] = List(2, 4)
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27584966
type: Answer
score: 2

http://stackoverflow.com/q/27537867
answer count: 3
has answer: http://stackoverflow.com/a/27538072
has answer: http://stackoverflow.com/a/57232574
tagged with: arrays
has body: Given an image file, say of PNG format, how to I get an array of int [r,g,b,a] representing the pixel located at row i, column j? So far I am starting here: private static int[][][] getPixels(BufferedImage image) { final byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); final int width = image.getWidth(); final int height = image.getHeight(); int[][][] result = new int[height][width][4]; // SOLUTION GOES HERE.... } Thanks in advance!
has comment: http://stackoverflow.com/comment/43504054
has answer: http://stackoverflow.com/a/27538044
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/100968660
tagged with: rgba
score: 1
favorite count: 0
has title: Java: Get the RGBA from a Buffered Image as an Array of Integer
has comment: http://stackoverflow.com/comment/100968357
type: Question
upvote count: 2
tagged with: pixel
has comment: http://stackoverflow.com/comment/43504002
accepted answer: http://stackoverflow.com/a/27538044
tagged with: bufferedimage
downvote count: 1
possible better answer: http://stackoverflow.com/a/27538072
tagged with: java

http://stackoverflow.com/a/27490901
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27490747
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27490747
has body: You can use annotation processing to do that. Run javac with proc, processor and processorpath option and implement a Processor that does all the checking you want. Note that you can't enforce others to use these options, so you should still include appropriate runtime checking.

http://stackoverflow.com/q/27525833
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
tagged with: java
type: Question
has title: Spring 4: Rest WebServices: getting 406 for get request but not for Post request
has body: I have a web service /ws/forgetPassword. When I access it using get, I am getting VMware vFabric tc Runtime 2.9.3.RELEASE/7.0.42.A.RELEASE - Error report HTTP Status 404 - type Status report message description The requested resource is not available. VMware vFabric tc Runtime 2.9.3.RELEASE/7.0.42.A.RELEASE But when I converted it to Post, It worked fine and I get following response. { httpResponse: "200" httpMessage: "OK" resetPasswordUrl: "If your email is registered with us, an email will be sent to you with further instructions." } Post Method @RequestMapping(value = "/forgetPassword", method = RequestMethod.POST) public RestResponseWrapper forgotPassword(HttpServletRequest request, HttpServletResponse response) { RestResponseWrapper responseWrapper = new RestResponseWrapper(); try { String email = request.getParameter("email"); logger.debug("Email " + email); UserCes userCes = getService().getUserByEmail(email); if (userCes != null) { String validationCode = RandomStringUtils.randomAlphabetic(40); ForgotPassword forgotPassword = new ForgotPassword(); forgotPassword.setCreatedBy(CesUtility.getUsername()); forgotPassword.setCreatedOn(DateTimeUtility.getCurrentTime()); forgotPassword.setEmail(email); forgotPassword.setValidationCode(validationCode); getBaseCrudService().save(forgotPassword); response.setStatus(HttpStatus.OK.value()); responseWrapper.setHttpResponse(HttpStatus.OK + ""); responseWrapper.setHttpMessage(HttpStatus.OK.getReasonPhrase()); responseWrapper.setResetPasswordUrl(getApplicationContext().getMessage("authauth.forgetpassword", new Object[] { validationCode }, Locale.US)); }else{ response.setStatus(HttpStatus.NOT_FOUND.value()); responseWrapper.setHttpResponse(HttpStatus.NOT_FOUND + ""); responseWrapper.setHttpMessage(HttpStatus.NOT_FOUND.getReasonPhrase()); } } catch (Exception e) { responseWrapper.setHttpResponse(HttpStatus.INTERNAL_SERVER_ERROR + ""); responseWrapper.setHttpMessage(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()); response.…
score: 0
tagged with: rest
answer count: 1
has answer: http://stackoverflow.com/a/27525936

http://stackoverflow.com/comment/43667042
type: Comment
has text: I also tested it in a different directory, didn't work. When I use the code on my local windows laptop it does work though.
type: QuestionComment
comment on: http://stackoverflow.com/q/27608408
score: 0

http://stackoverflow.com/a/27524795
has comment: http://stackoverflow.com/comment/43482175
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43478675
has comment: http://stackoverflow.com/comment/43565131
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27511111
has comment: http://stackoverflow.com/comment/43525411
has body: This is because you're missing other transient dependencies that akka-persistence depends on. For example by default it depends on: org.fusesource.leveldbjni:leveldbjni-all:1.7 org.iq80.leveldb:leveldb:0.5 com.google.protobuf:protobuf-java:2.5.0 And all these have further dependencies. Instead of downloading/adding jars manually you should add akka-persistence to libraryDependencies in your build.sbt which will automatically pull in all it's requisite dependencies. libraryDependencies += "com.typesafe.akka" %% "akka-persistence-experimental" % "2.3.4"
accepted answer of: http://stackoverflow.com/q/27511111
has comment: http://stackoverflow.com/comment/43483232
has comment: http://stackoverflow.com/comment/43509956

http://stackoverflow.com/a/27515006
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43542632
accepted answer of: http://stackoverflow.com/q/27512404
answers question: http://stackoverflow.com/q/27512404
has body: You've said a couple conflicting things here, but let me see if I can sort this out for you: You cannot update entities safely with 0 database operations. The cache always represents stale data. The only safe way to update data is by performing a database read (and, if appropriate, a write) in a transaction. A read will cost you 1 operation. Transactions sort themselves out by rolling back and retrying conflicts. They have the effective behavior of being applied serially. If you perform idempotent updates in a transaction, you will never have the "writes stepping on each other" problem. This is a combination of datastore behavior (error on conflict) and Objectify behavior (retrying on conflict). You may wonder if you can check the cache to see if you can avoid starting a real transaction. Not if you care about losing updates. By the time you read and check a value, it may have already changed in the database. Your update is lost because it has a poorly-defined ordering. Transactions give you predictable (serial) order of updates. Of course there's another way of solving this problem, which is to somehow guarantee that your entity never sees contention. That's often a very hard problem, which is why we have transactions.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43460984
type: Answer

http://stackoverflow.com/comment/43696285
comment on: http://stackoverflow.com/a/27624571
score: 0
type: AnswerComment
has text: I think your guess is just.... you know... a guess. Other answers provide documentation and the exact 'why' of this behaviour.
type: Comment

http://stackoverflow.com/comment/43587613
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27581641
score: 3
has text: This doesn't compile. You declare a 2d array, but initialize it as a 1d array.

http://stackoverflow.com/q/27594024
answer count: 2
tagged with: this
downvote count: 0
has comment: http://stackoverflow.com/comment/43611625
favorite count: 0
has title: Can you override THIS keyword in JAVA
accepted answer: http://stackoverflow.com/a/27594081
has body: Dealing with a refactoring scenario, and wondering if there's a way to override "this" in java. Basically, I would like to return an instance of another class when this is called. Is this possible?
has comment: http://stackoverflow.com/comment/43618057
score: 2
tagged with: instance
has comment: http://stackoverflow.com/comment/43611776
has answer: http://stackoverflow.com/a/27594081
possible better answer: http://stackoverflow.com/a/27594085
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43612429
tagged with: overriding
has answer: http://stackoverflow.com/a/27594085
type: Question
upvote count: 2

http://stackoverflow.com/comment/43586957
has text: Java 101: array indexes run from `0` to `size()-1`. Your code assumes the first element is `1`, and the last one is `size()`, which is where you try to access an **index out of bounds**.
comment on: http://stackoverflow.com/q/27581220
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27487110
answers question: http://stackoverflow.com/q/27487042
type: Answer
accepted answer of: http://stackoverflow.com/q/27487042
has body: Can't you just do something like this? recID++; if(recID &gt;= maxRecordings){ recID = 0; }
has comment: http://stackoverflow.com/comment/43406364
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/27592852
type: UnansweredQuestion
answer count: 0
tagged with: java
has title: how to rebuild an eclipse project to recognize imported WAR file that had different version of JRE
tagged with: web-applications
tagged with: eclipse
type: Question
has body: I just imported a project as a WAR file to my eclipse workspace. the project was built on someone else's machine. after importing it i got multiple errors, by hovering over any of them i was prompted by eclipse to downgrade to jre 1.5 (my default is 1.7) i accepted the suggested fix, which made all errors go away except the one for the main project folder. after searching the error i was sure it is due to the jre version. As suggested by others i downloaded and installed JDK 5, defined it in the JAVAPATH in the environment variables and set it as default for my workspace. i also changed the java compiler compliance level to the new version 1.5. i also changed the execution environment to the new version. after that i was prompted and accepted to rebuild the project. but the error didn't go a way even after restarting eclipse. so i tried to re-rebuild it in the 1.7 jre version. but still having the same issue. Any ideas about what is causing this issue or if am missing another step, would be highly appreciated.
has comment: http://stackoverflow.com/comment/43609394
score: 0
has comment: http://stackoverflow.com/comment/43617596

http://stackoverflow.com/comment/43594625
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27584924
has text: @OlaviMustanoja Hmm, I see what you mean. It's purely algorithmic. If you're using adequate variable names like row/column etc, it should be enough clear (I hope).
score: 0

http://stackoverflow.com/comment/124556629
has text: just for context, here checking this out because of the (at the time of writing this), the log4j bug, which is well-explained here: https://www.youtube.com/watch?v=Opqgwn8TdlM
score: 0
comment on: http://stackoverflow.com/q/27533727
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27587219
has body: I suspect that the method-local variables live only as the method is being executed. Also, GC is triggered when Eden or Long-generation blocks are overflowed (minor/major GC) etc... So, what if at the end of the method body Eden is not overflowed, so there is no need to trigger GC. In spite of not triggering major/minor GC we shall destroy all local variable. How is it done?
tagged with: java
score: 10
upvote count: 10
has answer: http://stackoverflow.com/a/27587246
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/27587236
has title: What destroys the local variable in java?
accepted answer: http://stackoverflow.com/a/27587246
type: AnsweredQuestion
tagged with: garbage-collection
linked to: http://stackoverflow.com/q/1567979
possible better answer: http://stackoverflow.com/a/27587519
has answer: http://stackoverflow.com/a/27587519
type: Question

http://stackoverflow.com/a/27626190
answers question: http://stackoverflow.com/q/27625915
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: How about using java.awt.geom package for 2D objects that provide double precision? e.g. Ellipse2D.Double ellipse = new Ellipse2D.Double(200+s.getX(), 200+s.getY(), width, height); check the package summary http://docs.oracle.com/javase/7/docs/api/java/awt/geom/package-summary.html

http://stackoverflow.com/q/27485753
score: 4
has answer: http://stackoverflow.com/a/27488208
accepted answer: http://stackoverflow.com/a/27488208
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
has title: iText 5.5.3 PDFPCell : long text doesn't fit corrctly in cell (wrap text incorrectly)
upvote count: 4
linked to: http://stackoverflow.com/q/26631815
type: AnsweredQuestion
downvote count: 0
has body: i am trying to create a Persian PDF containing tables and i want to write in it. when my string is long it doesn't fit the cell correctly. feels like String fills the cell upside down!... i mean for example when i want to write "hello my friend . what's up?" in the cell the output is like this: | what's up? | | my friend | | hello | but of course in Persian (it's Ok in English) here i attached the code by the way private LanguageProcessor al = new ArabicLigaturizer(); cell = new PdfPCell(new Phrase(al.process(persian_text), fontNormal)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setBorderWidth(0); table.addCell(cell); i would be thankful with your help
tagged with: java
tagged with: itext
type: Question
linked to: http://stackoverflow.com/q/26818555

http://stackoverflow.com/q/27499983
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27500004
tagged with: linux
has answer: http://stackoverflow.com/a/27500830
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27500830
upvote count: 1
accepted answer: http://stackoverflow.com/a/27500004
type: Question
has comment: http://stackoverflow.com/comment/43430566
score: 1
tagged with: java
has title: How to access Linux Global variables using Java program
has body: Thank you all for you assistance, I have shell script program which export value. Here is my shell script program #! /bin/sh export TEST=35 echo "echo $TEST" I have executed the shell script using the command ./test.sh as well as source ./test.sh (test.sh - shell script program name) I have tried to print the value in command prompt to make sure that TEST variable to export-ed and it prints TEST value as 35. Test variable is exported as expected. Now i have piece of java which access this TEST - linux global variable. sample code as follows, import java.util.Map; public class hello { public static void main(String[] args) { System.out.println(System.getProperty("TEST")); System.out.println("Hello World"); } } } Now the issue is when i execute the java program i am getting the TEST value as null. Now My question is am i doing a write way to access the GLobal variable from java. if not how can i access the Linux Global variable from java program.
answer count: 2

postgresql
tags question: http://stackoverflow.com/q/27503766
tags question: http://stackoverflow.com/q/27497775
tags question: http://stackoverflow.com/q/27605490
tags question: http://stackoverflow.com/q/27622228
tags question: http://stackoverflow.com/q/27566859
tags question: http://stackoverflow.com/q/27592881
tags question: http://stackoverflow.com/q/27612194
tags question: http://stackoverflow.com/q/27594807
tags question: http://stackoverflow.com/q/27509964
tags question: http://stackoverflow.com/q/27557411
tag name: postgresql
type: Tag
tags question: http://stackoverflow.com/q/27603050
tags question: http://stackoverflow.com/q/27622746
tags question: http://stackoverflow.com/q/27503691
tags question: http://stackoverflow.com/q/27612226
tags question: http://stackoverflow.com/q/27489595
tags question: http://stackoverflow.com/q/27531844
tags question: http://stackoverflow.com/q/27596345
tags question: http://stackoverflow.com/q/27524061

http://stackoverflow.com/q/27564958
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27565101
upvote count: 1
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has body: I need to parse the following Json [ "foo", [ "foot mercato", "football", "foot center", "foorzik", "footao" ] ] in java using Gson. Im really interested in values in the Array: so far I have tried: String jsonStr = "[" + "\"foo\"," + " [" + " \"foot mercato\"," + " \"football\"," + " \"foot center\"," + " \"foorzik\"," + " \"footao\"" + " ]" + "]"; JsonParser parser = new JsonParser(); JsonArray array = parser.parse(jsonStr).getAsJsonArray(); any suggestion?
answer count: 2
has title: Parsing Nested JSON array to an Array using GSON
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27565101
favorite count: 0
possible better answer: http://stackoverflow.com/a/27565342
has answer: http://stackoverflow.com/a/27565342

http://stackoverflow.com/q/27483442
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43566750
tagged with: java
has answer: http://stackoverflow.com/a/33085996
has title: Dropwizard doesn't log custom loggers to file
upvote count: 8
type: Question
answer count: 2
has body: I have a dropwizard app, where I configured logger appenders to file as follows: logging: level: INFO loggers: "mylogger": INFO "com.path.to.class": INFO appenders: - type: file currentLogFilename: .logs/mylogs.log archivedLogFilenamePattern: .logs/archive.%d.log.gz archivedFileCount: 14 And, created logger in my app: import org.slf4j.Logger; import org.slf4j.LoggerFactory; private final Logger OpLogger = LoggerFactory.getLogger("mylogger"); (and) private final Logger ClassLogger = LoggerFactory.getLogger(pathToClass.class); Do some test logging in main(): OpLogger.info("test 1"); ClassLogger.info("test 2); The application starts and runs without problems; but I don't get any logs (except for Jetty access logs, of course, that are correctly printed to mylogs.log), neither in stdout or in mylogs.log file. Instead, if I remove the loggers configuration in configuration.yml, I get all logs printed to stdout. Perhaps it's a problem of dropwizard or I have to add something to configuration.yml? I'm using Dropwizard 0.8.0
tagged with: logback
favorite count: 0
tagged with: slf4j
tagged with: dropwizard
possible better answer: http://stackoverflow.com/a/27513081
has answer: http://stackoverflow.com/a/27513081
score: 8
accepted answer: http://stackoverflow.com/a/33085996
tagged with: logging

http://stackoverflow.com/q/27525404
downvote count: 1
type: Question
tagged with: adapter
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43479388
answer count: 3
has body: I wrote the following statement to create an ArrayAdapter&lt;String&gt;, ArrayAdapter&lt;String&gt; arrayListAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.fragment_result_titles, R.layout.row_listview, arrayList); But I got the error that the constructor call is ambiguous. I understand that when null is passed, it is not clear which among ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects) and ArrayAdapter(Context context, int resource, int textViewResourceId, List&lt;T&gt; objects) are we calling. But then I tried this: ArrayList arrayList = null; ArrayAdapter&lt;String&gt; arrayListAdapter = new ArrayAdapter&lt;String&gt;(getActivity(), R.layout.fragment_result_titles, R.layout.row_listview, arrayList); This does not give the error, although I am still passing null, isn't it? Why is this happening?
tagged with: android
possible better answer: http://stackoverflow.com/a/27525526
has answer: http://stackoverflow.com/a/27525543
upvote count: 6
has answer: http://stackoverflow.com/a/27525519
favorite count: 0
has answer: http://stackoverflow.com/a/27525526
linked to: http://stackoverflow.com/q/5229809
score: 5
duplicate of: http://stackoverflow.com/q/5229809
has title: Android: Constructor is ambiguous when I pass Null, but not when I pass a variable assigned to Null
has comment: http://stackoverflow.com/comment/43481980
type: AnsweredQuestion
tagged with: android-arrayadapter
tagged with: java
accepted answer: http://stackoverflow.com/a/27525519

http://stackoverflow.com/comment/43571913
comment on: http://stackoverflow.com/q/27572966
score: 0
type: Comment
type: QuestionComment
has text: BTW never ignore exceptions, always handle them, even by simply printing their stacktrace.

http://stackoverflow.com/q/27553265
upvote count: 5
answer count: 1
downvote count: 0
tagged with: generics
has answer: http://stackoverflow.com/a/27553516
favorite count: 0
has title: How do I resolve this wildcard capture issue when using java generics?
type: AnsweredQuestion
tagged with: java
has body: I am having issues using java generics - specifically, using wildcard capture. Here is a simplified version of the code I have that exhibits the problem I am seeing. It is driving me crazy: public class Task { private Action&lt;ActionResult, ? extends ActionSubject&gt; action; private ActionSubject subject = new ActionSubjectImpl(); private List&lt;ActionResult&gt; list = new ArrayList&lt;&gt;(); public static void main(String[] args) { Task task = new Task(); task.setAction(new ActionImpl()); task.doAction(); } public void setAction(Action&lt;ActionResult, ? extends ActionSubject&gt; action) { this.action = action; } public void doAction() { list.add(action.act(subject)); } public static class ActionResult { } public interface Action&lt;T, U&gt; { public T act(U argument); } public interface ActionSubject { public String getName(); } public static class ActionImpl implements Action&lt;ActionResult, ActionSubjectImpl&gt;{ @Override public ActionResult act(ActionSubjectImpl argument) { // Code that requires ActionSubjectImpl specifically instead of the interface. // This classes implmentation of action should only support ActionSubjectImpl as an // argument. return new ActionResult(); } } public class ActionSubjectImpl implements ActionSubject { @Override public String getName() { return "I am a subject"; } } } Package declaration and imports are not included - otherwise this is complete. This does not compile. The problem is with the fragment list.add(action.act(subject)); where I am seeing the error message : incompatible types: ActionSubject cannot be converted to CAP#1 where CAP#1 is a fresh type-variable: CAP#1 extends ActionSubject from ? extends ActionSubject I can see from other posts that helper methods are suggested as a way get things like this to work, but I have not been able to come up with one that works. The Action action has the type parameters like so: Action&lt;ActionResult, ? extends ActionSubject&gt; and the ActionSubject that I am passing in to …
accepted answer: http://stackoverflow.com/a/27553516
type: Question
score: 5
tagged with: bounded-wildcard

http://stackoverflow.com/comment/43631552
has text: your answer is not helpfull for the the question(which is not clear too), it should be a comment... check the link http://stackoverflow.com/help/how-to-answer
type: Comment
comment on: http://stackoverflow.com/a/27603366
score: 0
type: AnswerComment

http://stackoverflow.com/q/27517786
favorite count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43506374
has body: In STS (Spring Tool Suite) version, We have this quick search plugin (Ctrl+Shift+L) that quickly spawns a dialog box that progressively displays all found occurences of the text provided in the project. Is there such thing in IntelliJ IDEA? A good description of the plugin can be found here: http://spring.io/blog/2013/07/11/eclipse-quick-search
has title: Is there a Quick Search Tool in IntelliJ iDEA?
score: 11
has answer: http://stackoverflow.com/a/35457717
has answer: http://stackoverflow.com/a/37810739
tagged with: quick-search
upvote count: 11
has answer: http://stackoverflow.com/a/27517877
has answer: http://stackoverflow.com/a/27517867
tagged with: java
tagged with: eclipse
type: Question
tagged with: intellij-idea
downvote count: 0
tagged with: spring-tool-suite
has answer: http://stackoverflow.com/a/27517856

http://stackoverflow.com/comment/43683952
type: QuestionComment
type: Comment
has text: Its on projectworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
comment on: http://stackoverflow.com/q/27617279
score: 0

http://stackoverflow.com/q/27482107
has title: How can I pass parameters to uploadphoto task method?
tagged with: java
type: Question
tagged with: asp.net-mvc
has body: I have a method which can be upload photo like this : public class uploadphotos : ApiController { public Task&lt;HttpResponseMessage&gt; Post( ) { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } string root =HostingEnvironment.MapPath("~/photos");//Burdaki app data klasoru degisecek var provider = new MultipartFormDataStreamProvider(root); // Read the form data and return an async task. var task = Request.Content.ReadAsMultipartAsync(provider). ContinueWith&lt;HttpResponseMessage&gt;(t =&gt; { if (t.IsFaulted || t.IsCanceled) { return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, t.Exception); } // This illustrates how to get the file names. foreach (MultipartFileData file in provider.FileData) { string fileName = file.LocalFileName; string originalName = file.Headers.ContentDisposition.FileName; FileInfo file2 = new FileInfo(fileName); file2.CopyTo(Path.Combine(root, originalName.TrimStart('"').TrimEnd('"')), true); file2.Delete(); //Trace.WriteLine(file.Headers.ContentDisposition.FileName); // Trace.WriteLine("Server file path: " + file.LocalFileName); } return Request.CreateResponse(HttpStatusCode.OK); }); return task; } } It works fine. But I want to send parameters to that method, How can I do that? Should I use like this: public Task&lt;HttpResponseMessage&gt; Post( Par one , Par two ) { ... ... ... On my android side : URL url = new URL("myurl/par1/par2/"); // URL url = new URL("myurl") this works without parameters // Open a HTTP connection to the URL conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy ... ... ... ... But when I use this , I got 404 response from server. How can I solve this issue? thanks in advance
score: 0
tagged with: .net
answer count: 1
tagged with: asp.net-web-api
linked to: http://stackoverflow.com/q/9767952
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43396905
has answer: http://stackoverflow.com/a/27482927

http://stackoverflow.com/a/27483073
upvote count: 3
answers question: http://stackoverflow.com/q/27482585
score: 3
has comment: http://stackoverflow.com/comment/43400682
has body: Add a TestWatcher rule that decides, at run time, whether to apply a timeout or not: @Rule public TestWatcher watcher = new TestWatcher() { @Override public Statement apply(Statement base, Description description) { // You can replace this hard-coded test name and delay with something // more dynamic if (description.getMethodName().equals("infinity")) { return new FailOnTimeout(base, 200); } return base; } }; Your original approach didn't work because JUnit rules take effect before the test code begins to run, so any attempts to adjust your Timeout object within your test are too late.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27482585
has comment: http://stackoverflow.com/comment/95100614
has comment: http://stackoverflow.com/comment/43400596
type: Answer

http://stackoverflow.com/q/27615438
has comment: http://stackoverflow.com/comment/43652565
has title: Conversion of string to array
has comment: http://stackoverflow.com/comment/43652646
upvote count: 0
has answer: http://stackoverflow.com/a/27615523
tagged with: java
downvote count: 7
has body: I have a string like the below line and this needs to be converted into an array with the help of java ["123","123"]["7845760296","yoga"] I tried giving the string to array directly and it gives syntax error. I am new to this and any help would be much appreciated. why this is being downed? any problem with my question.? Edit: I found solution in lengthy way but myself.my bad english forgive input: String mystring="["123","123"]["7845760296","yoga"]"; output: array[0]=123; array[3]=yoga; solution: result_from_server=result_from_server.replace("][", ","); result_from_server=result_from_server.replace("]",""); result_from_server=result_from_server.replace("[",""); result_from_server=result_from_server.replace("\"",""); System.out.println("result:"+result_from_server); String a[]=result_from_server.split(","); System.out.println(a[3]);
type: Question
answer count: 2
score: -7
has answer: http://stackoverflow.com/a/27615471
has comment: http://stackoverflow.com/comment/43652582
has comment: http://stackoverflow.com/comment/43652443
favorite count: 0
has comment: http://stackoverflow.com/comment/43652436
type: UnansweredQuestion

http://stackoverflow.com/q/27585607
accepted answer: http://stackoverflow.com/a/27585643
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: Impossible to pass string through activities at the beginning
score: 0
has answer: http://stackoverflow.com/a/27585643
answer count: 1
tagged with: android-activity
favorite count: 0
has body: I am trying to pass a string from an activity to another activity. I need this string to send an Http request with a specific key (the string) as a header. Intent intent = new Intent(getActivity(), StatusActivity.class).putExtra(Intent.EXTRA_TEXT,""); intent.putExtra("token", token); startActivity(intent); I try to get the value in the other activity: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_status, container, false); ListView listView = (ListView) rootView.findViewById(R.id.mylist); // Intent intent = getActivity().getIntent(); token = intent.getExtras().getString("token"); adapter = new ObjAdapter(getActivity() ,new ArrayList&lt;Post&gt;()); listView.setAdapter(adapter); return rootView; } But the problem is that I initialize an ArrayAdapter inside the method onCreate, because I want the data to be present at the beginning of the activity. It seems that the token is null and cannot be found. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_status); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new StatusFragment()) .commit(); } FeedAsync task = new FeedAsync(); task.execute(); } How can I get the string token at the beginning of the activity? I need the string token to execute the AsyncTask.
has comment: http://stackoverflow.com/comment/43595903
tagged with: android
has comment: http://stackoverflow.com/comment/43595717

http://stackoverflow.com/comment/43554585
score: 0
type: Comment
type: QuestionComment
has text: Can You show `HomePageResource.java` too?
comment on: http://stackoverflow.com/q/27513491

http://stackoverflow.com/q/27589885
answer count: 1
has answer: http://stackoverflow.com/a/27590000
has comment: http://stackoverflow.com/comment/43604248
type: AnsweredQuestion
tagged with: java
has body: I'm using RandomAccessFile's method write to achieve that, but the following code is throwing IndexOutOfBoundsException at the 3rd line: RandomAccessFile raf = new RandomAccessFile(this.dbFileName, "rw"); raf.seek(position); raf.write(data[0].getBytes(), 0, FieldLength.NAME.value); raf.write(data[1].getBytes(), 0, FieldLength.LOCATION.value); // etc FieldLength.NAME is an enum of int type. What's the off parameter in method write(byte[] b, int off, int len)? Documentation only says "off - the start offset in the data". Is it a position relative to the file's pointer? (Which was changed in the previous line, with execution of the method seek(long pos)) I didn't find any similar method in DataOutputStream class. The JDK is 6.
type: Question
has comment: http://stackoverflow.com/comment/43603707
accepted answer: http://stackoverflow.com/a/27590000
has comment: http://stackoverflow.com/comment/43603681
has title: Overwrite data in file written with DataOutputStream - IndexOutOfBoundsException - What's the "off" parameter in "write" method?
score: 0

x509
tags question: http://stackoverflow.com/q/27627648
tags question: http://stackoverflow.com/q/27562289
tag name: x509
type: Tag

http://stackoverflow.com/q/27581492
has comment: http://stackoverflow.com/comment/43632381
type: Question
has title: Serialization of detached JDO's in gwt's RemoteService Implementation
tagged with: google-app-engine
upvote count: 1
has comment: http://stackoverflow.com/comment/43612211
answer count: 1
downvote count: 1
tagged with: gwt
score: 0
tagged with: java
tagged with: jdo
accepted answer: http://stackoverflow.com/a/27598585
tagged with: datanucleus
has comment: http://stackoverflow.com/comment/43601005
has comment: http://stackoverflow.com/comment/43622532
has comment: http://stackoverflow.com/comment/43608877
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43603027
has comment: http://stackoverflow.com/comment/43620329
has body: In my RemoteServiceImpl (gwt) i would return an ArrayList. The model has a few members referencing to other objects which are also persistable. The whole object tree comes from gae datastore. I have to detach the objects before returning them in RemoteServiceImpl. Unfortunately after invoking pm.detachCopy() the nested information is lost which was previously present. @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true") @FetchGroup(name = "wc", members = {@Persistent(name = "waterConditions", recursionDepth = -1)}) @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY) public class InventoryInhabitant implements Serializable { ... @Persistent(defaultFetchGroup = "true") @Element(dependent = "true") private InventoryWaterConditions waterConditions; .... } @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true") @JsonSerialize(include = JsonSerialize.Inclusion.NON_EMPTY) public class InventoryWaterConditions implements Serializable { ... @Persistent(defaultFetchGroup = "true") @Element(dependent = "true") private InventoryPh ph; ... } Getter and Setter present just omitted for brevity. After detaching the field waterConditions is not null but it contains nothing all members for example "ph" are null. What i am do wrong in my case?
favorite count: 0
has answer: http://stackoverflow.com/a/27598585

http://stackoverflow.com/comment/43692490
comment on: http://stackoverflow.com/a/27636612
score: 0
type: AnswerComment
type: Comment
has text: I need out put as Date formate. String OutputDate=new SimpleDateFormat("yyyy-dd-MM HH:mm:ss").format(date); the out put is String

http://stackoverflow.com/q/27620071
tagged with: byte
type: Question
has answer: http://stackoverflow.com/a/27620283
linked to: http://stackoverflow.com/q/9431970
has comment: http://stackoverflow.com/comment/43661250
answer count: 3
has title: My bufferedReader reads through the entire file, not just one line. Why?
upvote count: 1
has answer: http://stackoverflow.com/a/27620234
has comment: http://stackoverflow.com/comment/43661051
has comment: http://stackoverflow.com/comment/43660980
has comment: http://stackoverflow.com/comment/43661008
has answer: http://stackoverflow.com/a/27620350
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43661038
has body: I have a bufferedReader which should read one line of a text file (which is encoded), decode it, and check whether it contains a particular set of numbers. The part where it checks to see whether it contains a particular set of numbers is fine, however, I have a problem that it reads through the entire file, my code below, as well as the output from what is read from the file as well as how it should be read is provided below: Code: prviate static final String UTF8_BOM = "\uFEFF"; String cardNumberStr = "106382076"; String lineFromFile = null; lineFromFile = bufferedReaderToWrite.readLine(); if (lineFromFile.startsWith(UTF8_BOM)) { lineFromFile = lineFromFile.substring(1); } lineFromFile = lineFromFile.substring(1, lineFromFile.length()-1); //Convert bytes read back to String for(String s: lineFromFile.split(", ")){ //Split every byte on , sb.append((char) Integer.parseInt(s)); //Convert byte to char } String textToCheck = sb.toString(); //Convert StringBuilder to String System.out.println(textToCheck); System.out.println(); System.out.println(cardNumberStr); if(textToCheck.contains(cardNumberStr)){ System.out.println(lineFromFile); } Output from what is read from file: 106382076 78, 97, 109, 101, 32, 116, 101, 115, 116, 32, 99, 97, 114, 100, 78, 111, 32, 52, 48, 52, 54, 48, 52, 57, 51, 57, 32, 67, 117, 114, 114, 101, 110, 116, 32, 66, 9 7, 108, 97, 110, 99, 101, 32, 51, 49, 48, 32, 111, 118, 101, 114, 100, 114, 97, 102, 116, 32, 102, 97, 108, 115, 101, 32, 111, 118, 101, 114, 68, 114, 97, 102, 116, 76, 105, 109, 105, 116, 32, 48, 32, 112, 105, 110, 32, 50, 50, 50, 50 Name test cardNo 404604939 Current Balance 310 overdraft false overDraftLimit 0 pin 2222Name account cardNo 106382076 Current Balance 132 overdraft false overDr aftLimit 0 pin 4444Name test cardNo 404604939 Current Balance 310 overdraft fals e overDraftLimit 0 pin 2222Name account cardNo 106382076 Current Balance 132 ove rdraft false overDraftLimit 0 pin 4444` It should output: Name test cardNo 4046049…
downvote count: 0
tagged with: bufferedreader
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43660946

http://stackoverflow.com/q/27491476
type: Question
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/43414550
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43414676
tagged with: swing
has title: JTextArea not updating after user input
tagged with: telnet
has body: I'm entering user input via telnet into a HashMap, then trying to display that info into a JTextArea. When I hit run, the GUI launches and the initial HashMap is posted to the GUI. But when I update the HashMap values, they don't show in the TextArea. I have a time textfield, which updates as it should and shows the current time. Where am I going wrong? Is the problem within the GUI class or is it my user input class? Here is my GUI class: public class GUI extends JFrame { private JTextArea theArea1; private JTextField theField1; private Timer theTimer; private static final int TIMER_DELAY = 1; private Scores scores; private SimpleDateFormat formatter; private long startTimeMillis; public GUI(Scores score) { this.scores = score; this.theArea1 = theArea1; this.theField1 = theField1; } public void init() { Container c = getContentPane(); setTitle("Leadrboard"); setSize(400, 400); formatter = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss"); startTimeMillis = System.currentTimeMillis(); JPanel aPanel = new JPanel( ); aPanel.setLayout(new GridLayout(2,1)); theField1 = new JTextField("", 20); aPanel.add(theField1); theField1.setEditable(false); theArea1 = new JTextArea("", 5, 20); aPanel.add(theArea1); theArea1.setEditable(false); c.add(new JScrollPane(theArea1), BorderLayout.CENTER) ; c.add(aPanel, BorderLayout.NORTH); String str = ""; theTimer = new Timer(TIMER_DELAY, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // do whatever theTimer requires Date todaysDate = new java.util.Date(); String formattedDate = formatter.format(todaysDate); theField1.setText(formattedDate); theArea1.setText(scores.toString()); } }); theTimer.start(); } } and here is my class for entering user input bellow. Once I enter score, which is the HashMap value, I print the HashMap in the cmd window, and it shows the HashMap as expected, but the GUI textField doesn't change: public class ClientRequest extends Thread { private Scores scores = new Scores(); private So…
answer count: 0
has comment: http://stackoverflow.com/comment/43418383
upvote count: 2
score: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/43559861
score: 4
comment on: http://stackoverflow.com/q/27567429
has text: What does `mm` represent?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27602144
has comment: http://stackoverflow.com/comment/43626984
has comment: http://stackoverflow.com/comment/43626952
has body: I suspect that the Address record doesn't have an ID when calling save(). You're missing the @GeneratedValue tag in that class, and if not specified, it defaults to "assigned" value. If you're not assigning a value to Address.cId before calling save(), you'll see this problem. Post all relevant code if this isn't the cause of the issue. EDIT: Looking at your table structure, Address should really have it's own ID in the schema design, and have a foreign key(FK) reference to Customer.ID.
has comment: http://stackoverflow.com/comment/43627358
has comment: http://stackoverflow.com/comment/43627681
score: 0
has comment: http://stackoverflow.com/comment/43631113
has comment: http://stackoverflow.com/comment/43627284
has comment: http://stackoverflow.com/comment/43627645
has comment: http://stackoverflow.com/comment/43627500
type: Answer
has comment: http://stackoverflow.com/comment/43631254
answers question: http://stackoverflow.com/q/27602047

http://stackoverflow.com/q/27488897
has answer: http://stackoverflow.com/a/27489012
type: Question
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/27488952
has title: using other java files in my java project
possible better answer: http://stackoverflow.com/a/27488952
has body: first of all, I have to say that this is my first attempt to do something with eclipse and java. Now, I've just open a new java project in eclipse called alignmentComparision. In addition to this, I have a java code, which I need to use in my newly created alignmentComparision project. To explain my problem clearly, I can give a similar c++ example. Assume that I have a file superposition.cpp and superposition.h and I created a cpp file whose name is alignmentComparision.cpp. By getting superposition.h, superposition.cpp and alignmentComparision.cpp at the same folder and adding #include superposition.h line to my alignmentComparision.cpp , I can call the functions inside superposition file. How could I do similar thing in the eclipse ?
has answer: http://stackoverflow.com/a/27488986
answer count: 5
has answer: http://stackoverflow.com/a/27489381
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27489381
tagged with: java
has answer: http://stackoverflow.com/a/27488950

http://stackoverflow.com/a/27609363
answers question: http://stackoverflow.com/q/27608961
score: 6
has body: That can't be part of your webapps WEB-INF/lib directory (not supported that way, as it cant access the internal server components it needs). Enable the servlets module in your ${jetty.base}/start.ini instead --module=servlets
has comment: http://stackoverflow.com/comment/47617374
downvote count: 0
has comment: http://stackoverflow.com/comment/43642113
has comment: http://stackoverflow.com/comment/43642380
has comment: http://stackoverflow.com/comment/47629810
has comment: http://stackoverflow.com/comment/43642282
type: Answer
upvote count: 6

http://stackoverflow.com/q/27595206
has answer: http://stackoverflow.com/a/27597763
score: 0
has body: I followed a tutorial for reading a picture and creating a texture out of it, however, it shows up flipped upside down when rendered. The image is power of two. Main class public class Main { public static void main(String args[]) throws IOException{ Main quadExample = new Main(); quadExample.start(); } public void start() throws IOException { try { Display.setDisplayMode(new DisplayMode(1280,720)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } // init OpenGL GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 1280, 0, 720, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glClearColor(0, 1, 0, 0); GL11.glEnable(GL11.GL_TEXTURE_2D); BufferedImage image = TextureLoader.loadImage("C:\\test.png"); final int textureID = TextureLoader.loadTexture(image); while (!Display.isCloseRequested()) { GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); GL11.glTexCoord2f(1, 0); GL11.glVertex2f(256, 0); GL11.glTexCoord2f(1, 1); GL11.glVertex2f(256, 256); GL11.glTexCoord2f(0, 1); GL11.glVertex2f(0, 256); GL11.glEnd(); Display.update(); } Display.destroy(); } } Texture Loader public class TextureLoader { private static final int BYTES_PER_PIXEL = 4; public static int loadTexture(BufferedImage image) { int[] pixels = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL); for (int y = 0; y &lt; image.getHeight(); y++) { for (int x = 0; x &lt; image.getWidth(); x++) { int pixel = pixels[y * image.getWidth() + x]; buffer.put((byte) ((pixel &gt;&gt; 16) &amp; 0xFF)); buffer.put((byte) ((pixel &gt;&…
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27597763
has comment: http://stackoverflow.com/comment/43615594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43614083
tagged with: opengl
has title: LWJGL Texture is flipped upside down when displayed
tagged with: java
tagged with: lwjgl
upvote count: 1
has comment: http://stackoverflow.com/comment/43614436
downvote count: 1
type: Question

http://stackoverflow.com/a/27540934
has comment: http://stackoverflow.com/comment/43516035
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43511805
accepted answer of: http://stackoverflow.com/q/27540443
has comment: http://stackoverflow.com/comment/43518854
answers question: http://stackoverflow.com/q/27540443
has body: This is a classic problem related to ThreadLocal. Thread local variables being global thread-local variables (Confined and belongs to the thread), they must not be used with a Thread Pool which retains Threads even after their task is over. This will eventually result in PermGen memory issues. Since you can not change the ThreadLocals in the third party library what you can use is avoid using a Thread Pool and create/start/destroy threads at will for each task. This way you can avoid Threads being alive after its task completion and avoid the unintended memory holding with ThreadLocal variables. For more information read this post
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43518176
has comment: http://stackoverflow.com/comment/43519445
type: Answer

http://stackoverflow.com/a/27632080
upvote count: 2
answers question: http://stackoverflow.com/q/27632001
has body: There are various pattern used in android frameworks like Broadcast receiver uses (observer pattern) remoter service invocation uses Proxy pattern) view and view group uses (Composite pattern) Media framework uses (Fascade pattern) A disucssion is already there here Which design patterns are used on Android? http://www.androiddesignpatterns.com/ Have a look at those links. It may help you.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/27622924
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27623841
has answer: http://stackoverflow.com/a/27623134
tagged with: installation
has title: "Ideal" Java Development Setup for OS X Mavericks?
tagged with: java
type: Question
answer count: 2
has body: I've been using Ruby for a long time, and while there is no "one true setup" for Ruby development, there are common patterns, eg: Install a ruby version manager (rvm, rbenv) Install ruby gems to manage ruby libraries Choose a text editor (TextMate, Sublime, vim, etc) I am getting started with Java now, and I am wondering if there is a similar "ideal" path to setting up a good Java development environment. Edit: In Ruby development, there are certain problems that need to be addressed in order to have a reasonably "sane" development environment, eg: management of Ruby versions (so that you can work on older and newer projects in the same environment) Ruby library management, particularly isolating different versions of installed libraries from each other choosing an IDE etc I am moving into Java development on OSX now, and I would like to know what the Java development "pain points" are, and various solutions for managing them.
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/27550105
has body: I have a setting.java class and in this class I read my data from a file and I want to use this data with jsp:useBean in my index.jsp page. this class code is bellow: public class setting { private boolean setstatus=false; private String title="Test"; public boolean changeheader(String text) { return true; } public boolean settitle(String text) { return true; } public void getTitle() throws IOException{ BufferedReader br ; try { br = new BufferedReader(new FileReader("C:\\Users\\Farshid\\workspace\\STPT\\WebContent\\file\\title.txt")); this.title = br.readLine(); System.out.println("\nline: " + this.title + "\n"); br.close(); } catch (FileNotFoundException e1) { e1.printStackTrace(); System.out.println("Error"); } } } And this is my index.jsp codes: &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;title&gt; &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;jsp:useBean id="settitle" class="com.stpt.project.setting" scope="page"&gt; &lt;jsp:getProperty property="title" name="settitle" /&gt; &lt;/jsp:useBean&gt; &lt;/body&gt; &lt;/html&gt; And these are my errors: type Exception report message Cannot find any information on property '*' in a bean of type 'com.stpt.project.setting' description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Cannot find any information on property '*' in a bean of type 'com.stpt.project.setting' org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:824) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1081) org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1125) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2377) org.apache.j…
tagged with: usebean
answer count: 0
has comment: http://stackoverflow.com/comment/43526468
upvote count: 3
type: UnansweredQuestion
tagged with: java
type: Question
score: 3
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/43553498
favorite count: 0
has title: Direct send class's data with usebean

http://stackoverflow.com/comment/43395406
comment on: http://stackoverflow.com/a/27481188
type: Comment
has text: I'm sorry but it seems it does not work. Now I see nothing in the Jpanel... :(
score: 0
type: AnswerComment

http://stackoverflow.com/a/27562418
has comment: http://stackoverflow.com/comment/43550652
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/43550519
score: -1
answers question: http://stackoverflow.com/q/27562301
downvote count: 1
has body: in Snapshot make the field that links to the other table (i suppose it's called row1) unique. @Column(unique = true) edit: you can not control how many other tables are using your primary key. what you can do is introduce a new table where you manage your linking. there you coudl have to columns one called link_from and the other one link_to and make link_to unique.

http://stackoverflow.com/comment/44252366
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27477418
has text: the two components were running well individually, and were later integrated to run simultaneously and this is the point when they run for a certain extent and then crash. Do you think running the 2 processes in parallel would do, maybe by using MPI??
score: 0

http://stackoverflow.com/q/27489523
has body: I am writing a simple program in Java, to connect to MySQL. I try to write a simple query to only check if username and password (typed by me when I run the program) are in my database. Since I have not so much experience with JDBC, I'd like to know if Java has a method like PHP's mysql_num_rows, to check if a specific piece of information is in my database.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27489560
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/27489578
type: Question
has comment: http://stackoverflow.com/comment/43410618
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27489560
upvote count: 1
downvote count: 1
has title: Is there something like mysql_num_rows in Java?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27489578
has comment: http://stackoverflow.com/comment/43410617

http://stackoverflow.com/q/27597514
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/27597925
tagged with: enums
tagged with: java
tagged with: hibernate
has body: I want to populate my drop down with the values from one column in database and data type of that column is ENUM having values (A,B,C). I have read a lot of questions and answers suggesting the creation of an ENUM in java and then mapping it to the column. But I think it is not consistent. What if I make a change in the database and forget to reflect that change in my Java enum? It could create a big blunder because it's totally static to make edits on both sides. Are there any better solutions for tackling this situation? I want to get all possible values from the database column through hibernate, and NOT from a Java enum that reflects the column in my database.
tagged with: mysql
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has title: How can I get All possible values of enum type in mysql through Hibernate
has comment: http://stackoverflow.com/comment/43618632
has answer: http://stackoverflow.com/a/27597925
type: Question
has comment: http://stackoverflow.com/comment/43618663

http://stackoverflow.com/comment/43431948
score: 0
has text: What's the table structure or your RoomManager-table?
type: QuestionComment
comment on: http://stackoverflow.com/q/27500712
type: Comment

http://stackoverflow.com/a/27560113
has body: Assuming that you don't do any compression, and that you restrict yourself to URL safe characters, then the following procedure will give you the most compact encoding possible. Make a list of all URL safe characters Count them. Suppose you have N. Represent your number in base N, representing 0 by the first character, 1 by the 2nd and so on. So, what about compression ... If you assume that the numbers you are representing are uniformly distributed across their range, then there is no real opportunity for compression. Otherwise, there is potential for compression. If you can reduce the size of the common numbers then you can typically achieve a saving by compression. This is how Huffman encoding works. But the downside is that compression at this level is not perfect across the range of numbers. It reduces the size of some numbers, but it inevitably increases the size of others. So what does this mean for your use-case? I think it means that you are looking at the problem the wrong way. You should not be aiming for a minimal encoded size for every number. You should be aiming to minimize the size on average ... averaged over the actual distribution of your numbers.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27559449
score: 1
upvote count: 1

http://stackoverflow.com/a/27570828
type: Answer
upvote count: 2
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43567287
has body: As far as I can see you are just doing base 256 maths. I have not programmed c for a little while so disregard any old terminology; int original_number = 300; // A number over 255 char higher_char, lower_char; // the 2 numbers/chars you are trying to get higher_char = original_number / 256; lower_char = original_number % 256; and then just print higher_char and lower_char as normal. [Edit And to convert back. char higher_char, lower_char; // The two chars you have in order int number_to_restore; // The original number you are trying to get back to number_to_restore = higher_char * 256 + lower_char; ] So using binary operators this becomes: int mask = 0xFF; int original_number = 300; // A number over 255 char higher_char, lower_char; // the 2 numbers/chars you are trying to get higher_char = (original_number &gt;&gt; 8) &amp; mask; lower_char = original_number &amp; mask; and the restore char higher_char, lower_char; // The two chars you have in order int number_to_restore; // The original number you are trying to get back to number_to_restore = (higher_char &lt;&lt; 8) | lower_char;
has comment: http://stackoverflow.com/comment/43572163
has comment: http://stackoverflow.com/comment/43567116
answers question: http://stackoverflow.com/q/27570721

http://stackoverflow.com/comment/43816566
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27562326
has text: Try to create the socket with a `SocketFactory` from a `Network` obtained through `ConnectivityManager.requestNetwork()` with `NET_CAPABILITY_INTERNET` specified. Or by other means if you find better. Check if this doesn't need additional permissions before.

http://stackoverflow.com/comment/43481847
comment on: http://stackoverflow.com/a/27507981
score: 0
type: AnswerComment
has text: Thanks @Predrag. I have already fixed the exception from the same thread. Didn't got time to mention the same. Thanks.
type: Comment

http://stackoverflow.com/q/27602038
has comment: http://stackoverflow.com/comment/43626563
has answer: http://stackoverflow.com/a/27602078
linked to: http://stackoverflow.com/q/22368107
answer count: 2
score: 0
tagged with: resultset
has comment: http://stackoverflow.com/comment/43626657
tagged with: jdbc
has body: I have two resultsets, one from DB2 and one from Sybase. I want to merge these resultsets based on some condition,for which i have made one function which will take two resultsets and merge them. But i am getting SQL exception- Resultset Closed I am using Connection object and Prepared statement to connect to the respective DB and execute the query. public void ExecuteDB2Query(SQLQuery){ Connection DB2con = DB2Sess.connection(); PreparedStatement statement = DB2con.prepareStatement(SQLQuery); MyResulset1= statement.executeQuery(); } Another method: public void ExecuteSybaseQuery(SQLQuery){ Connection Sybasecon = SybaseSess.connection(); PreparedStatement statement = Sybasecon.prepareStatement(SQLQuery); MyResulset2= statement.executeQuery(); } Final merge method puble void merge{ while(MyResultset1.next()){ while(MyResultset2.next()){ &lt;some code here&gt; } Do we have any way by which i can loop through these two result sets? without any exception.
has comment: http://stackoverflow.com/comment/43627235
has answer: http://stackoverflow.com/a/27602441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43627105
type: Question
has comment: http://stackoverflow.com/comment/43627147
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43626776
has title: how to merge two different resultsets from two different DBs in java

http://stackoverflow.com/q/27533691
score: 0
accepted answer: http://stackoverflow.com/a/27534006
answer count: 1
has answer: http://stackoverflow.com/a/27534006
has body: So I'v looked around and can't really find anyone that is trying to do this so thought I would ask myself. What I am trying to do is take a Excel File look at a specific cell take it's value, run through a tab delimited text file (It should find a match) and then write the following column in the text file to another cell in the spreadsheet. Here is an example : Cell A1 = LastName Text File: FirstName John LastName Doe MiddleName Allen It finds the match with LastName. Then looks at the next column in the text file for a value("Doe") and then writes that value to lets say Cell B1 in excel. I feel like it would be fairly easy to do I'm just not sure how to make it take the "Doe" value from the text file when it matches the first column. I have to do this for about 3,600 cells hence why I'm trying to write a java program to do it. Any help would be great thanks!
type: AnsweredQuestion
tagged with: java
has title: Using Java to match a excel cell value to a text file
tagged with: excel
type: Question

http://stackoverflow.com/comment/60352906
has text: I have the exact same problem , how did you whitelist *.googleapis.com?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/29198248

http://stackoverflow.com/a/27517804
has comment: http://stackoverflow.com/comment/43479148
answers question: http://stackoverflow.com/q/27517303
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27517303
has body: Your problem is that you're using postfix operators to increment/decrement your index values when you make your recursive call. In this case i+1 and i++ do very different things. i++ and i-- don't just evaluate to 'one more than i' and 'one less than i', they also change the value of i going forward in the program. Furthermore, they only evaluate to the incremented/decremented value after they have been used. Let's take a look at what happens when your board looks like this: 000100 001110 000011 000011 Your main loop will call turnOff(0, 3), like so: public static void turnOff(int i, int j) { // i=0, j=3 if (table[i][j] == 1) { table[i][j] = 0; if (j &lt; width - 1) { turnOff(i, j++); // calls turnOff(0,3) and sets j=4 } if (j &gt; 0) { turnOff(i, j--); // calls turnOff(0,4) and sets j=3 } //etc This screws up your bounds checking and makes many out-of-order and redundant calls, which breaks your algorithm. What you want to do is call the recursive method on each cell adjacent to the current one: public static void turnOff(int i, int j) { // i=0, j=3 if (table[i][j] == 1) { table[i][j] = 0; if (j &lt; width - 1) { turnOff(i, j+1); // calls turnOff(0,4) } if (j &gt; 0) { turnOff(i, j-1); // calls turnOff(0,2) } //etc In the long run, I cannot stress enough how important it is to learn to use a debugger. Your brain "sees" what you think you've written, not what you've actually written. Until you set a watch on a variable and see it do something unexpected, it's often very difficult to identify where your program is going astray.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43499584
type: QuestionComment
comment on: http://stackoverflow.com/q/27535402
has text: looks like ... after you get a line of your text, you will need to break it to list of words : you could use the split() with white space delimiter. then don't send the first and last words in the list .. The ugly part is you will need to construct the whole text with the first + scrambled + last :(
score: 0
type: Comment

http://stackoverflow.com/a/27528756
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/27528466
accepted answer of: http://stackoverflow.com/q/27528466
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43486232
has comment: http://stackoverflow.com/comment/43525564
has body: try getLocationOnScreen method. int[] locationOnScreent = new int[2]; yourView.getLocationOnScreen(locationOnScreent); // locationOnScreent[0] = x // locationOnScreent[1] = y
has comment: http://stackoverflow.com/comment/43486112
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43486423
has comment: http://stackoverflow.com/comment/43486133

http://stackoverflow.com/comment/43632106
type: QuestionComment
has text: @SotiriosDelimanolis yes I know that, however this solution was posted in http://stackoverflow.com/questions/22205877/problems-with-jaxb-marshal-unable-to-marshal-type-java-lang-string and the user said it works.
type: Comment
comment on: http://stackoverflow.com/q/27605000
score: 0

http://stackoverflow.com/comment/43676467
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27627570
has text: If you want help reviewing working code, then you should ask this question on http://codereview.stackexchange.com/.

http://stackoverflow.com/comment/43564891
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27569735
score: 0
has text: Use HashMap while storing. HashMap<key,list<item[pos]>>

http://stackoverflow.com/comment/43631267
has text: Buy Effective Java by Josh Bloch. There's loads of excellent advice on this sort of thing, but it's far too long to sum up in an answer here.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27604531
score: 2

http://stackoverflow.com/a/27476753
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27476140
score: 1
accepted answer of: http://stackoverflow.com/q/27476140
upvote count: 1
has body: Answer to 3): change the method signature to include: @AuthenticationPrincipal User principal This way the authentication credentials will be passed to the controller method called by Spring. The other way is through the security context: SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); As for 2), my guess at this point is that to influence the parameters used to compute the JWT token, one needs to implement a custom AccessTokenConverter. If my understanding is correct the default one called DefaultAccessTokenConverter does not allow for this. I welcome any other opinion on this.

wildfly-8
tags question: http://stackoverflow.com/q/27548507
tags question: http://stackoverflow.com/q/27513491
tags question: http://stackoverflow.com/q/27629270
type: Tag
tag name: wildfly-8
tags question: http://stackoverflow.com/q/27596345

http://stackoverflow.com/a/27617434
answers question: http://stackoverflow.com/q/27617349
score: 0
has comment: http://stackoverflow.com/comment/43656094
type: Answer
has comment: http://stackoverflow.com/comment/43656048
has body: To achieve this you will have to request the server time from the javascript using AJAX. Once the response is returned you will then be able to pass it into the date object as a string. var date = new Date(dateString); Using AJAX to get the server date: First you have to build a page to display the current time. On the server build a java file to serve this in a file: {"serverTime": "currentTimeString"} Once that is being served from the file you created, use AJAX to request the file asynchronously. jQuery's $.ajax() method is a popular method of completing this; it has a promise method callback once the file has been fetched, placing the response in memory. You can then decode the JSON String in the success callback like so: function(response) { var parsed = JSON.parse(response); var currentTime = parsed.serverTime; }

http://stackoverflow.com/q/27595797
has answer: http://stackoverflow.com/a/27595834
tagged with: regex
has answer: http://stackoverflow.com/a/27595829
answer count: 4
has answer: http://stackoverflow.com/a/27595830
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27595847
has comment: http://stackoverflow.com/comment/43615867
score: -1
has title: How to match string with my regular expressions?
downvote count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/27595830
has body: I have a String which will be coming in this format - /pep/v1/clients/clientId/tester I need to validate my string with the above format and extract clientId from it Sample example can be - /pep/v1/clients/ST-980/tester /pep/v1/clients/123/tester /pep/v1/clients/Hello%20World/tester So clientId in general can be anything so I need to match whatever is there in clientId. It can be numbers, strings, or number and string mixture or alphanumeric strings. So I came up with below regular expressions but it didn't worked on all the above examples. ^/pep/v1/clients/[0-9A-Za-z]+/tester$ I am working with Java, after matching my string with above regular expressions, I need to extract clientId from it.
has comment: http://stackoverflow.com/comment/43615423
possible better answer: http://stackoverflow.com/a/27595847
has comment: http://stackoverflow.com/comment/43615414

http://stackoverflow.com/comment/43534994
comment on: http://stackoverflow.com/q/27535087
has text: can you provide a little pease of code? i does not even get the "tabbing" to the next editable cell... do you have modified the factories?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27579627
has comment: http://stackoverflow.com/comment/43584394
has comment: http://stackoverflow.com/comment/43693365
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43585797
has answer: http://stackoverflow.com/a/27642252
has comment: http://stackoverflow.com/comment/43583931
tagged with: swing
has comment: http://stackoverflow.com/comment/43699798
has comment: http://stackoverflow.com/comment/43584251
type: Question
tagged with: application-restart
has title: Restarting a Java Game
has comment: http://stackoverflow.com/comment/43584882
has comment: http://stackoverflow.com/comment/43584535
has body: I have a Java Game i need to restart it when the user presses the restart button. My code snippets : package projectflappy; //imports public class TheGame extends JFrame implements MouseListener{ JPanel jp; //declaration of the varibles .... int x_ball = 30; int y_ball = 200; int x_width = 500; int y_height = 500; Label img = new Label(); int count = 5 , test = -4000; int i; //for ball loop Ellipse2D Ball; int cord_xup1 = 175,cord_xdown1 = 175; int cord_xup2 = 320,cord_xdown2 = 320; int cord_xup3 = 460,cord_xdown3 = 460; int cord_xup4 = 585,cord_xdown4 = 585; int cord_xup5 = 700,cord_xdown5 = 700; Boolean flag = true; RoundRectangle2D up1,down1,up2,down2,up3,down3,up4,down4,up5,down5; Font font = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,40); Font font1 = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,20); Font font3 = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,20); Font font4 = new Font("Matura MT Script Capitals",Font.ROMAN_BASELINE,10); float das[] = {10.0f}; BasicStroke color = new BasicStroke(10,BasicStroke.CAP_ROUND,BasicStroke.JOIN_BEVEL,20.0f,das,0.0f); private CellRendererPane crp = new CellRendererPane(); GradientPaint gp2 = new GradientPaint(20, 0, Color.DARK_GRAY, 0, 10, Color.GRAY, true); GradientPaint gp3 = new GradientPaint(30, 0, Color.BLACK, 0, 20, Color.GREEN, true); Toolkit kit = Toolkit.getDefaultToolkit(); //Getting the "background.jpg" image we have in the folder Image background = kit.getImage("D:\\College\\Programs\\ProjectFLAPPY\\src\\projectflappy\\1.png"); JLabel a = new JLabel("Get Ready ! Click to Start."); JLabel retry = new JLabel(new ImageIcon("D:\\College\\Programs\\ProjectFLAPPY\\src\\projectflappy\\unnamed.png")); //constructor public TheGame() throws IOException { super("Simple Drawing"); setSize(x_width, y_height); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); jp = new DrawingPanel(); add(jp); addMouseListener(this); } // Timer class initiazation--animating the ball ActionListen…
has comment: http://stackoverflow.com/comment/43584427
has comment: http://stackoverflow.com/comment/43586730
upvote count: 2
has answer: http://stackoverflow.com/a/27640891
answer count: 2
has comment: http://stackoverflow.com/comment/43692950
downvote count: 1
has comment: http://stackoverflow.com/comment/43584617
has comment: http://stackoverflow.com/comment/43584209
has comment: http://stackoverflow.com/comment/43586215
favorite count: 0
has comment: http://stackoverflow.com/comment/43584027
has comment: http://stackoverflow.com/comment/43623035
has comment: http://stackoverflow.com/comment/43585676
linked to: http://stackoverflow.com/q/5666134
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43585068
has comment: http://stackoverflow.com/comment/43584828
has comment: http://stackoverflow.com/comment/43584077

http://stackoverflow.com/comment/43613822
type: AnswerComment
has text: only digits are in the string, spaces are not considered delimiters but part of the value
comment on: http://stackoverflow.com/a/27594970
type: Comment
score: 0

http://stackoverflow.com/comment/43625721
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27601526
has text: That seems easy way of replacement but may not be efficient way. In my example I have 20 fixed variables to be replaced. a single template is replaced 10,000 times with new values in an hour.

http://stackoverflow.com/a/27603241
score: 0
answers question: http://stackoverflow.com/q/27602710
type: Answer
has body: The providerSearch must not be null in myPreference's instance. MyPrefrences myPrefrences = new MyPrefrences(); try { Field field = MyPrefrences.class.getDeclaredField("ProviderSearch"); Field field2 = ProviderSearch.class.getDeclaredField("ConfigURL"); field2.set(field.get(myPrefrences), val); } catch (Exception ex) { throw new RuntimeException(ex); } In addition, I recommend: Don't use public field. Use variables that begin with lower case. Use getters and setters.
has comment: http://stackoverflow.com/comment/43633692
has comment: http://stackoverflow.com/comment/43633359

h2
tags question: http://stackoverflow.com/q/27540469
tags question: http://stackoverflow.com/q/27480109
tags question: http://stackoverflow.com/q/27530514
type: Tag
tags question: http://stackoverflow.com/q/27598390
tag name: h2
tags question: http://stackoverflow.com/q/27490533

http://stackoverflow.com/comment/43548074
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27560989
has text: you can use a global timer reference a `countdown timer` and in each activity `onResume` method reset you `timer` and in your `timer` logic when countdown finishes `invalidate` your preferences
score: 0

http://stackoverflow.com/comment/43531766
has text: jobject buff = env->NewDirectByteBuffer((void*)&(sm->getIndices()[0]),sm->getNoOfIndices()*sizeof(uint32_t)); - seems to fix it - staring at that one for ages without seeing it!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27549199

http://stackoverflow.com/q/27572367
has comment: http://stackoverflow.com/comment/43572878
score: 0
has comment: http://stackoverflow.com/comment/43570376
answer count: 1
has title: Find a repeating pattern which has a repeating pattern
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27724460
tagged with: regex
tagged with: java
has body: I get a very large string that contains n number of records. Each record consists of 3 groups of text, the first 3 of which are encased in angle brackets. Each group of text is 1-n characters in length. This overall pattern repeats 1-n times within the string. (see example below). &lt;text1a&gt;&lt;text2a&gt;&lt;text3a&gt;text4a&lt;text1b&gt;&lt;text2b&gt;&lt;text3b&gt;text4b&lt;text1c&gt;&lt;text2c&gt;&lt;text3c&gt;text4c |--------single record-------||-------single record--------||-------single record--------| Using the above as the input string, I'm trying to develop a pattern matcher that would return to me each individual record in the string. I've tried many variations but either get nothing, only the first record, or the whole string. I've read many posts regarding repeating patterns and have tried to apply the principles with little success. I been successful at finding IP addresses, phone numbers, and other patterns that might repeat within a given string, but this pattern eludes me. Thanks in advance.
type: Question
linked to: http://stackoverflow.com/q/6020384
has comment: http://stackoverflow.com/comment/43570190

java-stream
tags question: http://stackoverflow.com/q/27559231
tags question: http://stackoverflow.com/q/27503284
tags question: http://stackoverflow.com/q/27636711
tag name: java-stream
tags question: http://stackoverflow.com/q/27564457
tags question: http://stackoverflow.com/q/27613957
type: Tag
tags question: http://stackoverflow.com/q/27606185
tags question: http://stackoverflow.com/q/27583623
tags question: http://stackoverflow.com/q/27534684
tags question: http://stackoverflow.com/q/27547519
tags question: http://stackoverflow.com/q/27621017
tags question: http://stackoverflow.com/q/27572859
tags question: http://stackoverflow.com/q/27614119

http://stackoverflow.com/comment/43553201
score: 0
type: Comment
type: QuestionComment
has text: I've edited my answer after you posted `web.xml`, check if it works for you.
comment on: http://stackoverflow.com/q/27548975

http://stackoverflow.com/comment/43544410
comment on: http://stackoverflow.com/q/27559162
score: 0
has text: Are you importing/using the correct `Point` class?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43557835
type: Comment
has text: @Tom ok I edited it, you are right, I should have explained it
comment on: http://stackoverflow.com/a/27566247
score: 0
type: AnswerComment

http://stackoverflow.com/a/27492746
answers question: http://stackoverflow.com/q/27492595
downvote count: 0
has comment: http://stackoverflow.com/comment/43425763
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/43435080
upvote count: 4
has body: The only thing short of screwing with the VM internals (yes, it is possible to do pointer arithmetic with e.g. to-and-fro JNI calls) is using way similar to Arrays.asList(bytes1).subList(startIndex, endIndex) (note that asList() doesn't work with primitive arrays by itself, you'd have to write or find on the 'net a similar implementation for primitives; http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/bytes/ByteList.html#subList%28int comes to mind here) - note that you'll get a List view this way, not byte[], since that'd be essentially impossible in Java (with the exception of VM hacks, mind me). Alternatively, do what you said - use java.nio.Buffer, ByteBuffer specifically, since that's the Java counterpart of pointer to memory; with array-backed ByteBuffer you can essentially either access the array directly or access the buffer in abstracted/modified (e.g. with offset) way. ByteBuffer bytes1 = ByteBuffer.allocate(100); for (int i = 0; i &lt; 100; i++) { bytes1.put((byte)(i+1)); } bytes1.position(offset); ByteBuffer byte2 = bytes1.slice(); or even byte[] bytes1 = new byte[100]; for (int i = 0; i &lt; 100; i++) { bytes1[i] = (byte)(i+1); } ByteBuffer bytes1 = ByteBuffer.wrap(bytes1); bytes1.position(offset); ByteBuffer byte2 = bytes1.slice();

http://stackoverflow.com/a/27600014
upvote count: 143
score: 143
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/100059124
downvote count: 0
type: Answer
has body: Starting from Java 7 you can use deleteIfExists that returns a boolean (or throw an Exception) depending on whether a file was deleted or not. This method may not be atomic with respect to other file system operations. Moreover if a file is in use by JVM/other program then on some operating system it will not be able to remove it. Every file can be converted to path via toPath method . E.g. File file = ...; boolean result = Files.deleteIfExists(file.toPath()); //surround it in try catch block
answers question: http://stackoverflow.com/q/27599965
accepted answer of: http://stackoverflow.com/q/27599965

http://stackoverflow.com/comment/43585509
type: Comment
has text: 1) See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) 2) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example).
score: 3
comment on: http://stackoverflow.com/q/27580177
type: QuestionComment

http://stackoverflow.com/comment/43586658
type: Comment
type: QuestionComment
score: 1
has text: Instead of `same value`, did you want to say `same type` ?
comment on: http://stackoverflow.com/q/27581127

http://stackoverflow.com/comment/43639873
comment on: http://stackoverflow.com/a/27604603
has text: @LouisWasserman: `null` arrays are ignored. Simply because some people see them as zero-length arrays. It is of course arbitrary. But in case `null` shouldn't be allowed, one can simply remove the `if` clause.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43608877
type: Comment
type: QuestionComment
has text: PM has a FetchPlan, and you can set the max FetchDepth as per http://www.datanucleus.org/products/accessplatform_4_0/jdo/fetchgroup.html
score: 1
comment on: http://stackoverflow.com/q/27581492

http://stackoverflow.com/comment/135286735
comment on: http://stackoverflow.com/a/27524543
has text: can you please explain this sentence in your answer " if a lambda expression does not capture values" I am bit confused
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43597109
score: 0
type: Comment
type: QuestionComment
has text: Websockets allows you to open a stream directly from JavaScript to your server. It doesn't use HTTP. It's not RESTful. https://developer.mozilla.org/en/docs/WebSockets
comment on: http://stackoverflow.com/q/27585864

http://stackoverflow.com/a/49959430
score: 1
has comment: http://stackoverflow.com/comment/87010268
answers question: http://stackoverflow.com/q/27573192
downvote count: 0
has comment: http://stackoverflow.com/comment/87025453
type: Answer
has body: It looks like you are not using java 1.8 In Java 1.8 the default TLS protocol version is v1.2, whereas in Java 1.6,1.7 default is TLS1.0. As you can see in logs ClientHello, TLSv1.2 it means you are either using java 1.6 or 1.7 now you can either switch to 1.8 or Just add static { System.setProperty("https.protocols", "TLSv1.2"); } in your application class before main class keeping you current java version .. hope this helps !!
upvote count: 1

http://stackoverflow.com/comment/43476902
type: Comment
type: QuestionComment
has text: my code is a bit complex and too long ; :-/
comment on: http://stackoverflow.com/q/27523861
score: 0

http://stackoverflow.com/q/27599934
answer count: 2
has answer: http://stackoverflow.com/a/33120472
downvote count: 0
accepted answer: http://stackoverflow.com/a/33120472
has title: Avoiding promotion failed in Java CMS GC
favorite count: 0
has answer: http://stackoverflow.com/a/27600466
tagged with: garbage-collection
upvote count: 7
has body: I have a Java application using CMS garbage collection that suffers from a "ParNew (promotion failed)" full GC a few times every day (see below for an example). I understand that a promotion failure occurs when garbage collection cannot find enough (contiguous) space in the old generation into which to promote an object from the new generation. At this point it is forced to do an expensive stop-the-world full GC. I want to avoid such events. I have read several articles that suggest possible solutions but I wanted to clarify/consolidate them here: -Xmx: Increase heap size, eg. from 2G to 4G -- simple solution to give more headroom in old generation -- seems to work reasonably well in my experience -XX:NewRatio: Increase NewRatio, eg. from 2 to 4, in order to increase old generation/decrease new generation -- give the old generation more space -- does not seem to have much, if any, effect from my experiments so far -XX:PromotedPadding: Increase the amount of padding provided for avoiding promotion failures -- however I cannot find any suggestions on what values to give for this parameter -- does anyone know what the value means, what the default is, or what values to try? -XX:CMSInitiatingOccupancyFraction -XX:+UseCMSInitiatingOccupancyOnly: Make the CMS cycle start sooner to avoid a lack of space in old generation -- I have not tried this solution yet -- what values would be reasonable to try? What is the default? Do not allocate very large objects on the heap: A very large object can be difficult to promote since it will require a large contiguous amount of free space in old generation -- this does not apply to my application, as far as I am aware In case it is relevant, here are my current GC options and a sample of logs preceding a promotion failed event. -Xmx4g -XX:+UseConcMarkSweepGC -XX:NewRatio=1 2014-12-19T09:38:34.304+0100: [GC (Allocation Failure) [ParNew: 1887488K-&gt;209664K(1887488K), 0.0685828 secs] 3115998K-&gt;1551788K(3984640K), 0.0690028 secs] [Tim…
type: AnsweredQuestion
tagged with: performance
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/27600466
tagged with: concurrent-mark-sweep
type: Question

http://stackoverflow.com/comment/43689468
comment on: http://stackoverflow.com/q/27634919
score: 0
has text: @NikhilEm Or just open the eclipse marketplace and install the Java Developement Tools
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27523454
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43478101
accepted answer of: http://stackoverflow.com/q/27522728
has body: You have to add a dependency on JSR 305. For example, Guava uses this: com.google.code.findbugs jsr305 1.3.9 Now, you have to use a workaround mentioned in a issue: Create a simple javax/annotation/Annotation.gwt.xml file in your project: Add <inherits name='javax.annotation.Annotation' /> to your applications module (.gwt.xml) file.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27522728

http://stackoverflow.com/comment/44258493
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27598464
type: Comment
has text: I feel like this is what I was doing, but I'll take a look when I have time and get back to you. Thanks for your answer.

java-6
tags question: http://stackoverflow.com/q/27629027
type: Tag
tag name: java-6

http://stackoverflow.com/q/27495318
tagged with: chess
has answer: http://stackoverflow.com/a/27593609
tagged with: tree
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27832584
answer count: 2
has body: I am having trouble identifying the error in my negamax (alpha - beta) implementation. I can make the simple negamax version work fine, however I am unable to convert it to its alpha-beta version of negaMax. First the simple negaMax version that is working .... public class NegaMax { static Node bestNode = null; public static final Node getMove(Node root, boolean maximizingPlayer) { bestNode = null; int score = maximizingPlayer ? negaMax(root, 4, maximizingPlayer) : negaMax(root, 4, !maximizingPlayer); if(bestNode != null) { bestNode.score = score; } return bestNode; } private static final int evaluate(Node node, boolean maximizingPlayer) { return Integer.parseInt(node.value) * (maximizingPlayer ? 1 : -1); } private static final int negaMax(Node node, int depthLeft, boolean maximizingPlayer) { if(depthLeft == 0) { return evaluate(node, maximizingPlayer); } int max = Integer.MIN_VALUE; Node bestChildSoFar = null; List&lt;Node&gt; children = node.getChildren(); for(Node child : children) { int score = -negaMax(child, depthLeft - 1, !maximizingPlayer); if(score &gt; max) { bestChildSoFar = child; max = score; } } bestNode = bestChildSoFar; return max; } ... and here the version that is not ... (returns -INFINITY) --(sourcecode ideas from chessprogrammingwiki) ... public class AlphaBetaNegaMax { public static final Node getMove(Node root, boolean maximizingPlayer) { int score = maximizingPlayer ? alphaBeta(root, Integer.MIN_VALUE, Integer.MAX_VALUE, 4, maximizingPlayer) : alphaBeta(root, Integer.MIN_VALUE, Integer.MAX_VALUE, 4, !maximizingPlayer); System.out.println(score); return null; // score is wrong ... fix this first } private static final int evaluate(Node node, boolean isMaximizingPlayer) { return Integer.parseInt(node.value) * (isMaximizingPlayer ? 1 : -1); } private static final int alphaBeta(Node node, int alpha, int beta, int depthleft, boolean maximizingPlayer) { if(depthleft == 0) { return evaluate(node, maximizingPlayer); } List&lt;Node&gt; children = nod…
downvote count: 0
accepted answer: http://stackoverflow.com/a/27832584
favorite count: 0
has title: Cannot find bug in NegaMax implementation for java chess game
upvote count: 1
possible better answer: http://stackoverflow.com/a/27593609

http://stackoverflow.com/q/27491622
type: Question
has title: Findbugs not excluding methods in our java application
has comment: http://stackoverflow.com/comment/43417814
tagged with: findbugs
has comment: http://stackoverflow.com/comment/43421242
has comment: http://stackoverflow.com/comment/43421167
has answer: http://stackoverflow.com/a/27499572
downvote count: 0
answer count: 1
score: 8
favorite count: 0
has body: I have added the following in the findbugs exclude.xml file &lt;Match&gt; &lt;Class name="com.ebay.kernel.service.invocation.SvcInvocationConfig" /&gt; &lt;Method name="getConnectionConfig" /&gt; &lt;Bug pattern="IS2_INCONSISTENT_SYNC" /&gt; &lt;/Match&gt; The code that needs to be ignored public ConnectionConfig getConnectionConfig() { return m_connectionConfig; } because Findbugs reports that m_connectionConfig suffers from (inconsistent synchronization) BUG - IS2_INCONSISTENT_SYNC But for some reason my findbugs are not getting ignored. and when I do following - &lt;Match&gt; &lt;Class name="com.ebay.kernel.service.invocation.SvcInvocationConfig" /&gt; &lt;Bug pattern="IS2_INCONSISTENT_SYNC" /&gt; &lt;/Match&gt; The findbugs is getting ignored for the entire class but as soon as I introduce &lt;Method name="getConnectionConfig"&gt; tag in between, findbugs stops getting ignored for that method. Can someone help me figure out why?
upvote count: 8
has comment: http://stackoverflow.com/comment/43414901
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27499572
tagged with: java

http://stackoverflow.com/comment/43527956
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27545013
has text: You can't reuse a FileInputStream. You'll need to open a new one for the line `XWPFDocument document = new XWPFDocument(is);`

http://stackoverflow.com/comment/43498658
type: QuestionComment
comment on: http://stackoverflow.com/q/27534536
score: 0
has text: @topsail: on appealing, any user with a gold badge in java can reopen this. or editing the question will send this to the reopen review queue. but i think Luiggi's linked answer should address your question, if only you can let go of your incorrect understanding of the keyword `static`.
type: Comment

http://stackoverflow.com/q/27579631
score: -1
has title: How to Invoke a single test suite multiple times in testng
has comment: http://stackoverflow.com/comment/43589938
answer count: 1
has comment: http://stackoverflow.com/comment/43590117
favorite count: 0
tagged with: testng
has body: I have a requirement where in I need to execute all the suites in the testng.xml file for a number of times say 5.I know how to run a single test case multiple times by using invocationcount attribute but I don't have any idea how to run a suite multiple times.Any help will be appreciated a lot
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43601574
linked to: http://stackoverflow.com/q/15464111
has answer: http://stackoverflow.com/a/27589326
has comment: http://stackoverflow.com/comment/43584045
tagged with: java
has comment: http://stackoverflow.com/comment/43591876
type: Question
has comment: http://stackoverflow.com/comment/43598456

http://stackoverflow.com/a/27556975
type: Answer
answers question: http://stackoverflow.com/q/27556216
score: 2
has body: There is a particular difference between caching solutions like Guava and EHCache and what you are trying to implement. The sole purpose of these caches is to act in the same way than getter functions work. So, caches are intended to retrieve a single element by its key and store it for further use; evicting it after it stops being used. E.g. @Cacheable public Object getter(String key){ ... } That's why getting a whole set of objects from the cache feels a little like forcing the cache and the eviction policy to work differently from its original purpose. What you need, instead of Guava cache (or other caching solutions), is a collection that can be evicted all at once by a timer function. Sadly, Guava doesn't provide that right now. You would still need a timer function provided by the application that would remove all existing elements from the cache. So, my suggestion would be the following: Even when it is possible for Guava to behave in the way you want it to, you will find out that you are not using the features that make Guava really valuable, and you are "forcing" it to behave differently. So I suggest you forget about the Guava implementation and consider using, for example, an specialization from the AbstractMap class, along with a timer function that will evict its contents every N seconds. This way you will be able to have all your entries in a single cache and stop worrying about the discrepancies between the timestamp and the time the entry was added to the cache.
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/43607531
type: QuestionComment
has text: I think the problem is on the line `klasa = (String) c.newInstance();`. If `c` is not of type `Class<String>` (which I think is the case here) you'll get a ClassCastException.
comment on: http://stackoverflow.com/q/27591852
score: 0
type: Comment

http://stackoverflow.com/q/27612961
has answer: http://stackoverflow.com/a/27613765
has title: mvn package error when trying mvn package
downvote count: 0
type: UnansweredQuestion
tagged with: maven
type: Question
has body: I have checked out a project from svn. I am trying to build the project using maven. It builds fine with mvn compile. when i try the command mvn package, i get the following error. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.737 s [INFO] Finished at: 2014-12-22T19:30:54-06:00 [INFO] Final Memory: 12M/155M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project usermanager: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please rea d the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE I find that this is because, the web.xml is not provided to the pom.xml. I have tried all the ways given in the answers in stack over flow. But none does seem to work Here is my pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.joseph usermanager war User Manager 1.0 The User Manager is an administration interface for Intranet Users, Groups, Applications, and Permissions. http://projects.joseph.com/usermanager 2006 Bug Tracker http://bugtracker.joseph.com lforehand Luke Forehand lforehand@parts-unltd.com Joseph Corporation http://wiki.josephnet.com Java Developer build build/test-classes build/classes WEB-INF/src test deploy **/*.properties deploy **/*.properties org.apache.maven.plugins maven-checkstyle-plugin 2.1 org.apache.maven.plugins maven-javadoc-plugin 2.2 org.apache.maven.plugins maven-surefire-report-plugin org.codehaus.mo…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27614031
has answer: http://stackoverflow.com/a/30951823
upvote count: 1
favorite count: 0
answer count: 3

http://stackoverflow.com/a/27553797
has comment: http://stackoverflow.com/comment/43533854
has body: What happens when you have a single character string ("a" for example) and you do this? String str = "a"; int wordLength = str.length(); str.charAt(wordLength - 2); Since wordLength = 1, wordLength-2 = -1 which isn't a valid index into a String. The same problem would come up if you did this: String str = ""; int wordLength = str.length(); str.charAt(wordLength - 2); OR str.charAt(wordLength - 1); Since wordLength = 0 What you need to do is check your wordLength before you continue: int wordLength = input.length(); if(wordLength &gt;= 5) { // find last letters // do your check/replacement }
has comment: http://stackoverflow.com/comment/43537098
has comment: http://stackoverflow.com/comment/43537173
downvote count: 0
has comment: http://stackoverflow.com/comment/43533840
has comment: http://stackoverflow.com/comment/43605976
answers question: http://stackoverflow.com/q/27553455
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43555645
has comment: http://stackoverflow.com/comment/43534214
has comment: http://stackoverflow.com/comment/43534052

import
type: Tag
tags question: http://stackoverflow.com/q/27578214
tags question: http://stackoverflow.com/q/27602489
tag name: import
tags question: http://stackoverflow.com/q/27563625
tags question: http://stackoverflow.com/q/27613221
tags question: http://stackoverflow.com/q/27530814
tags question: http://stackoverflow.com/q/27538626

http://stackoverflow.com/q/27476676
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/27476768
favorite count: 0
tagged with: multidimensional-array
has title: Java 2-D selection sort
type: AnsweredQuestion
tagged with: java
downvote count: 2
has body: I am preparing for an exam, and we are likely to be tasked with sorting a two dimensional array of ints. Sorted meaning the first row, first column is the lowest and the last row, last column is the highest. I approached the task by creating a 1-D array, and then populating it with all the values in the 2d array. Then, I passed it through a sorting method. Finally, I wrote each value of the sorted array back into the 2d array and returned it. This sort of worked, as you can see from the output below. I am confused as to where my process is breaking down, I would appreciate any input. Input: int[][] nums = {{1,5,9},{8,9,3},{0,7,6}}; output: 0 0 0 0 0 0 0 0 1 public int[][] sort2D(int[][]nums){ int[] temp = new int[((nums.length+1)*(nums.length+1))];//make one long array for(int i =0; i&lt;nums.length; i++){ //populate int counter = 0; //indices for long array for(int j = 0; j&lt;nums[i].length; j++){ System.out.println(temp[counter]); temp[counter] = (int)nums[i][j]; counter++; } } temp = sort(temp); //sort it (verified code) for(int i = 0; i&lt;nums.length; i++){ //reverse the above process int counter = 0; for(int j = 0; j&lt;nums.length; j++){ nums[i][j] = temp[counter]; counter++; } } return nums; }
upvote count: 1
has answer: http://stackoverflow.com/a/27476768
type: Question
score: -1
tagged with: sorting

http://stackoverflow.com/comment/43640293
has text: possible duplicate of [Spring security - org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined](http://stackoverflow.com/questions/14800523/spring-security-org-springframework-beans-factory-nosuchbeandefinitionexceptio) and [Spring Security: No bean named 'springSecurityFilterChain' is defined](http://stackoverflow.com/questions/27600899/spring-security-no-bean-named-springsecurityfilterchain-is-defined)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27608802

http://stackoverflow.com/a/27507248
has comment: http://stackoverflow.com/comment/43478242
answers question: http://stackoverflow.com/q/27500682
downvote count: 0
has comment: http://stackoverflow.com/comment/43496186
score: 1
has comment: http://stackoverflow.com/comment/43496270
has comment: http://stackoverflow.com/comment/43496149
has body: First, the parent of your RelativeLayout is probably not another RelativeLayout, and therefore you should not be trying to set the RelativeLayout's LayoutParams to be an instance of RelativeLayout.LayoutParams. Second, rewrite this as an XML layout and inflate it. Your RelativeLayout has a better chance of working then, as it will know its parent at inflation time. RelativeLayout is a finicky beast. Another option would be to switch away from RelativeLayout to something else that can do your centering, such as a FrameLayout.
has comment: http://stackoverflow.com/comment/43473327
has comment: http://stackoverflow.com/comment/43473130
upvote count: 1
has comment: http://stackoverflow.com/comment/43496502
type: Answer

http://stackoverflow.com/a/27631896
answers question: http://stackoverflow.com/q/27631880
has comment: http://stackoverflow.com/comment/43684007
has body: Static initializers are executed as soon as the class is loaded. The main method is called after the class has been loaded. This section of the JLS discusses the sequence of events (12.1.3-4): 12.1.3. Initialize Test: Execute Initializers In our continuing example, the Java Virtual Machine is still trying to execute the method main of class Test. This is permitted only if the class has been initialized (§12.4.1). Initialization consists of execution of any class variable initializers and static initializers of the class Test, in textual order. But before Test can be initialized, its direct superclass must be initialized, as well as the direct superclass of its direct superclass, and so on, recursively. In the simplest case, Test has Object as its implicit direct superclass; if class Object has not yet been initialized, then it must be initialized before Test is initialized. Class Object has no superclass, so the recursion terminates here. 12.1.4. Invoke Test.main Finally, after completion of the initialization for class Test (during which other consequential loading, linking, and initializing may have occurred), the method main of Test is invoked.
type: Answer
score: 8
downvote count: 0
upvote count: 8
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27631880

http://stackoverflow.com/comment/43482912
type: Comment
type: QuestionComment
has text: @xgdgsc Been doing research and you are correct will be changing, any of the two you recommend as a beginner?
comment on: http://stackoverflow.com/q/27526794
score: 0

http://stackoverflow.com/comment/43638337
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27551766
has text: yes, but when the type of key I want to serialize and de-serilize IS a generic type, although in reality it is String. In fact, I have found a way: after getting String keyStr = jp.getCurrentName(), create a another string jsonStr = "{\"key\":\"" + KeyStr + "\"}"; and then User user = mapper.readValue(jsonStr, User.class);K key = (K)user.key; besides, I have to define a classUser<K> {public K key}.

http://stackoverflow.com/q/27484941
has body: I am trying to run a bash script file from java code in ubuntu. But the commands are not running. Following is the bash file(batch.bash) located at /home/uttam/downloads/ #!/bin/bash convert rose.jpg rose.png I have installed imagemagick for image conversion, when I run above command from terminal it works perfectly fine. Below is the java code in eclipse which calls the bash file - public class imageConvert { /** * @param args * @throws IOException * @throws InterruptedException */ public static void main(String[] args) throws IOException, InterruptedException { String[] a = {"/bin/bash", "-c","/home/uttam/Downloads/batch.bash"}; List cmdAndArgs = Arrays.asList(a); ProcessBuilder pb = new ProcessBuilder(cmdAndArgs); pb.directory(new File("/home/uttam/Downloads/batch.bash")); Process p = null; p = pb.start(); p.waitFor(); } } It would be really helpful if anyone can tell me what problem is causing the commands to not run. Is this the folder permission issue or java code syntax issue? Thanks in Advance!!
has comment: http://stackoverflow.com/comment/43403715
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/43401987
has comment: http://stackoverflow.com/comment/43402260
tagged with: bash
has comment: http://stackoverflow.com/comment/43402335
tagged with: terminal
tagged with: processbuilder
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/43402021
score: 0
tagged with: java
has title: Running Bash Script files from java code in ubuntu
has comment: http://stackoverflow.com/comment/43402846
type: Question
has comment: http://stackoverflow.com/comment/43402801

http://stackoverflow.com/comment/43436662
comment on: http://stackoverflow.com/a/27503245
has text: in registerReceiver you have mentioned this.yourservice i didn't get this part...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43671987
score: 0
type: QuestionComment
type: Comment
has text: Request probably timed out, your thread is runnable.
comment on: http://stackoverflow.com/q/27620533

http://stackoverflow.com/comment/43388496
type: Comment
type: QuestionComment
has text: You throw exceptions, not numbers. Something like `throw new NullPointerException()` I [googled](https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1KMZB_enUS562US562&ion=1&espv=2&ie=UTF-8#safe=off&q=throw%20exception) for "throw exception" and the very first link was [How To Throw Exceptions](https://docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html).
score: 6
comment on: http://stackoverflow.com/q/27477281

http://stackoverflow.com/a/72250176
type: Answer
has body: Probably the Maven version you are using does not support the Java version you installed. I fixed the issue by installing the latest version of Maven using SDK man: sdk install maven Source: https://sdkman.io/sdks#maven
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/128853554
answers question: http://stackoverflow.com/q/27481953
downvote count: 0

http://stackoverflow.com/q/27513278
has title: how to control multiple JComboBoxes in java?
has body: I have trouble with setting up 12 comboboxes on a JDialog. The first 4 are the gender of 4 individuals. The second 4 are their personality types. The third 4 are their job titles. How come when I change the 1st person's gender combobox, the 2nd, 3rd, 4th gender comboboxes are all being changed at the same time? Why are they "linked" together? I already have separate ActionListeners for each? The same thing with the personality comboboxes and the job comboboxes. See attached pic. What do I need to do to severe whatever linking them? Also, Eclipse forces me to use "final" keyword on my customized JComboBoxMW. Note that JComboBoxMW is nothing fancy. just extending the JComboBox class with better mouse wheel control. See a portion of code below: public void setUpCrewGender() { List&lt;String&gt; genderList = new ArrayList&lt;String&gt;(2); genderList.add("M"); genderList.add("F"); genderComboBoxModel = new DefaultComboBoxModel&lt;String&gt;(); Iterator&lt;String&gt; i = genderList.iterator(); while (i.hasNext()) { String s = i.next(); genderComboBoxModel.addElement(s); } final JComboBoxMW&lt;String&gt; g1 = new JComboBoxMW&lt;String&gt;(genderComboBoxModel); g1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e1) { String s1 = (String) g1.getSelectedItem(); g1.setSelectedItem(s1); }}); g1.setMaximumRowCount(2); listPane.add(g1); final JComboBoxMW&lt;String&gt; g2 = new JComboBoxMW&lt;String&gt;(genderComboBoxModel); g2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e2) { String s2 = (String) g2.getSelectedItem(); g2.setSelectedItem(s2); }}); g2.setMaximumRowCount(2); listPane.add(g2); final JComboBoxMW&lt;String&gt; g3 = new JComboBoxMW&lt;String&gt;(genderComboBoxModel); g3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e3) { String s3 = (String) g3.getSelectedItem(); g3.setSelectedItem(s3); }}); g3.setMaximumRowCount(2); listPane.add(g3); final JComboBoxMW&lt;String&gt;…
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27513488
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27513488
possible better answer: http://stackoverflow.com/a/27513498
score: 0
has answer: http://stackoverflow.com/a/27513498
tagged with: combobox

http://stackoverflow.com/comment/43482033
has text: This would be possible, but in my opinion very complicated. You would have to get the ClassLoader of the WebApp, use a URLClassLoader with the webapp ClassLoader as parent. Or in other words: You need to implement your own deployment mechanism.
score: 1
comment on: http://stackoverflow.com/q/27526714
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27616540
tagged with: java
type: Question
has title: textView.setText is not working in compound view
answer count: 2
accepted answer: http://stackoverflow.com/a/27617723
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/27616726
has answer: http://stackoverflow.com/a/27616726
has answer: http://stackoverflow.com/a/27617723
has body: textView.setText is not working properly in a compound view. Means Both hello and jack are appearing... and jack is displayed below layout not appearing if I put some background color,... Could somebody help... Thanks and regards... Here is my code... Layout.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/chatLayout" android:layout_width="300dp" android:layout_height="400dp" &gt; &lt;TextView android:id="@+id/chatNamed" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Hello" android:textColor="#ffffff" android:textSize="20dp" android:textStyle="bold" android:layout_marginTop="10dp" android:layout_marginLeft="10dp" /&gt; &lt;/RelativeLayout&gt; CompoundView.java public class ChatCompoundView extends RelativeLayout { private static TextView zoneName; public ChatCompoundView(Context context) { this(context, null); setView(); } public ChatCompoundView(Context context, AttributeSet attrs) { this(context, attrs, 0); setView(); } public ChatCompoundView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setView(); } public void setView() { inflate(getContext(), R.layout.chat_layout, this); zoneName = (TextView) findViewById(R.id.chatNamed); } zoneName.setText("jack"); }
has comment: http://stackoverflow.com/comment/43654586
type: AnsweredQuestion

http://stackoverflow.com/q/27631830
answer count: 5
tagged with: reverse
accepted answer: http://stackoverflow.com/a/27632046
has body: Given a string: "This is a test" I wrote a program to reverse the words in the string, so I get an output of: "test a is this" This is my code in java: public class stringreversals { public static void main(String[] args){ String str = "This is a test"; System.out.println(str); reverseWordInAString(str); System.out.println(str); } static void reverseWordInAString(String str){ char[] array = str.toCharArray(); int length = array.length; reverseString(array, 0, length-1); int i=0, start=0; while(i&lt;=length){ if(array[i]!=' '){ i++; } else{ reverseString(array, start, i-1); start = i+1; } } } static void reverseString(char[] array, int start, int end){ int i=0, j=0; char c; for(i = start, j =end; i&lt; j; i++, j--){ c = array[i]; array[i] = array[j]; array[j] = c; } } } Every time I run it, it just prints the first string, but doesn't print the second one for some reason.
has answer: http://stackoverflow.com/a/27631918
has comment: http://stackoverflow.com/comment/43683887
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27631893
has comment: http://stackoverflow.com/comment/43684032
has title: Why isn't my code printing anything while I am attempting to reverse the words in a string
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/27632046
has answer: http://stackoverflow.com/a/27631939
possible better answer: http://stackoverflow.com/a/27631893
type: Question
has comment: http://stackoverflow.com/comment/43684010
upvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/27631877

http://stackoverflow.com/q/27563502
has body: I setup a selenium grid and added a chrome, an ie and two firefox (esr and current). It seems to me that setup and the calling code is correct, but the grid/node ignores my browser version for firefox. I setup two browsers in one node: -browser browserName=firefox,version=34,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe,firefox_profile=standard -browser browserName=firefox,version=31,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox ESR\firefox.exe,firefox_profile=esr They show up as version 31 and 34 in the grid. The node logs says they were added: 10:09:21.107 INFO [1] org.openqa.grid.common.RegistrationRequest - Adding browserName=firefox,version=34,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe,firefox_profile=standard 10:09:21.109 INFO [1] org.openqa.grid.common.RegistrationRequest - Adding browserName=firefox,version=31,maxInstances=5,firefox_binary=C:\Program Files (x86)\Mozilla Firefox ESR\firefox.exe,firefox_profile=esr When calling the grid with version 31 and 34 both requests are referred to the version 34 instance. From the Grid log: 10:10:38.865 INFO [13] org.openqa.grid.web.servlet.handler.RequestHandler - Got a request to create a new session: Capabilities [{browserName=firefox, version=31, platform=VISTA}] 10:10:38.866 INFO [10] org.openqa.grid.internal.ProxySet - Available nodes: [host :http://sel-node:5555] 10:10:38.866 INFO [10] org.openqa.grid.internal.BaseRemoteProxy - Trying to create a new session on node host :http://sel-node:5555 10:10:38.866 INFO [10] org.openqa.grid.internal.TestSlot - Trying to create a new session on test slot {firefox_binary=C:\Program Files (x86)\Mozilla Firefox\firefox.exe, seleniumProtocol=WebDriver, browserName=firefox, maxInstances=5, version=34, platform=VISTA, firefox_profile=standard} 10:10:39.388 INFO [35] org.openqa.grid.web.servlet.handler.RequestHandler - Got a request to create a new session: Capabilities [{browserName=f…
type: Question
has title: Selenium ignores browser version
tagged with: selenium-firefoxdriver
tagged with: selenium-grid
score: 0
has comment: http://stackoverflow.com/comment/43553104
has comment: http://stackoverflow.com/comment/44519013
has comment: http://stackoverflow.com/comment/43553326
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44513181
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium

http://stackoverflow.com/comment/43611939
has text: I know what you mean, but this does not seem to help. If I create 2 additional threads, #1 for timeout and #2 for reading stdout, thread #2 does not receive the relevant exception.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27568683
type: Comment

http://stackoverflow.com/q/27503920
tagged with: jsp
has comment: http://stackoverflow.com/comment/43437954
score: 0
has answer: http://stackoverflow.com/a/28248517
answer count: 1
has comment: http://stackoverflow.com/comment/43438609
has body: Help me out i have an issue with the jasper report over a servlet, error is mentioned below SEVERE: Allocate exception for servlet JaspersJob_servlet java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRRuntimeException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149) at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source) Servlet code: package jasper_job_Print; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.sql.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.design.JRDesignQuery; import net.sf.j…
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/28248517
tagged with: java
has comment: http://stackoverflow.com/comment/43480616
downvote count: 1
tagged with: servlets
type: Question
tagged with: jasper-reports
has title: Not able to display a Jasper report on the browser , Allocate exception for servlet JaspersJob_servlet java.lang.ClassNotFoundException

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/27492292
type: Tag
tags question: http://stackoverflow.com/q/27547263
tags question: http://stackoverflow.com/q/27520572
tags question: http://stackoverflow.com/q/27632605
tags question: http://stackoverflow.com/q/27527156
tags question: http://stackoverflow.com/q/27635522
tags question: http://stackoverflow.com/q/27622625
tags question: http://stackoverflow.com/q/27575059
tags question: http://stackoverflow.com/q/27609720

http://stackoverflow.com/comment/43590226
has text: Maybe you can add a short explanation why you suspect a leak in this code. Sure, memory usage will increase by the usage of lots of strings, but if they are all garbage collected later on, it's just not really a leak.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27582765
type: Comment

http://stackoverflow.com/comment/43496752
type: QuestionComment
comment on: http://stackoverflow.com/q/27534003
score: 1
type: Comment
has text: If you have a cursor in your super class, check if it having any data, before using the cursor object. if (cursor.moveToFirst()){ // if cursor contains data, the first object; then do your job here }

http://stackoverflow.com/comment/43516368
type: Comment
comment on: http://stackoverflow.com/a/27532320
has text: @BasilBourque Yes. But in SQL We can use java.sql.Date instead of java.util.Date. sql date only contain date-only. So We can use java.sql.TimeStamp for java.util.Date. java.util.Date can be used other sql purpose.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27574192
upvote count: 1
has comment: http://stackoverflow.com/comment/43574011
favorite count: 0
has body: I am very new in JSON parsing with JACKSON, Little about what I am trying to achieve - I have to parse the JSON values and collect it to compare the collected values with Live content which I am retrieving using selenium, I have used genson to create object classes for json. JsonGen.java of my program - import java.util.List; public class JsonGen{ private String _type; private List cast; private List clips; private Common_sense_data common_sense_data; private String common_sense_id; private List crew; private String description; private List episodes; private Number franchise_id; private List genres; private String guid; private Images images; private boolean is_locked; private boolean is_mobile; private boolean is_parental_locked; private String kind; private String mobile_networks; private String most_recent_full_episode_added_date; private String name; private List networks; private String platforms; private List ratings; private String release_date; private List season_filters; private String slug; private String tms_id; import java.util.List; public class Cast{ private String first_name; private String last_name; private String middle_name; public String getFirst_name(){ return this.first_name; } public void setFirst_name(String first_name){ this.first_name = first_name; } public String getLast_name(){ return this.last_name; } public void setLast_name(String last_name){ this.last_name = last_name; } public String getMiddle_name(){ return this.middle_name; } public void setMiddle_name(String middle_name){ this.middle_name = middle_name; } } import java.util.List; public class Clips{ private String description; private boolean is_locked; private boolean is_parental_locked; private Number run_time; private String slug; private List streams; private String thumbnail_url; private String title; public String getDescription(){ return this.description; } public void setDescription(String description){ this.description = description; } public boolean getIs_locked(){ ret…
accepted answer: http://stackoverflow.com/a/27574467
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27574287
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: selenium
has answer: http://stackoverflow.com/a/27574287
has answer: http://stackoverflow.com/a/27574467
type: Question
tagged with: jackson
score: -1
has title: Can not deserialize instance of JsonGen out of START_ARRAY token : newbee
answer count: 2
downvote count: 2

http://stackoverflow.com/a/60530369
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27580714
has body: Here are possible approaches: Use Lombok's @Delegate Use Kotlin's delegation support Use Java's default interface methods (looks uglier than 1 and 2)
accepted answer of: http://stackoverflow.com/q/27580714
score: 0

http://stackoverflow.com/comment/66704436
comment on: http://stackoverflow.com/a/27603609
has text: Ah that makes sense. For anyone else who is curious I had to add .put("transport.tcp.connect_timeout", "5s") to change my timeout
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/q/27556334
has body: What I am doing wrong? Thank you! Libs: http://cs621531.vk.me/v621531427/4ebb/vU1vHpBjyhQ.jpg sorry, it's uncutted. Pom: http pastebin.com/7rSWG89Q Full stacktace: http://pastebin.com/uwQsnwGn @Cacheable(value = "servicesByCategoryId", key = "T(java.lang.String).valueOf(#id).concat('-').concat(" + "T(java.lang.String).valueOf(#page)).concat('-').concat(T(java.lang.String).valueOf(#perPage))" + ".concat('-').concat(#orderBy).concat('-').concat(#order)") <beans xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cache="http://www.springframework.org/schema/cache" xmlns="http://www.springframework.org/schema/beans" 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/cache http://www.springframework.org/schema/cache/spring-cache.xsd"> <context:annotation-config/> <context:component-scan base-package="com.vse.uslugi"/> <cache:annotation-driven key-generator="enhancedDefaultKeyGenerator"/> <bean id="enhancedDefaultKeyGenerator" class="...utilities.generators.EnhancedDefaultKeyGenerator"/> <dependency> net.sf.ehcache ehcache 2.9.0 provided </dependency
favorite count: 0
has answer: http://stackoverflow.com/a/27556813
accepted answer: http://stackoverflow.com/a/27556813
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 1
has title: java.lang.NoClassDefFoundError: Could not initialize class net.sf.ehcache.config.ConfigurationFactory
upvote count: 1

http://stackoverflow.com/a/33085996
answers question: http://stackoverflow.com/q/27483442
upvote count: 7
has comment: http://stackoverflow.com/comment/55381896
type: AcceptedAnswer
type: Answer
has body: UPDATE The latest version of dropwizard supports logging configurations out of the box I ran into the same issue trying to set up Dropwizard (0.8.4) with a separate files. I ran into the same issue. So I dug a bit deeper and found a solution for me (not the cleanest but I couldn't seem to get that working differently). The issue is that LoggingFactory#configure automatically adds every appender to root. This is not very ideal so it needed overwriting. What I did was: Overwrite LoggingFactory. This is slightly messy since there is a few things that need to be copied sadly :( Here is my implementation: import java.io.PrintStream; import java.lang.management.ManagementFactory; import java.util.Map; import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; import org.slf4j.LoggerFactory; import org.slf4j.bridge.SLF4JBridgeHandler; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.logback.InstrumentedAppender; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.PatternLayout; import ch.qos.logback.classic.jmx.JMXConfigurator; import ch.qos.logback.classic.jul.LevelChangePropagator; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Appender; import ch.qos.logback.core.util.StatusPrinter; import io.dropwizard.logging.AppenderFactory; import io.dropwizard.logging.LoggingFactory; public class BetterDropWizardLoggingConfig extends LoggingFactory { @JsonIgnore final LoggerContext loggerContext; @JsonIgnore final PrintStream configurationErrorsStream; @JsonPro…
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/27483442

http://stackoverflow.com/a/27492484
type: Answer
answers question: http://stackoverflow.com/q/27488567
has body: Looks like this Eclipse JDT bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=439889
has comment: http://stackoverflow.com/comment/43418526
score: 0

http://stackoverflow.com/comment/43662553
comment on: http://stackoverflow.com/q/27620411
type: Comment
has text: have for an instance Broker class with a method that will to your query and result set operations...and then call the dialog with a parameter set to be the result of the previous function.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43526748
has text: @mbomb007 X, O and E are constants int he enum Player. E represents an empty square.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27549969
score: 0

http://stackoverflow.com/q/27575968
has body: i am using java to draw ovals and connect them by lines , when i scan variables the paint function doesn't work at all import java.awt.Color; import javax.swing.JFrame; import java.awt.Graphics; import java.awt.Paint; import java.util.Random; import java.util.Scanner; import javax.swing.JOptionPane; public class Main extends JFrame { public Main (){ setTitle("Graph"); setSize(1000, 1000); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void paint (Graphics g,int x,int z,int y) { g.fillOval(x, x+20, 40, 40); g.drawLine(x+10, x+50,x+z+10, z+30); g.fillOval(x+z, z, 40, 40); } public static void main(String[] args) { Scanner scan=new Scanner(System.in); int x = scan.nextInt(); int z =scan.nextInt(); int y =scan.nextInt(); x=x+1; z=z+1; y=y+1; Main m=new Main(); Graphics g=m.getGraphics(); m.paint(g, x, z, y); } }
has comment: http://stackoverflow.com/comment/43577439
tagged with: swing
has comment: http://stackoverflow.com/comment/43577706
accepted answer: http://stackoverflow.com/a/27576129
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43577462
has comment: http://stackoverflow.com/comment/43577429
tagged with: java
type: Question
answer count: 2
downvote count: 4
upvote count: 0
tagged with: user-interface
has answer: http://stackoverflow.com/a/27576259
has comment: http://stackoverflow.com/comment/43577435
score: -4
favorite count: 0
has answer: http://stackoverflow.com/a/27576129
has title: java paint function doesn't work
possible better answer: http://stackoverflow.com/a/27576259

http://stackoverflow.com/comment/80339998
has text: IabHelper is now obsolete and should no longer be used. Google released a BillingClient library: https://developer.android.com/google/play/billing/billing_library.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27480819

http://stackoverflow.com/comment/43506413
has text: In both Java and C++, alternatives include: 1) defining a protected or public setter method in the superclass, and 2) defining and consistently using a getter method [in C++, declared `virtual`], which can be overridden by a subclass.
comment on: http://stackoverflow.com/a/27532690
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43784494
has text: Strings from parsing json
comment on: http://stackoverflow.com/a/27580968
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27503766
has comment: http://stackoverflow.com/comment/43473350
type: UnansweredQuestion
tagged with: postgresql
has comment: http://stackoverflow.com/comment/43438358
type: Question
has comment: http://stackoverflow.com/comment/43439076
has comment: http://stackoverflow.com/comment/43444756
has answer: http://stackoverflow.com/a/27507120
answer count: 1
has body: I have a column "name" in database with unique constraint. I'm trying to handle database exception, to catch it, and return user friendly message to the user. Problem is with type of exception. Cause of Exception is org.postgresql.util.PSQLException But when I get exception (top Exception is javax.ejb.EJBTransactionRolledbackException) it can't be recognised as PSQLException. After some research I found that, and tried to se why I can't get "PSQLException" so I put a code like this: //code with saving row to database } catch (javax.ejb.EJBTransactionRolledbackException e) { try { int a = ((PSQLException)TisUtil.getRootError(e)).getErrorCode(); addMessageWarn("That name already exists"); } catch (Exception ex) { addmessageError(ex); } } The goal is to see why Java doesn't catch PSQLException. So, program goes into section with EJBTransactionRolledbackException. GetRootError method finds a root cause which is PSQLException, but it can't cast it. Exception ex looks like this: ClassCastException", detailMessage: "org.postgresql.util.PSQLException cannot be cast to org.postgresql.util.PSQLException". I'm using Jboss, wildfly 8.0, Persistance 2.0, PostgreSQL.
tagged with: jsf
score: 0
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/43438041
has title: Catching unique constraint exception in JSF

http://stackoverflow.com/comment/43606756
comment on: http://stackoverflow.com/a/27528035
type: Comment
has text: @fge yes, they are in classpath
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43446530
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27508152
type: Comment
has text: @Christian.tucker your question should include a **working** minimal example. If you don't know what causes the problem, how can you know what details are irrelevant for it?

http://stackoverflow.com/q/27571772
has comment: http://stackoverflow.com/comment/43635858
type: Question
has comment: http://stackoverflow.com/comment/43570629
has body: I am implementing an Applet which needs to access to file system and I need to show to user mock/fake files under mypc or userhome. There is a way to do it using JFileChooser with FileSystemView: This is a short example for Windows OS: JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSystemView(new FileSystemView() { @Override public File createNewFolder(File containingDir) throws IOException { //do something, not important here return null; } @Override public File[] getFiles(File dir, boolean useFileHiding) { File[] files = super.getFiles(dir, useFileHiding); // my pc -&gt; desktop -&gt; null if (dir.getParentFile() == null || dir.getParentFile().getParentFile() != null) { return files; } List&lt;File&gt; newFiles = new ArrayList(Arrays.asList(files)); newFiles.add(new File("Custom_File_1")); newFiles.add(new File("Custom_File_2")); return newFiles.toArray(new File[newFiles.size()]); } }); But the issue is that JFileChooser does not work properly on Mac OS. There is no ability to navigate into any subdirectory, move up from the current directory. Here is a similar problem: JFileChooser for directories on the Mac: how to make it not suck? (I switched off DIRECTORIES_ONLY mode, but it did not help) Now I am trying to use FileDialog, but there is another problem: I can not find a way to show mock/fake files under mypc or userhome (like FileSystemView). The question is: Is there an ability to fix JFileChooser in MAC OS? Or add mock/fake files into specific directory using FileDialog?
has title: FileDialog mock files
downvote count: 0
tagged with: macos
has comment: http://stackoverflow.com/comment/43586217
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/43659483
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/1356273
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43666398
tagged with: jfilechooser

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/27527751
tags question: http://stackoverflow.com/q/27560989
tag name: session-timeout

http://stackoverflow.com/comment/43474917
comment on: http://stackoverflow.com/q/27522936
has text: @TheLostMind Oops! could u suggest me how to handle this. I'm iterating the same hundreds of million times
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43485722
type: Comment
comment on: http://stackoverflow.com/q/27528455
type: QuestionComment
has text: Is EntityManager the only Autowired field in that class?
score: 0

http://stackoverflow.com/a/27484147
answers question: http://stackoverflow.com/q/27484022
has comment: http://stackoverflow.com/comment/43401527
has comment: http://stackoverflow.com/comment/43400897
score: 0
upvote count: 1
has body: With a collection of a generic type ? extends E, it is not legal to add new elements as the compiler cannot verify the exact type of the collection that your variable points to. Instead, the compiler can only tell that the collection represents any collection of subtypes of E. Thus: Collection&lt;? extends Something&gt; collection = ... collection.add(new Something()); does not compile. With your version of a DownCastCollection, the example would compile but instead throw a runtime exception. You migrate a compile-time error to become a runtime error. This is not a good idea as it introduces potential errors to your application that your compiler could otherwise catch. The only reason when casting a generic collection makes sense would be when you for some reason know the actual type of the collection but you were not able to express this by your program's types. Better that a cast is normally to create a new collection: Collection&lt;? extends Something&gt; collection = ... Collection&lt;Something&gt; other = new HashSet&lt;&gt;(collection);
downvote count: 1
has comment: http://stackoverflow.com/comment/43401860
has comment: http://stackoverflow.com/comment/43420429
type: Answer

http://stackoverflow.com/comment/43399893
type: AnswerComment
type: Comment
has text: That's teh reason I only printed element at index `1`.
comment on: http://stackoverflow.com/a/27483808
score: 0

http://stackoverflow.com/comment/43408098
type: Comment
comment on: http://stackoverflow.com/q/27488149
type: QuestionComment
has text: NO one should be using a JVM that old anymore.
score: 1

http://stackoverflow.com/comment/43653010
comment on: http://stackoverflow.com/q/27611108
has text: May you share your exact error log? I also improved answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27480181
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27480497
has answer: http://stackoverflow.com/a/27480405
tagged with: java
tagged with: file
has body: I have special scenario, in which I am trying to read a file in two while loops . in second loop it reads the file from egining, but I want to read the file where the first while stops reading the file. Here is my code stuff: while ((line = br.readLine()) != null) { if (line.startsWith(rootId.trim())) { break; } } while (!(line = br.readLine()).contains("---------------------------------------------------")) { // my other code stuff } Here my file stores data as follow, ----------------------------------------------------- 00001# // this is the rootId N1 N2 ----------------------------------------------------- 00002# N1 N2 ----------------------------------------------------- 00003# N1 N2 This method takes rootId and displays Nodes(N1,N2) and my other stuff. Here my stratergy is to read the file untill I get the rootId after that in another loop untill I get a line (--------) doing my stuff. but in next loop it again starts reading the file from begining . How to solve this. can any help me in this.
has comment: http://stackoverflow.com/comment/43422266
type: Question
has comment: http://stackoverflow.com/comment/43393588
has comment: http://stackoverflow.com/comment/43393500
has comment: http://stackoverflow.com/comment/43393590
has title: How to read a text file for particular kind of data?
score: 0
has comment: http://stackoverflow.com/comment/43393541
answer count: 2
has comment: http://stackoverflow.com/comment/43393862
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/43393570
tagged with: while-loop

http://stackoverflow.com/q/27604470
has answer: http://stackoverflow.com/a/27604881
has body: I want to update jlabel and jtextfield with setText() method but it is not working. However, rest of the code is working. The code is below; btnDosyaSe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int kullaniciSecimi = jfc.showOpenDialog(null); if (kullaniciSecimi == JFileChooser.APPROVE_OPTION) { File fileName = jfc.getSelectedFile(); textField.setText(fileName.getPath()); islemSureci.setText("Veriler Okunuyor..."); try { ArrayList&lt;ArrayList&lt;String&gt;&gt; tumYazılar = rwd.readTXT(fileName.getPath()); String[] yazarlar = rwd.yazarlar(fileName.getPath()); islemSureci.setText("Veriler Okundu! Öznitelik çıkarımına başlandı..."); oznitelikler = oc.oznitelikleriBul(tumYazılar, yazarlar); islemSureci.setText("Öznitelikler Çıkarılmıştır!"); //String text = readTXT(fileName); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }); In here, islemSureci is JLabel and textFiled is JTextField. When they are set, it is not working. After all the work finish in the code, they appear. Please can you tell what is the reasons?
has answer: http://stackoverflow.com/a/27607472
type: AnsweredQuestion
tagged with: jlabel
type: Question
accepted answer: http://stackoverflow.com/a/27607472
has title: JLabel and JTextField setText is not update
tagged with: swing
linked to: http://stackoverflow.com/q/782265
has answer: http://stackoverflow.com/a/37681230
tagged with: java
score: 0
answer count: 3
tagged with: jtextfield
possible better answer: http://stackoverflow.com/a/27604881

http://stackoverflow.com/a/27546523
answers question: http://stackoverflow.com/q/27543633
score: 0
has body: just read the stream regularly and save it into a regular String, then parse that String : // to get the general object that contains all the values JSONObject json = new JSONObject(json_readed); JSONObject response = json.getJSONObject("responsejson"); // to get the values List&lt;JSONArray&gt; all_values = new ArrayList&lt;JSONArray&gt;(); Iterator&lt;?&gt; keys = response.keys(); while( keys.hasNext() ){ String value = (String)keys.next(); if( response.get(value) instanceof JSONArray ){ all_values.add(response.getJSONArray(value)); } } now you have all the values(whatever what's it's name id) combined into that ArrayList called(all_values). Note that the JSON you provided in your question is missing opening"{" and closing"}" brackets in the beginning and the ending of it.
type: Answer

http://stackoverflow.com/comment/43427772
comment on: http://stackoverflow.com/a/27498228
type: Comment
has text: I am just proposing an alternative better suited to the purpose of Enumerations. Moreover, I think someone should have done it at least for other people who can get to this question via Google so that people see what better alernatives exist. Don't agree with the down vote sorry
score: 2
type: AnswerComment

http://stackoverflow.com/q/27503284
type: Question
has comment: http://stackoverflow.com/comment/43437109
answer count: 1
linked to: http://stackoverflow.com/q/20640157
downvote count: 0
has title: Java 8 Streams, perform part of the work as parallel stream and the other as sequential stream
has answer: http://stackoverflow.com/a/27504780
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/43437343
tagged with: java-8
has comment: http://stackoverflow.com/comment/43439325
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27504780
tagged with: java-stream
has comment: http://stackoverflow.com/comment/69118512
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43436682
has comment: http://stackoverflow.com/comment/43441008
has comment: http://stackoverflow.com/comment/43438701
has body: I have a stream performing a series of operations in parallel, then I have to write the results into a file, so I need the writing operation to be sequential, but it needs to be performed as a stream, I have lots of data to write, I cannot use an intermediate collection. Is there a way to do that? I thought to a solution that doesn't seem very clean, that is to make the writing method synchronized. Is this approach the only possible? is there some other way? Thank you.

http://stackoverflow.com/a/27542781
has comment: http://stackoverflow.com/comment/43530908
has comment: http://stackoverflow.com/comment/43523235
upvote count: 6
accepted answer of: http://stackoverflow.com/q/27542699
answers question: http://stackoverflow.com/q/27542699
type: AcceptedAnswer
has body: You've written the object twice, but only read back the first one. So if two copies of the object were written, you'd need to add a second read to see the second copy. It would also probably be a good idea to close the output before you read from the file, to ensure buffers are flushed. But all that said: ObjectOutputStream only writes a given object once, and then subsequent writes of that same object write references to it, not a second copy of it. From the documentation: The default serialization mechanism for an object writes the class of the object, the class signature, and the values of all non-transient and non-static fields. References to other objects (except in transient or static fields) cause those objects to be written also. Multiple references to a single object are encoded using a reference sharing mechanism so that graphs of objects can be restored to the same shape as when the original was written. The idea is that you'll serialize object graphs all at once. Mutating the object graph during serialization is a pretty odd thing to do. I can't find any documentation saying it isn't supported, but adding a second read to your project still shows "Test" rather than "Test123", so... To write out two separate Human objects, you'll need to create a second one before writing: import java.io.*; public class Human implements Serializable { private int age; private String name; public void setAge(int a) { this.age = a; } public void setName(String n) { this.name = n; } public String toString() { return "[Human " + this.age + ", " + this.name + "]"; } public static void main(String args[]) throws FileNotFoundException, IOException, ClassNotFoundException { try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("data.txt")))) { Human human = new Human(); human.setAge(21); human.setName("Test"); System.out.println("Human : " + human); oos.writeObject(human); human = new Human(); // &lt;== Change human.setAge(21); // &lt;== Change human.…
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/a/54511061
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27553217
has body: GKE lets you create disks to store data and this storage area can be linked to multiple pods.Notice that your cluster and disk must be in same zone/region. gcloud compute disks create disk1 --zone=zone_name now you can use this disk to store data from pods . This is a simple mongodb replicationcontroller yaml file that uses disk1 .This might not be an efficient way but its the simplest one that I know. apiVersion: v1 kind: ReplicationController metadata: labels: name: mongo name: mongo-controller spec: replicas: 1 template: metadata: labels: name: mongo spec: containers: - image: mongo name: mongo ports: - name: mongo containerPort: 27017 hostPort: 27017 volumeMounts: - name: mongo-persistent-storage mountPath: /data/db volumes: - name: mongo-persistent-storage gcePersistentDisk: pdName: disk1 fsType: ext4 disk 1 will exists even your pod get deleted or replaced.

http://stackoverflow.com/a/37211769
answers question: http://stackoverflow.com/q/27561391
has comment: http://stackoverflow.com/comment/91361608
upvote count: 11
type: Answer
downvote count: 0
has body: On the current version of Intellij (2016), you have now a way to reimport older test Result. On the runner tab, click on the button "Import test Results", and select the one you want EDIT : In the latest version, you have a "Recent Tests" action which allow you to see older test result without a need to open the rest windows. Shortcut Ctrl+Shift+Semicolon
score: 11

http://stackoverflow.com/a/27616894
accepted answer of: http://stackoverflow.com/q/27604978
answers question: http://stackoverflow.com/q/27604978
type: Answer
has body: I found a solution for my work the problem at my gml writer version if i changed the version from gml2 to gml3 the problem not seen. and ı changed my parser config. like this org.geotools.xml.Configuration configuration = new org.geotools.gml3.ApplicationSchemaConfiguration("sampleURL", "sample.xsd"); org.geotools.xml.Parser parser = new org.geotools.xml.Parser( configuration );
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/comment/43486597
type: Comment
comment on: http://stackoverflow.com/a/27528035
has text: So, this is a running application, then? Which means the templates you want are in the classpath?
type: AnswerComment
score: 0

http://stackoverflow.com/a/27595673
has comment: http://stackoverflow.com/comment/43619918
type: Answer
has comment: http://stackoverflow.com/comment/43619807
has comment: http://stackoverflow.com/comment/43618222
has comment: http://stackoverflow.com/comment/43616904
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43616310
upvote count: 1
answers question: http://stackoverflow.com/q/27594878
has body: your question seems have nothing to do with Shade plugin. Yes, it will download the transitive dependencies, as long as those dependencies is in the final POM after shading. Yes I believe you can selectively package some dependencies and exclude them in the final POM. However I will not recommend you doing so. I will only recommend using shade plugin to create UBER jar for deployment or Shade dependencies that you really want to be kept internal to your project. Selectively packaging some dependencies in your JAR is going to ruin dependency management mechanism of Maven. Update on why selectively packaging dependencies in JAR will ruin dependency management: For example, you are developing foo-1.0 which depends on bar-2.0 . Now you decided you want to include class of bar-2.0 in your foo-1.0.jar. If someone is depending on your foo-1.0, and he want to use bar-2.1, he is going to fall into a trouble: his application class path will contains classes from bar-2.0 (which is part of foo-1.0) and bar-2.1(which the project is declaring by itself), and you can hardly predict which bar the code is using. Hence one of the use case of shade plugin is to shade the dependencies, for which involves package renaming (i.e. shading as mentioned in my original answer), instead of simply including dependencies in JAR directly.

http://stackoverflow.com/comment/43643887
score: 0
type: AnswerComment
type: Comment
has text: `f.getContentPane().add(f);` appears to be your problem, I think you want `f.getContentPane().add(m);`
comment on: http://stackoverflow.com/a/27610454

http://stackoverflow.com/comment/43688280
comment on: http://stackoverflow.com/a/27634360
score: 0
has text: I already did this from the reading - http://stackoverflow.com/questions/22280229/how-to-monitor-a-java-program-using-jconsole. I add this inside VM arguments, under arguments tab.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43411565
type: Comment
type: QuestionComment
has text: Added the xml and explained more clear
comment on: http://stackoverflow.com/q/27481509
score: 0

http://stackoverflow.com/comment/43479545
type: Comment
type: QuestionComment
has text: I would restructure your database and I would create index by phone number containing user's IDs. It's fast and very effective.
score: 1
comment on: http://stackoverflow.com/q/27521954

http://stackoverflow.com/q/27589701
tagged with: java
has comment: http://stackoverflow.com/comment/43604092
tagged with: date
has answer: http://stackoverflow.com/a/58246805
has answer: http://stackoverflow.com/a/77422795
has answer: http://stackoverflow.com/a/71810802
has comment: http://stackoverflow.com/comment/43603904
has answer: http://stackoverflow.com/a/27589893
downvote count: 0
has answer: http://stackoverflow.com/a/27589769
has body: What i am trying to do:: Show message based on Good morning (12am-12pm) Good after noon (12pm -4pm) Good evening (4pm to 9pm) Good night ( 9pm to 6am) CODE:: I used 24-hr format to get this logic private void getTimeFromAndroid() { Date dt = new Date(); int hours = dt.getHours(); int min = dt.getMinutes(); if(hours&gt;=1 || hours&lt;=12){ Toast.makeText(this, "Good Morning", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=12 || hours&lt;=16){ Toast.makeText(this, "Good Afternoon", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=16 || hours&lt;=21){ Toast.makeText(this, "Good Evening", Toast.LENGTH_SHORT).show(); }else if(hours&gt;=21 || hours&lt;=24){ Toast.makeText(this, "Good Night", Toast.LENGTH_SHORT).show(); } } Question: Is this this best way of doing it, If no which is the best way
favorite count: 0
answer count: 19
has answer: http://stackoverflow.com/a/59891528
has answer: http://stackoverflow.com/a/65300906
has answer: http://stackoverflow.com/a/50602058
has answer: http://stackoverflow.com/a/56542042
tagged with: android
has answer: http://stackoverflow.com/a/46379998
upvote count: 56
has answer: http://stackoverflow.com/a/27589838
has answer: http://stackoverflow.com/a/52272932
has answer: http://stackoverflow.com/a/36714195
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27589786
has answer: http://stackoverflow.com/a/60999949
has answer: http://stackoverflow.com/a/74593068
has answer: http://stackoverflow.com/a/46379428
has comment: http://stackoverflow.com/comment/43603371
score: 56
tagged with: time
has answer: http://stackoverflow.com/a/60254750
accepted answer: http://stackoverflow.com/a/27589769
has answer: http://stackoverflow.com/a/64849946
possible better answer: http://stackoverflow.com/a/52272932
type: Question
has comment: http://stackoverflow.com/comment/99689951
has title: Showing Morning, afternoon, evening, night message based on Time in java

http://stackoverflow.com/a/27601131
upvote count: 3
has comment: http://stackoverflow.com/comment/43628188
has body: Using a database will not reduce memory cost or runtime per itself. However, the default hashmaps may not be what you are looking for, depending on your data types. When used with primitive values such as Integers then java hashmaps have a massive memory overhead. In a HashMap&lt;Integer, Integer&gt;, every entry uses like 24+16+16 bytes. Unused entries (and the hashmap keeps up to half of them unused) take 4 bytes extra. So you can roughly estimate >56 bytes per int->int entry in Java HashMap&lt;Integer, Integer&gt;. If you encode the integers as String, and we're talking maybe 6 digit numbers, that is likely 24 bytes for the underlying char[] array (16 bit characters; 12 bytes overhead for the array, sizes are a multiple of 8!), plus 16 bytes for the String object around (maybe 24, too). For key and value each. So that is then around 24+40+40, i.e. over 104 bytes per entry. (Update: as your keys are 17 characters in length, make this 24+62+40, i.e. 136 bytes) If you used a primitive hashmap such as GNU Trove TIntIntHashMap, it would only take 8 bytes + unused, so lets estimate 16 bytes per entry, at least 6 times less memory. (Update: for TLongIntHashMap, estimate 12 bytes per entry, 24 bytes with overhead of unused buckets.) Now you could also just store everything in a massive sorted list. This will allow you to perform a fast join operation, and you will lose much of the overhead of unused entries, and can probably process twice as many in much shorter time. Oh, and if you know the valid value range, you can abuse an array as "hashmap". I.e. if your valid keys are 0...999999, then just use an int[1000000] as storage, and write each entry into the appropriate row. Don't store the key at all - it's the offset in the array. Last but not least, Java by default only uses 25% of your memory. You probably want to increase its memory limit.
answers question: http://stackoverflow.com/q/27600812
downvote count: 0
has comment: http://stackoverflow.com/comment/43625341
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/43626098

http://stackoverflow.com/comment/43426434
type: QuestionComment
comment on: http://stackoverflow.com/q/27497441
type: Comment
has text: Can't you just iterate through desiredOrder, use its Strings as Keys and pass them into the list view successively?
score: 0

http://stackoverflow.com/comment/43622921
comment on: http://stackoverflow.com/q/27599207
type: Comment
has text: there is no containsKey method but there is a containsKey method in the hashtable class in java.utils which I import
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43492887
score: 0
has text: Based on http://stackoverflow.com/questions/2920678/getting-all-objects-with-a-certain-element-inside-a-collection-of-strings-with-c, it appears there is an open bug for this.
comment on: http://stackoverflow.com/q/27496231
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27520747
has title: How to hide a file that even if "Show hidden files and folder is checked" it will be hidden?
tagged with: hide
tagged with: file
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43470892
has comment: http://stackoverflow.com/comment/43470778
type: AnsweredQuestion
has body: I am trying to hide some files in my pc. If I hide them normally the show hidden files and folder option will still show the file in transparent form. I have used "attrib +a +s +r +h file" command but it still shows up. How can I really hide the files properly. Like some hide your files programs can do. Programming Language: Java or C#; EDIT: There is a free program that can do this on folders. How do they do it? http://www.cleanersoft.com/hidefolder/free_hide_folder.htm If it's a OS problem then there might be a way to this using win32 api. It's probably possible in c# but I don't know how.
tagged with: c#
has comment: http://stackoverflow.com/comment/43471016
accepted answer: http://stackoverflow.com/a/27521051
tagged with: java
has answer: http://stackoverflow.com/a/27520941
type: Question
has comment: http://stackoverflow.com/comment/43470861
has comment: http://stackoverflow.com/comment/43471077
has comment: http://stackoverflow.com/comment/43471587
score: 0
tagged with: show-hide
favorite count: 0
has answer: http://stackoverflow.com/a/27520874
possible better answer: http://stackoverflow.com/a/27521195
has answer: http://stackoverflow.com/a/27521051
has answer: http://stackoverflow.com/a/27521195
answer count: 4

http://stackoverflow.com/comment/43841559
has text: @tenwest Just beware that this could saturate the EDT with multiple events, causing a degradation in performance
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27629199
type: AnswerComment

http://stackoverflow.com/a/27583226
has body: The problem is here. String phoneNumber = "1234"; void setNumber(){ String phoneNumber; phoneNumber = "4321"; } When you create a second String phoneNumber in your setNumber function it overrides the first one within that function with a local variable. To fix this you'll either want to rename the variables to be different or use a this accessor, or simply remove the local variable such as: String phoneNumber = "1234"; void setNumber(){ this.phoneNumber = "4321"; } Or String phoneNumber = "1234"; void setNumber(String newPhoneNumber) { phoneNumber = newPhoneNumber; } p1.setNumber("4321");
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27583192
type: Answer

http://stackoverflow.com/comment/43624099
type: QuestionComment
has text: @RealSkeptic how do i clean the database? i am using my sql
comment on: http://stackoverflow.com/q/27600226
type: Comment
score: 0

http://stackoverflow.com/a/27637731
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27625293
has body: Sometimes it's easier to see a problem using variables. Your snippet could be rewritten as: int a = 1; int b = +2; System.out.println(a + b); Now, you can easily see that the second + operator is used to indicate a positive value. You could also have written +1 + +2. The - operator could be used to negate an expression. + and - are unary operators.
score: 3
upvote count: 3

http://stackoverflow.com/a/55345956
answers question: http://stackoverflow.com/q/27632355
has body: Click on Helps on the top bar. then click on Check for Updates. And update whatever updates are generated for your IDE. Helps> Check for Updates > .... Hope it will fix your problem.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/133049466
score: 1
has text: careful, this will accept any password unless you do `HashMap<String,Object> env = new HashMap<String,Object>(); env.put("jmx.remote.x.password.file", "path-to-password-file");`, and pass that in when you create the `JMXConnectorServer`, where you currently have the `null`. Still, thanks so much for putting me on the right path!!
comment on: http://stackoverflow.com/a/36085026
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27489065
has answer: http://stackoverflow.com/a/27489113
downvote count: 0
linked to: http://stackoverflow.com/q/2858628
score: 6
has title: If final object is being passed, should null still be checked?
has answer: http://stackoverflow.com/a/27489137
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43409786
favorite count: 0
has comment: http://stackoverflow.com/comment/43409783
possible better answer: http://stackoverflow.com/a/27489137
type: Question
has answer: http://stackoverflow.com/a/27489104
has answer: http://stackoverflow.com/a/27489093
has comment: http://stackoverflow.com/comment/43409689
upvote count: 6
has body: Check out the following code: @Override public int compareTo(final Intersection o) { if (o == null) return 0; double distance = t; double distance2 = o.t; if (distance == distance2) return 0; return distance2 &gt; distance ? -1 : 1; } All seems well however the fact that 0 may be returned on two different conditional occasions does somewhat bother me. If I do however move the variable assignments of distance and distance2 to the top, my IDE warns me that if (o == null) return 0; Would then be 'dead' code. If that's the case, should null even be checked in this scenario? What I mean is: @Override public int compareTo(final Intersection o) { double distance = t; double distance2 = o.t; if (o == null) return 0; if (distance == distance2) return 0; return distance2 &gt; distance ? -1 : 1; }
accepted answer: http://stackoverflow.com/a/27489113
answer count: 4
has comment: http://stackoverflow.com/comment/43409790

http://stackoverflow.com/q/27584924
has answer: http://stackoverflow.com/a/27585259
has title: How in depth should javadoc explanations of how algorithms work be?
has comment: http://stackoverflow.com/comment/43594686
answer count: 1
has comment: http://stackoverflow.com/comment/43594449
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/43594687
has comment: http://stackoverflow.com/comment/43594461
has comment: http://stackoverflow.com/comment/43594538
has comment: http://stackoverflow.com/comment/43594404
has comment: http://stackoverflow.com/comment/43594459
has body: How in depth should I describe how an algorithm works? For example, I'm working on a simple tetris game, and I want to explain how I rotate the tetrominoes in a way that the explanation doesn't cover a 100 lines, but the reader fully understands what I'm doing. My javadoc for the algorithm as it is now: /** * Rotates the tetromino 90 degrees clockwise. * &lt;p&gt; * The rotating algorithm guarantees O(n^2) time complexity and O(1) space * complexity, n being the width/height of the tetromino's layout. * &lt;p&gt; * The algorithm works by rotating each layer of the layout. A layer is * rotated by choosing 4 elements, one from each of the layout's sides, and * swapping them with each other in a clockwise manner. See an illustration * with the I-tetromino below: * &lt;p&gt; * &lt;pre&gt; * Layout: * * . . 1 . * . . 1 . * . . 1 . * . . 1 . * * Its first and second layer (layers 0 and 1): * * 0: x x x x 1: . . . . * x . . x . x x . * x . . x . x x . * x x x x . . . . * * First we swap the first layer's elements, 4 at a time: * * layout now: swap these elements: * * . . 1 . x . 1 x * . . 1 . . . 1 . * . . 1 . . . 1 . * . . 1 . x . 1 x * * layout now: swap these elements: * * . . 1 . . x 1 . * . . 1 . . . 1 x * . . 1 . x . 1 . * . . 1 . . . x . * * layout now: swap these elements: * * . . 1 . . . x . * . . 1 . x . 1 . * 1 . 1 . . . 1 x * . . . . . x . . * * Then we swap the second layer's elements: * * layout now: swap these elements: * * . . . . . . . . * . . 1 . . x x . * 1 . 1 1 1 x x 1 * . . . . . . . . * * layout now: * * . . . . * . . . . * 1 1 1 1 * . . . . * * The tetromino is now rotated. * &lt;/pre&gt; */ Should I simply omit the step-by-step illustration, prefering the readability of the rest of the class, should I ignore this issue, prefering the reader, or should I give a link to an external source where a similar algorithm is already explained in depth, possibly resulting in a dead link later? Or something else?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43594712
score: 1
tagged with: java
tagged with: javadoc
tagged with: comments
accepted answer: http://stackoverflow.com/a/27585259
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43594625

filewriter
tag name: filewriter
type: Tag
tags question: http://stackoverflow.com/q/27631082
tags question: http://stackoverflow.com/q/27637225
tags question: http://stackoverflow.com/q/27636536

http://stackoverflow.com/q/27575450
favorite count: 0
has body: I'm trying to write a project with EJB, JSF, and Maven and facelets the problem is when I call the page in the browser, the action parameter submits the form (without click) The xhtml page loads and not the action of my rich: commandbuttom already runs (calls the bean's method)! does forgot to configure something? If someone can give me a light, I am sending my pom.xml and part of my screen (xhtml). 4.0.0 projecto.com.br PortalScheduler war 0.0.1-SNAPSHOT APP Maven Webapp http://maven.apache.org junit junit 4.8.1 test org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Draft-16 org.hibernate hibernate-annotations 3.5.6-Final org.jboss.spec.javax.servlet jboss-servlet-api_3.1_spec 1.0.0.Alpha1 org.hibernate hibernate-jpamodelgen 1.2.0.Final org.hibernate hibernate-entitymanager 4.3.0.Beta2 org.apache.poi poi 3.9 org.apache.poi poi-excelant 3.9 org.apache.poi ooxml-schemas 1.1 org.jboss.spec.javax.ejb jboss-ejb-api_3.2_spec 1.0.0.Alpha2 org.hibernate hibernate 3.6.0.Beta2 pom axis axis 1.4 org.eclipse.birt.runtime.3_7_1 javax.wsdl 1.5.1 javax.xml.soap saaj-api 1.3.5 axis axis-saaj 1.4 org.apache.openejb javaee-api 6.0-5 zip org.apache.openejb javaee-api-libs 3.1.4 pom xstream xstream 1.2.2 xpp3 xpp3 1.1.4c ant ant-javamail 1.6.5 net.sf.retrotranslator retrotranslator-runtime 1.2.9 ant ant-junit 1.6.5 axis2 axis2 1.0 org.apache.commons commons-email 1.3.1 com.itextpdf itextpdf 5.5.3 org.richfaces.core richfaces-core-api 4.3.2.Final org.richfaces.core richfaces-core-impl 4.3.2.Final org.richfaces.ui richfaces-components-api 4.3.2.Final org.richfaces.ui richfaces-components-ui 4.3.2.Final InterService Part of my xtml <?xml version="1.0" encoding="UTF-8"?> <h:body> <ui:composition template="template/template.xhtml"> <ui:define name="content"> ID Data Cadastro Status Arquivo Processar Progress % <ui:repeat value="#{especialistaAtualizaBlacklist.arquivosBlacklist}" var="item"> <h:form id="form1"> <h:outputLabel value="#{item.cd_repositorio}" /> <h:outputLabel value=…
tagged with: richfaces
answer count: 0
type: UnansweredQuestion
tagged with: maven
upvote count: 1
has title: Richfaces 4.3 action in rich:commandButtom submit when page is loading
tagged with: facelets
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43674747
downvote count: 0

http://stackoverflow.com/comment/43564583
type: Comment
comment on: http://stackoverflow.com/a/27546906
has text: begins_with is available: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43673070
score: 0
type: AnswerComment
has text: "message" is already non-English when I am reading it. So you are right -- I likely don't need to use Charset. However, it is not unicode either. There is a localized properties file that contains for example Japanese values. I am trying to show the values on the JTextArea. In summary, read Japanese text from a file and show on JTextArea. Can you please tell how?
type: Comment
comment on: http://stackoverflow.com/a/27610828

http://stackoverflow.com/comment/43670580
type: Comment
comment on: http://stackoverflow.com/a/27613154
has text: So even if the joined field is on superclass it effects it's subclasses to. more info here: [Annotation JoinColumn](http://www.objectdb.com/api/java/jpa/JoinColumn)
type: AnswerComment
score: 0

http://stackoverflow.com/a/27482166
has comment: http://stackoverflow.com/comment/43398203
answers question: http://stackoverflow.com/q/27481528
has comment: http://stackoverflow.com/comment/43397753
score: 0
has comment: http://stackoverflow.com/comment/43401019
has body: Since the Java 6 Update 10 release (2008-10-15), unsigned applets can now make network connections to remote servers (servers that are different from the server that hosts the applet) using a special XML file called crossdomain.xml file. That file must be accessible on the server that the applet is trying to connect to. You have to sign your applet, to make crossdomain requests.
type: Answer
has comment: http://stackoverflow.com/comment/43399080
has comment: http://stackoverflow.com/comment/43400829
has comment: http://stackoverflow.com/comment/43399510
has comment: http://stackoverflow.com/comment/43400443
has comment: http://stackoverflow.com/comment/43401043

nexus
type: Tag
tags question: http://stackoverflow.com/q/27559428
tag name: nexus

http://stackoverflow.com/comment/68419779
has text: there is not `navigationBarColor` for appCompat You have to use the native v21 `android:navigationBarColor` in values-21
comment on: http://stackoverflow.com/a/27590732
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27560856
has comment: http://stackoverflow.com/comment/50023822
favorite count: 0
has body: We are facing some issue in the @FindBy in the page object model. My Scenario is i need to get a values from the excel and example given below protected static final String Loginfield= "test" - Webelement ID @FindBy(how=How.ID, using=Loginfield) public WebElement test; Anyone can you give some solutions?
type: UnansweredQuestion
tagged with: selenium-webdriver
answer count: 0
has comment: http://stackoverflow.com/comment/43551537
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43549607
has comment: http://stackoverflow.com/comment/43552527
type: Question
has title: The value for annotation attribute FindBy.using must be a constant expression
downvote count: 0
score: 1

http://stackoverflow.com/q/27505196
downvote count: 1
possible better answer: http://stackoverflow.com/a/27505263
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/27505263
score: -1
has answer: http://stackoverflow.com/a/27513968
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/27513968
favorite count: 0
has title: How to read column a1 from an Excel sheet and perform string matching to define variables in a Java program
type: AnsweredQuestion
has body: I need to read one fixed column of an Excel sheet and from that column I need to find out the variables and load them into a Java program. For example I need to read column a1 which contains the following data: "What is /@v1@/% of /@v2@/?" /@v1@/ and /@v2@/ are the variables. My Java program needs to detect these variables and insert random values into them. I have done the following: import java.io.FileInputStream; import java.util.ArrayList; import java.util.List; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; public class ACGS { public static void main(String[] args) throws Exception { //test file is located in your project path FileInputStream fileIn = new FileInputStream("C://users/admin/Desktop/Content.xls"); //read file POIFSFileSystem fs = new POIFSFileSystem(fileIn); HSSFWorkbook filename = new HSSFWorkbook(fs); //open sheet 0 which is first sheet of your worksheet HSSFSheet sheet = filename.getSheetAt(0); //we will search for column index containing string "Your Column Name" in the row 0 (which is first row of a worksheet String columnWanted = "v4"; Integer columnNo = null; //output all not null values to the list List&lt;Cell&gt; cells = new ArrayList&lt;Cell&gt;(); Row firstRow = sheet.getRow(0); for(Cell cell:firstRow){ if (cell.getStringCellValue().equals(columnWanted)){ columnNo = cell.getColumnIndex(); } } if (columnNo != null){ for (Row row : sheet) { Cell c = row.getCell(columnNo); if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) { // Nothing in the cell in this row, skip it } else { cells.add(c); } } }else{ System.out.println("could not find column " + columnWanted + " in first row of " + fileIn.toString()); } } } Could you tell me how can I proceed further?
tagged with: apache-poi
tagged with: java

http://stackoverflow.com/comment/43549439
has text: A java class has a size limit of 64k - you have a seriously long JSP or a lot of imports?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27561908
score: 1

http://stackoverflow.com/a/27499786
score: 1
answers question: http://stackoverflow.com/q/27498712
downvote count: 0
type: Answer
upvote count: 1
has body: Your code indentation is bad why dont you make it simple and clear for yourself, you have time to be a pro and write in style.. Thats your inEven function.. public boolean inEven(int o) { if ((o%2)==0) { inEven = true;} else { inEven = false;} return inEven; } // &lt;- What is this doing ; // &lt;-What is this doing } Should be like : public boolean inEven(int o) { if ((o%2)==0) { inEven = true; } else { inEven = false; } return inEven; }

http://stackoverflow.com/a/27555293
has body: For the general case, I'd say "it's an interface, so just create a mock." For this case, I think you're testing the wrong seam. The true unit under test in this case is your anonymously-declared SimpleTypeVisitor implementation. Consider that to truly test the whole typeToString method, you would have to verify that all six methods that you've implemented are consistent with their expected behavior. Therefore, you should promote the anonymous implementation to a concrete one and test those methods. Each of them should have at least one test and in those tests you can mock out typeToString to deal with your recursive calls.
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27554658
accepted answer of: http://stackoverflow.com/q/27554658
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/47934218
has text: It does, to the apparent satisfaction of OP and 8 other people who upvoted this answer. It you have a specific question or comment about my answer, feel free to voice it, but if you don't tell me what you didn't understand, how should I know what to improve?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27612109

http://stackoverflow.com/q/27637919
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43694770
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/43695149
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43694946
has comment: http://stackoverflow.com/comment/43694690
has body: I have a working Java Application that is randomizing a string and every other time when you click the button it will show the randomized text. So when someone clicks the button it will tell them what position in the game they are, then brings them to a blank screen waiting for the next player to click, and etc. It works perfectly but when I copy the code to a new file and type: extends JApplet The window in eclipse is just blank, nothing in it. I get no errors in the console though when running this. My basic aim is to make this application a java applet so I can post it online and hopefully open it on other devices without download, like an iPhone. Code: package main; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class Main extends JApplet{ private static JFrame window = new JFrame(); private static JPanel one = new JPanel(); private static JPanel two = new JPanel(); //1-4 Players private static JLabel job1 = new JLabel(); private static JLabel job2 = new JLabel(); private static JLabel job3 = new JLabel(); private static JLabel job4 = new JLabel(); private static JLabel jobprint = new JLabel(); private static JButton next = new JButton("Click To Find Your Position"); private static int countertwo = 0; private static int counter = 0; public static void shuffleArray(String[] a) { int n = a.length; Random random = new Random(); random.nextInt(); for (int i = 0; i &lt; n; i++) { int change = i + random.nextInt(n - i); swap(a, i, change); } } private static void swap(String[] a, int i, int change) { String helper = a[i]; a[i] = a[change]; a[change] = helper; } public static void main(String[] args) { String[] a = new String[] { "Murderer", "Judge", "Innocent", "Innocent"}; shuffleArray(a); next.setVisible(true); job1.setVisible(false); job2.setVisi…
has title: Extends Java Applet Making Everything Invisible - CLOSED
answer count: 0
has comment: http://stackoverflow.com/comment/43694957
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43695019

auto-increment
type: Tag
tags question: http://stackoverflow.com/q/27633339
tag name: auto-increment

http://stackoverflow.com/a/27617775
accepted answer of: http://stackoverflow.com/q/27617558
answers question: http://stackoverflow.com/q/27617558
type: Answer
has body: It sounds like a network or server issue that is out of your control. You could try exponential backoff (example) as a way to deal with it.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43523998
score: 0
type: Comment
has text: @AlanHay I totally agree (and I am upvoting you), that is why I kept the other suggestions. I just wanted to point it out in case it could be doable for V_B
comment on: http://stackoverflow.com/a/27548608
type: AnswerComment

http://stackoverflow.com/comment/43472358
comment on: http://stackoverflow.com/a/27519357
type: AnswerComment
score: 0
type: Comment
has text: Hi dude now i dowload android stud 1.0.1 and instaled it and import the tele project now i got gradle error missmatch how to fix it

http://stackoverflow.com/q/27574631
tagged with: android-intent
has comment: http://stackoverflow.com/comment/43575748
has comment: http://stackoverflow.com/comment/43574767
tagged with: java
has title: intent to take bold or italic from layout to another layout
type: Question
score: 0
has body: my code is to change edittext to bold or italic . this code to write a text in editText and send it to another layout when touch in image1 this has intent to take text and size of text i want another intent to take the bold or italic also . public class Graduation extends ActionBarActivity { Button button; ImageView imageView ; Spinner spinner; int fontSizeInt; String[]items = { "12", "16", "18", "20", "24", "28" , "30" }; int fontSizeFamily; EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.graduation); spinner = (Spinner)findViewById(R.id.spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, android.R.layout.simple_spinner_item, items); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener( new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { int position = spinner.getSelectedItemPosition(); try { fontSizeInt = Integer.parseInt(items[position]); } catch (NumberFormatException e) { fontSizeInt = 12; // Default size. } et.setTextSize(TypedValue.COMPLEX_UNIT_SP, (float) fontSizeInt); // TODO Auto-generated method stub } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); addListenerOnImageg1() ; addListenerOnButton1(); addListenerOnButton2(); et = (EditText) findViewById(R.id.et); } public void addListenerOnButton1() { final Context context = this; button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { et.setTypeface(null,Typeface.BOLD); } }); } public void addListenerOnButton2() { final Context context = this; button = (Button) findViewById(R.id.button2); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { et.setTypeface(null,Typeface.ITALIC); } }); } public void addListenerOnImageg1() { final Contex…
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43531355
type: QuestionComment
has text: Yes, if you compile a really huge Java app, like a Trading App made with GWT your PC can run out of resources
score: 0
comment on: http://stackoverflow.com/q/27551031
type: Comment

http://stackoverflow.com/comment/43645939
has text: @LuiggiMendoza Thanks for suggestion. Can you provide an example how would I do this? I also need to add `--help` functionality by which anyone can get to know how to run this jar and what are the various config parameters and what do they mean in general? Do we need to use any command line parser like JCommander?
score: 0
comment on: http://stackoverflow.com/q/27611136
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43656893
score: 0
has text: I want to compare dates like this `select * from users where dateOfRegistration>=(pickedDate);`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27617841

celltable
type: Tag
tag name: celltable
tags question: http://stackoverflow.com/q/27599583

http://stackoverflow.com/q/27551946
has comment: http://stackoverflow.com/comment/43530084
possible better answer: http://stackoverflow.com/a/27552047
has comment: http://stackoverflow.com/comment/43530068
tagged with: arrays
has answer: http://stackoverflow.com/a/27552047
has answer: http://stackoverflow.com/a/27552272
has answer: http://stackoverflow.com/a/27552121
has comment: http://stackoverflow.com/comment/43530165
has comment: http://stackoverflow.com/comment/43530255
answer count: 4
has title: Issues in running java two dimensional array
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43530314
accepted answer: http://stackoverflow.com/a/27552272
has body: I am new to java, Now i am learning arrays, This is example program: public class Array { public static void main(String[] args) { int[][] twodim = new int[][] { {1,2,4,4}, {2,4,5,5,4,3,3} }; int d1 = twodim.length; int d2 = twodim[1].length; for (int i = 0; i &lt; d1; i++){ for (int j = 0;j &lt; d2; j++){ System.out.println(twodim[i][j]); }} } } My output: 4 4 This is incorrect, please guide me, Thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/43530131
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43530157
has answer: http://stackoverflow.com/a/27552090

http://stackoverflow.com/q/27613699
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/43649632
has body: I am working on Huffman coding in Java. I am not getting the point of how and where to store the tree. I know how to make the tree, and then save it as a binary file, but for decoding purpose we will again need that same tree to decode. How can I save that tree in a file to attach it with binary file?
has comment: http://stackoverflow.com/comment/43649425
accepted answer: http://stackoverflow.com/a/27613883
has comment: http://stackoverflow.com/comment/43649471
tagged with: huffman-code
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43649640
downvote count: 1
tagged with: tree
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27613883
has comment: http://stackoverflow.com/comment/43649505
score: 1
tagged with: java
has title: How to save Huffman tree in file?

http://stackoverflow.com/comment/43502232
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27536675
has text: It's likely in your systems font directory...

http://stackoverflow.com/comment/43444217
type: QuestionComment
has text: I found this other very similar question by you, http://stackoverflow.com/questions/27359816/how-to-read-console-ouput so are you able to read the console in your grails yet? and just need help in showing it on a HTML page? or you still on reading console log from inside grails app? ... Also, you will have to give a little more details on how exactly do you invoke this Java Library.. do you invoke it from command line and then it prints the output?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27506826

http://stackoverflow.com/comment/93916978
has text: This solution splits a list and not a stream. Useful but not what @Bohemian asked.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/50367718
score: 5

open-closed-principle
tag name: open-closed-principle
type: Tag
tags question: http://stackoverflow.com/q/27581005

http://stackoverflow.com/a/27481719
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43511378
has comment: http://stackoverflow.com/comment/43396604
upvote count: 1
type: AcceptedAnswer
has body: This works for me. The reason I'm declaring the classes (Response, Restaurant etc) as static is because Jackson cannot deserialize non-static inner classes. public class Test { static String jsonString = "{ \"requestToken\":0, \"responseCode\":2, \"objectType\":\"com.test.Restaurant\", \"error\":null, \"data\":[ { \"id\":1, \"name\":\"Name\", \"addressCity\":\"Warszawa\", \"addressStreet\":\"Kopernika\", \"addressStreetNumber\":\"4\", \"addressApartmentNumber\":\"17\", \"categories\":[ { \"id\":1, \"restaurantId\":1, \"name\":\"Breakfast\", \"description\":\"Description\", \"dishes\":[ { \"id\":11, \"categoryId\":1, \"name\":\"Dish 1\", \"description\":\"Descr\", \"price\":8.99, \"photoId\":51 }, { \"id\":21, \"categoryId\":1, \"name\":\"Dish 2\", \"description\":\"Descr\", \"price\":6.99, \"photoId\":41 }, { \"id\":31, \"categoryId\":1, \"name\":\"Dish 3\", \"description\":\"Descr\", \"price\":14.99, \"photoId\":61 } ] }, { \"id\":2, \"restaurantId\":1, \"name\":\"Obiady\", \"description\":\"Opis kategorii\", \"dishes\":[ { \"id\":41, \"categoryId\":2, \"name\":\"Danie 4\", \"description\":\"Descr\", \"price\":6.99, \"photoId\":0 }, { \"id\":61, \"categoryId\":2, \"name\":\"Danie 5\", \"description\":\"Descr\", \"price\":8.0, \"photoId\":0 }, { \"id\":101, \"categoryId\":2, \"name\":\"Nowy obiad\", \"description\":\"\", \"price\":111.0, \"photoId\":0 } ] }, { \"id\":3, \"restaurantId\":1, \"name\":\"Pasta\", \"description\":\"Opis kategorii\", \"dishes\":[ ] }, { \"id\":4, \"restaurantId\":1, \"name\":\"Przystawki\", \"description\":\"Opis kategorii\", \"dishes\":[ ] }, { \"id\":11, \"restaurantId\":1, \"name\":\"Some category\", \"description\":\"test\", \"dishes\":[ ] }, { \"id\":51, \"restaurantId\":1, \"name\":\"Sushi\", \"description\":\"\", \"dishes\":[ ] } ] } ] }"; public static void main(String[] args) throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response res…
accepted answer of: http://stackoverflow.com/q/27481592
answers question: http://stackoverflow.com/q/27481592
has comment: http://stackoverflow.com/comment/43406024
type: Answer

http://stackoverflow.com/q/27488471
tagged with: maven
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43410880
score: 1
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27501043
upvote count: 1
has comment: http://stackoverflow.com/comment/43409429
type: Question
has comment: http://stackoverflow.com/comment/43412600
has body: I was trying to build an app with Spring, Hibernate and Maven. I was trying to write an integration test for my DAO class with the help of Pro spring with Web flow. I've put my test class below: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/WEB-INF/servlet-context.xml"}) @Transactional public class UsersDAOimplTest { I've also tried changing location, but my test is not running and showing Failed to load Application context in the console. My servlet-context.xml file is given below,it is in WEB-INF folder: <?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:mvc="http://www.springframework.org/schema/mvc" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <mvc:annotation-driven /> <context:component-scan base-package="com.mahin"/> com.mahin.models hibernate.dialect=org.hibernate.dialect.MySQLDialect <tx:annotation-driven transaction-manager="transactionManager"/> <mvc:resources mapping="/resources/**" location="/resources/" /> </beans> Here is my Console output Dec 15, 2014 9:56:12 PM org.springframework.test.context.support.AbstractTestContextBootstrapper getDefaultTestExecutionListenerClassNames INFO: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.spr…
has title: Integration test of persistent layer of Spring MVC and Hibernate
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43409275
has comment: http://stackoverflow.com/comment/43408670
has answer: http://stackoverflow.com/a/27501043
favorite count: 0

http://stackoverflow.com/q/27510538
upvote count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/43453758
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Extract two substrings from String surronded by special string (Java)
has comment: http://stackoverflow.com/comment/43454668
type: Question
has comment: http://stackoverflow.com/comment/43451226
has answer: http://stackoverflow.com/a/27510939
answer count: 1
has body: I have a String like this.. I am a !!!guy!!! but I like !!!cats!!! better than dogs. I need the strings within the exclamation Strings (!!!), a collection of Strings or array will do. I can probably do this a dirty way with String's substring and indexOf, but if you can suggest a better way with regular expressions or just cleaner code that would be much appreciated. Thanks.
has comment: http://stackoverflow.com/comment/43451222
score: 0
has comment: http://stackoverflow.com/comment/43451377
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/27510939

http://stackoverflow.com/a/27622521
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27622300
has body: Look for numbers that are surrounded by braces \((\d+)\) since process names are surrounded by curly braces it will only get the PID
upvote count: 1

http://stackoverflow.com/q/27617899
has comment: http://stackoverflow.com/comment/43658884
has title: OpenGL - how to construct an FPS style camera(the gun attached to it will move and rotate with it)
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27618161
accepted answer: http://stackoverflow.com/a/27618161
has comment: http://stackoverflow.com/comment/107761153
has body: my question is pretty directly: how to construct FPS camera, like in shooter games(you have gun, and whenever you rotate camera, gun rotates too.) Actually, moving is no problem, just(well, before i start coding, i want to say, i am using libGDX which is an opengl framework, but you would understand to all as i would understand to opengl code) : gun.transform.setTranslation(camera.position);// sets gun to the center of the camera camera.rotate(0,1,0,-3); //rotates direction and up vector of the camera gun.transform.rotate(0,1,0,-3); // rotates the gun gum.transform.trn(0.18f, -0.12f, -0.24f); //offseting the gun, to be everytime in the right bottom corner of the screen but this does not work. The camera is rotating kind of more than the gun. it looks like camera is sphere and.. it isnt what i want.
upvote count: 1
favorite count: 0
downvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43657176
tagged with: camera
tagged with: opengl
score: 1
tagged with: java

http://stackoverflow.com/a/27497138
answers question: http://stackoverflow.com/q/27496849
type: Answer
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43427263
has body: Try increasing the heap size. PFB links for reference.Hope this may help you. http://javarevisited.blogspot.com/2011/08/increase-heap-size-maven-ant.html http://javarevisited.blogspot.com/2011/09/javalangoutofmemoryerror-permgen-space.html :> echo $MAVEN_OPTS -Xmx2000m -Xms256m Try increasing the size of highlighted bold to -Xms512m and try once again

http://stackoverflow.com/a/27616388
has comment: http://stackoverflow.com/comment/43663349
has comment: http://stackoverflow.com/comment/43654650
upvote count: 3
has comment: http://stackoverflow.com/comment/43658983
has comment: http://stackoverflow.com/comment/43659032
answers question: http://stackoverflow.com/q/27616294
type: Answer
has body: Your PiCalculation returns a double, you can't expect to have more precision with this. Use BigDecimal everywhere, if you want to go further. But anyway with this method, even with 10^10 throws, you will only have 10 decimals. The 49 decimals you had with your double, were due to the double lack of precision
score: 3
downvote count: 0

http://stackoverflow.com/comment/43696333
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27638714
type: Comment
has text: Thank you. Would it work if RedSquare extended JFrame.

http://stackoverflow.com/comment/43557620
type: Comment
comment on: http://stackoverflow.com/q/27566310
type: QuestionComment
has text: Thanks @ZouZou i forgot that point. It worked thanks a lot. :)
score: 1

http://stackoverflow.com/comment/43632660
comment on: http://stackoverflow.com/q/27605282
score: 2
has text: What exactly do you mean by "won't work"? Are you calling revalidate() after removing the JPanel? Where is your [MCVE](http://stackoverflow.com/help/mcve)?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43396560
score: 0
type: Comment
has text: I basically need to transfer files and execute commands like MV , ls, etc.. Transfering files part i have done and is working fine. But regarding excuting commands I am not able to :( can u help me with a simple example code ?
comment on: http://stackoverflow.com/a/27480136
type: AnswerComment

dispose
tags question: http://stackoverflow.com/q/27558602
tag name: dispose
type: Tag

http://stackoverflow.com/comment/43482429
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27509568
has text: It's possible if the server integrates a Swagger library as part of the application.

http://stackoverflow.com/q/27556163
has answer: http://stackoverflow.com/a/27556207
tagged with: java
has comment: http://stackoverflow.com/comment/43538541
type: Question
score: -1
has title: how to change date format in servlet jsp?
has comment: http://stackoverflow.com/comment/43592952
has body: From database, the format will be coming yyyy-MM-dd. Instead would like to display MM-dd-yyyy. public static final String MM_DD_YYYY_DASH = "MM-dd-yyyy"; public static final String YYYY_MM_DD_DASH = "yyyy-MM-dd"; Thanks in advance.
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 0

http://stackoverflow.com/q/27569793
has body: I have String variable from Java (for example, str), that stores some GString expression, lets say "SELECT ${path} path FROM dual", it is absolutely dynamic string from user input, I can't know, how many ${} will be there. And I want not to use it in sql.rows() with evaluated ${path} by current binding using PreparedStatement. The problem is: If I won't convert str to GString somehow, it will throw SQLException, because without PreparedStatement we need use quotes around '${path}'. But it is unsafe, and Groovy generates warnings (that we should use PreparedStatement and remove quotes). If I will convert str to GString this way: sql.rows("${str}"), then Groovy will use absolutely wrong prepared statement that contains just "?", of course, it won't work, I need statement: "SELECT ? path FROM dual". The question is how can we get GString from String without wrapping it with "${}"? Or how can we evaluate only first level of GString (only str, not path)? Or how can I solve this problem in the other way? Thank you.
has comment: http://stackoverflow.com/comment/43624003
favorite count: 0
has comment: http://stackoverflow.com/comment/43565257
upvote count: 2
type: UnansweredQuestion
tagged with: gstring
has comment: http://stackoverflow.com/comment/43571928
tagged with: java
has comment: http://stackoverflow.com/comment/43594888
type: Question
has answer: http://stackoverflow.com/a/27668450
score: 2
has title: How to create GString from String without "${str}" in Groovy
answer count: 1
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/43566179
has comment: http://stackoverflow.com/comment/43731974
tagged with: groovy

undertow
type: Tag
tag name: undertow
tags question: http://stackoverflow.com/q/27548507
tags question: http://stackoverflow.com/q/27481792

http://stackoverflow.com/comment/43650288
score: 0
comment on: http://stackoverflow.com/q/27614006
type: Comment
has text: I have attached a screenshot on the post
type: QuestionComment

http://stackoverflow.com/a/27616807
accepted answer of: http://stackoverflow.com/q/27614073
has body: The MApplication has not yet been created when the life cycle @PostContextCreate is called. It is available when the @ProcessAdditions life cycle method is called: @ProcessAdditions void processAdditions(MApplication app) However you should note that this is still quite early in the application startup so other things may not be available. You may want to subscribe to the UIEvents.UILifeCycle.APP_STARTUP_COMPLETE event in the event broker. This will be called when the application startup is complete.
answers question: http://stackoverflow.com/q/27614073
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43656905
score: 1
upvote count: 1

http://stackoverflow.com/q/27605211
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27605326
tagged with: java
has title: how do you test if statements with junit?
type: Question
upvote count: 2
tagged with: junit
favorite count: 0
has answer: http://stackoverflow.com/a/27605291
answer count: 3
has answer: http://stackoverflow.com/a/27605442
score: 2
has body: I can't seem to find any tutorials online that address this I have this if statement: if (basket.getCustomerId() != null) { Basket exBasket = findBasketByCustomerId(basket.getCustomerId()); if (exBasket != null &amp;&amp; exBasket.getBasketId() != null) { return exBasket; } and I want to write a unit test that will test each individual line to see if it is doing the right thing. Any ideas? @Test public void testBasketWithANullCustomerId(){ basketInformationServiceImpl.createBasket(mockBasket); assertNotNull(mockBasket.getCustomerId()); }

http://stackoverflow.com/q/27530768
type: Question
answer count: 2
downvote count: 0
tagged with: jar
tagged with: tomcat
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I am having a directory having jar files. In which some classes are available in more than one jar file. List&lt;URL&gt; jarsToLoad = new ArrayList&lt;URL&gt;(); File jarDir = new File("Directory name having jar files"); for ( File jarFile : jarDir.listFiles()) { jarsToLoad.add( new URL("file", null, jarFile.getPath()) ); } Thread.currentThread().setContextClassLoader(new URLClassLoader(jarsToLoad.toArray(new URL[jarsToLoad.size()]))); jarDir.listFiles() is listing jars in different order while executing the above code in different machines. Suppose if Test.class is present in A.jar and B.jar in some machines Test.class is getting loaded from A.jar in some machines it is getting loaded form B.jar, based on which jar is listed first(JAVA API documentation say's listFiles() method won't guarantee any specific listing order). Suppose if both A.jar &amp; B.jar is present in tomcat $CATALINA_HOME/lib directory from which jar tomcat will load Test.class. I need explanation on how tomcat is loading the classes from jar files in this specific scenario. Thanks in advance.
has answer: http://stackoverflow.com/a/27530860
has title: Explanation needed on Classloader
tagged with: java
has answer: http://stackoverflow.com/a/27530866

http://stackoverflow.com/a/39300019
answers question: http://stackoverflow.com/q/27612828
has body: VerbalExpressions looks like what you're describing. ab*|c* would be expressed as something like that: VerbalExpression.regex() .then("a").then("b").zeroOrMore() .or("c").zeroOrMore() .build() It also exists in different languages.
has comment: http://stackoverflow.com/comment/65935759
score: 0
has comment: http://stackoverflow.com/comment/65936584
has comment: http://stackoverflow.com/comment/65946249
type: Answer

http://stackoverflow.com/q/27552692
score: 4
tagged with: java
type: UnansweredQuestion
upvote count: 4
has comment: http://stackoverflow.com/comment/80758899
downvote count: 0
tagged with: websocket
answer count: 0
tagged with: tomcat8
favorite count: 0
has title: How to properly close websocket session on server side when user reloads the web page and websocket session times out?
type: Question
has body: java.lang.IllegalStateException when user reloads the page. onClose method is called I get the exception that the socket has already been closed. Because of this, I cannot cleanup few things in a different Thread that stops when the web socket session closes. Everything is fine if user closes the session without reloading page (its basically a server side terminal over websocket). I am on tomcat8. Questions. How to properly close the websocket session on the server if user reloads the page? Also how do I do a few things when webshocket session times out? Following is the code that servers the websocket connection. @ServerEndpoint(value = "/ws/{clientId}", configurator = HttpSessionConfigurator.class) public class WSSession { public static final long DEFAULT_TIMEOUT = 3600000; public static final int DEFAULT_TIMEOUT_IN_SECONDS = 3600; private Session wsSession; private HttpSession httpSession; private static final ConfigService configService; static { configService = ConfigServiceFactory.getConfigService(System .getenv("ENVRIRONMENT")); } @OnOpen public void onOpen(@PathParam("clientId") String clientId, Session session, EndpointConfig config) throws IOException { Logger logger = Logger.getLogger(clientId); try { FileHandler fh = new FileHandler(configService.logDirectory() .toString() + "/" + clientId); SimpleFormatter formatter = new SimpleFormatter(); fh.setFormatter(formatter); logger.addHandler(fh); logger.setLevel(Level.INFO); } catch (SecurityException | IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println("Got ID: " + clientId); // TODO: Get the max timeout from configuration session.setMaxIdleTimeout(DEFAULT_TIMEOUT); ConnectionDetails cd = configService.getConnectionDetails(clientId); this.wsSession = session; this.httpSession = (HttpSession) config.getUserProperties().get( HttpSession.class.getName()); if (this.httpSession.getAttribute(SessionProperties.WS_SESSION.value()) != null &amp;&amp; this.httpSession.getAt…

http://stackoverflow.com/comment/43518278
type: QuestionComment
comment on: http://stackoverflow.com/q/27545634
score: 0
type: Comment
has text: @SeniorJD Yes I have debugged it by my own but can't seem to find the problem.

http://stackoverflow.com/a/27554423
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: Now i want walk tree using Listeners and change the input. Is there a way to change the input that Listener is using from inside? AFAIK, that is not possible at the moment. It is easier to build your own structure on top of it and transform that to your needs. Perhaps later: https://theantlrguy.atlassian.net/wiki/display/~admin/2012/12/08/Tree+rewriting+in+ANTLR+v4
answers question: http://stackoverflow.com/q/27498444

http://stackoverflow.com/a/38583182
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: The main problem i see is the configuration and some small details. In your example, you are using two ways to configure the project (Java and XML). I preffer to use Java-based configuration, it can be combined but without causing conflicts. Your example run HelloController because it is indicated in mvc-dispatcher-servlet.xml with the base-package. &lt;context:component-scan base-package="com.spitter.mvc"/&gt; And moreover, SpittrWebAppInitializer replace to web.xml. You must delete XML files and modify RootConfig to specify the correct package. @ComponentScan(basePackages={"spittr"} And WebConfig so be similar to this. @Configuration @EnableWebMvc @ComponentScan("spittr.web") public class WebConfig extends WebMvcConfigurerAdapter { // Configure a JSP view resolver @Bean public ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JstlView.class); resolver.setPrefix("/WEB-INF/pages/"); resolver.setSuffix(".jsp"); return resolver; } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // TODO Auto-generated method stub super.addResourceHandlers(registry); } } And you can only have unique paths in your controllers, for example if you add to WebConfig the package com.spitter.mvc to @ComponentScan you will have an error.
accepted answer of: http://stackoverflow.com/q/27582337
answers question: http://stackoverflow.com/q/27582337
type: AcceptedAnswer

http://stackoverflow.com/comment/43400376
comment on: http://stackoverflow.com/q/27484088
has text: @St.Antario There is a documentation which is pretty well descriptive, I suggest you to have a look :-)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43653053
score: 0
has text: Where is your loop? If it's null then it wont enter your if condition.
comment on: http://stackoverflow.com/q/27615772
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43535931
comment on: http://stackoverflow.com/a/27545331
type: Comment
has text: That is a good place to start. Thank you! Does anyone know of any really good tutorials on multitenancy? The google provided Guest book is ok but something else might be better.
score: 0
type: AnswerComment

http://stackoverflow.com/a/71721347
score: 0
has body: Here's a version of Scotts Proggy adapted to use the new JavaFX 17 Data-URI's: P.S. I use the Azul Zulu openJDK 17 JavaFX Runtime Bundle You can get that here: https://www.azul.com/downloads/?package=jdk#download-openjdk package example.stackoverflow; import static java.nio.charset.StandardCharsets.UTF_8; import java.util.Base64; import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.scene.text.Font; import javafx.stage.Stage; public class TextAreaTabs extends Application { private static final String CSS_TABSIZE_N = "Text {-fx-tab-size: %d}"; private static final char TAB = '\t'; private static final char NEWLINE = '\n'; private static final String TABBED_TEXT = "This is a test" + NEWLINE + TAB + "after a tab" + NEWLINE + TAB + "1" + TAB + "2"; public static void main(final String[] args) { launch(args); } private Scene scene; @Override public void start(final Stage primaryStage) { final var sliderLabel = new Label("Tab size:"); final var slider = new Slider(1, 50, 8); ; slider.valueProperty().addListener((obs, old, newValue) -> updateTabSize(newValue.intValue())); final var textArea = new TextArea(TABBED_TEXT); ; textArea.setFont(Font.font("Monospaced")); final var vBox = new VBox(8, new HBox(8, sliderLabel, slider), textArea); ; vBox.setPadding(new Insets(8)); scene = new Scene(vBox); primaryStage.setScene(scene); primaryStage.setTitle("TextArea Tab Experiment"); primaryStage.show(); } private void updateTabSize(final int tabSize) { final var styleText = CSS_TABSIZE_N.formatted(tabSize); final var styleBase64 = Base64.getUrlEncoder().encodeToString(styleText.getBytes(UTF_8)); final var url = "data:text/css;charset=UTF-8;base64," + styleBase64; System.out.println(styleText + TAB + " -> " + url); scene.getStylesheets().setAll(url); } }
type: Answer
answers question: http://stackoverflow.com/q/27585668

http://stackoverflow.com/a/27630440
upvote count: 0
has comment: http://stackoverflow.com/comment/43723153
type: AcceptedAnswer
has body: you can try something like this: // ratio - 0.0 - 1.0 List&lt;String&gt; getRatio(Map&lt;Double,String&gt; map, double ratio) { List&lt;String&gt; result = new ArrayList&lt;String&gt;(); for (Entry&lt;Double, String&gt; e: map.entrySet()) { double newRatio = (double) result.size() / map.size(); if (newRatio &gt;= ratio) break; result.add(e.getValue()); } return result; }
accepted answer of: http://stackoverflow.com/q/27630392
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/43722979
has comment: http://stackoverflow.com/comment/43723122
score: -1
answers question: http://stackoverflow.com/q/27630392
has comment: http://stackoverflow.com/comment/43722685

http://stackoverflow.com/q/27576782
tagged with: java
has answer: http://stackoverflow.com/a/27577969
linked to: http://stackoverflow.com/q/1458724
type: Question
tagged with: servlets
upvote count: 2
answer count: 3
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/27576923
has body: I want to add customers to a database using JSPs, JQuery and Servlets. When a customer already exists within the database table I want to show a confirmation message (Customer already exists. Are your sure you want to add the same customer?). When Customer does not exist all the data is written into the table and there is no need to show a confirm message. My jquery code so far: $('#myForm').submit(function() { var c = confirm("Customer have already. Are your sure you want to add the same customer?"); return c; }); And my servlet: int i = 0; ArrayList&lt;Customer&gt; cus = CustomerDao.addcustomer("abc"); i = cus.size(); if(i &gt; 0){ statement; }else{ statement ; } When I click the submit button it always shows the confirmation message. I don't wanna show confirmation message when the customer does not already exist in the database.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27576817
score: 2
has title: How can I display a confirmation message using Servlets
downvote count: 0

http://stackoverflow.com/a/27601024
answers question: http://stackoverflow.com/q/27600812
upvote count: 2
type: Answer
has body: Short answer: no. It's quite clear that you can't load your entire dataset in memory. You need a way to keep it on disk together with an index, so that you can access the relevant bits of the dataset without rescanning the whole file every time a new key is requested. Essentially, a DBMS is a mechanism for handling (large) quantities of data: storing, retrieving, combining, filtering etc. They also provide caching for commonly used queries and responses. So anything you are going to do will be a (partial) reimplementation of what a DBMS already does. I understand your concerns about having an external component to depend on, however note that a DBMS is not necessarily a server daemon. There are tiny DBMS which link with your program and keep all the dataset in a file, like SQLite does.,
score: 2
downvote count: 0

http://stackoverflow.com/q/27518380
has answer: http://stackoverflow.com/a/27518556
tagged with: server
has body: In our small company we have databases that is used by different software. For example a database that contains a user table with firstname, lastname, mailaddress, phonenumber. This shall be shared over multiple software applications. What is best design to use this table in multiple software applications. They are windows applications, SPA webapps and an android app and ios 7 app. What is the best way, so we don't have to hard code the connection string in each app? Is there something like Dependency Injection or JNDI?
tagged with: database
score: 0
answer count: 2
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43466764
type: UnansweredQuestion
has title: how to manage multiple data sources over multiple apps
has answer: http://stackoverflow.com/a/27518499
tagged with: java
has comment: http://stackoverflow.com/comment/43467143
tagged with: middleware
type: Question

http://stackoverflow.com/q/27536074
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43515757
has body: Hello I am having this problem where this code: public class FirstStepsApplication extends Application { private static final String ROOT_URI = "/"; @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); Directory rootDir = new Directory(getContext(), "war:///doc"); rootDir.setIndexName("index.html"); router.attach(ROOT_URI, rootDir); return router; } } Works in GAE localhost, when run with Maven: $mvn appengine:devserver No problem. However when deployed it does not work anymore. I've checked the logs and all I can see is that access to /index.html return 404
tagged with: capedwarf
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/27545112
tagged with: openshift
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43511024
tagged with: java
type: Question
has title: Restlet code works on local but not when deployed (on Openshift)
accepted answer: http://stackoverflow.com/a/27545112
tagged with: restlet

http://stackoverflow.com/a/27572337
score: 10
accepted answer of: http://stackoverflow.com/q/27571645
upvote count: 10
has comment: http://stackoverflow.com/comment/43570188
has body: The documentation of HttpURLConnection says: Each HttpURLConnection instance is used to make a single request but the underlying network connection to the HTTP server may be transparently shared by other instances. This means that you cannot create a new (POST) request on the same HttpURLConnection object. And indeed, you get an IllegalStateException from it. So you should remove the final modifier from the definition of con, and then, after finishing with the processing of the output of the original (GET) request, create another connection: con = (HttpURLConnection) url.openConnection(); Only then, you can continue with constructing your POST request. A little note: you use try-with-resources, so you don't need to explicitly close your streams. Also, you don't need two try blocks. In fact, you don't need to keep a reference to the InputStreamReader, as BufferedReader.close() also closes the underlying Reader, which also closes the underlying InputStream.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27571645

http://stackoverflow.com/comment/43597310
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27585534
type: QuestionComment
has text: Paste code for class X. What are the 3 methods and 4 attributes?

http://stackoverflow.com/comment/43493126
has text: "but the code doesn't seem to work for me" doesn't really help us identify the problem. What, specifically, is going wrong? Is there an error message or are you not getting the behavior you expected?
comment on: http://stackoverflow.com/q/27532305
score: 1
type: QuestionComment
type: Comment

onutterancecompleted
type: Tag
tags question: http://stackoverflow.com/q/27520018
tag name: onutterancecompleted

http://stackoverflow.com/a/65173675
has comment: http://stackoverflow.com/comment/126734061
downvote count: 0
has comment: http://stackoverflow.com/comment/126738146
answers question: http://stackoverflow.com/q/27585668
has body: After the implementation of JDK-8130738 in JavaFX 14, you can now change the advance of a tab character to any multiple of 'spaceAdvance'. Text and TextFlow now have a tabSize property and the CSS supports -fx-tab-size Since TextAreaSkin implements the TextArea using Text nodes, you can change the tab size of the TextArea with CSS. Example: package example.stackoverflow; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import javafx.application.Application; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.TextArea; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Stage; public class TextAreaTabs extends Application { private Scene scene; private File cssFile; public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { var slider = new Slider(1, 50, 8); slider.valueProperty().addListener((obs, old, newValue) -> { try { updateTabSize(newValue.intValue()); } catch (IOException ex) { System.err.println("Can't write CSS file."); } }); var ta = new TextArea("This is a test\n\tafter a tab\n\t1\t2\n"); ta.setFont(Font.font("Monospaced")); var vbox = new VBox(8,new HBox(8,new Label("Tab size:"),slider),ta); vbox.setPadding(new Insets(8)); scene = new Scene(vbox); primaryStage.setScene(scene); primaryStage.setTitle("TextArea Tab Experiment"); primaryStage.show(); } private void updateTabSize(int spaces) throws IOException { File oldFile = cssFile; cssFile = File.createTempFile("textareatabs", ".css"); cssFile.deleteOnExit(); Files.writeString(cssFile.toPath(), """ Text { -fx-tab-size: %d; } """.formatted(spaces), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); String conf…
type: Answer
has comment: http://stackoverflow.com/comment/126740320
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/126737807
has comment: http://stackoverflow.com/comment/126746802
has comment: http://stackoverflow.com/comment/126738574
has comment: http://stackoverflow.com/comment/126747551

http://stackoverflow.com/comment/43549069
has text: @tinker101 that also works fine. Are you shore, that the line is deleted when you give an existing user?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27542271
type: Comment

http://stackoverflow.com/comment/43497810
has text: Yes, 'But now, my question is regarding closing resources'. Use the finally in your code to close the resources you want. Did i get that wrong?
comment on: http://stackoverflow.com/a/27534633
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27492656
answer count: 3
tagged with: android
downvote count: 1
has comment: http://stackoverflow.com/comment/43417131
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43416990
tagged with: multithreading
has body: Android offers asynctask and handlers to communicate with an activity. But is it possible for a plain java thread to communicate with an activity and update an textview ? I tried to write a basic thread t = new thread(); but it would not allow me to access any textviews nor any members of the activity
has comment: http://stackoverflow.com/comment/43416998
upvote count: 0
has comment: http://stackoverflow.com/comment/43416895
has answer: http://stackoverflow.com/a/27492729
has answer: http://stackoverflow.com/a/27492714
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/27493341
has title: how can a java thread communicate with an activity

http://stackoverflow.com/comment/43533321
type: AnswerComment
has text: The php version of the code is fine I already have it and the code checks if the username selected is available or not and then returns either error=false if username is available or error=true if it is not available. What I want is for the android app to use this data and inform the user if the username is available or not
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27553394

http://stackoverflow.com/comment/43697170
comment on: http://stackoverflow.com/q/27639183
type: Comment
type: QuestionComment
has text: Guess what an int times 2 other ints results in.
score: 0

http://stackoverflow.com/q/27565557
favorite count: 0
has body: package my.app.bhaktamar; import android.app.Activity; //import android.content.Intent; import android.media.MediaPlayer; //import android.net.Uri; import android.os.Bundle; import android.util.Log; //import android.view.View; public class MainActivity extends Activity { MediaPlayer dontcall; @Override protected void onCreate(Bundle savedInstanceState) { Log.e("Pickle", "onCreate"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onResume() { Log.e("pickle", "onResume"); dontcall = MediaPlayer.create(this, R.raw.gpad1); dontcall.start(); super.onResume(); } @Override protected void onPause() { Log.e("pickle", "onPause"); dontcall.stop(); dontcall.release(); super.onPause(); } } What should i do so sound should play after autolock ?
tagged with: android
has title: My app get stop when auto lock,how can it be sorted
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27567004
has answer: http://stackoverflow.com/a/27565694
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/43698086
score: 0
type: Comment
type: QuestionComment
has text: public enum DocDatatype { PROFILE("Profile"), SUPPORT_DETAIL("SupportDetail"), I am writing test case for this class
comment on: http://stackoverflow.com/q/27639673

http://stackoverflow.com/a/27508045
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You will need to add @FormParam to your method parameters if you want them to be injected as such @POST @Path("/add") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response addAlert( @FormParam("name") String name, @FormParam("amount") int amount, @FormParam("timespan") String timespan, @FormParam("repo") String repo, @FormParam("action") String action) { }
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27507299
score: 1
answers question: http://stackoverflow.com/q/27507299

http://stackoverflow.com/a/27545828
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Ok guys, I have found the solution. The default base URI is http://localhost:8080/myapp. You can see it in Main.java, in line 16: public static final String BASE_URI = "http://localhost:8080/myapp/"; I changed localhost to 0.0.0.0, and it worked! public static final String BASE_URI = "http://0.0.0.0:8080/myapp/"; Thank you very much for your help, and I am sorry that I ended up answering my own question. I hope it helps some people in the future.
accepted answer of: http://stackoverflow.com/q/27524442
answers question: http://stackoverflow.com/q/27524442

listselectionlistener
tags question: http://stackoverflow.com/q/27546977
type: Tag
tag name: listselectionlistener

http://stackoverflow.com/q/27578208
has answer: http://stackoverflow.com/a/27578288
upvote count: 4
has comment: http://stackoverflow.com/comment/43581277
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43581291
tagged with: java
has body: I have a List&lt;Object&gt; objectsToProcess.Lets say it contains 1000000 item`s. For all items in the array you then process each one like this : for(Object : objectsToProcess){ Go to database retrieve data. process save data } My question is : would multi threading improve performance? I would of thought that multi threads are allocated by default by the processor anyways?
tagged with: multithreading
type: Question
duplicate of: http://stackoverflow.com/q/15292626
accepted answer: http://stackoverflow.com/a/27578327
score: 3
has comment: http://stackoverflow.com/comment/43581244
has answer: http://stackoverflow.com/a/27578327
possible better answer: http://stackoverflow.com/a/27578288
answer count: 2
downvote count: 1
has title: does multi threading improve performance? scenario java
linked to: http://stackoverflow.com/q/15292626
favorite count: 0

http://stackoverflow.com/q/27622895
answer count: 3
has title: How to add a value in a list inside another list?
favorite count: 0
has comment: http://stackoverflow.com/comment/43666585
upvote count: 3
has answer: http://stackoverflow.com/a/27623513
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/27622937
accepted answer: http://stackoverflow.com/a/27623513
tagged with: list
has answer: http://stackoverflow.com/a/27622937
tagged with: java
has body: I have a list of lists, using the following code: ArrayList&lt;List&lt;String&gt;&gt; keyHold = new ArrayList&lt;List&lt;String&gt;&gt;(); String cold[] = new String[]{"actions","cold","enabled"}; List&lt;String&gt; lCold = Arrays.asList(cold); lCold.add(Rows.getRow(rowNum, 0)); keyHold.add(lCold); String warm[] = new String[]{"actions","warm","enabled"}; List&lt;String&gt; lWarm = Arrays.asList(warm); lWarm.add(Rows.getRow(rowNum, 1)); keyHold.add(lWarm); This goes on for many more variations of this, with the strings changing. What I want to do is iterate through my list of lists, and for each list within, add a value to that list. So far, I am struggling for an answer and any assistance would be appreciated.
has answer: http://stackoverflow.com/a/27623036
type: Question
downvote count: 0

http://stackoverflow.com/q/27510998
upvote count: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27511089
has comment: http://stackoverflow.com/comment/43452217
possible better answer: http://stackoverflow.com/a/27511074
score: 13
has answer: http://stackoverflow.com/a/27511272
has answer: http://stackoverflow.com/a/27511074
type: Question
linked to: http://stackoverflow.com/q/23396421
tagged with: object
has body: I've seen some legacy code that uses lengthproperty on some objects and others that uses length() method. Currently I'm working with a NodeList from the org.w3c.dom package and I found that it have the getLength() method to get the numbers of elements. My Question is how as Java developer I can know how to determine when to use length, length(), size(), getLength()? obviously it depends of the object type and the API is there for read... but the point is how the Java Development select which of that implements in their classes. Note: In the Question When to use .length vs .length() Makoto answer's indicates that .length is a property on arrays. That isn't a method call, and length() is a method call on String. But, why is the reason? why not use ever a method or ever a property for maintain the consistency around all the API.
tagged with: java
has answer: http://stackoverflow.com/a/27511120
has comment: http://stackoverflow.com/comment/43452237
has title: When is length used as a method and when as property in Java?
downvote count: 0
favorite count: 0
answer count: 5
accepted answer: http://stackoverflow.com/a/27511120
has comment: http://stackoverflow.com/comment/43452223
has answer: http://stackoverflow.com/a/27511299

http://stackoverflow.com/comment/138520423
score: 0
type: Comment
type: QuestionComment
has text: This is almost a duplicate of [Java 8 Stream with batch processing](https://stackoverflow.com/questions/30641383/java-8-stream-with-batch-processing/78541045#78541045), the only difference is that the latter appears to use a `List` as the source of data. Basically all answers here would apply to the other, but not vice-versa. Some answers here also apply only to lists as well though. It seems it could make sense to merge the two questions. (I have an answer on the other one that is similar to one here so I’m refraining from marking them as duplicates due to the conflict of interest)
comment on: http://stackoverflow.com/q/27583623

http://stackoverflow.com/a/27581825
has body: You can create a function and pass it the value that you want to replace. It will be better then recursion because you can avoid extra cost of stack that will be required during each recursive call public static void replace(char[][] arr, char target, char replacment) { for (int i = 0; i&lt; arr.length; i++) { for (int j = 0; j&lt; arr[i].length; j++) { if (arr[i][j] == target) { arr[i][j] = replacment; } } } } Then you can call it like this replace(arr, (char)1, (char)2);
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43588168
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27581641

http://stackoverflow.com/comment/43681397
type: QuestionComment
has text: Not every x bytes, there're 3 parts(binary tab1 binary). I edited the question. I hope it's more clear now.
score: 0
comment on: http://stackoverflow.com/q/27600856
type: Comment

http://stackoverflow.com/q/27525678
has answer: http://stackoverflow.com/a/27525824
tagged with: java
type: Question
has title: Sorting in Java/Selenium/html
has answer: http://stackoverflow.com/a/27525763
has answer: http://stackoverflow.com/a/27525871
tagged with: wait
has body: This is Java, Selenium and Chrome though it must work for IE and Firefox too, I am writing an automation script to verify a web page. Part of the page is a table with columns such as " Name[ud] Dept[ud] Date[ud] Status[ud] ..." with thousands of rows of data. The [ud] are actually up and down arrows that appear when you hover over the columns, so if you click one it sorts that column ascending or descending. After I click, I get the column of values into a list, make a sorted copy of the list and compare them. This works sometimes. The data takea while to sort. Here are the three scenarios 1) The sort happens quickly enough so that when I get the values, they are already sorted and the test works. 2) The sort takes a while so when I get the values they are still the pre-sorted values in which case the test is invalid. 3) The sort is partially done by the time I get the values resulting in an eventual stale element. The management here frowns on doing a Thread.sleep(milliseconds) and I am not sure what a good time would be anyway. I can't find any xpath I can wait for because the paths are there before and after the sort. I am looking for a way to wait till the sort is done. Any suggestions. Any suggestions? The only thing I can notice is that the cursor spins while the sort is being done. Can Selenium perhaps be told to wait for the cursor to stop spinning?
answer count: 4
tagged with: xpath
has answer: http://stackoverflow.com/a/37803727
type: UnansweredQuestion
score: 0
tagged with: selenium

http://stackoverflow.com/q/27595671
downvote count: 1
has comment: http://stackoverflow.com/comment/43616293
type: Question
has comment: http://stackoverflow.com/comment/43615232
score: -1
has title: Require character escapes regex
has comment: http://stackoverflow.com/comment/43615155
upvote count: 0
has answer: http://stackoverflow.com/a/27595697
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43615270
linked to: http://stackoverflow.com/q/27596904
tagged with: regex
has comment: http://stackoverflow.com/comment/43615153
duplicate of: http://stackoverflow.com/q/27596904
type: AnsweredQuestion
has body: I am attempting to build a key-value serializer and I need to match all characters except =, ", , and \ when not prefixed with a backslash. So far what I have to match the rest of the pattern is with 'here' being where I need to match the 'special' characters ^[[a-zA-Z0-9-]+[=][^here]]+$
accepted answer: http://stackoverflow.com/a/27595697
tagged with: java
has comment: http://stackoverflow.com/comment/43615223

http://stackoverflow.com/q/27567550
has body: A desktop application stores its data in a xml file. This xml file, together with other files gets stored in a Zip-Archive to persist its state. I´ve always been at daggers drawn with encoding, but this time I really don´t understand, why its not working. Following problem: When I persist the Data in the xml file, everything seems fine. I log the output and all encodings are correct. I can open the Zip with other tools checking for the XML and the encoding is fine there as well, but as soon as I try to read it in again in my Java Application, the encoding gets messed up, like for example german umlauts are not correct anymore. Following code is used to read in the xml from the zip: private String readZipArchive( final Path path ) throws ZipException, IOException { String xmlData = null; try (ZipFile zipFile = new ZipFile( path.toFile(), StandardCharsets.UTF_8 )) { final Enumeration&lt;? extends ZipEntry&gt; zipEntryEnum = zipFile.entries(); while ( zipEntryEnum.hasMoreElements() ) { final ZipEntry zipEntry = zipEntryEnum.nextElement(); logger.debug( "zipEntry: " + zipEntry + " comment: " + zipEntry.getComment() ); switch ( FileType.valueOf( zipEntry.getComment() ) ) { case DATA: xmlData = convertStreamToString( zipFile.getInputStream( zipEntry ) ); //Here the String is not UTF 8, why? German Umlauts are broken: logger.dev( "Load State from File: \n" + xmlData ); break; case PICTURE: //OTHER Implementation, not important. break; } } return xmlData; } } private static String convertStreamToString( final InputStream is ) { try (Scanner s = new Scanner( is, "UTF-8" )) { s.useDelimiter( "\\A" ); return s.hasNext() ? s.next() : ""; } } Can anyone see, what my mistake is here? How to maintain the correct UTF-8 encoding, or can anyone think of any other reasons what could cause the encoding to break?
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27568362
upvote count: 1
type: Question
has title: persist/read xml content in ZIP maintaining the correct encoding
tagged with: encoding

http://stackoverflow.com/comment/43616880
score: 0
comment on: http://stackoverflow.com/q/27596520
type: QuestionComment
has text: This is your full coding?
type: Comment

http://stackoverflow.com/comment/43496234
type: AnswerComment
comment on: http://stackoverflow.com/a/27533833
type: Comment
has text: @s55michi or move `out += "bla";` inside the `if` code block.
score: 1

http://stackoverflow.com/q/27476204
has comment: http://stackoverflow.com/comment/43387938
has comment: http://stackoverflow.com/comment/43386933
downvote count: 0
has body: I have an application that when run in the IDE (Netbeans 8) works fine. The program makes use of 4 external .jar libraries. It also has a virtual machine argument pointing to a DLL. When I try to execute the .jar from the command line I get an error. This leads me to believe that there is a classpath issue. This is the error itself: C:\Users\piuser\Documents\NetBeansProjects\GameTrakaDesktopClient\dist&gt;java -jar GameTrakaDesktopClient.jar Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source) at sun.security.util.SignatureFileVerifier.process(Unknown Source) at java.util.jar.JarVerifier.processEntry(Unknown Source) at java.util.jar.JarVerifier.update(Unknown Source) at java.util.jar.JarFile.initializeVerifier(Unknown Source) at java.util.jar.JarFile.getInputStream(Unknown Source) at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source) at sun.misc.Resource.cachedInputStream(Unknown Source) at sun.misc.Resource.getByteBuffer(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 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.doPri…
has comment: http://stackoverflow.com/comment/43386818
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43386662
has comment: http://stackoverflow.com/comment/43387835
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27477627
has title: Exception in thread "main" java.lang.SecurityException: Invalid signature file d igest for Manifest main attributes
has comment: http://stackoverflow.com/comment/43387646
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43387995
type: Question
upvote count: 4
tagged with: ant
answer count: 1
score: 4

http://stackoverflow.com/a/27505130
has comment: http://stackoverflow.com/comment/43543061
upvote count: 5
answers question: http://stackoverflow.com/q/27504925
has body: There are many classes in standard java library that you cannot subclass, arrays aren't the only example. Consider String, or StringBuffer, or any of the "primitive wrappers", like Integer, or Double. There are optimizations that JVM does based on knowing the exact structure of these objects when it deals with them (like unboxing the primitives, or manipulating array memory at byte level). If you could override anything, it would not be possible, and affect the performance of the programs very badly.
type: Answer
score: 2
downvote count: 3

http://stackoverflow.com/comment/43456051
type: AnswerComment
type: Comment
has text: Fyi- one step scaling generally doesn't produce a nice result (especially over a large range), typically better to use a stepped approach, [for example](http://stackoverflow.com/questions/14115950/quality-of-image-after-resize-very-low-java/14116752#14116752)
comment on: http://stackoverflow.com/a/27512113
score: 0

http://stackoverflow.com/comment/43672666
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27625410
has text: @user3198603 I've reworded my answer. `@InitBinder` doesn't work on the model attribute. It works on the `WebDataBinder` which works on the model attribute.
type: AnswerComment

http://stackoverflow.com/q/27626959
has comment: http://stackoverflow.com/comment/43716966
accepted answer: http://stackoverflow.com/a/27627077
score: 0
tagged with: editor
type: AnsweredQuestion
tagged with: java
has title: Get the current source code of an Eclipse editor?
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27627077
answer count: 1
has body: I am working with Eclipse IDE. I want to develop a plug-in first of all, this plug-in allows me to get the whole source code as a simple string. I made a simple "hello the world" plug-in using the template "hello world command". Now I am searching to get the source code from the editor of Eclipse and display it with System.out.println(); statement instead of showing HELLO THE WORLD. I tried this but it shows me only the hierarchical sequence of my project, packageName/src/nameOfClass. System.out.println( Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput() ); My goal is to get the source code of the class itself (public class nameOfClass{ *** }).

http://stackoverflow.com/comment/43548525
type: Comment
has text: i used mysql too v 5.6
comment on: http://stackoverflow.com/a/27542271
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43713616
comment on: http://stackoverflow.com/q/27639844
type: Comment
type: QuestionComment
score: 0
has text: No actually I use 2.x sorry for the old link

http://stackoverflow.com/comment/43580950
type: Comment
comment on: http://stackoverflow.com/a/27575700
has text: Not sure if I understood your question completely. If I do then No. You will need to have POM.xml all the time in order to run the tests with multiple driver instances
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43593883
type: Comment
type: QuestionComment
has text: Well, the compiler tells you what you are doing wrong; you have to handle the exception.
score: 0
comment on: http://stackoverflow.com/q/27584671

http://stackoverflow.com/comment/43496229
score: 0
has text: Where is the loop where you add all lessons to the object returned? It seems to me you are returning just an item indeed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27533888

http://stackoverflow.com/a/27532690
score: 6
answers question: http://stackoverflow.com/q/27532532
accepted answer of: http://stackoverflow.com/q/27532532
has comment: http://stackoverflow.com/comment/43505878
type: AcceptedAnswer
upvote count: 6
downvote count: 0
has body: Subclass fields do not override superclass fields. You can set a default value through constructors, as illustrated below. // parent public class A { private int value = 0; public A( int initialValue ) { value = initialValue; } public void print() { System.out.println(value); } } // child class public class B extends A { public B() { super( 1 ); } } Also, in most cases, your life will be easier if you avoid protected fields. Protected fields open your data to direct access and modification by other classes, some of which you may not control. The poor encapsulation can allow bugs and inhibit modification. As suggested in the Java tutorials on access control: "Use the most restrictive access level that makes sense for a particular member. Use private unless you have a good reason not to."
has comment: http://stackoverflow.com/comment/43506413
type: Answer
has comment: http://stackoverflow.com/comment/43493999
has comment: http://stackoverflow.com/comment/43494327

http://stackoverflow.com/comment/43611496
score: 2
has text: Yep blocking the Event Dispatching Thread
comment on: http://stackoverflow.com/q/27593900
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/85065921
comment on: http://stackoverflow.com/a/27657909
type: AnswerComment
score: 0
has text: have you found any other way out to hide the element ? Also your provided link isn't working anymore.
type: Comment

http://stackoverflow.com/a/27590000
has body: The problem is either that data array does not have two elements (getting exception on third line implicates it would not have even one element) or the return of getBytes() does not return enough data. You need to check for this. The second problem might also be fixed by filling-up the data - probably strings - accordingly.
accepted answer of: http://stackoverflow.com/q/27589885
answers question: http://stackoverflow.com/q/27589885
has comment: http://stackoverflow.com/comment/43647236
has comment: http://stackoverflow.com/comment/43604036
has comment: http://stackoverflow.com/comment/43604080
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43604001
type: Answer
has comment: http://stackoverflow.com/comment/43604076
has comment: http://stackoverflow.com/comment/43603974
score: 0

http://stackoverflow.com/comment/43627404
type: QuestionComment
has text: I believe [this is how you get the exception](http://ideone.com/x4pvcd). You need to specify the input (_stdin_) beforo you run it.
score: 0
comment on: http://stackoverflow.com/q/27602088
type: Comment

http://stackoverflow.com/a/27585324
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27585271
answers question: http://stackoverflow.com/q/27585271
upvote count: 1
has body: private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { Log.i(TAG, "Logged in..."); } else if (state.isClosed()) { Log.i(TAG, "Logged out..."); } } There is in facebook sdk as any other sign in sdk a callback method of fail and success. on success just launch ur main activity or finish the current one as u wish.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43450144
comment on: http://stackoverflow.com/q/27509890
type: Comment
type: QuestionComment
score: 2
has text: 6 for totalLines, 1 for consecLines.

http://stackoverflow.com/q/27518999
possible better answer: http://stackoverflow.com/a/27519090
has title: How to improve search in an array of HashMap
tagged with: arrays
accepted answer: http://stackoverflow.com/a/27521137
has answer: http://stackoverflow.com/a/27519090
has comment: http://stackoverflow.com/comment/43469000
answer count: 3
has comment: http://stackoverflow.com/comment/43468043
has comment: http://stackoverflow.com/comment/43468732
tagged with: hash
has comment: http://stackoverflow.com/comment/43469259
has comment: http://stackoverflow.com/comment/43467813
has answer: http://stackoverflow.com/a/27519106
has comment: http://stackoverflow.com/comment/43467969
has answer: http://stackoverflow.com/a/27521137
has comment: http://stackoverflow.com/comment/43467984
type: AnsweredQuestion
has body: A search in any HashMap (or any hash based data structure) requires a single hash operation i-e O(1). However, when we have to search through an array of HashMaps then a single search will requires O(n) hash operations, where n is the size of array. I was wondering since array is a collections of consecutive memory locations, therefore there could be an efficient method to reduce the search from O(n) to O(1) in array of HashMap. Or we can design some object that in fact have the advantage of array as well as require single hash operation for search. Any suggestion ??? Consider the scenario, You are processing elements from different users and you want to keep them based on user profiles (separate from each other). The most memory efficient way is to keep them separate is using array of HashMap.
score: 0
tagged with: java
type: Question
tagged with: algorithm

http://stackoverflow.com/comment/43691634
type: QuestionComment
type: Comment
has text: @Back no not a race, but the fact remains that all popular underlying native APIs (posix, win32) do it, so it makes no sense for a low level abstraction to abstract that much away. That said one shouldn't use raw threads anyhow - it's rarely what's best.
score: 0
comment on: http://stackoverflow.com/q/27635610

http://stackoverflow.com/a/42020869
has comment: http://stackoverflow.com/comment/93486853
has body: When I tried @PaulSamsotha's solution with Jersey client 2.21.1, there was 400 error. It worked when I added following in my client code: MediaType contentType = MediaType.MULTIPART_FORM_DATA_TYPE; contentType = Boundary.addBoundary(contentType); Response response = t.request() .post(Entity.entity(multipartEntity, contentType)); instead of hardcoded MediaType.MULTIPART_FORM_DATA in POST request call. The reason this is needed is because when you use a different Connector (like Apache) for the Jersey Client, it is unable to alter outbound headers, which is required to add a boundary to the Content-Type. This limitation is explained in the Jersey Client docs. So if you want to use a different Connector, then you need to manually create the boundary.
has comment: http://stackoverflow.com/comment/93522617
type: Answer
has comment: http://stackoverflow.com/comment/93481544
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/115688984
answers question: http://stackoverflow.com/q/27609569
upvote count: 2
has comment: http://stackoverflow.com/comment/88059582

http://stackoverflow.com/comment/43671057
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27625293
has text: ++ is an increment operator so the compiler may be expecting a variable name either before or after ++
type: Comment

http://stackoverflow.com/comment/43491399
type: AnswerComment
comment on: http://stackoverflow.com/a/27530605
type: Comment
has text: @bridiver Good point, I see what you mean. I updated my answer to include what I do with initialization. Right now I don't use singletons, each spout/bolt manages its own connection.
score: 0

http://stackoverflow.com/q/27510216
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43451243
type: Question
has comment: http://stackoverflow.com/comment/43451402
tagged with: java
has title: Why is the JFrame transparent?
has comment: http://stackoverflow.com/comment/43450589
answer count: 1
has body: I have a JFrame that is acting up. If I just set the JFrame to visible, then the entire JFrame appears, but if I attempt to do anything after setting the JFrame to visible, then the JFrame will appear, but is transparent with only the title and the close options visible. This is only happening recently and I have no idea what is going on... Visible JFrame GUI frame = new GUI(); //GUI is a class that extends JFrame frame.setVisible(true); Transparent JFrame GUI frame = new GUI(); //GUI is a class that extends JFrame frame.setVisible(true); frame.setVisible(false); //If I throw a breakpoint here, as soon as it goes from .setVisible(true) to this line, the GUI appears, but is transparent Code public class GUI extends JFrame { private JPanel contentPane; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GUI frame = new GUI(); frame.setVisible(true); frame.setVisible(false); } catch (Exception e) { e.printStackTrace(); } } }); } public GUI() { setTitle("Title"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 330, 250); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); } } Image
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43451149
tagged with: jframe
has comment: http://stackoverflow.com/comment/43450881
type: UnansweredQuestion
tagged with: transparent
has answer: http://stackoverflow.com/a/27510855

http://stackoverflow.com/comment/43602118
has text: So I tried Thread.interrupt() and it had no effect, but Thread.stop() worked perfectly with no problem. I think in the past Ive been nervous using this method but sometimes it is actually what you need.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27573907
type: AnswerComment

http://stackoverflow.com/q/27635255
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/15826997
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27635395
has title: Remove white screen in WebView - Android Eclipse
has answer: http://stackoverflow.com/a/27635743
type: UnansweredQuestion
tagged with: webview
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43690766
tagged with: java
score: -1
tagged with: eclipse
has body: Upon running the WebView in ICS, I'm encountering such problem, a white screen always flickering before the WebView runs. I don't know if it is normal or not. If yes, are there any other way to remove it? Thanks. Here are my codes. WebViewSet.java public class WebViewSet { public static void settings(WebView view) { WebSettings s = view.getSettings(); s.setJavaScriptEnabled(true); s.setPluginState(PluginState.ON); s.setTextZoom(100); } } Home.java - Where in my I call my WebView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Layout View rootView = inflater.inflate(R.layout.fragment_home, container, false); // webview mWebView = (WebView)rootView.findViewById(R.id.home_webview); WebViewSet.settings(mWebView); mWebView.loadUrl("file:///android_asset/blover.swf"); return rootView; } }

http://stackoverflow.com/a/27495932
upvote count: 2
has body: TreeNode class is part of jackson-core. So you are probably missing the jackson-core JAR on your classpath. You can download it from here for example. Btw: This answer assumes that you are not using Maven to manage your dependencies, in which case the jackson-core dependency should be resolved automatically.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27495841
type: Answer
accepted answer of: http://stackoverflow.com/q/27495841
score: 2

http://stackoverflow.com/q/27491904
type: UnansweredQuestion
tagged with: path
has title: Manipulate paths with MS Windows semantics
tagged with: java
has body: In Java, the standard library File class can be used to manipulate platform-specific paths. I have an application that will be deployed on Linux, but which needs to manipulate win32-format paths such as "C:\Path\To\File.exe" and perform operations such as obtaining the parent path "C:\Path\To\". If I use the File class, this only works if the application is also running on Windows. What alternative do I have?
type: Question
answer count: 1
score: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/43416252
has answer: http://stackoverflow.com/a/27495538

http://stackoverflow.com/q/27614301
has answer: http://stackoverflow.com/a/43143254
favorite count: 0
has answer: http://stackoverflow.com/a/42442920
has answer: http://stackoverflow.com/a/40277402
type: UnansweredQuestion
upvote count: 76
has comment: http://stackoverflow.com/comment/43680738
answer count: 10
tagged with: spring
has body: I'm quite new to spring boot and I'd like to create a multiple datasource for my project. Here is my current case. I have two packages for entity for multiple database. Let's say com.test.entity.db.mysql ; for entities that belong to MySql com.test.entity.db.h2 ; for entities that belong to H2 Databases So, currently I have two entities class UserMySql.java @Entity @Table(name="usermysql") public class UserMysql{ @Id @GeneratedValue public int id; public String name; } UserH2.java @Entity @Table(name="userh2") public class Userh2 { @Id @GeneratedValue public int id; public String name; } I'd like to achieve a configuration where if I create user from UserMySql, it will be saved to MySql Database, and if I create user from Userh2 it will be saved to H2 Databases. So, I also have two DBConfig, let's say MySqlDbConfig and H2DbConfig. (com.test.model is package where I'll put my Repositories class. It will be defined below) MySqlDbConfig.java @Configuration @EnableJpaRepositories( basePackages="com.test.model", entityManagerFactoryRef = "mysqlEntityManager") public class MySqlDBConfig { @Bean @Primary @ConfigurationProperties(prefix="datasource.test.mysql") public DataSource mysqlDataSource(){ return DataSourceBuilder .create() .build(); } @Bean(name="mysqlEntityManager") public LocalContainerEntityManagerFactoryBean mySqlEntityManagerFactory( EntityManagerFactoryBuilder builder){ return builder.dataSource(mysqlDataSource()) .packages("com.test.entity.db.mysql") .build(); } } H2DbConfig.java @Configuration @EnableJpaRepositories( entityManagerFactoryRef = "h2EntityManager") public class H2DbConfig { @Bean @ConfigurationProperties(prefix="datasource.test.h2") public DataSource h2DataSource(){ return DataSourceBuilder .create() .driverClassName("org.h2.Driver") .build(); } @Bean(name="h2EntityManager") public LocalContainerEntityManagerFactoryBean h2EntityManagerFactory( EntityManagerFactoryBuilder builder){ return builder.dataSource(h2DataSource()) .packages("com.test.en…
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/52059918
has answer: http://stackoverflow.com/a/33106442
has answer: http://stackoverflow.com/a/48240987
has title: Spring Boot Multiple Datasource
tagged with: java
linked to: http://stackoverflow.com/q/30337582
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/38482733
score: 74
has answer: http://stackoverflow.com/a/43218966
downvote count: 2
has answer: http://stackoverflow.com/a/27679997
has comment: http://stackoverflow.com/comment/43657845
has comment: http://stackoverflow.com/comment/82679718
has comment: http://stackoverflow.com/comment/57012962
has answer: http://stackoverflow.com/a/77429897

http://stackoverflow.com/q/27591767
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/4810803
tagged with: android
has title: Cannot link to fb profile page when fb app is installed
downvote count: 0
has answer: http://stackoverflow.com/a/33861615
type: UnansweredQuestion
tagged with: facebook
has comment: http://stackoverflow.com/comment/43609167
score: 1
has body: I'm struggling linking to a Facebook profile page when the Facebook app is installed. It says that the page is not available. When the facebook app is not installed (opening with browser), everything works fine. Any ideas? public static Intent getFBIntent(Context context, String facebookId) { try { // Check if FB app is even installed context.getPackageManager().getPackageInfo("com.facebook.katana", 0); String facebookScheme = "fb://profile/" + facebookId; //also tried with /page Log.d("FB_LINK", facebookScheme); return new Intent(Intent.ACTION_VIEW, Uri.parse(facebookScheme)); } catch(Exception e) { // Cache and Open a url in browser String facebookProfileUri = "https://www.facebook.com/" + facebookId; return new Intent(Intent.ACTION_VIEW, Uri.parse(facebookProfileUri)); } }
tagged with: java
has comment: http://stackoverflow.com/comment/43609875
has comment: http://stackoverflow.com/comment/43609943
type: Question
upvote count: 1

http://stackoverflow.com/q/27482835
has body: I am using JPA and and Jackson is used for generating JSON Emp.java @Entity @NamedQuery(name = "Emp.findAll", query = "select o.empNo, o.empName from Emp o ") @Table(name = "EMP") public class Emp implements Serializable { @Column(name = "ename") private String empName; @Id @Column(name = "empno", nullable = false) private String empNo; ..... In service class I have the following code @GET @Path("/emplist") @Produces(MediaType.APPLICATION_JSON) public Object getEmployees() { List&lt;Emp&gt; list = this.findAll(); ObjectMapper objectMapper = new ObjectMapper(); empAsJson = objectMapper.writeValueAsString(list); public List&lt;Emp&gt; findAll() { return getEntityManager().createNamedQuery("Emp.findAll").getResultList(); } The problem is generated JSON doesn't have attribute names, e.g. ["2390","JAMES"], Whereas if I change namedQuery in Emp class to select o from Emp o then generated JSON has attribute names as shown below [{"empNo":"2390","empName":"JAMES"}, What could be the reason for this and how can I resolve this issue?
accepted answer: http://stackoverflow.com/a/27482984
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27482965
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/27482960
has answer: http://stackoverflow.com/a/27482960
type: Question
tagged with: jpa
tagged with: jackson
has answer: http://stackoverflow.com/a/27482984
score: 0
has title: JPA Entity attribute names missing in generated JSON
answer count: 3

http://stackoverflow.com/q/27612302
type: Question
answer count: 2
tagged with: for-loop
has title: How do I make this table 0-9 with loops in Java?
possible better answer: http://stackoverflow.com/a/27612387
upvote count: 1
has comment: http://stackoverflow.com/comment/43646887
favorite count: 0
has answer: http://stackoverflow.com/a/27612330
accepted answer: http://stackoverflow.com/a/27612330
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27612387
score: 1
tagged with: java
tagged with: loops
has body: How do I make this table? This is what should be the outcome: 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 0 1 3 4 5 6 7 8 9 0 1 2 4 5 6 7 8 9 0 1 2 3 5 6 7 8 9 0 1 2 3 4 6 7 8 9 0 1 2 3 4 5 7 8 9 0 1 2 3 4 5 6 8 9 0 1 2 3 4 5 6 7 9 0 1 2 3 4 5 6 7 8 And this is the best I could come up with: for (int i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 10; j++) { if (i + j &lt; 10) { System.out.print(i + j); } else System.out.print("x"); } System.out.println(); } } } I simply can't find a solution how to get numbers running again past 9 with the beginning of 0,1,2,3 etc. My code would generate next: 0123456789 123456789x 23456789xx 3456789xxx 456789xxxx 56789xxxxx 6789xxxxxx 789xxxxxxx 89xxxxxxxx 9xxxxxxxxx

self-signed
type: Tag
tags question: http://stackoverflow.com/q/27597508
tag name: self-signed

http://stackoverflow.com/comment/43495847
score: 0
type: Comment
has text: Thank you for your answer, but I already tried this and it did not help me to solve this issue.
comment on: http://stackoverflow.com/a/27529341
type: AnswerComment

http://stackoverflow.com/comment/43405623
comment on: http://stackoverflow.com/q/27485588
has text: If it is not possible, i have to use another solution, obviously. However, I ask users for lists, e.g. for a number of Dates: "List the Dates of your previous 5 appointments" or "List all your previous adresses where you lived longer than one month and the period of time when you lived there". And I thought a table to enter such data would be a pretty obvious choice.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27566006
type: Answer
has body: You can use: getClass().getResourceAsStream("/" + fileName); to get InputStream of file in resources folder.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27565876
downvote count: 0

http://stackoverflow.com/comment/43526904
comment on: http://stackoverflow.com/q/27549969
score: 0
type: Comment
type: QuestionComment
has text: @hfontanez gameOver() is a boolean which returns true if someone has won or if it is a tie (i.e. no squares remaining). Not really a big issue im worried about, it would do the smae thing while saving maybe 2 lines of code.

http://stackoverflow.com/q/27509861
tagged with: ioc-container
has answer: http://stackoverflow.com/a/27510883
has title: How Spring Ioc container interacts with Tomcat container
answer count: 3
downvote count: 0
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
score: 11
has answer: http://stackoverflow.com/a/27529194
tagged with: spring
upvote count: 11
has body: I am familiar with the Spring Framework and have done some work in it. In one of my interviews, I was asked "there is a web application deployed in Apache Tomcat; tell me how does the "Tomcat container" (used for servlets) interact with "Spring IoC container" (used for Spring beans)?" I couldn't understand what the interviewer meant by that and was left speechless. Can someone please clarify what this question was about and what a reasonable answer to it might be?
tagged with: java
has answer: http://stackoverflow.com/a/27509950
type: Question

http://stackoverflow.com/comment/43510079
has text: erm, see whether this is what you want?
type: AnswerComment
comment on: http://stackoverflow.com/a/27540808
score: 0
type: Comment

http://stackoverflow.com/a/27532707
type: Answer
has comment: http://stackoverflow.com/comment/43494473
score: 0
has comment: http://stackoverflow.com/comment/43494791
answers question: http://stackoverflow.com/q/27531840
has comment: http://stackoverflow.com/comment/43494252
has body: MyForm is bean for your jsp. So all the html tag property in JSP page should be in your form. &lt;html:select name="selection" property="option" but option is not there in your form page.
has comment: http://stackoverflow.com/comment/43494228

google-app-engine
tags question: http://stackoverflow.com/q/27573330
tag name: google-app-engine
tags question: http://stackoverflow.com/q/27595327
tags question: http://stackoverflow.com/q/27536788
type: Tag
tags question: http://stackoverflow.com/q/27507668
tags question: http://stackoverflow.com/q/27499100
tags question: http://stackoverflow.com/q/27574311
tags question: http://stackoverflow.com/q/27553217
tags question: http://stackoverflow.com/q/27575102
tags question: http://stackoverflow.com/q/27496641
tags question: http://stackoverflow.com/q/27475714
tags question: http://stackoverflow.com/q/27588075
tags question: http://stackoverflow.com/q/27576049
tags question: http://stackoverflow.com/q/27623383
tags question: http://stackoverflow.com/q/27585435
tags question: http://stackoverflow.com/q/27528330
tags question: http://stackoverflow.com/q/27587871
tags question: http://stackoverflow.com/q/27546952
tags question: http://stackoverflow.com/q/27536074
tags question: http://stackoverflow.com/q/27600245
tags question: http://stackoverflow.com/q/27581017
tags question: http://stackoverflow.com/q/27504836
tags question: http://stackoverflow.com/q/27569348
tags question: http://stackoverflow.com/q/27614210
tags question: http://stackoverflow.com/q/27539026
tags question: http://stackoverflow.com/q/27611890
tags question: http://stackoverflow.com/q/27575440
tags question: http://stackoverflow.com/q/27536240
tags question: http://stackoverflow.com/q/27591734
tags question: http://stackoverflow.com/q/27575569
tags question: http://stackoverflow.com/q/27579686
tags question: http://stackoverflow.com/q/27512404
tags question: http://stackoverflow.com/q/27529211
tags question: http://stackoverflow.com/q/27545554
tags question: http://stackoverflow.com/q/27581492
tags question: http://stackoverflow.com/q/27537358

http://stackoverflow.com/a/27558576
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/43563697
has comment: http://stackoverflow.com/comment/43543520
has body: To answer your question directly, I think BigInteger.modPow might be what you're looking for. public BigInteger modPow(BigInteger exponent, BigInteger m) Returns a BigInteger whose value is (this^exponent mod m) Alternatively (and more efficiently), you could also take (a mod n) to the (b mod n) power, this should make the code run much quicker. (a^b mod n) = ((a mod n)^(b mod n) mod n)
score: 1
answers question: http://stackoverflow.com/q/27558513
has comment: http://stackoverflow.com/comment/43563965
downvote count: 2

http://stackoverflow.com/comment/43795527
has text: I completed my answer. I think you need a concrete example and I hope you'll find that in the CXF samples. If you can provide me more information about the authentication protocol you want, maybe I could help you more ^^.
type: Comment
comment on: http://stackoverflow.com/a/27657972
type: AnswerComment
score: 0

http://stackoverflow.com/q/27500274
has title: OptimisticLocking is not working in eclipse link
tagged with: java
type: UnansweredQuestion
tagged with: optimistic-locking
tagged with: eclipselink
tagged with: version
tagged with: jpa
has body: I am working on a project and due to certain issue I am changing pessimistic locking to optimistic locking. While doing so i am getting an error while updating the entity in the code as i tried it as a standalone application so there is no chance that two threads are updating it simultaneously. I checked the value of version in the different part of the code. Its showing it as 0. While calling flush or commit its giving an excepion that it is updated to 1. Note: I already added @version int version_id field in entity for optimisticlocking. The code is as below: WorkItem tmp_workItem=entityManager.find(WorkItem.class , workItem.getEntityKey()); logger.info("Before merge"+ tmp_workItem.getVersion()); entityManager.merge(workItem); tmp_workItem=entityManager.find(WorkItem.class , workItem.getEntityKey()); logger.info("After merge"+tmp_workItem.getVersion()+" "+workItem.getVersion()); //logger.info(entityManager.getLockMode(WorkItem.class).toString()); entityManager.flush(); logger.info("After flush"+tmp_workItem.getVersion()); response = true; This code is throwing an exception : getVersion : 1 ] cannot be updated because it has changed or been deleted since it was last read. Class&gt; com.csg.ib.cobra.domain.WorkItem Primary Key&gt; [9553] at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:549) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1559 The Values of version in logger are : before merge : 0 0 after merge : 0 0 before flush: 0 0 Then how it can get incresed by 1 while calling entityManger.flush() )
type: Question
score: 0
has answer: http://stackoverflow.com/a/27509685
answer count: 1

http://stackoverflow.com/q/27616762
has comment: http://stackoverflow.com/comment/43655255
type: Question
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/43689331
score: 5
tagged with: dump
has comment: http://stackoverflow.com/comment/43654954
has body: in my company we develope an enterprise web application in Spring (Flex frontend) and deploy this app to our customers in Tomcat 6 in SAAS style. Recently we are suffering from (seemingly) random OutOfMemory errors so after investigation I knew that we should inspect the memory dump of the JVM in the moment of the error. The JVM we use is 1.6.18 and the Tomcat version is Tomcat 7.0.23 under Windows Server 2008. I added the parameter -XX:+HeapDumpOnOutOfMemoryError in the Tomcat monitor panel (under Java tab) but the machines aren't producing any dump. The full java options are set as follows on the server we are investigating: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0 -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 7.0 -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 7.0\endorsed -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 7.0\conf\logging.properties -XX:PermSize=128m -XX:MaxPermSize=1024m -Xms1024m -Xmx6144m -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false As you can see the max heap size is pretty large (6 Gigs) since out app is particurarly heavy. I added for testing reasons the jmx parameters in order to view the JVM status in real time with VisualVM, but nothig occurred while I was looking at it. All that the stderr shows is this: java.lang.OutOfMemoryError Nothing before it (except other errors that I don't know if correlated, but they are logged hours or several minutes before the OOM) and nothing after it. It seems strange to me that it doesn't report the memory section (Java heap size, or Permgen Space). Maybe the memory heap reserved is too big and the JVM can't write it at since it's in a criti…
has comment: http://stackoverflow.com/comment/43687498
answer count: 1
upvote count: 5
tagged with: java
type: UnansweredQuestion
has title: Java Spring app + Tomcat: JVM doesn't make memory dump
has answer: http://stackoverflow.com/a/27616842
downvote count: 0
tagged with: tomcat
tagged with: jvm
favorite count: 0

http://stackoverflow.com/q/27493785
favorite count: 0
has body: I have a question regarding hijacking session variables. Let us suppose we have a web app supported by Spring Security and I have landed on a page with a bunch of session variables stored on the server side. Now, session variables normally are not accessible purely from the client side. Is there any way for the client to somehow get the page re-directed to another web app (with malicious server-side scripts) while keeping the current session variables intact? My impression is that it is not possible without significant flaws in the original web app. Anyhow, the question is: Is it possible to steal session variables of web apps supported by Spring Security without making any changes to the server side content of the web app? Edit: Using TLS
has comment: http://stackoverflow.com/comment/43419300
accepted answer: http://stackoverflow.com/a/27493838
tagged with: spring
has title: Session hijacking in Java Spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27493838
type: Question
tagged with: session-hijacking
score: 0
upvote count: 1
downvote count: 1
answer count: 1

http://stackoverflow.com/comment/43451071
score: 1
comment on: http://stackoverflow.com/q/27510410
has text: How are the scores laid out in the file?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43712237
type: Comment
comment on: http://stackoverflow.com/a/27643618
has text: Thank you for your suggestion. Actually I already tried to convert string to char array(point 2 & 3). But I have problem in comparing two single array. That's why i try to use opencl. If you have any suggestion, plz let me know. Thank you!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43681975
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/27630668
has text: Each of your phase contains the same code, so this is nothing strange that for same input it will give same output. If you are familiar with arrays then consider searching for sorting algorithms. If arrays are something new to you then consider nesting your conditions like `if(var1IsMax){print(var1); if (var2>var3)print(var2);pritnt(var3)...`

http://stackoverflow.com/q/27507008
has comment: http://stackoverflow.com/comment/43444732
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/13778650
has comment: http://stackoverflow.com/comment/43446416
has answer: http://stackoverflow.com/a/27507022
tagged with: jvm
favorite count: 0
tagged with: static-members
has comment: http://stackoverflow.com/comment/43445819
tagged with: javac
has answer: http://stackoverflow.com/a/27507782
tagged with: undefined-behavior
has comment: http://stackoverflow.com/comment/43444442
has title: Accessing an uninitialised static field in Java
upvote count: 3
type: UnansweredQuestion
has body: I'm indebted to this answer for the idea. The following code compiles, but certainly shouldn't. It uses the value of x before it's been initialised. If you remove the StaticAssign. qualifier then it no longer compiles. public class StaticAssign { public static final int x; static { System.out.println(StaticAssign.x); x = 5; } public static void main(String[] args) {} } On my machine, this consistently prints 0. If I change the type of x to String, it consistently prints null. The question is: will it definitely print 0 or null, or might it access uninitialised memory and print out something else? And even if this code gets through the compiler, why isn't it picked up by the JVM? Is there a way to do nasty things based on this?
has comment: http://stackoverflow.com/comment/43446388
score: 3
has comment: http://stackoverflow.com/comment/43444385
tagged with: java

http://stackoverflow.com/a/27610048
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27609406
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27609406
type: Answer
score: 3
upvote count: 3
has body: This sound like a job for debugger. In particular - conditional breakpoint. In eclipse this can be done like this: Set breakpoint in FileInputStream(File) (it's almost certain this class will be used to read the file). In breakpoint view, click on breakpoint -> "Breakpoint Properties...". Check "Conditional" Enter some expression which will detect the file you are interested in. For example: arg0.getPath().endsWith("test.xml"). Start the program and wait until break point is hit. You will be able to get the callers from stack trace.

http://stackoverflow.com/comment/43683289
score: 0
has text: Another finding: When I replace the `TextFlow` with a simple `HBox`, then it seems that I cannot reproduce the issue.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27630194

http://stackoverflow.com/comment/43691015
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27635916
has text: I'm a bit new to this, could you please elaborate what do mean by "port 8080 may be blocked" when this is how we set the proxy: https://i.sstatic.net/sxSmP.jpg How would I go about obtaining a mediator proxy?
type: Comment

http://stackoverflow.com/comment/43403888
score: 0
type: Comment
type: QuestionComment
has text: How could you store in a ArrayList a String and Boolean?
comment on: http://stackoverflow.com/q/27485794

http://stackoverflow.com/comment/43512434
type: AnswerComment
comment on: http://stackoverflow.com/a/27541832
has text: Nevermind, I'm sorry, this is the right answer for the purpose, I still don't understand Java completely. Turns out onPageStarted (or onPageFinished), returns the URL that was last requested, and from there on, I used if statements. The code I used is on my post. Thank you very much!
score: 0
type: Comment

http://stackoverflow.com/comment/43464211
has text: Why is `descending` even a variable? You don't use it at all.
comment on: http://stackoverflow.com/q/27517092
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27744110
has body: In my case i passed web site url as www.example.com to HttpURLConnection. This returns old web page. But in Chrome, i get new version of web site. Then i noticed that the url in Chrome is http://example.com. There is no www. This returns the new version of web site. When i changed the url that i pass to HttpURLConnection, it get the new version of web site.
answers question: http://stackoverflow.com/q/27623685
type: Answer
score: 0

http://stackoverflow.com/comment/43569116
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27563876
has text: Tried but no luck :( Apparently, it's something that can't be done. Check out the second answer here: http://stackoverflow.com/questions/11576668/change-background-image-on-users-choice . I greatly appreciate your help trying Suvitruf! Would you like to post a link to that and mention that we can't alter the UI components in an answer and I'll select it as the right answer? Thanks again!

http://stackoverflow.com/a/27497800
upvote count: 1
type: Answer
has body: Your method will return an instance of Base. If ABC extends Base, you will merely create the instance of ABC and return it as an instance of Base. It's polymorphism at work. The return type on the overridden function may also be altered to only return ABC instead of any instance of BASE. See the comments below for the actual answer.
has comment: http://stackoverflow.com/comment/43427030
has comment: http://stackoverflow.com/comment/43426978
downvote count: 0
has comment: http://stackoverflow.com/comment/43426917
score: 1
has comment: http://stackoverflow.com/comment/43426981
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27497720
has comment: http://stackoverflow.com/comment/43426896
answers question: http://stackoverflow.com/q/27497720

http://stackoverflow.com/comment/43478677
type: Comment
comment on: http://stackoverflow.com/q/27524442
score: 0
type: QuestionComment
has text: Does the unit test work? There should be a test (in the test package) you can run

http://stackoverflow.com/q/27623037
has title: Hibernate annotation onDelete not handed in shema export
answer count: 1
has comment: http://stackoverflow.com/comment/43696547
accepted answer: http://stackoverflow.com/a/27639473
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43697593
tagged with: java
tagged with: hibernate
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/43697727
has answer: http://stackoverflow.com/a/27639473
tagged with: persistence
has body: I have a problem with hibernate 4.3.5 annotations. I have a project where I use annotations and hibernate shema export to generate my database. All the JPAs annotation works fine and the database is well generated. The problem comes when I want to add an hibernate annotation : onDelete. This annotation is ignored by the shema export and I can't find a way to make it work. I have searched a lot and found some similar topics but none of them solved my problem. @Entity @Table (name="comment") public class Comment{ ... @ManyToOne (fetch = FetchType.LAZY) @OnDelete (action=OnDeleteAction.CASCADE) @JoinColumn(name="from_user_id_comment") User fromUser; ... } My relation is bidirectionnal. (I have a list of comments in the class User). The SQL script generated for the creation of the table "comment" is the following : Hibernate: create table comment ( ... from_user_id_comment integer, ... primary key (id_comment) ) Hibernate: alter table comment add constraint FK_7m60iklffdi8xx9m6tw8ci4w7 foreign key (from_user_id_comment) references user (id_user) I use maven to handle my dependencies. What I want hibernate to do is to generate the "ON DELETE CASCADE" with the constraint, so th cascade is handled by the DB. Can somebody help me please ? Thanks, Pat pom.xml dependencies : org.postgresql postgresql 9.2-1003-jdbc4 mysql mysql-connector-java 5.1.25 javax.servlet javax.servlet-api 3.1.0 provided org.hibernate hibernate-core 4.3.5.Final javax.mail mail 1.4.7 org.apache.directory.studio org.apache.commons.lang 2.6 org.hibernate hibernate-c3p0 4.3.5.Final org.projectlombok lombok 1.14.8 provided
has comment: http://stackoverflow.com/comment/43666653
score: 0

http://stackoverflow.com/q/27609389
has body: I have a Java application where you can press a button and a missile is launched (represented by a red 5 x 5 pixel dot). The dot moves from point A to point B which is good. What I want to know is how can I make the dot bleep like on a radar. This is what I have so far: public class Explosion { public int x, y, ex, ey, sx, sy; public String Country, target; private Image img; public boolean remove; public int time = 0; public int timer = 40; public Explosion(String Country, String target) { this.Country = Country; this.target = target; GetCoordsLaunch(); GetCoordsTarget(); } public void GetCoordsTarget() { if (target == "Ocean") { ex = play.mh.x + 4 + 140; ey = play.mh.y + 245 + 16; } } public void GetCoordsLaunch() { if (Country == "USA") { x = play.mh.x + 4 + 86; y = play.mh.y + 245 + 42; } } public void tick() { if (time &gt;= timer) { if (x &gt; ex) { x--; } if (x &lt; ex) { x++; } if (y &gt; ey) { y--; } if (y &lt; ey) { y++; } time = 0; } else { time++; } if (x == ex &amp;&amp; y == ey) { remove = true; } } public void render(Graphics g) { g.setColor(Color.red); g.fillRect(x, y, 5, 5); } }
has comment: http://stackoverflow.com/comment/43641092
has title: Java How to create Bleeping dots?
score: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27609462
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43643004
has comment: http://stackoverflow.com/comment/43641039
tagged with: java
has comment: http://stackoverflow.com/comment/43641136
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43641577

http://stackoverflow.com/a/27506277
type: Answer
accepted answer of: http://stackoverflow.com/q/27506184
answers question: http://stackoverflow.com/q/27506184
has comment: http://stackoverflow.com/comment/43443383
has body: "jdbc:msql://localhost:3306/g52apr" should be: "jdbc:mysql://localhost:3306/g52apr" Edited Changed SQL Server reference to MySql
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43443662
score: 0

named-query
type: Tag
tags question: http://stackoverflow.com/q/27541894
tag name: named-query
tags question: http://stackoverflow.com/q/27565706

http://stackoverflow.com/a/27536349
score: 2
has comment: http://stackoverflow.com/comment/43501129
upvote count: 2
has body: mask[s.charAt(i)] gets the character from s at index i, converts it to an int (implicitly), and then looks up the value in mask at that index in the mask array. The int value of the character is not ASCII, it's UTF-16 (because that's how Java's characters are defined). The code makes a massive assumption (mentioned in a comment) that the string only has ASCII characters, which it apparently defines as characters whose value is &lt; 256; that's "extended" ASCII, ASCII itself only defines characters &lt; 128. For values &lt; 128, ASCII and UTF-16 are the same. Your overall function is doing this: Starting with an array with all false entries (because that's the default state of a boolean[]), it loops through the string s and, for each character, looks up whether it's seen that character before. If it has, return true out of the function (we've seen at least two occurrences of the character). If it hasn't seen a character before, it sets that entry in the array to true. If it gets all the way to the end of the string without returning true, it returns false&nbsp;&mdash; the string didn't have the same character repeated twice. The code will fail with an ArrayIndexOutOfBoundsException if it sees a character whose int value is &gt;= 256, which is entirely likely.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43501444
type: Answer
accepted answer of: http://stackoverflow.com/q/27536329
answers question: http://stackoverflow.com/q/27536329
has comment: http://stackoverflow.com/comment/43501194

http://stackoverflow.com/comment/43585797
type: QuestionComment
comment on: http://stackoverflow.com/q/27579627
has text: http://stackoverflow.com/questions/5666134/what-is-the-difference-between-class-this-and-this-in-java
score: 0
type: Comment

http://stackoverflow.com/comment/43432246
score: 0
has text: oh man, java still doesn't have this feature. but anyways, thanks for the help.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27500732

http://stackoverflow.com/q/27574405
favorite count: 0
has comment: http://stackoverflow.com/comment/43574322
has comment: http://stackoverflow.com/comment/43574558
upvote count: 3
has answer: http://stackoverflow.com/a/27574507
has answer: http://stackoverflow.com/a/27574440
has comment: http://stackoverflow.com/comment/43574325
has comment: http://stackoverflow.com/comment/43574305
has comment: http://stackoverflow.com/comment/43574595
type: UnansweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/43574369
tagged with: java
has body: How is it possible to assign the value null to this in Java? It's no problem to assign any certain value when using aliasing, example = this; example = something; but it doesen't work when assigning null to example. Is there any possibility to circumvent this and assign null to the object whose method is called?
has title: How can I assign the value 'null' 'this' in java?
has comment: http://stackoverflow.com/comment/43574306
type: Question
downvote count: 8
has comment: http://stackoverflow.com/comment/43574378
answer count: 2
has comment: http://stackoverflow.com/comment/43574339