http://stackoverflow.com/a/56709035
answers question: http://stackoverflow.com/q/26459904
upvote count: 6
has body: If you need defaults that your JVM will initially have set unless overridden, use: java -XshowSettings:properties -version This is helpful if you don't have a Java application already running, thus no pid to pass to one of the other commands. If you are seeking the properties of a JVM already running that has properties set via default or set explicitly by command, then use the pid for that JVM found via jps with the jcmd or jinfo commands as listed in answers above.
downvote count: 0
type: Answer
score: 6

http://stackoverflow.com/q/26430327
has comment: http://stackoverflow.com/comment/41505695
has comment: http://stackoverflow.com/comment/41505479
tagged with: java
type: Question
tagged with: recursion
has title: Why does this recursive method work?
has comment: http://stackoverflow.com/comment/41505482
has answer: http://stackoverflow.com/a/26430605
score: 0
answer count: 2
has body: I am writing a function to fulfill these requirements: Given a string, return true if it is a nesting of zero or more pairs of parenthesis, like (()) or ((())). Suggestion: check the first and last chars, and then recur on what's inside them. nestParen("(())") → true nestParen("((()))") → true nestParen("(((x))") → false The correct solution shown on the site is: public boolean nestParen(String str) { if (str.equals("")) return true; if (str.charAt(0) == '(' &amp;&amp; str.charAt(str.length()-1) == ')') return nestParen(str.substring(1,str.length()-1)); else return false; } I don't understand why this works. If the given string has a character other than ( like a ", won't it hit the else case and return false rather than skipping to the next (?
has comment: http://stackoverflow.com/comment/41505467
tagged with: string
has comment: http://stackoverflow.com/comment/41505465
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41505468
has answer: http://stackoverflow.com/a/26430597

spring-aop
tags question: http://stackoverflow.com/q/26363376
tags question: http://stackoverflow.com/q/26366287
tags question: http://stackoverflow.com/q/26506370
tag name: spring-aop
tags question: http://stackoverflow.com/q/26414419
type: Tag

http://stackoverflow.com/comment/41377363
type: Comment
score: 0
type: AnswerComment
has text: @Vasiliy you can try my suggestion.
comment on: http://stackoverflow.com/a/26359358

http://stackoverflow.com/comment/41471599
type: AnswerComment
comment on: http://stackoverflow.com/a/26404175
has text: Thanks. So to answer my question, you're saying "No" the wildcard Java version? I suspect the Scala compiler is doing more and leaving the type unbounded in the byte code. So comparing byte code/round tripping it may not make sense in this case...
type: Comment
score: 0

exi
tags question: http://stackoverflow.com/q/26380247
tag name: exi
type: Tag

http://stackoverflow.com/a/26373469
accepted answer of: http://stackoverflow.com/q/26373260
type: Answer
answers question: http://stackoverflow.com/q/26373260
has comment: http://stackoverflow.com/comment/41403851
has comment: http://stackoverflow.com/comment/41404479
downvote count: 0
score: 1
has body: Create an array list of array lists: BufferedReader br = new BufferedReader(new FileReader("input.txt")); int lineCount = readLines(); ArrayList&lt;ArrayList&lt;String&gt;&gt; rows = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(lineCount); for (int i = 0; i &lt; lineCount; i++) { ArrayList&lt;String&gt; row = new ArrayList&lt;String&gt;(); String line = br.readLine(); for(String s: line.split(",")) { row.add(s); } rows.add(row); } br.close();
upvote count: 1
type: AcceptedAnswer

euclidean-distance
type: Tag
tags question: http://stackoverflow.com/q/26379043
tag name: euclidean-distance

http://stackoverflow.com/q/26496338
tagged with: jetty
upvote count: 15
answer count: 4
downvote count: 0
has title: Strange java.lang.ArrayIndexOutOfBoundsException thrown on jetty startup
tagged with: java
type: Question
has body: Whenever I deploy jetty application I hit this issue. Looks like some jar or class is broken. Colleagues compiling exactly same code, doesn't hit the issue. Even if the deploy to the same computer. (we use git and maven) Deleting local maven repository ~/.m2 and rebuilding doesn't help. Can run same jetty app locally without any issues. My initial suspect was that some jar is broken. Tried jar tvf $every_jar and haven't found anything. Any ideas how can I debug this? Looks really mysterious and I suspect is that some file get corrupted. Stack trace: 2014-10-21 13:29:25.123:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/XYZ/},/XYZ/webapps/root javax.servlet.ServletException: jersey-serlvet at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:553) at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:344) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:791) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:39) at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:186) at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:494) at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:141) at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:145) at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.…
has answer: http://stackoverflow.com/a/38475772
score: 15
has answer: http://stackoverflow.com/a/48864320
tagged with: maven-jetty-plugin
has answer: http://stackoverflow.com/a/29618876
linked to: http://stackoverflow.com/q/38802954
has answer: http://stackoverflow.com/a/26496604
favorite count: 0
type: UnansweredQuestion

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

http://stackoverflow.com/a/26367597
has body: Simple fix: Initialize the reference to null: CustomerTelephone theirPhone = null; Better fix: Initialize the variable and move the reference to that variable into the try block. Thus if an exception is thrown in your try block, then you avoid a subsequent NullPointer exception. CustomerTelephone theirPhone = null; ... try { theirPhone = new CustomerTelephone(phoneNumber); theirPhone.getAreaCode(phoneNumber); } catch { ... }
accepted answer of: http://stackoverflow.com/q/26367288
has comment: http://stackoverflow.com/comment/41392442
answers question: http://stackoverflow.com/q/26367288
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41392670
has comment: http://stackoverflow.com/comment/41392758

http://stackoverflow.com/q/26427240
accepted answer: http://stackoverflow.com/a/26427916
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26427916
type: AnsweredQuestion
upvote count: 0
has title: How many times the ServiceLocator does do lookup operation in this case
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26427791
has body: Could you please help me in understanding this ServiceLocator class which is present in our Project This is our ServiceLocator class public class ServiceLocator { private static ServiceLocator instance; private Context initalContext; private Map cache; // return the singelton service locator public static ServiceLocator getInstance () throws ServiceLocatorException { if (instance == null) instance = new ServiceLocator(); return instance; } private ServiceLocator () { try { this.initalContext = new InitialContext(); this.cache = Collections.synchronizedMap(new HashMap()); } catch (NamingException ex) { System.err.printf("Error in CTX lookup"); } } public DataSource getDataSource (String dataSourceName) { DataSource datasource = null; try { if (this.cache.containsKey(dataSourceName)) datasource = (DataSource)this.cache.get(dataSourceName); else { Context envContext = (Context)initalContext .lookup("java:comp/env"); datasource = (DataSource)envContext .lookup(dataSourceName); this.cache.put(dataSourceName, datasource); } } catch (NamingException ex) { System.err.printf("Error in CTX lookup"); } return datasource; } } I have few questions with respect to the above code . Is it necessary to make it as singleton Or a static synchronized method ?? Why is it that the dataSourceName is put under the map cache ?? (What happens if there are 10 concurrent users does it do a look up operation 10 times or 1 time ) Is it that only one User can use Database at one time?? For your reference this is the client that is using this Service Locator private static final Logger logger = Logger.getLogger(MyObject.class); private Connection con; private DataSource dataSource; public MyObject() { this.dataSource = ServiceLocator.getInstance().getDataSource("jdbc/mydatabase"); }
score: -1
possible better answer: http://stackoverflow.com/a/26427791

http://stackoverflow.com/a/26451764
answers question: http://stackoverflow.com/q/26450910
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26450910
score: 6
has body: Use an actual URI constructor instead of hand-rolling your own: String userInfo = userName + ":" + password; String path = remoteDirectory + filename; // Need a '/' between them? URI sftpUri = new URI("sftp", userInfo, remoteServerAddress, -1, path, null, null); ... FileObject remoteFile = manager.resolveFile(sftpUri.toString(), opts);
has comment: http://stackoverflow.com/comment/43979528
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26463343
type: Question
has title: abstract out the key and value in json array
linked to: http://stackoverflow.com/q/14825632
has answer: http://stackoverflow.com/a/26541689
score: -1
answer count: 2
linked to: http://stackoverflow.com/q/26292155
upvote count: 0
tagged with: arrays
favorite count: 0
possible better answer: http://stackoverflow.com/a/26541878
has comment: http://stackoverflow.com/comment/41565370
has answer: http://stackoverflow.com/a/26541878
accepted answer: http://stackoverflow.com/a/26541689
has comment: http://stackoverflow.com/comment/41565331
type: AnsweredQuestion
has body: I have a json array : [{"choice":"Yes","score":"1"},{"choice":"No","score":"0"},{"choice":"Not Done","score":"0"}] How can I get the key and the value of the json? I want to store into database the choice and the score value.
has comment: http://stackoverflow.com/comment/41565211
tagged with: java
has comment: http://stackoverflow.com/comment/41565187
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41565121
downvote count: 1

http://stackoverflow.com/a/26504579
has body: In case anyone has the same problem renderScript checks that the input and output is the same type, etc. To avoid this, you must modify the ScriptC_"filename".java, and look for the forEach_"function" function and remove the following: // Verify dimensions Type tIn = ain.getType(); Type tOut = aout.getType(); if ((tIn.getCount() != tOut.getCount()) || (tIn.getX() != tOut.getX()) || (tIn.getY() != tOut.getY()) || (tIn.getZ() != tOut.getZ()) || (tIn.hasFaces() != tOut.hasFaces()) || (tIn.hasMipmaps() != tOut.hasMipmaps())) { throw new RSRuntimeException("Dimension mismatch between input and output parameters!"); }
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/26391870
score: -1
has comment: http://stackoverflow.com/comment/41692655
downvote count: 1

http://stackoverflow.com/comment/41624244
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26481596
score: 0
has text: I don't see paths when I invoke with this option

http://stackoverflow.com/a/26501074
answers question: http://stackoverflow.com/q/26500655
upvote count: 2
has body: In order to re-write the object (write a second copy of the object) with the updated state into the stream you'll have to reset() the stream in order to remove the copy of the object from the set of "known objects". It can be done like this: ... usPresident.setTerm(57); oos.reset(); // &lt;-- this guy! oos.writeObject(usPresident); Further, when you're reading the objects back - you'll have to read two objects, the first one that was saved (with state of term == 56) and the second (with state of term == 57): ObjectInputStream in = new ObjectInputStream( new FileInputStream("/home/nikhil/dev/USPresident.data")); usPresident = (USPresident)in.readObject(); System.out.println("usPresident.getTerm() = " +usPresident.getTerm()); // prints 56 usPresident = (USPresident)in.readObject(); System.out.println("usPresident.getTerm() = " +usPresident.getTerm()); // prints 57
downvote count: 0
type: Answer
score: 2

jaxb
tags question: http://stackoverflow.com/q/26417126
tags question: http://stackoverflow.com/q/26502286
tags question: http://stackoverflow.com/q/26392161
tags question: http://stackoverflow.com/q/26369701
tags question: http://stackoverflow.com/q/26369491
tags question: http://stackoverflow.com/q/26474469
tags question: http://stackoverflow.com/q/26402645
tags question: http://stackoverflow.com/q/26413431
tags question: http://stackoverflow.com/q/26468124
tags question: http://stackoverflow.com/q/26364644
tags question: http://stackoverflow.com/q/26418355
tags question: http://stackoverflow.com/q/26459916
tags question: http://stackoverflow.com/q/26498474
tags question: http://stackoverflow.com/q/26394387
tags question: http://stackoverflow.com/q/26488252
tags question: http://stackoverflow.com/q/26392679
type: Tag
tags question: http://stackoverflow.com/q/26360404
tags question: http://stackoverflow.com/q/26468894
tag name: jaxb
tags question: http://stackoverflow.com/q/26507900
tags question: http://stackoverflow.com/q/26414122
tags question: http://stackoverflow.com/q/26439184
tags question: http://stackoverflow.com/q/26379592
tags question: http://stackoverflow.com/q/26439066
tags question: http://stackoverflow.com/q/26433779
tags question: http://stackoverflow.com/q/26474481
tags question: http://stackoverflow.com/q/26398233
tags question: http://stackoverflow.com/q/26357458
tags question: http://stackoverflow.com/q/26461089
tags question: http://stackoverflow.com/q/26465463
tags question: http://stackoverflow.com/q/26430199

http://stackoverflow.com/q/26415738
has comment: http://stackoverflow.com/comment/41478994
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26415792
upvote count: 1
has title: How to print UTF-8 encoded charecters in JSoup
has body: I am using JSoup, version: 1.8.1 and want to parse content from http://corpus.quran.com/wordbyword.jsp . It is encoded with UTF-8 and contains Arabic charecters. I've written the following code which prints some contents in the console. Where there are some special chrecters in the html file, I have got '?' chrecters in those places. I don't know how to solve this problem. public static void main(String[] args){ String url = "http://corpus.quran.com/wordbyword.jsp"; System.out.printf("Fetching %s...\n", url); Document doc=null; try { doc = Jsoup.parse(new URL(url).openStream(), "UTF-8", url); //doc = Jsoup.connect(url).get(); } catch (IOException e) { e.printStackTrace(); System.exit(0); } System.out.println("Fetching completed. Collecting Data..."); Elements columns=doc.select("td"); for (Element link : columns) { System.out.printf(" * %s %s\n", link.tagName(),link.text()); } System.out.println("------------------------------------------"); } And the output in the console: Fetching http://corpus.quran.com/wordbyword.jsp... Fetching completed. Collecting Data... * td * td Qur'an | Word by Word | Audio | Prayer Times | Android | New : beta.quran.com * td * td __ * td Sign In * td Search * td * td * td * td __ * td Verse (1:1) - Word by Word * td Word by Word Quran Dictionary English Translation Syntactic Treebank Ontology of Concepts Documentation Quranic Grammar Message Board Resources Feedback Java API * td Word by Word * td Quran Dictionary * td English Translation * td Syntactic Treebank * td Ontology of Concepts * td Documentation * td Quranic Grammar * td Message Board * td Resources * td Feedback * td Java API * td __ * td Welcome to the Quranic Arabic Corpus, an annotated linguistic resource which shows the Arabic grammar, syntax and morphology for each word in the Holy Quran. Click on an Arabic word below to see details of the word's grammar, or to suggest a correction. Chapter (1) s?rat l-f?ti?ah (The Opening)Chapter (2) s?rat l-baqarah (The Cow)Chapter (3)…
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41479010
tagged with: jsoup
downvote count: 0
has comment: http://stackoverflow.com/comment/41478985
has answer: http://stackoverflow.com/a/26415792

http://stackoverflow.com/a/26511942
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/26511823
upvote count: 3
answers question: http://stackoverflow.com/q/26511823
has body: You are absolutely right: author's assumption has been that you are not going to subclass SimpleFactory, which is not a fair assumption to make (unless SimpleFactory is marked final). Since SimpleFactory is not final, you can definitely subclass it, gaining more flexibility than with a factory method, because SimpleFactory replaces inheritance with composition. An even better approach would be making SimpleFactory an interface. Doing so would let you pick composition or inheritance according to your preference, because an interface would not limit you in cases when your Store class already inherits a class. public interface SimpleFactory { Product createProduct(); } Then you can use either composition public class FactoryImpl implements SimpleFactory { public Product createProduct(){ // Return an instance of some subclass of Product } } public class StoreComposition { SimpleFactory factory = new FactoryImpl(); } or inheritance/composition combo public class StoreInheritance implements SimpleFactory { SimpleFactory factory = this; public Product createProduct(){ // Return an instance of some subclass of Product } }
downvote count: 0
has comment: http://stackoverflow.com/comment/41722314
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41666777

http://stackoverflow.com/q/26366478
tagged with: java
type: Question
has body: I am looking to use OAuth2 in my Play application, and I've been having trouble looking for an entry point in coding for it. SecureSocial seems like a good library to use, but there seems to be a disconnect between SecureSocial's Getting Started guide and the classes that are actually available in their library. Specifically, the guide (here) says to stick this class in as a starting UserService. However, it refers to two classes (securesocial.core.Identity and securesocial.core.IdentityId) that are supposedly in SecureSocial's jar are inexplicably missing. Does anyone know where I can find these classes (or find some kind of up-to-date guide or really any kind of basic, barebones way to learn OAuth with Play)? I can't post more than two links so I did not link to the jar's page in the maven repository, but search for securesocial_2.11.
answer count: 1
downvote count: 0
has title: securesocial.core.Identity missing from SecureSocial library?
favorite count: 0
has answer: http://stackoverflow.com/a/26432152
tagged with: playframework-2.0
tagged with: securesocial
type: UnansweredQuestion
tagged with: oauth-2.0
upvote count: 1
score: 1

http://stackoverflow.com/comment/41573262
has text: @Laura that is fine, you can build the map up one piece at a time while you loop over the incoming files. You just need a representation for 'I have not seen that file yet' as either the txt file or the png file could be found first. That is, at any point in time the map entry awesomePic1 could point at null, or (awesomePic1.txt,null) or (null, awesomePic1.png) or (awesomePic1.txt, awesomePic1.png).
comment on: http://stackoverflow.com/q/26467427
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41553844
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26456658
type: Comment
has text: "Similar" isn't the same - going to need more context before it's possible to make an accurate suggestion. However, if you can apply it to a `JLabel`, then it must implement the `Icon` interface, which means there must be a `paintIcon(Component, Graphics, int, int)` method...

http://stackoverflow.com/q/26466340
type: UnansweredQuestion
score: 0
tagged with: plugins
tagged with: java
tagged with: expandable
type: Question
tagged with: class
has title: Expandable java system
has comment: http://stackoverflow.com/comment/41571691
has body: I've been asked to create a java system capable of expand itself by plugins, however i'm a little confused in how exactly should i do that, my initial idea was to create a folder in the system's root path and create a routine that would read that folder and scan for .jar files that can be recognized as plugins (inside the .jar there'll be a .xml file which will be used as the system's signature), then load the files in the classpath at runtime, well this part seems quite easy, i found a lot of material about this subject, but i can't realize how i'll make the plugin access the main system's classes and methods, my initial idea was to pass through the constructor of the plugin, the path for the main system .jar and then load the main .jar in the plugin at runtime but i'm not sure if this is the most efficient approach. Does anybody has an idea?
has comment: http://stackoverflow.com/comment/41572262
answer count: 0

http://stackoverflow.com/q/26368464
type: Question
has comment: http://stackoverflow.com/comment/41394136
has comment: http://stackoverflow.com/comment/41394428
score: -2
linked to: http://stackoverflow.com/q/4685450
accepted answer: http://stackoverflow.com/a/26368559
has comment: http://stackoverflow.com/comment/41394207
has answer: http://stackoverflow.com/a/26368937
answer count: 3
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41394335
favorite count: 0
has body: I'm supposed to create a program that takes user-entered decimal number and converts it to binary using an inner and outer for or while loop. For some reason, whenever I enter a positive integer the program just does nothing. My code: public class Dec2Bin { public static void main (String[] args) { System.out.println("Welcome to Decimal Number to Binary Converter"); System.out.println(""); Scanner s = new Scanner(System.in); while (true) { String binary = ""; System.out.print("Enter a decimal number (-1 to end)"); int input = s.nextInt(); if (input &lt;= 0) { System.out.println("Goodbye!"); break; } int result = input; while (result &gt;= 0) { result = result / 2; binary = (result % 2) + binary; } System.out.println("Binary number is " + binary); } } } It should be prepending the remainder from result%2 to the binary string each time and that string should show the converted binary number. It does work as it's supposed to if I enter a negative number, displaying the "Goodbye!" message. Not sure where I went wrong.
has comment: http://stackoverflow.com/comment/41394183
possible better answer: http://stackoverflow.com/a/26368762
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26368762
tagged with: java
has comment: http://stackoverflow.com/comment/41394191
downvote count: 3
upvote count: 1
has title: Decimal to Binary converter loop
has comment: http://stackoverflow.com/comment/41394083
has answer: http://stackoverflow.com/a/26368559

http://stackoverflow.com/comment/41636600
type: Comment
type: QuestionComment
has text: Nobody? Please i really need help on this!
comment on: http://stackoverflow.com/q/26487782
score: 0

http://stackoverflow.com/comment/41441804
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26394737
has text: At the risk of being tedious, in your Java app, you're sure that the environment prior to creating the ProcessBuilder instance contains HOME? If you examine System.getenv() contents just prior to your line of Java, what does it show?
type: Comment

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/26403385
tags question: http://stackoverflow.com/q/26421836
tags question: http://stackoverflow.com/q/26448524
tags question: http://stackoverflow.com/q/26376329
tag name: jfreechart

http://stackoverflow.com/q/26491624
tagged with: spring-mvc
type: AnsweredQuestion
score: 7
tagged with: java
upvote count: 7
possible better answer: http://stackoverflow.com/a/26524440
type: Question
answer count: 2
tagged with: dropwizard
downvote count: 0
has answer: http://stackoverflow.com/a/26494161
accepted answer: http://stackoverflow.com/a/26494161
has body: I looked for the similar question but could not find any . I have a micro service created with drop-wizard which is running in localhost:9000. I am working in another project(with spring mvc) running in 8080. I wan to call the above service which gives me string back from any of my controllers in main project .lets say the path is "localhost:9000/giveMeString" .
favorite count: 0
has title: Calling a micro service
has answer: http://stackoverflow.com/a/26524440
has comment: http://stackoverflow.com/comment/41621406

http://stackoverflow.com/q/26487574
score: 17
tagged with: eclipse
has body: I have the following error when deploying an application with JBoss Tools in Eclipse: Error renaming C:\wildfly-8.1.0.Final\standalone\tmp\tmp7858611943756287857.xhtml to C:\wildfly-8.1.0.Final\standalone\deployments\.war\403.xhtml. This may be caused by your server's temporary deploy directory being on a different filesystem than the final destination. You may adjust these settings in the server editor. And here is a screenshot of the error: On the documentation, I found this: You can customize the deployment location and packaging type: To select the workspace deployment folder for the server, click Use workspace metadata. To select the deployment folder of the application server, click Use the JBoss deploy folder. To select a folder of your choice, click Use a custom deploy folder. With this option, complete the Deploy directories and Temporary Deploy Directory fields. The temporary folder must be on the same file system as the final deploy location otherwise publishing often fails. For all modules to be archived for deployment, select the Deploy projects as compressed archives check box. This avoids exploded deployments and reduces the amount of memory deployments occupy but may result in slower deployment. What does The temporary folder must be on the same file system as the final deploy location mean? How can I solve it? I've realized that the error doesn't occur when the check box Deploy projects as compressed archives is checked.
type: Question
has answer: http://stackoverflow.com/a/38660857
has answer: http://stackoverflow.com/a/52294035
tagged with: jboss-tools
has answer: http://stackoverflow.com/a/39470054
has answer: http://stackoverflow.com/a/27282274
has comment: http://stackoverflow.com/comment/64602599
has answer: http://stackoverflow.com/a/45873539
has answer: http://stackoverflow.com/a/34766008
has answer: http://stackoverflow.com/a/35733148
has comment: http://stackoverflow.com/comment/91535918
upvote count: 17
has comment: http://stackoverflow.com/comment/41609753
has answer: http://stackoverflow.com/a/37820603
tagged with: deployment
favorite count: 0
answer count: 9
has comment: http://stackoverflow.com/comment/114428909
type: UnansweredQuestion
has title: JBoss Tools deploy error: This may be caused by your server's temporary deploy directory being on a different filesystem than the final destination
has answer: http://stackoverflow.com/a/32605175
downvote count: 0
tagged with: java
tagged with: jboss

collections
tags question: http://stackoverflow.com/q/26445116
tags question: http://stackoverflow.com/q/26409869
tags question: http://stackoverflow.com/q/26418325
tags question: http://stackoverflow.com/q/26379707
tags question: http://stackoverflow.com/q/26493414
tags question: http://stackoverflow.com/q/26415507
tags question: http://stackoverflow.com/q/26410622
tags question: http://stackoverflow.com/q/26376635
tags question: http://stackoverflow.com/q/26369405
tags question: http://stackoverflow.com/q/26400310
tags question: http://stackoverflow.com/q/26412090
tags question: http://stackoverflow.com/q/26357402
tags question: http://stackoverflow.com/q/26378850
tags question: http://stackoverflow.com/q/26455021
type: Tag
tags question: http://stackoverflow.com/q/26502961
tags question: http://stackoverflow.com/q/26481768
tags question: http://stackoverflow.com/q/26488922
tags question: http://stackoverflow.com/q/26500423
tags question: http://stackoverflow.com/q/26481823
tags question: http://stackoverflow.com/q/26505953
tags question: http://stackoverflow.com/q/26495044
tags question: http://stackoverflow.com/q/26485964
tags question: http://stackoverflow.com/q/26492443
tags question: http://stackoverflow.com/q/26504803
tag name: collections
tags question: http://stackoverflow.com/q/26404999
tags question: http://stackoverflow.com/q/26365457
tags question: http://stackoverflow.com/q/26427774
tags question: http://stackoverflow.com/q/26359370
tags question: http://stackoverflow.com/q/26464997
tags question: http://stackoverflow.com/q/26427525
tags question: http://stackoverflow.com/q/26374334

http://stackoverflow.com/comment/41619941
comment on: http://stackoverflow.com/q/26492945
has text: the (built in) classloader is guaranteed to find a valid class in the classpath. what exactly is your question?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26406012
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41490827
has comment: http://stackoverflow.com/comment/41491293
has comment: http://stackoverflow.com/comment/41491051
has comment: http://stackoverflow.com/comment/41490080
downvote count: 0
has comment: http://stackoverflow.com/comment/41490594
has comment: http://stackoverflow.com/comment/41489855
has comment: http://stackoverflow.com/comment/41490967
has body: IHS (which is based on Apache) httpd.conf SetHandler server-status Order deny,allow Allow from all Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure where /your-app - context root of your app WAS: Servers > Server Types > WebSphere application servers > YOUR-APP > Web Container Settings > Web container: Custom Properties> New Name: com.ibm.ws.webcontainer.HTTPOnlyCookies; Value: JsessionID Servers > Server Types > WebSphere application servers > YOUR-APP > Session management > Enable Cookies link. Requires use of SSL protocol. There might be some problems in your application (depending on how it was developed) Example: # # Allow server status reports generated by mod_status, # with the URL of http://servername/server-status # Change the ".example.com" to match your domain to enable. # SetHandler server-status Order deny,allow Deny from all # Add an "Allow from" directive to provide access to the server status page. # # Examples: # # 1. Allow any client with hostname *.example.com to view the page. # # Allow from .example.com # # 2. Allow the local machine to view the page using the loopback address. # # Allow from 127.0.0.1 # # 3. Allow any machine on the local network to view the page. # # Allow from 192.168.1 ... ##### NON-DEFAULT ##### SetHandler server-status Order deny,allow Allow from all Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure LoadModule ibm_ssl_module modules/mod_ibm_ssl.so Listen 443 Listen 4469 SSLEnable Keyfile /root/keys/web1-key-db.kdb SSLStashfile /root/keys/web1-key-db.sth #####/NON-DEFAULT ##### ...
answers question: http://stackoverflow.com/q/26404444
has comment: http://stackoverflow.com/comment/41490781
type: Answer
has comment: http://stackoverflow.com/comment/41557565

http://stackoverflow.com/comment/41554331
type: QuestionComment
comment on: http://stackoverflow.com/q/26456935
score: 0
has text: Swing uses a passive rendering engine, while you can make "suggestions" to the rendering engine, you are, ultimately, not responsible for the rendering process. `getGraphics` is not how painting works in Swing and it can return `null`. You might like to also have a look at [How to use Swing Timers](http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html)
type: Comment

http://stackoverflow.com/comment/41592300
score: 0
type: Comment
type: QuestionComment
has text: @Ollegn See that part where it says *"runnable example which demonstrates"* - This doesn't mean all you code, just an example which replicates your work flow which is runnable by others...otherwise all you will get is guess work...
comment on: http://stackoverflow.com/q/26477521

http://stackoverflow.com/comment/41535041
score: 0
type: Comment
has text: @specializt It is fairly common practice to do that.
comment on: http://stackoverflow.com/a/26430487
type: AnswerComment

http://stackoverflow.com/comment/41513360
has text: Any chance this context snippet is deployed two times?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26434005
score: 0

http://stackoverflow.com/comment/41653808
has text: @VladIlie, thnx for the clarification. I thought it will be clear from the type of opened view=)
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26506232

http://stackoverflow.com/q/26468567
tagged with: resultset
has comment: http://stackoverflow.com/comment/41575119
tagged with: jdbc
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41575002
type: Question
has comment: http://stackoverflow.com/comment/41575408
tagged with: java
has body: I have 2 queries and therefore 2 ResultSet's returned from MySQL in Java through createStatement(). The queries are like SELECT * FROM abc; SELECT * FROM def; These queries are run simultaneously in single createStatement() like CreateConnection(); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select * from ABC; select * from DEF;"); while(rs.next()) { //Iterate through first resultset } rs.close(); stat.close(); conn.close(); How can I get the next ResultSet returned by second query?
has title: Get next ResultSet in JDBC
upvote count: 2
has answer: http://stackoverflow.com/a/26468738
accepted answer: http://stackoverflow.com/a/26468738
answer count: 1
has comment: http://stackoverflow.com/comment/41574870
favorite count: 0
has comment: http://stackoverflow.com/comment/41575257
has comment: http://stackoverflow.com/comment/41575080
has comment: http://stackoverflow.com/comment/41574954

http://stackoverflow.com/comment/41656047
type: Comment
type: QuestionComment
has text: even with unsafe publishing lack of final/volatile is unlikely to be easily reproducible on x86/64. The problem is likely in the code and accessing uninitialized objects
comment on: http://stackoverflow.com/q/26507130
score: 0

http://stackoverflow.com/q/26487587
possible better answer: http://stackoverflow.com/a/26487799
has answer: http://stackoverflow.com/a/26487799
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26487852
tagged with: java
type: Question
answer count: 2
has body: which is faster when application is running in java? this: static void readPrice(String dir) throws Exception{ /*Make URL and Connection*/ URL url = new URL(dir + "/prices/all/"); HttpURLConnection connection; /*Start connection*/ connection = (HttpURLConnection) url.openConnection(); /*Send User-Agent*/ connection.setRequestProperty("User-Agent", user_agent); /*Get http response*/ InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line = rd.readLine(); strJson = line; /*Read the prices json*/ pricesJson( strJson ); } or this: static void readPrice(String dir) throws Exception{ /*Connection with url */ connection = (HttpURLConnection) new URL( dir + "/prices/all/").openConnection(); /*Send User-Agent*/ connection.setRequestProperty("User-Agent", user_agent); /*Read the prices json*/ pricesJson( new BufferedReader(new InputStreamReader( connection.getInputStream())).readLine() ); } I need application very quickly and smoothly, because it has to make requests to the server in real time
has answer: http://stackoverflow.com/a/26487852
upvote count: 1
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/41609340
downvote count: 3
has title: which is faster when application is running in java?

http://stackoverflow.com/comment/41487454
type: Comment
comment on: http://stackoverflow.com/a/26420525
has text: well, I made very stupid mistake; grid has one label added also... sorry!
score: 0
type: AnswerComment

http://stackoverflow.com/a/26365754
has comment: http://stackoverflow.com/comment/41413967
has comment: http://stackoverflow.com/comment/66018361
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/41427454
downvote count: 0
answers question: http://stackoverflow.com/q/26360954
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26360954
has body: I think the correct way to suppress this : @SuppressWarnings("ResourceType") I'm offered this when I press Alt-Enter to bring up fixes for the warning and choose Inspection 'Constant and Resource Type Mismatches' options > Suppress for class (screenshot attached) . It works for me. It's possible that the ID for this inspection has changed since whatever code you were referencing was written; I looked briefly through the commit logs but couldn't find a reference to it.
type: Answer

http://stackoverflow.com/a/26450897
type: Answer
answers question: http://stackoverflow.com/q/26450807
score: 5
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26450807
has body: Set the read timeout on the connection. TCP may take a long time to detect a broken connection if packets are just being dropped. connection = urlAddress.openConnection(); connection.setReadTimeout(10000); // 10 seconds connection.setConnectTimeout(timeoutConnection);
type: AcceptedAnswer

http://stackoverflow.com/comment/41515494
type: Comment
comment on: http://stackoverflow.com/a/26432729
has text: @kaozbender this goal definitely doesn't invalidate using objects. If you're programming in Java, (almost) always use objects.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41481516
type: Comment
type: QuestionComment
has text: What is "FeedMessage"? I don't see that table or table alias in your query. I think you want to create another parameter with the same guid value, and specify that in the EXISTS subquery instead of "FeedMessage.guid".
comment on: http://stackoverflow.com/q/26417116
score: 0

http://stackoverflow.com/comment/41407347
score: 0
type: Comment
type: QuestionComment
has text: Your first example is fine. But, as you specify parameters, I guess '-b 3 -n 4' is also a valid input. You have to iterate with e.g. a for loop over args, detect the indexes of your parameters (-n, -b) and take their values at index+1. Also take care of the edge cases if e.g. the entered parameters aren't valid.
comment on: http://stackoverflow.com/q/26375678

http://stackoverflow.com/q/26450211
tagged with: try-catch
has comment: http://stackoverflow.com/comment/41542476
has comment: http://stackoverflow.com/comment/41551387
tagged with: long-integer
has body: For class I have to write a method that checks if multiplying a certain rational number with an integer results in an overflow or not. I have written following code and it works but I have a feeling it could be shorter but I don't know how: /** * A method for multiplying a rational number with a given number */ public Rational multiply(long factor) { try { this.numerator = Math.multiplyExact(this.getNumerator(), factor); return this; } catch (ArithmeticException e) { try { this.numerator = Math.multiplyExact(Math.multiplyExact(this.getNumerator(),this.getNumerator()), factor); this.denominator = this.denominator * this.denominator; return this; } catch (ArithmeticException e1) { try { this.numerator = Math.multiplyExact(Math.multiplyExact(this.getNumerator(),this.getNumerator()),Math.multiplyExact(factor, factor)); this.denominator = this.denominator * this.denominator * this.denominator; return this; } catch (ArithmeticException e2) { System.out.println("Overflow"); return null; } } } } The method does the following: a = numerator, b = denominator, f = factor If "a * f" does not result in overflow than return (a * f)/b If it does overflow than check if "aa * f" overflows, if it does not than return (aa * f)/bb If it does overflow than check if "aa * ff" overflows, if it does not than return (aa * ff)/bbb
score: 0
answer count: 1
has title: How to shorten method that checks if multiplying gives overflow
tagged with: integer-overflow
has comment: http://stackoverflow.com/comment/41551200
has comment: http://stackoverflow.com/comment/41542755
has answer: http://stackoverflow.com/a/26450861
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26450861
tagged with: java
type: Question

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

http://stackoverflow.com/q/26441937
score: -1
has answer: http://stackoverflow.com/a/26442392
tagged with: groovy
answer count: 1
accepted answer: http://stackoverflow.com/a/26442392
favorite count: 0
downvote count: 2
type: AnsweredQuestion
has body: I've been reading about publishing jar in the Gradle manual page (section 7.2.4). The following code is provided: uploadArchives { repositories{ flatDir{ dirs 'repos' } } } I added that piece of code in my build script but there is no repos dir was created in my project-root directory after gradle build was executed. What does it actual do? Is there a documentation for uploadArchive and the others methods?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41527180
tagged with: gradle
type: Question
has title: Publishing jar in Gradle

http://stackoverflow.com/comment/41488219
score: 0
comment on: http://stackoverflow.com/a/26421108
type: Comment
has text: Have you added the required permissions and Google Map API key in your manifest.xml file?
type: AnswerComment

http://stackoverflow.com/q/26421836
has comment: http://stackoverflow.com/comment/41490500
has comment: http://stackoverflow.com/comment/41505553
has comment: http://stackoverflow.com/comment/41492917
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41499305
tagged with: jfreechart
type: Question
has comment: http://stackoverflow.com/comment/41511162
downvote count: 0
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/41493112
has title: ChartPanel in a JScrollPane
type: UnansweredQuestion
has body: i'm trying to add a ChartPanel in a JscrollPane and make the horizontal scrollbar visible only when needed. When there are too many columns in the chart, i want its panel to be more wide than the frame and make the horizontal scrollbar visible. I also want to have a minimum gap between the bars in my chart. I post my code, without scrollpane and without the minimum gap between bars. So my questions are: how to set a precise gap between bars? how to make visible an horizontal scroll when there are too many bars to represent on the frame width? package view; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import javax.swing.SpringLayout; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; public class StatisticsPanel extends AbstractCenterPanel { private static final long serialVersionUID = 1L; private final ChartPanel chartPanel; public StatisticsPanel(final Map&lt;Calendar, Integer&gt; cashMap) { super(); final SimpleDateFormat df = new SimpleDateFormat("dd/MM", Locale.ITALY); final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Entry&lt;Calendar, Integer&gt; e : cashMap.entrySet()) { dataset.setValue(e.getValue(), "Incasso", df.format(e.getKey().getTime())); } final JFreeChart chart = ChartFactory.createBarChart("Andamento degli incassi", "Data", "Incasso (€)", dataset, PlotOrientation.VERTICAL, false, true, false); this.chartPanel = new ChartPanel(chart); final SpringLayout layout = new SpringLayout(); this.setLayout(layout); layout.putConstraint(SpringLayout.WEST, this.chartPanel, 0, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, this.chartPanel, 0, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, this.chartPanel, 0, SpringLayout.EAST, this); layout.putConstraint(Sp…
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/41649795
type: Comment
comment on: http://stackoverflow.com/a/26509524
has text: @pmaingi Edited my answer. You set that to a `double` in `icLoaded`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26375510
score: 0
type: Answer
has body: You can try forcing wicket to redirect immediately using a fake page that just redirects back to Careers1. Let's name it RedirectorPage: public class RedirectorPage extends WebPage { @Override protected void onBeforeRender() { throw new RestartResponseException(Careers1.class); } } Now in the logout link of Careers1 you redirect to RedirectorPage. That worked for me, but only after I moved the exception of RedirectorPage into onBeforeRender(). Throwing the exception in the page constructor still makes wicket ignore the fact the session has already been invalidated.
answers question: http://stackoverflow.com/q/26365614

http://stackoverflow.com/comment/41595944
comment on: http://stackoverflow.com/a/26479552
type: AnswerComment
has text: @osimerpothe &lt; is the < character escaped - so it is `while (a < b)`
score: 0
type: Comment

http://stackoverflow.com/comment/41456823
comment on: http://stackoverflow.com/q/26403067
type: Comment
has text: But now in GUI it shows java.lang.NullPointerException. It works with no GUI but with gui it doesn't. int num = q.pAhead(p.getName()); tArea.append("There are " + num + " patients ahead");
score: 0
type: QuestionComment

http://stackoverflow.com/a/26487152
score: 0
answers question: http://stackoverflow.com/q/26485936
has body: From en.wikibooks.org: If you have a public interface in JPA, you just need to map the implementation class and are fine for the most part. One issue is that you need to use the implementation class for queries, as JPA does not know about the interface. For JPQL the default alias is also the implementation class, but you could redefine this to be the public interface by setting the name of the Entity to be the public interface. JPA annotations on interfaces are ignored by JPA.
type: Answer

http://stackoverflow.com/q/26465182
answer count: 2
upvote count: 0
has title: SQLite Syntax Error code(1)
has answer: http://stackoverflow.com/a/26465392
has comment: http://stackoverflow.com/comment/41568485
has comment: http://stackoverflow.com/comment/41568326
tagged with: android
tagged with: sqlite
linked to: http://stackoverflow.com/q/2421189
score: -6
duplicate of: http://stackoverflow.com/q/1609637
favorite count: 0
linked to: http://stackoverflow.com/q/16055566
has comment: http://stackoverflow.com/comment/41568510
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41569020
has comment: http://stackoverflow.com/comment/41568968
has body: I am facing problem from long time. I am dynamically generating insert query in android SQLite database it throws following error. android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: INSERT INTO 'contacts' (id, name, phone_number, email, fax, job, company, website, address, mobile) VALUES(98,'Vijay Bachani','022 - 61608080','','','TRAVEL CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001',''), (99,'Taha Udaipurwala','022 - 61608080','taha.udaipurwala@riya.travel','','JR. CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001',''),(100,'Salman Lakdawala','022 - 61608080','salman.lakdawala@riya.travel','','JUNIOR CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001','9768683322'),(101,'Vipul Kharat','022 - 61608080','vipul.kharat@riya.travel','','JR. CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001','9768215903'),(102,'Abdul Rafiq Siddique','022 - 61608080','rafiq.siddique@riya.travel','','JR. CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001','9820327417'),(103,'Suryaji More','022 - 61608080','','','OFFICE ASSISTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001',''),(104,'Wayne Joseph','022 - 61608080','','','SR. CONSULTANT','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','237 Gulab Building, P.D Mello Road, Mumbai, 400001',''),(105,'GEORGE THOMAS','022 - 67772300','george.thomas@riya.travel','','GENERAL MANAGER','RIYA TRAVEL &amp; TOURS (I) PVT. LTD.','WWW.RIYA.TRAVEL','M/1, Leela Business Park, Andheri Kurla road, Andheri (East), Mumbai - 400059','9820128819'),(106,'K P RAMKUMAR','022 - 67772300','ramkumar…
downvote count: 6
has comment: http://stackoverflow.com/comment/41568451
tagged with: java
linked to: http://stackoverflow.com/q/1609637
has answer: http://stackoverflow.com/a/26465253
type: Question

java
tags question: http://stackoverflow.com/q/26450556
tags question: http://stackoverflow.com/q/26476982
tags question: http://stackoverflow.com/q/26458531
tags question: http://stackoverflow.com/q/26395602
tags question: http://stackoverflow.com/q/26465371
tags question: http://stackoverflow.com/q/26386422
tags question: http://stackoverflow.com/q/26498714
tags question: http://stackoverflow.com/q/26501599
tags question: http://stackoverflow.com/q/26439042
tags question: http://stackoverflow.com/q/26466444
tags question: http://stackoverflow.com/q/26412287
tags question: http://stackoverflow.com/q/26413063
tags question: http://stackoverflow.com/q/26359200
tags question: http://stackoverflow.com/q/26412344
tags question: http://stackoverflow.com/q/26391268
tags question: http://stackoverflow.com/q/26481823
tags question: http://stackoverflow.com/q/26468149
tags question: http://stackoverflow.com/q/26365077
tags question: http://stackoverflow.com/q/26427333
tags question: http://stackoverflow.com/q/26384626
tags question: http://stackoverflow.com/q/26488646
tags question: http://stackoverflow.com/q/26427693
tags question: http://stackoverflow.com/q/26417293
tags question: http://stackoverflow.com/q/26441981
tags question: http://stackoverflow.com/q/26452656
tags question: http://stackoverflow.com/q/26377978
tags question: http://stackoverflow.com/q/26471266
tags question: http://stackoverflow.com/q/26482049
tags question: http://stackoverflow.com/q/26354170
tags question: http://stackoverflow.com/q/26459259
tags question: http://stackoverflow.com/q/26411312
tags question: http://stackoverflow.com/q/26391091
tags question: http://stackoverflow.com/q/26453625
tags question: http://stackoverflow.com/q/26365850
tags question: http://stackoverflow.com/q/26372290
tags question: http://stackoverflow.com/q/26372114
tags question: http://stackoverflow.com/q/26436769
tags question: http://stackoverflow.com/q/26482714
tags question: http://stackoverflow.com/q/26484289
tags question: http://stackoverflow.com/q/26501088
tags question: http://stackoverflow.com/q/26402752
tags question: http://stackoverflow.com/q/26360865
tags question: http://stackoverflow.com/q/26390198
tags question: http://stackoverflow.com/q/26463228
tags question: http://stackoverflow.com/q/26393792
tags question: http://stackoverflow.com/q/26395994
tags question: http://stackoverflow.com/q/26443443
tags question: http://stackoverflow.com/q/26456778
tags question: http://stackoverflow.com/q/26403872
tags question: http://stackoverflow.com/q/26420228
tags question: http://stackoverflow.com/q/26357157
tags question: http://stackoverflow.com/q/26496211
tags question: http://stackoverflow.com/q/26511329
tags question: http://stackoverflow.com/q/26458704
tags question: http://stackoverflow.com/q/26387332
tags question: http://stackoverflow.com/q/26384803
tags question: http://stackoverflow.com/q/26387677
tags question: http://stackoverflow.com/q/26427080
tags question: http://stackoverflow.com/q/26507130
tags question: http://stackoverflow.com/q/26487266
tags question: http://stackoverflow.com/q/26361736
tags question: http://stackoverflow.com/q/26383121
tags question: http://stackoverflow.com/q/26395501
tags question: http://stackoverflow.com/q/26439498
tags question: http://stackoverflow.com/q/26474958
tags question: http://stackoverflow.com/q/26403714
tags question: http://stackoverflow.com/q/26383012
tags question: http://stackoverflow.com/q/26458341
tags question: http://stackoverflow.com/q/26486738
tags question: http://stackoverflow.com/q/26479922
tags question: http://stackoverflow.com/q/26456071
tags question: http://stackoverflow.com/q/26432369
tags question: http://stackoverflow.com/q/26475959
tags question: http://stackoverflow.com/q/26392097
tags question: http://stackoverflow.com/q/26490315
tags question: http://stackoverflow.com/q/26426085
tags question: http://stackoverflow.com/q/26460238
tags question: http://stackoverflow.com/q/26430630
tags question: http://stackoverflow.com/q/26371931
tags question: http://stackoverflow.com/q/26421371

http://stackoverflow.com/comment/41405236
score: 0
comment on: http://stackoverflow.com/q/26374322
type: Comment
type: QuestionComment
has text: I think the java.net.InetAddress will take more space than using either string or short

http://stackoverflow.com/comment/41585758
type: Comment
type: QuestionComment
has text: multiplying ints like that won't get you much. (nor will multiplying doubles for that matter.) You need to use at least BigDecimals
score: 4
comment on: http://stackoverflow.com/q/26474153

http://stackoverflow.com/q/26375943
linked to: http://stackoverflow.com/q/5445511
has comment: http://stackoverflow.com/comment/41410725
type: Question
has title: Explicitly use a custom class loader for all the classes
has comment: http://stackoverflow.com/comment/41407878
score: 0
answer count: 0
tagged with: classloader
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41409070
tagged with: java
has body: I have two modules in my application. These modules share some common JARs which contain some static HashMaps. I want these modules to be loaded using different Class Loaders. Each Class Loader will have a custom class path that contains a set of locations. URL [] urlsForModule1=getURLsForModule1(); URL[] urlsForModule2=getURLsForModule2(); Thread.currentThread().setContextClassLoader( new URLClassLoader( urlsForModule1, ClassLoader.getSystemClassLoader().getParent() ) ); //Perform the activities needed for Module 1 String valueForModelue1=CommonClass.getValueFromMap("someKey"); //The value is already set in some other place and this should give a specific value for Module 1 Thread.currentThread().setContextClassLoader( new URLClassLoader( urlsForModule2, ClassLoader.getSystemClassLoader().getParent() ) ); //Perform the activities needed for Module 2 String valueForModelue2=CommonClass.getValueFromMap("someKey"); //The value it should give a specific value for Module 2 But the problem that I'm facing is with the common Class files which are there in the Common JARs. Since these Class files are already loaded (before the above lines of code in some other classes) the staic HashMaps retain their previuos values. Is it possible to tell all the code below Thread.currentThread().setContextClassLoader( new URLClassLoader( urlsForModule1, ClassLoader.getSystemClassLoader().getParent() ) ); should use the above URLClassLoader to load the classes even if they are already loaded?

http://stackoverflow.com/a/26400939
downvote count: 0
has comment: http://stackoverflow.com/comment/41511626
has body: import org.apache.commons.lang.StringUtils; StringUtils.isNumeric(String s); Notice this doesn't throw exceptions on regular cases, which should be avoided in every possible scenario.
has comment: http://stackoverflow.com/comment/41503702
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26400433
answers question: http://stackoverflow.com/q/26400433
score: 1
has comment: http://stackoverflow.com/comment/41503732
type: AcceptedAnswer

http://stackoverflow.com/q/26445264
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/41533149
tagged with: overloading
type: AnsweredQuestion
score: 1
tagged with: java
has title: SortedVector from Vector
has answer: http://stackoverflow.com/a/26445290
type: Question
tagged with: vector
has body: (Learning task - got stuck) I need to make a class (SortedVector) that extends Vector always sorting the elements. Can't figure out how to overload the addElement method. I must use Collections.sort. public class SortedVector extends Vector { public void addElement(Object o){ super.add(o); Collections.sort(); //what do I do here? } }
downvote count: 0
tagged with: sorting
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/26445290
answer count: 1

http://stackoverflow.com/q/26424509
has title: System.NullPointerException: Attempt to de-reference a null object
tagged with: class
tagged with: controller
tagged with: apex
tagged with: salesforce
has answer: http://stackoverflow.com/a/26424700
type: Question
answer count: 2
has body: please help me with my code, Im new to Java/SF and I didn't understand the whole code. The code below should return the three values of the people which are younger than 18, between 18 to 30 and older. I want to learn the coding and I comment all lines, if something wrong, please correct me. At the moment I get the error: System.NullPointerException: Attempt to de-reference a null object Class.testfor1_c.getEZRen: line 18, column 1 Class.testfor1_c.: line 4, column 1 public class testfor1_c { public testfor1_c(ApexPages.StandardController stdcontroller) { getEZRen(); } public Integer Count_u18 {get; set;} // variable for people &lt; 18 public Integer Count_1830 {get; set;} // variable for people &gt;=18 AND &lt;30 public Integer Count_g30 {get; set;} // variable for people &gt;30 public void getEZRen() { List&lt;Einzelrisiko__c&gt; EZRList = [SELECT Alter__c FROM Einzelrisiko__c]; // create List EZRList with the information Alter__c of all people FOR (Einzelrisiko__c EZR : EZRList) { // Loop thru the all people IF(EZR.Alter__c &lt; 18) { Count_u18++; } // if Alter__c &lt; 18 variable Count_u18 increase IF(EZR.Alter__c &gt;= 18 &amp;&amp; EZR.Alter__c &lt;=30) { Count_1830++; } // if Alter__c &gt;=18 AND &lt;=30 variable Count_1830 increase IF(EZR.Alter__c &gt; 30) { Count_g30++; } // if Alter__c &gt; 30 variable Count_g30 increase } } } &lt;apex:page standardcontroller="account" extensions="testfor1_c"&gt; Anzahl {!Count_u18} // show the value of people &lt;18 Anzahl {!Count_1830} // show the value of people &gt;=18 AND &lt;=30 Anzahl {!Count_g30} // show the value of people &gt;30 &lt;/apex:page&gt; Thanks in advance, peX
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26439296
type: UnansweredQuestion

http://stackoverflow.com/a/26460385
has comment: http://stackoverflow.com/comment/41603110
has comment: http://stackoverflow.com/comment/74594537
type: Answer
upvote count: 10
downvote count: 1
answers question: http://stackoverflow.com/q/26460196
score: 9
accepted answer of: http://stackoverflow.com/q/26460196
type: AcceptedAnswer
has body: There is no public stream API, but the Realtime API offers subscriptions to Pages and User Profiles: https://developers.facebook.com/docs/graph-api/real-time-updates/v2.1 The Public Post Search is deprecated, so you can´t even use a cron job to get new public posts with specific keywords anymore. Example Usage: http://www.sitepoint.com/using-facebooks-realtime-updates-and-subscription-api/
has comment: http://stackoverflow.com/comment/41602896

http://stackoverflow.com/a/26421446
type: Answer
has comment: http://stackoverflow.com/comment/41488925
has comment: http://stackoverflow.com/comment/41489681
answers question: http://stackoverflow.com/q/26421370
score: 5
upvote count: 5
has body: You have problem with JAVA_HOME settings. Instead of /usr/lib/jvm/java-7-openjdk-amd64/bin Use this: /usr/lib/jvm/java-7-openjdk-amd64/ In that case mvn will use: /usr/lib/jvm/java-7-openjdk-amd64/bin/java That will solve your problem.
downvote count: 0
has comment: http://stackoverflow.com/comment/41488804
has comment: http://stackoverflow.com/comment/41489062

http://stackoverflow.com/q/26422133
upvote count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26422762
accepted answer: http://stackoverflow.com/a/26423213
tagged with: mapping
has body: I'm using BeanUtils.copyProperties to convert two beans. BeanUtils.copyProperties(organization, dtoOrganization); I would like to have a List in one bean and a Set in the other one. First bean: public class Form { private Set&lt;Organization&gt; organization; } Second bean: public final class DTOForm { private List&lt;DTOOrganization&gt; organization; } The result is an exception as stated here: argument type mismatch by Using BeanUtils.copyProperties Is it possible to customize BeanUtils.copyProperties to achive it?
has title: Is there a way to map a Set to a List with BeanUtils.copyProperties?
tagged with: spring
has answer: http://stackoverflow.com/a/26423213
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19064331
score: 3
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26422762

http://stackoverflow.com/comment/41516080
score: 0
type: Comment
type: QuestionComment
has text: There is no `foo2` functionality in class `A` if it's abstract. And `B` must implement `foo2` for the inheritance chain to be valid.
comment on: http://stackoverflow.com/q/26435685

http://stackoverflow.com/a/26487119
type: Answer
upvote count: 1
score: 1
has body: It isn't a good idea to share the embedded database's files between different applications. For most embedded database implementations it is even not possible, because the embedded database engine needs exclusive access to the underlying data files. Furthermore it is a performance penalty to access the database files over a shared folder. I know only two databases allowing shared database file access: SQLite and MS Access. Java and MS Access is not a good combination. Avoid it, use it only if you are forced to. For SQLite I don't know if it performs well for different processes on the same machine. But over a shared folder, I think this would work only for the simplest cases. So if you have multiple client applications accessing the same database then you should install a database server. A database server is exactly made for such a sceanario. It manages the server local database files efficiently and can handle many clients at the same time. There are simple ones like Apache Derby or H2 which are Java only implementations and very easy to use. If you need more performance then you can go with MySQL or PostgreSQL, but these are more complex to administer.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26484855
answers question: http://stackoverflow.com/q/26484855

http://stackoverflow.com/comment/41982250
type: Comment
has text: Interesting answer, even if it's not really what I expected.
type: AnswerComment
comment on: http://stackoverflow.com/a/26457708
score: 0

http://stackoverflow.com/q/26362362
favorite count: 0
type: UnansweredQuestion
has title: Executing java program with batch
upvote count: 0
has body: I have the assignment to create a project. I have programmed everything, but i was told to create a batch which executes my program on the console. My problem is to include the external jar, because i have nearly no experience with batch files. The structure of my folders is projectFolder{ srcFolder{...} libFolder{lib1.jar; lib2.jar; ...} resFolder{...} binFolder{start.bat; Main.class; toolsFolder{Tool.class; ...} ...} I only know that it hat to include "java Main", but not what else, so would very appreciate your help how my batch file should look like :) Edit: I also got an example from an other project, but i understand nearly nothing of it :/ run.bat: @echo off setlocal set VM_MEMORY=1280m call runjava.bat %0 de.usu.skm.stats.Statistics %1 %2 %3 %4 endlocal java.bat: break off if exist init.bat call init.bat if not "%VM_MEMORY%" == "" goto SETVMOPTS set VM_MEMORY=96m :SETVMOPTS rem USER_TIMEZONE must be set when you are using the ojdbc5 Oracle driver with 9i (and maybe 10i) rem set USER_TIMEZONE=-Duser.timezone=CET set USE_IPV4=-Djava.net.preferIPv4Stack=false set VM_OPTS=-server -Xmx%VM_MEMORY% -Djava.security.policy=gatekeeper.policy -Djava.rmi.server.useCodebaseOnly=true -Djavax.net.ssl.keyStore=keystore -Djavax.net.ssl.keyStorePassword=gatekeeper -Djavax.net.ssl.trustStore=keystore -Djavax.net.ssl.trustStorePassword=gatekeeper -Dsun.net.client.defaultConnectTimeout=5000 -Dsun.net.client.defaultReadTimeout=20000 -Dsun.net.inetaddr.ttl=10 %USE_IPV4% -Dzookeeper.preAllocSize=2048 -Dzookeeper.authProvider.1=de.usu.ucp.UcpAuthenticationProvider -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false -DJAVA_HOME="%JAVA_HOME%" -Djava.io.tmpdir=../temp -Dorg.terracotta.quartz.skipUpdateCheck=true :SETJAVA if "%JAVA_HOME%" == "" goto NOJAVAHOME rem echo Using JAVA_HOME %JAVA_HOME% set JAVA_CMD="%JAVA_HOME%\bin\java.exe" goto RUNJAVA :NOJAVAHOME echo WARNING: JAVA_HOME variable not set set JAVA_CMD=java :…
linked to: http://stackoverflow.com/q/2622062
downvote count: 1
has answer: http://stackoverflow.com/a/26362979
type: Question
tagged with: java
score: -1
tagged with: batch-file
has comment: http://stackoverflow.com/comment/41382481
answer count: 1

http://stackoverflow.com/comment/41429496
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26386570
has text: unable to access the jar file
score: 0

http://stackoverflow.com/a/26436801
upvote count: 0
has comment: http://stackoverflow.com/comment/41518286
has comment: http://stackoverflow.com/comment/41520763
has comment: http://stackoverflow.com/comment/41521015
type: Answer
score: -2
has body: You can do this using Java Threads. Schedule a servlet to load on server startup. See How can I set a servlet to load on startup of the container, rather than on the first request? In this servlet's init() method, spawn a thread. In this thread's run() method, calculate the number of milliseconds to wait until the task should be performed. Then call Thread.sleep(msec). Then do the task, and loop (infinitely). The java.util.Timer class can help a lot. Use the schedule() method of the java.util.Timer class: long now = System.currentTimeMillis(); Date whenToRun = new Date(now+millisecondsInFuture); Timer timer = new Timer(); TimerTask task = new TimerTask() { public void run() { // job code here } }; timer.schedule(task, whenToRun); Or use the scheduleAtFixedRate() method of the java.util.Timer class: int initialDelay = 30000; // start after 30 seconds int period = 5000; // repeat every 5 seconds Timer timer = new Timer(); TimerTask task = new TimerTask() { public void run() { // job code here } }; timer.scheduleAtFixedRate(task, initialDelay, period);
downvote count: 2
answers question: http://stackoverflow.com/q/26436769
has comment: http://stackoverflow.com/comment/41521032
has comment: http://stackoverflow.com/comment/41518105

http://stackoverflow.com/comment/41632827
comment on: http://stackoverflow.com/q/26500343
has text: Which errors do you want help understanding? My psychic powers aren't working very well today.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41484823
comment on: http://stackoverflow.com/a/26418911
type: AnswerComment
has text: I have tried this Before i asked the question. But then i get error sayin "missing return statement" at the last brace.
score: 0
type: Comment

jframe
tags question: http://stackoverflow.com/q/26412730
tags question: http://stackoverflow.com/q/26468633
tags question: http://stackoverflow.com/q/26479429
tags question: http://stackoverflow.com/q/26395710
tags question: http://stackoverflow.com/q/26471926
tags question: http://stackoverflow.com/q/26485706
tag name: jframe
tags question: http://stackoverflow.com/q/26483178
tags question: http://stackoverflow.com/q/26498950
tags question: http://stackoverflow.com/q/26358390
tags question: http://stackoverflow.com/q/26499704
tags question: http://stackoverflow.com/q/26402334
tags question: http://stackoverflow.com/q/26392629
tags question: http://stackoverflow.com/q/26501943
tags question: http://stackoverflow.com/q/26472689
tags question: http://stackoverflow.com/q/26492086
tags question: http://stackoverflow.com/q/26450095
tags question: http://stackoverflow.com/q/26475502
type: Tag
tags question: http://stackoverflow.com/q/26469621
tags question: http://stackoverflow.com/q/26447499

http://stackoverflow.com/a/26504445
downvote count: 0
score: 1
has body: Try this way,hope this will help you to solve your problem. This layout use define ListView for Activity. activity_main.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"&gt; &lt;ListView android:id="@+id/listView" android:layout_width="match_parent" android:layout_height="wrap_content"/&gt; &lt;/LinearLayout&gt; This layout as same which you created i just given id to ImageView,TextView and also correct LinearLayout weight. list_item.xml &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="match_parent" android:padding="8dp"&gt; &lt;ImageView android:id="@+id/imgIcon" android:layout_width="56dp" android:layout_height="56dp" android:background="#CCCCCC" android:layout_margin="8dp" /&gt; &lt;LinearLayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;TextView android:id="@+id/txtFirstLastName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="First Name Last Name" android:textSize="20dp" android:textColor="#757575" android:layout_margin="8dp"/&gt; &lt;TextView android:id="@+id/txtDescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some very long long description. Some very long long description. Some very long long description." android:textSize="14dp" android:textColor="#222222" android:layout_margin="8dp"/&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/txtParams1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="8dp" android:layout_weight="1"/&gt; &lt;TextView android:id="@+id/txtParams2" android:layout_width="0dp" android:layout_height="wrap_cont…
upvote count: 1
answers question: http://stackoverflow.com/q/26503876
type: Answer

http://stackoverflow.com/q/26366331
has body: There are two buttons in my ui which re-directs to two JFrames. I am trying to make that if user press button one, button two becomes disabled, and if the user presses button two, button one becomes disabled, so that the user cannot open both the JFrames at the same time. import java.awt.*; import java.awt.event.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.*; public class Main extends JFrame { public Main() { JPanel panel = new JPanel(); getContentPane().add (panel,BorderLayout.NORTH); JButton button1 = new JButton("One"); panel.add(button1); JButton button2 = new JButton("Two"); panel.add(button2); button1.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { button2.setEnabled(false); One f = new One(); f.setSize(350,100); f.setVisible(true); } }); button2.addActionListener (new ActionListener() { public void actionPerformed (ActionEvent e) { button1.setEnabled(false); Two fr = new Two(); fr.setSize(350,100); fr.setVisible(true); } }); public void enableButtons() { button1.setEnabled(true); button2.setEnabled(true); } } public static void main(String[] args) { Main frame = new Main(); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { enableButtons(); System.exit(0); } }); frame.setSize(300,200); frame.setLocationByPlatform(true); frame.setVisible(true); } }
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41390137
has answer: http://stackoverflow.com/a/26366380
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/26502538
tagged with: jbutton
has comment: http://stackoverflow.com/comment/41391152
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/9554636
has title: Enable one JButton and disable another

android
tags question: http://stackoverflow.com/q/26507479
tags question: http://stackoverflow.com/q/26444133
tags question: http://stackoverflow.com/q/26468279
tags question: http://stackoverflow.com/q/26365176
tags question: http://stackoverflow.com/q/26394145
tags question: http://stackoverflow.com/q/26410767
tags question: http://stackoverflow.com/q/26500036
tags question: http://stackoverflow.com/q/26412374
tags question: http://stackoverflow.com/q/26463749
tags question: http://stackoverflow.com/q/26436420
tags question: http://stackoverflow.com/q/26483303
tags question: http://stackoverflow.com/q/26402350
tags question: http://stackoverflow.com/q/26457535
tags question: http://stackoverflow.com/q/26355251
tags question: http://stackoverflow.com/q/26363882
tags question: http://stackoverflow.com/q/26458695
tags question: http://stackoverflow.com/q/26391911
tags question: http://stackoverflow.com/q/26411379
tags question: http://stackoverflow.com/q/26511190
tags question: http://stackoverflow.com/q/26513045
tags question: http://stackoverflow.com/q/26467364
tags question: http://stackoverflow.com/q/26397949
tags question: http://stackoverflow.com/q/26485996
tags question: http://stackoverflow.com/q/26396752
tags question: http://stackoverflow.com/q/26404761
tags question: http://stackoverflow.com/q/26488319
tags question: http://stackoverflow.com/q/26513564
tags question: http://stackoverflow.com/q/26468271
tags question: http://stackoverflow.com/q/26356654
tags question: http://stackoverflow.com/q/26502867
tags question: http://stackoverflow.com/q/26394799
tags question: http://stackoverflow.com/q/26445243
tags question: http://stackoverflow.com/q/26401841
tags question: http://stackoverflow.com/q/26443726
tags question: http://stackoverflow.com/q/26445731
tags question: http://stackoverflow.com/q/26416379
tags question: http://stackoverflow.com/q/26511532
tags question: http://stackoverflow.com/q/26426151
tags question: http://stackoverflow.com/q/26423734
tags question: http://stackoverflow.com/q/26385738
tags question: http://stackoverflow.com/q/26418417
tags question: http://stackoverflow.com/q/26430133
tags question: http://stackoverflow.com/q/26388599
tags question: http://stackoverflow.com/q/26472576
tags question: http://stackoverflow.com/q/26433694
tags question: http://stackoverflow.com/q/26455521
tags question: http://stackoverflow.com/q/26386556
tags question: http://stackoverflow.com/q/26512835
tags question: http://stackoverflow.com/q/26437376
tags question: http://stackoverflow.com/q/26459820
tags question: http://stackoverflow.com/q/26402748
tags question: http://stackoverflow.com/q/26510519
tags question: http://stackoverflow.com/q/26498609
tags question: http://stackoverflow.com/q/26476892
tags question: http://stackoverflow.com/q/26506559
tags question: http://stackoverflow.com/q/26411243
tags question: http://stackoverflow.com/q/26488929
tags question: http://stackoverflow.com/q/26426187
tags question: http://stackoverflow.com/q/26390303
tags question: http://stackoverflow.com/q/26477782
tags question: http://stackoverflow.com/q/26361672
tags question: http://stackoverflow.com/q/26493206
tags question: http://stackoverflow.com/q/26442550
tags question: http://stackoverflow.com/q/26421113
tags question: http://stackoverflow.com/q/26502872
tags question: http://stackoverflow.com/q/26452926
tags question: http://stackoverflow.com/q/26412490
tags question: http://stackoverflow.com/q/26404099
tags question: http://stackoverflow.com/q/26505085
tags question: http://stackoverflow.com/q/26494775
tags question: http://stackoverflow.com/q/26395436
tags question: http://stackoverflow.com/q/26383549
tags question: http://stackoverflow.com/q/26439059
tags question: http://stackoverflow.com/q/26487595
tags question: http://stackoverflow.com/q/26465290
tags question: http://stackoverflow.com/q/26384544
tags question: http://stackoverflow.com/q/26423845
tags question: http://stackoverflow.com/q/26373622
tags question: http://stackoverflow.com/q/26463573
tags question: http://stackoverflow.com/q/26381579

http://stackoverflow.com/comment/41451200
type: QuestionComment
comment on: http://stackoverflow.com/q/26400521
type: Comment
has text: <com.example.drawingapp.DrawingView this line
score: 0

http://stackoverflow.com/q/26487777
has answer: http://stackoverflow.com/a/26488019
has comment: http://stackoverflow.com/comment/41756749
has comment: http://stackoverflow.com/comment/41761800
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has title: 3D Java programming tutorial isn't working
accepted answer: http://stackoverflow.com/a/26488019
upvote count: 1
has comment: http://stackoverflow.com/comment/41761676
type: AnsweredQuestion
tagged with: pixel
has comment: http://stackoverflow.com/comment/41776315
score: 1
tagged with: java
tagged with: render
type: Question
has body: http://www.youtube.com/watch?v=iH1xpfOBN6M I've followed this tutorial up to episode four and where his window has pixels in it, mine is completely blank. I want to know whether anyone with experience with 3d programming in eclipse can see if there is something that doesn't look right to you. Display: package com.mine.minefrost; import java.awt.Canvas; import java.awt.Graphics; import java.awt.image.BufferStrategy; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import javax.swing.JFrame; import com.minefrost.graphics.Render; import com.minefrost.graphics.Screen; public class Display extends Canvas { private static final long serialVersionUID = 1L; public static final int WIDTH = 800; public static final int HEIGHT = 600; public static final String TITLE = "Minefrost Pre-Alpha 0.01"; private Thread thread; private Screen screen; private BufferedImage img; private Render render; private boolean running = false; private int[] pixels; public Display() { screen = new Screen(WIDTH, HEIGHT); img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); } private void start() { if (running) return; running = true; thread = new Thread(); thread.start(); } private void stop() { if (!running) return; running = false; try { thread.join(); } catch (Exception e) { e.printStackTrace(); System.exit(0); } } private void run() { while (running) { tick(); render(); } } private void tick() { } private void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } screen.render(); for (int i = 0; i&lt;WIDTH * HEIGHT; i++) { pixels[i] = screen.pixels[i]; } Graphics g = bs.getDrawGraphics(); g.drawImage(img, 0, 0, WIDTH, HEIGHT, null); g.dispose(); bs.show(); } public static void main(String[] args) { Display game = new Display(); JFrame frame = new JFrame(); frame.add(game); frame.pack(); frame.setTitle(TITLE); frame.setDefaultCloseOper…
has comment: http://stackoverflow.com/comment/41784343
has comment: http://stackoverflow.com/comment/41746049

http://stackoverflow.com/a/26415575
downvote count: 0
has comment: http://stackoverflow.com/comment/41504548
answers question: http://stackoverflow.com/q/26415507
type: Answer
has comment: http://stackoverflow.com/comment/41479381
upvote count: 1
has body: A set containing null contains the element null. An empty set does not contain the element null. Suppose you make a set containing null like this: Set&lt;Object&gt; setWithNull = new HashSet&lt;Object&gt;(); setWithNull.add(null); And an empty set like this: Set&lt;Object&gt; emptySet = new HashSet&lt;Object&gt;(); Then you can see the following differences: setWithNull.size()==1 emptySet.size()==0 setWithNull.isEmpty()==false emptySet.isEmpty()==true setWithNull.contains(null)==true emptySet.contains(null)==false setWithNull.equals(emptySet)==false So a set containing null is different from an empty set in many significant ways.
has comment: http://stackoverflow.com/comment/41505630
score: 1
has comment: http://stackoverflow.com/comment/41485003

http://stackoverflow.com/comment/41602106
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26470499
has text: I see. Could you provide your own wrapper script that just sets that variable and calls the maven appsembler script?
type: Comment

http://stackoverflow.com/comment/41576775
comment on: http://stackoverflow.com/a/26468864
type: AnswerComment
score: 0
has text: it can work like that? String ad = links.split("&")[0].split("v=")[1]; gives me the following error (The method split (String) is undefined for the type ArrayList <String>)
type: Comment

http://stackoverflow.com/comment/41607557
score: 0
comment on: http://stackoverflow.com/q/26484675
type: Comment
type: QuestionComment
has text: @Mena already posted and got some awesome reviews... :)

http://stackoverflow.com/a/26449630
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26449047
has body: Yes you can delete everything except - jdk1.8.0_25 2014/10/19 and - jre1.8.0_25 2014/10/19. And don't forget to add - jdk1.8.0_25/bin to your PATH variable.
type: Answer
answers question: http://stackoverflow.com/q/26449047
score: 2
has comment: http://stackoverflow.com/comment/41541983
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41542079

http://stackoverflow.com/q/26445499
has comment: http://stackoverflow.com/comment/41533695
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26445554
has comment: http://stackoverflow.com/comment/41533740
upvote count: 2
tagged with: java
downvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/26445554
has body: How do I replace the number that the user inputs as their choice with the actual corresponding string that their choice means in the print line. My code is longer but I had to trim it down. import java.util.Scanner; public class MagicGame { public static void main(String [] args) { String name; int userCharacter; int armorChoice; int weaponChoice; Scanner input = new Scanner(System.in); System.out.println("Please enter your name"); name = input.nextLine(); { System.out.println("Please select the character you would like to play:" + '\n' + "1 for Magic User" + '\n' + "2 for Fighter" + '\n' + "3 for Thief" + '\n' + "4 for Druid" ); userCharacter = input.nextInt(); System.out.println("Please select your Armor Type:" + '\n' + "1 for Steel plate – Armor Class 10" + '\n' + "2 for Chain mail – Armor Class 5" + '\n' + "3 for Leather armor – Armor Class 3" + '\n' + "4 for A robe – Armor Class 1"); armorChoice = input.nextInt(); System.out.println("Please choose a Weapon:" + '\n' + "1 for Sword" + '\n' + "2 for Short Sword" + '\n' + "3 for Scimitar" + '\n' + "4 for Dagger"); weaponChoice = input.nextInt(); System.out.println("Hello " + name + "! You chose to play a " + userCharacter + "." + '\n' + "Your armor is" + armorChoice + "." + '\n' + "You will be fighting with a " + weaponChoice + "."); } } These are supposed to be three groups each numbered 1-4 but the formatting keeps changing them. Magic User Fighter Thief Druid Steel plate – Armor Class 10 Chain mail – Armor Class 5 Leather armor – Armor Class 3 A robe – Armor Class 1 Sword Short sword Scimitar Dagger
has title: How do I replace the user inputed integer with the corresponding String

http://stackoverflow.com/q/26483303
downvote count: 3
has comment: http://stackoverflow.com/comment/41604273
has comment: http://stackoverflow.com/comment/41601828
accepted answer: http://stackoverflow.com/a/26484503
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/41603461
has comment: http://stackoverflow.com/comment/41602006
has comment: http://stackoverflow.com/comment/41604124
favorite count: 0
has comment: http://stackoverflow.com/comment/41602164
has comment: http://stackoverflow.com/comment/41602061
tagged with: android
has comment: http://stackoverflow.com/comment/41604634
has title: App has crashed (stopped)
has body: I just started with Android and Java development and got this on my AVD simulator. Also I found many same questions here but to be honest I don't really know how to fix it. My app hase just 3 buttons nothing more. Also they are not active.. I just put them in Graphical Layout. This is Logcat: 10-21 05:05:13.811: E/AndroidRuntime(2042): FATAL EXCEPTION: main 10-21 05:05:13.811: E/AndroidRuntime(2042): Process: com.example.reserved, PID: 2042 10-21 05:05:13.811: E/AndroidRuntime(2042): android.content.res.Resources$NotFoundException:Resource ID #0x7f070000 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.content.res.Resources.getValue(Resources.java:1123) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2309) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.content.res.Resources.getLayout(Resources.java:939) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.view.MenuInflater.inflate(MenuInflater.java:107) 10-21 05:05:13.811: E/AndroidRuntime(2042): at com.example.reserved.MainActivity.onCreateOptionsMenu(MainActivity.java:21) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.app.Activity.onCreatePanelMenu(Activity.java:2538) 10-21 05:05:13.811: E/AndroidRuntime(2042): at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:436) 10-21 05:05:13.811: E/AndroidRuntime(2042): at com.android.internal.policy.impl.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:800) 10-21 05:05:13.811: E/AndroidRuntime(2042): at com.android.internal.policy.impl.PhoneWindow$1.run(PhoneWindow.java:221) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.view.Choreographer.doCallbacks(Choreographer.java:574) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.view.Choreographer.doFrame(Choreographer.java:543) 10-21 05:05:13.811: E/AndroidRuntime(2042): at android.v…
has answer: http://stackoverflow.com/a/26484503
has comment: http://stackoverflow.com/comment/41601903
upvote count: 1
has comment: http://stackoverflow.com/comment/41601795
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41616304
type: AnswerComment
score: 0
type: Comment
has text: what you mean can you give full answer am still unable to get clear working code
comment on: http://stackoverflow.com/a/26490038

http://stackoverflow.com/comment/41523977
has text: You have to collect the value from the `EditText` field first then convert the string you collected to your byte array, `(EditText)findViewById(R.id.edittext1);` this line returns an EditText objct.
comment on: http://stackoverflow.com/q/26440208
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/41770709
type: AnswerComment
comment on: http://stackoverflow.com/a/26568923
type: Comment
has text: They way I understand your suggestion, that would be just as awkward to test as the approach with the `@Converter`. Basically, it would be the very same approach and just avoiding the annotation? If I misunderstood you, can you please elaborate?
score: 0

http://stackoverflow.com/comment/41377588
type: QuestionComment
comment on: http://stackoverflow.com/q/26359779
has text: Have you tried anything yet? `["test19", "test20"]` looks like a `List<String>`, so iterate over your map, and for each `Map.Entry`, use `list.add(entry.getValue())`.
score: 0
type: Comment

http://stackoverflow.com/a/26401934
type: Answer
has body: Instead of &lt;view in your xml file, you need the fully qualified name of the class (or use a new xml namespace). So, in this example, your xml might look like: &lt;com.example.training.LinearChart android:id="@+id/view1" android:layout_width="wrap_content" android:layout_height="wrap_content" (and therefore remove the class: attribute in your current XML). This should then inflate correctly.
has comment: http://stackoverflow.com/comment/41453458
score: 0
answers question: http://stackoverflow.com/q/26401727

http://stackoverflow.com/q/26397647
has answer: http://stackoverflow.com/a/26398110
tagged with: rss
upvote count: 1
accepted answer: http://stackoverflow.com/a/26398110
type: AnsweredQuestion
has body: i have a sample code for parsing data from XML , In XML parsing SAX,DOC,and XML Pull parser which is the best XML parser ,what is json parser...? and how to parse news feeds through json parser.please answer with any examples public class MainActivity1 extends Activity { private String finalUrl="http://downloads.bbc.co.uk/podcasts/worldservice/globalnews/rss.xml"; private HandleXML obj; private TextView title,link,description; private LinearLayout mWeatherInfosLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); finalUrl = intent.getStringExtra("url"); setContentView(R.layout.activity_main_activity1); mWeatherInfosLayout = (LinearLayout) findViewById(R.id.weather_infos1); fetch(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void fetch(){ obj = new HandleXML(finalUrl); obj.fetchXML(); mWeatherInfosLayout.removeAllViews(); while(obj.parsingComplete) { if(obj.gotit) { final LinearLayout forecastInfoLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.feedlist, null); final TextView tvWeather1 = (TextView) forecastInfoLayout.findViewById(R.id.textview_forecast_info1); final TextView tvWeather2 = (TextView) forecastInfoLayout.findViewById(R.id.textview_forecast_info2); final TextView tvWeather3 = (TextView) forecastInfoLayout.findViewById(R.id.textview_forecast_info3); final TextView tvWeather4 = (TextView) forecastInfoLayout.findViewById(R.id.textview_forecast_info4); tvWeather1.setText(obj.getTitle()); tvWeather4.setText(obj.getPubDate()); tvWeather2.setText(obj.getLink()); String string = obj.getDescription(); String[] parts = string.split("&lt;"); String part1 = parts[0]; tvWeather3.setText(part1); mWeatherInfosLayout.addView(forecastInfoLayout); obj.setgotit(); } } } }
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 1
downvote count: 0
has title: How to make Rss News Reader application in android ....?
tagged with: android
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/41451785
type: Comment
comment on: http://stackoverflow.com/q/26400923
score: 0
type: QuestionComment
has text: @TheLostMind No, other answers say that `IdentityHashCode` may not refer to the same object and can also have same value for different objects.

onpaint
tags question: http://stackoverflow.com/q/26396100
tag name: onpaint
type: Tag

http://stackoverflow.com/comment/41557943
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26403539
has text: If the html has some text which has all bold, italics and underline styling, then all the extra tags are remaining. How can that be handled? Please refer question for example
type: Comment

http://stackoverflow.com/q/26388808
upvote count: 3
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/32589370
tagged with: ssl
type: AnsweredQuestion
tagged with: htmlunit
score: 3
downvote count: 0
has body: I have a Java application that connects to a web page using HtmlUnit 2.15 and scrapes content of it. Some of these urls requires TLS where as others require SSL. Since recent versions of TLS is considered more secure than SSLv3 some folks upgraded their application servers to use TLS while others are still configured to use SSL. Does HtmlUnit let you specify the protocol that you want it to use while fetching the page ?
favorite count: 0
has title: Can HtmlUnit 2.15 connect using TLS instead of SSL?
has answer: http://stackoverflow.com/a/32589370
tagged with: apache-httpclient-4.x
type: Question
tagged with: tls1.2

http://stackoverflow.com/q/26482902
has answer: http://stackoverflow.com/a/26484180
tagged with: opensaml
answer count: 2
tagged with: saml-2.0
downvote count: 0
has title: Create SAML Assertion and Sign the response
score: 7
favorite count: 0
has body: I have a Java web application. I want to implement SAML Single-Sign-On login for my application. I have got this GitHub onelogin program to send request and get response. But it was not working properly. I created one account there. But I don't have an enterprise account. When I run the application, it is going to onelogin login page. I tried to login, but it is not returning anyuthing in the response, showing I don't have permission. If I provide wrong credentials also, it is not giving any SAML response. So I decided to create an assertion and sign it. Do I need to send a SAML request to any identity provider first? How to create a sample SAML assertion instead of going to IdP(Like this is fine?) Once I get the SAML response, how do I sign it in my application and proceed? Thanks UPDATE 1 &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="123" InResponseTo="abc" IssueInstant="2014-11-21T17:13:42.872Z" Version="2.0"&gt; &lt;samlp:Status&gt; &lt;samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/&gt; &lt;/samlp:Status&gt; &lt;saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0"&gt; &lt;saml:Subject&gt; &lt;saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"&gt; user@example.com &lt;/saml:NameID&gt; &lt;/saml:Subject&gt; &lt;saml:AuthnStatement AuthnInstant="2014-11-21T17:13:42.899Z"&gt; &lt;saml:AuthnContext&gt; &lt;saml:AuthnContextClassRef&gt; urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport &lt;/saml:AuthnContextClassRef&gt; &lt;/saml:AuthnContext&gt; &lt;/saml:AuthnStatement&gt; &lt;/saml:Assertion&gt; &lt;/samlp:Response&gt;
tagged with: single-sign-on
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/384851
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/46000524
type: Question

http://stackoverflow.com/q/26403207
type: Question
has body: I have a 'DBF' file with me I have Read the files successfully using the code as following: public static void main(String args[]) throws Exception { DBFReader dbfreader = new DBFReader("./book2.dbf"); int i; for (i=0; i&lt;dbfreader.getFieldCount(); i++) { System.out.print(dbfreader.getField(i).getName()+" "); } System.out.print("\n"); for(i = 0; dbfreader.hasNextRecord(); i++) { Object aobj[] = dbfreader.nextRecord(Charset.forName("GBK")); for (int j=0; j&lt;aobj.length; j++) System.out.print(aobj[j]+" | "); System.out.print("\n"); } System.out.println("Total Count: " + i); } I have referred 'https://code.google.com/p/jdbf/' to do this. I need to update the columns of my 'DBF' file. I have tried a lot but unable to get code. Please help me guys??
tagged with: dbf
score: 0
answer count: 1
has title: Unable to update Column of DBF using jdbf
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27874423
tagged with: java

http://stackoverflow.com/comment/44919659
comment on: http://stackoverflow.com/a/26528790
type: AnswerComment
has text: Sorry for the late reply, as for the zoom part, we had to put that to a future development. @agusgambina that was exactly what I had in mind, I'm certainly going to give it a try! As soon as I have it, I'll post the results here. Thanks a lot.
score: 0
type: Comment

http://stackoverflow.com/a/26469507
downvote count: 0
type: Answer
has body: Try this modified version of your second getDepth() method: public int getDepth(Node root, String data) { if (root == null || root.getData().getName().equals(data)) { // you hit the spot - either you are below a leaf // or you matched the node // if you were doing insert/replace, you would put the data on this spot return 0; } if (isSmallerThan(data, root.getData().getName())) { return 1 + getDepth(root.leftChild, data); } return 1 + getDepth(root.rightChild, data); } where isSmallerThan(String a, String b) returns true if a is smaller than b. This method depends on how you want your strings to be compared. And you don't need to pass the level all along...
accepted answer of: http://stackoverflow.com/q/26469169
has comment: http://stackoverflow.com/comment/41576992
answers question: http://stackoverflow.com/q/26469169
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26405670
has comment: http://stackoverflow.com/comment/41460202
has comment: http://stackoverflow.com/comment/41470961
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41472262
has comment: http://stackoverflow.com/comment/41462388
score: 0
tagged with: owl
has title: Loading a RDF/XML File using owl api
tagged with: owl-api
has comment: http://stackoverflow.com/comment/56157651
type: UnansweredQuestion
has body: I'm trying to open a rdf/xml file using the OWL API. The file is accessible from: http://www.dmi.unict.it/~longo/comunect/comunect.owl If I download the file and try to open it with the loadOntologyFromOntologyDocument(File file) of OWLOntologyManager class. I obtain the following error: org.semanticweb.owlapi.io.UnparsableOntologyException: Problem parsing file:/C:/myfile.owl Could not parse ontology. Either a suitable parser could not be found, or parsing failed. See parser logs below for explanation. The following parsers were tried: 1) RDFXMLParser 2) OWLXMLParser 3) OWLFunctionalSyntaxOWLParser 4) TurtleOntologyParser 5) KRSS2OWLParser 6) ManchesterOWLSyntaxOntologyParser 7) OBOFormatOWLAPIParser 8) OWLOBO12Parser Parser: RDFXMLParser org.xml.sax.SAXParseException; systemId: file:/C:/myfile.owl; lineNumber: 1; columnNumber: 1; the content is not allowed in prolog. Now, since I can open the file with Protege, why I can't parse the ontology with the owl api library ? Thank you.

http://stackoverflow.com/q/26406423
has comment: http://stackoverflow.com/comment/41461677
type: Question
has title: JOptionPane inside a while loop showing after the while loop is terminated
has comment: http://stackoverflow.com/comment/41461507
score: 0
tagged with: while-loop
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41461765
has answer: http://stackoverflow.com/a/26407002
tagged with: joptionpane
has body: So the programs successfully runs, except that when the while loop's termination condition is met, it will post the last JOptionPane input dialog before showing the message dialog to end the program, where the input dialog will accomplish absolutely nothing. import javax.swing.JOptionPane; import java.util.Arrays; public class DiceGame2{ public static void main(String[] args){ Dice[] dDice = new Dice[5]; String[] sDice = new String[5]; String finalSDice, sRoll; int diceTotal=1, oldTotal=0, iRoll, numberOfRolls=0; for(int i=0; i&lt;5; i++){ dDice[i]= new Dice(); } for(int i=0; i&lt;5; i++){ dDice[i].roll(); } while(diceTotal&gt;=oldTotal){ for(int i=0; i&lt;5; i++){ sDice[i]=Integer.toString(dDice[i].value()); } finalSDice=Arrays.toString(sDice); oldTotal=diceTotal; diceTotal=0; for(int i=0; i&lt;5; i++){ diceTotal+=dDice[i].value(); } sRoll=JOptionPane.showInputDialog(null,"Your 5 dice contain the numbers:\n"+finalSDice+"\nThese dice have a total score of "+diceTotal+".\nEnter which dice you would like to reroll to attempt to increase your score:"); iRoll=Integer.parseInt(sRoll); dDice[iRoll-1].roll(); numberOfRolls++; } finalSDice=Arrays.toString(sDice); JOptionPane.showMessageDialog(null, "Your 5 dice contain the numbers:\n"+finalSDice+"\nThese dice have a total score of "+diceTotal+".\nYou've failed to increase your total score.\n You made "+numberOfRolls+" successful rolls."); } } How can I fix this?
tagged with: java
has comment: http://stackoverflow.com/comment/41461564

http://stackoverflow.com/q/26428538
type: Question
has title: Java regex to find whitespaces or upper-case characters
has comment: http://stackoverflow.com/comment/41502911
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26428627
tagged with: casing
favorite count: 0
has answer: http://stackoverflow.com/a/26428574
has answer: http://stackoverflow.com/a/26428671
has comment: http://stackoverflow.com/comment/41502161
tagged with: regex
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26428671
score: 1
tagged with: java
has body: I have a method that validates a string and makes sure it doesn't have any whitespaces or upper-case characters: boolean validate(String input) { if(input.matches(".*\\S.*([A-Z]+)")) { return false; } return true; } Unfortunately, when I run this, it simply doesn't work. It doesn't throw any exceptions, it just allows all input string ("HelloWorld", "hello world", "Hello world", etc.) to pass validation. Any ideas where I'm going wrong?
tagged with: whitespace
upvote count: 1
accepted answer: http://stackoverflow.com/a/26428574

http://stackoverflow.com/comment/41391125
type: QuestionComment
has text: FYI, logcat is better as a code block than a blockquote. I edited the Question for you.
comment on: http://stackoverflow.com/q/26366866
score: 0
type: Comment

http://stackoverflow.com/q/26445706
score: 3
has answer: http://stackoverflow.com/a/26445712
has comment: http://stackoverflow.com/comment/41534438
upvote count: 4
linked to: http://stackoverflow.com/q/10516248
answer count: 2
favorite count: 0
has title: Multiplying odd numbers of 1-15
has body: I've written the following code: int oddProd = 1; for(int count = 1; count &gt;= 15; count++){ if (count % 2 != 0) oddProd = oddProd * count; } System.out.println("Odd Product: " + oddProd); Why doesn't this work? It outputs 1, and I checked, it doesn't even enter the for loop!
type: UnansweredQuestion
tagged with: java
tagged with: multiplication
has comment: http://stackoverflow.com/comment/41534052
downvote count: 1
has answer: http://stackoverflow.com/a/26445710
type: Question

http://stackoverflow.com/q/26403349
upvote count: 2
type: AnsweredQuestion
score: 2
has body: I am using SimpleDateFormat to convert a date string to java.sql.date. On converting, I am getting a issue, i.e. Year is getting added automatically. Code: String d="2012-12-04T08:48:00"; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-mm-dd'T'HH:MM:SS"); java.util.Date date = null; date = formatter.parse(d); System.out.println("UTIL DATE: "+date); System.out.println("SQL DATE: "+new Date(date.getTime())); Output: UTIL DATE: Fri Dec 04 08:12:00 IST 2015 SQL DATE: 2015-12-04 I should have got 2012 year in date, but it is adding up 3 years, Is there anything wrong in my code? Thanks in Advance.
tagged with: java
possible better answer: http://stackoverflow.com/a/26403527
has answer: http://stackoverflow.com/a/26403527
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26403389
tagged with: simpledateformat
downvote count: 0
tagged with: date
tagged with: sqldatetime
has title: String date to SQL date adding years
favorite count: 0
accepted answer: http://stackoverflow.com/a/26403389

http://stackoverflow.com/a/26388759
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41443586
has comment: http://stackoverflow.com/comment/41432063
type: Answer
accepted answer of: http://stackoverflow.com/q/26388638
has body: The easiest approach I know is to extract it into a method using Arrays.deepEquals(Object[], Object[]), something like - public static boolean contains(List&lt;int[][]&gt; al, int[][] toFind) { for (int[][] arr : al) { if (Arrays.deepEquals(arr, toFind)) { return true; } } return false; } Then you can test it like public static void main(String[] args) { ArrayList&lt;int[][]&gt; test = new ArrayList&lt;int[][]&gt;(); int[][] one = { { 1, 2, 3 }, { 4, 5, 6 } }; int[][] two = { { 1, 2, 3 }, { 4, 5, 6 } }; int[][] three = { { 9, 7, 5 }, { 1, 2, 4 }, { 5, 6, 7 } }; test.add(one); if (contains(test, two)) { System.out.println("Found two"); } } Output is Found two
upvote count: 3
answers question: http://stackoverflow.com/q/26388638
score: 3

http://stackoverflow.com/q/26397233
tagged with: printing
answer count: 1
type: UnansweredQuestion
has title: How do I replace a numeric value with a string in Java
has body: I want to print "Two" in the place of 2 and "Four" in the place of 4 in Java within a FOR Loop while printing the numbers from 1 to 50. For example: 1 Two 3 Four 5 . . . 1Four 15 . . . Two1 TwoTwo Two3 TwoFour . . . 50
has comment: http://stackoverflow.com/comment/41446000
tagged with: output
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26397519
score: 0

http://stackoverflow.com/q/26448717
upvote count: 142
has comment: http://stackoverflow.com/comment/112829163
has answer: http://stackoverflow.com/a/26847924
has comment: http://stackoverflow.com/comment/71569536
has answer: http://stackoverflow.com/a/38991080
favorite count: 0
has answer: http://stackoverflow.com/a/26450091
has answer: http://stackoverflow.com/a/26813208
has answer: http://stackoverflow.com/a/58799822
has answer: http://stackoverflow.com/a/69121398
has answer: http://stackoverflow.com/a/31154402
has answer: http://stackoverflow.com/a/35561591
linked to: http://stackoverflow.com/q/42202735
has body: I spent a moment trying to figure out a way to add a header to a RecyclerView, unsuccessfully. This is what I got so far: @Override protected void onCreate(Bundle savedInstanceState) { ... layouManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layouManager); LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); headerPlaceHolder = inflater.inflate(R.layout.view_header_holder_medium, null, false); layouManager.addView(headerPlaceHolder, 0); ... } The LayoutManager seems to be the object handling the disposition of the RecyclerView items. As I couldn't find any addHeaderView(View view) method, I decided to go with the LayoutManager's addView(View view, int position) method and to add my header view in the first position to act as a header. Aaand this is where things get uglier: java.lang.NullPointerException: Attempt to read from field 'android.support.v7.widget.RecyclerView$ViewHolder android.support.v7.widget.RecyclerView$LayoutParams.mViewHolder' on a null object reference at android.support.v7.widget.RecyclerView.getChildViewHolderInt(RecyclerView.java:2497) at android.support.v7.widget.RecyclerView$LayoutManager.addViewInt(RecyclerView.java:4807) at android.support.v7.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:4803) at com.mathieumaree.showz.fragments.CategoryFragment.setRecyclerView(CategoryFragment.java:231) at com.mathieumaree.showz.fragments.CategoryFragment.access$200(CategoryFragment.java:47) at com.mathieumaree.showz.fragments.CategoryFragment$2.success(CategoryFragment.java:201) at com.mathieumaree.showz.fragments.CategoryFragment$2.success(CategoryFragment.java:196) at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:41) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflec…
has comment: http://stackoverflow.com/comment/61980225
tagged with: android
tagged with: android-recyclerview
linked to: http://stackoverflow.com/q/26530685
has comment: http://stackoverflow.com/comment/41857486
type: AnsweredQuestion
has title: Android 5.0 - Add header/footer to a RecyclerView
tagged with: java
type: Question
tagged with: android-5.0-lollipop
accepted answer: http://stackoverflow.com/a/31154402
has answer: http://stackoverflow.com/a/31608939
has answer: http://stackoverflow.com/a/63315488
has answer: http://stackoverflow.com/a/36288606
answer count: 14
possible better answer: http://stackoverflow.com/a/38226230
score: 142
has answer: http://stackoverflow.com/a/27196065
has answer: http://stackoverflow.com/a/38226230
has comment: http://stackoverflow.com/comment/122166230
has answer: http://stackoverflow.com/a/35482745
downvote count: 0

http://stackoverflow.com/q/26507212
has answer: http://stackoverflow.com/a/26507273
score: 0
tagged with: java
has title: Generic type as a parameter of an abstract method?
has comment: http://stackoverflow.com/comment/41645353
answer count: 4
accepted answer: http://stackoverflow.com/a/26507271
has answer: http://stackoverflow.com/a/26507272
has answer: http://stackoverflow.com/a/26507264
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41645620
linked to: http://stackoverflow.com/q/24574478
tagged with: generics
possible better answer: http://stackoverflow.com/a/26507264
has comment: http://stackoverflow.com/comment/41645257
type: Question
has body: I'll try to ask this question as generic (no pun intended) as possible. Let's say I have an object "garage" that works as a container for cars. It looks something like this: public abstract class Garage { public abstract List&lt;? extends Car&gt; getCars(); public abstract void addCarToGarage(Car car); } Because I am very rich, I will have different type of garages, some only contains my sport cars, another only my SUVs and so on. So one of my garages will look like this: public class SportCarGarage extends Garage { @Override public List&lt;SportCar&gt; getCars() { // code to return the cards } @Override public void addCarToGarage(Car car){ // code to add car to garage } } Now you may already see my problem. I can implement getCars() so that it will return a list of SportCar. But I would need to check every single car for its type if I call addCarToGarage and I won't get an syntax error if someone tries to add a SUV in my SportCarGarage. I would want something like this: public abstract class Garage { public abstract List&lt;? extends Car&gt; getCars(); public abstract void addCarToGarage(? extends Car car); } But that will just give me a syntax error. I guess there is an easy solution for that and I just don't know what to search for. Hope you can help.
has answer: http://stackoverflow.com/a/26507271

http://stackoverflow.com/a/26384699
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26384634
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26384634
downvote count: 0
score: 4
has body: Set the parameters parameter as final: public void FbShare(final JSONObject parameters) { //... } For an overview of what's happening, see: Why Java inner classes require "final" outer instance variables? Cannot refer to a non-final variable inside an inner class defined in a different method

http://stackoverflow.com/q/26445795
has comment: http://stackoverflow.com/comment/41534323
has comment: http://stackoverflow.com/comment/41534210
has body: I have a textview timer, i want it stops after 10 seconds of showing on display and after 10 seconds that my current activity jumps to an other activity Runnable runnable = new Runnable() { @Override public void run() { while(Running) { try{ Thread.sleep(1000); }catch(InterruptedException e) { e.printStackTrace(); } handler.post(new Runnable() { @Override public void run() { number+=1; tvTimer.setText(String.valueOf(number)); //With setting value of number on textfield ITS POSSIBLE TO SEE THE TIMER if(number==10) { Running = false; handler.removeCallbacks(this);//that does not works for me to stop Intent i = new Intent(getApplicationContext(), SonucMenu.class); startActivity(i); //Starting my second class } } }); } } My Second activity starts but the layout from second activity comes more than one time, what i want is that it comes only one time, and i think this problem depends on that i cant stop runnable Here My Complete original Code MainActivity.class package com.marburg.leftright; import java.util.Random; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import com.marburg.leftright.R; import android.support.v7.app.ActionBarActivity; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Handler; 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 { static Random rnd=new Random(); static int rndN = rnd.nextInt(2); TextView inf,tvSc, tvTimer; Button btnL, btnR; int ScoreRhtg = 0; int ScoreFls = 0; String right = "RIGHT"; String left = "LEFT"; private int number; private Handler handler; private boolean Running = true; MediaPlayer mySound; public void sendData() { String rData = Integer.toString(ScoreRhtg); //Score Of Right Answer Data setting Stri…
has answer: http://stackoverflow.com/a/26447720
tagged with: java
upvote count: 1
has title: How do i exit runnable and switch another activity
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/9458097
score: 1
linked to: http://stackoverflow.com/q/16188398
favorite count: 0
has answer: http://stackoverflow.com/a/26450353
type: Question
answer count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/26447720
accepted answer: http://stackoverflow.com/a/26450353

http://stackoverflow.com/q/26494703
type: UnansweredQuestion
score: 2
has title: Installing JMagick on Mac to work with Eclipse
answer count: 0
has body: I have tried many different ways of installing Imagemagick (by which I understand I should get jmagick) -- brew, binary files, this installer: http://cactuslab.com/imagemagick/ and so on. I then try to do as it says here: http://www.rori.me/tech/installing-imagemagick-jmagick-with-eclipse-ubuntu/ , but cannot find a libJMagick.so file--I only have a magick.so file. I tried pointing eclipse to that, but I continue to get the Exception in thread "main" java.lang.UnsatisfiedLinkError: no JMagick in java.library.path error when trying to run a small sample program. Can anyone please help me?
tagged with: java
tagged with: eclipse
type: Question
tagged with: jmagick
upvote count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26477703
tagged with: java
type: Question
has title: Read file from WEB-INF from any class
has answer: http://stackoverflow.com/a/26478107
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: web-inf
has body: How can I read a zip file from WEBINF/ folder from a java class in a jar file in WEB-INF\eclipse\plugins folder? classLoader.getResource(fileName) works only if the file is inside the jar file in the WEB-INF\eclipse\plugins folder. I'd like to read it directly from application WEB-INF folder. Thanks in advance.

http://stackoverflow.com/a/26454633
upvote count: 1
has body: You can use regex for readability and to avoid loop: String value = txtPantalla.getText(); if(Pattern.matches(".*[^0-9].*", value)) { // there are some invalid characters! JOptionPane.showMessageDialog(null, "Only works with numbers"); } Any solution that requires you to hardcode something is probably wrong.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26454532
score: 1
accepted answer of: http://stackoverflow.com/q/26454532

http://stackoverflow.com/comment/41452722
score: 0
comment on: http://stackoverflow.com/q/26398371
type: Comment
type: QuestionComment
has text: The task would be clearer if you shared sample PDFs.

http://stackoverflow.com/q/26456340
has comment: http://stackoverflow.com/comment/41553282
has body: I have a for loop looping through each element in an arrayList performing someMethod() on them, depending on the result of that method I either want to keep or remove that element from the list. for example: int returnResult; for (int i=0;i&lt;4;i++){ returnResult = someMethod(arrayList.get(i)); if (returnResult == -1){ arrayList.remove(i); } } My question is; if i have say 5 elements in the list and on the second iteration through the loop (so when i=1), I remove that element, when I go through the 3rd iteration will arrayList.get(2) be referencing what was actually the 4th element? i.e. does it immediately reduce the stack size?
type: Question
has answer: http://stackoverflow.com/a/26456412
possible better answer: http://stackoverflow.com/a/26456412
tagged with: arraylist
has answer: http://stackoverflow.com/a/26456397
score: 0
answer count: 2
tagged with: generics
has comment: http://stackoverflow.com/comment/41553252
accepted answer: http://stackoverflow.com/a/26456397
has title: java - referencing elements in an arraylist whilst removing some
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41553294
tagged with: stack
tagged with: java

http://stackoverflow.com/q/26409731
type: UnansweredQuestion
has title: Mockito throwing WrongTypeOfReturnValue
has answer: http://stackoverflow.com/a/26411579
type: Question
tagged with: java
score: 4
upvote count: 4
has body: Logic in implementation class is as shown below, I tried to write a mock and get exception as WrongTypeOfReturnValue /** * update audit and courier log when Provider sign the document. * @param cmsCourierInfo * @param documentInfo * @throws Exception */ public boolean doAuditProviderESignCompletion(CMSCourierInfo cmsCourierInfo, DocumentInfo documentInfo) throws Exception { String signerTitle = ""; List&lt;ParticipantInfo&gt; participantInfos = documentInfo.getParticipants().getParticipantInfo(); //First participant is Provider ParticipantInfo participantInfo = participantInfos.get(0); if(StringUtils.isNotEmpty(participantInfo.getTitle())){ signerTitle = participantInfo.getTitle(); } //update audit log with provider signed information CMSCourierContractManager.signContract(cmsCourierInfo.getGuidString(), participantInfo.getName(), signerTitle, null); //update audit log when document sent to Internal Signer return doAuditSentForInternalSigner(cmsCourierInfo.getDocumentKey(), documentInfo); } Test @Test public void testUpdateContractStatus() throws Exception{ String documentKey = "TestKey"; cmsCourierInfo = mock(CMSCourierInfo.class); when(cmsFactoryManager.findCourier(anyString())).thenReturn(cmsCourierInfo); EchoSignDocumentServiceImpl echoSignDocumentService = spy(documentService); when(echoSignDocumentService.updateContractStatus(anyString())).thenReturn(true); doThrow(new RuntimeException()).when(echoSignDocumentService).updateContractStatus(anyString()); boolean status = echoSignDocumentService.updateContractStatus(documentKey); Assert.assertEquals(true, status); } Error that I get is org.mockito.exceptions.misusing.WrongTypeOfReturnValue: Boolean cannot be returned by findCourier() findCourier() should return CMSCourierInfo *** If you're unsure why you're getting above error read on. Due to the nature of the syntax above problem might occur because: 1. This exception *might* occur in wrongly written multi-threaded tests. Please refer to Mockito FAQ on limitatio…
answer count: 3
tagged with: mockito
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/50375268
has answer: http://stackoverflow.com/a/49946607

http://stackoverflow.com/comment/41632967
type: Comment
type: QuestionComment
has text: I wonder if you might show your Fraction object code and then we might actually be able to verify that @DavidWallace gave you the right answer?
comment on: http://stackoverflow.com/q/26500343
score: 0

http://stackoverflow.com/q/26501414
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26501425
has answer: http://stackoverflow.com/a/26501461
tagged with: arraylist
has answer: http://stackoverflow.com/a/26501421
has body: I'm practicing my java and have run into some problems. I want to learn to remove elements from an Arraylist, so I'm removing the odds. public static void arrayLists(){ List&lt;Integer&gt; xlist = new ArrayList&lt;Integer&gt;(); for (int x = 0; x &lt; 10; x ++){ xlist.add(x); } for (Iterator&lt;Integer&gt; pointer = xlist.iterator(); pointer.hasNext();){ if (pointer % 2 == 1){ pointer.remove(); } } } Why doesn't this compile? 'bad operand types for binary operator %' I think the issue has to do with the elements of the list are Integers while I'm comparing them to int (s). Any ideas how to solve this?
answer count: 4
favorite count: 0
has title: bad operand types for binary operator %
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41634786
downvote count: 1
has comment: http://stackoverflow.com/comment/41634741
has answer: http://stackoverflow.com/a/26501440
tagged with: java
score: -1

http://stackoverflow.com/comment/41434640
score: 0
comment on: http://stackoverflow.com/a/26390591
type: Comment
has text: Yes it did fix it :D thank you so much. I think I know what to do now with the rest of the coding :) Thanks a ton
type: AnswerComment

http://stackoverflow.com/q/26499063
accepted answer: http://stackoverflow.com/a/26499292
tagged with: quit
has answer: http://stackoverflow.com/a/26499176
has comment: http://stackoverflow.com/comment/41630728
has comment: http://stackoverflow.com/comment/41630829
has comment: http://stackoverflow.com/comment/41630679
tagged with: calculator
has comment: http://stackoverflow.com/comment/41631133
favorite count: 0
has comment: http://stackoverflow.com/comment/41630929
has body: So I have been working on this simple calculator in Java for a while now, and I want the program to end when a user types "quit" in the scanner. I tried to implement this feature as an 'If' statement near the end of my main class in the following line: if (input.equals("quit")) { System.out.println("Thanks for using my program."); System.exit(0); } My IDE doesn't recognize any errors, but when I compile and run my program, and attempt to exit the program by typing 'quit' into the scanner, the program ends (with errors) without displaying my exit message. My code is as follows: package calculator; import java.util.Scanner; public class Calculator { public static void main(String[] args) { System.out.println("Hello, welcome to my calculator"); System.out.println("Enter in some stuff you want to me to calculate"); Scanner scan = new Scanner(System.in); System.out.println("If you need help please type \"help\""); System.out.println("If at anytime you want to leave, type \"quit\""); System.out.println("If you want to continue, hit enter."); String s1 = scan.nextLine(); if (s1.equals("help")){ System.out.println(" "); System.out.println("Double operand commands:"); System.out.println("Addition: '+' (Ex: 'a + b' )"); System.out.println("Subtraction: '-' (Ex: 'a - b' )"); System.out.println("Multiplication: '*' (Ex: 'a * b' ) "); System.out.println("Division: '/' (Ex: 'a / b' )"); System.out.println("Exponents: '^' (Ex: 'a ^ b' )"); System.out.println(" "); } Scanner input = new Scanner(System.in); Maths maths = new Maths(); double answer = 0; double numA, numB; char operator; boolean quit = false; while (quit == false) { System.out.print("Please enter your equation: "); numA = input.nextDouble(); operator = input.next().charAt(0); numB = input.nextDouble(); if (operator == '+') { answer = maths.add(numA, numB); } if (operator == '-') { answer = maths.subtract(numA, numB); } if (operator == '*') { answer = maths.multiply(numA, numB); } if (operator == '/') { answer = maths.…
answer count: 5
has answer: http://stackoverflow.com/a/26499292
has comment: http://stackoverflow.com/comment/41630963
has answer: http://stackoverflow.com/a/26499151
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/41630701
score: 1
tagged with: loops
possible better answer: http://stackoverflow.com/a/26499105
has comment: http://stackoverflow.com/comment/41630807
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26499150
has answer: http://stackoverflow.com/a/26499105
has title: How do I fix my Java code so that it ends when a user types "quit"?
tagged with: java
has comment: http://stackoverflow.com/comment/41630706
has comment: http://stackoverflow.com/comment/41630669

http://stackoverflow.com/comment/41599318
has text: What exactly is the problem now? Did fixing your mistake solve the problem?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26461404
type: QuestionComment

http://stackoverflow.com/comment/41585668
comment on: http://stackoverflow.com/q/26474097
score: 0
type: Comment
has text: How about http://www.mkyong.com/spring/spring-named-parameters-examples-in-simplejdbctemplate/
type: QuestionComment

http://stackoverflow.com/a/26482421
has comment: http://stackoverflow.com/comment/41600677
has comment: http://stackoverflow.com/comment/41601487
has comment: http://stackoverflow.com/comment/41600971
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41600345
type: Answer
accepted answer of: http://stackoverflow.com/q/26482205
has body: No. Overriden methods cannot be resolved at compile time. They are resolved during Runtime based on type of object. InvokeVirtual is the Byte-code way of telling you that a method has been called.
answers question: http://stackoverflow.com/q/26482205
upvote count: 1

http://stackoverflow.com/a/26496913
type: AcceptedAnswer
has body: You can perform this by using ProcessBuilder. ProcessBuilder processBuilder = new ProcessBuilder(); p.command("cmd_to_run", "args_if_any"); p.start();
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26496791
answers question: http://stackoverflow.com/q/26496791

http://stackoverflow.com/q/26456518
has body: I have defaultTableModel object stored inside a serializable ProductObj class. public class ProductObj implements Serializable{ private static final long serialVersionUID = 79839857245324985L; private Integer taskID; private List&lt;String&gt; data; private JFreeChart climateChartPanel; private JFreeChart productivityChartPanel; private JFreeChart developmentChartPanel; private DefaultTableModel developmentTable; private DefaultTableModel productivityTable; In all cases I can visualize developmentTable Jtable normally. But for productivityTable, When I did not comment the commented line, I get a null exception when trying to visualize the jTable. In some way, serialization appears to interfere with the object. This productivityTable is generated by 'n' threads, in those threads it is a volatile static object, but in the end it is stored in a future that is stored in a List. private void serialize(String path) throws Exception { List&lt;ProductObj&gt; products = new ArrayList&lt;&gt;(controller.getFutures().size()); for(Future&lt;ProductObj&gt; f : controller.getFutures()) products.add(f.get()); try (FileOutputStream fileOut = new FileOutputStream(Util.PathNameThisOS(path+"/"+"SimulationObjects.srz")); ObjectOutputStream out = new ObjectOutputStream(fileOut)) { //out.writeObject(products); } products = unserialize(path); } here is the exception: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.plaf.synth.SynthLookAndFeel.paintRegion(SynthLookAndFeel.java:371) at javax.swing.plaf.synth.SynthLookAndFeel.update(SynthLookAndFeel.java:335) at javax.swing.plaf.synth.SynthViewportUI.update(SynthViewportUI.java:168) at javax.swing.JComponent.paintComponent(JComponent.java:778) at javax.swing.JComponent.paint(JComponent.java:1054) at javax.swing.JViewport.paint(JViewport.java:731) at javax.swing.JComponent.paintChildren(JComponent.java:887) at javax.swing.JComponent.paint(JComponent.java:1063) at javax.swing.JComponent.paintChildren(JCompon…
score: 0
has comment: http://stackoverflow.com/comment/41553689
has comment: http://stackoverflow.com/comment/41553569
has comment: http://stackoverflow.com/comment/41555866
tagged with: serialization
has comment: http://stackoverflow.com/comment/41553665
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41553696
has comment: http://stackoverflow.com/comment/41553682
tagged with: future
has comment: http://stackoverflow.com/comment/41554284
answer count: 0
tagged with: java
has title: Does java serialization in some way change object?
tagged with: swing
type: Question
tagged with: defaulttablemodel
has comment: http://stackoverflow.com/comment/41553782

http://stackoverflow.com/a/26443603
answers question: http://stackoverflow.com/q/26443527
downvote count: 0
has body: It's the ternary operator. Because the first option trueValue.equalsIgnoreCase(fieldValue) is a boolean, it seems to assume the second option defaultValue is a boolean rather than a nullable Boolean. It's odd, but that seems to be what's happening. If you cast the first option to Boolean, the error goes away: Boolean value = (fieldValue != null ? (Boolean) trueValue.equalsIgnoreCase(fieldValue) : defaultValue);
type: Answer
score: 9
upvote count: 9

http://stackoverflow.com/q/26508925
answer count: 1
tagged with: httpclient
accepted answer: http://stackoverflow.com/a/26509305
tagged with: ajax
score: 0
tagged with: apache-commons-httpclient
has body: I'm using following code to get pagecontent. But unfortunately i'm not able to get data which is within the table. HttpGet httget = new HttpGet("http://pstweb.cloudapp.net/raselect/?tid=188J"); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httget); HttpEntity entity = response.getEntity(); String thirdPartyPageContent=EntityUtils.toString(entity); But if you enter the url directly in browser I get all the data in table. My understanding is to make ajax call it takes some time. But our httpclient is not waiting for the same. please help me in getting the table page content. Thanks
linked to: http://stackoverflow.com/q/7260282
has answer: http://stackoverflow.com/a/26509305
type: AnsweredQuestion
tagged with: java
has title: Need to get table data using httpclient
type: Question

http://stackoverflow.com/comment/41605033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26484503
type: Comment
has text: please post your manifest.xml, is the error still the same or its different, try cleaning your project and launch the app

http://stackoverflow.com/a/26427426
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26426842
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26426842
has body: The function would be used in conjunction with a driver loop that doubles the number of subintervals at each iteration, refining the estimated integral until the difference from one iteration to the next is less than some threshold criterion. It is desirable in such an endeavor to avoid repeating computations that have already been performed, and that's the point of the lines you asked about. Consider the function values that are needed when applying the trapezoid rule on a given number of subintervals. Now consider the function values needed for splitting each subinterval in half and applying the trapezoid rule to those subintervals. Half (give or take 1) of the function values needed in the latter case are the same ones needed in the former. The code presented simply reuses the previously computed values (0.5 * bef), adding to them only the new values (i = i + 2). It must scale down the previous estimate by a factor of two to account for splitting the subintervals in two. Note that for the code to be right, it appears that argument n must represent the number of subintervals of the integration region, not the number of dividing points as its documentation claims.

http://stackoverflow.com/comment/41513617
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26434419
has text: IndexOutOfBounds means you are trying to index into the array but this is outside the bounds of the array

http://stackoverflow.com/a/26461008
has comment: http://stackoverflow.com/comment/41565787
has comment: http://stackoverflow.com/comment/41563224
has comment: http://stackoverflow.com/comment/41567495
has comment: http://stackoverflow.com/comment/41569046
has comment: http://stackoverflow.com/comment/41563137
upvote count: 5
has body: In your login activity write this code: this will switch from LoginActivity to MainActivity startActivity(new Intent(LoginActivity.this, MainActivity.class)); finish();
has comment: http://stackoverflow.com/comment/41567105
has comment: http://stackoverflow.com/comment/41599119
score: 5
has comment: http://stackoverflow.com/comment/41600340
downvote count: 0
has comment: http://stackoverflow.com/comment/41563492
has comment: http://stackoverflow.com/comment/41564575
answers question: http://stackoverflow.com/q/26460924
has comment: http://stackoverflow.com/comment/41565686
type: Answer
has comment: http://stackoverflow.com/comment/41563391
has comment: http://stackoverflow.com/comment/41565404

http://stackoverflow.com/comment/41395855
type: QuestionComment
comment on: http://stackoverflow.com/q/26369301
has text: Because `byte` is an 8-bit signed value, and has a range of -128 to 127. Look at the bit pattern for 135 (hint: Windows Calculator will convert between decimal, octal, binary and hex) and figure out what it would mean as an 8-bit signed value.
score: 0
type: Comment

http://stackoverflow.com/comment/41656591
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26513330
has text: Does the `doctor_id` value exist in the table? You can assign the return value of `executeUpdate` to an integer to see how many rows were affected.
score: 0

http://stackoverflow.com/a/26438057
has body: boardGame[i][j] returns the char stored at index j in dimension í, and since you have filled the entire array with asterisks, that is what is printed. If you want to print the numbers, then replace boardGame[i][j] with j I suggest you read this documentation for details on how arrays work.
accepted answer of: http://stackoverflow.com/q/26437975
answers question: http://stackoverflow.com/q/26437975
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41446335
comment on: http://stackoverflow.com/q/26397604
has text: Balanced `<>` for generics are not regular.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41486422
type: QuestionComment
has text: Check out Ant, Gradle or Maven
comment on: http://stackoverflow.com/q/26420084
type: Comment
score: 1

http://stackoverflow.com/comment/41665073
has text: Oryx is just a Java binary. It doesn't install anywhere. You just run it. It can be on any machine that has Hadoop config that points to the cluster's resources. It doesn't even need to be part of the cluster. The error just says "something failed" and isn't the underlying cause.
type: Comment
comment on: http://stackoverflow.com/a/26431414
score: 0
type: AnswerComment

http://stackoverflow.com/q/26393422
type: Question
tagged with: code-formatting
upvote count: 3
tagged with: java
answer count: 2
tagged with: javadoc
has answer: http://stackoverflow.com/a/32370399
tagged with: eclipse
has title: Eclipse Javadoc formatting: how to allow/disallow single-line Javadoc comments?
has answer: http://stackoverflow.com/a/26395297
has body: So, random question: I've got a codebase where lots of enums, etc have comments that look like this: public enum SomeEnum { /** value1 */ VALUE1, /** value2 */ VALUE2; } Is there a way to compel the Eclipse formatter to break up the Javadocs into a "standard" multi-line format, like the below? My current settings have no effect on the above snippet. public enum SomeEnum { /** * value1 */ VALUE1, /** * value2 */ VALUE2; } The current behavior doesn't do this - running Eclipse 4.4.0, with the following checked in Javadoc comment settings: (X) Format HTML tags (X) Format Java code snippets inside 'pre' tags (X) Blank line before Javadoc tags (X) Indent Javadoc tags ( ) Indent description after @param ( ) New line after @param tags (X) /** and */ on separate lines ( ) Remove blank lines Thanks!
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41442356
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/41467391
has text: possible duplicate of [Format date in java](http://stackoverflow.com/questions/4772425/format-date-in-java)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26409483

http://stackoverflow.com/a/26446178
has comment: http://stackoverflow.com/comment/41541158
has comment: http://stackoverflow.com/comment/41541178
downvote count: 1
has comment: http://stackoverflow.com/comment/41534879
answers question: http://stackoverflow.com/q/26446147
has comment: http://stackoverflow.com/comment/41538604
has comment: http://stackoverflow.com/comment/41538404
has comment: http://stackoverflow.com/comment/41534884
type: Answer
upvote count: 6
has body: Using the Scanner.nextInt() method would do the trick: Input: 56 83 12 99 Code: import java.util.Scanner; class Example { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] numbers = new int[4]; for(int i = 0; i &lt; 4; ++i) { numbers[i] = sc.nextInt(); } } } At @user1803551's request on how Scanner.hasNext() can achieve this: import java.util.*; class Example2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); while (sc.hasNextInt()) { // this loop breaks there is no more int input. numbers.add(sc.nextInt()); } } }
score: 5

http://stackoverflow.com/comment/41448558
score: 1
has text: possible duplicate of [How to force the static block running in each test method?](http://stackoverflow.com/questions/5784277/how-to-force-the-static-block-running-in-each-test-method)
comment on: http://stackoverflow.com/q/26398935
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41625903
score: 0
comment on: http://stackoverflow.com/a/26435323
type: AnswerComment
has text: Thank you so much! It helped, I followed along with how you did this and I was able to save the new columns!
type: Comment

http://stackoverflow.com/q/26422364
answer count: 1
has answer: http://stackoverflow.com/a/26431437
tagged with: java
has title: Using future.onComplete with Java and Akka and a different Result as String
accepted answer: http://stackoverflow.com/a/26431437
score: 2
type: AnsweredQuestion
tagged with: akka
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
tagged with: future
has body: I have the following question... I'm using Akka 2.3.6 from Java and would like to get the following done: Future&lt;Object&gt; future = ask(actor, new GetPOIDataMessage(tenant), Timeout.durationToTimeout(duration)); future.onSuccess(new OnComplete&lt;NonSimpleObject&gt;() { public void onComplete(Throwable failure, final NonSimpleObject data) { if (failure != null) { deferredResult.setErrorResult("An error occured during the request"); } else { deferredResult.setResult(data); } } }, ec); NonSimpleObject is the type of the message sent back from the actor. I get the following error compiling my code: error: method onSuccess in interface Future&lt;T&gt; cannot be applied to given types; [error] future.onSuccess(new OnComplete&lt;NonSimpleObject&gt;() { [error] ^ [error] required: PartialFunction&lt;Object,U&gt;,ExecutionContext [error] found: &lt;anonymous OnComplete&lt; NonSimpleObject &gt;&gt;,ExecutionContext [error] reason: cannot infer type-variable(s) U [error] (argument mismatch; &lt;anonymous OnComplete&lt; NonSimpleObject &gt;&gt; cannot be converted to PartialFunction&lt;Object,U&gt;) [error] where U,T are type-variables: [error] U extends Object declared in method &lt;U&gt;onSuccess(PartialFunction&lt;T,U&gt;,ExecutionContext) [error] T extends Object declared in interface Future` which I fail to decode. Seems to be over my head right now. It works fine with a String as the result. I could not find other examples on the web that are using something different as a String. Thanks for any pointers in the right direction. Jan

http://stackoverflow.com/a/26433142
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41581145
downvote count: 0
has body: You can not upload your Java app by clicking "Deploy to App Engine" GUI button from Google Plugin for Eclipse, but instead, you can upload with Appscale command line client. (as of 2014-10-21) You can follow the instructions that GAE provides for writing an application in Eclipse. The code layout discussed there is fully compatible with AppScale. Make sure to use the correct version of the SDK described in AppScale's FAQ. After that deploying your app on AppScale is as easy as typing appscale deploy Guestbook from the command line.
type: Answer
has comment: http://stackoverflow.com/comment/41616982
accepted answer of: http://stackoverflow.com/q/26430242
answers question: http://stackoverflow.com/q/26430242
score: 3
upvote count: 3

http://stackoverflow.com/a/26444512
score: 1
answers question: http://stackoverflow.com/q/26444423
upvote count: 1
has body: You have to change the value of the variable loop inside oft the while loop to false. I guess this should be in the case when the user types done. So in this case add the following line: loop = false; anywhere in the case "done": block
downvote count: 0
type: Answer

http://stackoverflow.com/q/26412019
answer count: 1
has answer: http://stackoverflow.com/a/26442483
tagged with: distortion
type: UnansweredQuestion
tagged with: java
tagged with: slick2d
tagged with: lwjgl
type: Question
tagged with: rotation
has body: I'm trying to rotate a rectangular Slick2d image with pixel size 666 x 333 using LWJGL. I was able to rotate a square image with pixel size 666 x 666 around its center, but the rectangular image does distort during the rotation and this is my problem. Here is the image I use for testing purposes: https://i.sstatic.net/0bjr5.jpg The left window shows the image before the rotation, the right window shows the image how it looks when I rotate it 90 degrees, it's distorted: https://i.sstatic.net/FGcNB.jpg Here is my source code snippet for the rotation: float x = 0.335f; float y = 0.335f; glMatrixMode(GL_TEXTURE); glLoadIdentity(); glTranslatef(x, y, 0f); glRotatef(angle, 0f, 0f, 1f); glTranslatef(-x, -y, 0f); glMatrixMode(GL_MODELVIEW); You may wonder why I don't use the function “setRotation” or “rotate” of a Slick2d Image. The reason I don't use this does not matter here, but I simply can't use it in my real project and furthermore I want to do it with gl. It's the first time ever I touch LWJGL and Slick2d and I need it only for a small part of my project. If you know how to rotate the image like above without the distortion, please help me. Thank you.
has title: Rotation of rectangular Slick2d image with LWJGL causing distortion
score: 0

http://stackoverflow.com/q/26440729
upvote count: 4
has title: Login using Google+ on Parse
downvote count: 0
tagged with: java
type: Question
tagged with: android-layout
score: 4
has answer: http://stackoverflow.com/a/31426460
answer count: 1
has body: I know this question has already been asked, but I couldn't find any solution. I am using Parse, where are users are able to login using Facebook, Twitter, and Google+. As of now, only Facebook and Twitter is fully functional. I have managed to login using Facebook and Twitter in the following way: private void onLoginButtonClicked() { LoginActivity.this.progressDialog = ProgressDialog.show( LoginActivity.this, "", "Logging in...", true); List&lt;String&gt; permissions = Arrays.asList("public_profile", "user_about_me", "user_relationships", "user_birthday", "user_location"); ParseFacebookUtils.logIn(permissions, this, new LogInCallback() { @Override public void done(ParseUser user, ParseException err) { LoginActivity.this.progressDialog.dismiss(); if (user == null) { Log.d(IntegratingFacebookTutorialApplication.TAG, "Uh oh. The user cancelled the Facebook login."); } else if (user.isNew()) { Log.d(IntegratingFacebookTutorialApplication.TAG, "User signed up and logged in through Facebook!"); showUserDetailsActivity(); } else { Log.d(IntegratingFacebookTutorialApplication.TAG, "User logged in through Facebook!"); moodpage(); } } }); } private void onTwitterButtonClicked() { ParseTwitterUtils.logIn(this, new LogInCallback() { @Override public void done(ParseUser user, ParseException err) { if (user == null) { Log.d("MyApp", "Uh oh. The user cancelled the Twitter login."); } else if (user.isNew()) { Log.d("MyApp", "User signed up and logged in through Twitter!"); showUserDetailsActivity(); } else { Log.d("MyApp", "User logged in through Twitter!"); moodpage(); } } }); } I am trying to figure out to achieve this with Google+ through parse. Someone has suggested for me to look into Parse Rest API, however, I am not familiar with it, and need more guidance. Some people have suggested me to use https://github.com/Glamdring/google-plus-java-api/ and looks promissing, but I am not sure how I would work that out. for example lets say I have googleButton = (Button) findViewById…
tagged with: android-activity
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26391151
tagged with: prepared-statement
type: Question
score: 0
has body: I use sqlite 3.7 and have a schema that looks like: CREATE TABLE IF NOT EXISTS subjects ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT ); CREATE TABLE IF NOT EXISTS predicates ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, predicate TEXT NOT NULL UNIQUE ); CREATE TABLE IF NOT EXISTS objects ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, object BLOB NULL UNIQUE ); CREATE TABLE IF NOT EXISTS statements ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, subject INTEGER NOT NULL REFERENCES subjects(id) ON DELETE RESTRICT, predicate INTEGER NOT NULL REFERENCES predicates(id) ON DELETE RESTRICT, object INTEGER NULL REFERENCES objects(id) ON DELETE RESTRICT ); To insert a row into statements I first INSERT OR IGNORE the predicate and the object, then I retrieve the ids: INSERT OR IGNORE INTO predicates(predicate) VALUES (?) SELECT predicates.id FROM predicates WHERE predicates.predicate = ? To finally execute INSERT INTO statements(subject, predicate, object) VALUES (?, ?, ?) I my question is: Is there a way to directly do these (prepared) statements in one go? INSERT OR IGNORE INTO predicates(predicate) VALUES (?); SELECT predicates.id FROM predicates WHERE predicates.predicate = ?; INSERT OR IGNORE INTO objects(object) VALUES (?); SELECT predicates.id FROM objects WHERE objects.object = ?; INSERT INTO statements(subject, predicate, object) VALUES (?, ?, ?);
has answer: http://stackoverflow.com/a/26391626
tagged with: sql
tagged with: sqlite
answer count: 1
tagged with: insert
accepted answer: http://stackoverflow.com/a/26391626
has title: Use ID inserted with `INSERT OR IGNORE` in next `INSERT` statement
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41553136
comment on: http://stackoverflow.com/a/26452956
score: 0
type: Comment
has text: TNT thanks alot man, you have been helping me alot today. Thanks man :)
type: AnswerComment

http://stackoverflow.com/a/27966459
upvote count: 2
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/61171830
answers question: http://stackoverflow.com/q/26460141
has comment: http://stackoverflow.com/comment/68171662
has body: Since version 3.12 of POI, it's working like a charm (also with own column labels): //insert column pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 2, "Central"); pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 3, "East"); pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 4, "West"); pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 5, "Grand Total");
type: Answer

http://stackoverflow.com/comment/41424172
comment on: http://stackoverflow.com/a/26384923
type: AnswerComment
score: 0
type: Comment
has text: And instead of throwing an exception it silently logs it - how mean! Is there any way to work around that, or do we have to wait for the bug fix?

http://stackoverflow.com/q/26410934
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26413210
type: UnansweredQuestion
has title: org.openqa.selenium.InvalidSelectorException
downvote count: 2
tagged with: selenium
upvote count: 1
has comment: http://stackoverflow.com/comment/41472713
type: Question
tagged with: java
score: -1
has body: I am trying to run a program. Without testng it works fine. But when I ran using TestNG it works smoothly all the login scenarios but when it comes to logout XPath it says FAILED: Testloginpager org.openqa.selenium.InvalidSelectorException: The xpath expression '//a[contains(text(),'Log out')]' cannot be evaluated or does notresult in a WebElement (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 5.19 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html But I tried the same XPath in Mozilla and found that it is the right path for that logout web element.

http://stackoverflow.com/comment/41656099
score: 0
has text: @DaveNewton-Yeah,now I agree. Issue is same,but,one couldn't decide unless more information is provided in the question!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26512892

http://stackoverflow.com/q/26459652
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41561935
tagged with: selenium
upvote count: 1
accepted answer: http://stackoverflow.com/a/26462307
type: Question
has comment: http://stackoverflow.com/comment/41562695
tagged with: debugging
tagged with: testing
has title: Why my Selenium test code run successfully in single-step but failed when using Run?
has body: I have some Selenium code which do some automatic UI tests using Firefox driver. I bind them into a test suite and run them orderly. But it fails on a driver.switchTo().frame() invocation and throws a org.openqa.selenium.NoSuchFrameException: Unable to locate frame, the full error messages are as below: org.openqa.selenium.NoSuchFrameException: Unable to locate frame: OpenNewPKFD Command duration or timeout: 3.07 seconds Build info: version: '2.43.1', revision: '5163bceef1bc36d43f3dc0b83c88998168a363a0', time: '2014-09-10 09:43:55' System info: host: 'H3000-0254', ip: '169.254.169.127', os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_13' Session ID: 4fcea4bb-880c-4725-bdf1-cda4b5a03553 Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=32.0.3, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}] The weird thing is, if I run it in single-step mode, the code line which throws above exception will work just fine. No error occurs. So I suspect there're something related to time or speed, but I don't know what it is at all. So can you give me some advice to deal with this problem? UPDATED below is my pom.xml of the project: 4.0.0 GALSelenium GALSelenium 0.0.1-SNAPSHOT <selenium.version>2.43.1</selenium.version> src src **/*.java log4j log4j 1.2.17 org.seleniumhq.selenium selenium-java ${selenium.version} org.testng testng 6.8.8 org.seleniumhq.selenium selenium-server ${selenium.version} org.seleniumhq.selenium selenium-support ${selenium.version} commons-logging commons-logging 1.2
has comment: http://stackoverflow.com/comment/41563195
tagged with: firefox
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26462307
type: AnsweredQuestion

http://stackoverflow.com/comment/41600846
type: Comment
type: QuestionComment
score: 2
has text: Your attached method "docMethod" does exactly why you want to do I suppose. You just have to call that method with doc, then surg and ped.
comment on: http://stackoverflow.com/q/26482681

http://stackoverflow.com/a/26478404
accepted answer of: http://stackoverflow.com/q/26478328
has comment: http://stackoverflow.com/comment/41724676
answers question: http://stackoverflow.com/q/26478328
score: 1
has comment: http://stackoverflow.com/comment/41695912
upvote count: 1
has comment: http://stackoverflow.com/comment/41739427
has body: Try with this: I have done same things with Checkbox [ custom checkbox ]. @Override public void onClick(View view) { CheckBox cb = (CheckBox) view; if(cb.isChecked()){ LinearLayout llLayout = (LinearLayout) cb.getParent(); for(int i=0; i&lt;((ViewGroup)llLayout).getChildCount(); ++i) { View nextChild = ((ViewGroup)llLayout).getChildAt(i); if(nextChild instanceof CheckBox &amp;&amp; nextChild.getId()==cb.getId() ){ }else if (nextChild instanceof CheckBox &amp;&amp; nextChild.getId()!=cb.getId() ){ CheckBox cb2=(CheckBox) nextChild; cb2.setChecked(false); } } } else{ LinearLayout llLayout = (LinearLayout) cb.getParent(); for(int i=0; i&lt;((ViewGroup)llLayout).getChildCount(); ++i) { View nextChild = ((ViewGroup)llLayout).getChildAt(i); if(nextChild instanceof CheckBox &amp;&amp; nextChild.getId()==cb.getId() ){ CheckBox cb2=(CheckBox) nextChild; cb2.setChecked(false); }else if (nextChild instanceof CheckBox &amp;&amp; nextChild.getId()!=cb.getId() ){ CheckBox cb2=(CheckBox) nextChild; cb2.setChecked(false); } } } } My XML: &lt;LinearLayout android:id="@+id/llShift" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="4" android:gravity="right" android:orientation="horizontal" &gt; &lt;CheckBox android:id="@+id/cbMorning" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@drawable/custom_radio_button_morning" android:paddingBottom="5dp" android:paddingRight="3dp" android:paddingTop="5dp" /&gt; &lt;CheckBox android:id="@+id/cbEvning" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@drawable/custom_radio_button_evening" android:paddingBottom="5dp" android:paddingRight="5dp" android:paddingTop="5dp" /&gt; &lt;/LinearLayout&gt; custom_radio_button_morning.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@drawable/morni…
has comment: http://stackoverflow.com/comment/41738841
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41721698
type: Answer

arraylist
tags question: http://stackoverflow.com/q/26505953
tags question: http://stackoverflow.com/q/26510341
tags question: http://stackoverflow.com/q/26492508
tags question: http://stackoverflow.com/q/26508592
tags question: http://stackoverflow.com/q/26500461
tags question: http://stackoverflow.com/q/26415972
tags question: http://stackoverflow.com/q/26451293
tags question: http://stackoverflow.com/q/26446391
tags question: http://stackoverflow.com/q/26393205
tags question: http://stackoverflow.com/q/26446674
tags question: http://stackoverflow.com/q/26499342
tags question: http://stackoverflow.com/q/26477436
tags question: http://stackoverflow.com/q/26419053
tags question: http://stackoverflow.com/q/26436102
tags question: http://stackoverflow.com/q/26374442
tags question: http://stackoverflow.com/q/26439821
tags question: http://stackoverflow.com/q/26424030
tags question: http://stackoverflow.com/q/26375910
tags question: http://stackoverflow.com/q/26443513
tags question: http://stackoverflow.com/q/26432913
tags question: http://stackoverflow.com/q/26453542
tags question: http://stackoverflow.com/q/26404256
tags question: http://stackoverflow.com/q/26419842
tags question: http://stackoverflow.com/q/26453461
tags question: http://stackoverflow.com/q/26402829
tags question: http://stackoverflow.com/q/26450886
tags question: http://stackoverflow.com/q/26411693
tags question: http://stackoverflow.com/q/26445705
tags question: http://stackoverflow.com/q/26445116
tags question: http://stackoverflow.com/q/26499910
tags question: http://stackoverflow.com/q/26371678
tags question: http://stackoverflow.com/q/26505831
tags question: http://stackoverflow.com/q/26449111
tags question: http://stackoverflow.com/q/26398393
tags question: http://stackoverflow.com/q/26479394
tags question: http://stackoverflow.com/q/26382104
tags question: http://stackoverflow.com/q/26501414
tags question: http://stackoverflow.com/q/26387128
tags question: http://stackoverflow.com/q/26354737
tags question: http://stackoverflow.com/q/26465974
tags question: http://stackoverflow.com/q/26417963
tags question: http://stackoverflow.com/q/26474235
tags question: http://stackoverflow.com/q/26454471
tags question: http://stackoverflow.com/q/26382269
tags question: http://stackoverflow.com/q/26353862
tags question: http://stackoverflow.com/q/26454773
tags question: http://stackoverflow.com/q/26418087
tags question: http://stackoverflow.com/q/26431909
tags question: http://stackoverflow.com/q/26449259
tags question: http://stackoverflow.com/q/26389860
tags question: http://stackoverflow.com/q/26400310
tags question: http://stackoverflow.com/q/26391428
tags question: http://stackoverflow.com/q/26496034
tags question: http://stackoverflow.com/q/26403105
tags question: http://stackoverflow.com/q/26513627
tags question: http://stackoverflow.com/q/26445209
tags question: http://stackoverflow.com/q/26509324
tags question: http://stackoverflow.com/q/26436182
tags question: http://stackoverflow.com/q/26450282
tags question: http://stackoverflow.com/q/26396397
tags question: http://stackoverflow.com/q/26412090
tags question: http://stackoverflow.com/q/26512892
tags question: http://stackoverflow.com/q/26481835
tags question: http://stackoverflow.com/q/26430015
tags question: http://stackoverflow.com/q/26448155
tags question: http://stackoverflow.com/q/26505687
tags question: http://stackoverflow.com/q/26453627
tags question: http://stackoverflow.com/q/26499917
tags question: http://stackoverflow.com/q/26362472
tags question: http://stackoverflow.com/q/26456340
tags question: http://stackoverflow.com/q/26433087
tags question: http://stackoverflow.com/q/26474028
tags question: http://stackoverflow.com/q/26483469
tags question: http://stackoverflow.com/q/26441850
tags question: http://stackoverflow.com/q/26436276
tags question: http://stackoverflow.com/q/26443482
type: Tag
tags question: http://stackoverflow.com/q/26388638
tags question: http://stackoverflow.com/q/26496016
tags question: http://stackoverflow.com/q/26387268

http://stackoverflow.com/comment/41379584
type: QuestionComment
type: Comment
has text: Yepp curl would be a possible solution.
score: 0
comment on: http://stackoverflow.com/q/26360568

http://stackoverflow.com/a/26508344
has comment: http://stackoverflow.com/comment/41647165
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26508058
has body: You stated that you need to read from a file, but none of your code is actually reading from a file. This should be your first step. Try looking at BufferedReader documentation as well as numerous posts on this site regarding proper methods to perform file IO operations. I'm assuming your storing your grades in the 2D gradeTable array like: {Category, grade}. You will need to read each row in your file(BufferedReader has methods for this), parse the string (Look at the String documentation, specifically split or substring/indexOf methods) into category and grade, and then populate your array. Look into using more dynamic data structures, such as ArrayList. This will allow you to expand the size as you add more grades, as well as not having to copy your array into a new array every time the size expands.

http://stackoverflow.com/q/26374984
has comment: http://stackoverflow.com/comment/41406112
has body: While writing loops I often get confused with which one I should choose. For example, int sum; for(int i=0; i&lt;10; i++) { sum=0; ... .... } Or for(int i=0; i&lt;10; i++) { int sum=0; ... .... } Say, the variable is only required in this loop. There is no need of it in the later part of the program. I need the value of the variable sum to be 0 at the beginning of the loop. Which one is the better practice? Re-initializing a variable at the start of the loop or re-declaring it? Which one is more efficient?
possible better answer: http://stackoverflow.com/a/26375371
tagged with: initialization
favorite count: 0
has answer: http://stackoverflow.com/a/26375371
tagged with: declaration
has comment: http://stackoverflow.com/comment/41406097
has comment: http://stackoverflow.com/comment/41406122
has comment: http://stackoverflow.com/comment/41406212
has title: Is it more efficient to declare a variable inside a loop, or just to reassign it?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26375179
tagged with: performance
upvote count: 14
linked to: http://stackoverflow.com/q/8803674
tagged with: java
linked to: http://stackoverflow.com/q/6093537
has comment: http://stackoverflow.com/comment/41406315
downvote count: 5
tagged with: loops
type: Question
score: 9
has answer: http://stackoverflow.com/a/26375043
has comment: http://stackoverflow.com/comment/41406307
has comment: http://stackoverflow.com/comment/41406370
accepted answer: http://stackoverflow.com/a/26375179
has comment: http://stackoverflow.com/comment/41413077
has comment: http://stackoverflow.com/comment/41406095
has comment: http://stackoverflow.com/comment/41406334
has comment: http://stackoverflow.com/comment/41406191
answer count: 3

http://stackoverflow.com/comment/93963810
has text: see also answer by Melody Feng.
comment on: http://stackoverflow.com/a/35830351
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41430026
type: Comment
has text: Thank you for the quick reply. Looks like I could try something like this. I'll give it a try tomorrow and let you know how it worked out.
comment on: http://stackoverflow.com/a/26384480
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41558564
type: QuestionComment
has text: Can you post your JSON too?
score: 1
comment on: http://stackoverflow.com/q/26459450
type: Comment

http://stackoverflow.com/a/26384717
answers question: http://stackoverflow.com/q/26384449
has body: If you're talking about within Amazon's ecosystem, yes. You don't pay for data transferred between EC2 (in the North Virginia region) and S3. See the pricing page: This is mirrored on EC2's pricing page, $0 for data from S3 in the same region. However, note that you will pay $0.005 per 1,000 requests for GET requests with S3.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26384449
score: 1
upvote count: 1

http://stackoverflow.com/q/26436080
has answer: http://stackoverflow.com/a/26436174
type: UnansweredQuestion
type: Question
tagged with: java
has body: I have a webpage which asks for username,password and there is a log in button. Log in button uses jsp function as follows function submitData(){ document.getElementById('txtSN').value=document.getElementById('txtRegNumber').value; document.getElementById('txtPD').value=document.getElementById('txtPwd').value; if(document.getElementById('txtSN').value == '' || document.getElementById('txtSN').length == 0) { alert(' Please Enter Student Register No/Studen ID'); document.getElementById('txtSN').focus(); return false; } if(document.getElementById('txtPD').value == '' || document.getElementById('txtPD').length == 0) { alert(' Please Enter Password'); document.getElementById('txtPD').focus(); return false; } if(document.getElementById('txtverifycode').value == '' || document.getElementById('txtverifycode').length == 0) { alert(' Please Enter Verification Code'); document.getElementById('txtverifycode').focus(); return false; } document.getElementById('txtPA').value=1; document.getElementById('txtRegNumber').value="iamalsouser"; document.getElementById('txtPwd').value="thanksandregards"; document.getElementById('frmStudentMain').action="youLogin.jsp"; document.getElementById('frmStudentMain').submit(); } Can I use the above code in android. That is I will create two EditText for username and password; and I am going to create a function which is going to use above jsp code. What my question is, Is it possible to use jsp code for buttons in android?? Whether I want to convert the jsp code to java?? Actually I am newbie. If my question doesn't sounds good I am sorry about that.
score: 0
answer count: 1
tagged with: jsp
has title: How to implement jsp code in android?
tagged with: android

http://stackoverflow.com/q/26416652
type: AnsweredQuestion
tagged with: command-prompt
possible better answer: http://stackoverflow.com/a/26416694
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26416679
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41480599
has comment: http://stackoverflow.com/comment/41480479
answer count: 2
has body: Created a simple Java program to add 2 whole numbers (which is not complete yet). I want help specifically on my variable "sum". Command prompt dictates it may have not been initialized, I defined sum within the "if statements". How else should I define or what am I doing wrong here? Any help is greatly appreciated! import java.util.Scanner; public class Calculator { public static void main(String[] args){ //Objective: Calculate whole numbers to add, subtract, divide and multiply Scanner kbd1 = new Scanner(System.in); Scanner kbd2 = new Scanner(System.in); int num1, num2, sum; System.out.println("Enter two whole numbers: "); num1 = kbd1.nextInt(); num2 = kbd2.nextInt(); System.out.println("Now what would you like to do with these numbers? (Please input add, subtract, multiply, or divide)"); Scanner oper = new Scanner(System.in); String operation; operation = oper.nextLine(); if (operation == "add" || operation == "Add") { sum = num1 + num2; } else if (operation == "subtract" || operation == "Subtract") { if (num1 &gt; num2) { sum = num1 - num2; } else { sum = num2 - num1; } } else if (operation == "multiply" || operation == "Multiply") { sum = num1 * num2; } else if (operation == "divide" || operation == "Divide") { sum = num1 / num2; } System.out.println("The answer is: " + "/n" + sum); } } UPDATE: Based on Sotirios Delimanolis, getlost, and other answers: import java.util.Scanner; public class Calculator { public static void main(String[] args){ //Objective: Calculate whole numbers to add, subtract, divide and multiply Scanner kbd1 = new Scanner(System.in); Scanner kbd2 = new Scanner(System.in); int num1, num2, sum; System.out.println("Enter two whole numbers: "); num1 = kbd1.nextInt(); num2 = kbd2.nextInt(); System.out.println("Now what would you like to do with these numbers? (Please input add, subtract, multiply, or divide)"); Scanner oper = new Scanner(System.in); String operation; operation = oper.nextLine(); if (operation.equals("add")) { sum = num1 + num2; …
downvote count: 0
has comment: http://stackoverflow.com/comment/41480791
favorite count: 0
has comment: http://stackoverflow.com/comment/41480880
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/41480703
has answer: http://stackoverflow.com/a/26416694
has title: Java program: Variable sum may not have been initialized
has answer: http://stackoverflow.com/a/26416679

http://stackoverflow.com/q/26453520
linked to: http://stackoverflow.com/q/9554636
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41548021
has title: java JFrame giving me java.lang.NullPointerException and I can't figure out why
has comment: http://stackoverflow.com/comment/41579114
has comment: http://stackoverflow.com/comment/41573120
tagged with: nullpointerexception
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41549007
has body: Before you mark this post as duplicate and referance What is a NullPointerException, and how do I fix it?, I have read that and (I am still new to java and might not understand this correctly) can't seem to see how that is connected to my error. I am trying to dispose a java swing JFrame and load another in it's place and have gotten this to work. Even though it is doing exactly what I want, it still gives me the java.lang.NullPointerException error. As far as I understand the code that the error is connected to is functioning as I want it to. Here is my relevant code. If you need me to include any other code I did not think was necessary please let me know and I will edit. EDIT I removed all my previous code and have added mcve code for you. package test; public final class Test { private static GUI1 gui1; private static GUI2 gui2; public static void main(String[] args) { startGUI1(); } public static void startGUI1() { gui1 = new GUI1(); } public static GUI1 getGUI1() { return gui1; } public static void startGUI2() { gui2 = new GUI2(); } public static GUI2 getGUI2() { return gui2; } } package test; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; public class GUI1 { JFrame frame; public GUI1() { frame = new JFrame(); frame.setVisible(true); frame.setSize(500, 500); frame.setLocationRelativeTo(null); frame.add(new Pane()); } public class Pane extends JComponent { public Pane() { try { Scanner read = new Scanner(new File("user.txt")); if (read.nextInt() != 0) { test.Test.startGUI2(); test.Test.getGUI1().frame.dispose(); } } catch (FileNotFoundException ex) { Logger.getLogger(GUI1.class.getName()).log(Level.SEVERE, null, ex); } } } } package test; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JButton; import…
has comment: http://stackoverflow.com/comment/41547896
has comment: http://stackoverflow.com/comment/41548105
favorite count: 0
has comment: http://stackoverflow.com/comment/41578441
has answer: http://stackoverflow.com/a/26469820
has comment: http://stackoverflow.com/comment/41548865
upvote count: 2
has comment: http://stackoverflow.com/comment/41549606
has comment: http://stackoverflow.com/comment/41549513
has comment: http://stackoverflow.com/comment/41578975
has comment: http://stackoverflow.com/comment/41579382
has comment: http://stackoverflow.com/comment/41550682
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41549472
has comment: http://stackoverflow.com/comment/41548887
tagged with: java
has comment: http://stackoverflow.com/comment/41547932
has comment: http://stackoverflow.com/comment/41549103
tagged with: swing
accepted answer: http://stackoverflow.com/a/26469820
has comment: http://stackoverflow.com/comment/41551698
has comment: http://stackoverflow.com/comment/41548271
type: Question
has comment: http://stackoverflow.com/comment/41549648

http://stackoverflow.com/comment/41614416
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26490227
has text: How does your compiler know what OrderToolRequest is? Is it in the build file?
score: 0

http://stackoverflow.com/q/26447302
has comment: http://stackoverflow.com/comment/50790791
has comment: http://stackoverflow.com/comment/41539553
has comment: http://stackoverflow.com/comment/41540379
tagged with: user-interface
favorite count: 0
has title: issues adding JLabel returned from method to JPanel in java
has comment: http://stackoverflow.com/comment/41578153
has comment: http://stackoverflow.com/comment/41684325
has comment: http://stackoverflow.com/comment/41577196
score: 2
tagged with: jlabel
has comment: http://stackoverflow.com/comment/41538063
answer count: 0
has comment: http://stackoverflow.com/comment/41537094
upvote count: 3
type: UnansweredQuestion
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/42156708
has comment: http://stackoverflow.com/comment/41731339
has comment: http://stackoverflow.com/comment/41539891
type: Question
tagged with: java
tagged with: jpanel
has body: I am trying to make a gui for a flashcard application that can use both images and text as the "front" and "back" of the flashcard. The issue is my TextSide and ImageSide classes (which both implement a Side interface) have a method getContent() which is supposed to return a JLabel, but something is going awry when I try to add the returned JLabel to a JPanel. Here is an excerpt from the main class which is where the issue is actually occurring. other classes follow in case the problem is actually there. note: a window is appearing. the buttons appear just fine. the text entry box does, too. but the north displayCard JPanel is there but empty. one other note: main class is calling study method which calls flashcard which calls textSide. static void theGui(StudyMethod method){ final StudyMethod meth = method; final boolean flip = false; final JPanel displayCard = new JPanel(); displayCard.setLayout(new FlowLayout()); meth.pickCard(); JLabel p = meth.getAnswer(); System.out.println(p); displayCard.add(p); displayCard.revalidate(); displayCard.repaint(); final JTextArea textInput = new JTextArea(10, 20); JPanel buttons = new JPanel(); buttons.setLayout(new FlowLayout()); JButton dontKnow = new JButton("Do Not Know"); JButton know = new JButton("I Know"); JButton exit = new JButton("Exit"); JButton flipIt = new JButton("Flip"); buttons.add(dontKnow); buttons.add(know); buttons.add(exit); buttons.add(flipIt); JPanel gui = new JPanel(); gui.setLayout(new BorderLayout()); gui.add(displayCard, BorderLayout.NORTH); gui.add(textInput, BorderLayout.CENTER); gui.add(buttons, BorderLayout.SOUTH); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(gui); frame.pack(); frame.setVisible(true); TextSide class: package flashcards; import javax.swing.*; public class TextSide implements Side{ private String text; private JLabel label; TextSide(String text){ this.text = text; label = new JLabel(text); } public JLabel getContent(){ return label; }…
has comment: http://stackoverflow.com/comment/41541235
has comment: http://stackoverflow.com/comment/50770142
has comment: http://stackoverflow.com/comment/41536985

http://stackoverflow.com/comment/41442848
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26395468
has text: for example, if array is [ 12 6 7 45 54 69 23 1 0 23] then after swapping three times it should be [ 0 1 6 45 54 69 23 7 12 23]
score: 0

http://stackoverflow.com/q/26470980
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26471244
downvote count: 1
has comment: http://stackoverflow.com/comment/41580184
favorite count: 0
has comment: http://stackoverflow.com/comment/41580060
has title: Java subtract months without Library
has answer: http://stackoverflow.com/a/26471878
accepted answer: http://stackoverflow.com/a/26471878
has body: I want to subtract months from integer without any library. The problem is that when I reduce 1 month from first month : 0 (January) it should be 12 (Dec) but it will be -1.. This is my code for adding int currentMonthInt = Integer.parseInt(currentMonth) - 1; int currentYearInt = Integer.parseInt(currentYear); // show today month if (dateposition == 0){ showListView(currentMonth, currentYear, db); } // show next month for (int i = 1; i &lt;=200; i++){ if (dateposition == i){ int month = currentMonthInt + i; int year = currentYearInt + (month / 12); month = (month % 12)+1; String monthString = String.format("%02d", month); String yearString = String.valueOf(year); showListView(monthString, yearString, db); } } and this is my code for subtracting : (but it dosen't work) for (int i = -200; i &lt; 0; i++){ //This is not correct! //int month = currentMonthInt + i; //int year = currentYearInt + (month / 12); //month = (month % 12)+1; String monthString = String.format("%02d", month); String yearString = String.valueOf(year); showListView(monthString, yearString, db); } P.S. dateposition is for position of month if its 0 its today months and year and if its +1 its next month and so on and if its -1 its prev month
has comment: http://stackoverflow.com/comment/41579608
has comment: http://stackoverflow.com/comment/41580746
has comment: http://stackoverflow.com/comment/41580101
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41580833
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/41579566
score: 1
has comment: http://stackoverflow.com/comment/41579959
tagged with: math
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/41579620
possible better answer: http://stackoverflow.com/a/26471244

http://stackoverflow.com/a/26492195
type: Answer
score: 1
has body: look in the eclipse.ini file, that's where it specifies the JVM to run with.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26492178

http://stackoverflow.com/q/26371032
accepted answer: http://stackoverflow.com/a/26663679
has title: How can I assert that assertion A or assertion B passes with Junit 4?
has answer: http://stackoverflow.com/a/76022668
has comment: http://stackoverflow.com/comment/41400709
possible better answer: http://stackoverflow.com/a/26371278
has answer: http://stackoverflow.com/a/26371278
type: AnsweredQuestion
tagged with: junit
has comment: http://stackoverflow.com/comment/41399241
type: Question
has body: I'm using Junit 4 w/ Selenium WebDriver for some automated testing. I have a test that records some values on a page, clicks a button on the page to load the next page and then compares the recorded value to make sure they changed. The problem is it's a PAIR of values and only one of them has to change, not both. For testing it I've currently implemented the following code: boolean orderNumberChanged = true; try { assertThat(orderNumber, is(not(getValueForElement(By.name("updateForm:j_id35"))))); } catch (AssertionError ae) { orderNumberChanged = false; } try { assertThat(orderDate, is(not(getValueForElement(By.name("updateForm:j_id37"))))); } catch (AssertionError ae) { if ( !orderNumberChanged ) { fail("OrderNumber and OrderDate didn't change."); } } While it should work perfectly fine it just looks ugly to me and it seams like there should be some way to assert something like this. For the record getValueForElement() is a method I wrote to wrap driver.findElement(locator).getAttribute("value");
has answer: http://stackoverflow.com/a/26663679
tagged with: selenium-webdriver
score: 0
tagged with: java
answer count: 3

http://stackoverflow.com/q/26456460
has answer: http://stackoverflow.com/a/72478191
has answer: http://stackoverflow.com/a/26456819
has body: I started to use puppet recently, and i'm trying to deploy a web server using gce_compute and apache-tomcat. To deploy the web server i install the modules puppetlabs-java and puppetlabs-tomcat, and to create an instance of apache-tomcat i'm using the code provided by puppet : class { 'java': } class { 'tomcat': } class { 'epel': }-&gt; tomcat::instance { 'default': install_from_source =&gt; false, package_name =&gt; 'tomcat', }-&gt; tomcat::service { 'default': use_jsvc =&gt; false, use_init =&gt; true, service_name =&gt; 'tomcat', } But when my agent pulls the manifest i'm getting this error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install tomcat' returned 100: Reading package lists... puppet-agent[3302]: Building dependency tree... puppet-agent[3302]: Reading state information... puppet-agent[3302]: E: Unable to locate package tomcat Can you help me to figure out why this happens and how i fix this error. Thanks in advance.
possible better answer: http://stackoverflow.com/a/26475943
answer count: 3
has answer: http://stackoverflow.com/a/26475943
upvote count: 1
has title: Puppet: unable to locate package tomcat
tagged with: tomcat
favorite count: 0
tagged with: google-compute-engine
tagged with: debian
tagged with: puppet
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26456819
type: Question
score: 1
tagged with: java

http://stackoverflow.com/a/26355887
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26355776
has body: First you need to make the DoThis() method public. public static void DoThis(){ System.out.println("Awesome"); } Then just call the method in your actionPerformed method: public void actionPerformed(ActionEvent event){ Object source = event.getSource(); if (source == butt){ DriverPC.DoThis(); } } This works for me! :)

object-oriented-analysis
tags question: http://stackoverflow.com/q/26465371
tag name: object-oriented-analysis
type: Tag
tags question: http://stackoverflow.com/q/26446700

http://stackoverflow.com/comment/41406457
type: AnswerComment
has text: is there any differences between them in efficiency ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26375179

http://stackoverflow.com/q/26508163
has title: Add mysql connector to a maven / nexus build in eclipse
tagged with: java
has body: I'm trying to connect to a mysql database in java and so I have to add mysql-connector-java:jar to my eclipse project. The integration with maven is not working though. Here is what I have in my settings.xml: default <mvn.path>.../maven-3.0.4/bin/mvn.bat</mvn.path> <javac.5>...bin/javac.exe</javac.5> <javac.6>..../javac.exe</javac.6> central-repository OSS central Maven Release Repository https://oss.sonatype.org/content/repositories/releases public-repository-main Central Repository https://repo1.maven.org/maven2 public-repository OSS Maven Release Repository https://oss.sonatype.org/content/groups/public true false nexus * http://xxxx:8083/nexus/content/groups/public And here is the error I get when I try to a mvn clean install Failure to find mysql:mysql-connector-java:jar:5.0.5 in http://xxxx:8083/nexus/content/groups/public How can I force nexus to download the artifact from my public repositories to nexus? Do I have to add it manually?
tagged with: mysql
has answer: http://stackoverflow.com/a/26508342
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41783077
accepted answer: http://stackoverflow.com/a/26558898
type: Question
upvote count: 4
downvote count: 0
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26628564
has answer: http://stackoverflow.com/a/26628564
score: 4
has answer: http://stackoverflow.com/a/26558898
linked to: http://stackoverflow.com/q/6860370
tagged with: nexus
has comment: http://stackoverflow.com/comment/41722333
tagged with: maven
has comment: http://stackoverflow.com/comment/41722986
type: AnsweredQuestion

http://stackoverflow.com/q/26455186
has comment: http://stackoverflow.com/comment/41555878
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26459471
type: Question
has comment: http://stackoverflow.com/comment/41551605
has comment: http://stackoverflow.com/comment/41551105
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41558522
score: 0
answer count: 1
has title: Why won't my android assets load after first run?
has comment: http://stackoverflow.com/comment/41551192
linked to: http://stackoverflow.com/q/12516298
tagged with: android
has body: I am writing an android app using the LibGDX framework. I'm currently running into an issue where after I have installed my app (via Eclipse or manually by using the .apk installer) certain .png assets won't render to the screen. After doing the initial install, everything works as expected on the first run. After that however, some of my assets won't render. There are no exceptions; the images are loaded, they just aren't rendered to the screen. I have inspected the installed .apk in /data/app/&lt;appname&gt;, and the texture pack file and image I am using are both there, and look as they should. The code for creating the pack file was copied from another project I wrote, and the implementation of the texture loading is identical. All of the dependencies and api versions are identical between those two projects, and I am only experiencing this on the new app. As soon as I use the eclipse debugger to run and observe the program, the .apk is reloaded, and thus the issue goes away ... for that first run. I have also tried reinstalling the .apk located in /data/app, and then the program will work ... for that first run. I have tried re-exporting the offending .png files as new .pngs, and that doesn't help. I have tried exporting them as .jpgs, and that doesn't help. This is causing me to pull my hair out! Does anyone know what the issue could be? Edit: Game.java ... @Override public void create() { TEXTURES = new TextureAtlas(Gdx.files.internal("textures/textures.pack")); WIDTH = Gdx.app.getGraphics().getWidth(); HEIGHT = Gdx.app.getGraphics().getHeight(); this.setScreen(new IntroScreen()); startTime = System.currentTimeMillis(); } ... ButtonRenderer.java ... private ButtonRenderer() { playButton = createButton("play", "play_dark", "play_dark", buttonSize, buttonSize); pauseButton = createButton("pause", "pause_dark", "pause_dark", buttonSize, buttonSize); stopButton = createButton("stop", "stop_dark", "stop_dark", buttonSize, buttonSize); recordButton = createButton("…
accepted answer: http://stackoverflow.com/a/26459471

http://stackoverflow.com/q/26491726
tagged with: jax-rs
score: 0
has body: I have two jax-rs webservices: WS1 and WS2. Also I have an html form that user add some text and when click submit button call WS1 or WS2 and send an xml file via post. The xml file look like: &lt;documents&gt; &lt;document&gt; some text 1 &lt;/document&gt; &lt;document&gt; some text 2 &lt;/document&gt; &lt;/documents&gt; When I call ws1 or ws2 from html form, xml file passes without problem. But when I try to call ws1 from ws2, I can't send xml file which contains special characters in element "document". (don't send all xml file) So my question is how can I pass xml file that contains special characters or how can replace all special characters? Call wb1 public String sendPost(String value) throws Exception { String url = "http://localhost:8084//wb1"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("POST"); String urlParameters = "xmlinput=" + value; // Send post request con.setDoOutput(true); java.io.BufferedOutputStream wr = new BufferedOutputStream(con.getOutputStream()); wr.write(urlParameters.getBytes()); wr.flush(); wr.close(); //response BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); response.append(inputLine); } in.close(); return response.toString(); } wb1: @POST @Produces("application/xml") public String getXml(@FormParam("xmlinput") String xmlinput) throws Exception { //some code } EDIT: for example I have this string: RT @CEJA: CEJA President @BartoliniMatteo with S&amp;amp;D COMAGRI coordinator @paolodecastro. @EP_Agriculture @TheProgressives http://t.co/65xi4… I want to replace &amp;amp; with black space. I try with String.replaceAll("\W", " "); but 1) replace only &amp;; etc 2) I want to keep links without modification
tagged with: web-services
type: AnsweredQuestion
tagged with: java
has title: passing special character in jax-rs webservice
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26491923
accepted answer: http://stackoverflow.com/a/26491923

http://stackoverflow.com/q/26416779
tagged with: c#
accepted answer: http://stackoverflow.com/a/26422654
has answer: http://stackoverflow.com/a/26417159
score: 0
answer count: 2
has body: I've been working on converting the classes over to C# (DataInputStream and DataOutputStream) and I've finished the DataOutputStream class, now the problems are all sitting in the InputStream class. Note: The reason that I'm not using the Encoding class in C# is because DataInput/DataOutputStream in Java use a custom UTF-8 Encoding. Basically, I have this code: (C#) which uses the BinaryReader class public String ReadUTF() { int utflen = this.ReadUnsignedShort (); byte[] bytearr = null; char[] chararr = null; if(bytearr.Length &lt; utflen) { bytearr = new byte[utflen * 2]; chararr = new char[utflen * 2]; } int c, char2, char3; int count = 0; int chararr_count=0; this.ReadFully(bytearr, 0, utflen); while (count &lt; utflen) { c = (int) bytearr[count] &amp; 0xff; if (c &gt; 127) break; count++; chararr[chararr_count++]=(char)c; } while (count &lt; utflen) { c = (int) bytearr[count] &amp; 0xff; switch (c &gt;&gt; 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: /* 0xxxxxxx*/ count++; chararr[chararr_count++]=(char)c; break; case 12: case 13: /* 110x xxxx 10xx xxxx*/ count += 2; if (count &gt; utflen) throw new Exception( "malformed input: partial character at end"); char2 = (int) bytearr[count-1]; if ((char2 &amp; 0xC0) != 0x80) throw new Exception( "malformed input around byte " + count); chararr[chararr_count++]=(char)(((c &amp; 0x1F) &lt;&lt; 6) | (char2 &amp; 0x3F)); break; case 14: /* 1110 xxxx 10xx xxxx 10xx xxxx */ count += 3; if (count &gt; utflen) throw new Exception( "malformed input: partial character at end"); char2 = (int) bytearr[count-2]; char3 = (int) bytearr[count-1]; if (((char2 &amp; 0xC0) != 0x80) || ((char3 &amp; 0xC0) != 0x80)) throw new Exception( "malformed input around byte " + (count-1)); chararr[chararr_count++]=(char)(((c &amp; 0x0F) &lt;&lt; 12) | ((char2 &amp; 0x3F) &lt;&lt; 6) | ((char3 &amp; 0x3F) &lt;&lt; 0)); break; default: /* 10xx xxxx, 1111 xxxx */ throw new Exception( "malformed input around byte " + count); } }…
tagged with: io
possible better answer: http://stackoverflow.com/a/26417159
has title: C# BinaryReader ReadUTF from Java's DataOutputStream
tagged with: input
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26422654
tagged with: output
type: Question

http://stackoverflow.com/comment/41442356
type: Comment
comment on: http://stackoverflow.com/q/26393422
score: 1
has text: This is one of many bugs with eclipse's code formatter for comments (including Javadoc). You should open a bug report [here](https://bugs.eclipse.org/bugs/).
type: QuestionComment

http://stackoverflow.com/q/26413265
has answer: http://stackoverflow.com/a/26413296
tagged with: double
type: AnsweredQuestion
tagged with: java
has body: Why am I getting the Possible lossy conversion from double to int error and how can I fix it? public class BinSearch { public static void main(String [] args) { double set[] = {-3,10,5,24,45.3,10.5}; double l = set.length; double i, j, first, temp; System.out.print("Before it can be searched, this set of numbers must be sorted: "); for (i = l-1; i&gt;0; i--) { first=0; for(j=1; j&lt;=i; j++) { if(set[j] &lt; set[first]) // location of error according to compiler { first = j; } temp = set[first]; set[first] = set[i]; set[i] = temp; } } } } As you can see, I've already tried replacing int with double near the top when declaring variables but it doesn't seem to do the job.
type: Question
has answer: http://stackoverflow.com/a/26413373
upvote count: 4
accepted answer: http://stackoverflow.com/a/26413296
has comment: http://stackoverflow.com/comment/41474544
score: 4
tagged with: type-conversion
tagged with: int
has title: Possible lossy conversion from double to int
answer count: 3
has comment: http://stackoverflow.com/comment/41474832
downvote count: 0
possible better answer: http://stackoverflow.com/a/26413321
favorite count: 0
has answer: http://stackoverflow.com/a/26413321

http://stackoverflow.com/q/26502379
tagged with: java
has comment: http://stackoverflow.com/comment/41636952
has title: Is there a way to copy and paste on the Java side while dynamcly changing the content of the clipboard?
downvote count: 0
answer count: 1
favorite count: 0
has body: I am trying to copy and paste from Excel into our own application into several fields. For this i am reading out the clipboard and create an array which is equal to the fields beeing copied from excel. The look of the application is somehow equal to excel, you can go into the next column with tab, and into the next row with enter. The following code should read the clipboard content and Paste the Strings immediatly. to do this i am using the Key Robot in combination with the setting of the clipboard. Now i am running into the following problem. I set the new Clipboard content in the loop for every cell in the Excel sheet. i am getting the single value for each cell with getClipboardContents, but the Robot pressing ctrl + v does still copy the whole area beeing copied in Excel. Is there a way to copy and paste on the Java side while dynamcly changing the content of the clipboard? private 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 = (String) contents.getTransferData(DataFlavor.stringFlavor); } catch (UnsupportedFlavorException ex) { // highly unlikely since we are using a standard DataFlavor ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } catch (NullPointerException npe) { npe.printStackTrace(); } } return result; } private String[][] generateExcelArray() { String clipboard = getClipboardContents(); String[] rows = clipboard.split("\n"); String[][] table = new String[rows.length][rows[0].split("\t").length]; for (int i = 0; i &lt; table.length; ++i) { String[] row = rows[i].split("\t"); int _a = 0; if (row.length != table[i].length) _a = table[i].length - row.length; for (int j = 0; j+_a &lt; tabl…
has answer: http://stackoverflow.com/a/26502984
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1

http://stackoverflow.com/comment/41639559
has text: "it's pretty trivial to put that code section into a timer or it's own thread" - then why not write it like it is supposed to be? "I'm trying to illustrate how it can be done without extra clutter." - no, it cannot be done like that, it is not a "clutter" issue. Especially if you write: "Well, this would do it:" in your answer. This, definitely wouldn't *do it*.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26503526

http://stackoverflow.com/comment/41592175
has text: yes, I saw that, and have you tried `Log.d("tag", "PID SCAN: " + data.getString("pid"));`?
type: AnswerComment
comment on: http://stackoverflow.com/a/26477579
score: 0
type: Comment

http://stackoverflow.com/comment/41609125
type: Comment
type: QuestionComment
has text: Assuming the content of `filename` is a valid encrypted value, the way you read it in is unreliable. `String.getBytes()` is platform-dependent, and if it happens to be UTF-8 for any plausible encrypted data it will produce a `byte[]` that is longer than the input and thus in this case too long for RSA decrypt. In other it may be a 1-byte code that gives the correct length but the wrong contents, which will still fail but with a different exception. ...
comment on: http://stackoverflow.com/q/26483256
score: 0

http://stackoverflow.com/q/26400746
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26400774
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26403058
type: Question
has body: I have a List instance called words and a HashMap instance called map. I have certain words on the list and count them to save on the HashMap. The HashMap has count as value and word as key. I don't know what I am doing wrong here. Any help is greatly appreciated. IS THERE A BETTER IMPLEMENTATION FOR THIS? for (String aword : words) { map = new HashMap&lt;String, Integer&gt;(); if (map.containsKey(aword)) { int count; try { count = map.get(aword); count++; } catch (NullPointerException npe) { count = 0; } map.put(aword, count); System.out.println(aword+"SS"+count); } else { map.put(aword, 0); System.out.println(aword+"else"+0); } } My else clause is always entered.
tagged with: hashmap
has title: Count words from list and save them and their count in a Hashmap
has answer: http://stackoverflow.com/a/26400797
has answer: http://stackoverflow.com/a/26400774
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26400797
tagged with: word-count
has answer: http://stackoverflow.com/a/26400798
answer count: 5
has answer: http://stackoverflow.com/a/26400871
upvote count: 1

http://stackoverflow.com/q/26459514
has body: You have an input of n and that represents half the rows that the diamond will have. I was able to make the first half of the diamond but I'm EXTREMELY frustrated with the second half. I just can't seem to get it. I'm not here to ask for specific code I need, but can you point me in the right direction and give me some tips/tricks on how to write this? Also, if I'm going about this program the wrong way, feel free to tell me and tell me on how I should approach the program. The diamonds at the bottom represent an input of 5. n-1 represents the spaces to the left of each asterisk. Thank you for your help! public static void printDiamond(int n) { for(int i=0;i&lt;n;i++) { for(int a=0;a&lt;(n-(i+1));a++) { System.out.print(" "); } System.out.print("*"); for(int b=0; b&lt;(i*2);b++) { System.out.print("-"); } System.out.print("*"); System.out.println(); } } ** What I need ** What I have currently *--* *--* *----* *----* *------* *------* *--------* *--------* *--------* *------* *----* *--* **
answer count: 4
accepted answer: http://stackoverflow.com/a/26459605
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26459605
has answer: http://stackoverflow.com/a/26459631
tagged with: nested-loops
tagged with: java
possible better answer: http://stackoverflow.com/a/26459610
has answer: http://stackoverflow.com/a/26461085
has title: I'm having trouble making a diamond shape with loops
type: Question
score: 0
tagged with: for-loop
upvote count: 1
has answer: http://stackoverflow.com/a/26459610
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41558780

icepush
type: Tag
tags question: http://stackoverflow.com/q/26460978
tag name: icepush

http://stackoverflow.com/q/26387726
type: Question
tagged with: c#
score: 0
has title: Data sent over TCPClient to Java Server Socket on Android causes Thread to hang
has comment: http://stackoverflow.com/comment/41442902
has comment: http://stackoverflow.com/comment/41429635
has comment: http://stackoverflow.com/comment/41429332
answer count: 1
has comment: http://stackoverflow.com/comment/41446311
has answer: http://stackoverflow.com/a/26399834
has comment: http://stackoverflow.com/comment/41431506
has comment: http://stackoverflow.com/comment/41445344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41429764
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/41430360
tagged with: java
has comment: http://stackoverflow.com/comment/41429290
has body: I'm creating an Android app which sends Text Messages( SMSManager Class ). This is an app I'm creating for developers, so, the app has to be inter-operable with the various programming languages. The app seems to be working well with JAVA and PHP. I've been experiencing problems with C#. TcpClient sock = new TcpClient(); sock.Connect("192.168.1.24", 5000); NetworkStream ns = sock.GetStream(); String str = "9840486945#hi"; byte[] by = Encoding.Default.GetBytes(str); ns.Write(by, 0, by.Length); ns.Read(by, 0, by.Length); //Will receive "Transmitted" or "Failed" string returndata = System.Text.Encoding.Default.GetString(by); Console.WriteLine(returndata); if(returndata.Equals("Transmitted")) { ns.Read(by, 0, by.Length); //Will receive "Delivered" returndata = System.Text.Encoding.Default.GetString(by); Console.WriteLine(returndata); } On the Android side, I've attempted this: if(lang.equals("CS")) { byte[] by=new byte[1024]; InputStream is; try { is = s.getInputStream(); is.read(by); input=new String(by); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } I've checked the input coming into the Android app, its perfectly normal. But when I use the input I've received from the socket, the Logcat app's log shows: W/System.err(14636): at com.app.mysmsgateway.Receiver.run(MainActivity.java:498) This is what line 498 contains: smsManager.sendTextMessage(phoneNo, null, msg, sentPI, deliverPI); Thanks in advance! EDIT: Changed encoding on both ends to UTF-8. Still showing me the System.err.

http://stackoverflow.com/a/26395199
has body: 404 means that the URL was not found. I suspect that you need the web application name in your URL. So rather than using a form action of: /TestServlet1, try /name_of_your_web_app/TestServlet1
score: 0
answers question: http://stackoverflow.com/q/26395160
type: Answer

http://stackoverflow.com/comment/41379398
type: AnswerComment
type: Comment
has text: 1. JSP absolutely cannot do this, browser history is clien code task.
comment on: http://stackoverflow.com/a/26360573
score: 0

http://stackoverflow.com/a/26446676
has comment: http://stackoverflow.com/comment/41536282
has body: Use split(String regex) to split the string. (See the javadocs for split()) Then you can individually parse each value in the way you want it. Here is an example using your data: String toBeSplit = "232131231, random name, 23.3232"; String[] split = toBeSplit.split(","); int value1 = Integer.parseint(split[0].trim()); String value2 = split[1].trim(); double value3 = Double.parseDouble(split[2].trim()); I use trim() (See the javadocs for trim()) to get rid of the white space left behind after splitting. Here's another way to do it without trim(): (Just add a space inside the split regex) String toBeSplit = "232131231, random name, 23.3232"; String[] split = toBeSplit.split(", "); int value1 = Integer.parseint(split[0]); String value2 = split[1]; double value3 = Double.parseDouble(split[2]);
has comment: http://stackoverflow.com/comment/41536515
answers question: http://stackoverflow.com/q/26446597
accepted answer of: http://stackoverflow.com/q/26446597
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41536522

http://stackoverflow.com/q/26455482
tagged with: jvm-hotspot
has body: I have this code to generate class dynamically and load it import javassist.CannotCompileException; import javassist.ClassPool; public class PermGenLeak { private static final String PACKAGE_NAME = "com.jigarjoshi.permgenleak."; public static void main(String[] args) throws CannotCompileException, InterruptedException { for (int i = 0; i &lt; Integer.MAX_VALUE; i++) { ClassPool pool = ClassPool.getDefault(); pool.makeClass(PACKAGE_NAME + i).toClass(); Thread.sleep(3); } } } I launched this class against Java 7 (jdk1.7.0_60) and as expected it filled up PermGenSpace and heap remained unused image shows permgen usage overtime and at the end JVM was terminated Now the same code ran against Java 8 (jdk1.8.0_40-ea) and as expected it kept expanding native memory (Metaspace) but surprisingly for 1g of Metaspace it consumed 3g of Heap in OldGen (almost 3x of Metaspace maintained over time) image shows Metaspace usage overtime and System memory usage sample this email from Jon Masamitsu and this JEP ticket says interned String and Class stats and some misc data has been moved to Heap what exactly makes this increase in heap as it loads more classes into Metaspace ?
downvote count: 0
tagged with: jvm
favorite count: 0
tagged with: metaspace
score: 16
has title: Java8 metaspace & heap usage
tagged with: java-8
upvote count: 16
has answer: http://stackoverflow.com/a/26456286
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26456279
tagged with: java
has answer: http://stackoverflow.com/a/26456279
accepted answer: http://stackoverflow.com/a/26456286
type: Question
answer count: 2

http://stackoverflow.com/comment/41490752
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26421232
has text: Have you tried `subscriptions[subscriptions[0].getYear()-year] = new SubscriptionYear(year, subscription);` already? (don't forget to remove the `for` loop).
score: 0

http://stackoverflow.com/comment/41523168
score: 0
type: AnswerComment
has text: @code578841441 It is only available in JavaEE, not in JavaSE - and in JavaEE it is lowercased (`JsonObject`)
type: Comment
comment on: http://stackoverflow.com/a/26439745

http://stackoverflow.com/q/26477879
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41594985
has body: I am getting error while connecting to remote machine , here is the java error log - DBConnection.getConnectionFromDB - Error Occured -- SQL EXCEPTION org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:207) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) at org.postgresql.jdbc2.AbstractJdbc2Connection.&lt;init&gt;(AbstractJdbc2Connection.java:136) at org.postgresql.jdbc3.AbstractJdbc3Connection.&lt;init&gt;(AbstractJdbc3Connection.java:29) at org.postgresql.jdbc3g.AbstractJdbc3gConnection.&lt;init&gt;(AbstractJdbc3gConnection.java:21) at org.postgresql.jdbc4.AbstractJdbc4Connection.&lt;init&gt;(AbstractJdbc4Connection.java:31) at org.postgresql.jdbc4.Jdbc4Connection.&lt;init&gt;(Jdbc4Connection.java:24) at org.postgresql.Driver.makeConnection(Driver.java:397) at org.postgresql.Driver.connect(Driver.java:267) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) and here is pg_hba.conf file - # TYPE DATABASE USER ADDRESS METHOD # IPv4 local connections: host all all 127.0.0.1/32 md5 host all all 192.168.1.101/24 trust host all all 0.0.0.0/0 trust # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. #host replication postgres 127.0.0.1/32 md5 #host replication postgres ::1/128 md5
tagged with: postgresql-9.2
has comment: http://stackoverflow.com/comment/41595021
tagged with: java
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41592616
has answer: http://stackoverflow.com/a/38222929
has title: postgres connection refused in swing
tagged with: postgresql
has answer: http://stackoverflow.com/a/26485642

http://stackoverflow.com/q/26458756
type: Question
has answer: http://stackoverflow.com/a/26458794
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41557546
has answer: http://stackoverflow.com/a/26458885
linked to: http://stackoverflow.com/q/685300
has comment: http://stackoverflow.com/comment/41557523
type: UnansweredQuestion
tagged with: inheritance
has body: In this program class a { int a=25; public void aa() { System.out.println(a); } } class b extends a { int a=2; public static void main(String[] args) { b x=new b(); x.aa(); } } why does "x.aa()" prints 25 ans why not 2?,what is the reason behind it? class a { int a=25; public void aa() { System.out.println(a); b(); } public void b() { System.out.println("this should print"); } } class b extends a { int a=2; public static void main(String[] args) { b x=new b(); x.aa(); } public void b() { System.out.println("this should not print"); } } and if we consider the above output,then here again the output of b() of above should print "this should print" but we are getting the ouput from sublcass "this should not print"
has answer: http://stackoverflow.com/a/26458922
answer count: 4
has comment: http://stackoverflow.com/comment/41557384
has answer: http://stackoverflow.com/a/26458923
has title: Why is this program printing 25? (Java inheritance)
has comment: http://stackoverflow.com/comment/41557511

http://stackoverflow.com/comment/41654924
type: Comment
has text: Hmm. I've tried this but for some reason I'm still getting a runtime error for my nonexistent randomCheck(). Is there a cache or something that I should delete? I recompile it every time I run it
comment on: http://stackoverflow.com/a/26510948
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41652846
has text: Use the `Graphics2D` [drawImage(..)](http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#drawImage(java.awt.Image,%20int,%20int,%20int,%20int,%20java.awt.Color,%20java.awt.image.ImageObserver)) method.
comment on: http://stackoverflow.com/q/26511329
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26485495
has comment: http://stackoverflow.com/comment/41605698
has answer: http://stackoverflow.com/a/26485825
has title: How to convert ArrayList instanceObject to toString
has comment: http://stackoverflow.com/comment/41605526
has comment: http://stackoverflow.com/comment/41605979
score: 0
has comment: http://stackoverflow.com/comment/41605479
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/41605558
has answer: http://stackoverflow.com/a/26486009
has comment: http://stackoverflow.com/comment/41607001
has comment: http://stackoverflow.com/comment/41607470
has comment: http://stackoverflow.com/comment/41607287
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41606870
has body: i want to convert the instance of class which is in ArrayList to toString i have here my code User class: public class User { // ... public void setName(String name) { this.fullname = name; } @Override public String toString() { return this.fullname; } public ArrayList&lt;User&gt; getTheLikers() { ArrayList&lt;User&gt; user = new ArrayList&lt;&gt;(); user.add(this); return user; } Post class: public class Post { public ArrayList&lt;User&gt; getLikers() { User a = new User(); ArrayList&lt;User&gt; b = a.getTheLikers(); return b; } and here is the code where i should get the getLikers() while(rs.next()) { User a = new User(); Post b = new Post(); String name = rs.getString("people_who_like"); a.setName(name); ArrayList c; c = b.getLikers(); String liker = c.toString(); p.addElement(liker); } i have already convert it to toString as you can see.. but it shows that i have display my value but it is in null
has comment: http://stackoverflow.com/comment/41605978
has comment: http://stackoverflow.com/comment/41605570
has comment: http://stackoverflow.com/comment/41605451
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41607084
has comment: http://stackoverflow.com/comment/41607912
has comment: http://stackoverflow.com/comment/41605462
has answer: http://stackoverflow.com/a/26485614
has comment: http://stackoverflow.com/comment/41607803

http://stackoverflow.com/comment/41370516
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26354227
has text: Its my pleasure to help you. It would be another pleasure if you accept the answer. I am giving you another example how to use `Environment.getExternalStorageDirectory()`.. :)

http://stackoverflow.com/q/26392679
has body: Is it possible to unmarshal a XML file like this: <company id="bh23" name="imob"> <store-info id="2392"> NYC Imob's NYC 5th keyboard</keyboard> 2000 mouse</keyboard> 1000 </stores> into classes like these: @XmlElementRoot(name = "company") public class Company { @XmlAttribute (name = "id") String id; @XmlAttribute (name = "name") String name; @XmlElement (name = "store") List stores; //all the getters and setters } @XmlElementRoot (name = "store") public class Store { @XmlAttribute (name = "id") String id; @XmlElement (name = "address") String address; @XmlElement (name = "name") String name; @XmlElementWrapper (name = "products") @XmlElement (name = "product") List products; //all the getters and setters } public class main { public static void main (String args[]) { try { JAXBContext jaxbContext = JAXBContext.newInstance(Company.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Company portfolio = (Company) jaxbUnmarshaller.unmarshal(new File(xmlUrlPath)); System.out.println(portfolio.toString()); } catch (JAXBException e) { e.printStackTrace(); } } } I'm trying to "skip" or "jump" the node named "store-info" because I don't want to create another class just to keep the store's address and name, since it would be more simple to "append" both address and name to "Store" class. Of course, when I run the code, the vars "address", "id" and "name" becomes null and only the list of products is correctly unmarshaled. Is there a way to skip a node, merging their fields into another class? I'm avoiding (for "legal" purposes) the use of MOXy lib and their XPath annotation.
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26394227
score: 2
tagged with: java
tagged with: jaxb
linked to: http://stackoverflow.com/q/5949265
type: Question
downvote count: 0
has title: Skip XML nodes while unmarshaling XML with JAXB
tagged with: unmarshalling
answer count: 1

http://stackoverflow.com/q/26385667
downvote count: 2
upvote count: 1
answer count: 1
has body: I have a problem finding a multiline string: I have this text in the "contractBytes" var: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 8848 2009-09-08 <CreditPurpose id="20"/> <NegativeStatus id="4"/> 2009-09-08 2009-09-08 2011-03-31 украинский Первый контрагент <Classification id="1"/> 1980-12-06 <Residency id="1"/> <Citizenship code="UA"/> <MaritalStatus id="2"/> 2554209876 ВЦ620997 1997-04-01 Дебальцевский ГОУМВД Украины в Донецкой области 2554209876 м. Kharkov, вул. Street, буд. 1, кв. 1 7800.0 <CreditUsage id="3"/> 7800.0 0.0 I'm trying get part using regex: Pattern p = Pattern.compile("(<Contract)(.)*(Contract>)", Pattern.DOTALL); Matcher m = p.matcher(contractBytes); for (;m.find();) { if (m.group(1).contains(" " + contractCode + " ")) { dealXmlMap.put(Long.parseLong(contractCode), m.group(1)); break; } } But m.find always returns false. What should I do with this pattern to get the text from contractBytes var?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26385729
linked to: http://stackoverflow.com/q/1732348
favorite count: 0
has comment: http://stackoverflow.com/comment/41425471
type: Question
tagged with: regex
score: -1
has title: Java regex doesn't match multiline string
tagged with: java

http://stackoverflow.com/a/26373743
type: Answer
has body: This line: String[] tokens = line.split("/t"); is presumably trying to split a tab-separated line, but you are using a forward-slash instead of a back-slash. It should be: String[] tokens = line.split("\t"); You should check the length of tokens before attempting to index it, to help catch these types of errors. Even with the above change, if you encounter a line which isn't tab-separated for any reason, you will get the same exception. I would suggest wrapping the code where you access your tokens array with a length check: if (tokens.length &gt;= 3) { prereqcl.add(new prereqclass(tokens[0].trim(),tokens[1].trim(),tokens[2].trim() ) ); } else { System.out.println("Only found " + tokens.length + " tokens."); }
has comment: http://stackoverflow.com/comment/41404196
score: 0
has comment: http://stackoverflow.com/comment/41404257
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26373620
answers question: http://stackoverflow.com/q/26373620

http://stackoverflow.com/comment/41591865
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26477300
has text: @Jenny `i have no idea how to trace and debug it.` You're using Visual C++. It has one of the best debuggers ever developed for a C++ environment. There shouldn't be an excuse for not using it.
type: QuestionComment

http://stackoverflow.com/a/26409772
type: Answer
answers question: http://stackoverflow.com/q/26409453
accepted answer of: http://stackoverflow.com/q/26409453
has body: You can use LocalDate (Java 1.8) and the function LocalDateTime.parse This function will return a LocalDateTime object based on the char sequence (your date) and a DateTimeFormatter. From the Java 1.8 API: public static LocalDateTime parse(CharSequence text, DateTimeFormatter formatter) Obtains an instance of LocalDateTime from a text string using a specific formatter. The text is parsed using the formatter, returning a date-time. Parameters: text - the text to parse, not null formatter - the formatter to use, not null Returns: the parsed local date-time, not null Throws: DateTimeParseException - if the text cannot be parsed
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41558256
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26459164
has text: @Polppan: He means the return value.
type: Comment

http://stackoverflow.com/q/26418500
has body: What is the difference between OpaqueTridentKafkaSpout and TransactionalTridentKafkaSpout? When would you use one over the other?
has answer: http://stackoverflow.com/a/26510338
answer count: 1
downvote count: 0
favorite count: 0
has title: Compare Opaque or Transactional Kafka spout
accepted answer: http://stackoverflow.com/a/26510338
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: apache-storm
type: Question
tagged with: apache-kafka
tagged with: trident
tagged with: java
tagged with: message-queue

http://stackoverflow.com/q/26470999
type: Question
tagged with: outlook
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/17361340
tagged with: com
has comment: http://stackoverflow.com/comment/41621768
has title: Jacob Fatal Error
has comment: http://stackoverflow.com/comment/41579527
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/41611797
type: UnansweredQuestion
tagged with: jacob
has body: I am trying to build a Java Drag and Drop that works with Outlook emails. I've been using Jacob because of an inability to transfer data from Outlook to Java using standard AWT Event stuff. That said, all of the solutions I've pulled from here or other sites have been causing a fatal crash in Java. Here's the code: import java.awt.dnd.*; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.datatransfer.*; import java.io.*; import java.util.List; import sun.awt.datatransfer.*; import com.jacob.com.*; import com.jacob.activeX.*; public class D2 extends JFrame { private static final String DIR = "FILES"; private static void saveSelectedOutlookMails(String directory) { Dispatch xl = new Dispatch("Outlook.Application"); //Dispatch selection = Dispatch.get(xl, "Selection").toDispatch(); System.out.println(xl); System.out.println(xl==null); //PROGRAM CRASHES AFTER THIS LINE Dispatch explorer = Dispatch.get(xl,"ActiveExplorer").toDispatch(); System.out.println("explorer"); Object selection = Dispatch.get(explorer, "Selection").toDispatch(); Variant count = Dispatch.get(selection, "Count"); for (int mailIndex = 1; mailIndex &lt;= count.toInt(); mailIndex++ ) { Object mailItem = Dispatch.call(selection, "Item", new Variant(mailIndex)).toDispatch(); Variant senderName = Dispatch.get(mailItem, "SenderName"); Variant subject = Dispatch.get(mailItem, "Subject"); Variant body = Dispatch.get(mailItem, "Body"); String emailFileName = subject.toString() +".txt"; String fullPath = directory + "/" + emailFileName; try { File email = new File(fullPath); PrintWriter writer = new PrintWriter( new FileWriter(email) ); writer.println("From: "+ senderName ); writer.println("Subject: "+ subject); writer.println(""); writer.print( body ); writer.close(); } catch (IOException e) { System.out.println(e.getMessage()); //logger.error("IOException writing e-mail with subject: '"+ subject +"'", e); continue; } Object attachments = Dispatch.get(mailItem, "Attachments").to…
has answer: http://stackoverflow.com/a/41020703
tagged with: java
has answer: http://stackoverflow.com/a/26523603
has comment: http://stackoverflow.com/comment/41660446

http://stackoverflow.com/q/26494672
has title: Command prompt error while running an applet
has comment: http://stackoverflow.com/comment/41666633
has body: When I am trying to run an applet in command prompt I am getting an error message saying: System cannot find the file specified. Initially I compiled my applet, it works fine using: javac BubbleSort1.java But when I tried running this using the following, I'm getting the above error: appletviewer BubbleSort1.html Anyhow, both the html file and the java file are in same folder in C drive. (Windows 7) I would be grateful if anyone could help me. The HTML is: <TITLE> BubbleSort
tagged with: command-prompt
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41622855
has comment: http://stackoverflow.com/comment/41624073
tagged with: java
has comment: http://stackoverflow.com/comment/41623616
type: Question
score: 0
has comment: http://stackoverflow.com/comment/41623407
has comment: http://stackoverflow.com/comment/41623542
tagged with: applet
has comment: http://stackoverflow.com/comment/41623570

http://stackoverflow.com/comment/41656921
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26513255
has text: @user1745356 I added an example

http://stackoverflow.com/comment/41624880
type: QuestionComment
comment on: http://stackoverflow.com/q/26488667
type: Comment
has text: @Michael-O Using `SSLv2Hello` might still have its uses even if only TLS is being used. It allows a handshake to begin with a server that for some reason requires `SSLv2Hello` messages. On the other hand, if everyone stops coding that hack into their software, perhaps servers that require it will die out sooner...
score: 2

http://stackoverflow.com/comment/41519565
has text: @getlost i have posted the jsp function of log in button...please have a look on that
comment on: http://stackoverflow.com/q/26387186
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26392299
has answer: http://stackoverflow.com/a/26392998
has answer: http://stackoverflow.com/a/26392383
score: 4
downvote count: 0
has answer: http://stackoverflow.com/a/26392459
favorite count: 0
has body: As input I am getting an address as a String. It may say something like "123 Fake Street\nLos Angeles, CA 99988". How can I convert this into an object with fields like this: Address1 Address2 City State Zip Code Or something similar to this? If there is a java library that can do this, all the better. Unfortunately, I don't have a choice about the String as input. It's part of a specification I'm trying to implement. The input is not going to be very well structured so the code will need to be very fault tolerant. Also, the addresses could be from all over the world, but 99 out of 100 are probably in the US.
answer count: 5
type: UnansweredQuestion
tagged with: street-address
has answer: http://stackoverflow.com/a/26392348
has title: How do you convert a java String to a mailing address object?
has answer: http://stackoverflow.com/a/26392768
tagged with: data-conversion
tagged with: java
has comment: http://stackoverflow.com/comment/41437609
has comment: http://stackoverflow.com/comment/41439461
type: Question
upvote count: 4

http://stackoverflow.com/comment/41447004
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26389566
has text: No, john, Alexey was asking what here is GWT-specific. You are asking a question about database transactions - which has nothing to do with GWT. By including the GWT tag, and not the relevant database/transaction related tags you are in effect asking the wrong bunch this question.

recursion
type: Tag
tags question: http://stackoverflow.com/q/26512928
tags question: http://stackoverflow.com/q/26394957
tags question: http://stackoverflow.com/q/26456343
tags question: http://stackoverflow.com/q/26418078
tags question: http://stackoverflow.com/q/26427947
tags question: http://stackoverflow.com/q/26357805
tags question: http://stackoverflow.com/q/26476982
tags question: http://stackoverflow.com/q/26492508
tags question: http://stackoverflow.com/q/26430327
tags question: http://stackoverflow.com/q/26398195
tags question: http://stackoverflow.com/q/26498802
tags question: http://stackoverflow.com/q/26408499
tags question: http://stackoverflow.com/q/26478705
tags question: http://stackoverflow.com/q/26411053
tag name: recursion
tags question: http://stackoverflow.com/q/26404678
tags question: http://stackoverflow.com/q/26455024
tags question: http://stackoverflow.com/q/26435429
tags question: http://stackoverflow.com/q/26460013
tags question: http://stackoverflow.com/q/26384752
tags question: http://stackoverflow.com/q/26471600
tags question: http://stackoverflow.com/q/26453831
tags question: http://stackoverflow.com/q/26443634
tags question: http://stackoverflow.com/q/26455105
tags question: http://stackoverflow.com/q/26484675
tags question: http://stackoverflow.com/q/26512230
tags question: http://stackoverflow.com/q/26477233
tags question: http://stackoverflow.com/q/26458438
tags question: http://stackoverflow.com/q/26513627
tags question: http://stackoverflow.com/q/26433861
tags question: http://stackoverflow.com/q/26478385
tags question: http://stackoverflow.com/q/26398915
tags question: http://stackoverflow.com/q/26499737
tags question: http://stackoverflow.com/q/26395512
tags question: http://stackoverflow.com/q/26421688
tags question: http://stackoverflow.com/q/26441850
tags question: http://stackoverflow.com/q/26496016
tags question: http://stackoverflow.com/q/26454710
tags question: http://stackoverflow.com/q/26394183

http://stackoverflow.com/a/26497104
has comment: http://stackoverflow.com/comment/41627314
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26497024
has body: You should think of Java generic types as annotations for the compiler, rather than something that you can use in code, because they don't exist at bytecode level. If you need to check for a type, you must pass the class to the method. This should work: private ServerEvent filterEvents(final Class&lt;?&gt; clazz) { return argThat(new ArgumentMatcher&lt;ServerEvent&gt;() { @Override public boolean matches(Object argument) { return clazz.isInstance(argument); } }); Edit: Java's instanceof operator can not compare an object against a class reference. It requires the class name. Class.isInstance() allows you to check instances dynamically.
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/41627226

http://stackoverflow.com/q/26498712
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26498762
has answer: http://stackoverflow.com/a/26500440
has title: Spaces in Java Regular Expressions
has answer: http://stackoverflow.com/a/26498757
downvote count: 0
favorite count: 0
has body: I am new to both Java and regular expressions I want to detect a pattern like Section : I have a code snippet String line = "Section 12: sadfdggfgfgf"; Pattern ptn = Pattern.compile("Section [0-9+]:"); Matcher mtch = ptn.matcher(line); When ptn = "Section [0-9+]: mtch is false I am able to detect the pattern (mtch says TRUE) when ptn = "Section [0-9+] Is there something I am missing about spaces in the String ? I have to assume they may or may not be spaces between Section and &lt;Number&gt;
tagged with: regex
answer count: 4
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26498724

http://stackoverflow.com/comment/41541178
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26446178
has text: I'll be frank, I know the answer. The reason I asked to show the code is that comments like "do this and that" which seem trivial, but are not, eventually give the OP hours of frustration because they are stuck on some caveat.
type: AnswerComment

http://stackoverflow.com/q/26446741
tagged with: multiplication
type: Question
has title: Triangular Multiplication Table
accepted answer: http://stackoverflow.com/a/26446909
tagged with: java
upvote count: 2
has answer: http://stackoverflow.com/a/26446909
answer count: 1
has body: I'm new to Java. I'm trying to make a triangular multiplication table that looks somewhat like this: Enter # of rows 7 1 2 3 4 5 6 7 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 6 12 18 24 30 36 7 14 21 28 35 42 49 Each row/column has to be numbered, and I have no idea how to do this. My code is seemingly waaay off, as I get an infinite loop that doesn't contain the correct values. Below you will find my code. public class Prog166g { public static void main(String args[]) { int userInput, num = 1, c, d; Scanner in = new Scanner(System.in); System.out.print("Enter # of rows "); // user will enter number that will define output's parameters userInput = in.nextInt(); boolean quit = true; while(quit) { if (userInput &gt; 9) { break; } else { for ( c = 1 ; c &lt;= userInput ; c++ ) { System.out.println(userInput*c); for (d = 1; d &lt;= c; d++) // nested loop required to format numbers and "triangle" shape { System.out.print(EasyFormat.format(num,5,0)); } } } } quit = false; } } EasyFormat refers to an external file that's supposed to format the chart correctly, so ignore that. If someone could please point me in the right direction as far as fixing my existing code and adding code to number the columns and rows, that would be greatly appreciated!
favorite count: 0
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/26368594
has body: I deleted a lot of code not relevant to the GUI and had to change the addTab method definition because tabbedPane wasn't visible. It works fine: public class Example { @SuppressWarnings("serial") private static void initialize() { JFrame frmLoganalyzer = new JFrame(); frmLoganalyzer.setTitle("LogAnalyzer"); frmLoganalyzer.setBounds(100, 100, 450, 300); frmLoganalyzer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); frmLoganalyzer.getContentPane().add(tabbedPane); JPanel systemLogTab = new JPanel(); tabbedPane.addTab("System Log", null, systemLogTab, null); systemLogTab.setLayout(new BorderLayout()); JList list = new JList(); JScrollPane listScroller = new JScrollPane(list); systemLogTab.add(listScroller); frmLoganalyzer.setVisible(true); } private static void initialize2() { JFrame frmLoganalyzer = new JFrame(); frmLoganalyzer.setTitle("LogAnalyzer"); frmLoganalyzer.setBounds(100, 100, 450, 300); frmLoganalyzer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tabbedPane = new JTabbedPane(); frmLoganalyzer.getContentPane().add(tabbedPane); addTab("System Log", tabbedPane); frmLoganalyzer.setVisible(true); } public static void addTab(String tabName, JTabbedPane tabbedPane) { JPanel systemLogTab = new JPanel(); tabbedPane.addTab(tabName, null, systemLogTab, null); systemLogTab.setLayout(new BorderLayout()); JList list = new JList(); JScrollPane listScroller = new JScrollPane(list); systemLogTab.add(listScroller); } public static void main(String[] args) { initialize(); // call initialize2() and see that it's the same } }
type: Answer
accepted answer of: http://stackoverflow.com/q/26364015
answers question: http://stackoverflow.com/q/26364015
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/41422978

http://stackoverflow.com/comment/41636867
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26502043
has text: @AleksandrM thank you, I tried it now. But the results are same.
score: 0

http://stackoverflow.com/comment/84320569
comment on: http://stackoverflow.com/q/26384245
score: 0
type: QuestionComment
has text: Titles should be questions, or at least describe the subject of the question in sufficient detail.
type: Comment

http://stackoverflow.com/a/26440806
type: Answer
answers question: http://stackoverflow.com/q/26439839
accepted answer of: http://stackoverflow.com/q/26439839
score: 0
type: AcceptedAnswer
has body: I tested your code and works without any issue however you can try using if statement. Also make sure your switch statement return true or break; tho it works without using any of them; here how you can use if statement: if(event.getAction() == MotionEvent.ACTION_UP){ // up is called touch++; Log.i("info", "touch # " + touch); return true; }

http://stackoverflow.com/comment/41535291
type: QuestionComment
comment on: http://stackoverflow.com/q/26446348
type: Comment
has text: @afzalex: This doesn't have anything to do with equals() -- the poster explicitly wants to know if strings are _similar_, not _equal_.
score: 3

http://stackoverflow.com/a/26536797
upvote count: 3
has body: If the jar is part of the application server environment/build I would not add it to the war/ear file. It should be availble through out all the env DIT/UAT/PROD (envs need to be consistent with prod). Also when the app serever fixes are applied or server is upgaded we will be using the lastest jar. In other cases(external) it would be best to package it in war in order to avoid issues while migrating from env to env.
accepted answer of: http://stackoverflow.com/q/26371010
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26371010
type: Answer
score: 3

http://stackoverflow.com/q/26393644
has body: I have a program, that processes an input file, and allows actions to be performed on the resulting dataset. Due to the nature of the application, the memory footprint is pretty huge - several GB. The program works great 90% of the time, however certain input files cause an unreasonable amount of time to be spent in garbage collection. Essentially the program spends a lot of time creating objects that dont get used until the process is complete, at which point they are used. Essentially the memory keeps growing initially, then remains pretty constant. About 3 minutes into running the applications runtime, 99.9% of the time is spent on garbage collection, however there is almost no garbage to be collected (I have already checked for memory leaks). This seems to happen when approx 85% of the heap space is used and the heap stops growing. I don't know if the heap stops growing because no memory is availalble, or because the GC is taking too much time. I set a 5GB limit on heap space, and it grows to 3.6 before stalling. My question is this. Given that I KNOW I have no (or very few memory leaks) and I know that my application will require a huge amount of memory, can I turn off, or at least reduce the aggressiveness of GC?
type: Question
has comment: http://stackoverflow.com/comment/41444196
has comment: http://stackoverflow.com/comment/41442607
has comment: http://stackoverflow.com/comment/41459510
has comment: http://stackoverflow.com/comment/41440107
answer count: 0
has comment: http://stackoverflow.com/comment/41440026
has title: Java - Reducing time spent in garbage collection
type: UnansweredQuestion
tagged with: garbage-collection
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/87600616

http://stackoverflow.com/q/26366806
score: 1
tagged with: java
has title: No mapping found for HTTP request with URI (spring 4.1 annotation configuration)
has comment: http://stackoverflow.com/comment/41391713
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41391997
favorite count: 0
has comment: http://stackoverflow.com/comment/41391561
has body: first of all, please don't lock this thread, please. I've read all the questions, and they still cannot solve my problem. I'm studying how to use annotation on spring without configuring xml files. I'm stucking with the error: No mapping found for HTTP request with URI [/WEB-INF/index.jsp] in DispatcherServlet with name 'dispatcherServlet' This is the project structure This my pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany spring-sample 1.0 war spring-sample <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.springframework.boot spring-boot-starter-parent 1.2.0.M2 javax javaee-web-api 7.0 provided org.springframework spring-context org.springframework.boot spring-boot-starter-web spring-milestones Spring Milestones http://repo.spring.io/milestone false spring-snapshots http://repo.spring.io/snapshot spring-milestones http://repo.spring.io/milestone org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 ${endorsed.dir} org.apache.maven.plugins maven-war-plugin 2.3 false org.apache.maven.plugins maven-dependency-plugin 2.6 validate copy ${endorsed.dir} true javax javaee-endorsed-api 7.0 jar org.springframework.boot spring-boot-maven-plugin repackage This is configuration class: @ComponentScan(basePackages = "com.sample.spring") @EnableAutoConfiguration @EnableWebMvc @org.springframework.context.annotation.Configuration public class MainApp extends WebMvcConfigurerAdapter implements WebApplicationInitializer { @Override public void onStartup(ServletContext sc) throws ServletException { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(MainApp.class); // Manage the lifecycle of the root application context sc.addListener(new ContextLoaderListener(rootContext)); ServletRegistration.Dynamic registration = sc.addServlet("dispatcher", new DispatcherServ…
has comment: http://stackoverflow.com/comment/41392237
has comment: http://stackoverflow.com/comment/41391400
tagged with: maven
has answer: http://stackoverflow.com/a/26378215
accepted answer: http://stackoverflow.com/a/26378215
has comment: http://stackoverflow.com/comment/41391043
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-boot
tagged with: spring-4
downvote count: 0
has comment: http://stackoverflow.com/comment/41391601

http://stackoverflow.com/q/26493273
has comment: http://stackoverflow.com/comment/41620342
tagged with: bliki
score: 0
has comment: http://stackoverflow.com/comment/41620239
has answer: http://stackoverflow.com/a/26493483
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41620469
tagged with: java
has body: I'm trying to use Bliki to access and parse wiki pages. I just downloaded the zip file and put the bliki-core-3.0.19.jar into my eclipse build path. However, when I tried to connect using sample code. there was an error. The sample code is here: public static void test(){ String pageName = "File:Mona Lisa.jpg"; User user = new User("", "", "http://en.wikipedia.org/w/api.php"); Connector con = new Connector(); user = con.login(user); List&lt;Page&gt; pages = user.queryImageinfo(new String[]{pageName}); if(pages != null) System.out.println(pages.size()); } And I got errors as: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod at info.bliki.api.User.&lt;init&gt;(User.java:98) at info.bliki.api.User.&lt;init&gt;(User.java:71) at main.wiki.WikiCall.test(WikiCall.java:23) at main.wiki.WikiCall.main(WikiCall.java:32) Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.HttpMethod at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 4 more It seems like I'm missing the http jar for the connection, but there's no one the zip file and i thought the bliki-core.jar should contain it. Any suggestions?
tagged with: lang
has answer: http://stackoverflow.com/a/26493694
tagged with: https
type: Question
answer count: 2
has title: Java NoClass Found Error

http://stackoverflow.com/comment/41479588
comment on: http://stackoverflow.com/q/26415648
has text: Hmm I was thinking on similar line
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41523733
comment on: http://stackoverflow.com/q/26439389
has text: Did that but still the same!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26477124
answers question: http://stackoverflow.com/q/26473453
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/41592290
upvote count: 0
score: -1
has body: getTags() this might return an iterable with "name", "address", "manager", "employeeid"." https://developers.google.com/gdata/javadoc/com/google/gdata/data/spreadsheet/CustomElementCollection#getTags() Example - ListDemo.java public void printAndCacheEntry(ListEntry entry) { // We only care about the entry id, chop off the leftmost part. // I.E., this turns http://spreadsheets.google.com/..../cpzh6 into cpzh6. String id = entry.getId().substring(entry.getId().lastIndexOf('/') + 1); // Cache all displayed entries so that they can be updated later. entriesCached.put(id, entry); out.println("-- id: " + id + " title: " + entry.getTitle().getPlainText()); for (String tag : entry.getCustomElements().getTags()) { out.println(" &lt;gsx:" + tag + "&gt;" + entry.getCustomElements().getValue(tag) + "&lt;/gsx:" + tag + "&gt;"); } } http://gdata-java-client.googlecode.com/svn-history/r497/trunk/java/sample/spreadsheet/list/ListDemo.java I have never used this, so not 100% sure. But looks like what you want.

http://stackoverflow.com/a/26428230
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26426694
score: 1
has body: As says your stacktrace Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.tests.test2.Size] is defined: expected single matching bean but found 2: size1,size2 Spring can't match a single bean to inject because he find 2 beans that could using, for this reason will thrown this exception. Exception thrown when a BeanFactory is asked for a bean instance for which multiple matching candidates have been found when only one matching bean was expected. Reference of Exception Anyway you're using this thing in the wrong way, because there isn't any bean with id="small" You must change @Qualifier("small") to @Qualifier("size1") or @Qualifier("size2").
type: Answer

http://stackoverflow.com/a/26468355
has body: Maybe I'm misinterpreting what you want, but it sounds like you may be better off using an ExecutorService to actually run things. You can create those using Exectors.newSingleThreadExecutor() or Executors.newFixedThreadPool(2) (2 being an example of the number of threads for it to use). You can then either .execute or .submit Runnables on the ExecutorService. submit will return a Future&lt;T&gt; object that can be used to track the status of a particular job submitted to an ExecutorService. Having said that, you may need to create a new class to do it as the Runnable / Callable class would need to have a FileToFTP variable in it. (Side note: I try to avoid inner classes, so if you're wondering why I didn't suggest doing it that way...) The problem then becomes "how do I tell how many files are pending?" Unfortunately, the only easy way is to make it a static property of another class... with either static get/set methods or as a public/protected property. An AtomicInteger is ideal for this, so you may want to consider using one as a protected static one in your calling class. It has dedicated increment/decrement commands as well as ones that both adjust the value and return it.
answers question: http://stackoverflow.com/q/26466855
upvote count: 1
has comment: http://stackoverflow.com/comment/41878201
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26464984
has comment: http://stackoverflow.com/comment/41568458
has title: Why im getting NullPointerException in this specific case?
tagged with: exception
tagged with: matrix
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41568440
has answer: http://stackoverflow.com/a/26465104
has answer: http://stackoverflow.com/a/26465164
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26465070
has body: I don't know why im getting a NPE while consulting if a position of a 2darray of objects (cells) is empty or not. Im checking this by if ((matrix[i][j]) == null) and i've tried if ((matrix[i][j]) != null) but im getting the NPE again and again. I want to know how i check it without that NPE... public class 2darrayofcells { //rows and columns are final by requirement private final int rows; private final int colums; private Cell[][] matrix; //the array needs an initial object private Cell initialCell; //Position class consist on 2 integers (x,y) public 2darrayofcell(Position pos){ //the arg pos is used to create the initial cell in the specified position of the array rows = 10; columns = 10; matrix = new Cell[rows][columns]; initialCell = new Cell(); matrix[pos.getX()][pos.getY()] = initialCell; } . . . //Here i put a cell in a position of the array but before putting it //i need to know if it's empty. It will return true if the cell is added to //that position public boolean putCell(Cell cell, Position pos){ //Null Pointer Exception if (matrix[pos.getX()][pos.getY()] == null) { //Do stuff return true; } return false; } } The main class... public static void main(String[] args) { Position pos = new Position(5,5); 2darrayofcells test = new 2darrayofcells(pos); //test only has an object in 5,5 //The position for the cell i want to insert (3,3) is empty Position cellPos = new Position(3,3); Cell testCell = new Cell(); test.putCell(testCell, cellpos); } The matrix got its initialization...
score: 0
has comment: http://stackoverflow.com/comment/41568722
has comment: http://stackoverflow.com/comment/41568125
answer count: 3
possible better answer: http://stackoverflow.com/a/26465070
tagged with: null
accepted answer: http://stackoverflow.com/a/26465104
tagged with: pointers

http://stackoverflow.com/comment/41411050
score: 0
type: Comment
type: QuestionComment
has text: mytag attr1=`\\`"20258044753052856\" where have matched this `\\`
comment on: http://stackoverflow.com/q/26377954

http://stackoverflow.com/a/26397843
type: Answer
has comment: http://stackoverflow.com/comment/41463137
has body: If you are using an array of Studentdetails then you have to use that array on your form declaration on the modelAndAttribute field, and then using a foreach to iterate everyone, and using the index. &lt;form:form id="" method="post" action="" modelAttribute="studentdetail"&gt; &lt;form:input type="text" id="" path="studentdetail.st.fname"/&gt; &lt;/form:form&gt;
score: 0
answers question: http://stackoverflow.com/q/26396052
has comment: http://stackoverflow.com/comment/41450066
has comment: http://stackoverflow.com/comment/41461404

http://stackoverflow.com/comment/41460137
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26390186
has text: That would do it. That is also why I mentioned that you need to be using jpa-2.0.

http://stackoverflow.com/comment/41492846
type: Comment
type: QuestionComment
has text: When modifying the property, you are putting the old value at the end of the new value. This implies that your handler is attempted to be queried first, but for loading your class, the URL of your class has to be opened, so the JRE tries to find a handler and will attempt your handler first, so your class must be loaded, but for that the URL of your class has to be opened, so the JRE tries to find a handler and will attempt your handler first, so your class must be loaded, but for that the URL of your class has to be opened, so the JRE tries to find a handler and will attempt your handler fir…
comment on: http://stackoverflow.com/q/26363573
score: 0

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

sockets
tags question: http://stackoverflow.com/q/26380333
tags question: http://stackoverflow.com/q/26374781
tags question: http://stackoverflow.com/q/26442284
tags question: http://stackoverflow.com/q/26493360
tags question: http://stackoverflow.com/q/26396579
tags question: http://stackoverflow.com/q/26452212
tags question: http://stackoverflow.com/q/26470140
tags question: http://stackoverflow.com/q/26488063
tags question: http://stackoverflow.com/q/26440461
tags question: http://stackoverflow.com/q/26445243
tags question: http://stackoverflow.com/q/26440670
tags question: http://stackoverflow.com/q/26467964
tags question: http://stackoverflow.com/q/26489349
tags question: http://stackoverflow.com/q/26496719
tags question: http://stackoverflow.com/q/26450519
tags question: http://stackoverflow.com/q/26511950
tags question: http://stackoverflow.com/q/26459002
tags question: http://stackoverflow.com/q/26371454
tags question: http://stackoverflow.com/q/26443872
tags question: http://stackoverflow.com/q/26509366
tags question: http://stackoverflow.com/q/26416001
tags question: http://stackoverflow.com/q/26447671
type: Tag
tags question: http://stackoverflow.com/q/26481164
tags question: http://stackoverflow.com/q/26362373
tags question: http://stackoverflow.com/q/26422107
tags question: http://stackoverflow.com/q/26430425
tags question: http://stackoverflow.com/q/26373333
tags question: http://stackoverflow.com/q/26386220
tags question: http://stackoverflow.com/q/26384639
tags question: http://stackoverflow.com/q/26378807
tags question: http://stackoverflow.com/q/26373145
tags question: http://stackoverflow.com/q/26448973
tags question: http://stackoverflow.com/q/26504972
tags question: http://stackoverflow.com/q/26478647
tags question: http://stackoverflow.com/q/26454348
tags question: http://stackoverflow.com/q/26479207
tags question: http://stackoverflow.com/q/26379452
tags question: http://stackoverflow.com/q/26415934
tag name: sockets
tags question: http://stackoverflow.com/q/26418061
tags question: http://stackoverflow.com/q/26423346
tags question: http://stackoverflow.com/q/26464074
tags question: http://stackoverflow.com/q/26409766
tags question: http://stackoverflow.com/q/26407417
tags question: http://stackoverflow.com/q/26387726
tags question: http://stackoverflow.com/q/26452656
tags question: http://stackoverflow.com/q/26456071
tags question: http://stackoverflow.com/q/26500522
tags question: http://stackoverflow.com/q/26493388
tags question: http://stackoverflow.com/q/26452710
tags question: http://stackoverflow.com/q/26489168

http://stackoverflow.com/a/26408696
score: 1
answers question: http://stackoverflow.com/q/26408642
upvote count: 1
has comment: http://stackoverflow.com/comment/41466143
downvote count: 0
has body: Primitive types, like int, long, boolean, float, or in your case double (note the lowercase first letter), are not objects, and as such, they have no methods. When you do val.getVal(), you're trying to invoke a method on a primitive type. EDIT: the comparison in this case is much simpler: if (val &gt; PublicStock) Remember: primitives are NOT objects, they directly hold the value.
type: Answer

http://stackoverflow.com/a/26488037
accepted answer of: http://stackoverflow.com/q/26487976
answers question: http://stackoverflow.com/q/26487976
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/41610645
score: 3
has body: The Stack class is already generic, but in order make the transfer method generic, you have to do: public static &lt;E&gt; Stack&lt;E&gt; transfer(Stack&lt;E&gt; s) { Stack&lt;E&gt; t = new Stack&lt;E&gt;(); return t; }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41442736
comment on: http://stackoverflow.com/q/26395436
has text: @AlexLockwood Do you have an example I could be pointed to?
type: Comment
type: QuestionComment
score: 0

append
tags question: http://stackoverflow.com/q/26504146
tags question: http://stackoverflow.com/q/26409461
tag name: append
type: Tag

http://stackoverflow.com/q/26432043
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26432130
has comment: http://stackoverflow.com/comment/41509005
has answer: http://stackoverflow.com/a/26432405
accepted answer: http://stackoverflow.com/a/26432405
answer count: 6
has comment: http://stackoverflow.com/comment/41509130
has comment: http://stackoverflow.com/comment/41508756
has comment: http://stackoverflow.com/comment/41508793
has comment: http://stackoverflow.com/comment/41518841
has comment: http://stackoverflow.com/comment/41515131
possible better answer: http://stackoverflow.com/a/26432230
favorite count: 0
has comment: http://stackoverflow.com/comment/41509001
has title: Java - calling a void function without semicolons (;)
has answer: http://stackoverflow.com/a/26432230
has body: I want to call a function without using semicolons, is that possible? Ex: void myFunction(){ } I want to call it without using semicolons. If the function would be something else than void I could write if(myfunction() != null) { } How can I do something similar with a void function?
has comment: http://stackoverflow.com/comment/41509012
has answer: http://stackoverflow.com/a/26432101
has answer: http://stackoverflow.com/a/26432633
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41509575
downvote count: 3
score: -1
has answer: http://stackoverflow.com/a/26432122

http://stackoverflow.com/comment/41544183
type: Comment
comment on: http://stackoverflow.com/a/26451371
has text: Thanks for your answer, as i said i was pretty confused but now i am sure :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41389363
score: 0
type: QuestionComment
has text: I've not seen a `<SpringLogger>` element anywhere. Why don't you declare a normal `<logger>` with `name="org.springframework"` (note no `*`)?
type: Comment
comment on: http://stackoverflow.com/q/26365942

http://stackoverflow.com/comment/41372315
comment on: http://stackoverflow.com/a/26356260
type: Comment
has text: because of boolean type It gives me error what if I add !=0 `mealunit.setBreakfast((c.getInt(c.getColumnIndex(KEY_BREAKFAST)))!=0);`?
type: AnswerComment
score: 0

http://stackoverflow.com/a/26445554
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26445499
answers question: http://stackoverflow.com/q/26445499
has comment: http://stackoverflow.com/comment/41533773
has body: Map is good in storing values like this. For example this code : int playerCharacter; Map&lt;Integer, String&gt; characters = new HashMap&lt;Integer, String&gt;(); characters.put(1, "Fighter"); characters.put(2, "Mage"); characters.put(3, "Rogue"); playerCharacter = 2; //This is what you get from input System.out.println("You are: " + characters.get(playerCharacter)); Has this output: You are: Mage You can use map for iteration too : System.out.println("Please select the character you would like to play:"); for (Entry&lt;Integer, String&gt; character : characters.entrySet()) { System.out.println(character.getKey() + ": " + character.getValue()); } Has this output : Please select the character you would like to play: 1: Fighter 2: Mage 3: Rogue
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41534440
score: 1
has comment: http://stackoverflow.com/comment/41533961
type: AcceptedAnswer

http://stackoverflow.com/comment/41600685
has text: I have noticed that I get this exception if I run my wizard in the empty workspace for the first time, so the wizard probably tries to load an image for project folder. If I create another projects before running my wizard the exception doesn't appear.
comment on: http://stackoverflow.com/a/26481558
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26396722
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41444931
has title: how to invoke different controller in the same form
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26396994
score: 0
has body: I am newbie to spring framework.My requirement is,i have a form it has start date and end date textfield and two submit buttons,i invoke two separate controller for the button click.But form tag accepts only one action attribute.I do this in struts2 by using formaction attribute in button tag.But i don't know how to do it in spring? Below is my code Start Date End Date Any help will be greatly appreciated!!!
answer count: 1

http://stackoverflow.com/q/26500477
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41633082
type: Question
has comment: http://stackoverflow.com/comment/41633157
has title: Is it possible to run Message Dialog Box java in Mac's Terminal?
has body: Here is a simple Java program from textbook import javax.swing.JOptionPane; public class WelcomeInMessageDialogBox{ public static void main(String[] args){ // Display Welcome JOptionPane.showMessageDialog(null,"Welcome to Java!"); } } And I put WelcomeInMessageDialogBox.java on the desktop, and then at Terminal, I type javac WelcomeInMessageDialogBox.java java WelcomeInMessageDialogBox And it returns this Exception in thread "main" java.lang.NoClassDefFoundError: WelcomeInMessageDialogBox Caused by: java.lang.ClassNotFoundException: WelcomeInMessageDialogBox at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) What's going on? I have no problem with Hello World.java, is that possible to run Dialog Box java program in Mac's Terminal?
score: 0
has comment: http://stackoverflow.com/comment/41633339
has comment: http://stackoverflow.com/comment/41633227
has comment: http://stackoverflow.com/comment/41633438
tagged with: macos
has comment: http://stackoverflow.com/comment/41633166
has comment: http://stackoverflow.com/comment/41633133
has comment: http://stackoverflow.com/comment/41633292
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41633237
has comment: http://stackoverflow.com/comment/41633453

http://stackoverflow.com/q/26504267
tagged with: java
has answer: http://stackoverflow.com/a/26505146
has body: I am trying to authenticate a user on login using Spring Security 3.2.5 This is a simple task and I managed to find many examples how to do so. My problem is that in my database, a user is unique by (username and group). I need to provide both values to my custom UserDetailsService in order to retrieve a user. Can someone please guide me to the best solution in this case? Here is what I came up with so far (I am confused so excuse me if I am mistaken) By creating a custom authenticationProvider and perform user database checking in the authenticate method. Basically, moving my loadByUserName implementation from MyUserDetailsService to authenticate methode in MyAuthenticationProvider. public class MyAuthenticationProvider implements AuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String name = ... String password = ... String group = ... ....//I am not sure how to do it though } @Override public boolean supports(Class&lt;?&gt; authentication) { return authentication.equals(MyUsernamePasswordGroupAuthenticationToken.class); } } May be by passing multiple parameters to loadUserByName. I would like to have something like loadUserByNameAndGroud(String name, String group) but I have no idea how to make the custom authenticationProvider invoke loadUserByNameAndGroud instead of loadUserByName security.xml &lt;security:http use-expressions="true"&gt; &lt;security:custom-filter ref="myAuthenticationFilter" position="FORM_LOGIN_FILTER"/&gt; &lt;security:intercept-url pattern="/views/login*" access="isAnonymous()"/&gt; &lt;security:intercept-url pattern="/views/**" access="isAuthenticated()"/&gt; &lt;security:form-login login-page="/views/login.faces" default-target-url="/" username-parameter="username" password-parameter="password"/&gt; &lt;security:logout logout-url="/logout" delete-cookies="JSESSIONID"/&gt; &lt;/security:http&gt; &lt;security:authentication-manager&gt; &lt;security:authenti…
type: Question
upvote count: 2
has title: How to authenticate a user by multiple parameters and not just by name in Spring?
tagged with: spring-security
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26505342
downvote count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/26505500
score: 2

http://stackoverflow.com/comment/41452706
comment on: http://stackoverflow.com/q/26401369
type: Comment
type: QuestionComment
has text: you shouldn't even need to `cast` it in the first place
score: 1

http://stackoverflow.com/q/26363566
tagged with: java
has answer: http://stackoverflow.com/a/26370443
accepted answer: http://stackoverflow.com/a/26370443
score: 0
has answer: http://stackoverflow.com/a/26365923
has title: I can not select a link using class spam in Selenium
has body: I have the following command in HTML: ** Cadastro de cliente** Must select the page in the "Cadastro de cliente" item. I used the following command , but it did not work. WebElement menuCadCliente = driver.findElement(By.xpath("/html/body/div/form/div/div/div/div/div[1]/div[7]/div/div[6]/div/div[1]/div/div[1]/a/span")); menuCadCliente.click(); I'm New world of selenium webdriver , so I ask your help.
answer count: 4
tagged with: selenium-webdriver
possible better answer: http://stackoverflow.com/a/26363885
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26363885
tagged with: selenium
has answer: http://stackoverflow.com/a/26364114
type: Question

http://stackoverflow.com/a/26381877
type: AcceptedAnswer
score: 4
downvote count: 0
type: Answer
has body: That happens because of specific setting about imports in IDEA. Go to Settings - Code Style - Java - Imports and set 'Class count to use import with '*'' to whatever value you want.
accepted answer of: http://stackoverflow.com/q/26381796
upvote count: 4
answers question: http://stackoverflow.com/q/26381796

http://stackoverflow.com/comment/41413575
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26377568
has text: why ` !("blue".equalsIgnoreCase(this.color)`? Try debugger then.
type: AnswerComment

http://stackoverflow.com/comment/49720094
type: Comment
has text: Does your comment mean that Opaque spouts are relatively faster than Transactional ones?
comment on: http://stackoverflow.com/a/26510338
score: 0
type: AnswerComment

http://stackoverflow.com/q/26374326
favorite count: 0
accepted answer: http://stackoverflow.com/a/26374366
type: Question
score: -1
has body: I have created a program using Java that generates emirps by user input, but I need help on stopping the user when entering zero or a negative integer. I have tried many things but when I run the program with zero or a negative number it will go crazy and give me infinite amount of numbers. I would appreciate it if someone could help me on this. Here is what I got so far... import java.util.Scanner; public class GenerateEmirps { public static void main(String[] args) { Scanner scanner = new Scanner (System.in); System.out.print("Enter number of desired emirps: "); int emrips = scanner.nextInt(); int count = 1; for( int i = 2; ; i++){ if ((isPrime(i)) &amp;&amp; (isPrime(reverseIt(i))) &amp;&amp; (!isPalindrome(i))) { System.out.print(i + " "); if (count % 10 == 0) { System.out.println(); } if (count == emrips){ break; } count++; } } } public static boolean isPrime(int num){ for (int i = 2; i &lt;=num / 2; i++){ if (num % i == 0) { return false; } } return true; } public static int reverseIt(int num){ int result = 0; while (num != 0) { int lastDigit = num % 10; result = result * 10 + lastDigit; num /= 10; } return result; } public static boolean isPalindrome(int num){ return num == reverseIt(num); } }
downvote count: 1
tagged with: primes
answer count: 1
has answer: http://stackoverflow.com/a/26374366
tagged with: java
type: AnsweredQuestion
upvote count: 0
has title: Generating emirps stop when a user enters a zero or negative integer.

http://stackoverflow.com/comment/41570522
type: QuestionComment
score: 0
has text: Not sure, what you are trying to archive, have you looked at spring configuration separation with profiles?
comment on: http://stackoverflow.com/q/26463393
type: Comment

http://stackoverflow.com/q/26363682
tagged with: code-generation
has body: I am working on a project to generate some code in Eclipse. I found that CodeModel can generate Java Code for me, but how do I integrate this as a plug-in? How does Eclipse generate Code? Like getters and setters? My overall goal would be to generate my own code in Eclipse. Is there any API out there what I could use?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41385224
linked to: http://stackoverflow.com/q/12878710
score: 1
tagged with: java
favorite count: 0
tagged with: eclipse
type: Question
answer count: 2
upvote count: 1
has title: How does Eclipse generate code? Like Getters and Setters
has answer: http://stackoverflow.com/a/26724485
tagged with: eclipse-plugin
tagged with: eclipse-rcp
possible better answer: http://stackoverflow.com/a/26724485
linked to: http://stackoverflow.com/q/11166862
has comment: http://stackoverflow.com/comment/41385550
has answer: http://stackoverflow.com/a/26378019
accepted answer: http://stackoverflow.com/a/26378019
downvote count: 0

http://stackoverflow.com/q/26461598
tagged with: file-io
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41565219
accepted answer: http://stackoverflow.com/a/26461676
has comment: http://stackoverflow.com/comment/41565802
linked to: http://stackoverflow.com/q/5052311
tagged with: swing
has comment: http://stackoverflow.com/comment/41565696
tagged with: jfilechooser
type: Question
has answer: http://stackoverflow.com/a/26461676
has body: I need to use a JFileChooser in my simple Quiz game to load and save 'Question /Answer' sets , when the FileChooser window opens i want it to be in the current working directory, i want this to work in Linux,Windows and OSX, i am doubtful if the "user.dir" mehtod works in all platforms , Can someone help out , Code Below... For loading public class openMenuItemListener implements ActionListener { public void actionPerformed(ActionEvent e) { nextButton.setEnabled(true); JFileChooser fileChooser=new JFileChooser(); fileChooser.showOpenDialog(frame); loadFile(fileChooser.getSelectedFile()); } } For Saving: class saveMenuListener implements ActionListener { public void actionPerformed(ActionEvent e) { JFileChooser fileSave=new JFileChooser(); fileSave.showSaveDialog(frame); saveFile(fileSave.getSelectedFile()); } }//class ends
tagged with: java
has title: How to make JFileChooser open showing current working dirctory irrespective of Operating System used?
has comment: http://stackoverflow.com/comment/41565489
tagged with: cross-platform
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41565197

http://stackoverflow.com/a/26398078
answers question: http://stackoverflow.com/q/26398048
type: Answer
downvote count: 0
score: 5
has body: Assuming that your condition is correct, change: if((name!=null || address!=null)||(!(name.equals("")||address.equals("")))){ to: if((name!=null || address!=null)||(!("".equals(name)||"".equals(address)))){ Explanation: by using "".equals(name) you guarantee that even if name is null (which is possible since you're using || in the previous expression) the comparison will return false instead of NPE. Same goes for address.
upvote count: 5

http://stackoverflow.com/comment/41488902
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26421108
type: Comment
has text: is a Fragment and not an activity. The fragment have the onCreateView method

http://stackoverflow.com/comment/41536860
score: 0
type: Comment
type: QuestionComment
has text: Ah ok I see.. thanks for the info. I guess I'll just have to restart then.
comment on: http://stackoverflow.com/q/26447151

http://stackoverflow.com/comment/41487795
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26420776
has text: Thank you for your answer. Can one property have multiple groups? For example, groups ={A.class, B.classs}, like this

http://stackoverflow.com/comment/41572795
type: Comment
comment on: http://stackoverflow.com/q/26465593
type: QuestionComment
has text: Have you tried to debug the `SSL` Handshake. On *nix Systems you can use a tool like OpenSSL `OpenSSL s_client -connect www.test.com:443 -prexit` to see what's happening during the handshake. You can also try to trace the SSL Handshake on the Server side by setting the Java Options when you start your Application to `-Djavax.net.debug=all` `-Djavax.net.debug=ssl:handshake:data`. See also [Debugging SSL/TLS Connections](http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/ReadDebug.html)
score: 0

http://stackoverflow.com/comment/41419340
comment on: http://stackoverflow.com/q/26376172
type: Comment
has text: @Skizzo: I ran `mvn dependency:tree>tree.txt` but it's a very big file around 1000 lines.. are you looking for any specific info? I updated with dependency part of the result in my question
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41623249
score: 0
comment on: http://stackoverflow.com/a/26474662
type: Comment
has text: Thanks. I changed it to use MultiThreadedHttpConnectionManager and that solved the issue of Connection reset. I want to vote for your answer but unfortunately I don't have 15 reputation.
type: AnswerComment

http://stackoverflow.com/q/26449591
has comment: http://stackoverflow.com/comment/41541705
has comment: http://stackoverflow.com/comment/41542446
type: Question
has comment: http://stackoverflow.com/comment/41541868
tagged with: java
has answer: http://stackoverflow.com/a/26450666
has title: Logger4j throws ExceptionInInitiaizerError
has body: I am new to Log4j. I am experienced with Java though. I have written a small example to run a Log4j app. package com.log; import org.apache.log4j.Logger; public class Log4jExample { static Logger log = Logger.getLogger(Log4jExample.class.getName()); public static void main(String[] args) { log.debug("Hello, this is a debug message."); log.info("Hello, this is an info message."); } } And this is my log4j.properties file that I manually created in the $JAVA_HOME/jre/lib/ext/ directory. # Define the root logger with appender X log = /Users/aditya/Desktop/log4j log4j.rootLogger = DEBUG, FILE # Set the appender named X to be a File appender log4j.appender.FILE=org.apache.log4j.FileAppender log4j.appender.FILE.File=${log}/log.out # Define the layout for X appender log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.conversionPattern=%m%n I am on Mac OS X. I am running the code as: javac com/log/Log4jExample.java java com.log.Log4jExample But this is what I get. Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext at org.apache.log4j.Logger.getLogger(Logger.java:37) at com.log.Log4jExample.&lt;clinit&gt;(Log4jExample.java:13) What am I doing wrong? Please help.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41541826
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41542433
tagged with: log4j
has comment: http://stackoverflow.com/comment/41541892

http://stackoverflow.com/q/26384899
tagged with: servlets
score: 0
tagged with: sftp
has answer: http://stackoverflow.com/a/26386524
answer count: 1
type: AnsweredQuestion
tagged with: java
has title: How to read Jsch HostKey value from Database
has body: I have a Secure FTP set up in a Java servlet using Jsch and it is running on Windows and developed in Eclipse. So currently I have all the SFTP details, i.e. username etc in a database table to make them secure and configurable, except for the HostKey value from the Windows registry which I placed in a text file and the location of the text file I have as a field in the database. After I obtain the SFTP details as an object, the following code obtains the HostKey from the text file; String SFTPFile = SFTPD.getSftp_file(); jsch.setKnownHosts(SFTPFile); This works fine, but I want to read the HostKey in from the database as well because a text file is vulnerable to corruption, removal or tampering. I tried the following; InputStream IS = new ByteArrayInputStream(SFTPD.getSftp_hostkey().getBytes()); Channel channel = null; ChannelSftp channelsftp = null; JSch jsch = new JSch(); com.jcraft.jsch.Session session = jsch.getSession(SFTPUsername, SFTPHost, SFTPPort); try { session.setPassword(SFTPPassword); jsch.setKnownHosts(IS); session.connect(); channel = session.openChannel("sftp"); channel.connect(); channelsftp = (ChannelSftp)channel; But when debugging I get this error below. How do I resolve this and read the value in from the table? 15-Oct-2014 14:45:02 com.sun.xml.ws.transport.http.servlet.WSServletDelegate doGet SEVERE: caught throwable javax.xml.ws.WebServiceException: com.ctc.wstx.exc.WstxIOException: null at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:130) at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:285) at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:421) at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:99) at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:650) at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:263) at com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync (ServletAdapter.java:218) …
type: Question
accepted answer: http://stackoverflow.com/a/26386524

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26372092
tags question: http://stackoverflow.com/q/26475502
tags question: http://stackoverflow.com/q/26474594
tags question: http://stackoverflow.com/q/26422424
tags question: http://stackoverflow.com/q/26456147
tags question: http://stackoverflow.com/q/26488408
type: Tag
tags question: http://stackoverflow.com/q/26500598
tags question: http://stackoverflow.com/q/26501599
tags question: http://stackoverflow.com/q/26511329
tags question: http://stackoverflow.com/q/26498103
tags question: http://stackoverflow.com/q/26498792
tags question: http://stackoverflow.com/q/26433278
tags question: http://stackoverflow.com/q/26434449
tags question: http://stackoverflow.com/q/26435930
tags question: http://stackoverflow.com/q/26372920
tags question: http://stackoverflow.com/q/26375302

http://stackoverflow.com/a/26418544
score: 1
upvote count: 1
has body: And yes, you can pack the table/tree too. for (final TreeColumn item : tree.getColumns()) { item.pack(); } for (final TableColumn item : table.getColumns()) { item.pack(); } Which is quite similar to the CTRL+NUM-PAD '+' Keycode on Windows.
downvote count: 0
answers question: http://stackoverflow.com/q/26408690
type: Answer

http://stackoverflow.com/comment/41430399
has text: Thanks so much for catching this master Lowagie. You are the man! I just upgraded from iText 2.1.1 to 5.5.3 and the upgrade was very painless. Sorry to see your name go from the package. The right thing to do, but you deserved the credit.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26376099
score: 1

http://stackoverflow.com/a/26392468
upvote count: 72
type: Answer
has comment: http://stackoverflow.com/comment/41473603
has comment: http://stackoverflow.com/comment/41491122
has comment: http://stackoverflow.com/comment/41512439
answers question: http://stackoverflow.com/q/26375932
has comment: http://stackoverflow.com/comment/41585509
has comment: http://stackoverflow.com/comment/41528596
has body: Computer multiplication is really happening modulo 2^32. Once you have accumulated enough powers of two in the multiplicand, then all values will be 0. Here we have all the even numbers in the series, along with the maximum power of two that divides the number, and the cumulative power of two num max2 total 10 2 1 12 4 3 14 2 4 16 16 8 18 2 9 20 4 11 22 2 12 24 8 15 26 2 16 28 4 18 30 2 19 32 32 24 34 2 25 36 4 27 38 2 28 40 8 31 42 2 32 The product up to 42 is equal to x * 2^32 = 0 (mod 2^32). The sequence of the powers of two is related to Gray codes (among other things), and appears as https://oeis.org/A001511. EDIT: to see why other responses to this question are incomplete, consider the fact that the same program, restricted to odd integers only, would not converge to 0, despite all the overflowing.
downvote count: 0
score: 72

http://stackoverflow.com/q/26409869
type: Question
has answer: http://stackoverflow.com/a/26410089
upvote count: 2
tagged with: java
answer count: 2
tagged with: thread-safety
tagged with: collections
has title: Is a readonly EnumSet iterator thread safe?
type: UnansweredQuestion
has body: I have an EnumSet which is final and immutable i.e. initialized once in the constructor. Is the contains() method on this EnumSet thread safe? It is internally using an iterator to make the contains check. Hence if two threads are simultaneously calling the contains() can the iterator position in one call effect other one? Or are the iterators having different instances in these two thread calls?
has answer: http://stackoverflow.com/a/26409943
score: 2
downvote count: 0
favorite count: 0
tagged with: enumset

http://stackoverflow.com/q/26513564
accepted answer: http://stackoverflow.com/a/26514551
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/16622843
downvote count: 0
has answer: http://stackoverflow.com/a/26514551
has answer: http://stackoverflow.com/a/50977858
tagged with: android
has body: How do i create a key store file in android studio? Its my first time publishing an app for android studio and I dont know what a key store file is and dont know how to use it. How do i make one for android studio instead of eclipse because when i search on google I only get results for making one for eclipse unless its exactly the same with android studio? When i tried to make a key store and entered a random file for the key store path i got the error: keytool error: java.lang.Exception: Keystore file exists, but is empty: C:\Users\king__000\Documents\KeyStore
has title: How do i create a key store file in android studio?
favorite count: 0
possible better answer: http://stackoverflow.com/a/50977858

compare
tags question: http://stackoverflow.com/q/26500492
tag name: compare
tags question: http://stackoverflow.com/q/26449040
tags question: http://stackoverflow.com/q/26357112
tags question: http://stackoverflow.com/q/26496487
tags question: http://stackoverflow.com/q/26490633
tags question: http://stackoverflow.com/q/26374838
type: Tag
tags question: http://stackoverflow.com/q/26393347
tags question: http://stackoverflow.com/q/26371108

performance
tags question: http://stackoverflow.com/q/26410554
tags question: http://stackoverflow.com/q/26406014
tags question: http://stackoverflow.com/q/26368982
tags question: http://stackoverflow.com/q/26476669
tags question: http://stackoverflow.com/q/26410622
tags question: http://stackoverflow.com/q/26495841
tags question: http://stackoverflow.com/q/26418087
tags question: http://stackoverflow.com/q/26430595
tags question: http://stackoverflow.com/q/26496753
tags question: http://stackoverflow.com/q/26431093
tags question: http://stackoverflow.com/q/26374896
tags question: http://stackoverflow.com/q/26462566
tags question: http://stackoverflow.com/q/26475030
tags question: http://stackoverflow.com/q/26441804
tags question: http://stackoverflow.com/q/26384192
tags question: http://stackoverflow.com/q/26361390
tags question: http://stackoverflow.com/q/26388414
tags question: http://stackoverflow.com/q/26392015
tag name: performance
tags question: http://stackoverflow.com/q/26365457
tags question: http://stackoverflow.com/q/26456445
tags question: http://stackoverflow.com/q/26389413
tags question: http://stackoverflow.com/q/26484988
type: Tag
tags question: http://stackoverflow.com/q/26491815
tags question: http://stackoverflow.com/q/26455105
tags question: http://stackoverflow.com/q/26405229
tags question: http://stackoverflow.com/q/26374984
tags question: http://stackoverflow.com/q/26390570
tags question: http://stackoverflow.com/q/26380982

http://stackoverflow.com/q/26431111
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: ui-automation
type: Question
tagged with: rft
has body: The RFT Test Object is not able to identify individual Web elements in any browser. So far tested in IE9 and Chrome 32.0 . I have tried cleaning out all java versions but it did not work.It works in my laptop with the same setting but not in my dektop. Anyone any ideas. MY RFT version:- 8.5.1 IE version:-9 Java version installed in machine:-1.7.0_60-ea The Object Inspector just shows screen coordinates when I am expecting something like "Html.A" for a link for .class property and so on....
has title: RFT does not recognize webelements
has answer: http://stackoverflow.com/a/26458647
score: 0

http://stackoverflow.com/a/26452870
has body: The error message is clear though. Your JLabel called lbl_mem_select is only attached to a horizontal group: GL.setHorizontalGroup(GL.createSequentialGroup() .addGroup(GL.createParallelGroup(LEADING) .addComponent(lbl_mem_settings) .addComponent(lbl_mem_select)) //here you attach the label .addGroup(GL.createParallelGroup(LEADING) .addComponent(cb_mem_select)) ); However, in your vertical group you did not include the label. Changing the code for the vertical group to GL.setVerticalGroup(GL.createSequentialGroup() .addGroup(GL.createParallelGroup(BASELINE) .addComponent(lbl_mem_settings) .addComponent(lbl_mem_select)) //add this line .addGroup(GL.createParallelGroup(BASELINE) .addComponent(lbl_mem_settings) .addComponent(cb_mem_select)) ); should do it. That being said ... do you really want to use the GroupLayout to hand-code a UI. A quote from the GroupLayout tutorial GroupLayout is a layout manager that was developed for GUI builders such as Matisse, the GUI builder provided with the NetBeans IDE While it is possible to hand-code a layout with it, it requires quite a lot of (unreadable imho) code to do it. There are other (third party) layout managers which are better suited for handcoding a layout.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26452809
type: Answer
answers question: http://stackoverflow.com/q/26452809
downvote count: 0
score: 1

http://stackoverflow.com/q/26459271
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26459552
has body: I have three run arguments that are min width, max width and the text file name. The text files are filled with one long string of random characters. I want to put each character into a grid spot. But all I get back is the string itself from the file. How do I make the grid? class GridCipher{ static int minGridWidth; static int maxGridWidth; static File inputFile; public static void main(String[] args) throws FileNotFoundException { if (handleArguments(args)) processInput(); } static final String usage = "Usage: GridWriter min_width max_width input_file_name"; static boolean handleArguments(String[] args) { // Check for correct number of arguments if (args.length != 3) { System.out.println("Wrong number of command line arguments."); System.out.println(usage); return false; } try { minGridWidth = Integer.parseInt(args[0]); maxGridWidth = Integer.parseInt(args[1]); } catch (NumberFormatException ex) { System.out.println("min_width and max_width must be integers."); System.out.println(usage); return false; } inputFile = new File(args[2]); if (!inputFile.canRead()) { System.out.println("The file " + args[2] + " cannot be opened for input."); return false; } return true; } static void processInput() throws FileNotFoundException { Scanner input = new Scanner(inputFile); String line = input.nextLine(); int length = line.length(); // number of characters. // Try each width in the appropriate range for (int width = minGridWidth; width &lt;= maxGridWidth; width++) { // Determine heigth of grid int height = line.length() / width; // Add one to height if there's a partial last row if (line.length() % width != 0) height += 1; loadUnloadGrid(line, width, height); } } static void loadUnloadGrid(String line, int width, int height) { char grid[][] = new char[height][width]; // Determine number long columns int longColumn = line.length() % width; if (longColumn == 0) longColumn = width; //Load the input data into the grid by column int charCount = 0; for (int c = 0; c &lt; width; c++…
has comment: http://stackoverflow.com/comment/41558289
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41558335
upvote count: 1
type: Question
has title: Make a Grid from a string in a text file
has comment: http://stackoverflow.com/comment/41558267
answer count: 2
has answer: http://stackoverflow.com/a/26459717
downvote count: 0

http://stackoverflow.com/q/26483374
favorite count: 0
has body: I am trying to use Spring Batch in a Java EE container (Websphere 8.0) I got it working so far, but I'd like it to use a container-provided datasource and transaction manager. (I am using a derby database instead of the default hsql-db) I copied the baseContext.xml from the spring-batch-core.jar to my classpath, and changed the beans for dataSource and transactionManager. (see below) It seems to work as far as it seems to be able to start a transaction and access the database, but then it fails with a timeout ("could not obtain IDENTITY value"). Has anyone managed to use a Java EE dataSource with spring batch? I could find nothing online, and the spring batch documentation does not even contain the word "JEE". This is my adapted baseContext.jar. The original bean definitions for dataSource and transaction manager have been comented out: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> <tx:jta-transaction-manager /> <jee:jndi-lookup id="dataSource" jndi-name="jbatchSampleDB" expected-type="javax.sql.DataSource" lookup-on-startup="true" cache="true" /> <batch:job-repository data-source="dataSource" id="jobRepository" transaction…
tagged with: spring-batch
has title: How to make Spring batch play nice in Java EE container
downvote count: 0
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: websphere-8
type: Question
upvote count: 1

http://stackoverflow.com/comment/41589004
comment on: http://stackoverflow.com/q/26475889
score: 1
has text: You can always have a separate class to hold the values and use that object everywhere in your application. Like a POJO or in simple words, having a class where you have all the getters and setters for all your important variables. You can also have the service class in your case for getting the coordinates and save those coordinates in the getters and setters class and then use them in the class you desire.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26434225
score: -3
has comment: http://stackoverflow.com/comment/41513224
has answer: http://stackoverflow.com/a/26434243
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/1140268
has comment: http://stackoverflow.com/comment/41513257
has title: what regular expression can match the [ and ] characters?
answer count: 2
tagged with: brackets
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26434350
tagged with: regex
has comment: http://stackoverflow.com/comment/41513264
downvote count: 4
has body: I'm trying to use the java method replaceAll(), that removes from a string all characters that match a given regex, to remove the opening and closing brackets characters from a string. So, I need to use as a parameter a regex that matches [ and ]. I've tried using [|] or ([|]) but they don't seem to work.
has comment: http://stackoverflow.com/comment/41513268
has comment: http://stackoverflow.com/comment/41513294
type: UnansweredQuestion

http://stackoverflow.com/q/26455226
has answer: http://stackoverflow.com/a/26455277
score: 0
type: UnansweredQuestion
has title: enum to create and contain objects java
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/41551468
type: Question
has answer: http://stackoverflow.com/a/26455289
has body: I have a class called Planet that creates Planet objects with some attributes. Can I have an enum (not used to them yet) that stores and creates the planets? For example something like: public enum planetEnum{ earth (250, 0, 100, "blue"), mars (360, 0, 80, "red"); planetEnum(double distance, double angle, double diameter, String col){ new Planet(distance, angle, diameter, col); } } Hoping that in the end I can refer to mars and earth as objects, i.e. : earth.getDistance() I hope its clear :) Thanks in advance! Edit: Thanks for your responses. I've found and read already the oracle tut on enums but I couldn't find what I was actually looking for. Because it's a task to learn the basics of inheritance, I need to keep the Planet class separate and to create Planet objects, so I cant actually put the constructor in the enum. Is there a way to refer to the Planet class and create from it, from inside of the enum? Thanks again!
answer count: 3
has answer: http://stackoverflow.com/a/26455257

http://stackoverflow.com/a/26497463
has body: You have 2 problems. First was explained by Tom Elliott. The second problem is that also the max[] array is initialized with 0, and when you search for max values you change the value from max array (which is 0) with the value from the numbers array, so the numbers array becomes filled with 0s. A quick solve (though not the best) would be to copy the numbers array in a temp array and use that temp when searching for min values. In case you didn't exactly understood what I said, try to make a print of the numbers array after you found the 5 max values.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26496752

http://stackoverflow.com/comment/73351539
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26373886
type: AnswerComment
has text: Can we specify some other name to the **_id** field? If yes, then how? Thanks in advance.

http://stackoverflow.com/a/26511368
answers question: http://stackoverflow.com/q/26473613
type: AcceptedAnswer
score: 0
type: Answer
has body: The answer to this was actually really simple. I put the following in the stopTrailer method. public void stopTrailer() { PlatformImpl.startup(new Runnable() { @Override public void run() { remove(jfxPanel); webEngine.load(null); } }); } What it actually does is to reload the browser webEngine to the "address" null. And removes the panel. It seems a bit weird to me cause I would interpret this code as the start of a second thread - without access to the first one. Perhaps someone could explain just how this works?
accepted answer of: http://stackoverflow.com/q/26473613

http://stackoverflow.com/comment/41618222
has text: @Rustam But you removed all of my formatting of the actual question which made it more readable?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26491187

http://stackoverflow.com/q/26358345
score: 0
tagged with: jnlp
has answer: http://stackoverflow.com/a/26382813
has body: Hello i have a problem with a RCP application. 1. If I start the application using the following command, the application start well. C:...\jre7\bin\javaws.exe ht.tps://.../application.jnlp 2. Nevertheless, if I start the same application with the JNLP downloaded on user's computer with the following command: C:...\jre7\bin\javaws.exe application.jnlp I get this error : APPLICATION BLOCKED BY SECURITY SETTINGS The Java security settings have prevented this application from running. You may change this behavior in the Java Control Panel. Someone can help me ?
type: UnansweredQuestion
tagged with: java
has title: JWS Application blocked by Security Setteings
type: Question
answer count: 1
tagged with: java-web-start

http://stackoverflow.com/comment/42031838
type: AnswerComment
has text: This kind of solves my problem in a very intelligent way :). I will be doing a lookup table with all the power of 2 and find the nearest value to the "OS memory". In case no one will post a programmatic way of retrieving the exact value I will mark you as the correct answer.
type: Comment
comment on: http://stackoverflow.com/a/26682914
score: 0

http://stackoverflow.com/comment/60594588
type: Comment
comment on: http://stackoverflow.com/a/36492543
type: AnswerComment
has text: Doesn't this still mean I have to explicitly specify dependency in `connectors` on all child-modules?
score: 0

http://stackoverflow.com/a/26504703
answers question: http://stackoverflow.com/q/26503840
has body: As Spring-Roo uses AspctJ ITD to generate code you need add its runtime libraries as a dependency. But I think that AspectJ is not suitable for Android. It works I found android-aspectj library which seems to be a possible way to archive this (I don't try it). Also, this library refers to a post which explains it. Good luck!
accepted answer of: http://stackoverflow.com/q/26503840
has comment: http://stackoverflow.com/comment/41677243
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41676382
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41655944

http://stackoverflow.com/comment/41523841
comment on: http://stackoverflow.com/q/26439389
score: 0
type: Comment
has text: Please paste your entire code. Nobody is going to steal your *code*.
type: QuestionComment

http://stackoverflow.com/a/26425427
has body: You need to use a constructor for that, or a method returning an instance of Memba, instead of void. Constructor public Memba(String Memb_Name,String Memb_Surname,int age,int contact,String address,String username,String password) { this.Memb_Name = Memb_Name; this.Memb_Surname = Memb_Surname; this.age = age; this.contact = contact; this.address = address; this.username = username; this.password = password; } Method delivering new instance (usually in factory patterns and such like) public static Memba newInstance(String Memb_Name,String Memb_Surname,int age,int contact,String address,String username,String password) { // you will need to declare an empty constructor in your Memba class, // _if_ you have already declared the constructor above, // for the following line to compile Memba result = new Memba(); result.Memb_Name = Memb_Name; result.Memb_Surname = Memb_Surname; result.age = age; result.contact = contact; result.address = address; result.username = username; result.password = password; return result; } Notes My advice is to stick to conventions regarding variable names - i.e. Memb_Name should be refactored as name or memberName, etc. In the last assignments in the void method you expose in your question, you seem to assign static fields with the parameters of your method. I am assuming here they are in fact instance fields of Memba
downvote count: 0
has comment: http://stackoverflow.com/comment/41495934
has comment: http://stackoverflow.com/comment/41497731
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26425359
score: 3

http://stackoverflow.com/q/26361689
has answer: http://stackoverflow.com/a/34117076
has answer: http://stackoverflow.com/a/26361929
accepted answer: http://stackoverflow.com/a/26361929
has comment: http://stackoverflow.com/comment/41381301
favorite count: 0
has title: How to remove auth request in Spring?
score: 6
tagged with: spring
answer count: 4
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/34218897
tagged with: java
tagged with: hibernate
has body: This message says: Required authorization. To access on the server http://localhhost:8080 you should enter login and password. Server message: Spring. I'm using Hibernate 4, Spring 4 and Gradle. Also, I'm using Spring Boot. But this message appears even if I have got plane code from tutorial. What caused it and how to get rid of it? What's wrong? No error messages in console.
has comment: http://stackoverflow.com/comment/41381168
has comment: http://stackoverflow.com/comment/41381219
type: Question
has answer: http://stackoverflow.com/a/26361775
upvote count: 6
downvote count: 0
has answer: http://stackoverflow.com/a/34218897

http://stackoverflow.com/comment/41470083
type: QuestionComment
has text: Easiest way to do it is get both trees in order and then compare them. Read about [ordering](http://en.wikipedia.org/wiki/Tree_traversal#In-order_.28symmetric.29).
comment on: http://stackoverflow.com/q/26411053
score: 0
type: Comment

http://stackoverflow.com/q/26398438
answer count: 0
type: UnansweredQuestion
tagged with: configuration
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41449055
tagged with: hadoop
has comment: http://stackoverflow.com/comment/41451533
tagged with: hdfs
has comment: http://stackoverflow.com/comment/41685373
score: 0
has title: How to edit Configuration and write to the .xml file in HDFS?
tagged with: http://stackoverflow.com/tag/xml
has body: I know that Hadoop has a set of API to use Configuration. Here is the question. I need edit the properties in the .xml at run time. For example, there is a configuration file named "hdfs-a.xml", i load it in my java code. Configuration conf = new Configuration(); conf.addResource("/hdfs-a.xml"); conf.set("dfs.test.num", 2); how can i change the value of "dfs.test.num" in file "hdfs-a.xml" to "2"? Is there any way to edit the .xml file in java code at run time?

http://stackoverflow.com/q/26512721
linked to: http://stackoverflow.com/q/18841744
has answer: http://stackoverflow.com/a/26513017
tagged with: java
has answer: http://stackoverflow.com/a/36653560
type: Question
has body: I want to connect Java class file with SQL server 2008. I have logged in with SQL server authentication use: sa, pass:123456. But i am receiving error in connectivity. static String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; static String dburl = "jdbc:sqlserver://localhost\\SQL2008:1433;Database=Java"; static String user = "sa"; static String password = "123456"; public static void update() throws Exception{ String sql = "UPDATE Categories SET Id='COM' WHERE Id='LAP'"; Class.forName(driver); Connection conn = DriverManager.getConnection(dburl, user, password); Statement stmt = conn.createStatement(); stmt.executeUpdate(sql); conn.close(); } public static void main(String[] args) throws Exception { Basic.update(); } Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.". at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:170) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1048) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:829) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:712) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Tutorials.jdbc.Basic.update(Basic.java:48) at Tutorials.jdbc.Basic.main(Basic.java:72)
has answer: http://stackoverflow.com/a/26512865
tagged with: sql-server
score: 0
has answer: http://stackoverflow.com/a/26529138
tagged with: sql
duplicate of: http://stackoverflow.com/q/18841744
has answer: http://stackoverflow.com/a/26513044
answer count: 5
type: UnansweredQuestion
has title: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect
has comment: http://stackoverflow.com/comment/41655500
has comment: http://stackoverflow.com/comment/41655628

http://stackoverflow.com/q/26416180
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41479766
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26416724
type: Question
tagged with: actionlistener
has title: Java Swing actionPerformed
has comment: http://stackoverflow.com/comment/41479854
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/26416724
tagged with: swing
has body: Hi there I'm working in a project where I had to create a CUI game and now convert it to GUI, I'm in the process of adding functionality to buttons that interact with the game but am having trouble. This is the method I'm attempting to access. It's in a class called Pet. public double feedPet() { if(this.hunger &lt; MAX_HUNGER) { this.hunger += food; if(this.hunger &gt; MAX_HUNGER) { this.hunger = MAX_HUNGER; } System.out.println(this.petName + " enjoyed the meal!"); System.out.println("Hunger increased by " + food + " to a total of " + this.hunger); spacing(); } else { System.out.println(this.petName + " is currently full!"); spacing(); } return this.hunger; } This is the class that is trying to access the method. public GamePanel(PetWorld petWorld, Pet pet, Game game) { initComponents(); genComponents(pet); } private void genComponents(final Pet pet) { this.setSize(600, 600); graphicsPanel.setSize(600, 400); graphicsPanel.setBackground(Color.red); buttonPanel.setSize(600, 200); buttonPanel.setBorder(BorderFactory.createTitledBorder("Pet Options")); JButton feedBtn = new JButton("Feed"); JButton playBtn = new JButton("Play"); JButton sickBtn = new JButton("Medicine"); JButton trainBtn = new JButton("Train"); JButton sleepBtn = new JButton("Sleep"); //// error occurring here I believe \\\\ feedBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { pet.feedPet(); } }); buttonPanel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); //// Pet Options \\\\ gc.weightx = 0.5; gc.weighty = 0.5; gc.gridx = 0; gc.gridy = 1; buttonPanel.add(feedBtn, gc); gc.gridx = 1; gc.gridy = 1; buttonPanel.add(playBtn, gc); gc.gridx = 2; gc.gridy = 1; buttonPanel.add(sickBtn, gc); gc.gridx = 3; gc.gridy = 1; buttonPanel.add(trainBtn, gc); gc.gridx = 4; gc.gridy = 1; buttonPanel.add(sleepBtn, gc); } I've had to make the pet final, I believe this to be bad as I alter values in the pet itself, eg happiness, hunger etc…

http://stackoverflow.com/comment/41559023
type: QuestionComment
has text: For better help sooner, post one [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) as opposed to three source files.
comment on: http://stackoverflow.com/q/26459688
score: 0
type: Comment

oop
tags question: http://stackoverflow.com/q/26413871
tags question: http://stackoverflow.com/q/26493005
tags question: http://stackoverflow.com/q/26469199
tag name: oop
tags question: http://stackoverflow.com/q/26462846
tags question: http://stackoverflow.com/q/26488409
tags question: http://stackoverflow.com/q/26395055
tags question: http://stackoverflow.com/q/26392671
tags question: http://stackoverflow.com/q/26458350
tags question: http://stackoverflow.com/q/26441800
tags question: http://stackoverflow.com/q/26500373
tags question: http://stackoverflow.com/q/26379848
tags question: http://stackoverflow.com/q/26373160
tags question: http://stackoverflow.com/q/26494745
tags question: http://stackoverflow.com/q/26378305
tags question: http://stackoverflow.com/q/26500247
tags question: http://stackoverflow.com/q/26353862
type: Tag
tags question: http://stackoverflow.com/q/26370145
tags question: http://stackoverflow.com/q/26390413

http://stackoverflow.com/a/26402625
type: Answer
has body: In android XML file is used to represent layout e.g activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="40dp" android:layout_marginTop="17dp" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/RelativeLayout&gt; and to show this layout on android screen we write following line in java class Mainactivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); **setContentView(R.layout.activity_main);** }
score: 0
answers question: http://stackoverflow.com/q/26402229

http://stackoverflow.com/a/40205360
answers question: http://stackoverflow.com/q/26378230
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: pipe = new Each(pipe, new Debug("displayText", true)); true is used to display header in data. Set it to false if you do not want header info. With this, you will see every line of data in pipe with the column name visit here

http://stackoverflow.com/a/26377979
answers question: http://stackoverflow.com/q/26377978
accepted answer of: http://stackoverflow.com/q/26377978
score: 0
type: AcceptedAnswer
type: Answer
has body: It's fairly simple. In the custom Action I do the following to save the perspective: IWorkbenchPage page = window.getActivePage(); IPerspectiveRegistry perspectiveRegistry = window.getWorkbench() .getPerspectiveRegistry(); IPerspectiveDescriptor personalPerspectiveDescriptor = perspectiveRegistry .findPerspectiveWithId(perspectiveId); if (page != null &amp;&amp; personalPerspectiveDescriptor != null) { // ... other stuff like different confirm dialogs page.savePerspectiveAs(personalPerspectiveDescriptor); } A nice example of how to use perspectives for letting the user customize their layouts without showing too much of the built-in perspective functionality can be found here: http://www.subshell.com/en/subshell/blog/article-Eclipse-RCP-Change-Your-Perspective100.html

http://stackoverflow.com/q/26488979
upvote count: 1
tagged with: string
tagged with: unicode
favorite count: 0
possible better answer: http://stackoverflow.com/a/26489206
has comment: http://stackoverflow.com/comment/41612119
linked to: http://stackoverflow.com/q/9699071
has answer: http://stackoverflow.com/a/26489206
tagged with: utf-8
has comment: http://stackoverflow.com/comment/41612568
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26489028
accepted answer: http://stackoverflow.com/a/26489028
has title: How many bytes does a string contains?
has body: public class ClassToTestSnippets { private static ClassToTestSnippets ctts; public static void main(String[] args) { ctts = new ClassToTestSnippets(); ctts.testThisMethod(); } public void testThisMethod() { System.out.println("\u2014".length()); //answer is 1 } } Above code prints 1. But \u2014 is E2 80 94 i.e. 3 bytes. How do I know how many bytes does a string contains?
answer count: 2

http://stackoverflow.com/q/26487836
tagged with: rabbitmq
tagged with: spring-rabbit
type: AnsweredQuestion
score: 2
has body: I have dead lettering set up for a few queues that I am using. In the configuration I use: <property name="messageRecoverer" ref="rejectAndDontRequeueRecoverer"/> <property name="retryOperations" ref="retryTemplate" /> If i want the message on the dead letter queue to have the x-exception-stacktrace , I read that I need to use RepublishMessageRecoverer. Is using that in dead lettering as simple as replacing RejectAndDontRequeueRecoverer with RepublishMessageRecoverer in the above setting or do I need to write a custom messageRecoverer?
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26488820
has title: How to use RepublishMessageRecoverer in Dead lettering?
answer count: 1
tagged with: dead-letter
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26488820
tagged with: spring

http://stackoverflow.com/comment/41640417
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26504484
has text: to the one who voted down..would be good to comment why the down vote
score: 0

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

http://stackoverflow.com/q/26408690
tagged with: eclipse-rcp
answer count: 2
downvote count: 0
tagged with: eclipse-plugin
possible better answer: http://stackoverflow.com/a/26418544
favorite count: 0
has title: tableviewercolumn setwidth percentages instead of pixels
has body: the setWidth method for the TableViewerColumn class takes integer types, I would really like to use percentages, is there anyway to do this, or pack the table or something?
tagged with: swt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26408841
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26418544
type: Question
has answer: http://stackoverflow.com/a/26408841
tagged with: tableviewer

http://stackoverflow.com/a/26487909
answers question: http://stackoverflow.com/q/26487239
type: Answer
has comment: http://stackoverflow.com/comment/41610123
downvote count: 0
score: 1
has body: Insert the data in database helper onCreate() using the SQLiteDatabase parameter passed in as an argument. Do not attempt to call getWritableDatabase() in onCreate() or a method called from there - that would cause the "called recursively" exception you've seen.
upvote count: 1

http://stackoverflow.com/comment/41482965
has text: I fixed it. All I had to do was change an else statement to an else-if and add a comparison condition. I spent 2 hours trying to fix it. Thank you to those who posted help :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26414258
score: 0

http://stackoverflow.com/q/26461089
has answer: http://stackoverflow.com/a/26461649
possible better answer: http://stackoverflow.com/a/26461649
type: AnsweredQuestion
has title: Getting null after unmarshalling using JaXB?
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26466656
type: Question
has body: I have below XML. &lt;?xml version="1.0"?&gt; &lt;aws:TrafficHistoryResponse xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/"&gt; &lt;aws:Response xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11"&gt; &lt;aws:OperationRequest&gt; &lt;aws:RequestId&gt;6b09364e-ac0d-686c-cb95-0b1393fd234e&lt;/aws:RequestId&gt; &lt;/aws:OperationRequest&gt; &lt;aws:ResponseStatus xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/"&gt; &lt;aws:StatusCode&gt;Success&lt;/aws:StatusCode&gt; &lt;/aws:ResponseStatus&gt; &lt;/aws:Response&gt; &lt;/aws:TrafficHistoryResponse&gt; POJO classes: package-info.java @javax.xml.bind.annotation.XmlSchema(namespace = "http://alexa.amazonaws.com/doc/2005-10-05/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.mycom.web; AlexaResult @XmlRootElement(name = "TrafficHistoryResponse") public class AlexaResult implements Serializable { /** * */ private static final long serialVersionUID = -3068403572663448394L; private AlexaResponse alexaResponse; @XmlElement(name="Response", namespace="http://awis.amazonaws.com/doc/2005-07-11") public AlexaResponse getAlexaResponse() { return alexaResponse; } public void setAlexaResponse(AlexaResponse alexaResponse) { this.alexaResponse = alexaResponse; } } JAXBContext jaxbContext = JAXBContext.newInstance(AlexaResult.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(webTrafficDetails); AlexaResult result = (AlexaResult) unmarshaller.unmarshal(reader); But I am getting result.getAlexaResponse().getAlexaHistoryResult() as null ? Anything am I missing? Thanks!
accepted answer: http://stackoverflow.com/a/26466656
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
answer count: 2
upvote count: 1
tagged with: jaxb

http://stackoverflow.com/comment/41536429
score: 0
type: QuestionComment
type: Comment
has text: myName is an array of strings, to make it a single string you have to choose which string first. ie `myName[0].charAt(0)` This is the first letter of the first word.
comment on: http://stackoverflow.com/q/26447055

http://stackoverflow.com/q/26370088
has comment: http://stackoverflow.com/comment/41397536
has comment: http://stackoverflow.com/comment/41397581
has answer: http://stackoverflow.com/a/26386185
tagged with: static-methods
tagged with: random
downvote count: 0
answer count: 1
tagged with: instance-variables
has comment: http://stackoverflow.com/comment/41399514
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41423636
has title: Error message stating misplaced constructors for java
has body: So I reworked it some but now I am getting the additional error of "complete the whilestatement? /* This is a program in that can figure out a number chosen by a human user */ import java.util.Random; import java.util.Scanner; public class NumberGuesser { public static void main(String[] args) { boolean playAgain = false; do { playOneGame(); playAgain = shouldPlayAgain(); } while (playAgain); } public static void playOneGame() { int continueGuessing = 0; int guess = 50; int low = 1; int high = 100; Scanner keyboard = new Scanner(System.in); char response; System.out.println("Guess a number between 1 and 100.\n"); do { guess = getMidpoint (low, high); response = getUserResponseToGuess(guess); if (response == 'h') { high = guess; continueGuessing = 1; } else if (response == 'l') { low = guess; continueGuessing = 0; } while(response != 'h' &amp;&amp; response != 'l') } } /*get midpoint method */ public static int getMidpoint(int high, int low); int range = high- low; Random generator = new Random(); if (range &gt;0){ int midpoint = generator.nextInt(range) + low +1; return midpoint; } else return guess; public static char getUserResponseToGuess(int guess) { Scanner keyboard = new Scanner(System.in); String input; char response; do { System.out.println("Is it " + guess + "? (h/l/c): "); input = keyboard.nextLine(); response = input.charAt(0); } while (response != 'h' &amp;&amp; response != 'l' &amp;&amp; response != 'c'); return response; } static boolean shouldPlayAgain() { Scanner keyboard = new Scanner (System.in); String input; char response; do { System.out.println("Do you want to play again? (y/n); "); input = keyboard.nextLine(); response = input.charAt(0); } while (response != 'y' &amp;&amp; response != 'n') if (response == 'y') { return true; } else return false; } } So i am to create a program in that can figure out a number chosen by a human user. The human user will think of a number between 1 and 100. The program will make guesses and the user will tell the…
has comment: http://stackoverflow.com/comment/41401043
has comment: http://stackoverflow.com/comment/41423561
has comment: http://stackoverflow.com/comment/41399535
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41397664
has comment: http://stackoverflow.com/comment/41423302

http://stackoverflow.com/comment/41408897
comment on: http://stackoverflow.com/q/26376640
score: 0
has text: generate json response
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26441604
has answer: http://stackoverflow.com/a/26441884
has answer: http://stackoverflow.com/a/26441788
has comment: http://stackoverflow.com/comment/41526652
has body: Details of my Homework Topic: Single Dimensional Array Write a java program that first read in the size of a one dimensional array, read in each array element of double type, reverses the order of this one-dimensional array. Do not create another array to hold the result. Hint: Use the code in the text for exchanging two elements. Sample Output: Please input the size of array: 4 Please input 4 double numbers: 1.0, 2.0, 3.0, 4.0 After reverse order: 4.0, 3.0, 2.0, 1.0 I have 2 problems with my assignment. Wondering if anyone can help me find a solution. I need to fill the values of an array (double[] myArray) using Scanner input from a single line for multiple doubles. I need to reverse the order of the values inside the array WITHOUT using a 2nd array. This is my code so far. Scanner sc = new Scanner(System.in); System.out.println("Please input the size of array: "); int arraySize = sc.nextInt(); //Stores user input double[] myArray = new double[arraySize]; //Create array[userInput] System.out.print("Please input " + arraySize + " double numbers: ");//Collect user input int j = 0; while (sc.hasNext()) { //Another Failed Attempt to collect the input from a single line if (sc.hasNextDouble()) { myArray[j] = sc.nextDouble(); //Insert user input into array j++; } } Collections.reverse(Arrays.asList(myArray));//Doesn't work :( System.out.println("After reverse order: "); for (int i=0;i&lt;arraySize;i++) System.out.println(myArray[i]); My problem is that when the input for the doubles is given by the user the console moves to the next line still expecting input, if input is given ArrayIndexOutOfBounds is thrown
has answer: http://stackoverflow.com/a/63871754
favorite count: 0
has comment: http://stackoverflow.com/comment/41526303
has answer: http://stackoverflow.com/a/26442117
linked to: http://stackoverflow.com/q/20912313
downvote count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/2721546
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41526463
has answer: http://stackoverflow.com/a/26441710
has title: Java Homework Reverse Array
has comment: http://stackoverflow.com/comment/41526632
tagged with: java
has comment: http://stackoverflow.com/comment/41527657
type: Question
has answer: http://stackoverflow.com/a/26443043
accepted answer: http://stackoverflow.com/a/26442117
linked to: http://stackoverflow.com/q/13102045
has answer: http://stackoverflow.com/a/48328596
has comment: http://stackoverflow.com/comment/41526315
tagged with: arrays
score: -1
possible better answer: http://stackoverflow.com/a/26441788
answer count: 7

http://stackoverflow.com/comment/41580024
has text: @MadProgrammer I don't see transparency in your result. Since red rectangle block is changed in before and after images, only that part need to be shown and everything else(means background) should be transparent. How this can be achieved?
comment on: http://stackoverflow.com/a/26457879
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/q/26357186
accepted answer: http://stackoverflow.com/a/26416983
has body: Could you give me some information on what is exactly stored in object header? I know, that it's probably JVM dependent, but maybe for HotSpot at least? I'm looking for exact description specifically for a first row. I've read several information that I can't verify positively with information I find. Maybe you have a link to OpenJDK wiki that says it all?
upvote count: 53
downvote count: 0
has title: What is in Java object header?
favorite count: 0
score: 53
answer count: 3
tagged with: object-layout
possible better answer: http://stackoverflow.com/a/26357629
has answer: http://stackoverflow.com/a/26357629
tagged with: jvm
tagged with: jol
has answer: http://stackoverflow.com/a/26416983
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/110201406
has answer: http://stackoverflow.com/a/26364995
type: Question
tagged with: java-memory-model

http://stackoverflow.com/q/26502346
has comment: http://stackoverflow.com/comment/41636661
has comment: http://stackoverflow.com/comment/41636603
has comment: http://stackoverflow.com/comment/41637597
has body: edit: this was entirely my error, likely due to rushing things at 4am. The code was technically sound and working fine, though thank to the comments I have removed some redundancy to make things a bit smarter. I'm working on a class project that deals with Java super/subclasses and inheritance. While 90% of the code works just fine, one minor thing doesn't seem to want to work and I'm a bit perplexed as to why. Basically, we're creating a new class called CompactDisc that contains information such as product code, Description, Price, and Artist. When the user enters the appropriate code (sgtp), the console will output the information. Unfortunately the Artist line is always blank, despite giving it data. While there are other classes involved with this project, I'll will only post the ones I feel are important. ProductApp.java: import java.util.Scanner; public class ProductApp { public static void main(String args[]) { // display a weclome message System.out.println("Welcome to the Product Selector\n"); // perform 1 or more selections Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { System.out.print("Enter product code: "); String productCode = sc.next(); // read the product code sc.nextLine(); // discard any other data entered on the line // get the Product object Product p = ProductDB.getProduct(productCode); // display the output System.out.println(); if (p != null) System.out.println(p.toString()); else System.out.println("No product matches this product code.\n"); System.out.println("Product count: " + Product.getCount() + "\n"); // see if the user wants to continue System.out.print("Continue? (y/n): "); choice = sc.nextLine(); System.out.println(); } } } Product.java: import java.text.NumberFormat; public class Product { private String code; private String description; private String artist; private double price; protected static int count = 0; public Product() { code = ""; description = ""; price = 0; } public v…
downvote count: 0
tagged with: polymorphism
has answer: http://stackoverflow.com/a/26502543
favorite count: 0
has comment: http://stackoverflow.com/comment/41636602
tagged with: subclass
has answer: http://stackoverflow.com/a/26502485
accepted answer: http://stackoverflow.com/a/26502543
has title: Minor issue when working with extended classes in Java
has comment: http://stackoverflow.com/comment/41636586
answer count: 4
has comment: http://stackoverflow.com/comment/41636624
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41637232
tagged with: java
has comment: http://stackoverflow.com/comment/41637338
type: Question
tagged with: superclass
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26502549
possible better answer: http://stackoverflow.com/a/26502458
has answer: http://stackoverflow.com/a/26502458
has comment: http://stackoverflow.com/comment/41636863
has comment: http://stackoverflow.com/comment/41636521

undefined
tags question: http://stackoverflow.com/q/26450209
tag name: undefined
type: Tag

http://stackoverflow.com/q/26421232
has comment: http://stackoverflow.com/comment/41491070
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41490752
downvote count: 0
has body: Hi everyone I'm am reading from a csv file a that take a string, years and double. Basically reading a country name, years, and stats of cellular data. Example: Country Name 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 Aruba 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.029310471 0 0 2.138784453 3.605985937 3.98141538 6.16435217 13.48254011 16.50927821 57.05427692 65.05605558 72.10431377 99.64250268. My program is able to read the data but is outputting the wrong sum onto the screen. I created 2 classes. One called subscriptionYear that has two variables called year(stores the year for a subscription data) and subscriptions(stores the number of subscriptions for a specific year). The 2nd class called country stores the country and subscription data from each country. My method getNumSubscriptions is calculating wrongly as it only reads what in 2012 and not doing the total sum. if i input other years it reads the sum as 0 and only read the last year 2012. How can i calculate the sum using the index position of the year to calculate the sum between 1960 to 2012. Please could someone tell me what i did wrong. public class SubscriptionYear { private int year; private double subscriptions; public SubscriptionYear(int year,double subscriptions) { this.year = year; this.subscriptions = subscriptions; setYear(year); setSubscription(subscriptions); } public void setYear(int Year) { this.year= Year; } public void setSubscription(double value) { this.subscriptions = value; } public int getYear() { return year; } public double getSubscription() { return subscriptions; } public String toString()//returns number of subscriptions { return "Number of Subscriptions: "+subscriptions; } } class Country: public class Country { private String countryNames; private SubscriptionYear[] subscri…
has comment: http://stackoverflow.com/comment/41489196
score: 1
has comment: http://stackoverflow.com/comment/41491565
favorite count: 0
has comment: http://stackoverflow.com/comment/41491653
has comment: http://stackoverflow.com/comment/41488414
has comment: http://stackoverflow.com/comment/41488772
has comment: http://stackoverflow.com/comment/41488906
has title: Outputting the wrong sum from array of reference
has answer: http://stackoverflow.com/a/26421967
has comment: http://stackoverflow.com/comment/41490951
has comment: http://stackoverflow.com/comment/41489559
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41490689
has answer: http://stackoverflow.com/a/26422012
upvote count: 1
has comment: http://stackoverflow.com/comment/41489116
has comment: http://stackoverflow.com/comment/41490425
tagged with: java

http://stackoverflow.com/comment/41666697
type: QuestionComment
has text: *"..but with the characteristics that I want."* unless you actually meant *"..but **not** with the characteristics that I want."* that statement makes no sense. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).
comment on: http://stackoverflow.com/q/26513065
score: 0
type: Comment

http://stackoverflow.com/q/26500373
tagged with: tree
tagged with: oop
has comment: http://stackoverflow.com/comment/41633193
has title: backtrace a tree without mutable members
tagged with: java
type: Question
tagged with: functional-programming
answer count: 1
has body: I am trying to make a recursive tree such that parent has reference to child and child has reference to parent. The thing I am trying to do is to backtrace the tree from a child whitout mutable members. It is hard because giving the child a reference to the parent in the constructor requireds the parent instance to be already created. I only could think of two ways and both are not so good. The first way is the fallowing create child instance with function "setParent()" which only works once with the help of a private boolean variable. create parent and pass the child instance. the parent will pass itself to "setParent()". After that, child has reference to parent and setParent() cannot be used. The second way is to create parent and child completly separate but hold them in some sort of data structure which can search for parent of some child and the otherway arround. If there is a better way please teach me. I work mainly in java but the question is general.
has answer: http://stackoverflow.com/a/26500514
score: 0
has comment: http://stackoverflow.com/comment/41633724
has comment: http://stackoverflow.com/comment/41637857
type: UnansweredQuestion
tagged with: scala
has comment: http://stackoverflow.com/comment/41633131

http://stackoverflow.com/a/29772532
type: Answer
has body: You can try this: final XBaseFile dbf = new XBase().open(new File("...")); try { for (int i = 0; i &lt; dbf.rowCount(); i++) { if (dbf.go(i) &amp;&amp; !dbf.isDeleted()) { final Double x = dbf.getValue("B"); final Double y = dbf.getValue("C"); dbf.setValue("C", String.valueOf(x + y)); } } } finally { dbf.closeQuietly(); } I am using xbase4j library.
answers question: http://stackoverflow.com/q/26439203
accepted answer of: http://stackoverflow.com/q/26439203
score: 0
has comment: http://stackoverflow.com/comment/96049961
type: AcceptedAnswer

http://stackoverflow.com/comment/41679995
comment on: http://stackoverflow.com/a/26521525
score: 0
type: AnswerComment
has text: this gives me the key of the max value in the map, I really need the max key. But thanks, I think I can modify this to my needs.
type: Comment

http://stackoverflow.com/q/26435517
type: UnansweredQuestion
type: Question
has body: My REST service outputs @Produces(MediaType.APPLICATION_XML). This is converted from: ArrayList orders = new ArrayList (); GenericEntity<ArrayList > entity = new GenericEntity<ArrayList >(orders) {}; .... return Response.status(Response.Status.OK).entity(entity).build(); Example: <coffeeOrders> 2 http://localhost:9080/cs9322.ass2/rest/coffee/2 http://localhost:9080/cs9322.ass2/rest/payment/2 1 http://localhost:9080/cs9322.ass2/rest/coffee/1 http://localhost:9080/cs9322.ass2/rest/payment/1 In my client, I want to call this service and save the response as an ArrayList . CoffeeOrder looks something like this: public class CoffeeOrder { private String id; private ArrayList<String> links = new ArrayList<String>(); ... } Is there a way that I can fill this object with the response from the REST request? Thank you for your help!
has title: Jersey Client to save response from REST Call into custom object
tagged with: java
has answer: http://stackoverflow.com/a/26436065
score: 0
tagged with: jersey
answer count: 1
tagged with: rest
linked to: http://stackoverflow.com/q/26014656

http://stackoverflow.com/q/26366273
tagged with: javascript
tagged with: struts
has answer: http://stackoverflow.com/a/26366475
score: 0
answer count: 3
tagged with: http://stackoverflow.com/tag/pdf
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26366468
has body: I have a jsp page from which i have to redirect to an external URL and this URL has a dynamic field at the end which i bring from another class. The task for me is to open this url in a new tab or window when that jsp is loaded. I tried the target attribute in the HTML tag but it did not work. &lt;html target="_blank"&gt; &lt;body&gt; &lt;% String filename=(String)request.getAttribute("fileToOpen"); response.sendRedirect("http://manuals/example/"+filename+".pdf"); %&gt; &lt;/body&gt; &lt;/html&gt;
has answer: http://stackoverflow.com/a/26368891
tagged with: java
type: Question
has title: JSP should redirect to a dynamic URL in a new window or tab
tagged with: jsp

http://stackoverflow.com/comment/41540276
score: 1
has text: what is database transaction hook?? please elaborate??
type: AnswerComment
comment on: http://stackoverflow.com/a/26444535
type: Comment

http://stackoverflow.com/q/26483049
type: Question
has comment: http://stackoverflow.com/comment/41601529
possible better answer: http://stackoverflow.com/a/26483238
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41601429
tagged with: regex
has body: I have a fixed format such as xxx-xxxx. Which is 3 alphanumeric then a dash then 4 alphanumeric. I am new to regex. I would like to know how i can carry this checking on regex for java. I know that for /w is for any word, /d for any digit. And x{n} for n number of occurences. But how do i put all these together? Thanks.
has answer: http://stackoverflow.com/a/26483426
has comment: http://stackoverflow.com/comment/41601564
has answer: http://stackoverflow.com/a/26483238
has comment: http://stackoverflow.com/comment/41601585
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26483079
accepted answer: http://stackoverflow.com/a/26483079
has title: Fixed format regex: [aaa-aaaa]

http://stackoverflow.com/comment/41653270
type: Comment
has text: Passing or returning a single variable in Java will always cost you copying one (1) machine word for the reference (regardless of its size). Java has no copy semantics. Unless you create an explicit copy of the structure, there won't be any draconian cost. Of course, if you don't need all of the data, you shouldn't create the structure (whatever structure) in the first place.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26511165

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/26488012
tags question: http://stackoverflow.com/q/26459450
tags question: http://stackoverflow.com/q/26375658
tags question: http://stackoverflow.com/q/26466444
tags question: http://stackoverflow.com/q/26357157
tags question: http://stackoverflow.com/q/26374023
tags question: http://stackoverflow.com/q/26366167
tags question: http://stackoverflow.com/q/26508338
tags question: http://stackoverflow.com/q/26418209
tags question: http://stackoverflow.com/q/26464607
tags question: http://stackoverflow.com/q/26387666
tags question: http://stackoverflow.com/q/26479720
tags question: http://stackoverflow.com/q/26510169
tags question: http://stackoverflow.com/q/26381166
tags question: http://stackoverflow.com/q/26408160
tags question: http://stackoverflow.com/q/26360996
tags question: http://stackoverflow.com/q/26367884
tags question: http://stackoverflow.com/q/26506418
tags question: http://stackoverflow.com/q/26439821
tags question: http://stackoverflow.com/q/26397061
tags question: http://stackoverflow.com/q/26470783
tags question: http://stackoverflow.com/q/26497856
tags question: http://stackoverflow.com/q/26480838
tags question: http://stackoverflow.com/q/26472867
tags question: http://stackoverflow.com/q/26384473
tags question: http://stackoverflow.com/q/26503733
tags question: http://stackoverflow.com/q/26374716
tags question: http://stackoverflow.com/q/26452823
tags question: http://stackoverflow.com/q/26422447
tags question: http://stackoverflow.com/q/26431581
tags question: http://stackoverflow.com/q/26461605
type: Tag
tags question: http://stackoverflow.com/q/26417895
tags question: http://stackoverflow.com/q/26404538
tags question: http://stackoverflow.com/q/26510904
tags question: http://stackoverflow.com/q/26364475
tags question: http://stackoverflow.com/q/26450686
tags question: http://stackoverflow.com/q/26445116
tags question: http://stackoverflow.com/q/26410238
tags question: http://stackoverflow.com/q/26494372
tags question: http://stackoverflow.com/q/26399593
tags question: http://stackoverflow.com/q/26397647
tags question: http://stackoverflow.com/q/26468406
tags question: http://stackoverflow.com/q/26383704
tags question: http://stackoverflow.com/q/26463343
tags question: http://stackoverflow.com/q/26451873
tags question: http://stackoverflow.com/q/26513269
tags question: http://stackoverflow.com/q/26453742
tags question: http://stackoverflow.com/q/26470114
tags question: http://stackoverflow.com/q/26441214
tags question: http://stackoverflow.com/q/26501523
tags question: http://stackoverflow.com/q/26490300
tags question: http://stackoverflow.com/q/26450472
tags question: http://stackoverflow.com/q/26449333
tags question: http://stackoverflow.com/q/26389182
tags question: http://stackoverflow.com/q/26419842
tags question: http://stackoverflow.com/q/26473461
tag name: json
tags question: http://stackoverflow.com/q/26513365
tags question: http://stackoverflow.com/q/26371900
tags question: http://stackoverflow.com/q/26493800
tags question: http://stackoverflow.com/q/26411379
tags question: http://stackoverflow.com/q/26485996
tags question: http://stackoverflow.com/q/26358684
tags question: http://stackoverflow.com/q/26502867
tags question: http://stackoverflow.com/q/26416332
tags question: http://stackoverflow.com/q/26462429
tags question: http://stackoverflow.com/q/26399149
tags question: http://stackoverflow.com/q/26381320
tags question: http://stackoverflow.com/q/26389376
tags question: http://stackoverflow.com/q/26442564
tags question: http://stackoverflow.com/q/26401131
tags question: http://stackoverflow.com/q/26426808
tags question: http://stackoverflow.com/q/26437047
tags question: http://stackoverflow.com/q/26461180
tags question: http://stackoverflow.com/q/26449763
tags question: http://stackoverflow.com/q/26440278
tags question: http://stackoverflow.com/q/26510089
tags question: http://stackoverflow.com/q/26474206
tags question: http://stackoverflow.com/q/26449934

http://stackoverflow.com/q/26415499
answer count: 1
tagged with: events
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/26415557
tagged with: java
type: Question
tagged with: mouseevent
score: 0
has body: I make a method to drag any Component what I want even a JFrame I use a MouseInputAdapter to make de functions I use the Mouse Events and Mouse Motion Events public static void Mover(final Component obj, final boolean info) { MouseInputAdapter d = new MouseInputAdapter() { int x, X, y, Y; @Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { x = e.getXOnScreen(); X = obj.getLocation().x; y = e.getYOnScreen(); Y = obj.getLocation().y; } } @Override public void mouseDragged(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { obj.setLocation(X + (e.getXOnScreen() - x), Y + (e.getYOnScreen() - y)); } } }; obj.addMouseListener(d); obj.addMouseMotionListener(d); } so what is the difference MouseInputAdapter and MouseAdapter? what its better? thanks for yours advices and answers
has title: what is the difference MouseInputAdapter and MouseAdapter?

http://stackoverflow.com/comment/41531018
type: Comment
has text: Why should the last row have any 1s? There are no zeros in any diagonal.
type: QuestionComment
comment on: http://stackoverflow.com/q/26444049
score: 0

http://stackoverflow.com/a/26414858
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26411231
type: Answer
score: 2
downvote count: 0
has body: Not the optimal solution but you can have nested html table code in the Cell Example ... userColumn = new Column&lt;User, SafeHtml&gt;(new SafeHtmlCell()) { @Override public SafeHtml getValue(User user) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.appendHtmlConstant("&lt;table style=\"width:100%\"&gt;"); for (Product product : user.getProducts()) { sb.appendHtmlConstant("&lt;tr&gt;"); sb.appendHtmlConstant("&lt;td&gt;" +product.getProductNumber()+"&lt;/td&gt;"); sb.appendHtmlConstant("&lt;td&gt;" +product.getName()+"&lt;/td&gt;"); sb.appendHtmlConstant("&lt;td&gt;" +product.getQuality()+"&lt;/td&gt;"); sb.appendHtmlConstant("&lt;tr&gt;"); } sb.appendHtmlConstant("&lt;/table&gt;"); return sb.toSafeHtml(); } };
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26411231

http://stackoverflow.com/comment/41652132
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26510649
has text: If anyone one of your "internal" activities finds it has been created without necessary previous setup, it should use an Intent to redirect to your normal "front door" activity.
score: 0

http://stackoverflow.com/q/26482205
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41600167
type: Question
has comment: http://stackoverflow.com/comment/41600084
has comment: http://stackoverflow.com/comment/41600206
tagged with: java
tagged with: overriding
has body: Is there a possibility for an overridden method to be resolved statically? And what is the relation between Invoke virtual and dynamic binding? Are all invoke virtual methods dynamically bound? class Dynamic { public void display() { System.out.println("in dynamic"); } public static void invoke(Dynamic x) { x.display(); } } here x.display shows invoke virtual? what does it mean?does it mean it is dynamically bound?
upvote count: 2
has comment: http://stackoverflow.com/comment/41600133
tagged with: dynamic-binding
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26482421
accepted answer: http://stackoverflow.com/a/26482421
has title: Overridden methods and dynamic binding
score: 2

http://stackoverflow.com/q/26394515
answer count: 1
tagged with: midi
tagged with: javax.sound.midi
has answer: http://stackoverflow.com/a/26397915
score: 0
has title: How to create MIDI Sysex Master Volume message from volume level?
type: AnsweredQuestion
has body: If volume level is represented as a float value between 0 and 1, how to create data bytes of the Universal SysEx Master Volume message? This is Sysex message constructor, with given Sysex message status byte (0xF0) and data bytes: new SysexMessage(0xF0, data, data.length) According to MIDI specification, there are 2 status bytes and 6 data bytes in the Master Volume message (without status bytes), with the last two data bytes specifying volume level: 0xF0 SysEx (Status) 0x7F Universal Realtime 0x7F Disregards channel 0x04 Sub-ID -- Device Control 0x01 Sub-ID2 -- Master Volume 0xLL Bits 0 to 6 of a 14-bit volume 0xMM Bits 7 to 13 of a 14-bit volume 0xF7 End of SysEx (Status) So, if I'm not wrong, data bytes should look like this: data = new byte[] { 0x7F, 0x7F, 0x04, 0x01, LL, MM } My question is how to get LL and MM bytes from a float volume level between 0 and 1?
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26397915

http://stackoverflow.com/comment/41523487
comment on: http://stackoverflow.com/q/26439804
score: 0
type: Comment
type: QuestionComment
has text: Try to use for autowired interface instead class. Maybe useful for you will be this link too: http://forum.spring.io/forum/spring-projects/container/80224-issue-injecting-transactional-dao-object-into-unit-test

http://stackoverflow.com/q/26448325
accepted answer: http://stackoverflow.com/a/26450424
possible better answer: http://stackoverflow.com/a/26448359
tagged with: java
has answer: http://stackoverflow.com/a/26448359
has title: Hadoop IntWritable Iterable retrieve value by index?
downvote count: 1
type: Question
type: AnsweredQuestion
score: -1
has answer: http://stackoverflow.com/a/46768829
tagged with: hadoop
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26450424
favorite count: 0
has body: I have a Iterable Object.To convert a IntWriter to int we can use get() method.Is there a way to retrieve the first value of an Iterable Intwriter object.I tried Iterator&lt;IntWritable&gt; values; values.get(0).get() //To retrieve the first value.

http://stackoverflow.com/q/26399155
has comment: http://stackoverflow.com/comment/41504458
tagged with: parsing
has comment: http://stackoverflow.com/comment/41504119
tagged with: http://stackoverflow.com/tag/rdf
tagged with: owl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41496088
tagged with: mapping
answer count: 0
tagged with: java
has title: mapping AnnotationAssertion into an owl:Class
has comment: http://stackoverflow.com/comment/41507547
has comment: http://stackoverflow.com/comment/41496388
has comment: http://stackoverflow.com/comment/41507599
type: Question
has body: I would like to change the structure of this RDF file and save it in OWL file, but i have big data thus i should write a program, which do this automatically. Any idea how could i map the annotation name to an owl:Class in java and which java library i need to download? &lt;rdf:Description rdf:about="http://www.onto-service.com/test.xml#co_67"&gt; &lt;j.0:qCount&gt;2&lt;/j.0:qCount&gt; &lt;j.0:name&gt;vendor&lt;/j.0:name&gt; &lt;j.0:mDate&gt;2014-10-03T11:17:56&lt;/j.0:mDate&gt; &lt;j.0:color&gt;0080FF&lt;/j.0:color&gt; &lt;j.0:cDate&gt;2014-10-02T19:53:25&lt;/j.0:cDate&gt; &lt;j.0:cCount&gt;2&lt;/j.0:cCount&gt; &lt;j.0:au&gt;Super&lt;/j.0:au&gt; &lt;/rdf:Description&gt; Please help me to resolve this problem. Thanks!
has comment: http://stackoverflow.com/comment/41459526
score: 0

http://stackoverflow.com/q/26399757
has answer: http://stackoverflow.com/a/26400377
tagged with: android
has comment: http://stackoverflow.com/comment/41452103
accepted answer: http://stackoverflow.com/a/26406102
has comment: http://stackoverflow.com/comment/41452728
linked to: http://stackoverflow.com/q/4834750
has comment: http://stackoverflow.com/comment/41450037
has comment: http://stackoverflow.com/comment/41451550
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41452406
has body: I have implemented a list view using a custom array adapter. Now I want to get the selected item of the list view. I know that there are solutions using onclick listeners. However I would like to use the getSelectedItem() method of the ListView (AdapterView) class. The method always returns null. The other getSelected* methods also do not work. // onCreate mList = (ListView) findViewById(R.id.listView); // set in Broadcast Receiver (inner class) mList.setAdapter(new ListAdapter(getApplicationContext(), R.layout.list_view_item, R.id.textView, itemList)); // onButtonClick Log.i(TAG, "Selected: " + mList.getSelectedItem()); OnButtonClick is a callback of a seperate button. If I click on it the selected item should be printed in logcat but it returns everytime null. Can anyone help me? XML: </RelativeLayout> If I select an item the color changes.
has comment: http://stackoverflow.com/comment/41452294
score: 1
tagged with: java
has title: Android ListView - get the selected item
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41450084
has comment: http://stackoverflow.com/comment/41451246
has comment: http://stackoverflow.com/comment/41453161
tagged with: android-arrayadapter
has answer: http://stackoverflow.com/a/26406102
has comment: http://stackoverflow.com/comment/41454141
tagged with: listview
answer count: 3
has answer: http://stackoverflow.com/a/26399890
tagged with: android-listview
downvote count: 0
has comment: http://stackoverflow.com/comment/41452481
favorite count: 0
possible better answer: http://stackoverflow.com/a/26399890
has comment: http://stackoverflow.com/comment/41452292

http://stackoverflow.com/a/26421851
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26421701
answers question: http://stackoverflow.com/q/26421701
type: Answer
has comment: http://stackoverflow.com/comment/41490322
upvote count: 11
has comment: http://stackoverflow.com/comment/41491016
has comment: http://stackoverflow.com/comment/41489938
score: 11
has comment: http://stackoverflow.com/comment/41490320
has comment: http://stackoverflow.com/comment/41490363
has body: There are primarily 2 things you should know. If 2 threads call the same method, each thread will have a different Stack Frame for the method. So, method local variables are thread safe. The changes made in local variables of one method will not interfere with other thread's changes. You should (usually) worry about thread-safety / interference when you have a shared resource being modified by both threads. PS : Your doSum() does very little processing. A smart JVM might actually inline the method.

http://stackoverflow.com/comment/41548730
type: Comment
has text: Well, you just have to use `javac` and add the servlets-api.jar to the classpath. It's like compiling any other class from command line.
comment on: http://stackoverflow.com/q/26453948
score: 0
type: QuestionComment

http://stackoverflow.com/q/26500655
type: Question
has body: See the snipper below USPresident usPresident = new USPresident(56); try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("/home/nikhil/dev/USPresident.data"))){ oos.writeObject(usPresident); usPresident.setTerm(57); oos.writeObject(usPresident); System.out.println("Serialized"); } Created an Instance of President with term as 56. Serialized it. Reset the term to 57 Serialized it again But, when I deserialize the object, it still has the term as 56 (and not 57!) I see this explanation given i book, Yes, it will print 56 even though you changed the term using its setter to 57 and serialized again. This happens due to serialVersionUID, which is checked by the JVM at the time of serialization. If a class is already serialized and you try to serialize it again, the JVM will not serialize it. But, as of my understanding, serialVersionUID is used to check if the Class object matches with the serialized object during deserialization. Also, the serialVersionUID is used as an identifier of the Object signature and not the state. Don't understand what is happening here. Can someone explain this behavior? Had a look into the implementation of ObjectOutputStream and this is how writeObjet is implemented public final void writeObject(Object obj) throws IOException { if (enableOverride) { writeObjectOverride(obj); return; } try { writeObject0(obj, false); } catch (IOException ex) { if (depth == 0) { writeFatalException(ex); } throw ex; } } see the boolean enableOverride . This has to be true to write 'modified' object. However, this can be set to true, only if the use does subclass the ObjectOutputStream. See the protected constructor below, protected ObjectOutputStream() throws IOException, SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION); } bout = null; handles = null; subs = null; enableOverride = true; debugInfoStack = null; } Why such a strange behavior?
downvote count: 0
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/26501074
possible better answer: http://stackoverflow.com/a/26500848
favorite count: 0
tagged with: serialization
accepted answer: http://stackoverflow.com/a/26500689
has title: Cannot Serialize a class already Serialized?
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26500689
has answer: http://stackoverflow.com/a/26500848

http://stackoverflow.com/q/26491528
answer count: 0
tagged with: swing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41616927
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/41621335
has title: displaiyng the data from my databse to my table
has body: i need help displaying my data to my database and i keep getting these errors please someone help ill display the code and the errors import java.awt.*; import java.awt.event.*; import java.sql.Connection; import java.sql.ResultSet; import javax.swing.*; import javax.swing.table.*; import net.proteanit.sql.DbUtils; import javax.swing.JInternalFrame; public class Form3 extends JInternalFrame { private JButton button = new JButton("Button"); private JTable table = new JTable(new DefaultTableModel(100,11)); private javax.swing.JScrollPane jsp = new JScrollPane(table); /** * Launch the application. */ Connection conn = null; /** * Create the frame. */ public Form3() { super(); setBounds(-10, -10, 600, 450); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent argo) { try{ String query1 = "SELECT * FROM csc3610_Connection.Oilform"; java.sql.PreparedStatement pst1= conn.prepareStatement(query1); ResultSet rs = pst1.executeQuery(); table.setModel(DbUtils.resultSetToTableModel(rs)); }catch (Exception e){ e.printStackTrace(); } } }); JPanel panel = new JPanel(); panel.add(button); getContentPane().add(panel, BorderLayout.WEST); jsp.setBorder(BorderFactory.createLineBorder(Color.red)); jsp.getViewport().setPreferredSize(new Dimension(500, 500)); getContentPane().add(jsp, BorderLayout.CENTER); table.getColumnModel().getColumn(10).setPreferredWidth(6); table.setGridColor(Color.gray); } private void display() { JFrame f = new JFrame("TablePanel"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(this); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } } and here are the errors i get someone please help me. i have no idea what these errors mean and its making me made. java.lang.NullPointerException at guii.Form3$1.actionPerformed(Form3.java:39) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.sw…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41618282
has comment: http://stackoverflow.com/comment/41624399
has comment: http://stackoverflow.com/comment/41616868
has comment: http://stackoverflow.com/comment/41617420

http://stackoverflow.com/q/26439252
answer count: 1
has answer: http://stackoverflow.com/a/26439321
accepted answer: http://stackoverflow.com/a/26439321
downvote count: 0
tagged with: java-io
tagged with: exception
upvote count: 1
has body: hi i'm learing Object Serialization and tried this import java.io.*; class Employee implements Serializable{ Employee(int temp_id,String temp_name) { id=temp_id; name=temp_name; } int id; String name; } public class SerialTest{ public static void main(String[] args) { Employee e1=new Employee(14,"John"); try{ FileOutputStream fileStream=new FileOutputStream("myserial.ser"); ObjectOutputStream os=new ObjectOutputStream(fileStream); os.writeObject(e1); } catch(IOException ioex) { ioex.printStackTrace(); } finally{ os.close(); } }//main ends }//class ends The program worked before i put in the call to os.close(); Now i doesn't compile , i get the error saying SerialTest.java:29: cannot find symbol symbol : variable os location: class SerialTest os.close(); ^ It worked before i tried to close the ObjectOutPutStream , the contents of the serialized file are below , ¬í^@^Esr^@^HEmployee^S&lt;89>S§±&lt;9b>éØ^B^@^BI^@^BidL^@^Dnamet^@^RLjava/lang/String;xp^@^@^@^Nt^@^GSainath ~ i cant seem to understand where i am going wrong , please help!
has comment: http://stackoverflow.com/comment/41522365
has comment: http://stackoverflow.com/comment/41522302
has comment: http://stackoverflow.com/comment/41522322
favorite count: 0
has comment: http://stackoverflow.com/comment/41522405
has title: Java Object Serialization ,Unable to close ObjectOutputStream?
tagged with: object-serialization
tagged with: cannot-find-symbol
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/26362563
has body: Yes you can do this in both Jena Rules and in Jena ARQ (the query processing engine for SPARQL). The Setup Let us assume that you have defined a structured representation of your data. For Xi, you have an object that corresponds to something like this (N3): [ a :Entry ; :hasEntryValue 4.3 ] Then, for your set, A, you can define its values as an RDF Collection such as rdf:List. The following N3 woudl describe the set A={4.3, 4.2}, for example. [ a :Set ; dct:identifier "A" ; entries ( [ a :Entry ; :hasEntryValue 4.3 ][ a :Entry ; :hasEntryValue 4.2 ] ) ] . In Jena Rules In Jena rules, you could write something along the lines of: [calculate: ( ?set rdf:type :Set ), ( ?set rdfs:member ?x0 ), nextSmallest( ?set ?x0 ?x1 ), makeSkolem( ?calculated ?x0 ?set), difference( ?difference ?x0 ?x1) -&gt; (?calculated :hasValue ?difference), (?calculated :derivedFrom ?x0), (?calculated :derivedFrom ?x1) ] This would require you to construct a Jena Builtin for the nextSmallest portion of the query. The above rule would, for a given value, ?x0, within a particular set ,?set, attempt to identify the nextSmallest element, ?x1, and (if that succeeds) construct a new node, ?calculated and associate the ?difference with it by means of some domain-specific :hasValue property. As a style note, I also introduced a :derivedFrom property in order to trace where that node came from so it wouldn't be useless as a calculation result. In ARQ / SPARQL The first question is whether or not you want the results to be in your graph with your data (as in the rule-based approach) or if you simply want the results. If you simply want the results, you have a choice as to whether or not the results are in a graph form. The simplest approach would be to simply SELECT the results: SELECT ?set ?x0Val (BIND(?x1Val-?x0Val) AS ?difference) WHERE { ?set rdf:type :Set . ?set rdfs:member ?x0 . ?set rdfs:member ?x1 . ?x0 :hasEntryValue ?x0Val . ?x1 :hasEntryValue ?x1Val . FILTER( ?x0Val &lt; ?x1Val ) FILTER NOT EXI…
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26358919

http://stackoverflow.com/comment/41639382
score: 0
comment on: http://stackoverflow.com/q/26503995
has text: `boolean charIsY = (ch=='y' || ch=='Y');`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26469343
has comment: http://stackoverflow.com/comment/41576415
has answer: http://stackoverflow.com/a/26469977
has comment: http://stackoverflow.com/comment/41579737
accepted answer: http://stackoverflow.com/a/26471778
has title: JAVA Arranging Stacks how to keep original
answer count: 4
possible better answer: http://stackoverflow.com/a/26469501
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41580619
has answer: http://stackoverflow.com/a/26469501
score: 0
tagged with: stack
tagged with: java
has comment: http://stackoverflow.com/comment/41577341
has comment: http://stackoverflow.com/comment/41577466
has body: Okay guys htis is my updated code. This is what I have. I need stack to keep it original numbers and I need stack 2,3,and 4 to keep their original numbers and right now all I'm getting is 1s 2s and 0s import java.util.Random; public class Lab5 { public static void main(String[] arg) { Random rnd = new Random(); Stack&lt;Integer&gt; stack = new IStack&lt;Integer&gt;(); Stack&lt;Integer&gt; stack2= new IStack&lt;Integer&gt;(); Stack&lt;Integer&gt; stack3= new IStack&lt;Integer&gt;(); Stack&lt;Integer&gt; stack4= new IStack&lt;Integer&gt;(); int stream,y; for(int i=0;i&lt;20;i++) { stream = rnd.nextInt(101); stack.push(stream); // stack2.push(stream); } for(int i=0; i&lt;20; i++) { int x = stack.pop()%3; if(x == 0%3) stack2.push(x); if(x == 1%3) stack4.push(x); if(x == 2%3) stack3.push(x); } while( !stack.isEmpty() ) System.out.print(stack.pop()+" "); System.out.println(); while( !stack2.isEmpty() ) System.out.print(stack2.pop()+" "); System.out.println(); while( !stack3.isEmpty() ) System.out.print(stack3.pop()+" "); System.out.println(); while( !stack4.isEmpty() ) System.out.print(stack4.pop()+" "); System.out.println(); } }
type: Question
has answer: http://stackoverflow.com/a/26469654
has answer: http://stackoverflow.com/a/26471778
has comment: http://stackoverflow.com/comment/41576393
tagged with: runtime-error

http://stackoverflow.com/comment/41619538
type: QuestionComment
comment on: http://stackoverflow.com/q/26492163
score: 0
type: Comment
has text: You can't. You have to make the logic such that you won't even try to show the fragment until the data is loaded or prevent the user from interacting with it in some way. What happens if connection is lost before data is finished? What if the data is corrupted? What happens if it takes 5 minutes to download?

http://stackoverflow.com/comment/41499369
type: QuestionComment
comment on: http://stackoverflow.com/q/26425932
has text: Thanks, create an answer and I'll mark it as the solution if you care.
score: 0
type: Comment

http://stackoverflow.com/q/26473453
tagged with: google-sheets-api
has body: I'm accessing a public Google Docs Spreadsheet using the Google Sheets API. The API says that when you query a list-feed for a worksheet, you get back a list of rows excluding the first row, which is the header row (by convention). Is there a way to access the header row? I see that you can use the cells feed to request specific cells: // Fetch column 4, and every row after row 1. URL cellFeedUrl = new URI(worksheet.getCellFeedUrl().toString() + "?min-row=2&amp;min-col=4&amp;max-col=4").toURL(); CellFeed cellFeed = service.getFeed(cellFeedUrl, CellFeed.class); Is there another way that is more explicit, to retrieve the header row?
tagged with: gdata
tagged with: google-sheets
has answer: http://stackoverflow.com/a/26474455
accepted answer: http://stackoverflow.com/a/26474455
tagged with: gdata-api
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26477124
type: AnsweredQuestion
has title: Querying/Accessing/Retrieving Header row in Google Spreadsheet
tagged with: java
has answer: http://stackoverflow.com/a/26477124
type: Question

http://stackoverflow.com/q/26367288
has body: Code is nowhere near done but I'm basically stuck at this until I can move any further. Keep getting a local variable may not have been initialized on theirPhone.. If I move the constructor passed the try catch I get an error on the try catch, if I leave it the way it is I get the error at theirPhone.getAreaCode(phoneNumber); any help? import java.util.Scanner; public class CustomerTelephone { public static void main(String[] args) { CustomerTelephone theirPhone; String phoneNumber = "407 407 4074"; try { theirPhone = new CustomerTelephone(phoneNumber); } catch (InvalidTelephoneException ite) { System.out.println("Invalid telephone number format."); } theirPhone.getAreaCode(phoneNumber); } public CustomerTelephone(String telephone) throws InvalidTelephoneException { if (telephone.length() != 12) { throw new InvalidTelephoneException( "The phone number was entered incorrectly."); } } public String getAreaCode(String phoneNumber) { String goBack; String[] teleArray = phoneNumber.split("(?!^)"); goBack = teleArray[0 - 2]; return goBack; } public String getExchange(String phoneNumber) { String goBack = null; return goBack; } public String getLocalNumber(String phoneNumber) { String goBack = null; return goBack; } }
has title: The local variable may not have been initialized constructor/method
answer count: 3
accepted answer: http://stackoverflow.com/a/26367597
downvote count: 0
has answer: http://stackoverflow.com/a/26367599
favorite count: 0
tagged with: constructor
upvote count: 1
possible better answer: http://stackoverflow.com/a/26367633
has answer: http://stackoverflow.com/a/26367633
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/26367597
type: Question
tagged with: local
tagged with: variables

http://stackoverflow.com/comment/41479902
type: AnswerComment
has text: How is the way to implement a comparable? sorry is the first time I use this structure
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26416272

http://stackoverflow.com/comment/41523122
has text: I don't think xmlReader modifies the resource. I think the dtd file is only used in read mode and concurrency is not a problem. Thanks for support.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26439239

http://stackoverflow.com/comment/41499406
has text: GenerationType.AUTO means you have the sequence table, so you need to SchemaGeneration for the table to be created.
score: 0
comment on: http://stackoverflow.com/q/26426878
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/92852959
score: 0
has text: Wow! Great answer :)
type: AnswerComment
comment on: http://stackoverflow.com/a/46000524
type: Comment

http://stackoverflow.com/comment/41437240
type: QuestionComment
has text: magic??? yeah!!?.. its avada kedavra!!! .. lol.. to be b serious elaborate futher on your error, maybe with codes or logcat
comment on: http://stackoverflow.com/q/26392097
score: 0
type: Comment

http://stackoverflow.com/q/26448345
type: AnsweredQuestion
tagged with: java
has title: Object cloning with mutable fields
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26448561
possible better answer: http://stackoverflow.com/a/26448561
score: 0
has comment: http://stackoverflow.com/comment/41538587
has answer: http://stackoverflow.com/a/26448506
has body: I am studying about clone() method of the Object class. I have tried the following example. public class Orange { private Double price; public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } } public class Fruit implements Cloneable { private String colour; private String fruitCode; private Orange orange; public String getColour() { return colour; } public void setColour(String colour) { this.colour = colour; } public String getFruitCode() { return fruitCode; } public void setFruitCode(String fruitCode) { this.fruitCode = fruitCode; } public Orange getOrange() { return orange; } public void setOrange(Orange orange) { this.orange = orange; } @Override protected Object clone() throws CloneNotSupportedException { return super.clone(); } @Override public boolean equals(Object obj) { Fruit other = (Fruit)obj; return new EqualsBuilder().append(this.getFruitCode(), other.getFruitCode()).append(this.colour, other.colour).isEquals(); } @Override public int hashCode() { return new HashCodeBuilder().append(this.getFruitCode()).append(this.colour).toHashCode(); } } public class CloneTest { public static void main(String[] args) { Fruit fruit = new Fruit(); try { fruit.setOrange(new Orange()); fruit.getOrange().setPrice(12.45); fruit.setFruitCode("X1"); Fruit clonedFruit = (Fruit) fruit.clone(); fruit.setFruitCode("X2"); fruit.getOrange().setPrice(15.5); System.out.println("fruit's orange price is : "+fruit.getOrange().getPrice()); System.out.println("clonedFruit's orange price is : "+clonedFruit.getOrange().getPrice()); System.out.println("fruit's code is : "+fruit.getFruitCode()); System.out.println("fruit's code is : "+clonedFruit.getFruitCode()); } catch (CloneNotSupportedException ex) { Logger.getLogger(CloneTest.class.getName()).log(Level.SEVERE, null, ex); } } } **out put is** fruit's orange price is : 15.5 clonedFruit's orange price is : 15.5 fruit's code is : X2 fruit's code is : X1 Note that I have changed the orange objec…
accepted answer: http://stackoverflow.com/a/26448506

http://stackoverflow.com/comment/41611552
comment on: http://stackoverflow.com/q/26488398
has text: @aruisdante You are also wrong about "the reference in `aBar.aFoo` is completely unchanged". Since `bFoo` is the same as `aBar.aFoo`, this cannot be true.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26417536
tagged with: java
tagged with: floating-point
has answer: http://stackoverflow.com/a/26417565
type: Question
has comment: http://stackoverflow.com/comment/41485906
has body: I have been struggling to understand the concept of roundoff errors in Java with floating-point. While I understand that double is not supposed to be used for financial calculations, I don't understand why the 'd' variable does not come out to 0.0. How can I get this to print out the first println? package zetcom; public class floatingComparison { public static void main(String[] args) { double r = Math.sqrt(2); double d = r * r - 2; if (d == 0) { System.out.println("sqrt(2) squared minus 2 is 0"); } else { System.out.println("sqrt(2) squared minus 2 is " + d); } } } Any explanation would be appreciated.
has answer: http://stackoverflow.com/a/26417561
linked to: http://stackoverflow.com/q/588004
has comment: http://stackoverflow.com/comment/41482283
score: 0
answer count: 2
duplicate of: http://stackoverflow.com/q/588004
possible better answer: http://stackoverflow.com/a/26417561
has comment: http://stackoverflow.com/comment/41482159
accepted answer: http://stackoverflow.com/a/26417565
has title: Why do floating-point numbers have roundoff errors?
tagged with: double
type: AnsweredQuestion

http://stackoverflow.com/q/26442579
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41549551
tagged with: eclipse
has body: Even though I disabled the package-info warning, I still get this warning in a jUnit class and another enum class. They are both part of the same project but in different packages, and every other class in either package doesn't pop up this warning anymore. How can I solve this? I tried turning checkstyle on and off again just to let Eclipse rebuild the project, but it doesn't get fixed.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Turning off package-info warning in Checkstyle for Eclipse doesn't work
tagged with: checkstyle
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26404790
possible better answer: http://stackoverflow.com/a/26404955
favorite count: 0
has comment: http://stackoverflow.com/comment/41458353
has answer: http://stackoverflow.com/a/26404955
tagged with: regex
has title: replace single digits which surrounding non-digits with a space using java
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26404852
upvote count: 0
has body: I want to replace single digits which surrounding alpha charactors[a-zA-Z] with a space in a string as follows. "Foo 12 Bar" =&gt; "Foo 12 Bar" //1 and 2 shouldn’t be replaced "Foo12Bar" =&gt; "Foo12Bar" // 1 and 2 shouldn’t be replaced "Foo1Bar" =&gt; "Foo Bar" //1 shouldn’t be replaced "Foo2Bar" =&gt; "Foo Bar" //2 shouldn’t be replaced "Foo 1Bar" =&gt; "Foo 1Bar" //1 shouldn’t be replaced(space @ left side) any help on this?
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/26404875
accepted answer: http://stackoverflow.com/a/26404875
downvote count: 1
has answer: http://stackoverflow.com/a/26405545

http://stackoverflow.com/q/26365291
has title: Coudn't hit the contextroot in Spring MVC
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41388378
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/26365455
has body: I am a newbie to Spring MVC, trying to develop a small application. My problem is when i try to hit the application with localhost:8080/MyFirstApplication I get an error saying request resource is not available. However when I change the url-pattern to /forms/*, I am able to hit the application localhost:8080/MyFirstApplication/forms/loginform.jsp. I have placed the loginform.jsp in WEB-INF/views/. MyFirstApplication dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / loginform.jsp Can someone pls pointout what has gone wrong here!
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/70070231
type: Comment
score: 1
has text: @Rexxar: Don't know, but that's a very good question! Go ahead and make it a separate question and post the link here for others.
comment on: http://stackoverflow.com/a/34501284
type: AnswerComment

http://stackoverflow.com/q/26444223
has comment: http://stackoverflow.com/comment/41531190
score: 0
has answer: http://stackoverflow.com/a/26444275
has title: How do I create a loop in java that checks a single scanner line for next()
has answer: http://stackoverflow.com/a/26444350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41531146
type: Question
has comment: http://stackoverflow.com/comment/41531169
has body: System.out.print("Enter some stuff:"); while (input.hasNext()){ System.out.print(input.next()+ " "); } Whenever this runs, it asks the user for input, then prints it all out. However, what I want, is a loop that will print out all of the tokens of a scanner. Then, it realizes there are no more tokens, and the loop exits.
tagged with: java
answer count: 2

http://stackoverflow.com/a/26446940
score: 1
answers question: http://stackoverflow.com/q/26439141
has body: You can use Tattletale. Tattletale is an excellent tool that recursively scans your application and provides detailed reports about its contents. Tattletale 1.2.0.Beta2 or later contains additional support to help with the new JBoss Modules class loading used in WildFly. Tattletale's "jbossas7" report can be used to to automatically identify and specify dependent module names in your application's jboss-deployment-structure.xml file. Use Tattletale to find application dependencies
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41462491
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26364583
has text: It's not updating on another thread: this will run on the FX Application Thread. It worked for me, but working with lookups like this is not very robust.

http://stackoverflow.com/comment/41450355
comment on: http://stackoverflow.com/q/26400049
score: 0
has text: That would be pretty neat in some cases but I doubt it's possible.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26493924
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Punctuation in Noun Phrase Extraction
has comment: http://stackoverflow.com/comment/41739065
downvote count: 0
tagged with: nlp
favorite count: 0
tagged with: phrase
type: UnansweredQuestion
tagged with: opennlp
has body: I am using OpenNLP to extract noun phrases from documents. In reviewing the output, I discovered that the phrase chunker ignores commas, leading to noun phrases that combine, for instance, multiple elements of a list into one phrase or two clauses in a sentence into one noun phrase. As a dummy example: public class TestTokenizer { public static void main(String[] args) throws IOException { String content = "dog, cat, fish, rat"; String[] tokens = NLPToolsControllerOpenNLP.getInstance().getTokeniser().tokenize(content); String[] pos = NLPToolsControllerOpenNLP.getInstance().getPosTagger().tag(tokens); String[] phrases = NLPToolsControllerOpenNLP.getInstance().getPhraseChunker().chunk(tokens, pos); for(int i = 0; i&lt;tokens.length; i++) { System.out.println("Token: " + tokens[i] + " and POS: " + phrases[i]); } List&lt;String&gt; candidates = new ArrayList&lt;String&gt;(); String phrase = ""; for (int n = 0; n &lt; tokens.length; n++) { if (phrases[n].equals("B-NP")) { phrase = tokens[n]; for (int m = n + 1; m &lt; tokens.length; m++) { if (phrases[m].equals("I-NP")) { phrase = phrase + " " + tokens[m]; } else { n = m; break; } } phrase = phrase.replaceAll("\\s+", " ").trim(); System.out.println("phrase: " + phrase); } } outputs: Token: dog and POS: B-NP Token: , and POS: I-NP Token: cat and POS: I-NP Token: , and POS: I-NP Token: fish and POS: I-NP Token: , and POS: O Token: rat and POS: B-NP phrase: dog , cat , fish phrase: rat Parentheses have the same issue: because the chunker tags them with I-NP, I end up with noun phrases containing them. The OpenNLP documentation says that "The OpenNLP Sentence Detector can detect that a punctuation character marks the end of a sentence or not." As such, I am a bit surprised that the phrase detector cannot detect the use of a comma or a parenthesis to mark the beginning or end of a phrase. Is there something I am missing here? Is there another approach that I should use? I am trying to avoid dealing with these issues on a case…
answer count: 0

http://stackoverflow.com/a/26464116
type: Answer
upvote count: 1
downvote count: 1
has body: Try this way,hope this will help you to solve your problem. for (AudioFile _data : itemsAll) { String[] subStringsArray = _data.getSubStrings(); for(String subString : subStringsArray){ if(subString.equals(constraint)){ suggestions.add(_data); break; } } }
accepted answer of: http://stackoverflow.com/q/26463899
answers question: http://stackoverflow.com/q/26463899
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/26510656
answer count: 2
has title: HttpSession with Servlet + Java not working
type: AnsweredQuestion
has body: i have the following pice of code 'anmelden.java': @WebServlet("/anmelden") public class anmelden extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String benutzer = request.getParameter("benutzer"); String passwort = request.getParameter("passwort"); try { PrintWriter out = response.getWriter(); Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost/test","admin","*****"); PreparedStatement stmt = con.prepareStatement("SELECT benutzer,passwort,rolle FROM login WHERE benutzer = ? AND passwort = ?"); stmt.setString(1, benutzer); stmt.setString(2, passwort); ResultSet rs = stmt.executeQuery(); if(rs.next()) { HttpSession session = request.getSession(); session.setAttribute("benutzer", rs.getString("benutzer")); RequestDispatcher dis = request.getRequestDispatcher("mandant.jsp"); dis.forward(request, response); out.print("1"); } else { out.print("Benutzername und/oder Passwort falsch"); } } catch (Exception e) { e.printStackTrace(); } } } This is my jsp file 'login.jsp': $("#anmelden").click(function(){ var benutzer = $("#benutzer").val(); var passwort = $("#passwort").val(); if(benutzer == "" || passwort == "") { return; } $.ajax({ url:"anmelden", type:"POST", data:"benutzer="+benutzer+"&amp;passwort="+passwort }).success(function(data){ var erfolg = data; if(erfolg == "1") { window.location.href="http://localhost:8080/PSD/mandant.jsp"; } else { $("#ok").text(erfolg); } }); }); As u can see i tries to set the name coming from my DB into my session Attribute. I want to use the Attribute in my 'mandant.jsp' file. But it dosen't work - all what happens is, that my 'login.jsp' file which makes the ajax call, print the code from 'mandant.jsp' into my div as text. So it dosen't opend the next page as i want -.- But if i comment out the HttpSession block then it works fine but then i …
tagged with: jsp
type: Question
has answer: http://stackoverflow.com/a/26510906
score: 0
has answer: http://stackoverflow.com/a/26510919
tagged with: java
possible better answer: http://stackoverflow.com/a/26510919
tagged with: servlets
accepted answer: http://stackoverflow.com/a/26510906

http://stackoverflow.com/q/26375962
tagged with: java
accepted answer: http://stackoverflow.com/a/26376047
tagged with: loops
has title: Java menu looping
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26376030
has comment: http://stackoverflow.com/comment/41407795
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26376960
type: Question
possible better answer: http://stackoverflow.com/a/26376960
has answer: http://stackoverflow.com/a/26376047
answer count: 3
upvote count: 1
has body: I have a conversion program that will not cooperate with me. It converts meters to: Kilometers, Inches, Feet, or it Exits the program. My problem is that it is supposed to keep on going and allow you to enter choice 1, get the answer and keep entering choices until you hit 4 to end the program. So far it ends after calculating the first choice or after telling that a distance in meters cannot be a negative number no matter what. This is the first time I have asked a forum for help and I am VERY new to java so please keep it simple for me. import java.util.Scanner; public class ConversionProgram { public static void showKilometers(double meters) //Converts Meters to Kilometers { double kilometers = meters * 0.001; System.out.println(meters + " meters is " + kilometers + " kilometers."); } public static void showInches(double meters) //Converts Meters to Inches { double inches = meters * 39.37; System.out.println(meters + " meters is " + inches + " inches."); } public static void showFeet(double meters) //Converts Meters to Feet { double feet = meters * 3.281; System.out.println(meters + " meters is " + feet + " feet."); } public static void quitProgram() { System.out.println("Bye!"); } public static void showMenu() { System.out.println(" 1. Convert to Kilometers "); System.out.println(" 2. Convert to Inches "); System.out.println(" 3. Convert to Feet "); System.out.println(" 4. Quit the program "); System.out.println(" "); } public static void main(String[] args) { double meters; int choice; Scanner keyboard = new Scanner(System.in); System.out.println("Enter a Distance in Meters: "); meters = keyboard.nextDouble(); if (meters &lt; 1) { System.out.println("Meter can not be negative."); } else showMenu(); choice = keyboard.nextInt(); switch (choice) { case 1: showKilometers(meters); break; case 2: showInches(meters); break; case 3: showFeet(meters); break; case 4: quitProgram(); break; } } }

http://stackoverflow.com/q/26442082
has comment: http://stackoverflow.com/comment/41527285
tagged with: java
type: UnansweredQuestion
tagged with: literals
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26442210
type: Question
has answer: http://stackoverflow.com/a/26442110
tagged with: integer
score: -1
tagged with: double
answer count: 3
has title: In Java, how do you print out an anwer in a different literal?
has answer: http://stackoverflow.com/a/26442105
has body: I know that you add an L to a value if it exceeds the scope of an integer but you still have to print it as such. I understand the concept of doing it when you're just printing out a plain number. What about when you're using a defined variable instad? Say I have something like. double a = 2.5; System.out.println(a); I want "a" to be printed out as a integer. Thanks for any answers in advance :)
downvote count: 1

http://stackoverflow.com/a/26388604
has comment: http://stackoverflow.com/comment/41431154
has comment: http://stackoverflow.com/comment/41452972
score: 2
has comment: http://stackoverflow.com/comment/41432056
upvote count: 3
has comment: http://stackoverflow.com/comment/41430854
downvote count: 1
has comment: http://stackoverflow.com/comment/41433391
accepted answer of: http://stackoverflow.com/q/26388465
has body: Basically you are positioning the cursor before the first row and then requesting data. You need to move the cursor to the first row. So first call result.next();
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26388465
type: Answer

http://stackoverflow.com/comment/41620153
score: 0
type: Comment
type: QuestionComment
has text: @MarshallTigerus, Sorry I didnt get your point. Class A is subclass of Class B and also the methods are overridden in Class A
comment on: http://stackoverflow.com/q/26493005

http://stackoverflow.com/comment/41646523
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26507900
has text: Can you post the generated code for `ParameterValueList`? In [this answer](http://stackoverflow.com/questions/3237473/jaxb-exception-class-not-known-to-this-context), they suggest adding an annotation to include the missing class:

http://stackoverflow.com/comment/41652452
comment on: http://stackoverflow.com/q/26511023
type: Comment
has text: why are you posting all of your source... nobody wants to read that.
type: QuestionComment
score: 0

masking
tag name: masking
tags question: http://stackoverflow.com/q/26370928
type: Tag

http://stackoverflow.com/q/26386336
type: Question
has answer: http://stackoverflow.com/a/26386446
downvote count: 0
tagged with: monitoring
tagged with: tomcat
tagged with: reporting
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I'd like to monitor my Tomcat Webserver in real-time. e.g. each 5 seconds a script/program tells me how a) many users currently online b) how many requests in total c) how many megabytes transferred d) avg. response time e) how many java objects have been initialized since then. Is that possbible? If yes, using what framework/API?
score: 1
tagged with: java
has title: Real-time reporting Tomcat Webserver

http://stackoverflow.com/q/26390854
downvote count: 0
score: 4
tagged with: qpid
answer count: 3
favorite count: 0
has title: QPID broker with RabbitMQ client authentication exception
has answer: http://stackoverflow.com/a/55813564
type: UnansweredQuestion
tagged with: authentication
has answer: http://stackoverflow.com/a/26420858
tagged with: rabbitmq
tagged with: java
type: Question
upvote count: 4
has body: I am testing using the Java QPID broker. I was able to send and receive messages using the proton client but with anonymous authentication. I am interested in testing with authentication turned on and understand the proton client does not support (yet). I therefore downloaded the rabbitMQ client jars. I am using password file authentication (that came with QPID). I set my RabbitMQ client connection factory like this: connectionFactory = new ConnectionFactory(); connectionFactory.setHost("localhost"); connectionFactory.setUsername("guest"); connectionFactory.setPassword("guest"); The code fails on this line (specifically on getConnection). connection = RabbitMQConnectionFactory.getInstance().getConnection(); This is the exception: java.io.IOException: No compatible authentication mechanism found - server offered [CRAM-MD5] at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:309) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:590) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:612) at com.vue.rabbit.core.RabbitMQConnectionFactory.getConnection(RabbitMQConnectionFactory.java:37) at com.vue.rabbit.producer.SimpleProducer.main(SimpleProducer.java:25) If I change QPID broker to use anonymous authentication and also change client not to set user/password, I get a similar exception of "server offered [ANONYMOUS]" Am I doing something wrong? These should be compatible? Somewhat separate question is why is there a Java and C++ QPID broker if they both support the same on-wire AMQP protocol? Thanks in advance for any help!
tagged with: amqp
has answer: http://stackoverflow.com/a/36756913

http://stackoverflow.com/a/26457086
score: 1
upvote count: 1
downvote count: 0
has body: Make the variable non-local, an instance field, and then your problem is solved.
answers question: http://stackoverflow.com/q/26456992
type: Answer

http://stackoverflow.com/q/26400490
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/5813344
linked to: http://stackoverflow.com/q/26230170
tagged with: wicket
tagged with: multi-upload
score: 2
type: AnsweredQuestion
has body: I have created a multiuploadField object in wicket project which allows to select files and submit the files after clicking on submit button. But I want to auto submit the form once the file are selected by the user and upload the file without clicking the submit button. Is it possible to do this? Is there any way of doing it using onChange event or anything else. Upload form Thanks in advance.
has title: Wicket multiuploadField Auto submit
tagged with: java
has answer: http://stackoverflow.com/a/26402593
type: Question
accepted answer: http://stackoverflow.com/a/26402593
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26418113
has title: Why do I get an 'ArrayIndexOutOfBoundsException' error?
score: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/26418184
favorite count: 0
linked to: http://stackoverflow.com/q/7574543
possible better answer: http://stackoverflow.com/a/26418138
answer count: 4
has answer: http://stackoverflow.com/a/26418184
type: AnsweredQuestion
has body: I'm new to Java programming. Can someone assist me with the following code: public class RandomSeq { public static void main(String[] args) { // command-line argument int N = Integer.parseInt(args[0]); // generate and print N numbers between 0 and 1 for (int i = 0; i &lt; N; i++) { System.out.println(Math.random()); } } } I receive the following error message when trying to compile: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 Thank you in advance. [1] I use a 64-bit Java 8 (Update 25) SE implementation, using a 64-bit Eclipse IDE for Java Developers (v. 4.4.1).
has answer: http://stackoverflow.com/a/26418180
has answer: http://stackoverflow.com/a/26418197
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41483066
tagged with: java
has answer: http://stackoverflow.com/a/26418138

http://stackoverflow.com/q/26354252
has body: I have a string in format MM/dd/yy hh:mm:ss am I need to convert this to date and at the same time I have to check if this date/time is in daylight savings time for America/New York time zone. My code is always returning false. Date calculatedDate; DateFormat df = new SimpleDateFormat("MM/dd/yy hh:mm:ss a"); public void checkIfDateIsDST() throws Exception { TimeZone timezoneone = TimeZone.getTimeZone("America/New York"); String datetime1 = "12/10/14 3:03:45 pm"; try { calculatedDate = df.parse(datetime1); } catch (ParseException e) { } TimeZone timezoneone = TimeZone.getTimeZone("America/New York"); System.out.println("In daylight time:" +timezoneone.getTimeZone("America/NewYork").inDaylightTime(calculatedDate)); }
has comment: http://stackoverflow.com/comment/41374280
has comment: http://stackoverflow.com/comment/41371615
has comment: http://stackoverflow.com/comment/41372235
type: UnansweredQuestion
has title: Convert a string to date in java and check if is in daylight savings for America/NewYork timezone
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41367938
type: Question
has comment: http://stackoverflow.com/comment/41373941
has comment: http://stackoverflow.com/comment/41367961

http://stackoverflow.com/q/26373206
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26373268
upvote count: 0
answer count: 1
has body: In my java program I have a text file of dates and im trying to store each into an array. However the day, month and year keep getting stored into a different part of the array and not together please help me. These are a few of the lines from the text file 12/12/1996,23/08/2000,27/02/1980 12/04/1976, 24/09/2003, 13/06/1993 30/07/1995, 20/06/2004, 23/05/1990 private static String person1Date[]; private static String person2Date[]; private static String person3Date[]; static int count =0; person1Date = new String[100]; person2Date = new String[100]; person3Date = new String[100]; File dateFiles = new File(dates.txt); Scanner dates = new Scanner(dateFiles); while(dates.hasNextLine) { String datesLine = dates.nextLine(); String [] datesDetails = datesLine.split(","); person1Date[count] = datesDetails[0].trim(); person2Date[count] = datesDetails[1].trim(); person3Date[count] = datesDetails[2].trim(); count++; }
favorite count: 0
has comment: http://stackoverflow.com/comment/41403174
has title: storing dates from a text file into an array

http://stackoverflow.com/q/26384294
downvote count: 0
has comment: http://stackoverflow.com/comment/41423301
has comment: http://stackoverflow.com/comment/41424929
has answer: http://stackoverflow.com/a/26416422
favorite count: 0
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/41425523
has comment: http://stackoverflow.com/comment/41423449
has comment: http://stackoverflow.com/comment/41423521
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41423490
tagged with: swing
score: 4
has title: JComboBox: Not editable but typeable
has comment: http://stackoverflow.com/comment/41427628
tagged with: java
has comment: http://stackoverflow.com/comment/41423827
linked to: http://stackoverflow.com/q/14865035
has comment: http://stackoverflow.com/comment/41423685
has comment: http://stackoverflow.com/comment/41424614
has comment: http://stackoverflow.com/comment/41423550
type: Question
has comment: http://stackoverflow.com/comment/41423188
has comment: http://stackoverflow.com/comment/41425974
has comment: http://stackoverflow.com/comment/41497787
has comment: http://stackoverflow.com/comment/41423258
upvote count: 4
has body: In my application, there is a JComboBox featuring about 200 entries. The people working with the application complain that it is frustrating to have to scroll all the way to the bottom, even though they know exactly what the last element of the list is. So I went and made the JComboBox editable, so they can just type in this last element. However, my database does not accept any values other than featured in the dropdown of this combobox. Is there a way to make the JComboBox only "typeable" instead of "editable", so it will let you type in values, but only as long as they match at least 1 item in the dropdown? Edit: As is turns out, the above demanded feature is already implemented per se. My application, however, is using custom code that somehow disables it. I cannot figure out where it happens ... as a matter of fact, I don't see at all what the below code is doing exactly. Edit2: I did some testing (took me quite some time) and figured out, that it is not my custom code that's disabling the feature. In fact, it was a somehow faulty implementation of the combobox-filling ComboBoxModel that prevented the jumping somehow. I can now type c and it jumps to the first entry beginning with c. However, I cannot type " " (space), because then the popup is going to close. I found this answer, but it seems overly complicated. Isn't there an easier way to do it?
has comment: http://stackoverflow.com/comment/41424161
answer count: 1

http://stackoverflow.com/comment/72872237
type: AnswerComment
has text: Also, if this was the case why make LocalDate Serializable?
comment on: http://stackoverflow.com/a/26451921
type: Comment
score: 7

http://stackoverflow.com/comment/41445314
score: 0
type: Comment
type: QuestionComment
has text: `Sel_RptDaywiseProduction` and `Sel_RptProdWiseSaleSumm` are two different stored procedures. Which one is having issues?
comment on: http://stackoverflow.com/q/26396926

http://stackoverflow.com/comment/41577005
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26424267
type: AnswerComment
has text: Thanks. This seems to work when I make the call through SoapUI. I have yet to test it on the web interface but confident it will work. Will keep you updated

http://stackoverflow.com/comment/41478157
comment on: http://stackoverflow.com/a/26413964
has text: Thanks but I don't know exactly what you mean with the loop at the server. Could you give some small example code? The clients send only one object, the server sends a answer but and closes the connection. So I don't have several requests per connection.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26449467
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26449111
has comment: http://stackoverflow.com/comment/41703900
accepted answer of: http://stackoverflow.com/q/26449111
has body: There's been a suggestion to use array.length and change the signature of divide to take an int for the second argument. If it is important for divide to take arguments of type E, consider adding a method public abstract E fromInt(int f); and using that to convert the length to E. That method could also replace setToZero(), or at least be used in a default implementation. In the interest of code reuse, consider moving add(), divide(), etc. to a separate class, Calculator&lt;E&gt;. An instance of Calculator would then be given to GenericAverage on creation. You may even want to move average() to the Calculator class.
type: AcceptedAnswer

http://stackoverflow.com/a/26387933
answers question: http://stackoverflow.com/q/26387645
accepted answer of: http://stackoverflow.com/q/26387645
type: AcceptedAnswer
downvote count: 0
has body: Found it, I can simply use @PropertySource("classpath:/settings/${env}/database.properties")
type: Answer
has comment: http://stackoverflow.com/comment/76749595
has comment: http://stackoverflow.com/comment/67575884
has comment: http://stackoverflow.com/comment/67622011
score: 24
upvote count: 24

http://stackoverflow.com/a/26456408
has body: You need to add a for-loop after: System.out.println ("Please enter" + count + "more values:"); The for-loop should run for count times, and each time the loop is run, it should ask the user for an input. You can then take that input and square it (remember - squaring is as easy as multiplying a number by itself! 2 * 2 = 4, or 2-squared) Once you have the squared number, add it to a sum variable which you will have created before the for-loop. Then just print out the sum after the for-loop. Here is a great tutorial on for-loops!
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41554418
accepted answer of: http://stackoverflow.com/q/26456186
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26456186

http://stackoverflow.com/comment/41431625
comment on: http://stackoverflow.com/a/26389036
type: AnswerComment
score: 0
type: Comment
has text: Check for port no 3306 . which default port on which mysql runs. Check if that port is open.

http://stackoverflow.com/q/26404301
has answer: http://stackoverflow.com/a/26411356
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/26411356
tagged with: netty
has title: How can I switch between 2 groups of handlers in netty
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am trying to write a client server application that communicate using Message Objects(Message Class is defined in my application). there is a scenario in which i want to transfer file between them. First I must send a message to client to notify it about specific file information and after that the file itself is going to be written to channel. The problem is how can I handle this scenario in client? Is it a good solution to remove Message handler after receiving message and replace it with a byte array handler? what are the alternatives?

http://stackoverflow.com/q/26441216
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26441271
has title: Exception in thread "main" java.util.IllegalFormatConversionException: d != java.lang.String
has answer: http://stackoverflow.com/a/26441337
upvote count: 2
has body: I'm new to Java and I'm not sure how to fix the error I'm getting when trying to run this code: import java.util.Scanner; public class P3_3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter a number: "); int number = in.nextInt(); if (number &lt; 0) number *= -1; if (number &gt;= 10 &amp;&amp; number &lt; 100) { number = 2; } else if (number &gt;= 100 &amp;&amp; number &lt; 1000) { number = 3; } else if (number &gt;= 1000 &amp;&amp; number &lt; 10000) { number = 4; } else if (number &gt;= 10000 &amp;&amp; number &lt; 100000) { number = 5; } else if (number &gt;= 100000 &amp;&amp; number &lt; 1000000) { number = 6; } else if (number &gt;= 1000000 &amp;&amp; number &lt; 10000000) { number = 7; } else if (number &gt;= 10000000 &amp;&amp; number &lt; 100000000) { number = 8; } else if (number &gt;= 100000000 &amp;&amp; number &lt; 1000000000) { number = 9; } else { System.out.println("Number is greater than 10 billion."); } System.out.printf("%d has ", number + "digits."); } } I'm trying to print how many digits the number has, by checking whether the number is &gt;= 10, &gt;= 100 and so on... I run the code and I'm able to input an int but once I input it and press enter all I get it an error and can't seem to see what I have done wrong. Can anyone enlighten me?
answer count: 3
has answer: http://stackoverflow.com/a/26441272
accepted answer: http://stackoverflow.com/a/26441272
favorite count: 0
possible better answer: http://stackoverflow.com/a/26441271
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/41658912
has text: If you want to follow the fingers movement between `ACTION_DOWN` and `ACTION_UP`, then you could use `ACTION_MOVE` (http://developer.android.com/reference/android/view/MotionEvent.html). Store the first position on `ACTION_DOWN` and evaluate the direction by using the new position at event `ACTION_MOVE`.
comment on: http://stackoverflow.com/q/26493632
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41639655
has text: There is no function in JRE. You need to make your own
comment on: http://stackoverflow.com/q/26504151
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26493414
type: Question
has comment: http://stackoverflow.com/comment/41646183
has title: Transformation of any List to List<Object[]>
has comment: http://stackoverflow.com/comment/41620980
upvote count: 2
has comment: http://stackoverflow.com/comment/41620418
has comment: http://stackoverflow.com/comment/41644871
has comment: http://stackoverflow.com/comment/41620720
tagged with: collections
has comment: http://stackoverflow.com/comment/41625966
tagged with: java-8
answer count: 1
tagged with: java
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41620915
score: -3
has answer: http://stackoverflow.com/a/26495779
has comment: http://stackoverflow.com/comment/41620872
has body: I want to be able to transform any List&lt;> to the List of Object[] - i.e. every element of the given list should be transformed to Object array in a given way. For example, I have List&lt;User&gt; users = Lists.newArrayList(new User((long) 1, "Name1"), new User ((long) 2, "Name2")); and a Function Function &lt;User, Object[]&gt; mapper = user -&gt; new Object[] {user.getUserId(), user.getUserName()} And I need to get List of Object arrays, by transforming every user with the mapper. But the point is to write the function, that can work with any given list and any given mapper. I created Transformer class and tried to achieve my goal in the next way, but got compilation error: class Transformer { private List&lt;?&gt; content; private Function&lt;?, Object[]&gt; mapper; //getters and setters .... public List&lt;Object[]&gt; transform() { return content.stream() .map(mapper) // this row isn't compiled .collect(Collectors.toList()); } } Error:(75, 45) java: method map in interface java.util.stream.Stream&lt;T&gt; cannot be applied to given types; required: java.util.function.Function&lt;? super capture#1 of ?,? extends R&gt; found: java.util.function.Function&lt;capture#2 of ?,java.lang.Object[]&gt; reason: cannot infer type-variable(s) R (argument mismatch; java.util.function.Function&lt;capture#2 of ?,java.lang.Object[]&gt; cannot be converted to java.util.function.Function&lt;? super capture#1 of ?,? extends R&gt;) What advice can you give me?
has comment: http://stackoverflow.com/comment/41620671
has comment: http://stackoverflow.com/comment/41629778
favorite count: 0

http://stackoverflow.com/q/26491038
score: 0
has answer: http://stackoverflow.com/a/26491483
answer count: 4
has comment: http://stackoverflow.com/comment/41616149
has comment: http://stackoverflow.com/comment/41616505
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26491104
tagged with: java
has body: The statement says: Successive integers read from the keyboard. When you read a -1, the program must indicate how many numbers between 1 and 100 we read and what is their arithmetic mean (MediaNum.java). I push this code: import java.util.*; public class MediaNum { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); double number, sum=0, medium; int counter=0; System.out.println("When you want to finish enter '-1'."); System.out.println("Enter the numbers:"); number = entrada.nextDouble(); while (number != -1){ sum = sum + number; counter++; number = entrada.nextDouble(); } if (number == -1){ counter++; System.out.println("counter"); } if (number == -1 &amp;&amp; number &lt; 101){ medium = sum/counter; System.out.println("The medium of the numbers entered is: "+medium); } } } The part of the medium and the part when I put -1 the counter finishes is correct but the error is when i put a number above 100 the counter counts this number and the medium will be incorrect.
has comment: http://stackoverflow.com/comment/41616017
possible better answer: http://stackoverflow.com/a/26491191
type: Question
has title: Arithmetic average of a series of numbers
has answer: http://stackoverflow.com/a/26491559
has answer: http://stackoverflow.com/a/26491104
has comment: http://stackoverflow.com/comment/41616194
has comment: http://stackoverflow.com/comment/41616117
has answer: http://stackoverflow.com/a/26491191
has comment: http://stackoverflow.com/comment/41615995

http://stackoverflow.com/a/26385508
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26363408
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26363408
has comment: http://stackoverflow.com/comment/41444328
type: Answer
has body: how do I extract that value to an int. I believe you want to use the Results Table API. ResultsTable.getResultsTable will get the active results after your Analyze Particles command, and you can then interrogate it with the getValue methods. COuld anyone pease explain to me how can I display that I think your Analyze Particles isn't running because running Color Threshold... doesn't actually apply the threshold to create a mask or 8-bit image, it just opens the thresholding interface. I actually had a lot of trouble trying to get the Color Threshold to apply. I think you have a couple options though: If you run Color Threshold in Fiji, and open the Macro Recorder, you can press the "Macro" button in the Color Threshold dialog to dump a ton of IJ1 Macro code to the recorder. This code will actually apply the selected threshold to your image and create an image that can then be input to Analyze Particles. But you would have to replicate this process on the Java side and I don't know how flexible it will be. Alternately, you can adapt the following IJ1 Macro code to just threshold the image as 8-bit. run("8-bit"); setAutoThreshold("Default"); //run("Threshold..."); setOption("BlackBackground", false); run("Convert to Mask"); If you can get the desired threshold from just operating on an 8-bit version of your image then this is a much simpler option to get your data to Analyze Particles. If these options don't fully work for you, I would also recommend writing to the ImageJ mailing list, which is read by the Threshold Colour author, among many others.
score: 3

http://stackoverflow.com/q/26401841
has comment: http://stackoverflow.com/comment/41453287
has comment: http://stackoverflow.com/comment/41458089
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41453996
tagged with: java
has comment: http://stackoverflow.com/comment/41453957
has comment: http://stackoverflow.com/comment/41453874
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26403265
has title: Can I use array reference at setOnClickListener(new OnClick(){});
has comment: http://stackoverflow.com/comment/41457299
has body: I was coding an android application, and I ended the second activity. public class OneBoardActivity extends Activity { //omitted @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_board); turn=true; statetext=(TextView)findViewById(R.id.StateText); mover[0][2]=(Button)findViewById(R.id.mover13); mover[0][3]=(Button)findViewById(R.id.mover14); mover[0][4]=(Button)findViewById(R.id.mover15); //omitted again for(i=0;i&lt;7;i++){ for(j=0;j&lt;7;j++){ if(i&lt;=1 &amp;&amp; j&lt;=1 || i&gt;=6 &amp;&amp; j&lt;=1 || i&lt;=1 &amp;&amp; j&gt;=6 || i&gt;=6 &amp;&amp; j&gt;=6){ moverState[i][j]=-2; continue; } mover[i][j].setOnClickListener(new OnClickListener(){ //Line 92 @Override public void onClick(View v) { // TODO Move by State moveByState(i,j); } }); //omitted for the last time ...and this code ended without any syntax errors. BUT, when I ran this application and got this activity out, this application resulted a "Unfortunately, ..." error. This is the logcat: 10-16 04:09:56.641: E/AndroidRuntime(1230): FATAL EXCEPTION: main 10-16 04:09:56.641: E/AndroidRuntime(1230): Process: com.truefalseapps.solitaire, PID: 1230 10-16 04:09:56.641: E/AndroidRuntime(1230): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.truefalseapps.solitaire/com.truefalseapps.solitaire.OneBoardActivity}: java.lang.NullPointerException 10-16 04:09:56.641: E/AndroidRuntime(1230): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 10-16 04:09:56.641: E/AndroidRuntime(1230): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 10-16 04:09:56.641: E/AndroidRuntime(1230): at android.app.ActivityThread.access$800(ActivityThread.java:135) 10-16 04:09:56.641: E/AndroidRuntime(1230): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 10-16 04:09:56.641: E/AndroidRuntime(1230): at android.os.Handler.dispatchMessage(Handler.java:102) 10-16…
has comment: http://stackoverflow.com/comment/41457361
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/41453580
favorite count: 0
has comment: http://stackoverflow.com/comment/41454078
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/26403265

http://stackoverflow.com/a/26461649
answers question: http://stackoverflow.com/q/26461089
has comment: http://stackoverflow.com/comment/41563315
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41563549
has comment: http://stackoverflow.com/comment/41564263
has body: Note that you change the aws namespace from: xmlns:aws="http://alexa.amazonaws.com/doc/2005-10-05/" to xmlns:aws="http://awis.amazonaws.com/doc/2005-07-11" First of all, make sure this is corect. Next, if this is the case then you have elements in different namespaces in your document. In this case you have basically two options: Use package-info.java to define the most used namespace (I think this will be http://awis.amazonaws.com/doc/2005-07-11 in this case). Omit namespace in @XmlElements (and further annotations) which use this namespace. Do not use package-info.java and write namespace in all of the @XmlElements. package-info.java can provide a "default" namespace which will be used to "qualify" elements (defined by @XmlElement, @XmlElements, @XmlElementWrapper, @XmlElementRef, @XmlElementRefs) if they don't provide a namespace. But you can also provide the namespace explicitly: @XmlElement(name="TrafficHistoryResult", namespace="http://awis.amazonaws.com/doc/2005-07-11")
has comment: http://stackoverflow.com/comment/41564670
has comment: http://stackoverflow.com/comment/41563453

http://stackoverflow.com/comment/41651037
type: AnswerComment
comment on: http://stackoverflow.com/a/26510290
type: Comment
has text: @LuiggiMendoza You cann't modify `ArrayList` if it's *true* immutable class.
score: 0

http://stackoverflow.com/q/26460610
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/41560662
answer count: 1
favorite count: 0
has body: Please suggest how can pass the the Switch case Condition with IF Statement baseclass.java class Baseclass { public static WebDriver driver; public void GetDriver(int browserId) { { switch (browserId) { case 1: // For Firefox Driver driver = new FirefoxDriver(); break; case 2: // For Chrome Driver System.setProperty("webdriver.chrome.driver", "D:\\chromedriver_win32\\chromedriver.exe"); driver = new ChromeDriver(); break; case 3: // For IE Driver System.setProperty("webdriver.ie.driver", "D:\\IEDriverServer.exe"); driver = new InternetExplorerDriver(); } } } } another class i have inherit the base class and set the condition public class AdminRenewals extends Baseclass { @BeforeTest public final void Startup() { Baseclass ed = new Baseclass(); ed.GetDriver(3); } } from the AdminRenewals class how can we check the switch case condition with another method sonething like if(GetDriver==2) { if (!name1.equals("")) { name1 = new StringBuffer(name1).insert(name1.length() - 1, " ") .toString(); if(GetDriver==3) { if (!name1.equals("")) { name1 = new StringBuffer(name1).insert(name1.length() - 1, "test ") .toString(); Expected: if i use the chrome driver its should be execute that particular if condition (based on switch case)
has title: how can pass the Switch case condition with IF Statement
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41560645
has answer: http://stackoverflow.com/a/26460705
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/26433053
score: 0
type: UnansweredQuestion
has body: Half year before. I already accessed to Factva.com(A NEWS DATABASE WITH ACCESS CONTROL) by Selenium driver,searching news automatically. However, two months ago, Factiva updates its access protocol from HTTP to HTTPS, which disables my program. Under HTTP, my program can switch to a new URL within the same Chrome(EVEN a new tab). I did this by using the function: chrome.get(URL) where the URL is a direct search link. I even access the new search request by this method. You know, under HTTP search, you can just combine some key words and logic operator to produce a new URL. And I use chrome.get(URL) to switch to the new search results. However, under HTPPS, I cannot use the above method anymore. When I use the method, Factiva shows the infos that I was in the off-login status( I should login again. Even though if I click the backforward button with my mouse, I can go back to the Factiva webpage and need not login) My question is: Why my old method didn't work UNDER HTTPS? How can I let Factiva know, even I use the old method, I am already in the access and need not login again! My old method under HTTP: Class SearchTXT{ public String getSearchUrl(String keyword, String startTime, String endTime){ String f0=”http://global.factiva.com.***.uk/zhcn/du/headlines.asp?napc=S&amp;searchText=” String f2="&amp;dateRangeMenu=custom&amp;dateFormat=dmy&amp;dateFrom="; String f4="&amp;dateTo="; String f6="&amp;sortBy=y&amp;currentSources="; String f7=”Wall Street Journal”; String f8="&amp;searchLanguage=custom&amp;searchLang=EN&amp;dedupe=0&amp;srchuiver=2&amp;accountid=9MEM000300&amp;namespace=16"; Return f0+keyword+f2+startTime+f4+endTime+f6+f7+f8; } } AFTER login the FACTIVA database by Selenium Driver, I got a chrome with the access to FACTIVA. Then: I use this: SearchTXT st = new SearchTXT(): String searchURL= st.geSearchUrl(“DELL”, “2011-11-10”, “2014-10-10”); chrome.get(searchURL); String pageSource=chrome.getPageSource(); Then I can use Jsoup.jar to Parser and collect the …
has title: Using Selenium to access a commercial database with HTTPS security
has comment: http://stackoverflow.com/comment/41522301
answer count: 0
has comment: http://stackoverflow.com/comment/41540828
tagged with: java
tagged with: selenium
tagged with: authentication
tagged with: https
has comment: http://stackoverflow.com/comment/41513179
type: Question
tagged with: search

http://stackoverflow.com/comment/41451245
comment on: http://stackoverflow.com/a/26400527
has text: You make 3 calls to append, then for each append, you also have conditionals and a check for existing length. I don't think it's efficient enough. It's quite logical though.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41437936
score: 0
type: Comment
type: QuestionComment
has text: And what is the specific question you have?
comment on: http://stackoverflow.com/q/26392548

http://stackoverflow.com/comment/41630132
type: Comment
comment on: http://stackoverflow.com/q/26485650
type: QuestionComment
has text: @vz0 There are other IMHO easier-to-use tools, such as [JavaCPP](https://github.com/bytedeco/javacpp) :)
score: 0

http://stackoverflow.com/comment/115424223
type: Comment
has text: this is very important for someone who is new to documentation in Android Studio, as for Android Studio will not recognize @link command...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/51360702

http://stackoverflow.com/comment/41502188
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26427142
has text: We changed the code and we dont use DomainClassConverter anymore.we have a relation `@ManyToOne` to `Product` from the `Sku` entity and we just found that in Spring data JPA we can access to the product just with the id (not with the full product entity so no more `DomainClassConverter`) using special keywords for the method name: `findByProductId` in our repository interface (witch extends JpaRepository).With the 'DomainClassConverter' the method used was `findByProduct` In the doc of Spring data they talk about the method keywords name but itsnot clear when we have relation between entities.

http://stackoverflow.com/q/26480054
favorite count: 0
tagged with: scala
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26480485
accepted answer: http://stackoverflow.com/a/26480485
downvote count: 0
has body: In my java code, I am calling a method, from a class which is defined in Scala, and I want to use one of its methods in java. Here is how I call it and it works fine. Seq&lt;SomeObjectType&gt; variableName = ScalaClass.MethodInTheScalaClass(); I can call this function in java in this form, but since I am calling this method from a compiled package, I can't see what it going on (and therefore I can't change it). The problem now is that, I don't know how to iterate over the "variableName" in java (since Seq is a scala type). How can I iterate over variableName or convert it to a Java object (e.g. List)?
has title: Using scala object inside java?
tagged with: java
tagged with: loops
type: Question
score: 3
tagged with: type-conversion
upvote count: 3
answer count: 1

http://stackoverflow.com/comment/41463489
has text: The breadcrumb idea (changing the PATH " " to TRIED"." is a good idea. It'd also help with tracking. But what about cases where it's in an intersection with 2+ possible paths? I'll definitely make that char[][] change, thank you! :) David Wallace
comment on: http://stackoverflow.com/a/26394220
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/119060274
has text: Yeah, thanks!!!! Oracle should be update the documentation...
comment on: http://stackoverflow.com/a/26852187
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26440650
tagged with: token
has answer: http://stackoverflow.com/a/26450252
favorite count: 0
has comment: http://stackoverflow.com/comment/41532592
accepted answer: http://stackoverflow.com/a/26450252
tagged with: javacc
has title: JavaCC recognise token within token
upvote count: 1
has comment: http://stackoverflow.com/comment/41528659
has body: I'm having some problem with my JavaCC project. I'm trying to recognise a variable declaration which has a possible "variable" prefix, a kind and the name of the variable (id). But the parser recognise the first word as kind and do not go on to the rest of the line. It says: Exception in thread "main" ParseException: Encountered " &lt;KIND&gt; "char "" at line 2, column 9. Was expecting one of: &lt;VARIABLE&gt; ... here's how my tokens are declared TOKEN : { &lt;START: "start"&gt; {debugStream.println("start");} | &lt;END: "end"&gt; {debugStream.println("end");} | &lt;VARIABLE: ("variable" &lt;KIND&gt; &lt;ID&gt;) | (&lt;KIND&gt; &lt;ID&gt;)&gt; {debugStream.println("variable decl");} | &lt;KIND: "integer"|"real"|"logic"|"char"|"text"&gt; {debugStream.println("kind");} | &lt;ID: (["a"-"z","_"])+&gt; {debugStream.println("id");} } I've also tried to put the kind and id into special_tokens, then the parser goes without errors, but don't recognise variable declaration too. Edit: here's the input string start char sex integer num end
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/a/26459637
has body: i've get the key for that api i.e. 5ad273b81ff66c6f3248604cfc728baa call simple api .... api call to get daily prayer use code to fetch value... try { HttpClient client=new DefaultHttpClient(); HttpGet request=new HttpGet("http://muslimsalat.com/daily.json?key=5ad273b81ff66c6f3248604cfc728baa"); HttpResponse response=client.execute(request); HttpEntity entity=response.getEntity(); String json=EntityUtils.toString(entity); JSONObject jsonObject=new JSONObject(json); Toast.makeText(MainActivity.this, jsonObject.getString("title")+"\n"+jsonObject.getString("prayer_method_name"), 0).show(); entity.consumeContent(); } catch(Exception e) { e.getStackTrace(); Toast.makeText(MainActivity.this, e.toString() , 0).show(); }
score: 1
answers question: http://stackoverflow.com/q/26452823
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26452823
type: Answer
upvote count: 1

exception
tags question: http://stackoverflow.com/q/26381195
tags question: http://stackoverflow.com/q/26468745
tags question: http://stackoverflow.com/q/26440739
tags question: http://stackoverflow.com/q/26464984
tags question: http://stackoverflow.com/q/26476537
tags question: http://stackoverflow.com/q/26430448
tags question: http://stackoverflow.com/q/26372873
tags question: http://stackoverflow.com/q/26407917
tags question: http://stackoverflow.com/q/26481421
tags question: http://stackoverflow.com/q/26483585
tags question: http://stackoverflow.com/q/26480342
tags question: http://stackoverflow.com/q/26498333
tags question: http://stackoverflow.com/q/26414522
tags question: http://stackoverflow.com/q/26467181
tags question: http://stackoverflow.com/q/26457891
tags question: http://stackoverflow.com/q/26382276
tags question: http://stackoverflow.com/q/26470588
tags question: http://stackoverflow.com/q/26475154
tags question: http://stackoverflow.com/q/26383624
tags question: http://stackoverflow.com/q/26448747
tags question: http://stackoverflow.com/q/26431003
tags question: http://stackoverflow.com/q/26361559
type: Tag
tags question: http://stackoverflow.com/q/26459988
tags question: http://stackoverflow.com/q/26414203
tags question: http://stackoverflow.com/q/26358839
tags question: http://stackoverflow.com/q/26489786
tags question: http://stackoverflow.com/q/26451990
tags question: http://stackoverflow.com/q/26460992
tags question: http://stackoverflow.com/q/26392672
tags question: http://stackoverflow.com/q/26389195
tags question: http://stackoverflow.com/q/26476798
tags question: http://stackoverflow.com/q/26458937
tags question: http://stackoverflow.com/q/26403008
tags question: http://stackoverflow.com/q/26462858
tags question: http://stackoverflow.com/q/26399384
tags question: http://stackoverflow.com/q/26355336
tags question: http://stackoverflow.com/q/26453937
tags question: http://stackoverflow.com/q/26439389
tags question: http://stackoverflow.com/q/26405054
tags question: http://stackoverflow.com/q/26471387
tag name: exception
tags question: http://stackoverflow.com/q/26473914
tags question: http://stackoverflow.com/q/26376439
tags question: http://stackoverflow.com/q/26411765
tags question: http://stackoverflow.com/q/26489763
tags question: http://stackoverflow.com/q/26454322
tags question: http://stackoverflow.com/q/26439430
tags question: http://stackoverflow.com/q/26464401
tags question: http://stackoverflow.com/q/26512820
tags question: http://stackoverflow.com/q/26458133
tags question: http://stackoverflow.com/q/26421668
tags question: http://stackoverflow.com/q/26439252
tags question: http://stackoverflow.com/q/26448474

http://stackoverflow.com/comment/41498450
comment on: http://stackoverflow.com/q/26425098
type: Comment
type: QuestionComment
has text: There's a complete working example [here][1]. [1]: http://stackoverflow.com/questions/2181774/calling-clojure-from-java/2187427#2187427
score: 0

mod-jk
tags question: http://stackoverflow.com/q/26430639
type: Tag
tag name: mod-jk

android-activity
tags question: http://stackoverflow.com/q/26371395
tags question: http://stackoverflow.com/q/26510649
tags question: http://stackoverflow.com/q/26435996
tags question: http://stackoverflow.com/q/26501593
tags question: http://stackoverflow.com/q/26457219
tags question: http://stackoverflow.com/q/26475101
tags question: http://stackoverflow.com/q/26453335
tags question: http://stackoverflow.com/q/26420783
tags question: http://stackoverflow.com/q/26425033
tags question: http://stackoverflow.com/q/26469578
tags question: http://stackoverflow.com/q/26449867
tag name: android-activity
tags question: http://stackoverflow.com/q/26445893
tags question: http://stackoverflow.com/q/26460924
tags question: http://stackoverflow.com/q/26415843
tags question: http://stackoverflow.com/q/26425816
tags question: http://stackoverflow.com/q/26383717
tags question: http://stackoverflow.com/q/26411710
tags question: http://stackoverflow.com/q/26479004
tags question: http://stackoverflow.com/q/26471846
tags question: http://stackoverflow.com/q/26451027
tags question: http://stackoverflow.com/q/26513648
tags question: http://stackoverflow.com/q/26440729
tags question: http://stackoverflow.com/q/26468271
tags question: http://stackoverflow.com/q/26411243
tags question: http://stackoverflow.com/q/26477782
tags question: http://stackoverflow.com/q/26439059
tags question: http://stackoverflow.com/q/26484232
tags question: http://stackoverflow.com/q/26417850
type: Tag

http://stackoverflow.com/comment/41570939
has text: You need to be able to obtain sequences in batches that match your batch writing size, otherwise JPA must interupt the batch to get additional sequence values. I don't believe MySQL has sequencing, so it is defaulting to Identity; you need to use table sequencing instead. see http://java-persistence-performance.blogspot.com/2011/06/how-to-improve-jpa-performance-by-1825.html?showComment=1379577956140#c4472664570410361957
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26427887

http://stackoverflow.com/q/26358068
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has body: Error occurred while collecting items to be installed. An error occurred while collecting items to be installed session context was:(profile=profile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.objectweb.asm,5.0.1.v201404251740 I installed osgi.bundle and import but error while export eclipse product. Java version: 7u67, OS: Mac OS, Eclipse SDK Version: 4.3.2
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/26381053
has title: Error encounter while export eclipse product

http://stackoverflow.com/q/26463545
score: 1
tagged with: string
favorite count: 0
has title: why am i getting error: "Exception in thread "main" java.lang.NullPointerException"
type: Question
tagged with: double
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26463576
tagged with: java
has body: When i run my program i get the following error: Exception in thread "main" java.lang.NullPointerException at study.calendar.HomeWorkDiary.&lt;init&gt;(HomeWorkDiary.java:51) at study.calendar.HomeworkTeftInterFace.main(HomeworkTeftInterFace.java:18) Java Result: 1 BUILD SUCCESSFUL (total time: 1 second) despite my best efforts i cannot identify the problem i believe that it my have to do with the way i am declaring my program. could please help by identifying and providing a solution to my problem this will be much appreciated. here is the problem code: Interface class: public class HomeworkTeftInterFace { public static void main(String[] args) { HomeWorkDiary tefo = new HomeWorkDiary("test"); String task1 = JOptionPane.showInputDialog("task"); String subject1 = JOptionPane.showInputDialog("subject"); double priorty1 = (Double.parseDouble(JOptionPane.showInputDialog("priorty"))); int day1 = parseInt(JOptionPane.showInputDialog("due day")); int month1 = parseInt(JOptionPane.showInputDialog("month")); int year1 = parseInt(JOptionPane.showInputDialog("year")); tefo.addTask(task1, subject1, priorty1, day1, month1, year1); } } the next class: public HomeWorkDiary(String filename) { // System.out.println("test5"); diary = new Homework[count + 50]; count = 0; // System.out.println("test6"); try { Scanner file = new Scanner(new File("HomeWork.txt")); file.useDelimiter("#"); while (file.hasNextLine()) { // System.out.println("test3"); String task = file.next(); String subject = file.next(); // System.out.println("test7"); String priorty = file.next(); // System.out.println("test9"); String day = file.next(); String month = file.next(); String year = file.next(); // System.out.println("test"); diary[count].setTaks(task); diary[count].setSubject(subject); diary[count].setPrioity(Double.parseDouble(priorty)); diary[count].setDay(parseInt(day)); diary[count].setmonth(parseInt(month)); diary[count].setyear(parseInt(year)); // System.out.println("test 10"); count++; file.nextLine…
accepted answer: http://stackoverflow.com/a/26463576
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41565655
tagged with: arrays
tagged with: int
has comment: http://stackoverflow.com/comment/41565754
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/26487627
has body: I found out that when I call: File.createTempFile(); in tomcat7 my temp file is created. BUT... it is deleted immediately after the Thread creating this file ends. The default behavior of JVM should be to keep these files until it is shutdown. Apparently tomcat overwrites this behavior. Is there any switch to change this so that tomcat would keep the temp file?
has comment: http://stackoverflow.com/comment/41609571
answer count: 1
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/26487769
accepted answer: http://stackoverflow.com/a/26487769
upvote count: 3
type: AnsweredQuestion
downvote count: 0
has title: tomcat how to keep temporary files?
type: Question
score: 3
tagged with: temporary-files
has comment: http://stackoverflow.com/comment/41624816
tagged with: java

getmessage
tags question: http://stackoverflow.com/q/26498333
type: Tag
tag name: getmessage

http://stackoverflow.com/comment/41485767
score: 0
type: AnswerComment
has text: The tasks was that each method must return a new MyOwnString object. I am wondering that if I wanted to do the toUppercase and toLowercase method seperately, i would have to keep creating tempData for both, but with different request.
type: Comment
comment on: http://stackoverflow.com/a/26417893

http://stackoverflow.com/q/26398680
has answer: http://stackoverflow.com/a/26419905
type: UnansweredQuestion
tagged with: mahout
has body: I am trying to do the topics analysis on set of documents using the latest version of Mahout. The output for topic to term mapping is proper with each topic having list of terms with corresponding probabilities. But the when I tried getting the document to topic mapping , it only displays a set of topics starting with some letter. Like in this case all topics starting with letter a Following is the sample code used to generate the document topic mapping: VectorDumper.main(new String[] { "-i" , inputDocTopicsDir , "-o", oututDocTopicsDir , "-d", inputDictionaryDir , "-dt", "sequencefile" , "-sort", "true" , "-vs", "10" }); Sample output: {2d:0.019996671414880783,3d:0.019994853350969108,4d:0.02000171234917903,5d:0.019994290328033588,a.config:0.01999309367417373,a.k.a:0.02000227944902019,a.system:0.01999771644223781,aaa:0.020003361639812457,aam:0.019990182999365072,aapm:0.020012465032122083,aapv:0.01999879522431889,aar:0.019995543474585993,aas:0.019995157547471696,aav:0.02000267326012652,ab:0.020025978185034182,aba:0.01999553819903237,abandon:0.020013355238553677,abandoned:0.01999559962237951,abandonment:0.019994194616256,abandons:0.02001433184497984,abatement:0.01997728075793184,abberationa:0.020001189392395737}
tagged with: java
type: Question
tagged with: cluster-analysis
has title: Mahout 0.9 CVB document topic mapping error
tagged with: hadoop
score: 0
answer count: 1

spring-mvc
tags question: http://stackoverflow.com/q/26418730
tags question: http://stackoverflow.com/q/26463055
tags question: http://stackoverflow.com/q/26463728
tags question: http://stackoverflow.com/q/26383704
tags question: http://stackoverflow.com/q/26469679
tags question: http://stackoverflow.com/q/26421357
tags question: http://stackoverflow.com/q/26409790
tags question: http://stackoverflow.com/q/26374793
tags question: http://stackoverflow.com/q/26357014
tags question: http://stackoverflow.com/q/26489318
tags question: http://stackoverflow.com/q/26497955
tags question: http://stackoverflow.com/q/26433013
tags question: http://stackoverflow.com/q/26491624
tags question: http://stackoverflow.com/q/26461781
tags question: http://stackoverflow.com/q/26366192
tags question: http://stackoverflow.com/q/26447739
tags question: http://stackoverflow.com/q/26462853
tags question: http://stackoverflow.com/q/26434811
tags question: http://stackoverflow.com/q/26427972
tags question: http://stackoverflow.com/q/26420814
tags question: http://stackoverflow.com/q/26399500
tags question: http://stackoverflow.com/q/26389143
tags question: http://stackoverflow.com/q/26487660
tags question: http://stackoverflow.com/q/26412938
tags question: http://stackoverflow.com/q/26380940
tags question: http://stackoverflow.com/q/26463008
tags question: http://stackoverflow.com/q/26369353
tags question: http://stackoverflow.com/q/26417895
tags question: http://stackoverflow.com/q/26483173
tags question: http://stackoverflow.com/q/26433631
tags question: http://stackoverflow.com/q/26450400
tags question: http://stackoverflow.com/q/26464104
tags question: http://stackoverflow.com/q/26361689
tags question: http://stackoverflow.com/q/26366806
tags question: http://stackoverflow.com/q/26360160
tags question: http://stackoverflow.com/q/26379980
tags question: http://stackoverflow.com/q/26406205
tags question: http://stackoverflow.com/q/26473333
tags question: http://stackoverflow.com/q/26393518
tags question: http://stackoverflow.com/q/26437580
tags question: http://stackoverflow.com/q/26378078
tag name: spring-mvc
tags question: http://stackoverflow.com/q/26448009
tags question: http://stackoverflow.com/q/26373056
tags question: http://stackoverflow.com/q/26380886
tags question: http://stackoverflow.com/q/26381602
tags question: http://stackoverflow.com/q/26488798
tags question: http://stackoverflow.com/q/26359664
tags question: http://stackoverflow.com/q/26475828
tags question: http://stackoverflow.com/q/26386889
tags question: http://stackoverflow.com/q/26471225
type: Tag
tags question: http://stackoverflow.com/q/26385116
tags question: http://stackoverflow.com/q/26482756
tags question: http://stackoverflow.com/q/26433174
tags question: http://stackoverflow.com/q/26370409
tags question: http://stackoverflow.com/q/26402875
tags question: http://stackoverflow.com/q/26480338
tags question: http://stackoverflow.com/q/26487261
tags question: http://stackoverflow.com/q/26379290
tags question: http://stackoverflow.com/q/26376369
tags question: http://stackoverflow.com/q/26370743
tags question: http://stackoverflow.com/q/26498517
tags question: http://stackoverflow.com/q/26397168
tags question: http://stackoverflow.com/q/26430257
tags question: http://stackoverflow.com/q/26485864
tags question: http://stackoverflow.com/q/26376392
tags question: http://stackoverflow.com/q/26405691
tags question: http://stackoverflow.com/q/26472992
tags question: http://stackoverflow.com/q/26479376
tags question: http://stackoverflow.com/q/26484440
tags question: http://stackoverflow.com/q/26460111
tags question: http://stackoverflow.com/q/26434005
tags question: http://stackoverflow.com/q/26410060
tags question: http://stackoverflow.com/q/26476143
tags question: http://stackoverflow.com/q/26513217
tags question: http://stackoverflow.com/q/26475556
tags question: http://stackoverflow.com/q/26498928
tags question: http://stackoverflow.com/q/26494180
tags question: http://stackoverflow.com/q/26365291

http://stackoverflow.com/a/26432230
answers question: http://stackoverflow.com/q/26432043
score: 4
has body: I want to call a function without using semicolons, is that possible? If I understand your question, yes you can do it by using a unicode semicolon instead of an ASCII one. Something like, public static void main(String[] args) { System.out.println("Hello, World!")\u003B // &lt;-- The Java compiler // will make that a semicolon, but it clearly isn't one here. }
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/26493896
linked to: http://stackoverflow.com/q/14617
has comment: http://stackoverflow.com/comment/41621270
tagged with: deployment
has comment: http://stackoverflow.com/comment/41624780
type: AnsweredQuestion
tagged with: auto-update
has answer: http://stackoverflow.com/a/26496236
accepted answer: http://stackoverflow.com/a/26496236
score: 1
has body: I am wondering how I can make my Java game automatically check for updates when a button is pressed, I have an ActionListener calling my UpdateGUI class: btnUpdate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new UpdateGUI(); } }); and then I am stuck from here on, I've got the GUI sorted (labels, buttons etc), but it's just the update checker, I also would like help to make a label appear when an update is available. I have tried looking through the various questions provided to me as I was making this question, all of which did not help me. UpdateGUI Code public class UpdateGUI { public UpdateGUI() { JFrame starGameUpdater = new JFrame(); starGameUpdater.setTitle("StarGame Updater"); starGameUpdater.getContentPane().setLayout(null); JLabel labelStargameUpdate = new JLabel("StarGame Updater"); labelStargameUpdate.setHorizontalAlignment(SwingConstants.CENTER); labelStargameUpdate.setBounds(165, 11, 94, 14); starGameUpdater.getContentPane().add(labelStargameUpdate); } }
tagged with: java
has comment: http://stackoverflow.com/comment/41622186
tagged with: swing
tagged with: updates
has comment: http://stackoverflow.com/comment/41621728
has title: How do I check my program for updates in Java
type: Question
has comment: http://stackoverflow.com/comment/41624452
has comment: http://stackoverflow.com/comment/41725435
has comment: http://stackoverflow.com/comment/41622474
has comment: http://stackoverflow.com/comment/41689504
has comment: http://stackoverflow.com/comment/41621450
upvote count: 2
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41621688
has comment: http://stackoverflow.com/comment/41621247

http://stackoverflow.com/comment/41604277
comment on: http://stackoverflow.com/q/26484485
type: Comment
has text: Check [this page](http://docs.oracle.com/javase/7/docs/api/java/io/Writer.html).
score: 0
type: QuestionComment

http://stackoverflow.com/a/26393488
score: 3
has comment: http://stackoverflow.com/comment/41439717
has comment: http://stackoverflow.com/comment/41439664
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41440070
has body: You have a variable shadowing issue, that is, you declare a bunch of instance fields.... public class TheaterRevenue extends JFrame { private JTextField adultTicketPriceTextField; private JTextField adultTicketSoldTextField; private JTextField childTicketPriceTextField; private JTextField childTicketSoldTextField; But then redeclare them as local variables (within your constructor) public TheaterRevenue() { //... //TextFields JTextField adultTicketPriceTextField = new JTextField(20); JTextField adultTicketSoldTextField = new JTextField(20); JTextField childTicketPriceTextField = new JTextField(20); JTextField childTicketSoldTextField = new JTextField(20); This means that when the actionPerformed method tries to access the values from these instance fields public void actionPerformed(ActionEvent e) { //.. input1 = adultTicketPriceTextField.getText(); The field is still null. To fix it, remove the declarations within you constructor and make sure you are initialising the instance fields correctly... public TheaterRevenue() { //... //TextFields adultTicketPriceTextField = new JTextField(20); adultTicketSoldTextField = new JTextField(20); childTicketPriceTextField = new JTextField(20); childTicketSoldTextField = new JTextField(20);
accepted answer of: http://stackoverflow.com/q/26393349
upvote count: 3
answers question: http://stackoverflow.com/q/26393349
type: Answer
has comment: http://stackoverflow.com/comment/41439725
has comment: http://stackoverflow.com/comment/41439629
downvote count: 0

http://stackoverflow.com/q/26500423
tagged with: java
linked to: http://stackoverflow.com/q/10750791
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/26500495
upvote count: 20
linked to: http://stackoverflow.com/q/2435163
has answer: http://stackoverflow.com/a/26500436
linked to: http://stackoverflow.com/q/4012167
score: 20
has title: What does it mean for a collection to be final in Java?
has body: What does it mean for a collection to be declared final in Java? Is it that no more elements can be added to it? Is it that the elements already there cannot be changed? Is it something else?
downvote count: 0
has answer: http://stackoverflow.com/a/26500444
has comment: http://stackoverflow.com/comment/41633136
favorite count: 0
has answer: http://stackoverflow.com/a/26500446
linked to: http://stackoverflow.com/q/13079365
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/2435163
answer count: 4
tagged with: immutability
has comment: http://stackoverflow.com/comment/41632983
tagged with: final

http://stackoverflow.com/comment/41519781
has text: @getlost I searched for more times...i cant get required solution
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26387186
score: 0

http://stackoverflow.com/comment/41509395
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26432191
has text: which line in your example is line 46 in your file ("Model.forward(Model.java:_46_)")?

http://stackoverflow.com/comment/41552344
type: QuestionComment
has text: @biziclop: no, honestly, my application runs quite fast, but I use array.clone() which seems like an easy way to get a copy of an array. Then I suddenly read (in the question I referred to) that it's a bad idea. So I'm confused now.
comment on: http://stackoverflow.com/q/26453100
score: 0
type: Comment

http://stackoverflow.com/comment/41577143
type: Comment
has text: Yes, use annotation does help.
type: AnswerComment
comment on: http://stackoverflow.com/a/26459698
score: 0

http://stackoverflow.com/comment/41461504
has text: Do you want to change the spacing between rows or columns (or both)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26404991

http://stackoverflow.com/comment/41578479
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26470429
has text: It's not clear what regular expressions have to do with this... and what if there are multiple "min" occurrences? Do you want to find the last space before the first min?
type: Comment

http://stackoverflow.com/q/26420666
has answer: http://stackoverflow.com/a/26426586
score: 2
has body: A am new in Drools and have read some docs and tutorials, sure, my question has a trivial solution. I use onle rule file and class Counter, depicted below. The environment is : Wintel JDK 1.7 (71), DROOLS 6.1.0 public class DroolsInsertionTester { private Logger log = Logger.getLogger(this.getClass().getName()); private KieSession getNewStatefullKIESession (){ KieContainer kContainer = KieServices.Factory.get().getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("test"); return kSession; } public static void main(String[] args) { // TODO Auto-generated method stub DroolsInsertionTester tester = new DroolsInsertionTester(); tester.test(); } private void test() { KieSession kSession = getNewStatefullKIESession(); Counter cnt1 = new Counter(1); Counter cnt2 = new Counter(2); FactHandle fact1, fact2; // STEP 1 fact1 = kSession.insert(cnt1); kSession.fireAllRules(); // STEP 2 fact2 = kSession.insert(cnt2); kSession.fireAllRules(); } public class Counter { public int count; public Counter (int cnt){ this.count = cnt; } there is an rule rule "Counter shower 1" when $Counter : Counter() then System.out.println("Counter there (1) : " + $Counter.count); end rule "Counter shower 2" when $Counter : Counter() accumulate (Counter() ; $cnt : count()) then System.out.println("Counter there (2) : " + $Counter.count); end rule "Counter shower 3" when Counter() then System.out.println("Counters there (3) : "); end rule "Counter creator" when $Counter : Counter(count == 2) then insert (new Counter(3)); // STEP 3 System.out.println("new Counter created "); end rule "Counter remover" when $Counter : Counter(count == 1) exists Counter (count == 3) then retract ($Counter) ; // STEP 4 System.out.println("retract counter with ID = 1"); end This is kModule &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"&gt; &lt;kbase name="rules" packages="rules"&gt; &lt;ksession name="test" /&gt; &lt;/kbase&gt; &lt;/kmodule&gt; The r…
upvote count: 2
tagged with: business-rules
type: Question
tagged with: drools
tagged with: java
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26429684
has title: Working Memory & objects insertion behavior in Drools
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/37389856

http://stackoverflow.com/comment/41560082
comment on: http://stackoverflow.com/q/26460062
score: 0
type: QuestionComment
has text: Just a side note, if you are using maven `2` or above then you have to work with `M2_HOME` instead of `MAVEN_HOME`. Type `mvn --version` to get informations about your installation.
type: Comment

http://stackoverflow.com/a/26408527
type: Answer
has body: Do you really want to pause your thread until the other one as finished? You should never, ever block the main thread. The join method allows one thread to wait for the completion of another. If t is a Thread object whose thread is currently executing, t.join(); causes the current thread to pause execution until t's thread terminates. Overloads of join allow the programmer to specify a waiting period. However, as with sleep, join is dependent on the OS for timing, so you should not assume that join will wait exactly as long as you specify. (from java docs) Also, does performMatchCalc() needs to be public ? Now, at first glance that code actually looks correct, but, you can still prevent someone from starting another calculation. Perhaps with something similar of this : public class DoMath { private Thread mathThread; protected math calc() { } public static DoMath getInstance() { if(_instance == null) { _instance = new DoMath(); } return _instance; } // perform a synchronous math calc, and return a boolean indicating success or failure. public boolean performMathCalc() { if(null != mathThread &amp;&amp; mathThread.isAlive()) return false; MathEngine.setApplicationMode(MathEngine.AUTO); MathEngine.getInstance().StartMathCalc(MathEngine.DIVISION); return true; } // perform an async math calc, and call back the listener when done public void performMathCalc(final listener client) { //re-start calculation? if so if(null != mathThread &amp;&amp; mathThread.isAlive()) { matchThread.interrupt(); matchThread = null; } mathThread = new Thread(new Runnable() { public void run() { boolean result = performMathCalc(); client.mathFinished(result); } }); mathThread.setDaemon(true); mathThread.start(); } public static interface listener { public void mathFinished(boolean success); } protected static DoMath _instance; }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26408115
downvote count: 0

http://stackoverflow.com/q/26498103
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/41628943
has body: I am trying to write a program to allow a user to draw an ellipse by using clicks. The user left-clicks at first to select the radius, then right-clicks to select the horizontal radius, then right-clicks again to select the vertical radius. Nothing is drawn after clicking. I don't understand where the error is. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Ellipse extends JPanel implements MouseListener{ Graphics P; public Ellipse() { addMouseListener(this); } static int Radius = 0; int CenterX, CenterY, RadiusX, RadiusY; public void paintComponent(Graphics g) { P=g; EllipseMidpoint(CenterX, CenterY, RadiusX, RadiusY); } public void EllipseMidpoint(int Cx, int Cy, int Rx, int Ry) { int Rx2 = Rx * Rx; int Ry2 = Ry * Ry; int twoRx2 = 2 * Rx2; int twoRy2 = 2 * Ry2; int x = 0; int y = Ry; int p; int px= 0; int py = twoRx2 * y; PlotEllipsePoint(Cx, Cy, x, y); //Region 1 p = (int)(Ry2 - (Rx2 * Ry) + (0.25 + Rx2)); while (px &lt; py) { x = x + 1; px = twoRy2 + px; if (p &lt; 0) { p = Ry2 + px + p; } else { y = y - 1; py = twoRx2 - py; p = Ry2 + px - py + p; } PlotEllipsePoint(Cx, Cy, x, y); } //Region2 p = (int)(Ry2 * (x + 0.5) * (x + 0.5) + Rx2 * (y - 1) * (y - 1) - Rx2 * Ry2); while (y &gt; 0) { y = y - 1; py = twoRx2 - py; if (p &gt; 0) { p = Rx2 - py + p; } else { x = x + 1; px = twoRy2 + px; p = Rx2 + px - py + p; } PlotEllipsePoint(Cx, Cy, x, y); } } public void PlotEllipsePoint(int CX, int CY, int X, int Y) { drawPixel(CX + X, CY + Y); drawPixel(CX - X, CY + Y); drawPixel(CX + X, CY - Y); drawPixel(CX - X, CY - Y); } public void drawPixel(int x, int y) { P.fillOval(x, y, 5, 5); } public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { CenterX = e.getX(); CenterY = e.getY(); } else if (e.getButton() == MouseEvent.BUTTON3) { Radius = Radius + 1; if (Radius == 1) { RadiusX = (int) Math.pow((Math.pow((e.getX() - CenterX), 2) + Math.pow((e.getY() - CenterY), 2)), 0.5); } else if (Radius == 2) { RadiusY = (int) …
has title: Midpoint Ellipse Algorithm in Java
downvote count: 4
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26498214
tagged with: ellipse
type: UnansweredQuestion
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/41628987

hibernate
tags question: http://stackoverflow.com/q/26481224
tags question: http://stackoverflow.com/q/26498517
tags question: http://stackoverflow.com/q/26390800
tags question: http://stackoverflow.com/q/26421889
tags question: http://stackoverflow.com/q/26483603
tags question: http://stackoverflow.com/q/26457891
tags question: http://stackoverflow.com/q/26507446
tags question: http://stackoverflow.com/q/26405451
tags question: http://stackoverflow.com/q/26396735
tags question: http://stackoverflow.com/q/26478690
tags question: http://stackoverflow.com/q/26505645
tags question: http://stackoverflow.com/q/26497676
tags question: http://stackoverflow.com/q/26469263
tags question: http://stackoverflow.com/q/26399026
tags question: http://stackoverflow.com/q/26384256
tags question: http://stackoverflow.com/q/26415231
tags question: http://stackoverflow.com/q/26387399
tags question: http://stackoverflow.com/q/26362470
tags question: http://stackoverflow.com/q/26468245
tags question: http://stackoverflow.com/q/26447834
tags question: http://stackoverflow.com/q/26461251
tags question: http://stackoverflow.com/q/26449538
tags question: http://stackoverflow.com/q/26511552
tags question: http://stackoverflow.com/q/26464926
tags question: http://stackoverflow.com/q/26360636
tags question: http://stackoverflow.com/q/26485936
tags question: http://stackoverflow.com/q/26406393
tags question: http://stackoverflow.com/q/26384192
tags question: http://stackoverflow.com/q/26502584
tags question: http://stackoverflow.com/q/26409897
tags question: http://stackoverflow.com/q/26437501
tags question: http://stackoverflow.com/q/26449214
tags question: http://stackoverflow.com/q/26416881
tags question: http://stackoverflow.com/q/26377514
tags question: http://stackoverflow.com/q/26419491
tags question: http://stackoverflow.com/q/26499982
tags question: http://stackoverflow.com/q/26377118
tags question: http://stackoverflow.com/q/26426083
tags question: http://stackoverflow.com/q/26422320
tags question: http://stackoverflow.com/q/26443952
tags question: http://stackoverflow.com/q/26423724
tags question: http://stackoverflow.com/q/26411823
tags question: http://stackoverflow.com/q/26490057
tags question: http://stackoverflow.com/q/26397598
tags question: http://stackoverflow.com/q/26353774
tags question: http://stackoverflow.com/q/26468910
tags question: http://stackoverflow.com/q/26404283
tags question: http://stackoverflow.com/q/26377093
tags question: http://stackoverflow.com/q/26372340
tags question: http://stackoverflow.com/q/26463292
tags question: http://stackoverflow.com/q/26457112
tag name: hibernate
tags question: http://stackoverflow.com/q/26421371
tags question: http://stackoverflow.com/q/26486844
tags question: http://stackoverflow.com/q/26474804
tags question: http://stackoverflow.com/q/26452974
tags question: http://stackoverflow.com/q/26355535
tags question: http://stackoverflow.com/q/26497409
tags question: http://stackoverflow.com/q/26505522
tags question: http://stackoverflow.com/q/26370254
tags question: http://stackoverflow.com/q/26421859
tags question: http://stackoverflow.com/q/26449877
tags question: http://stackoverflow.com/q/26378820
tags question: http://stackoverflow.com/q/26378831
tags question: http://stackoverflow.com/q/26414726
tags question: http://stackoverflow.com/q/26367983
tags question: http://stackoverflow.com/q/26474557
tags question: http://stackoverflow.com/q/26444253
tags question: http://stackoverflow.com/q/26379522
tags question: http://stackoverflow.com/q/26405931
tags question: http://stackoverflow.com/q/26359634
tags question: http://stackoverflow.com/q/26402143
tags question: http://stackoverflow.com/q/26358973
tags question: http://stackoverflow.com/q/26387539
tags question: http://stackoverflow.com/q/26503942
tags question: http://stackoverflow.com/q/26501595
tags question: http://stackoverflow.com/q/26386808
tags question: http://stackoverflow.com/q/26471534
tags question: http://stackoverflow.com/q/26495940
tags question: http://stackoverflow.com/q/26417089

http://stackoverflow.com/comment/41569529
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26465841
type: Comment
has text: How to assign min back to timLim?

http://stackoverflow.com/comment/41615226
has text: you would also have to change `priemgetallen.add(i);` to `priemgetallen.add((int)i);` since `List.add()` takes an int
comment on: http://stackoverflow.com/a/26490632
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26407536
has comment: http://stackoverflow.com/comment/41463798
answers question: http://stackoverflow.com/q/26407292
has comment: http://stackoverflow.com/comment/41464785
has comment: http://stackoverflow.com/comment/41464030
has body: Don't use the same Connection in your application! But what you want to achieve could be done using static variable. For example, add the following code to any of your classes, or create a new class for it: private static Connection con = null; public static Connection getConnection (String url) { if (con == null) con = DriverManager.getConnection(url); return con; } Then, call MyClass.getConnection("jdbc:mysql://localhost:3306/") or whatever the connection string is, and it will return one Connection that you could use for all classes.
score: 0
has comment: http://stackoverflow.com/comment/41464473
has comment: http://stackoverflow.com/comment/41463721
type: Answer

http://stackoverflow.com/comment/41612053
has text: *"i have tryed to add a JOptionpane list where it is changing to the queen piece but just keep running into compiling errors in my code"* Which errors? What does the compiler say? What line?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26476669
score: 0

http://stackoverflow.com/q/26438230
tagged with: sqlite
answer count: 1
has answer: http://stackoverflow.com/a/28125194
tagged with: swing
tagged with: spring
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: authentication
accepted answer: http://stackoverflow.com/a/28125194
type: Question
has body: I am create Java Swing application using Spring. I am creating two user one admin second general. There are mainly five function or menu button in my application. For admin user I want to show all five menu button, and for general user only four. I have created logging window, getting username and password from SQLite. I searched on the web and found Apache Shiro and JAAS. But I have to do this urgently, and to use that framework will need more time. Is there any simple Java code to do this? Any example similar to my problem?
has title: User authorization in Java using Spring, Swing and SQLite

http://stackoverflow.com/a/26447526
has body: You have created an Array of Strings where each element in that array is a "String". So, you can't use charAt to the array. charAt(index) by it's name - you can think (give me the character at position index). So, first you need to go to the particular "String" and then say "give me the character at position 'x' ". So, if you want to go to "Facebook", then say hey "give me the element of the array at position 3 which is index 2" using: myName[2]; store it in say variable str which needs to be a "String" : String str = myName[2]; Then, you can use charAt(x) on str using : for(int i =0 ; i&lt;str.length() ; i++){ System.out.println(str.charAt(i)); }
answers question: http://stackoverflow.com/q/26447055
score: 0
type: Answer

http://stackoverflow.com/q/26492329
score: 1
tagged with: java
tagged with: callable
has title: Why Future thread doesn't work in background of application?
answer count: 2
accepted answer: http://stackoverflow.com/a/26525889
downvote count: 0
tagged with: threadpoolexecutor
favorite count: 0
has body: Today I found a wierd problem. What I want is to check server availability (Particularly SSL checking) once application started and display proper message if server is down. This process should work in background and user is able to navigate the app if server has problem (app can works offline). What I did is simple. In main activity I have @Override protected void onStart() { super.onStart(); // Check Internet connection // Check Location sensor // Check server accessibility BackendCheck backendCheck = new BackendCheck(this); if (!backendCheck.execute()) { displayErrorDialog(); return; } } This is BackendCheck class: public class BackendCheck implements Callable&lt;Boolean&gt; { private static final String TAG = BackendCheck.class.getSimpleName(); // Thread sleep time private static final int THREAD_SLEEP = 5000; // Number of attempts to call an API in order to get response private static final int MAX_ATTEMPT = 3; // Current attempt private int counter = 0; // The url that should be used in order to get server response private String mTestUrl; // App mContext private Context mContext; // Server status private boolean mServerStatus = false; public BackendCheck(Context context) { this(context, ""); } public BackendCheck(Context context, String url) { this.mTestUrl = url; this.mContext = context; } public boolean execute() { // Check #mTestUrl and use Feature API if this variable is empty if (TextUtils.isEmpty(mTestUrl)) { mTestUrl = PassengerConstants.URL_BASE + mContext.getResources() .getString(R.string.uri_feature_payments); } // Get ExecutorService from Executors utility class, thread pool size is 10 ExecutorService executor = Executors.newFixedThreadPool(10); do { // Increment counter counter++; // Submit Callable tasks to be executed by thread pool Future&lt;Boolean&gt; future = executor.submit(this); try { // Break Do-While loop if server responded to request (there is no error) if (!future.get()) { mServerStatus = true; break; } } catch (InterruptedException…
tagged with: android
linked to: http://stackoverflow.com/q/44352674
tagged with: future
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26525889
upvote count: 1
possible better answer: http://stackoverflow.com/a/26492558
type: Question
has answer: http://stackoverflow.com/a/26492558
has comment: http://stackoverflow.com/comment/41619552

quicksort
tags question: http://stackoverflow.com/q/26395441
tag name: quicksort
tags question: http://stackoverflow.com/q/26370762
type: Tag
tags question: http://stackoverflow.com/q/26433861

http://stackoverflow.com/comment/41575872
type: QuestionComment
type: Comment
has text: PS: Whats up with that down-vote.. Which part shows no research effort; is not clear or not useful??
score: 0
comment on: http://stackoverflow.com/q/26468715

http://stackoverflow.com/a/26466390
score: 0
accepted answer of: http://stackoverflow.com/q/26466116
has body: This might be due to other processes are still using the file, like anti-virus program and also it may be a case that any other processes in your application may possessing a lock. please check that and deal with that, it may solve your problem.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26466116
has comment: http://stackoverflow.com/comment/41789280

http://stackoverflow.com/a/26443177
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26443144
has comment: http://stackoverflow.com/comment/41753740
answers question: http://stackoverflow.com/q/26443144
type: AcceptedAnswer
downvote count: 0
has body: You should only wire classes that will provide specific functionality to the current whole class. Entity classes, managed by Hibernate (or any other ORM framework), do not meet such requirement, and you should create it using new keyword or they will be created as result of finding data from your datasource, so they should not be managed by Spring nor any other DI framework.
type: Answer
has comment: http://stackoverflow.com/comment/41754547
score: 2
has comment: http://stackoverflow.com/comment/41754475

http://stackoverflow.com/comment/41412475
comment on: http://stackoverflow.com/a/26366380
type: AnswerComment
score: 0
type: Comment
has text: That's why it remains disabled till the end. Think about it logically, when would you like the buttons enabled again? If I understand your program correctly, you would want the buttons enabled once the user closes the JFrame.

maven
tags question: http://stackoverflow.com/q/26470499
tags question: http://stackoverflow.com/q/26382256
tags question: http://stackoverflow.com/q/26508244
tags question: http://stackoverflow.com/q/26373455
tags question: http://stackoverflow.com/q/26386758
tags question: http://stackoverflow.com/q/26390784
type: Tag
tags question: http://stackoverflow.com/q/26385046
tags question: http://stackoverflow.com/q/26354209
tags question: http://stackoverflow.com/q/26471404
tags question: http://stackoverflow.com/q/26482070
tags question: http://stackoverflow.com/q/26504905
tags question: http://stackoverflow.com/q/26356142
tags question: http://stackoverflow.com/q/26468861
tags question: http://stackoverflow.com/q/26502339
tags question: http://stackoverflow.com/q/26406323
tags question: http://stackoverflow.com/q/26421754
tags question: http://stackoverflow.com/q/26404343
tags question: http://stackoverflow.com/q/26468910
tags question: http://stackoverflow.com/q/26359212
tags question: http://stackoverflow.com/q/26403719
tags question: http://stackoverflow.com/q/26475959
tags question: http://stackoverflow.com/q/26374281
tags question: http://stackoverflow.com/q/26481596
tags question: http://stackoverflow.com/q/26478926
tags question: http://stackoverflow.com/q/26506364
tags question: http://stackoverflow.com/q/26438248
tags question: http://stackoverflow.com/q/26391795
tags question: http://stackoverflow.com/q/26464371
tags question: http://stackoverflow.com/q/26356477
tags question: http://stackoverflow.com/q/26449957
tags question: http://stackoverflow.com/q/26354674
tags question: http://stackoverflow.com/q/26410292
tags question: http://stackoverflow.com/q/26379036
tags question: http://stackoverflow.com/q/26359911
tags question: http://stackoverflow.com/q/26420681
tags question: http://stackoverflow.com/q/26481653
tags question: http://stackoverflow.com/q/26446328
tags question: http://stackoverflow.com/q/26367545
tags question: http://stackoverflow.com/q/26492239
tags question: http://stackoverflow.com/q/26421949
tags question: http://stackoverflow.com/q/26439055
tags question: http://stackoverflow.com/q/26440012
tags question: http://stackoverflow.com/q/26373748
tags question: http://stackoverflow.com/q/26460062
tags question: http://stackoverflow.com/q/26457883
tags question: http://stackoverflow.com/q/26437674
tags question: http://stackoverflow.com/q/26376172
tags question: http://stackoverflow.com/q/26475472
tags question: http://stackoverflow.com/q/26508166
tags question: http://stackoverflow.com/q/26497522
tags question: http://stackoverflow.com/q/26373376
tags question: http://stackoverflow.com/q/26388803
tags question: http://stackoverflow.com/q/26384622
tags question: http://stackoverflow.com/q/26457460
tags question: http://stackoverflow.com/q/26371195
tags question: http://stackoverflow.com/q/26379980
tags question: http://stackoverflow.com/q/26489330
tags question: http://stackoverflow.com/q/26463696
tags question: http://stackoverflow.com/q/26460181
tags question: http://stackoverflow.com/q/26453191
tags question: http://stackoverflow.com/q/26364009
tags question: http://stackoverflow.com/q/26367035
tags question: http://stackoverflow.com/q/26442108
tags question: http://stackoverflow.com/q/26467881
tags question: http://stackoverflow.com/q/26490352
tags question: http://stackoverflow.com/q/26424723
tags question: http://stackoverflow.com/q/26451963
tags question: http://stackoverflow.com/q/26414571
tags question: http://stackoverflow.com/q/26496413
tags question: http://stackoverflow.com/q/26437581
tags question: http://stackoverflow.com/q/26398477
tags question: http://stackoverflow.com/q/26453160
tags question: http://stackoverflow.com/q/26510093
tags question: http://stackoverflow.com/q/26383157
tags question: http://stackoverflow.com/q/26486653
tags question: http://stackoverflow.com/q/26488353
tags question: http://stackoverflow.com/q/26391559
tags question: http://stackoverflow.com/q/26362014
tags question: http://stackoverflow.com/q/26411984

http://stackoverflow.com/comment/41477561
type: QuestionComment
has text: Can't you just change your 'while' to a 'if'. You have an infinite loop otherwise.
comment on: http://stackoverflow.com/q/26414762
score: 0
type: Comment

http://stackoverflow.com/comment/41387266
type: Comment
type: QuestionComment
has text: What is Utente class ?
comment on: http://stackoverflow.com/q/26364558
score: 0

http://stackoverflow.com/a/26380549
downvote count: 0
has body: I have solved it by using parameter: false I found it worked when using Resin 4.0.41. If I use Resin 3.1.9 I wonder why it didn't work.
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26379984
type: Answer
answers question: http://stackoverflow.com/q/26379984

http://stackoverflow.com/comment/41587513
type: Comment
has text: @JoopEggen: yep. A simple mental Venn diagram will show a big problem if case1 and case2 have an empty union set.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26474955

http://stackoverflow.com/comment/41627504
score: 0
comment on: http://stackoverflow.com/q/26497241
type: QuestionComment
type: Comment
has text: Where is this code in your servlet? Is it in ctor? You will get config only in methods which are inherited from `HttpServlet`: `init, doGet`, etc.

http://stackoverflow.com/q/26358726
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26358855
answer count: 3
has title: Double.Min_Value not working as expected
has answer: http://stackoverflow.com/a/26358760
accepted answer: http://stackoverflow.com/a/26358760
favorite count: 0
has answer: http://stackoverflow.com/a/26359141
has body: I have the following code, but it doesn't go through the if when mutuaInformation is zero. Any idea what is going wrong? int largestEntropyIndex = Integer.MIN_VALUE; double largestMutualInfomation = Double.MIN_VALUE; for (int i = 0; i &lt; attributes.size(); i++) { String attrName=this.attributes.get(i); double conditionalEntropy = calcConditionalEntropy(i, instances, this.attributeValues.get(attrName).size(), this.labels.size()); System.out.println("conditional entropy is: "+conditionalEntropy); double mutualInformation = entropy - conditionalEntropy; if (mutualInformation &gt; largestMutualInfomation){ largestMutualInfomation = mutualInformation; largestEntropyIndex = i; }
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26358855

http://stackoverflow.com/comment/41409093
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26376640
has text: afaik, one cannot upload files with ajax...
score: 0

http://stackoverflow.com/comment/41595429
has text: Then create a `boolean` for each task, specifying whether it's running or not. Both tasks should first check if it's already running (check the boolean). If not, set the boolean to true and continue. If your task is already running and it's executed again, itll exit since the boolean is true (its already running). Ensure the task only exexutes if its not already running
comment on: http://stackoverflow.com/q/26479432
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26420934
has answer: http://stackoverflow.com/a/26421149
has title: Get Member/Fields of an existing Object
has body: i will discribe my problem with the following example: public class Person{ private int age; private String name; public Person(int age, String name){ this.age = age; this.name = name; } } I ve a class with some Members (age and name in this case) but i don't know which and how much my class does have. Also i don't even care about the amount or the types. I wan't to get all members of only one class. like this: private List&lt;Object&gt; getAll(Class searchedClass, Object from){ // This is where the magic happens } This method shall return a List with every not null object which is an instance of the Class "searchedClass" and is a member of the Object "from". In my case i've classes called Property and PropertyContainerList and an interface called PropertyContainer. A PropertyContainerList can only contain objects which implements my interface PropertyContainer. So a class could've 10 Properties as members and another one cuold've 5 but objects of both can be added. A Property has the method addListener(...). I want, every time an object is added to my list, to add an listener to every "Property"-member of the object. so like this: if(instance of PropertyContainer is added){ List&lt;Property&gt; properties = getAll(Property.class, propertyContainerObject); for(Property property : properties) property.addListener(new Listener()); } I tried a few things but i've no idea how to realize the getAll(Class, Object) method. Please help :) Thanks for answers
has answer: http://stackoverflow.com/a/26422095
has comment: http://stackoverflow.com/comment/41488019
tagged with: java
has answer: http://stackoverflow.com/a/26421235
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/41487963
has comment: http://stackoverflow.com/comment/41487976
score: 0
answer count: 3
tagged with: member
linked to: http://stackoverflow.com/q/2548384
tagged with: field
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41487820

http://stackoverflow.com/comment/41476179
comment on: http://stackoverflow.com/a/26412237
type: AnswerComment
type: Comment
has text: [Worldwind is on Maven Central](http://search.maven.org/#search|ga|1|worldwind), too.
score: 0

http://stackoverflow.com/q/26507389
has comment: http://stackoverflow.com/comment/41645891
tagged with: jsf
has comment: http://stackoverflow.com/comment/41780537
tagged with: primefaces
tagged with: java
has answer: http://stackoverflow.com/a/26586854
has comment: http://stackoverflow.com/comment/41646252
accepted answer: http://stackoverflow.com/a/26586854
has comment: http://stackoverflow.com/comment/41646185
has comment: http://stackoverflow.com/comment/41646157
has comment: http://stackoverflow.com/comment/41646898
has comment: http://stackoverflow.com/comment/41646060
type: Question
tagged with: websphere
upvote count: 1
has comment: http://stackoverflow.com/comment/41647160
has comment: http://stackoverflow.com/comment/41645768
has title: Error 500: javax.servlet.ServletException: org.primefaces.model.TreeNode on deployment on websphere
score: 0
linked to: http://stackoverflow.com/q/13121606
has comment: http://stackoverflow.com/comment/41647783
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41646487
has comment: http://stackoverflow.com/comment/41645933
has comment: http://stackoverflow.com/comment/41781795
tagged with: maven
has comment: http://stackoverflow.com/comment/41780668
downvote count: 1
has comment: http://stackoverflow.com/comment/41646830
type: AnsweredQuestion
has body: Recently i had integrated my web application project with maven which was earlier working fine. On integration, i am finding this error for which i have no clue. I checked if any of my dependancies were missing in my pom.xml but what all were required were already present. I seriously have no idea of how to proceed or how to debug my issue. I am able fire all my commands using maven and getting build success too. This is my initial phase with maven and would request the expertise here to guide me to proper directions. Below is my source code for POM. Below is my error log: Faces Servlet: javax.servlet.ServletException: org.primefaces.model.TreeNode at javax.faces.webapp.FacesServlet.service(FacesServlet.java:221) class for my web path entries: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;classpath&gt; &lt;classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/&gt; &lt;classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/&gt; &lt;classpathentry including="**/*.java" kind="src" path="src/main/java"/&gt; &lt;classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/&gt; &lt;classpathentry kind="var" path="M2_REPO/asm/asm-commons/3.3/asm-commons-3.3.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/asm/asm-tree/3.3/asm-tree-3.3.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/asm/asm/3.3/asm-3.3.jar"/&gt; &lt;classpathentry kind="lib" path="C:/Program Files/Java/jdk1.6.0_34/lib/tools.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.2/antlr-2.7.2.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/&gt; &lt;classpathentry kind="var" path="M2_REPO/org/primefaces/primefaces/5.0/primefaces-5.0.jar"/&gt; &lt;classpathen…

http://stackoverflow.com/comment/41533145
type: QuestionComment
type: Comment
score: 1
has text: @traianus Re _"than have to buy a certificate from one of the CA's"_ - That's not (completely) true. 1. [StartSSL](http://www.startssl.com/) offers 1-year SSL/TLS + S/MIME for free. 2. You can easily create your own certificates with [OpenSSL](https://www.openssl.org/) (thus being your own CA) and associate this certificate with your `https://` site. If your visitors accept your certificate in the dialog that pops up in their browser it is stored in their browser's certificate store and the dialog will not appear again until the certificate's expiration date is reached.
comment on: http://stackoverflow.com/q/26437581

http://stackoverflow.com/q/26357469
has body: i am trying to read 7th line of a string so that i can filter the required text but not getting more.(assuming i have n number of line). class Lastnthchar { public static void main(String[] args) { // TODO Auto-generated method stub String alldata =" FORM"+"\n"+ " to get all data"+"\n"+ " PART A is mandatory"+"\n"+ " enclose all Certificate"+"\n"+ " Certificate No. SFDSFDFS Last updated on 12-Jun-2009"+"\n"+ " Name and address"+"\n"+ " Lisa Lawerence"+"\n"+ " 10/3 TOP FLOOR, Street no 22 ,NewYork"+"\n"+ " residence"+"\n"+ " zip-21232"+"\n"+ " C 78,New York"+"\n"+ " US"+"\n"+ " US"+"\n"+ " "+"\n"+ " worldwide"; String namerequired = new String (); //BufferedReader br = new BufferedReader(alldata); int lineno = 0; for(lineno = 0; lineno &lt;alldata.length(); lineno ++) { //what should i do? } } } so if any solution please help.
has title: Read nth line from string
accepted answer: http://stackoverflow.com/a/26357705
tagged with: filter
answer count: 3
has answer: http://stackoverflow.com/a/26357967
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26357705
has answer: http://stackoverflow.com/a/26357572
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/26357572
type: Question

uiactivityviewcontroller
tag name: uiactivityviewcontroller
tags question: http://stackoverflow.com/q/26496192
type: Tag

http://stackoverflow.com/comment/41632355
type: Comment
type: QuestionComment
has text: I don't find enough documentations/tutorials for using Retrofit.
score: 6
comment on: http://stackoverflow.com/q/26500036

http://stackoverflow.com/a/26474112
score: 0
answers question: http://stackoverflow.com/q/26473999
has body: You should pass distance a Point object not 2 integers. Try something like this: pt2.distance(new Point(3, -10)); That is what you are probably looking for.
type: Answer

http://stackoverflow.com/q/26436289
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/41517193
downvote count: 2
answer count: 1
favorite count: 0
has title: How to return to beginning of while loop java
has body: How to break out of forloop and return to beginning of while loop. My function should return 111221 when I input 1211 since there is one 1, one 2, and two 1's. If anyone has any ideas, I'd really appreciate it. public static String occurence(String input) { int s = 0; String out = ""; int count = 0; while(s &lt; input.length()) { int num = getInt(input, s); for(int r = s; r &lt; input.length(); r++) { if(num == getInt(input, r)) { count++; } else { System.out.println(count); out += count; out += num; s += count; count = 0; // Jump to start of while loop } } } return out; }
has comment: http://stackoverflow.com/comment/41517199
tagged with: while-loop
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26436301
tagged with: break
upvote count: 0
tagged with: loops

http://stackoverflow.com/a/27321642
has body: The response is probably in this tutorial : https://sites.google.com/site/telosystutorial/springmvc-jpa-springdatajpa
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26378907
downvote count: 0

http://stackoverflow.com/comment/41595161
comment on: http://stackoverflow.com/q/26479429
score: 0
has text: here is the it "error: cannot find symbol"
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26474958
has title: Array Errors Java
has body: When I compile the java code, I met the problem: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 11 at watercount.trap(watercount.java:41) at watercount.main(watercount.java:14) It seems that the Array is not used correctly, but I can not figure out. Thanks for your help ! import java.util.Arrays; public class watercount { public static void main (String args[]){ int[] Array = new int[] {1,3,4,6,8,12,2,3,4,5,10}; int water_num; water_num = trap(Array); System.out.println(Arrays.toString(Array)); } public static int trap (int[] A) { int trap=0; int high=0; if (A==null) return trap; int []leftHigh = new int[A.length]; int []rightHigh = new int[A.length]; for(int i=0; i&lt;A.length; i++){ if(A[i]&gt;high) high = A[i]; leftHigh[i]=high; } high=0; for(int i=A.length;i&gt;=0;i--){ if(A[i]&gt;high) high = A[i]; rightHigh[i]=high; } for(int i=0; i&lt;A.length; i++) {trap+=Math.min(rightHigh[i],leftHigh[i])-A[i];} return trap; }
upvote count: 0
has comment: http://stackoverflow.com/comment/41587384
answer count: 1
favorite count: 0
score: -3
has answer: http://stackoverflow.com/a/26474983
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26474983
tagged with: java
downvote count: 3
type: Question
tagged with: arrays

http://stackoverflow.com/q/26397741
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: swt
has title: Exception in thread "main" org.eclipse.swt.SWTException: Could not complete the operation due to error 800a025e
type: Question
tagged with: javascript
has body: I am developing an SWT application with an embedded browser and have used the following function to implement search function in the browser.This works perfectly if I search for words with more than two letters in it. If I search for 1 letter or 2 letters, it throws the error Exception in thread "main" org.eclipse.swt.SWTException: Could not complete the operation due to error 800a025e. public void searchNextOccuranceOfWord(String str) { System.out.println("Search next button is pressed"); str=str.trim(); String script_finddown= " var supported = false;"+ "var found = false;"+ "if (window.find) {"+ // Firefox, Google Chrome, Safari "supported = true;"+ // if some content is selected, the start position of the search // will be the end position of the selection "found = window.find (\""+ str+ "\",false,false,false,false,true,false);return \" found \"; "+ "}"+ "else {"+ "if (document.selection &amp;&amp; document.selection.createRange) {"+ // Internet Explorer, Opera before version 10.5 "var textRange = document.selection.createRange ();"+ "if (textRange.findText) {"+ // Internet Explorer "supported = true;"+ // if some content is selected, the start position of the search // will be the position after the start position of the selection "if (textRange.text.length &gt; 0) {"+ "textRange.collapse (true);"+ "textRange.move (\"character\", 1);"+ "}"+ "found = textRange.findText (\""+str+ "\",1);"+ "if (found) {"+ "textRange.select ();return \"found \" ; "+ "}"+ "}"+ "}"+ "if (supported) {"+ "if (!found) {"+ "return \" not found\"; "+ "}"+ "}"+ "else {"+ "return \" not suppoerted\"; " + "}"+ "} " ; //boolean ex = browser.execute("window.find(\"" + str + "\" ,false,false,true,false,true,false )"); String ex = (String)browser.evaluate(script_finddown); System.out.println(ex); // TODO Auto-generated method stub } I debugged it and saw that there is problem at the statement "textRange.select ()"
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41446713
score: 0
has comment: http://stackoverflow.com/comment/41446604

http://stackoverflow.com/q/26502067
possible better answer: http://stackoverflow.com/a/26502277
has body: Why does this give an error? public class Getmethods { public static void main(String[] args) throws ClassNotFoundException { Class t = Class.forName("Getmethods"); if( t == null) { System.out.println("null"); } } } Error: Could not find or load main class Getmethods
has comment: http://stackoverflow.com/comment/41636061
upvote count: 1
has comment: http://stackoverflow.com/comment/41635909
accepted answer: http://stackoverflow.com/a/26502126
has title: Error using Class.forName() to get Class object for a Class
favorite count: 0
has comment: http://stackoverflow.com/comment/41635978
has comment: http://stackoverflow.com/comment/41635958
has answer: http://stackoverflow.com/a/26502277
downvote count: 5
score: -4
has answer: http://stackoverflow.com/a/26502126
has comment: http://stackoverflow.com/comment/41635853
has comment: http://stackoverflow.com/comment/41636019
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41636026
type: Question
answer count: 2

http://stackoverflow.com/comment/41575213
type: Comment
comment on: http://stackoverflow.com/a/26468525
type: AnswerComment
has text: this doesn't work. As I said, when i click on the gridview, then it does get updated. When I execute yours, even that doesn't happen
score: 0

http://stackoverflow.com/comment/41503525
score: 1
comment on: http://stackoverflow.com/q/26429280
has text: Youjust edit the source code files - what do you mean to remove them?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41604743
comment on: http://stackoverflow.com/q/26484557
has text: okay i'm starting up XTEXT.. Hope its as easy to use as you're saying :)
score: 0
type: Comment
type: QuestionComment

utf-8
tags question: http://stackoverflow.com/q/26391790
tags question: http://stackoverflow.com/q/26500574
tags question: http://stackoverflow.com/q/26501786
tags question: http://stackoverflow.com/q/26391418
tags question: http://stackoverflow.com/q/26488979
tags question: http://stackoverflow.com/q/26469049
tags question: http://stackoverflow.com/q/26357938
tag name: utf-8
type: Tag
tags question: http://stackoverflow.com/q/26397598
tags question: http://stackoverflow.com/q/26432479

http://stackoverflow.com/comment/41485061
type: QuestionComment
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63201/discussion-between-unknown-and-frobberofbits).
comment on: http://stackoverflow.com/q/26407962
score: 0

http://stackoverflow.com/a/26417253
type: Answer
answers question: http://stackoverflow.com/q/26417239
accepted answer of: http://stackoverflow.com/q/26417239
has body: you can try this code: public String getBirthDay(){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS"); return sdf.format(birthDay); }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/41650686
type: AnswerComment
comment on: http://stackoverflow.com/a/26483184
has text: You should be able to see the JVM under Discovered(JDP) (if you enable the tree view). Some setting on your machine is affecting this then, will try to find out which settings/permissions could be required..
type: Comment
score: 0

http://stackoverflow.com/comment/41607352
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26485775
type: Comment
has text: Eh, you should just *remove* that `myFrame.setLayout(new GridBagLayout());` line. Besides that the code is obviously meant to use the default `BorderLayout` (i.e. using the `"South"` constraint), it is a *really bad* idea to change the layout manager *after* components have been added to the container. Btw. why are you doing the `invokeLater` stuff twice?

http://stackoverflow.com/q/26505510
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41641806
linked to: http://stackoverflow.com/q/11245244
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/74044958
has body: I am inserting into an SQLite in-memory database with Java. When a specific condition is encountered I need to empty it after copying its content to a disk-based database. And then start populating the in-memory database again. How can I achieve this using Java?
has title: From in-memory database to disk
score: 0
tagged with: sqlite
answer count: 1
favorite count: 0

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

http://stackoverflow.com/a/26464207
upvote count: 6
has body: The question starts with "Can I" so the answer is YES, you can. But you should NOT do it. First, if you want a database to check if a value exists, use a database. If you still want to implement it in Java (which is temporary anyways if you don't store it somewhere after execution), I would highly recommend to use a HashMap. Complexity of retrieval from a HashMap is O(1) while ArrayList's complexity is O(n) for same operation.
downvote count: 0
answers question: http://stackoverflow.com/q/26464071
score: 6
type: Answer

http://stackoverflow.com/comment/41394102
type: AnswerComment
has text: Thanks @Elliott Frisch, what is a POJO?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26368341

http://stackoverflow.com/a/26454563
has body: The call setcopy.remove(element) will remove the int at position element. You are not removing the element itself. If you want to remove the element you have to write setcopy.remove(setcopy.indexOf(element)) EDIT: you can also use setcopy.remove(element) but then you have to loop like this: for (Integer element : set) or you can do it like this: for (int element : set){ //copy setcopy.remove(new Integer(element)); }
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26454471
type: Answer
accepted answer of: http://stackoverflow.com/q/26454471
has comment: http://stackoverflow.com/comment/41550593

http://stackoverflow.com/comment/42097919
has text: The table to wrap the results doesn't make any difference.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26752844
type: Comment

http://stackoverflow.com/comment/41591117
score: 0
type: AnswerComment
type: Comment
has text: Thank you so much for taking the time to give a thorough response, Victor. I'm not following your second point (which seems to be full of useful help). I have only a layman's understanding of this material as all we've been doing in class is going over various data structures and algorithms. Specifically, I'm not sure how my IDE (Eclipse) works or what you mean by domain types. I'm assuming incremental refinement is just running a piece of code to see if it works, debugging, rinse, repeat? Again, thanks SO much for responding.
comment on: http://stackoverflow.com/a/26476087

http://stackoverflow.com/comment/41384051
comment on: http://stackoverflow.com/a/26359377
type: AnswerComment
has text: ...or use the fully-qualified Java class name.
type: Comment
score: 1

http://stackoverflow.com/comment/41374032
score: 3
has text: Is there any way without having to update all existing entities?
comment on: http://stackoverflow.com/a/26357731
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26509404
tagged with: network-programming
type: UnansweredQuestion
has body: I am learning about UDP client server where the communication is one way from Server to Client. Server will send UDP packets to Client. I want to to make it dual communication where Server and Client can send UDP packets to each other. Do I need to make another Datagram socket for Client Server to make it dual communication or can I use my existing Datagram socket to do the job. If I dont need another Datagram Socket , I would appreciate if you can show me how it is done I would appreciate if you can point me to relevant resources on dual commuication for Client Server
tagged with: udp
has answer: http://stackoverflow.com/a/26542861
type: Question
has title: UDP Client Server dual communication
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/26371556
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/26394271
possible better answer: http://stackoverflow.com/a/26371617
tagged with: java
has answer: http://stackoverflow.com/a/26371617
type: Question
linked to: http://stackoverflow.com/q/26388848
has title: What does it mean to be "associated with persistence context"?
answer count: 2
tagged with: jpa
downvote count: 0
has body: In this documentation http://docs.oracle.com/javaee/5/tutorial/doc/bnbqw.html, it says Managed entity instances have a persistent identity and are associated with a persistence context.Detached entity instances have a persistent identify and are not currently associated with a persistence context. So I am trying to understand what "asscoiated with a persistence context mean"?
tagged with: entitymanager
favorite count: 0
has answer: http://stackoverflow.com/a/26394271
score: 2

http://stackoverflow.com/comment/41657073
score: 0
type: Comment
type: QuestionComment
has text: It's obviously possible, since this code compiles.
comment on: http://stackoverflow.com/q/26513593

http://stackoverflow.com/comment/41407138
has text: Here is the code: java -cp 'C:/users/daniel/desktop/study/fall 2014/text analytics/assignment3/lucene-core-3.0.0.jar' Indexer
score: 0
comment on: http://stackoverflow.com/q/26375470
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26481936
has body: The important thing that you need to remember about java Arrays is that, their indexing starts from '0' but not from '1'. When you create an array of size '2', to access the first array element you need to use index '0' (something like arr[0]) and to access the second array element you need to use the index '1'. This understanding would be good enough to overcome the out of bounds exceptions. Just go through the code carefully and see when ever you are accessing the array element, you are not using the index which is less than '0' (or) greater than 'size-1' (i.e if you create an array of size 'N', the index can not be less than '0' and can not be greater than N-1).
downvote count: 0
answers question: http://stackoverflow.com/q/26481835
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26394169
has comment: http://stackoverflow.com/comment/41440644
has comment: http://stackoverflow.com/comment/41441492
has answer: http://stackoverflow.com/a/26394623
type: Question
has comment: http://stackoverflow.com/comment/41444771
has title: what is wrong in my program ? i am trying to find the list of prime number from n to m
tagged with: java
downvote count: 6
has comment: http://stackoverflow.com/comment/41440912
has comment: http://stackoverflow.com/comment/41440688
answer count: 1
score: -6
favorite count: 0
has body: I am trying to write a program to find the prime numbers from n to m, but I do not know what I am doing wrong. For example, if I enter in 2 for n and 9 for m, I just get back 2 when the correct output should be 2 3 5 7 Here's my code: public static void main(String[] args) { Scanner input = new Scanner(System.in); PrintStream output = System.out; output.print("Enter a number to test: "); int n = input.nextInt(); int m = input.nextInt(); boolean isPrime = true; int i = 2; while (n &gt; 0 &amp;&amp; n &lt; m) { isPrime &amp;= n % i != 0; if (isPrime) { output.println(n); } n++; } }
has comment: http://stackoverflow.com/comment/41440752
accepted answer: http://stackoverflow.com/a/26394623
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/41640876
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26503102
has text: similar to this [link](http://docs.oracle.com/cd/E21454_01/html/821-2600/dsgn_impl_cstm_hndlrs_t.html#custom_handler) and at the end i got a builded String
score: 0

http://stackoverflow.com/a/26378059
answers question: http://stackoverflow.com/q/26364608
has comment: http://stackoverflow.com/comment/41423857
has body: Background Information When you execute mvn help:effecitve-pom, help is a prefix which represents a specific plugin while effective-pom is the goal from that plugin that should be executed. The first thing Maven does is try to lookup the full plugin based on the given prefix (so in your case the prefix help). Normally it does this by checking the /org/apache/maven/plugins/maven-metadata.xml file in your local repository (by default your local repository is stored under %HOME%/.m2/repository). If this file doesn't exist then it tries to check it remotely (again default configuration would use maven central), and will then cache this file in your local repository with the following name: maven-metadata-&lt;remote-repo-id&gt;.xml (so for maven central it would be: maven-metadata-central.xml). If at this point it is unable to access this file remotely then it wont be able to find the plugin and will fail the build. This is exactly what you are experiencing. Your Issue There are two main reasons why it wont be able to resolve the plugin: the local files in your repository are corrupt in some way maven is unable to access the remote repository (so basically a problem with your internet connection). You can use the debug flag -X when executing your maven build to receive more information about what is going on. For you executing the following: mvn -X help:effective-pom should provide information about how it is trying to resolve the plugin prefix. For example if I execute this command I see the following: [DEBUG] Resolving plugin prefix help from [org.apache.maven.plugins, org.codehaus.mojo] [DEBUG] Could not find metadata org.apache.maven.plugins/maven-metadata.xml in local (/home/user/.m2/repository) [DEBUG] Skipped remote update check for org.apache.maven.plugins/maven-metadata.xml, locally cached metadata up-to-date. My locally cached file from the remote repository is up to date so it will just use that. Do either /org/apache/maven/plugins/maven-metadata.xml or /org/a…
type: Answer
has comment: http://stackoverflow.com/comment/41425855
score: 11
has comment: http://stackoverflow.com/comment/41452438
has comment: http://stackoverflow.com/comment/41427721
downvote count: 1
upvote count: 12
has comment: http://stackoverflow.com/comment/41463967

http://stackoverflow.com/q/26458728
tagged with: java
has comment: http://stackoverflow.com/comment/41578869
downvote count: 2
has body: I'm trying to get rid of this code's warnings, but avoiding an excessive use of tags. Eclipse shows a warning saying "*Invalid location of tag . Is it possible to to avoid this error in this JSP using Eclipse, respecting the required W3C HTML semantic request? See the Eclipse warnings http://imageshack.com/a/img907/4755/TYhL7x.png http://imageshack.com/a/img537/2847/HjHvUA.png <%= sonho.getTituloSonho() %> <%= sonho.getDescricaoSonho() %> <% UsuarioBEANS usuario = usuarioBO.selecionarUsuario(sonho.getCdUsuario()); %> <%= usuario.getNome() %> <% CategoriaSonhoBEANS categoria = categoriaSonhoBO.obterCategoria(sonho.getCdCategoria()); %> <%= categoria.getNomeCategoria() %>
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41558647
has title: How can I clean this code without a lot of tags respecting HTML semantic?
score: -1
tagged with: eclipse
tagged with: w3c-validation
answer count: 1
has answer: http://stackoverflow.com/a/26471278
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41559419
has comment: http://stackoverflow.com/comment/41557288

http://stackoverflow.com/q/26442434
favorite count: 0
accepted answer: http://stackoverflow.com/a/26442878
possible better answer: http://stackoverflow.com/a/26442459
has comment: http://stackoverflow.com/comment/41527926
has answer: http://stackoverflow.com/a/26442459
type: AnsweredQuestion
score: 3
tagged with: java
has body: I come across this doubt a lot and I could use some opinions about it. I frequently use variables for values that are only used once and I'm not sure if there's a right or wrong way to do it. Is there any convention guideline about this? A simple example: int matches = 10; int victories = 4; int defeats = 3; int ties = (matches - (victories + defeats)); int score = (victories*3 + ties); Should ties be removed so that it becomes this? int matches = 10; int victories = 4; int defeats = 3; int score = (victories*3 + (matches - (victories + defeats))); Despite the silly example, I've wondered about this on situations of different complexities. I can see some Pros and Cons of using ties: Pros: Improves Readability ties can be used later if needed Easier maintenance Cons: Less compact code Makes use of more variables Uses resources unnecessarily Maybe this is just a situation of personal taste but let me know how you deal with this and why. Thanks!
downvote count: 1
has comment: http://stackoverflow.com/comment/41527930
type: Question
upvote count: 4
has title: Optimizing use of variables for values that are only used once
tagged with: optimization
answer count: 2
tagged with: variables
has answer: http://stackoverflow.com/a/26442878

http://stackoverflow.com/q/26406010
has answer: http://stackoverflow.com/a/76285270
answer count: 5
possible better answer: http://stackoverflow.com/a/26406270
upvote count: 4
has answer: http://stackoverflow.com/a/32949196
accepted answer: http://stackoverflow.com/a/32949196
has answer: http://stackoverflow.com/a/26406921
downvote count: 0
has title: How to output label with icon in line?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38235335
tagged with: java
tagged with: vaadin
type: Question
has body: Text of the label jumps on a next line when I use setIcon(). How to output it in one line? Label info = new Label("Reports are generated every day at 5 pm", ContentMode.HTML); info.setIcon( new ThemeResource("img/icons/information.png") ) ; info.setSizeUndefined(); JobsLayout.addComponent( info ); JobsLayout.setComponentAlignment(info, Alignment.MIDDLE_RIGHT);
has answer: http://stackoverflow.com/a/26406270
score: 4
favorite count: 0

http://stackoverflow.com/comment/138177689
type: AnswerComment
type: Comment
has text: This is really not intuitive. Think about (b OR c) and (d OR e). How should I turn it into OR criteria list quicklly?
comment on: http://stackoverflow.com/a/33571972
score: 0

http://stackoverflow.com/comment/41526751
comment on: http://stackoverflow.com/a/26441794
has text: Sorry. If you do not know these terms, you should go and read some beginning tutorials.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41371849
has text: If it helped you to solve your problem, mark the answer as accepted so that the others with the similar issue can benefit.
type: Comment
comment on: http://stackoverflow.com/a/26355202
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41576585
comment on: http://stackoverflow.com/a/26468653
type: Comment
has text: He's is using Text for both key & value in mapper to output. I don't think that's the issue.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41707961
comment on: http://stackoverflow.com/a/26484790
score: 0
type: AnswerComment
has text: Thanks a lot war. I will try with this.
type: Comment

http://stackoverflow.com/a/26386166
accepted answer of: http://stackoverflow.com/q/26386073
type: Answer
answers question: http://stackoverflow.com/q/26386073
downvote count: 0
has comment: http://stackoverflow.com/comment/41440827
score: 1
has body: Yes, you can wrap your non-serializable object in a serializable wrapper. No, it won't magically make the wrapped object serializable. You'll get a NotSerializableException if you attempt to serialize the wrapper class (without making that field transient).
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42178370

http://stackoverflow.com/comment/41426292
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26386134
has text: Are you sure the Java version works? `i+1` when `i == newSolution.length - 1` is out of bounds.

http://stackoverflow.com/q/26413434
accepted answer: http://stackoverflow.com/a/26429411
upvote count: 1
has answer: http://stackoverflow.com/a/28628756
has comment: http://stackoverflow.com/comment/41474883
favorite count: 0
possible better answer: http://stackoverflow.com/a/28628756
has title: Hibernate query timeout exception - I can't save data to the database
has comment: http://stackoverflow.com/comment/41475559
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41475086
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
has body: I would like to save an article, but i got an exception. I don't know what do I do wrong. I have three entities: User.class, Category.class and Article.class. User has these atributes: id name email password List of articles (One-To-Many) Category has these atributes: id name List of categories (Many-To-Many) Article has these attributes: id title content publishDate User (Many-To-One) List of categories (Many-To-Many) There are my controller and JSP file. ArticleController.class @Controller public class ArticleController { @Autowired ArticleService articleService; @Autowired CategoryService categoryService; @Autowired UserService userService; @ModelAttribute("article") public Article construct(){ return new Article(); } @RequestMapping("/admin/clanky") public String articles(Model model){ model.addAttribute("articles", articleService.findAll()); model.addAttribute("categories", categoryService.findAll()); model.addAttribute("users", userService.findAll()); return "articles"; } @RequestMapping(value="/admin/clanky", method=RequestMethod.POST) public String saveArticle(@ModelAttribute("article") Article article, BindingResult result){ Date publishDate = new Date(); article.setPublishDate(publishDate); articleService.save(article); return "redirect:/admin/clanky.html?success=true"; } @InitBinder public void initBinder(WebDataBinder webDataBinder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm"); dateFormat.setLenient(false); webDataBinder.registerCustomEditor(Date.class, "publishDate", new CustomDateEditor(dateFormat, false)); } @InitBinder protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { binder.registerCustomEditor(Integer.class, new CustomNumberEditor( Integer.class, true)); }} article.jsp <form:form commandName="article" cssClass="form-horizontal"> <form:hidden path="id" class="form-control input-sm" /> Title: <form:input path="title" cssClass="form-control" /> Content: <form:textarea …
tagged with: jsp
has answer: http://stackoverflow.com/a/26429411

http://stackoverflow.com/a/26496253
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41655157
accepted answer of: http://stackoverflow.com/q/26495940
has comment: http://stackoverflow.com/comment/41625922
answers question: http://stackoverflow.com/q/26495940
type: AcceptedAnswer
downvote count: 0
has body: Correct form is: return new Configuration().configure("/META-INF/hibernate.cfg.xml").buildSessionFactory(); configure(String) method looks for classpath resource and everything under /src/test/resources/ is available on the classpath in Maven when you run your tests.
type: Answer
has comment: http://stackoverflow.com/comment/41625722
has comment: http://stackoverflow.com/comment/41626436

http://stackoverflow.com/a/26420640
score: 0
answers question: http://stackoverflow.com/q/26420614
type: Answer
has body: When you assign an "exam" to the array, it doesn't create a new object. It merely stores the reference of an existing object in the array. If I understand your second question, when you create an array with a call such as Exam[] exams = new Exam[numberOfExams]; you create an object that contains enough space for numberOfExams references to Exam objects. BTW, exams[numberOfExams] = exam; would give you an ArrayIndexOutOfBoundsException, since your array has numberOfExams elements, so the valid indices are from 0 to numberOfExams-1.

http://stackoverflow.com/q/26480112
answer count: 1
has comment: http://stackoverflow.com/comment/41597160
has body: I am attempting to update a .txt file that is being displayed through a ListView. I have a button that removes lines from the ListView, but i want this to also update the lines in my .txt file while keeping their structure so that they show up in the ListView correctly after editing. IMPORTANT: The updated output to the output.txt file MUST keep the same format to ensure that is shows up in the list view correctly. Much thanks. EDIT: To put it more clearly, i have a .txt file displayed in a ListView. When i delete the line in ListView, i want it to be deleted in the .txt file as well. Here is my code for the list view as seen in ViewMeds.Java : package ibettergetagoodgradeforthisorillbepissed.sciencefair.beta.mmmeds.com.mmmeds; import android.app.ActionBar; import android.graphics.Color; import android.util.Log; import android.util.SparseBooleanArray; import android.view.View.OnClickListener; import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; import android.app.FragmentManager; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.support.v4.widget.DrawerLayout; import android.text.method.ScrollingMovementMethod; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class viewMed…
has comment: http://stackoverflow.com/comment/41596477
score: 0
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/41596519
type: UnansweredQuestion
type: Question
has title: Updating .txt file after editing it in ListView?
tagged with: java
has comment: http://stackoverflow.com/comment/41596437
tagged with: listview
has answer: http://stackoverflow.com/a/26480978

http://stackoverflow.com/q/26397261
has comment: http://stackoverflow.com/comment/41594646
has comment: http://stackoverflow.com/comment/41445902
type: Question
has title: XYPlot doesn't draw all points correctly
has comment: http://stackoverflow.com/comment/41594670
score: 0
has comment: http://stackoverflow.com/comment/41446121
has comment: http://stackoverflow.com/comment/41445766
has comment: http://stackoverflow.com/comment/41446702
type: UnansweredQuestion
tagged with: androidplot
has comment: http://stackoverflow.com/comment/41446286
tagged with: android
has body: I'm trying to display 550 data points with periodic peaks (the flat line is 61). The problem is, that androidplot isn't drawing all the points correctly! From my log: ECG I values 61,61,62,63,62,61,61,61,61,67,71,68,61,53,61,61,61,61,61,61,61,61,62,63,64,64,64,63,62,61,61,61 I've got the rangeboundaries set to plot.setRangeBoundaries(0,100, BoundaryMode.AUTO);, but as you can see, the peaks never drop to the 53 data point. I can see this lower point sometimes, but it gets smoothed out a fraction of a second later (as you can see in the screenshot). My line and point formatter is: LineAndPointFormatter lapf = new LineAndPointFormatter(p.color, null, null, null); lapf.getLinePaint().setStrokeJoin(Paint.Join.MITER); lapf.getLinePaint().setStrokeWidth(1); I've tried with the both Paint.Join.ROUND and Paint.Join.BEVEL and got the same effect. I've also used the debugger to check that 53 is being inserted into the series. EDIT After some debugging, it looks like my pulse loop thread is wrong: while (keepRunning) { for (PulseXYSeries j : series) { for (int k = 0; k &lt; j.plotStep; k++) { int at = (j.position + k) % j.getSize(); if (j.pulsing) { if (j.pulsePosition == j.pulseValues.size() - 1) { j.pulsing = false; j.pulsePosition = 0; } else { try { int pulseVal = j.pulseValues.get(j.pulsePosition); j.setY(pulseVal,at); j.pulsePosition += 1; } catch(IndexOutOfBoundsException e) { j.pulsePosition = 0; } } } else { j.setY(j.pulseValues.get(0), at); long currTime = SystemClock.elapsedRealtime(); if (currTime - j.getLastPulse() &gt;= j.getPulseDelay()) { j.pulsing = true; j.setLastPulse(currTime); } } j.remove(((at + j.eraserSize) % j.getSize())); } j.position = (j.position + 1) % j.getSize(); // fixed it by changing +1 to + j.plotStep } Thread.sleep(delay); } My custom series looks like: private class PulseXYSeries implements XYSeries { private List&lt;Integer&gt; pulseValues = new ArrayList&lt;Integer&gt;(); private int pulsePerMinute; public int pulsePosition; public int po…
has comment: http://stackoverflow.com/comment/41445747
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41445804

http://stackoverflow.com/comment/41394191
type: QuestionComment
comment on: http://stackoverflow.com/q/26368464
score: 0
has text: thanks Jarrod, I added that. Still not working when I enter a positive integer, however.
type: Comment

http://stackoverflow.com/q/26503877
has answer: http://stackoverflow.com/a/26521623
tagged with: wso2-identity-server
has title: WSO2IS with OpenID and Liferay
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26523749
tagged with: wso2
has comment: http://stackoverflow.com/comment/41647253
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: openid4java
has body: I followed the guide in the following link https://docs.wso2.com/display/IS500/WSO2+Identity+Server+as+an+OpenID+Provider I successfully added the certificate to the cacerts of Java but after restarting Liferay I got the same error from Liferay ("You have entered invalid data. Please try again") as when there was no certificate added. Note that I didn't deviate from the guide. I've even tried to connect with a simple openid4java application and I get the following exception: org.openid4java.discovery.yadis.YadisException: 0x704: I/O transport error: peer not authenticated which according to most cases is because of SSL problems with the Java certificates. Any ideas what might have gone wrong?

http://stackoverflow.com/q/26447360
downvote count: 0
has comment: http://stackoverflow.com/comment/48070501
has comment: http://stackoverflow.com/comment/41574056
favorite count: 0
has body: Consider a MVP-ish set of types. An abstract Presenter exists, with a View interface: public interface View { //... } public abstract class AbstractPresenter&lt;V extends View&gt; { @Inject V view; //... } Then, lets have a specific concrete presenter subclass, with its view interface and implementation: public interface LoginView extends View { //... } public LoginPresenter extends AbstractPresenter&lt;LoginView&gt; { //... } public class LoginViewImpl implements LoginView { //... } In a Dagger module, of course we would define a @Provides method: @Provides LoginView provideLoginView() { return new LoginViewImpl(); } In Guice you could write this the same way, or just bind(LoginView.class).to(LoginViewImpl.class). However, in Dagger (both v1 and the 2.0-SNAPSHOT from Google), this produces an error, since it can't figure out what V is when creating the binding wiring for AbstractPresenter&lt;V&gt;. On the other hand, Guice figures out that that because it is actually creating a LoginPresenter, so it needs an implementation of LoginView. Dagger 1.2.2: foo.bar.AbstractPresenter$$InjectAdapter.java:[21,31] cannot find symbol symbol: class V location: class foo.bar.AbstractPresenter$$InjectAdapter Dagger 2.0-SNAPSHOT: Caused by: java.lang.IllegalArgumentException: V at dagger.internal.codegen.writer.TypeNames$2.defaultAction(TypeNames.java:39) at dagger.internal.codegen.writer.TypeNames$2.defaultAction(TypeNames.java:36) at javax.lang.model.util.SimpleTypeVisitor6.visitTypeVariable(SimpleTypeVisitor6.java:179) at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1052) at dagger.internal.codegen.writer.TypeNames.forTypeMirror(TypeNames.java:36) at dagger.internal.codegen.MembersInjectorGenerator.write(MembersInjectorGenerator.java:142) at dagger.internal.codegen.MembersInjectorGenerator.write(MembersInjectorGenerator.java:61) at dagger.internal.codegen.SourceFileGenerator.generate(SourceFileGenerator.java:53) at dagger.internal.codegen.InjectBindingRegistry.generat…
has comment: http://stackoverflow.com/comment/48068657
has comment: http://stackoverflow.com/comment/48069940
type: UnansweredQuestion
has title: Generic @Inject'd fields in an abstract superclass
has answer: http://stackoverflow.com/a/32983667
tagged with: java
has comment: http://stackoverflow.com/comment/45731818
score: 23
has comment: http://stackoverflow.com/comment/45743813
has answer: http://stackoverflow.com/a/32996297
upvote count: 23
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/45713963
tagged with: dagger
has comment: http://stackoverflow.com/comment/45736394
answer count: 2
tagged with: guice
has comment: http://stackoverflow.com/comment/48078138

http://stackoverflow.com/comment/41516134
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26435609
type: Comment
has text: @ThomasNorman: OK, you're adding your MouseListener **inside** of the MouseListener, which won't work. Why not add it in your class's constructor or some other init or set up method? Also, your compiler will complain because your class that implements the MouseListener doesn't implement all the methods of the MouseListener interface, and that's not allowed (unless the class is abstract, which isn't what you want). So give it the rest of the MouseListener methods.

http://stackoverflow.com/a/26480523
downvote count: 1
answers question: http://stackoverflow.com/q/26480153
score: -1
type: Answer
has body: I had same requirement Docx4j worked for me.It has lot of helpers docx4j documentation
upvote count: 0

http://stackoverflow.com/a/26449146
type: Answer
has body: write your setOnClickListener code into the if condition if (convertView == null) { ..... ..... // write here your holder.tvComment.setOnClickListener convertView.setTag(holder); } and before this line: convertView.setTag(holder); Your full adapter would be something like this: import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.skyline.jimmy.widget.LikeToast; import com.skyline.jimmy.widget.MyToast; import android.annotation.SuppressLint; import android.app.ActionBar; import android.app.Activity; import android.content.ClipData; import android.content.Context; import android.content.Intent; import android.net.Uri; //import android.text.ClipboardManager; import android.content.ClipboardManager; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import android.widget.Toast; public class VoteListAdapter extends BaseAdapter { ViewHolder holder; protected static final String CLIPBOARD_SERVICE = null; private final String TAG = "*** VoteListAdapter ***"; private Context context; private ArrayList&lt;Vote&gt; votes; int showHideBtn = 0; public VoteListAdapter(Context context,List&lt;Vote&gt; voteList) { this.context =context; this.votes =(ArrayList&lt;Vote&gt;) voteList; } @Override public int getCount() { return votes.size(); } @Override public Object getItem(int position) { return votes.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(fin…
has comment: http://stackoverflow.com/comment/41541058
has comment: http://stackoverflow.com/comment/41540081
has comment: http://stackoverflow.com/comment/41540857
has comment: http://stackoverflow.com/comment/41540722
has comment: http://stackoverflow.com/comment/41540811
has comment: http://stackoverflow.com/comment/41540242
score: 0
answers question: http://stackoverflow.com/q/26449067
has comment: http://stackoverflow.com/comment/41540102
has comment: http://stackoverflow.com/comment/41541309

http://stackoverflow.com/a/26410080
has comment: http://stackoverflow.com/comment/41468554
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41468558
has comment: http://stackoverflow.com/comment/41468882
has comment: http://stackoverflow.com/comment/41468669
has comment: http://stackoverflow.com/comment/41468810
type: Answer
has comment: http://stackoverflow.com/comment/41468678
has body: concat takes one String argument, and appends it to the String instance it's called on. See the docs for the details. You can use the + operator to do this String concat5 = concat1+concat2+concat3+concat4; But be aware that this is a relatively expensive process, and if you're doing a lot of concatenation the StringBuilder class is the thing to use instead.
has comment: http://stackoverflow.com/comment/41468840
has comment: http://stackoverflow.com/comment/41468424
has comment: http://stackoverflow.com/comment/41468349
score: 2
has comment: http://stackoverflow.com/comment/41468715
downvote count: 0
has comment: http://stackoverflow.com/comment/41468803
accepted answer of: http://stackoverflow.com/q/26410003
answers question: http://stackoverflow.com/q/26410003
has comment: http://stackoverflow.com/comment/41468376
upvote count: 2

http://stackoverflow.com/a/26403284
upvote count: 1
has body: You can set the depth behaviour you want in the SearchControls object: current object, one level lower, or entire subtree.
answers question: http://stackoverflow.com/q/26402438
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/26510388
score: 0
has body: You don't need guava. Just do String#matches with a suitable regex. i..e str.matches("[1-9a-zA-Z.\\-_ ]*");
type: Answer
answers question: http://stackoverflow.com/q/26510255

http://stackoverflow.com/q/26394819
upvote count: 1
favorite count: 0
has title: Libgdx: Multiplexer does not continue to inputProcessor returns true?
downvote count: 0
answer count: 0
type: UnansweredQuestion
has body: I've been searching but can't seem to find the solution. I'm trying to implement a game where the player will press a button to create a new object/body. This object is suppose to be handled with a mousejoint and I want it object and mousejoint to depend if my mouse in pressed down or not. And the creation of the object should depend on of the button is pressed. I create my input processor like this: InputMultiplexer multiplexer = new InputMultiplexer(uiStage, this); Gdx.input.setInputProcessor(multiplexer); Then for the TextButton I add an InputListener. button.addListener(new InputListener() { public boolean touchDown(InputEvent event, float coordX, float coordY, int pointer, int button) { createPlank = true; System.out.println("button touchDown"); return false; } }); As I return false in the touchDown I think that the InputHandler (this) should be called. The problem is that it doesn't seam to get there. It is as if I would return true. Does anyone know how to solve this problem? What might be the problem that the next Inputprocessor does not get to handle the touch?
tagged with: libgdx
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/41505473
score: 0
comment on: http://stackoverflow.com/q/26430257
type: Comment
type: QuestionComment
has text: Well I am using the spring tool suite and I right clicked my project and did run as -> Spring boot app. This may not force a recompile but eclipse will almost always compile as changes are made directly? Anything I am missing?

cxf
tags question: http://stackoverflow.com/q/26387208
tags question: http://stackoverflow.com/q/26405460
tags question: http://stackoverflow.com/q/26508701
tags question: http://stackoverflow.com/q/26419938
type: Tag
tags question: http://stackoverflow.com/q/26354639
tags question: http://stackoverflow.com/q/26449214
tags question: http://stackoverflow.com/q/26462457
tags question: http://stackoverflow.com/q/26407397
tag name: cxf
tags question: http://stackoverflow.com/q/26432048
tags question: http://stackoverflow.com/q/26417126
tags question: http://stackoverflow.com/q/26403674
tags question: http://stackoverflow.com/q/26398477

http://stackoverflow.com/q/26425954
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41496839
upvote count: 2
has answer: http://stackoverflow.com/a/26426584
type: Question
has answer: http://stackoverflow.com/a/26426017
has body: Can someone explain why, when I input values, the output is increased by 9, for all the values stored in the array? int [] number; int numCounter,num; userInt validate = new userInt(); //set the number of array it can hold number = new int[100]; //set the counter to be equal to zero; numCounter = 0; validate.InputString("enter up to 100 positive integer;"); while(true){ validate.InputString("enter 0 to end"); num = validate.userInt(); //this will exist the loop statement if(num &lt;= 0) break; number[numCounter] = num; numCounter++; } //this will print the enter number from the array in reversed order for(int i = numCounter - 1; i &gt;= 0; i--) System.out.println(number[i] +'\t'); }
tagged with: java
has title: Output int from array in java increases the integer value
possible better answer: http://stackoverflow.com/a/26426017
answer count: 3
accepted answer: http://stackoverflow.com/a/26425994
has comment: http://stackoverflow.com/comment/41496834
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26425994

http://stackoverflow.com/comment/41676297
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26480223
has text: Does this imply that both modules are Maven-based? I'd like to avoid that.
score: 0

http://stackoverflow.com/a/26474254
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26474069
has body: You want to match an operator surrounded by something that is not an operator. An operator, in your definition : [!=&lt;>] Inversely, not an operator would be : [^!=&lt;>] Then try : [^!=&lt;&gt;]+([!=&lt;&gt;]+)[^!=&lt;&gt;]+
answers question: http://stackoverflow.com/q/26474069
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26396423
tagged with: java
has title: There is no Action mapped for namespace [/] and action name [login] associated with context path [/jilmt]
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/41449580
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41454423
tagged with: jboss5.x
answer count: 0
has body: I am getting this exception in jboss 5.1.0m but if I deploy it in jboss 5.0.0 it works fine. 10:02:28,379 WARN [ServletUrlRenderer] No configuration found for the specified action: 'login' in namespace: '/'. Form action defaulting to 'action' attribute's literal value. 10:02:28,406 WARN [ServletUrlRenderer] No configuration found for the specified action: 'feedBack' in namespace: '/'. Form action defaulting to 'action' attribute's literal value. 10:02:28,489 WARN [ServletUrlRenderer] No configuration found for the specified action: 'feedBack' in namespace: '/'. Form action defaulting to 'action' attribute's literal value. 10:02:45,644 WARN [Dispatcher] Could not find action or result There is no Action mapped for namespace [/] and action name [login] associated with context path [/eilmt]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58) struts.xml &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE struts SYSTEM "struts2.3.dtd"&gt; &lt;struts&gt; &lt;constant name="struts.multipart.saveDir" value="F:\fileU" /&gt; &lt;constant name="struts.action.excludePattern" value="/.*FileUploadServlet.*,/.*SendFileData.*" /&gt; &lt;constant name="struts.devMode" value="true" /&gt; &lt;constant name="struts.custom.i18n.resources" value="global" /&gt; &lt;!-- for understanding purpose only --&gt; &lt;package name="default" namespace="/" extends="struts-default"&gt;
type: Question
tagged with: struts-action
tagged with: action-mapping

http://stackoverflow.com/comment/41450159
score: 0
type: QuestionComment
type: Comment
has text: if(value >= 40 && value <= -30) will never true, use if(false) instead
comment on: http://stackoverflow.com/q/26399822

http://stackoverflow.com/comment/41621214
type: AnswerComment
type: Comment
has text: Other similar problem I have is that I have multiple classses A, B, C etc which dont have any commonalities but all of them have all methds which need to make call to in ClassZ.methodZ . Now how can we design this? as we cant use base class template method stuff
comment on: http://stackoverflow.com/a/26493286
score: 0

http://stackoverflow.com/q/26431144
tagged with: selenium
has answer: http://stackoverflow.com/a/26431242
accepted answer: http://stackoverflow.com/a/26431242
type: Question
has body: Here is what I normally write for finding an element with name =" email " WebElement emailInput = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By .name("email"))); What if there is an element modal body as seen below WebElement modalBody = enrollForm.findElement(By .className("modal-body")); Now, if I was to find a specific WebElement within another WebElement sorta like... WebElement a = driver.findElement(By.id("KeepSmiling"); WebElement b = a.findElement(By.className("ChocolatesMakeMeSizzle"); Here b is an element within a. Since there are many other div with className -> ChocolatesMakeMeSizzle I wish to do the same but with WebDriverWait. I avoid this issue using Thread.sleep(xx) but its a really bad method. Here is what I tried (but I realized that Im trying to slow down a webElement which makes no sense). WebElement emailInput = (new WebDriverWait(modalBody, 10)) .until(ExpectedConditions.presenceOfElementLocated(By .name("email"))); Any tips how to achieve this? Confessions: I honestly was avoiding this method and using Thread.sleep(xx). I am able to use the xpath and find the way but I am hoping for an answer to my question! :)
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41513568
has title: Selenium - Web Driver Wait
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41479969
type: Comment
has text: William Jones B2 42500 Susan Baker A3 65000 Horatio Caine A1 83768.95 Teddy Baer B4 53000 Allie Gator A2 48000 Sally Mander A1 62123.89 Amy Aspargus A1 100050 Henry Huckleberry B1 41234.5 Ryan Rutabaga B2 32987.2
score: 0
comment on: http://stackoverflow.com/q/26416179
type: QuestionComment

http://stackoverflow.com/q/26365002
type: Question
has answer: http://stackoverflow.com/a/31521152
has title: Solr: Scoring exact matches higher than partial matches
has body: In a very simple case, I have three documents with filenames "Lark", "Larker", and "Larking" (no file extension). In solr, I index these three documents mapping the filename to a "title" field. When I do a search for "Lark" all three documents are returned (which is what I want) but they are all given the same score. I would prefer that "Lark" be scored the highest, as it is an exact match to my query, with the others coming behind. <field name="title" type="text_general" indexed="true" stored="true" multiValued="false"/> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/> <tokenizer class="solr.StandardTokenizerFactory"/> <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" /> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class="solr.LowerCaseFilterFactory"/> I believe the reason they are getting the same score is because of the EdgeNGramFilterFactory employed at index time. Each document gets indexed as "La", "Lar", "Lark" with two of the documents ("Larker" and "Larking") being indexed with some additional variations. So in effect each document is an exact match for the query "Lark." I would like some way of executing a query where the term "Lark" would return all three documents but with the document titled "Lark" being returned higher than the others. Results of query debug: <lst name="debug"> Lark Lark text:lark text:lark <lst name="explain"> 2.7104912 = (MATCH) weight(text:lark in 0) [DefaultSimilarity], result of: 2.7104912 = fieldWeight in 0, product of: 1.4142135 = tf(freq=2.0), with freq of: 2.0 = termFreq=2.0 3.8332133 = idf(docFreq=3, maxDocs=68) 0.5 = fieldNorm(doc=0) 2.7104912 = (MATCH) weight(text:lark in 1) [DefaultSimilarity], result of: 2.7104912…
has answer: http://stackoverflow.com/a/26381537
accepted answer: http://stackoverflow.com/a/26381537
tagged with: lucene
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41393358
favorite count: 0
possible better answer: http://stackoverflow.com/a/31521152
upvote count: 8
tagged with: solrj
score: 8
has comment: http://stackoverflow.com/comment/41391459
type: AnsweredQuestion
tagged with: java
tagged with: solr

http://stackoverflow.com/comment/41521613
type: Comment
type: QuestionComment
has text: I have just started learning java web using servlets and jsp.I was writing a basic application in MVC.I want the logical code in one Servlet and the code which displays the content on the web page in another servlet
comment on: http://stackoverflow.com/q/26438761
score: 0

http://stackoverflow.com/comment/41581148
score: 0
type: Comment
has text: In your code is nothing that handles with an array. Please post all code related to your problem
type: QuestionComment
comment on: http://stackoverflow.com/q/26471813

http://stackoverflow.com/comment/41679889
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26483426
has text: Yes HamZa, There are differences in Java and Ruby regex.(In Ruby we write regexes by delimiting them with /, and in Java you need to double-escape everything (\\ instead of \) so that the backslashes get through to the regex engine) I would correct myself on the pattern compilation where I mean better visualisation of the regex verity for provided input. I was just being helpful, as I personally like rubular and usually tweak the irregularities accordingly.

http://stackoverflow.com/comment/41654015
type: AnswerComment
comment on: http://stackoverflow.com/a/26511148
has text: i think i may end up just doing this. it is the right way of going about this.
type: Comment
score: 0

http://stackoverflow.com/q/26496468
favorite count: 0
has title: Illegal start of expression in my ESP Game Methods
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26496515
tagged with: java
downvote count: 1
type: Question
tagged with: jgrasp
upvote count: 0
has body: The line public static String guessColor(Scanner keyboard) is where my errors are. The errors are as follows: illegal start of expression: at public, and at static. error: ';' expected: in between String and guessColor. error ';' expected: in between Scanner and keyboard. illegal start of expression: at ) in that line. public class RichardsonESPGame { public static void main(String[] args) { String random; String guess; Scanner keyboard = new Scanner(System.in); random = computerColor(); guess = guessColor(keyboard); String end = recordGame(random, guess); System.out.println(end); keyboard.close(); } /** In this method the color choices will be displayed. */ public static String computerColor() { Random rand = new Random(); int color = rand.nextInt(5) + 1; return receiveColor(color); } /** This method will give the computer and user its color options. */ public static String receiveColor(int color) { String selection; switch (color) { case 1: selection = "Red"; break; case 2: selection = "Blue"; break; case 3: selection = "Green"; break; case 4: selection = "Yellow"; break; case 5: selection = "Orange"; break; default: System.out.println("Make a valid selection."); selection = null; } return selection; /** This method will get the user's color choice. */ public static String guessColor(Scanner keyboard) { System.out.println("Enter a number from 1 to 5 to receive a color.\n 1 is Red\n 2 is Blue\n 3 is Green\n 4 is Yellow\n 5 is Orange\n"); int richardsonGuessColor = keyboard.nextInt(); String color = receiveColor(richardsonGuessColor); while (color == null) { System.out.println("Enter a number from 1 to 5 to receive a color.\n 1 is Red\n 2 is Blue\n 3 is Green\n 4 is Yellow\n 5 is Orange\n"); int guess = keyboard.nextInt(); color = receiveColor(richardsonGuessColor); } return color; } /** This method will determine if user guesses correctly. */ public static String recordGame(String richardsonComputerColor, String richardsonGuessColor) { String end; end = "The comput…
answer count: 1
accepted answer: http://stackoverflow.com/a/26496515
score: -1

http://stackoverflow.com/a/26368559
type: Answer
answers question: http://stackoverflow.com/q/26368464
has comment: http://stackoverflow.com/comment/41394308
downvote count: 0
has body: Your problem is the infinite loop caused by while (result &gt;= 0) { result = result / 2; binary = (result % 2) + binary; } Change your while (result &gt;= 0) to while (result &gt; 0) and test as your current code doesn't work (for example decimal 1 should return 1 instead of 0)
score: 3
has comment: http://stackoverflow.com/comment/41394251
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41394373
accepted answer of: http://stackoverflow.com/q/26368464

http://stackoverflow.com/a/26495447
has body: If the interface is: public interface Callback&lt;T&gt; { public void callback(T t); } Then the only way to implement it would be to produce a class which implements the callback method. Let's say that the type parameter were Boolean, then the override would be Callback&lt;Boolean&gt; callback = new Callback&lt;Boolean&gt;() { @Override public void callback(Boolean parameter) { // your code here } };
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26495341
answers question: http://stackoverflow.com/q/26495341
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41583904
has text: You're `return`ing from your function inside the first loop so any further execution is abandoned at that point.
type: Comment
comment on: http://stackoverflow.com/q/26473229
score: 0
type: QuestionComment

http://stackoverflow.com/a/26363885
answers question: http://stackoverflow.com/q/26363566
has comment: http://stackoverflow.com/comment/41389312
has body: That xpath looks overly complicated. It might be useful to think more simple. You can search by id, but if the id attribute is dynamically generated, you can always try searching it by 'linkText' : driver.findElement(By.linkText("Cadastro de cliente")).click();
type: Answer
score: 0

http://stackoverflow.com/a/26416309
has body: 1) You are asking the user to guess the number twice before you enter the while loop. Since numGuesses is set to 1 and added by 1 on entering the while loop, you'll be off by one (you're asking the user to guess the number for the third time in the while loop). 2) Since you are printing your 'cheater'-code after you are prompting the user to guess the number it will only appear after that guess. Please note that Random().nextInt(11) includes 0 as well, so you might want to initialize guess to -1 as in the example below: int randomNum = new Random().nextInt(11); //Define random number between 0 (inclusive) and 10 (inclusive) int guess = -1; int numGuesses = 0; out.println(randomNum); //Cheater while (guess != randomNum) { guess = Integer.parseInt(JOptionPane.showInputDialog("Guess a number from 0-10: ")); numGuesses++; //To increase the value of numGuesses by 1 each time the while loop iterates } JOptionPane.showMessageDialog(null, "You got it right after only " + numGuesses + " tries!"); out.println(numGuesses); //To see if it matches the JOptionPane value
answers question: http://stackoverflow.com/q/26415993
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26415993

http://stackoverflow.com/comment/41572716
comment on: http://stackoverflow.com/q/26467090
type: QuestionComment
score: 0
has text: The line that gives me the error is the Image declaration. Also, what is that directory? I do not have that.
type: Comment

http://stackoverflow.com/comment/41565816
has text: Thanks for the link to the specs, I somehow forgot that it exists and was mainly going through various tutorials. But in Java it seems it doesn't work exactly that way, calling `MultiplierPOA._this()` on the newly created instance throws an exception `org.omg.CORBA.BAD_INV_ORDER: The Servant has not been associated with an ORB instance`
type: Comment
comment on: http://stackoverflow.com/a/26445615
score: 1
type: AnswerComment

http://stackoverflow.com/q/26505953
has comment: http://stackoverflow.com/comment/41832106
has comment: http://stackoverflow.com/comment/41642668
has comment: http://stackoverflow.com/comment/41832487
downvote count: 3
has comment: http://stackoverflow.com/comment/41643058
upvote count: 1
tagged with: collections
linked to: http://stackoverflow.com/q/5852863
has comment: http://stackoverflow.com/comment/41642936
has comment: http://stackoverflow.com/comment/41644021
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26506309
tagged with: list
duplicate of: http://stackoverflow.com/q/5852863
tagged with: java
linked to: http://stackoverflow.com/q/11582445
type: Question
score: -2
has comment: http://stackoverflow.com/comment/41642910
answer count: 1
has comment: http://stackoverflow.com/comment/41642818
has comment: http://stackoverflow.com/comment/41643035
accepted answer: http://stackoverflow.com/a/26506309
favorite count: 0
tagged with: arraylist
has title: Java ArrayList collection to hold latest 5 additions
has comment: http://stackoverflow.com/comment/41642666
has comment: http://stackoverflow.com/comment/41642661
has body: I have an extra ordinary requirement of having a Java object array list (or list initialized as an ArrayList) which will be continuously updated and is supposed to hold only the latest 5 items with the objects to be sorted in a descending order of they were added. How could this be accomplished? I need to come up with a solution within Java SE 7 preferably using no 3rd party library. NOTE For those who mark this question as a duplicate, you do not seem to understand the requirement of using ArrayList for this case and that Queues and ArrayLists are different object types as well as Java and C# are different languages. Do you think Stackoverflow's internal search engine is not as good as you are in locating the duplicate questions? When marking a question as "duplicate", make sure you link a true duplicate, please.

http://stackoverflow.com/q/26437115
has title: Android studio unable to create new project : IllegalArgumentException
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27703439
tagged with: java
type: Question
answer count: 1
score: 0
upvote count: 1
has body: I have Java Version 8 Update 25, and Android Studio 0.8.6 I am trying to create a new project and it fails saying : 12:20:00 PM IllegalArgumentException: Argument 0 for @NotNull parameter of com/intellij/openapi/vfs/VfsUtilCore.virtualToIoFile must not be null: Argument 0 for @NotNull parameter of com/intellij/openapi/vfs/VfsUtilCore.virtualToIoFile must not be null Can someone please help me out with this?
downvote count: 1
favorite count: 0
tagged with: android-studio

http://stackoverflow.com/comment/41563410
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26462303
has text: @Cold [this](http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java) might help you.

http://stackoverflow.com/a/26478482
has comment: http://stackoverflow.com/comment/41593892
has body: Recursive version: public static boolean isEqual(ArrayList&lt;O&gt; arrlist1, ArrayList&lt;O&gt; arrlist2, int n) { if (arrlist1.size() == n &amp;&amp; arrlist1.size() == arrlist2.size()) { return true; } else { if (arrlist1.get(n).equals(arrlist2.get(n))) { return isEqual(arrlist1, arrlist2, n + 1); } else { return false; } } } and it should be called like this: isEqual(arrlist1, arrlist2, 0);
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41593928
has comment: http://stackoverflow.com/comment/41594010
answers question: http://stackoverflow.com/q/26478385
has comment: http://stackoverflow.com/comment/41593989
upvote count: 1
has comment: http://stackoverflow.com/comment/41593907

http://stackoverflow.com/q/26491666
type: AnsweredQuestion
has title: Vowpal Wabbit execute without writing to disk
tagged with: vowpalwabbit
tagged with: java
has body: I wrote a java code to execute Vowpal Wabbit in the following way: System.out.println("Executing command " + command); final Runtime r = Runtime.getRuntime(); final Process p = r.exec(command); System.out.println("waiting for the process"); try (final BufferedReader b = new BufferedReader(new InputStreamReader(p.getInputStream()))) { String line; while ((line = b.readLine()) != null) { final T lineResult = textParser.parseLine(line); parserResultCombiner.addToCombiner(lineResult); } } p.waitFor(); System.out.println("done"); } where the command is vw -d input.txt --loss_function=logistic -f model.vw The disadvantage of this is that it requires writing to disk. After some searching, I learned that vowpal wabbit supports reading data from standard input example in R I could not find any example to accomplish this in Java 1.8. Could anyone share one with me?
type: Question
has comment: http://stackoverflow.com/comment/41687111
has comment: http://stackoverflow.com/comment/41617309
answer count: 1
accepted answer: http://stackoverflow.com/a/32124760
score: 0
has answer: http://stackoverflow.com/a/32124760
linked to: http://stackoverflow.com/q/10407308
tagged with: java-8
linked to: http://stackoverflow.com/q/3643939

http://stackoverflow.com/comment/41399874
type: QuestionComment
type: Comment
has text: What types could represent?
comment on: http://stackoverflow.com/q/26371418
score: 0

http://stackoverflow.com/q/26441826
type: AnsweredQuestion
tagged with: return-value
tagged with: java
has title: How to print return values from a boolean?
type: Question
has comment: http://stackoverflow.com/comment/41529522
has comment: http://stackoverflow.com/comment/41528330
tagged with: boolean
score: 0
has answer: http://stackoverflow.com/a/26443355
has comment: http://stackoverflow.com/comment/41527196
answer count: 1
has comment: http://stackoverflow.com/comment/41548981
has comment: http://stackoverflow.com/comment/41526773
favorite count: 0
has body: I am trying to print the value return value from a boolean, to check that the if statements are working correctly. I get no errors but nothing shows in the console. Any advice is appreciated. Also if it makes a difference the code is not part of the main class. If it does, is there a way of printing the return value of the boolean from the main? Here is what I have tried. public boolean inCollision(double x, double y, furniture f) { if (x + radius &lt;= f.getXpos(0) || x + radius &gt; f.getXpos(2)) { System.out.println("False"); return false; } if (y + radius &lt; f.getYpos(0) || y + radius &gt; f.getYpos(2)) { System.out.println("False"); return false; } System.out.println("True"); return true; } This is where furniture comes from public class furniture { private String name; private double xpos; private double ypos; private double width; private double height; public furniture (String n, double x, double y, double w, double h) { name = n; xpos = x; ypos = y; width = w; height = h; } public double getXpos(int c){ if (c==0 || c==1){return xpos;} else {return xpos+width;} } public double getYpos(int c){ if (c == 0 || c == 1){return ypos;} else {return ypos+width;} } public String toString() { return "the "+ name+ " has a height of "+height+" and a width of "+width+". Its coordinates are ("+xpos+","+ypos+")," ; } } Below is the whole page of code for the first part. public class roomba { private double xpos; private double ypos; private double radius; public roomba(double x, double y, double r){ xpos = x; ypos = y; radius = r; } public String toString() { return "the coordinates of the roomba are ("+xpos+","+ypos+").It has a radius of "+radius ; } public boolean inCollision(double x, double y, furniture f){ if (x+radius &lt;=f.getXpos(0) || x+radius &gt;f.getXpos(2)){ System.out.println("False"); return false; } if (y+radius &lt; f.getYpos(0) || y+radius &gt; f.getYpos(2)) { System.out.println("False"); return false;} System.out.println("True"); return true; }
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/41527071
accepted answer: http://stackoverflow.com/a/26443355

http://stackoverflow.com/a/26354733
has body: I'd say when you want to know exactly what went wrong. If it's your own custom exception, you know there's no other possible causes for it, as opposed to something generic or already-existing, which could have been thrown by an unrelated problem.
score: 0
answers question: http://stackoverflow.com/q/26354581
type: Answer

http://stackoverflow.com/comment/41464958
comment on: http://stackoverflow.com/a/26407838
score: 0
type: AnswerComment
has text: @PratanuMandal, what I don't think you realise is ***nothing on a PC is undeleteable*** - nor 100% secure.
type: Comment

http://stackoverflow.com/q/26480377
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/26523673
accepted answer: http://stackoverflow.com/a/26523673
has comment: http://stackoverflow.com/comment/41673589
favorite count: 0
tagged with: google-app-engine
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41656217
type: Question
has body: I have a simple web app that lets users upload a CSV to GAE blob storage. I am trying to pass that data to a google analytics API method but I cannot work out how. Following the tutorial doc, I only seem to be able to return the file in the response header. Is there a way to pass the blob directly to the method as a file? Alternatively is there a way to upload a blob and then map the data to Cloud Storage?
has comment: http://stackoverflow.com/comment/41673543
tagged with: google-cloud-storage
tagged with: blobstore
has comment: http://stackoverflow.com/comment/41673523
has title: How do I access CSV data from Google App Engine?
upvote count: 1

http://stackoverflow.com/comment/42545433
has text: I added the code in the thread which is changing the state of the button after sleeping for some time in a synchronized block. Also made the action performed to synchronize on the button so that the problem of RACE wont occur. Hope this help anyone.
type: Comment
comment on: http://stackoverflow.com/a/26456014
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41611821
has text: You can probably work out a set of punctuation characters that are ok between words, and another set that isn't, then define your regular expression based on that.
comment on: http://stackoverflow.com/q/26488854
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41547031
comment on: http://stackoverflow.com/a/26453012
score: 0
type: AnswerComment
has text: you mean like this? `s.useDelimiter("\\s|(?=[\\s=]+)|(?<=\\p{Punct})|(?=\\p{Punct})");` ? I want to be able to keep what I did here.
type: Comment

http://stackoverflow.com/q/26486258
type: Question
has answer: http://stackoverflow.com/a/26486615
has comment: http://stackoverflow.com/comment/41607437
tagged with: thread-sleep
upvote count: 1
answer count: 1
has body: I want to display a status msg that updates dynamically as and when different stages of processing is reached on the processing triggered on clicking a button. Could you pls help on this. Here is the code that I used, but is not working. It always shows the status msg at the end of the function and not intermediate status msgs while executing. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.*; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.*; import java.net.*; import java.io.*; public class MainApplet extends JApplet { JButton gstbtn = new JButton("Connect to Gst Hotspot"); JButton wifibtn = new JButton("Connect to existing Wifi networks"); JLabel status = new JLabel(); JPanel toppanel = null, nwConfigDialog = null; final JFrame f= new JFrame(); JTextField ssidTxt; JPasswordField pwdTxt; JOptionPane opt; public void init() { gstbtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Gst Hotspot connect workflow triggered"); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); status.setText(""); toppanel.repaint(); if(connectToHotSpot()) { //todo: Connect to gst hotspot try { status.setText("connected to Local Gst Box Wifi Hotspot"); status.repaint(); Thread.sleep(20*1000); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch(Exception ex) { System.err.println("connect to hotspot: Sleep Exception: " + ex.getMessage()); } //showNwConfigDialog(f); } else { status.setText("Unable to connect to Local Gst Box Wifi Hotspot"); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); wifibtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Wifi n/w connect workflow triggered"); } }); toppanel = new JPanel(new GridLayout(4,4,4,4)); gstbtn.setPreferredSize(new Dimension(5,5)); wifibtn.setPreferredSize(new Dimension(5,5)); setContentPane(toppanel); getContentPane(…
favorite count: 0
tagged with: jlabel
tagged with: event-dispatch-thread
tagged with: swing
has title: Dynamically updating JLabel to display a changing status msg for processing done on clicking a button
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26486615
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26383131
tagged with: camunda
tagged with: business-process-management
has body: I have a Call Activity, which is used in different lanes of my BPMN diagram. There is a task inside the Call Activity. Is it possible to determine the Lane of the Call Activity from the Task? It looks something like this in the pictures here: I want to determine "MyLane1" respectively "MyLane2" from inside the Task "Get parent Lane".
has answer: http://stackoverflow.com/a/26408828
type: AnsweredQuestion
score: 3
has title: How to determine the lane of a call activity?
tagged with: java
tagged with: bpmn
has answer: http://stackoverflow.com/a/26384480
accepted answer: http://stackoverflow.com/a/26384480
type: Question
answer count: 2
downvote count: 0
upvote count: 3
possible better answer: http://stackoverflow.com/a/26408828
favorite count: 0

http://stackoverflow.com/q/26400627
has comment: http://stackoverflow.com/comment/41454258
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41451663
favorite count: 0
has answer: http://stackoverflow.com/a/26462191
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/41451616
upvote count: 2
has comment: http://stackoverflow.com/comment/41455011
tagged with: java
tagged with: swing
type: Question
has body: I want to add only vertical scrollbar for my panel. I can do it succesfully but in horizontal view there is no dots appearing for long texts. I want to see both vertical scrollbar and three dot for long texts that doesn't fit the screen. How can I do it? By the way If I add my panel directly to the frame dots appearing. with scrollpane when adding panel directly to the frame public class ScrollPaneDemo { public static void main(String[] args) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); for (int i = 0; i &lt; 25; i++) { panel.add(createLabel()); } JScrollPane scrollPane = new JScrollPane(panel); scrollPane .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JFrame frame = new JFrame(); frame.getContentPane().add(scrollPane); frame.setSize(300, 300); frame.setVisible(true); } public static JLabel createLabel() { return new JLabel( "Long Text, Long Text, Long Text, Long Text, Long Text, Long Text, Long Text, Long Text, Long Text"); } }
has title: JScrollPane show only vertical bar and three dot for horizontal
accepted answer: http://stackoverflow.com/a/26462191
has comment: http://stackoverflow.com/comment/41562100

http://stackoverflow.com/a/26477929
upvote count: 2
type: AcceptedAnswer
has body: You can't implement both interfaces unless the methods differ in parameter types (or method name) when they return different types. From JLS-8.1.5, a class cannot have multiple methods with the same signature and different primitive return types (§8.4).
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26477886
accepted answer of: http://stackoverflow.com/q/26477886

http://stackoverflow.com/q/26407874
linked to: http://stackoverflow.com/q/12338763
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26408014
has comment: http://stackoverflow.com/comment/41467739
has comment: http://stackoverflow.com/comment/41464439
linked to: http://stackoverflow.com/q/330331
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/41468175
has comment: http://stackoverflow.com/comment/41464444
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26409910
possible better answer: http://stackoverflow.com/a/26408266
has answer: http://stackoverflow.com/a/26408266
type: Question
has comment: http://stackoverflow.com/comment/41464566
tagged with: java
has answer: http://stackoverflow.com/a/26408014
tagged with: javascript
has body: My servlet is giving me a CSV file with chars like 'é', 'á' or 'õ'. When I open the servlet via browser, it works fine. But when the information get to my page, it's all �. I tried changing the coding in the actual database, but it didn't work. console.log(csv), where csv is the information from the servlet, and it's also full of '�'s. I'm not even sure where the problem is, because the actual page has several latin characters which are presented properly. I'm using Microsoft SQL '08, tried both nvarchar and varchar fields.
tagged with: servlets
has title: How can I fix the '�' symbols on my page? It seems to be something happening between the servlet and the Javascript.

http://stackoverflow.com/comment/41593205
score: 0
type: Comment
type: QuestionComment
has text: How variable is the prefix string? Could there be nested quotes? For simple cases, see [String.lastIndexOf](http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#lastIndexOf(int)), for instance.
comment on: http://stackoverflow.com/q/26478161

colors
tags question: http://stackoverflow.com/q/26474963
tags question: http://stackoverflow.com/q/26478533
tags question: http://stackoverflow.com/q/26434449
tag name: colors
tags question: http://stackoverflow.com/q/26373007
type: Tag

http://stackoverflow.com/comment/72891153
type: Comment
type: QuestionComment
has text: Never close the client! Let it handle all the connections for you. Yes, it keeps a pool of connections open, along with several thread pools, caches and data structures to be aware of the current topology of the cluster.
score: 1
comment on: http://stackoverflow.com/q/26354650

http://stackoverflow.com/comment/41500434
comment on: http://stackoverflow.com/q/26427659
type: Comment
has text: do you really have to roll your own [contains](http://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html#contains%28java.lang.Object%29) method like that?
score: 0
type: QuestionComment

http://stackoverflow.com/a/26482508
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26477445
type: Answer
answers question: http://stackoverflow.com/q/26477445
has body: public IList&lt;Integer, Term&gt; add(IList&lt;Integer, Term&gt; p1, IList&lt;Integer, Term&gt; p2) { IList&lt;Integer, Term&gt; addList = new LList&lt;Integer, Term&gt;(); if (p1 == null || p2 == null) { return addList; } if(p1.getSize() &gt;= p2.getSize() || p2.getSize() &lt;= p1.getSize()){ ... } ... }

http://stackoverflow.com/q/26455936
tagged with: java
possible better answer: http://stackoverflow.com/a/26456083
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26456083
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26455954
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/26455954
tagged with: spring
has title: Properties and env always null
type: AnsweredQuestion
has body: I have a hard time loading properties from my properties file. I'm trying to load a property into my configuration class which is listed below. package dk.fitfit.budget.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.Environment; @Configuration @PropertySource("classpath:application.properties") public class ApplicationConfig { private static final Logger logger = LoggerFactory.getLogger(ApplicationConfig.class); @Autowired private Environment env; @Value("${snot:test}") private String snot; public ApplicationConfig() { logger.info("Application config loaded!"); // Displays as expected logger.info("snot: {}", snot); // snot: null logger.info("env: {}", env); // env: null } @Bean public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { return new PropertySourcesPlaceholderConfigurer(); } } If I change the name of the file (application.properties) or "@PropertySource("classpath:application.properties")" I get an error about the file not being present. So clearly it's being loaded (to some extend anyway). I was at least expecting to see the default string "test" injected into the variable snot. But not even that is done. I'm not able to autowire Environment either... not sure if there is a relation. The content of my application.properties is as below. snot=snog My application.properties file is placed in src/main/resources/. Anyone got a clue about what I'm doing wrong?

http://stackoverflow.com/a/26415851
answers question: http://stackoverflow.com/q/26415732
has comment: http://stackoverflow.com/comment/41479162
score: -2
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41479171
has comment: http://stackoverflow.com/comment/41479201
downvote count: 2
has body: Since it's a LinkedList, you won't be able to find out its size until after the first (and only) pass. To find the middle element, you need to know two things; what index is at the middle, and what is the value of the element at that index. Finding the middle index is easy--just make one pass through the list, keeping a counter of how many nodes there are. As you do this, you'll need to keep track of each element in a separate data structure, perhaps an ArrayList, since you're only allowed one pass through the LinkedList. Once you're done, half the counter to find the middle index, and return the ArrayList element at that index. The pseudo code looks like this: int count ArrayList elements for each node in LinkedList: count++ elements.append(node) middleIndex = count/2 middleElement = elements.getIndex(middleIndex) return middleElement Of course, you'll need to take care of the case where there isn't a single middle element.

http://stackoverflow.com/a/26479741
type: Answer
has comment: http://stackoverflow.com/comment/41621582
has comment: http://stackoverflow.com/comment/41597231
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26479612
downvote count: 0
has body: Since you said: ...at no less than 4-5 different places... and you really don't want to do major code changes, I would: Supply the password in an encrypted form. Go through those 4-5 places (it's not so much!), and call a wrapper method that you have to write separately: MyPassUtil.getXYZPassword() which internally calls the System.getProperty() to get the encrypted password, decrypt it, and return the plain text version to whoever is calling it. Keep in mind though, that this way, the decryption key and algorithm is stored within the application, and a good Java decompiler (JD-GUI or CFR) will still return this information. In other words, anyone with the access to the JAR file, can still get the information with some minor effort, something which I presume, since one can call jinfo, they can also get the JAR file. The best is to use some form of keystore, which again, you can easily implement once you do the wrapper method mentioned in step 2, without affecting whoever is using it. Also, some security tips: If it's an SSH / SFTP connection, set up SSH keys between the two machines, and eliminate use of passwords. If it's a database connection, at least configure the DBMS to allow connections only from this particular machine's IP address. If the connection is over the internet and you are behind an NAT, set-up a VPN first, and channel the traffic between the hosts through it. For other setups, try and see whether there are some other tips you can do similar to these two points, to improve the security around these passwords.

http://stackoverflow.com/q/26500845
has comment: http://stackoverflow.com/comment/41633755
has comment: http://stackoverflow.com/comment/41633774
has comment: http://stackoverflow.com/comment/41633811
has answer: http://stackoverflow.com/a/26500974
answer count: 2
has comment: http://stackoverflow.com/comment/41636106
has comment: http://stackoverflow.com/comment/41633851
has answer: http://stackoverflow.com/a/26500942
possible better answer: http://stackoverflow.com/a/26500942
has title: Trouble with creating Battleship using Java
has comment: http://stackoverflow.com/comment/41633742
accepted answer: http://stackoverflow.com/a/26500974
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41634127
has body: The following block of code is supposed to check if the coordinates that the user entered are the coordinates of the ship. The ship is located on a two dimensional array at (1,1) and (1,2). The problem started when I surrounded the getUserGuess method implementation with a while loop. The loop checks if the ship is still alive and will keep asking for the user to enter coordinates until the ship is sunk. However, as soon as the user enters either pair of the correct coordinates, the entire ship is sunk. I have no idea why this keeps happening. As soon as I comment out the loop, the problem stops, but the loop is necessary. Here is the method: public void checkResult(String userGuess) { while (frigateIsAlive == true) { if (userGuess.equalsIgnoreCase(board[1][1])){ System.out.println("hit!"); numOfHitsOnFrigate++; board[1][1] = " *"; createBoard(); } if (userGuess.equalsIgnoreCase(board[1][2])) { System.out.println("hit!"); numOfHitsOnFrigate++; board[1][2] = " *"; createBoard(); } else if (numOfHitsOnFrigate == 2) { System.out.println("Enemy frigate has been sunk!"); frigateIsAlive = false; break; } else { System.out.println("miss!"); // try again } } } public String getUserGuess() { // takes the users guess System.out.println("Choose a coordinate on the board to fire at"); int x = input.nextInt(); int y = input.nextInt(); String userGuess = board[x][y]; return userGuess; } Let me know if you need to see any other part of the code in order to better assist me.
has comment: http://stackoverflow.com/comment/41633821
type: Question

http://stackoverflow.com/a/27960687
score: 2
has body: I had the same problem and it was resolved by editing /etc/hosts and providing an IP address of the machine hostname vi /etc/hosts 127.0.0.1 localhost template 127.0.0.1 &lt;name of the machine&gt;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26361205
upvote count: 2

http://stackoverflow.com/q/26391986
has title: Leave space according to display width of text in a particular font in
answer count: 0
score: 1
tagged with: java
has body: I have created an app that reads all lines from a text file and writes that text using a ttf font on a BufferedImage. Here, the BufferedImage is just an image of an empty ruled page from a notebook. And I am trying to read contents from the file and write it on the BufferedImage(i.e, the paper's image). I am able to do it. But I am having some problems like some words are getting overlapped. This is my code so far to write to the BufferedImage. private void printText() { x = leftSpacing; // leftSpacing - The amount of space to be left blank from the left side(i.e, to leave the area of the paper where we write the question number and answer number). y = upSpacing; // upSpacing - The amount of space to be left blank from the top of the paper(i.e, to leave the part of the paper where we write the date and page number). /* words - ArrayList&lt;ArrayList&lt;String&gt;&gt;, in which each array list contains each line of the file. like words(1) contains all words of first line, words(2) contains words of second line, and so on. */ for(ArrayList&lt;String&gt; listOfWords : words) { // Iterate through each sentence for(String word : listOfWords) { // Iterate through each word of the sentence textContainer = font.getStringBounds(word+" ", context); // Get bounds of the word along with a space in the form of java.awt.Rectangle2D x += textContainer.getWidth(); // Add width of the word to the X co-ordinate. // Test if X has become greater than imageWidth - space left from left side. if(x &gt; imageWidth - leftSpace) { x = leftSpacing; // Set X back to 0 y += lineSpacing; // And move Y to next line. lineSpacing - Anount of gap to be left between printing each line. } if(y &gt; imageHeight) { // If Y is more than imageHeight return; // Simply quit printing and return } graphics.drawString(word+" ", x, y); // Draw word at X, Y } } } Any help will be appreciated. Thanks in advanced.
upvote count: 1
tagged with: bufferedimage
type: Question
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41561647
score: 0
type: Comment
has text: +1, nice first question
type: QuestionComment
comment on: http://stackoverflow.com/q/26456325

http://stackoverflow.com/a/26639174
type: Answer
answers question: http://stackoverflow.com/q/26471913
upvote count: 2
score: 2
has body: You can go to Window, Reset Perspective which will give you your shared area back, although also obviously reset any other views you may have.
has comment: http://stackoverflow.com/comment/42800860
downvote count: 0

http://stackoverflow.com/a/26410268
type: Answer
has body: Container.remove(panel) This is what you're looking for Also, tempBoard doesnt seem to do anything.
score: 0
answers question: http://stackoverflow.com/q/26408686

http://stackoverflow.com/q/26482147
has comment: http://stackoverflow.com/comment/41600517
favorite count: 0
has comment: http://stackoverflow.com/comment/41600393
score: -1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26482686
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/41599882
type: Question
tagged with: blowfish
upvote count: 0
has comment: http://stackoverflow.com/comment/41600192
has comment: http://stackoverflow.com/comment/41600317
has body: Hi all sorry if I make you confused in my prev question, I want know about how implement Blowfish algorithm in java for encrypted and decrypt file ? import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import javax.swing.JFormattedTextField; import java.io.ObjectOutputStream; import java.security.Key; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.KeyGenerator; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.WindowConstants; public class aa extends javax.swing.JFrame { private JButton jButton1; private JButton jButton2; private JLabel jLabel2; private JLabel jLabel3; private JButton jButton3; private JPasswordField jPasswordField1; private JLabel jLabel1; private JTextField jTextField1; private JTextField jTextField3; /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { aa inst = new aa(); inst.setVisible(true); } public aa() { super(); initGUI(); } private void initGUI() { try { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.getContentPane().setLayout(null); this.setTitle("Program Enkripsi Dekripsi"); { jButton1 = new JButton(); this.getContentPane().add(jButton1); jButton1.setText("Enkripsi"); jButton1.setBounds(70, 88, 58, 24); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { //TODO add your code for jButton10.actionPerformed saveFile(); } }); } { jTextField1 = new JTextField(); this.getContentPane().add(jTextField1); jTextField1.setBounds(71, 17, 141, 19); } { jLabel1 = new JLabel(); this.getContentPane().add(jLabel1); jLabel1.setText("Input"); jLabel1.setBounds(8, 1…
has title: Implement Blowfish algorithm in Java for encrypt and decrypt file
has comment: http://stackoverflow.com/comment/41600225
has answer: http://stackoverflow.com/a/26482686
answer count: 1
tagged with: cryptography

http://stackoverflow.com/q/26490079
tagged with: windows
type: AnsweredQuestion
tagged with: netbeans
has body: path - C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin catalina_home - C:\Program Files\Apache Software Foundation\Tomcat 7.0\ server setting in netbeans https://i.sstatic.net/2mFDn.png (the system wont let me post images) when i hit run button tomcat throws an error: 127.0.0.1 command is not recognized as an internal or external operable program or batch file. (using windows 7 64bit)
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41619579
type: Question
has answer: http://stackoverflow.com/a/26496222
has title: cannot run tomcat 7 from netbeans
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41615882
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/26485487
favorite count: 0
accepted answer: http://stackoverflow.com/a/26496222

palindrome
tags question: http://stackoverflow.com/q/26386605
tag name: palindrome
type: Tag
tags question: http://stackoverflow.com/q/26467789

http://stackoverflow.com/q/26422320
tagged with: spring
has comment: http://stackoverflow.com/comment/41493906
type: Question
type: AnsweredQuestion
has body: there are 2 entities in my application - User and Role. I would like to set up a unidirectional ManyToMany relationship. My entities: Role: @Entity @Table(name = "roles") public class RoleEntity extends BaseEntity { @Column(nullable = false, unique = true) private String name; //Getters and Setters } User: @Entity @Table(name = "users") public class UserEntity extends BaseEntity { @Column(nullable = false, unique = true) private String username; @Column(nullable = false, unique = false) private String password; @Column(nullable = false, unique = false) private String firstName; @Column(nullable = false, unique = false) private String lastName; @ManyToMany(fetch = FetchType.EAGER) @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "role_id"), inverseJoinColumns = @JoinColumn(name = "user_id")) private Set&lt;RoleEntity&gt; roles = new HashSet&lt;RoleEntity&gt;(); //Getters and Setters } The problem appears when trying to create a new User that has a Role. I am creating a User like that: //Role RoleEntity adminRole = new RoleEntity(); adminRole.setName("ROLE_ADMIN"); roleService.createRole(adminRole); //User UserEntity admin = new UserEntity("admin", "admin", "adminFirstName", "adminLastName"); RoleEntity role_admin = roleService.loadRoleByRoleName("ROLE_ADMIN"); admin.getRoles().add(role_admin); userService.persistUser(admin); Strangely, the right database entries are getting created even though I am receiving an Exception when JPA tries to write to the joined Table. Stack trace: 17-10-2014 11:42:51 DEBUG SQL:104 - insert into users (firstName, lastName, password, username) values (?, ?, ?, ?) 17-10-2014 11:42:51 DEBUG IdentifierGeneratorHelper:93 - Natively generated identity: 1 17-10-2014 11:42:51 DEBUG AbstractTransactionImpl:173 - committing 17-10-2014 11:42:51 DEBUG AbstractFlushingEventListener:147 - Processing flush-time cascades 17-10-2014 11:42:51 DEBUG AbstractFlushingEventListener:188 - Dirty checking collections 17-10-2014 11:42:51 DEBUG Co…
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/41490633
has answer: http://stackoverflow.com/a/26502672
answer count: 1
tagged with: jpa
downvote count: 0
has title: JPA closes connection before creating JoinTable statement
has comment: http://stackoverflow.com/comment/41491196
favorite count: 0
accepted answer: http://stackoverflow.com/a/26502672
upvote count: 1

http://stackoverflow.com/a/26404927
type: Answer
downvote count: 0
score: 1
has body: You can use this method. It will not allow you to change the collection size (no add()/remove() operations). List&lt;&gt; unmodiffableList = Collections.unmodifiableList(oListeRet);
answers question: http://stackoverflow.com/q/26404859
upvote count: 1

http://stackoverflow.com/a/26421778
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26421548
score: 1
upvote count: 1
has body: When you call makeListView the JList is null as it hasn't been initialized yet...thus, you are basically saying scroll = new JScrollPane(null);...which isn't particularly helpful... Next, when you call updateListView, you create a new instance of the JList and JScrollPane and do nothing with them... private void updateListView(DefaultListModel listModel) { list = new JList(listModel); scroll = new JScrollPane(list); } so they will never be displayed on the screen... To rectify this, you will need to make some modifications... Create an instance of the JList and assign it to the instance field list, before you create the JScrollPane Instead of creating new instances of the list and scroll, simply use JList#setModel You may also like to have a look at Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? With JList, you affect the size of the JScrollPane through the use of JList#setVisibleRowCount and JList#setPrototypeCellValue

http://stackoverflow.com/a/28620110
upvote count: 9
score: 9
downvote count: 0
has body: To mock the static private method: @Mocked({"mockMethod"}) MyClass myClass; String result; @Before public void init() { new Expectations(myClass) { { invoke(MyClass.class, "mockMethod", anyString); returns(result); } } } @Test public void testMethodToTest() { result = "true"; // Replace result with what you want to test... assertTrue( ( MyClass.methodToTest() ); } From JavaDoc: Object mockit.Invocations.invoke(Class methodOwner, String methodName, Object... methodArgs) Specifies an expected invocation to a given static method, with a given list of arguments.
type: Answer
answers question: http://stackoverflow.com/q/26408253
has comment: http://stackoverflow.com/comment/95877795

http://stackoverflow.com/a/26467066
type: Answer
has comment: http://stackoverflow.com/comment/41571906
answers question: http://stackoverflow.com/q/26467038
has body: Unless you have specific requirements, stick to the standard.
accepted answer of: http://stackoverflow.com/q/26467038
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41572143
score: 0

http://stackoverflow.com/q/26455711
has comment: http://stackoverflow.com/comment/41552265
tagged with: static
has comment: http://stackoverflow.com/comment/41553392
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41552457
has comment: http://stackoverflow.com/comment/41552368
has title: How do I work-around Java's block on static method extension?
tagged with: java
has comment: http://stackoverflow.com/comment/41552045
tagged with: methods
tagged with: extend
type: Question
has comment: http://stackoverflow.com/comment/41552062
has answer: http://stackoverflow.com/a/26474532
has body: I'm building a parser for a compiler, and what I would like to have a class (static) method for each term the parser finds. This method should return a regular expression which can be used to determine whether the token that the Scanner provided is that term and express it as a boolean value. It should be a static method that all derivative classes are guaranteed to have. Unfortunately, the Java language does not take kindly to this kind of method extension. The code would either not compile, or reference the wrong edition of the method. I'm sure I'll come up with a few workarounds myself, probably involving reflection or a careful HashMap; but this isn't the first time I've run into a problem like this one, and I'm curious. Has anyone else here come up with a solution that provides passable extensibility of static methods? Okay, let met clarify. I am not looking for a why-doesn't-this-compile, nor am I looking for a how-do-I-make-this-work. I am looking for a method by which I can check a method, which does not require the class to yet be instantiated, which can be relied upon to exist for any extending class. And, it needs to work in my weapon of choice for this project, that is, Java. As we all know that what I am discussing is in fact not a static method (pardon me, I thought I was clear about that), there is no code to show you; and what I do have is largely tangential. What I have come up with is this, in an abstract constructor: public Item(String token) { if(!check(token)) { throw new MismatchException(this.getClass() + " cannot be instantiated for \"" + token + "\""); } this.setData(derive(token)); } public abstract boolean check(String token); Meanwhile, creation of each token (and in this instance, addition to the abstract parse tree) goes like this (though I believe that it's still in need of a little polishing): for(Sting token : tokenList) { for(Class&lt;?&gt; cls : buildables) { try { Constructor constructor = cls.getConstructor(String.class); result.…
has comment: http://stackoverflow.com/comment/41552942
score: 0
has comment: http://stackoverflow.com/comment/41552053
answer count: 1
has comment: http://stackoverflow.com/comment/41552087

http://stackoverflow.com/q/26445729
has answer: http://stackoverflow.com/a/26447933
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41879339
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/41534098
has body: Here is my current code. I need help with getting the set list to work in the pizza and the test code. package pizza; import java.util.EnumSet; import java.util.Set; import pizza.Pizza.Crust; import pizza.Pizza.Size; import pizza.Pizza.Topping; public class Pizza { // Declare enums public enum Size{ SMALL, MEDIUM, LARGE, JUMBO } public enum Crust{ CHEESY, HAND_TOSSEDS, THIN_AND_CRISPY, DEEP_PAN } public enum Topping{ MUSHROOMS, GREEN_PEPPERS, HAM, PEPPERONI, SAUGSAGE } // declare variables private Size pizzaSize; private Crust crustType; private Set&lt;Topping&gt; setOfToppings = EnumSet.noneOf(Topping.class); public Pizza(){ } public void addTopping(Topping topping) { setOfToppings.add(topping); } public Set&lt;Topping&gt; getToppings() { return setOfToppings; } public Pizza(Size pizzaSize, Crust crustType, Topping greenPeppers, Topping saugsage, Topping pepperoni) { this.pizzaSize = pizzaSize; this.crustType = crustType; } public Pizza(Size large, Crust cheesy, Topping greenPeppers) { // TODO Auto-generated constructor stub } public Size getPizzaSize() { return pizzaSize; } public void setPizzaSize(Size pizzaSize) { this.pizzaSize = pizzaSize; } public Crust getCrustType() { return crustType; } public void setCrustType(Crust crustType) { this.crustType = crustType; } public String toString(){ return "A "+pizzaSize+" Pizza with "+ crustType +" crust" + "with " + setOfToppings + "Toppings"; } } Here is my TestCode package pizza; import pizza.Pizza.Crust; import pizza.Pizza.Size; import pizza.Pizza.Topping; public class PizzaTest { public static void main(String[] args) { // use constructor 1 Pizza vegieCrunch = new Pizza(); vegieCrunch.setCrustType(Crust.THIN_AND_CRISPY); vegieCrunch.setPizzaSize(Size.MEDIUM); vegieCrunch.addTopping(Topping.MUSHROOMS); // constructor 2 Pizza doubleCheese = new Pizza(Size.LARGE, Crust.CHEESY, Topping.GREEN_PEPPERS); Pizza PartyPizza = new Pizza(Size.JUMBO, Crust.DEEP_PAN, Topping.HAM, Topping.SAUGSAGE, Topping.PEPPERONI); // use of g…
score: 0
has comment: http://stackoverflow.com/comment/41534301
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: set
has title: Need help writing in a set for my pizza code

http://stackoverflow.com/comment/41657669
type: QuestionComment
has text: What about if you don't specify `-Dhttps.protocols` at all... will `SSLv2Hello` then become available?
comment on: http://stackoverflow.com/q/26488667
score: 0
type: Comment

http://stackoverflow.com/a/26498489
has comment: http://stackoverflow.com/comment/41663382
answers question: http://stackoverflow.com/q/26496752
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41651356
accepted answer of: http://stackoverflow.com/q/26496752
type: Answer
has body: Try debugging your code by entering inside your nested min loop the following line: System.out.println("the value of numbers[i] is: " + numbers[i]); so it looks like this: for (int j=0; j &lt; 5; j++) //finds five lowest...array not assigned values { for (int i=0; i &lt; numbers.length; i++) { if (numbers[i] &lt; min[j]) { System.out.println("the value of numbers[i] is: " + numbers[i]); temp = numbers[i]; numbers[i] = min[j]; min[j] = temp; } } } You'll notice something interesting. The innermost nested part doesn't even start. Try putting that line into the nested max loop in its respective location instead... and it will run fine and show the max array values. You are getting zero values for the min array because (other than initial assigning) the innermost part of the nested min loop isn't being started somehow, so it fails to run and searched values do not get assigned to the min array. The outer nested parts of the min loop run fine if you try debugging them with a similar line. It's this part that won't start and something's wrong with: if (numbers[i] &lt; min[j]) { System.out.println("the value of numbers[i] is: " + numbers[i]); temp = numbers[i]; numbers[i] = min[j]; min[j] = temp; } (Update) In the min loop, numbers[i] from i=0 to i=4 have a value of 0 after completing the max loop. You only need to add one line and use int i=5 instead of int i=0 inside your min loop: for (int j=0; j &lt; 5; j++) //finds five lowest...array not assigned values { min[j] = max[4]; // added line for (int i=5; i &lt; numbers.length; i++) // change to int i=5 { if (numbers[i] &lt; min[j]) {...
has comment: http://stackoverflow.com/comment/41655447
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41654204
has comment: http://stackoverflow.com/comment/41650931

http://stackoverflow.com/a/26506171
type: AcceptedAnswer
has body: make a custom adapter like this and then assign the values to the text views pass array like this to adapter UserList disadpt = new UserList(HomePage.this, mEmployeeList); userList.setAdapter(disadpt); then in adapter do this .. public class UserList extends BaseAdapter { private Context mContext; private ArrayList&lt;Employee&gt; items; public UserList(Context c, ArrayList&lt;Employee&gt; items) { this.mContext = c; this.items = items; } public int getCount() { return this.items.size(); } public Object getItem(int position) { return this.items.get(position); } public long getItemId(int position) { return position; } @Override public View getView(int pos, View child, ViewGroup arg2) { Holder mHolder; LayoutInflater layoutInflater; if (child == null) { layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); child = layoutInflater.inflate(R.layout.listcell, null); mHolder = new Holder(); //mHolder.txt_id = (TextView) child.findViewById(R.id.txt_id); mHolder.txt_fName = (TextView) child.findViewById(R.id.txt_fName); mHolder.txt_lName = (TextView) child.findViewById(R.id.txt_lName); mHolder.txt_userName = (TextView) child.findViewById(R.id.txt_userName); child.setTag(mHolder); } else { mHolder = (Holder) child.getTag(); } Employee employee = this.items.get(pos); ArrayList&lt;String&gt; employeeInfo = new ArrayList&lt;String&gt;(); employeeInfo.add(employee.employeeId); employeeInfo.add(employee.firstName); employeeInfo.add(employee.lastName); mHolder.Details.setTag(employeeInfo); mHolder.txt_fName.setText(employee.firstName + " " + employee.lastName); mHolder.txt_userName.setText(employee.emailId); return child; } public class Holder { //TextView txt_id; TextView txt_fName; TextView txt_lName; TextView txt_userName; Button Details; } } hope this helps ...
has comment: http://stackoverflow.com/comment/41645039
score: 0
has comment: http://stackoverflow.com/comment/41645346
type: Answer
answers question: http://stackoverflow.com/q/26506051
accepted answer of: http://stackoverflow.com/q/26506051

http://stackoverflow.com/comment/41433747
comment on: http://stackoverflow.com/q/26390176
has text: Use `BigInteger` instead. http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26402743
type: Answer
answers question: http://stackoverflow.com/q/26402556
has comment: http://stackoverflow.com/comment/41455674
has body: Simplest way to do it would be to create three datasets (let's say arraylists) and keep previous page data in one and current and future in the next one. Then put an onClickListener that changes the data in listviews and then notify adapter using .notifyDatasetChanged().
score: 0

http://stackoverflow.com/q/26451569
favorite count: 0
has comment: http://stackoverflow.com/comment/41544960
type: UnansweredQuestion
has title: How to call returns from other methods is inputs for others?
has body: I'd like to be able to call the return for three methods for the inputs of another. In the example below, I have other methods pulling the month, day, and year from a MM/DD/CCYY date. Then, the dayOfWeekMethod takes those ints and figures out the day of the week for that given day. How do I correctly format the first two lines to correctly give me that result? Thanks!! Here's what I have (which is incorrectly done): System.out.println("The date is "+MyDateTest.dayOfWeekMethod(MyDateTest.monthMethod(date), MyDateTest.dayMethod(date), MyDateTest.yearMethod(date)); public static int dayMethod(String dateInput){ int day = MyDate.getDay(dateInput); return day; } public static int monthMethod(String dateInput){ int month = MyDate.getMonth(dateInput); return month; } public static int yearMethod(String dateInput){ int year = MyDate.getYear(dateInput); return year; } public static String dayOfWeekMethod(int month, int day, int year){ String dayOfWeek = MyDate.dayofWeek(month, day, year); return dayOfWeek; }
has comment: http://stackoverflow.com/comment/41544398
tagged with: return
score: 1
upvote count: 1
tagged with: methods
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/41544533
has answer: http://stackoverflow.com/a/26451695
tagged with: java
has answer: http://stackoverflow.com/a/26451701
answer count: 2
tagged with: dayofweek
downvote count: 0
has comment: http://stackoverflow.com/comment/41544446

http://stackoverflow.com/q/26500962
answer count: 1
has comment: http://stackoverflow.com/comment/41633975
tagged with: c++
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26706980
has body: The Google Play Games Services works well, but there comes following error after creating GameServices object. I'm using SDK with cocos2d-x. Java Activity is initialized within JNI_OnLoad. Creating the GameServices object is initialized as descripted in Googles C++ SDK docs. Google Play Game Services C++ SDK 1.2 Google Play Services Revision 20 Android NDK 9d 10-22 08:07:43.474: E/GamesNativeSDK(26078): Exception in dalvik/system/DexClassLoader.loadClass: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.games.NativeSdkEntryPoints" on path: DexPathList[[zip file "/data/data/com.CompanyName.MyApp/app_.gpg.classloader/921cd45b6e4d26e0809d5e163b7327ee.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]. Is this error critical? And how can I fix this?
has comment: http://stackoverflow.com/comment/41644650
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/41971024
type: AnsweredQuestion
score: 3
tagged with: cocos2d-x
downvote count: 0
has answer: http://stackoverflow.com/a/26706980
favorite count: 0
type: Question
has title: Google Play Game Services C++ SDK does not find NativeSdkEntryPoints java class
tagged with: android

http://stackoverflow.com/comment/41495854
has text: @WimOmbelets we are getting the id of GenericPoduct and setting it to the id of menuController and at last statement u can see i am logging the GenericProduct Id and it is displaying it in logs
comment on: http://stackoverflow.com/q/26423951
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26396269
has comment: http://stackoverflow.com/comment/41478239
type: Answer
has comment: http://stackoverflow.com/comment/41445582
has comment: http://stackoverflow.com/comment/41477991
has comment: http://stackoverflow.com/comment/41445523
accepted answer of: http://stackoverflow.com/q/26396100
has comment: http://stackoverflow.com/comment/41444170
answers question: http://stackoverflow.com/q/26396100
has body: To start with, NEVER do this... while (lol) { gui.repaint(500); } You do not control the paint process, that is the domain of the RepaintManager. If you want your component updated, use repaint ONCE and let the RepaintManager figure it out. The core of your problem is here... public Line(Color color, Point[] points) { color = this.color; points = this.points; } You are assigning the values of this.color to color and this.points to points, which has no effect. You should be assigning them the other way around (color to this.color) You will, also want to take a closer look at: The Use of Multiple JFrames, Good/Bad Practice? Painting in AWT and Swing Performing Custom Painting Calling super.paintComponents from within paint is a bad idea, you should be calling super.paint and let it take care of the appropriate paint calls. Actually, you shouldn't be overriding paint without a really good reason, espically of top level containers. Instead, start by extending your paint class from a JPanel and override it's paintComponent method instead. You can then add this component to what ever container you want.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41478318
has comment: http://stackoverflow.com/comment/41478144
score: 0

http://stackoverflow.com/comment/41508872
has text: Remove images and leave only text. I formatted your error text, don't forget to format it ;)
score: 0
comment on: http://stackoverflow.com/q/26431826
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41597219
type: Comment
comment on: http://stackoverflow.com/q/26465593
type: QuestionComment
score: 0
has text: What do you mean with "first certificate"? The root certificate? You either need to import the certificate(s) into your clients keystore / trust store ... or to configure the client to ignore certificate errors.

http://stackoverflow.com/a/55656112
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/101885167
has comment: http://stackoverflow.com/comment/101917702
upvote count: 26
has body: If the dependency is defined in a &lt;dependencies&gt; block that is within a &lt;dependencyManagement&gt; block, adding it without the version number to a &lt;dependencies&gt; block that is outside &lt;dependencyManagement&gt; may fix the problem. This is because the purpose of &lt;dependencyManagement&gt; block is to manage dependency versions, and not to install the dependencies. See this other article: Differences between dependencyManagement and dependencies in Maven
answers question: http://stackoverflow.com/q/26506364
has comment: http://stackoverflow.com/comment/135070911
score: 26

http://stackoverflow.com/comment/41472241
type: QuestionComment
comment on: http://stackoverflow.com/q/26409790
has text: I think problem is with resolving the errorcode with message
score: 0
type: Comment

http://stackoverflow.com/q/26497068
favorite count: 0
has answer: http://stackoverflow.com/a/26530902
downvote count: 2
tagged with: orientdb
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41653812
has title: Lucene in Neo4j has some misbehaviours in terms of reliable search querys - compared to OrientDB
accepted answer: http://stackoverflow.com/a/26530902
type: Question
has comment: http://stackoverflow.com/comment/41651968
tagged with: analyzer
tagged with: lucene
upvote count: 4
has body: I'm still in the evaluation of Neo4j vs. OrientDB. Most importantly I need Lucene as full-text index engine. So I created on both databases the same schema with the same data (300Mio lines). I'm also experienced with querying different things in both systems. I used the Standard Analyzer on both sides. The OrientDB test query results are all fine and really good in terms of reliability and speed. The speed of Neo4j is also ok but the results are kind of bad in most of the cases. So let's come to the different issues I have with Neo4j Lucene indexing. I always give you an example of how it would look in OrientDB and which result set you should be getting out of the query. So in these examples, there are Applns that have title(s). Titles are indexed with Lucene in both databases. Applns also have an ID just to demonstrate the ordering. At the end of each query I have some questions about them. It would be great to get some feedback or even answers about them. Query #0: One word query with no order Well this query is very simple. It shall be tested how the database behave if there is just a simple word and nothing else. As you can see the Neo4j result is way longer then the one from OrientDB. OrientDB is using TFIDF to keep the results short and more reliable to the actual search. As you can see as first result in OrientDB, there is title with SOLAR. That is totally missing in Neo4j, too. In Neo4j: START n=node:titles('title:solar') RETURN n.title,n.ID LIMIT 10 SOLAR RADIATION SHIELDING PARTICULATE AND SOLAR RADIATION SHIELDING RESIN MATERIAL DISPERSED WITH ... 38321319 Solar module for cooling solar cells on the underside of a solar panel has air inlet and outlet openings ... 12944121 Solar construction component for solar thermal assemblies, solar thermal assembly, method for operating a solar... 324146113 ... In OrientDB: SELECT title,ID FROM Appln WHERE title LUCENE "solar" LIMIT 10 SOLAR 24900187 Solar unit and solar apparatus 1876343 Solar module with solar conce…
answer count: 1
tagged with: neo4j
has comment: http://stackoverflow.com/comment/41654657

http://stackoverflow.com/a/26479950
answers question: http://stackoverflow.com/q/26479052
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41597226
has comment: http://stackoverflow.com/comment/41596571
has body: I looked over the solutions posted and I think I found a version that serves my purposes. What do you think about this one? int size = mailbox.size(); for(int i = 0; i &lt; size; i++) { Mail currentMail = mailbox.poll(); if (!badNews(currentMail)) mailbox.offer(currentMail); } Edit: A new solution that may be problem free. What you guys think? while(true) { boolean badNewRemains = false; for(Mail mail: mailbox) { if(badNews(mail)) { badNewRemains = true; mailbox.remove(mail); break; } } if(!badNewRemains) break; }

http://stackoverflow.com/comment/41401970
score: 2
has text: why do you need two different classes that have same content?
comment on: http://stackoverflow.com/q/26372564
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26438706
type: Answer
answers question: http://stackoverflow.com/q/26438628
downvote count: 2
has comment: http://stackoverflow.com/comment/48827825
score: 31
upvote count: 33
has body: It's easy to change Jetbrains' products to use jdk1.7: Open Application folder Choose Jetbrains product you use RightClick and choose 'show package content' <- I dont know how exactly it is in english version of OS Choose Contents Double Click Info.plist Find: JVMVersion 1.6* and change to: JVMVersion 1.7* Save and quit, Enjoy!
has comment: http://stackoverflow.com/comment/42440628
has comment: http://stackoverflow.com/comment/41640219
has comment: http://stackoverflow.com/comment/41595339

http://stackoverflow.com/comment/41555643
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26457622
has text: have you tried specifying the closure without leaving the -> out?{ -> AuditorContextHolder.auditor } also as is not necessary if you are using Groovy 2.2+

http://stackoverflow.com/comment/41552975
has text: I changed the `query.setParameter("name", name2);` lines to use the parameters in the signature. i.e. `query.setParameter("name", name);`. This seems to have resolved the issue. However, now I get `Attempt to execute a query with no argument for parameter p3 (error 775)`
comment on: http://stackoverflow.com/a/26455894
score: 0
type: AnswerComment
type: Comment

versioning
tags question: http://stackoverflow.com/q/26411701
tag name: versioning
type: Tag

http://stackoverflow.com/q/26375910
downvote count: 0
has answer: http://stackoverflow.com/a/39824099
tagged with: arraylist
favorite count: 0
tagged with: assign
has body: I'm doing an assignment in which I have to have a Stamp store with a GUI, where users need to be able to add and remove items from a shopping card, then print an order receipt to a file when the customer checks out. I'm having a lot of issues with the shopping cart, as I'm not sure if items are being added correctly, since I can not display them. Currently, the code for the cart is ShoppingCart.java import java.util.ArrayList; import java.util.List; public class ShoppingCart { static // creates arraylist for cart List&lt;CartItem&gt; items = new ArrayList&lt;CartItem&gt;(); public void AddItem(CartItem store) { items.add(store); } public static void main(String[] args) { System.out.println(items.get(0)); } } Item.java import java.util.ArrayList; import java.util.List; public class Item { ShoppingCart cart; public void CartSelection() { CartItem items = new CartItem("Parcel", 12, "Italy", true, 10.00); cart.AddItem(items); } } CartItem.java import java.util.ArrayList; import java.util.List; // creates a class to store items in cart arraylist public class CartItem { public CartItem( String Type, Integer Weight, String Destination, Boolean NovDec, Double Price) { } } For a start, the code was giving me an error saying The method get(int) is undefined for the type CartItem. After searching for the cause of the problem, I altered the code now I get Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:638) at java.util.ArrayList.get(ArrayList.java:414) at ShoppingCart.main(ShoppingCart.java:16) Any help or pointers in the right direction would be greatly appreciated.
type: UnansweredQuestion
has title: Shopping Cart in Java
tagged with: cart
has answer: http://stackoverflow.com/a/26375947
score: 3
upvote count: 3
tagged with: java
type: Question
answer count: 2
tagged with: arrays

http://stackoverflow.com/q/26366858
downvote count: 1
accepted answer: http://stackoverflow.com/a/26367192
type: Question
has title: Error while returning integer instead of Scanner.NextInt()
has answer: http://stackoverflow.com/a/26367192
answer count: 1
favorite count: 0
tagged with: return
has body: I'm writing a menu-driven Java program to implement a Vigenere Cipher. For the menu function, I wrote the following code: public static int printmenu(){ Scanner scan = new Scanner(System.in); System.out.println("Welcome to the Vigenere Cipher!"); System.out.println("What would you like to do?"); System.out.println("1.Encrypt a message"); System.out.println("2.Decrypt a message"); System.out.println("Enter your choice:"); return scan.nextInt(); } Now this does the job correctly, but I was criticized by my professor for not closing my scanner class object "scan". So, I made the following edit to my code: public static int printmenu(){ int a; Scanner scan = new Scanner(System.in); System.out.println("Welcome to the Vigenere Cipher!"); System.out.println("What would you like to do?"); System.out.println("1.Encrypt a message"); System.out.println("2.Decrypt a message"); System.out.println("Enter your choice:"); a = scan.nextInt(); scan.close(); return a; } This, however, returns the following error: Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Unknown Source) at vigenere.Ciphermain.main(Ciphermain.java:30) I don't understand what I'm doing wrong. Can anyone help me? Edit: Here is the source code for the Ciphermain class: public class Ciphermain extends JFrame{ public static int printmenu(){ int a; Scanner scan = new Scanner(System.in); System.out.println("Welcome to the Vigenere Cipher!"); System.out.println("What would you like to do?"); System.out.println("1.Encrypt a message"); System.out.println("2.Decrypt a message"); System.out.println("Enter your choice:"); a = scan.nextInt(); scan.close(); return a; } public static void main(String[] args) { String message, key; int choice; choice = printmenu(); Scanner scan = new Scanner(System.in); if(choice == 1){ System.out.println("Enter the message to be encrypted:"); message = scan.nextLine(); System.out.println("Enter the secret key:"); key = scan.next(); Cipher …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41391193
tagged with: java.util.scanner
upvote count: 2
score: 1
tagged with: java

http://stackoverflow.com/q/26440278
has answer: http://stackoverflow.com/a/26440727
has answer: http://stackoverflow.com/a/26440367
accepted answer: http://stackoverflow.com/a/26440727
has body: I am trying to access JSONObjects in this Image link to the JSON code I am trying to access the "lat" and "lng" as such: "geometry": { "location": { "lat": 37.422258, "lng": -122.0840678 } } I am using Java in this case. I tried using this: JSONObject dataObj = obj.getJSONObject("location"); lat = dataObj.getString("lat"); lng = dataObj.getString("lng"); But I got no result. Any help would be appreciated.
has answer: http://stackoverflow.com/a/26440348
possible better answer: http://stackoverflow.com/a/26440367
linked to: http://stackoverflow.com/q/5245840
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How do I access these JSONObjects?
type: Question
has comment: http://stackoverflow.com/comment/41524112
score: 0
answer count: 3

http://stackoverflow.com/comment/41519320
score: 0
type: AnswerComment
type: Comment
has text: The used method returns an `Object` that the user selected from the provided `Object[]`. It still is - of course - not a `double`.
comment on: http://stackoverflow.com/a/26437567

http://stackoverflow.com/comment/41417018
type: AnswerComment
type: Comment
has text: I can use long but I found int performs faster than long
comment on: http://stackoverflow.com/a/26381134
score: 0

http://stackoverflow.com/comment/41680694
type: AnswerComment
comment on: http://stackoverflow.com/a/26513923
has text: Thanks a lot. But I did not get where can I use the YarnClient APIs to specify the resources required to launch this job (e.g. memory and CPU resources to launch the ApplicationMaster). Did you came across by this stuff before?
score: 0
type: Comment

http://stackoverflow.com/q/26431030
tagged with: arrays
has answer: http://stackoverflow.com/a/26431090
favorite count: 0
has comment: http://stackoverflow.com/comment/41506758
has title: Arrays from method
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41506764
downvote count: 2
tagged with: methods
tagged with: import
type: Question
score: -2
has body: I have a method MethodA at class A which returns an Array with 10 elements. I am calling the MethodA from class B and I want somehow to store the array in class B. IS there any way I could do this ? I am using Java.
tagged with: java
has comment: http://stackoverflow.com/comment/41506879
upvote count: 0
answer count: 1

http://stackoverflow.com/q/26508517
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41647405
upvote count: 1
has comment: http://stackoverflow.com/comment/41647450
type: Question
has comment: http://stackoverflow.com/comment/41647850
has body: I am new to java and have been set a task to create a class called Manual along with some properties shown in the question below: "1. Design a class Manual with the following properties: serial number - string, - default:?????? title - string, - default: Untitled author - string, - default: Unknown Write a constructor and a method to print details of a Manual on the console. " I have been working on this task and so far I have this: public class Manual { String serialNumber, title, author; public Manual(){ serialNumber = "??????"; title = "Untitled"; author = "Unknown"; } } Would anyone be able to let me know if my working so far is correct and also how I might be able to complete the last line referring to a constructor / print method. Thank you
has title: Class & Properties - Java
downvote count: 0
has answer: http://stackoverflow.com/a/26508976
tagged with: class
possible better answer: http://stackoverflow.com/a/26508784
has comment: http://stackoverflow.com/comment/41647546
answer count: 2
tagged with: printing
has answer: http://stackoverflow.com/a/26508784
accepted answer: http://stackoverflow.com/a/26508976
has comment: http://stackoverflow.com/comment/41647958
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41647473
tagged with: properties
has comment: http://stackoverflow.com/comment/41647661

http://stackoverflow.com/q/26456382
has comment: http://stackoverflow.com/comment/41553328
has comment: http://stackoverflow.com/comment/41553291
score: -3
downvote count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26456406
has answer: http://stackoverflow.com/a/26456390
accepted answer: http://stackoverflow.com/a/26456390
type: Question
has title: head first java dog/myDogs exercise
answer count: 2
has body: i am having a trouble compiling my code, which is: Class Dog { String name = null; public static void main (String[] args) { //make a Dog object and access it Dog dog1 = new Dog(); dog1.bark(); dog1.name = "Bart"; //now make a Dog array Dog[] myDogs = new Dog[3]; //and put some dogs in it myDogs[0] = new Dog(); myDogs[1] = new Dog(); myDogs[2] = dog1; //now access the Dogs using the array references myDogs[0].name = "Fred"; myDogs[1].name = "George"; //Hmmm.. what is myDogs[2] name? System.out.print("last name's dog is - "); System.out.println(myDogs[2].name); // now loop through the array // and tell all dogs to bark int x = 0; while (x &lt; myDogs.length) { myDogs[x].bark(); x = x + 1; } } public void bark() { System.out.println(name + "Ruff!!"); } public void eat() { } public void ChaseCat() { } } and the javac gives me this: C:\Users\User&gt;javac Dog.java Dog.java:1: error: class, interface, or enum expected Class Dog { ^ Dog.java:3: error: class, interface, or enum expected public static void main (String[] args) { ^ Dog.java:7: error: class, interface, or enum expected dog1.bark(); ^ Dog.java:8: error: class, interface, or enum expected dog1.name = "Bart"; ^ Dog.java:11: error: class, interface, or enum expected Dog[] myDogs = new Dog[3]; ^ Dog.java:13: error: class, interface, or enum expected myDogs[0] = new Dog(); ^ Dog.java:14: error: class, interface, or enum expected myDogs[1] = new Dog(); ^ Dog.java:15: error: class, interface, or enum expected myDogs[2] = dog1; ^ Dog.java:18: error: class, interface, or enum expected myDogs[0].name = "Fred"; ^ Dog.java:19: error: class, interface, or enum expected myDogs[1].name = "George"; ^ Dog.java:22: error: class, interface, or enum expected System.out.print("last name's dog is - "); ^ Dog.java:23: error: class, interface, or enum expected System.out.println(myDogs[2].name); ^ Dog.java:27: error: class, interface, or enum expected int x = 0; ^ Dog.java:28: error: class, interface, or enum expected while (x &lt; m…
upvote count: 1
possible better answer: http://stackoverflow.com/a/26456406
favorite count: 0

http://stackoverflow.com/q/26456199
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41553629
has comment: http://stackoverflow.com/comment/41553565
has comment: http://stackoverflow.com/comment/41552905
answer count: 1
linked to: http://stackoverflow.com/q/604385
score: 0
has title: Cruise Control Installation error
tagged with: cruisecontrol
has answer: http://stackoverflow.com/a/26456761
has body: I am trying to install Cruise Control on my Windows 2008 R2 Enterprise. While installing , I got java version compatibility errors and found a solution for the same at stackoverflow: Cruise Control service error: Cannot construct net.sourceforge.cruisecontrol.BuildLoopInformation as it does not have a no-args constructor Now, I ran into a different installation problem (attached the screenshot): Please help... Thank you :) java.lang.ClassCastException: net.sourceforge.cruisecontrol.BuildLoopInformation cannot be cast to net.sourceforge.cruisecontrol.BuildLoopInformation at net.sourceforge.cruisecontrol.util.BuildInformationHelper.toObject(BuildInformationHelper.java:32) at net.sourceforge.cruisecontrol.dashboard.web.BuildLoopController.handleRequestInternal(BuildLoopController.java:28) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:858) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHand…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12169454

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

http://stackoverflow.com/comment/41568275
has text: @RahulTripathi I suggest you to change your title since answers are misunderstanding your question. See my answer, hopefully it does help you.
comment on: http://stackoverflow.com/q/26464938
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/41515554
score: 0
type: QuestionComment
type: Comment
has text: The recursion is required as part of an assignment
comment on: http://stackoverflow.com/q/26435429

http://stackoverflow.com/q/26453983
has title: Is it a good idea to use static helper classes in Play Framework 2?
favorite count: 0
has comment: http://stackoverflow.com/comment/41552491
type: AnsweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26457708
type: Question
has body: I'm developing a Play Framework 2 application in Java, and I'm wondering if I can use static helper classes. For example, I want to know if a user is logged and have completed its profile. This test take a few lines, may be subject to change, and is used a lot in the application. So I write a class with these tests in one method with one argument (the Session object) that I use everywhere. But I have to instantiate a class each time to use the method, so at scale it may be inefficient. Is it safe to make it static ? If it is, what other play object can I use safely as a parameter ?
tagged with: java
tagged with: thread-safety
accepted answer: http://stackoverflow.com/a/26457708
score: 0
has comment: http://stackoverflow.com/comment/41982190
tagged with: playframework
answer count: 1

http://stackoverflow.com/q/26436769
upvote count: 2
has comment: http://stackoverflow.com/comment/41518438
tagged with: api
has comment: http://stackoverflow.com/comment/41518202
tagged with: jsp
favorite count: 0
tagged with: timer
has comment: http://stackoverflow.com/comment/41518338
has answer: http://stackoverflow.com/a/26437201
accepted answer: http://stackoverflow.com/a/26437201
answer count: 4
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4691132
has title: How can I automatically invoke a servlet periodically at specified time intervals
downvote count: 0
has comment: http://stackoverflow.com/comment/41518040
has comment: http://stackoverflow.com/comment/41519989
duplicate of: http://stackoverflow.com/q/4691132
has comment: http://stackoverflow.com/comment/41518084
type: Question
has answer: http://stackoverflow.com/a/26436801
has answer: http://stackoverflow.com/a/26436799
has answer: http://stackoverflow.com/a/26437484
has body: Have to call the servlet periodically.(like service concept in andorid) How to do this. Using timer or any other solution? Thanks in advance.
tagged with: java
possible better answer: http://stackoverflow.com/a/26436799
tagged with: servlets

http://stackoverflow.com/q/26427525
tagged with: collections
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/41501728
tagged with: java
linked to: http://stackoverflow.com/q/542979
has comment: http://stackoverflow.com/comment/41500043
type: Question
has comment: http://stackoverflow.com/comment/41500181
downvote count: 0
has answer: http://stackoverflow.com/a/26428397
has comment: http://stackoverflow.com/comment/41500332
score: 2
answer count: 1
favorite count: 0
upvote count: 2
tagged with: out-of-memory
accepted answer: http://stackoverflow.com/a/26428397
has title: Java big list object causing out of memory
has body: I am using Java Spring ibatis I have java based reporting application which displays large amount of data. I notice when system try to process large amount of data it throws "out of memory" error. I know either we can increase the memory size or we can introduce paging in reporting application. any idea ? i am curious if there is some thing like if list object is large enough split it into memory and disk so we don't have to make any major change in the application code ? any suggestion appreciated.

http://stackoverflow.com/comment/41656636
has text: If "Updated" is on the output only tells you that there was no exception. It doesn't imply that the operation was successfull.
comment on: http://stackoverflow.com/q/26513330
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26374449
has answer: http://stackoverflow.com/a/26374512
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26374562
tagged with: java
has title: Why is my method not emptying the ArrayList<Card>?
type: Question
answer count: 2
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/26374512
has body: I'm trying to empty the ArrayList hand, so that a new round can be played. I'm not sure why my for loop isn't emptying the "hand" and instead only removing the first card in the hand. Here's my code: import java.util.ArrayList; public class Game { private Deck aDeck; private InputReader reader; private ArrayList&lt;Card&gt; hand; private String commandChoice; private int handValue; /** * Method to run the game. * First while loop will run until the player chooses "no" for another round. * Second while look will keep running until the player chooses to stand, has 21 or busts. * the last while loop is to make sure that the player chooses either "Hit" or "Stand". If neither is choosen, it will keep requesting it. */ public void Play(){ int playerPoints = 0; int totalRounds = 0; commandChoice = ""; hand = new ArrayList&lt;Card&gt;(); reader = new InputReader(); intro(); aDeck = new Deck(); aDeck.loadDeck(); aDeck.shuffle(); aDeck.shuffle(); while(anotherRound() == false){ dealCard(); dealCard(); report(); playTurn(); totalRounds ++; emptyHand(); endRound(); anotherRound(); } System.out.println("Player Points: " + playerPoints); System.out.println("Total Rounds: " + totalRounds); } /** * intro message to player */ private void intro(){ System.out.println("Welcome to 1451 Blackjack!"); System.out.println("You will start with two cards."); System.out.println("You will be prompted to 'hit' or 'stand' 'hit' means you want another card, 'stand' not."); System.out.println(""); System.out.println("You are trying to get Blackjack with exactly 21 points."); } /** * deals a card to the player */ private void dealCard(){ int deckSize = aDeck.deckSize(); if(deckSize == 0){ System.out.println("Time for some more cards"); aDeck.loadDeck(); aDeck.shuffle(); aDeck.shuffle(); } else { Card tempCard = aDeck.takeCard(); hand.add(tempCard); } } /** * calculates the hand value of the player * @return handValue */ private int getHandValue(){ handValue = 0; for(Card eachCard : hand) { int temp…
score: 0
has answer: http://stackoverflow.com/a/26374562

http://stackoverflow.com/comment/72872064
comment on: http://stackoverflow.com/a/26451921
type: AnswerComment
type: Comment
score: 13
has text: What would be the alternative to this ? How would I serialize an object that has a localdate field

http://stackoverflow.com/q/26494934
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26494955
upvote count: 3
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/26494965
has answer: http://stackoverflow.com/a/32079223
has body: I add the details of a Person to an ArrayList twice, but when I want to print the two objects, it just repeats the final details twice (and it does not print the first). import java.util.ArrayList; public class Arraylist { Person person = new Person(); ArrayList&lt;Person&gt; array = new ArrayList&lt;&gt;(); Person personTwo; Person personThree; void dataEntery(String name , int age , double marks, int itc, int pf) { person.addDetail(name,age,marks); person.marksDetail(itc,pf); array.add(person); } void print() { int index =0; while(index&lt;array.size()) { personTwo = array.get(index); System.out.println(personTwo.name); System.out.println(personTwo.age); System.out.println(personTwo.marks); System.out.println(personTwo.itc); System.out.println(personTwo.pf); index++; } } } Can anyone explain why the first isn't printing and why the last prints twice?
favorite count: 0
has title: How to add objects in an ArrayList multiple times
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41623198
score: 1

http://stackoverflow.com/comment/41380621
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26360636
score: 0
has text: @ManojSingh, 1 issue in your code is you are creating `OrderDetail` object only once outside for-loop, this is not correct, you have to create it inside for-loop because it is like when you see the list `orderdetail` then all the elements of the list contains just duplicates of same element. Anyway this is not an answer but I am just trying to tell the issue in your code.

http://stackoverflow.com/comment/41475829
score: 0
has text: yes you are absolutely right.Can you help how to get bitmap from imageview?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26413784

http://stackoverflow.com/a/26436199
has comment: http://stackoverflow.com/comment/41516994
accepted answer of: http://stackoverflow.com/q/26436182
has comment: http://stackoverflow.com/comment/41517023
has comment: http://stackoverflow.com/comment/41516955
upvote count: 1
answers question: http://stackoverflow.com/q/26436182
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41517074
has comment: http://stackoverflow.com/comment/41517253
type: Answer
has comment: http://stackoverflow.com/comment/41516967
has body: Start with an array containing the four objects: Object[] objects = new Object[] { object1(param1, param2), object2(param1), object3(param1, param2, param3, param4), object4(param1, param2) } Then adjust your code: Random generator = new Random(); for(int i = 0; i &lt; 100; i++){ int j = generator.nextInt(4); // this will give us 0,1,2,or 3 arraylist.add(objects[j]); // etc.. continues with 3 other else if statments and objects } Notice that you don't have to create a new generator on every iteration - you can create it just once and reuse the same instance.
downvote count: 0
has comment: http://stackoverflow.com/comment/41517111
has comment: http://stackoverflow.com/comment/41516945
has comment: http://stackoverflow.com/comment/41517153
score: 1

http://stackoverflow.com/q/26399450
has body: I have an azure VM, on which I have hosted an AD LDS instance. I have also created a few users in an OU. I am trying to connect to the AD LDS instance using my Java code. My code is as follows: public final class Main { private static final List&lt;String&gt; EMPTY_ARGS = emptyList(); public static void main(String[] args) throws Exception { List&lt;String&gt; argsList = asList(args); String url = "LDAP://xx.xx.xxx.xx:389/o=org,c=US"; //Public IP of VM String principal = "CN=Test User,OU=Users,O=org,C=US"; String password = "password"; List&lt;String&gt; attributeNames = new ArrayList&lt;String&gt;(); attributeNames.add(url); attributeNames.add(principal); attributeNames.add(password); System.out.println("url = " + url); System.out.println("principal = " + principal); System.out.println("password = " + password); System.out.println("attributeNames = " + attributeNames); Hashtable&lt;Object, Object&gt; env = new Hashtable&lt;Object, Object&gt;(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, url); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, principal); env.put(Context.SECURITY_CREDENTIALS, password); env.put("java.naming.ldap.factory.socket", "cnauroth.ldaputil.CustomSSLSocketFactory"); DirContext ctx = null; try { System.out.println("Inside"); ctx = new InitialDirContext(env); System.out.println("Successfully authenticated."); if (!attributeNames.isEmpty()) { Attributes attributes = ctx.getAttributes(principal, attributeNames.toArray(new String[attributeNames.size()])); for (String attributeName : attributeNames) { Attribute attribute = attributes.get(attributeName); if (null != attribute) { NamingEnumeration&lt;?&gt; values = attribute.getAll(); if (null != values) { if (values.hasMore()) { System.out.println(attributeName); while (values.hasMore()) System.out.println(" " + values.next()); } } } } } } finally { if (null != ctx) { try { ctx.close(); } catch (Nam…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41450283
has title: Connect to remote AD LDS server using Java
tagged with: adlds
answer count: 0
tagged with: java
type: Question
tagged with: active-directory
has comment: http://stackoverflow.com/comment/41449495
has comment: http://stackoverflow.com/comment/41449754
score: 0

http://stackoverflow.com/a/26444197
type: Answer
has comment: http://stackoverflow.com/comment/41662516
has comment: http://stackoverflow.com/comment/41661761
has comment: http://stackoverflow.com/comment/41656132
has body: Take a read through the Java Servlet Specification, specifically section 13.6.3. Reading a spec sounds scary, but the Java Servlet Spec is one of the most readable I've ever read: it's meant to be read by programmers and not by lawyers. The quick summary is that when a user tries to access a protected page (and haven't yet authenticated), they are presented with the login page. The "submit" button posts the username and password to the servlet container (Tomcat) which performs the authentication (checks the username/password) and either goes back to the login page (if the username/password were incorrect) or redirects the user back to the protected page they originally requested. There's some stuff going on here that isn't obvious because the container (Tomcat) is handling it for you. Reading the spec -- the whole thing, actually -- will give you great insight into how everything works and will make you much better prepared to babysit this code you've inherited. Update 2014-10-22 13:45 EDT To determine the type of authentication that is being performed, you need to look for a &lt;Realm&gt; element in your web applications' META-INF/context.xml file, or in Tomcat's conf/server.xml, nested inside your web application's &lt;Context&gt; element. It will indicate the type of realm being used (usually "Memory" which is for conf/tomcat-users.xml, or DataSource/JDBC which indicate that the authentication information is in a relational database, etc.). None of the "realm" stuff is covered by the spec. For that, you'll have to refer to the Tomcat documentation, or join the Tomcat users' list and the community in general.
accepted answer of: http://stackoverflow.com/q/26434320
answers question: http://stackoverflow.com/q/26434320
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41666638
score: 0

http://stackoverflow.com/a/26421586
downvote count: 0
answers question: http://stackoverflow.com/q/26420783
has comment: http://stackoverflow.com/comment/41501065
has comment: http://stackoverflow.com/comment/41504200
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41503148
has comment: http://stackoverflow.com/comment/41503855
score: 1
has comment: http://stackoverflow.com/comment/41503760
has body: ImageView profilePicture ; mprofilePicture = (ImageView)findViewById(R.id.profilePicturePreview); replace with ProfilePictureView mprofilePicture; mprofilePicture = (ProfilePictureView) findViewById(R.id.profilePicturePreview); and import this import com.facebook.widget.ProfilePictureView;

http://stackoverflow.com/a/26447085
answers question: http://stackoverflow.com/q/26447059
type: Answer
has body: Use a switch statement. System.out.println("Please choose the input currency:"); Scanner in = new Scanner(System.in); String choice = in.next(); String inType; switch(choice) { case "1": inType = "US Dollars"; break; // etc... default: inType = null; System.out.println("Please enter a correct currency type from the list."); } System.out.printf("Now enter the input in" + inType);
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41536717
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26447059

http://stackoverflow.com/comment/41574619
comment on: http://stackoverflow.com/q/26468428
score: 0
type: Comment
type: QuestionComment
has text: yeah i m using the most updated version 7.3 . but still I am not able to navigate through arrows. I am not sure if I have to write some command to actiavte that functionality ?

http://stackoverflow.com/comment/41512236
comment on: http://stackoverflow.com/q/26433334
score: 0
type: Comment
type: QuestionComment
has text: @HotLicks, right, sorry. I may have incorrectly used some vocabulary in my question, but I understand that you can't change the class of an object. Thank you for the other piece of info though! I did try searching and couldn't find anything. I may not have used the correct vocab in my searches either.

http://stackoverflow.com/q/26457535
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/41555348
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26457581
tagged with: android
has title: Handling results from AsyncTask
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: android-fragments
linked to: http://stackoverflow.com/q/12575068
score: 0
has body: I created an new AsyncTask and everything seems to be running fine. I just do not know how to retrieve the results and utilize them in the Fragment that is creating the AsyncTask. How can I retrieve an ArrayList after the AsyncTask has finished running and use that ArrayList in the calling fragment? Is it within the OnPostExecute? ASYNCTASK @Override protected ArrayList&lt;String&gt; doInBackground(String... params) { // TODO Auto-generated method stub mArray = new ArrayList&lt;String&gt;(); StringBuilder sb = new StringBuilder(GEOCODING_API_BASE + OUT_JSON); try { sb.append("?address=") .append(URLEncoder.encode(params[0], "UTF-8")); sb.append("&amp;sensor=false"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } String uri = sb.toString(); HttpGet httpGet = new HttpGet(uri); HttpClient client = new DefaultHttpClient(); HttpResponse response; StringBuilder stringBuilder = new StringBuilder(); try { response = client.execute(httpGet); HttpEntity entity = response.getEntity(); InputStream stream = entity.getContent(); int b; while ((b = stream.read()) != -1) { stringBuilder.append((char) b); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } JSONObject jsonObject = new JSONObject(); try { jsonObject = new JSONObject(stringBuilder.toString()); double lng = ((JSONArray) jsonObject.get("results")) .getJSONObject(0).getJSONObject("geometry") .getJSONObject("location").getDouble("lng"); double lat = ((JSONArray) jsonObject.get("results")) .getJSONObject(0).getJSONObject("geometry") .getJSONObject("location").getDouble("lat"); Log.e("latitude", "" + lat); Log.e("longitude", "" + lng); String longitude = Double.toString(lng); String latitude = Double.toString(lat); mArray.add(longitude); mArray.add(latitude); } catch (JSONException e) { e.printStackTrace(); } return mArray; } @Override protected void onPostExecute(ArrayList&lt;String&gt; result) { super.onPostExecu…
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26442590
tagged with: jtable
has answer: http://stackoverflow.com/a/26442619
answer count: 1
downvote count: 0
has body: I am trying to set a value in my jtablemodel using the setValueAt method whenever a header is clicked. I currently have a MouseAdapter correctly displaying which column is being clicked on but the board.setValueAt() method is not being called. Mouse Listener. This correctly displays the column in which I click. I've tried to use board.getModel().setValueAt() but that didnt work either. public class HeaderListener extends MouseAdapter{ private JTable board; public HeaderListener(JTable board){ this.board = board; } @Override public void mouseClicked(MouseEvent event) { Point point = event.getPoint(); int column = board.columnAtPoint(point); System.out.println(column); Data value = new Data(0,"yes"); board.setValueAt(value, 0, column); } } TableModel. The "Set value at entered" never gets displayed to console. When I try to Override it it gives me an error. public class TableModel extends AbstractTableModel{ private Data[][] data; private String[] columnNames = {"Move Here", "Move Here", "Move Here", "Move Here", "Move Here","Move Here"}; public TableModel(){ data = new Data[6][7]; Data test = new Data(0,"yes"); data[1][1] = test; } @Override public int getRowCount() { return data.length; } @Override public int getColumnCount() { return columnNames.length; } @Override public String getColumnName(int col) { return columnNames[col]; } @Override public Object getValueAt(int row, int col) { return (data[row][col]==null?"":data[row][col].getText()); } public void setValueAt(Data data2, int row, int col){ System.out.println("Set value at entered"); data[row][col] = data2; fireTableCellUpdated(row,col); System.out.println(data[row][col].getText()); System.out.println(data[row][col].getPlayer()); } } Main method board creation... JTable board = new JTable(new TableModel()); board.getTableHeader().addMouseListener(new HeaderListener(board)); Can anyone tell me what I am doing wrong?
has comment: http://stackoverflow.com/comment/41528287
favorite count: 0
accepted answer: http://stackoverflow.com/a/26442619
score: 2
type: AnsweredQuestion
tagged with: abstracttablemodel
upvote count: 2
tagged with: mouselistener
tagged with: java
tagged with: swing
type: Question
has title: AbstractTableModel setValueAt method not being called

http://stackoverflow.com/q/26476705
has answer: http://stackoverflow.com/a/26476899
has body: I have a quick question about this HiLo game that I have been trying to fix from a while now. When I run the program it counts guesses outside of the 0-10 range, but I don't want it to do that. How do I fix that? Here is my code. import java.util.Random; // Random number generator class import java.util.Scanner; // reads user inputs public class HiLo { public static void main(String[] args) { // declare variables final int MAX = 10; int answer, guess; int numberOfTries = 0; String again; Scanner Keyboard = new Scanner(System.in); do { System.out.print(" I'm thinking of a number between 0 and " + MAX + ". Guess what it is: "); guess = Keyboard.nextInt(); // guess Random generator = new Random(); // Random number generator. 0 to 10. answer = generator.nextInt(MAX) + 1; if (guess &gt; 10) // if guess is bigger than 10 then error message { System.out.println("ERROR – Your guess is out of the range 0 to 10."); } if (guess &lt; 0) // if guess is smaller than 0 then error message { System.out.println("ERROR – Your guess is out of the range 0 to 10."); } while (guess != answer) // If guess is not the answer { if (guess &gt; answer) // If guess is more than the answer { System.out.println("You guessed too high! \nTry again:"); guess = Keyboard.nextInt(); } if (guess &lt; answer)// If guess is less than the answer { System.out.println("Too Low! \nTry again:"); guess = Keyboard.nextInt(); } numberOfTries = numberOfTries + 1; }// end of the loop // display result if (guess == answer) { numberOfTries += 1; System.out.println("YOU WIN!"); System.out.println("It took you " + numberOfTries + " tries!"); System.out.println(); System.out.print("Do you want to play again(Y/N)?"); } Keyboard.nextLine(); // skip over enter key again = Keyboard.nextLine(); numberOfTries = 0; } while (again.equalsIgnoreCase("Y")); } // end of class } // end of main
has title: Why does my HiLo game allow guesses outside of the 0-10 range?
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26476899
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41590893
has comment: http://stackoverflow.com/comment/41590488
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/41590492

http://stackoverflow.com/q/26471959
has title: SSLV3 Handshake issue after Poodle vulnerability fix
tagged with: sslv3
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: handshake
tagged with: https
type: Question
upvote count: 1
has body: I recently applied the patch for POODLE vulnerability on my server and tested for its vulnerability and things looked pretty good. But the problem now is that I have an internal service that communicated via HTTPS and that communication is breaking with the following error - Both the services are deployed in the same tomcat server - hence it's an internal web service call. How can I fix this? javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1822) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1004) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230) at org.glassfish.jersey.client.HttpUrlConnector$3.getOutputStream(HttpUrlConnector.java:312) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:200) at org.glassfish.jersey.message.internal.CommittingOutputStream.commitStream(CommittingOutputStream.java:194) at org.glassfish.jersey.message.internal.CommittingOutputStream.commit(CommittingOutputStream.java:262) at org.glassfish.jersey.message.internal.OutboundMessageContext.commitStream(OutboundMessageContext.java:812) at org.glassfish.jersey.client.Client…
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41510754
type: Comment
score: 3
has text: @PeterHwang the rule is quite simple: the package hierarchy must match the folder hierarchy. Decide of a root folder for your sources. All the classes in this root folderare in the default package. All the classes in a subdirectory must be in a package which matches the directory path from the root folder.
comment on: http://stackoverflow.com/q/26432953
type: QuestionComment

http://stackoverflow.com/comment/41429234
has text: I replace my getConnection() with the one su suggested, and I have specified my JDBC resource in the lookup field (the same JDBC resource that I specify in the persistence.xml), but something fails because when I call getConnection() dataSource=null and an ExceptionInInitializerError is throws. I also added the @Stateless annotation to my class, but anything. Do you think there is something missing?
comment on: http://stackoverflow.com/a/26360671
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26364114
has body: You are using the complete XPath, which almost always is a bad idea. From the little bit of code you posted there are too many solutions. Any one of the following could work: driver.findElement(By.className("x106")) driver.findElement(By.tagName("span")) driver.findElement(By.linkText("Cadastro de cliente")) Have a read through the documentation.
has comment: http://stackoverflow.com/comment/41389131
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26363566

http://stackoverflow.com/comment/41491803
has text: Sure, but that gets you the code, not the message. By message I mean something like "The field name must not be blank". Or do you use the `spring:message`tag on the JSP? I understand your question but I don't understand why you need a code in the first place and who will do what with it. And that makes it difficult to suggest a solution.
score: 1
comment on: http://stackoverflow.com/q/26418730
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41430647
type: Comment
comment on: http://stackoverflow.com/a/26388066
score: 0
type: AnswerComment
has text: If you are getting the filename from a parameter, create the `File` like this: `java.io.File file = new java.io.File(request.getParameter("nameOfParameterGoesHere"));`

http://stackoverflow.com/q/26462673
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26464504
tagged with: java
tagged with: servlets
has body: I have my jsp file similar to the following: <input type="text" name="fromDate" <input type="text" name="toDate" <input type="text" class="totAmount" New schedule rows get dynamically added and for each of this, there can be no.of fromTime and toTime tables. I need to get these values in my servlet. I know I could get the values of fromDate and toDate through String[] fromDates=request.getParameterValues("fromDate"); String[] toDates=request.getParameterValues("toDate"); I am looking to find out how I can retrieve fromHour and toHour values corresponding to its fromDate and toDate. Thanks, in advance.
type: Question
tagged with: jsp
has comment: http://stackoverflow.com/comment/41566761
has comment: http://stackoverflow.com/comment/41567418
score: 0
has title: Get the dynamically added table values in servlet
has answer: http://stackoverflow.com/a/26464504
answer count: 1

http://stackoverflow.com/a/26469820
accepted answer of: http://stackoverflow.com/q/26453520
type: Answer
has comment: http://stackoverflow.com/comment/41585134
score: 3
has comment: http://stackoverflow.com/comment/41579708
upvote count: 3
has comment: http://stackoverflow.com/comment/41579663
downvote count: 0
has body: No, your problem is not that the JFrame is null, but rather your Test.gui1 variable is null. I added a line to your code to test it out: public Pane() { try { Scanner read = new Scanner(new File("user.txt")); if (read.nextInt() != 0) { Test.startGUI2(); // ********** two lines below added ****** System.out.println("gui1 null? " + (Test.getGUI1() == null)); System.out.println("frame null? " + (frame == null)); Test.getGUI1().frame.dispose(); } } catch (FileNotFoundException ex) { Logger.getLogger(GUI1.class.getName()).log(Level.SEVERE, null, ex); } This will return: gui1 null? true frame null? false You're trying to call methods on the gui1 GUI1 object before its constructor has completed, a dangerous thing to do. But again, the ultimate solution may be different and will depend on what you're trying to achieve. If your goal is to swap views, then I'm with Andrew Thompson -- you should switch JPanel views with a CardLayout. Another way to test that I'm right is to see what happens if we call your frame swapping code in the GUI1 constructor vs giving it a little delay by queuing it on the Swing event thread using SwingUtilities.invokeLater(Runnable). In the code below, try running it with different values for the CREATE_ERROR boolean. In other words, run it once with public static final boolean CREATE_ERROR = true; and then run it again with public static final boolean CREATE_ERROR = false; and see what happens import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class TestA { private static GUI1A gui1; private static GUI2A gui2; public static void main(String[] args) { startGUI1(); } public static void startGUI1() { gui1 = new GUI1A(); } public static GUI1A getGUI1() { return gui1; } public static void startGUI2() { gui2 = new GUI2A(); } public static GUI2A getGUI2() { return gui2; } } class GUI1A { public static final boolean CREATE_ERROR = true; private JFrame frame1 = new JFrame("Frame 1"); public GUI1A() { frame1.setDefa…
answers question: http://stackoverflow.com/q/26453520
type: AcceptedAnswer

http://stackoverflow.com/a/26513655
has body: Example String g = "line"; char c = g.charAt(0); // returns 'l' char[] c_arr = g.toCharArray(); // returns a length 4 char array ( 'l','i','n','e' )
answers question: http://stackoverflow.com/q/26513593
type: Answer
score: 0

http://stackoverflow.com/q/26508546
answer count: 3
favorite count: 0
has title: Conditional expression that returns -1 or 1 randomly
has answer: http://stackoverflow.com/a/26509010
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26508681
has answer: http://stackoverflow.com/a/26509086
has comment: http://stackoverflow.com/comment/41647470
has comment: http://stackoverflow.com/comment/41647471
upvote count: 0
tagged with: conditional-statements
score: -5
tagged with: expression
has body: Is there any way in Java to write conditional expression that returns -1 or 1 randomly?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41647462
downvote count: 5

http://stackoverflow.com/comment/60631651
type: Comment
comment on: http://stackoverflow.com/a/26364445
has text: Unless your library is all try-with-resources, having full coverage elsewhere should eventually make the few lines missed in the try blocks insignificant which is what I meant
score: 0
type: AnswerComment

http://stackoverflow.com/q/26412175
upvote count: 1
has comment: http://stackoverflow.com/comment/41472305
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26412207
linked to: http://stackoverflow.com/q/13109996
accepted answer: http://stackoverflow.com/a/26412207
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: loops
type: Question
tagged with: for-loop
has body: When i put in the first input it prints the second and the third at the same time. Console: Please enter the grade for course 1 A Please enter the grade for course 2 Please enter the grade for course 3 Code: import java.io.IOException; public class MyGradeLoops { public static void main(String[] args) throws IOException{ int grade; for (int i=1; i&lt;6; i++) { System.out.println("Please enter the grade for course " + i); grade = System.in.read(); } System.out.println("Thank your for submitting your grades"); } }
has title: For loop advances two numbers instead of one

http://stackoverflow.com/tag/c
tags question: http://stackoverflow.com/q/26356327
tags question: http://stackoverflow.com/q/26473875
tags question: http://stackoverflow.com/q/26496805
tag name: c
tags question: http://stackoverflow.com/q/26406581
type: Tag
tags question: http://stackoverflow.com/q/26398063
tags question: http://stackoverflow.com/q/26380923
tags question: http://stackoverflow.com/q/26378274
tags question: http://stackoverflow.com/q/26485650
tags question: http://stackoverflow.com/q/26402036

http://stackoverflow.com/a/26503526
downvote count: 1
has comment: http://stackoverflow.com/comment/41638718
score: 0
has comment: http://stackoverflow.com/comment/41639082
has comment: http://stackoverflow.com/comment/41658824
has comment: http://stackoverflow.com/comment/41639377
has comment: http://stackoverflow.com/comment/41684915
type: Answer
answers question: http://stackoverflow.com/q/26503109
has comment: http://stackoverflow.com/comment/41639978
has comment: http://stackoverflow.com/comment/41639559
has body: Well, this would do it (note, you would probably want to put the code from the first sleep onwards into a timer or it's own thread in a real application to avoid blocking the thread running the code): public static void main(String[] args) throws Exception { final JFrame jf = new JFrame(); final JButton jButton = new JButton("Hello"); final Color originalBackground = jButton.getBackground(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); jf.getContentPane().add(jButton); jf.pack(); jf.setVisible(true); } }); Thread.sleep(500); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jButton.setBackground(Color.RED); } }); Thread.sleep(1000); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jButton.setBackground(originalBackground); } });
upvote count: 1

http://stackoverflow.com/comment/41596663
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26480259
has text: actually em creating a chathead like in facebook chat problem is this on ActionDown Event i want to open or launch my app but problem is when user try to reallocate the chathead from one location to other the event fire
score: 0

http://stackoverflow.com/comment/41493354
type: QuestionComment
type: Comment
has text: Are there other mehods in your ConnectionProviderTest class apart from the 3 you are including?
comment on: http://stackoverflow.com/q/26406573
score: 0

http://stackoverflow.com/a/26412330
has comment: http://stackoverflow.com/comment/41473171
has body: from what you shown: algorithm is: start from root for every node v every left-child is node v's child so add this child to node v childs list every right-child is node v's parent's child(or parent of parent until it is a left-child of its parent, then the node you discovered is the child of left-child node's parent's child). pseudo code for finding a node's parent in actual tree: enter node. if node is left child print its node-&gt;parent. else while node-&gt;parent is right child node = node-&gt;parent print node-&gt;parent.
has comment: http://stackoverflow.com/comment/41472985
has comment: http://stackoverflow.com/comment/41472702
score: 0
has comment: http://stackoverflow.com/comment/41473353
answers question: http://stackoverflow.com/q/26412113
has comment: http://stackoverflow.com/comment/41473275
type: Answer
has comment: http://stackoverflow.com/comment/41473263
has comment: http://stackoverflow.com/comment/41472843

http://stackoverflow.com/q/26369139
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26443906
score: 6
has body: I'm trying to modify the existing EnvInject plugin so that the Environment Variables link it puts on a build's page is hidden. If I'm understanding the Jenkins API correctly, I should be able to do this by finding where the Action interface is implemented and having getIconFileName() return null. I found that method implemented in EnvInjectAction.java and modified it to return null, but this had no effect--the link is still visible on build pages. I even tried modifying getDisplayName() and getUrlName() to also return null, but this also had no effect. Here is the modified method: public String getIconFileName() { return null; } I've taken care to follow the instructions for deploying a custom build of a core plugin from the Jenkins plugin tutorial, and I've also tried rebooting the machine that Jenkins is running on, all to no avail. I'm clearly missing something vital, but I can't figure out what it could be. What else do I need to do to make the plugin not display the Environment Variables link?
downvote count: 0
tagged with: java
tagged with: jenkins-plugins
type: Question
answer count: 2
upvote count: 6
has answer: http://stackoverflow.com/a/26597412
has title: How do I modify a Jenkins plugin to stop it from putting a link on build pages?
favorite count: 0
tagged with: jenkins

http://stackoverflow.com/comment/41716892
has text: can you post the code for your Entity?
comment on: http://stackoverflow.com/q/26492183
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26434905
tagged with: java
tagged with: file
type: Question
has title: Can't copy internal file to user's computer
accepted answer: http://stackoverflow.com/a/26438515
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41514518
has comment: http://stackoverflow.com/comment/41514660
has body: I have a program that requires that an internal file (DICTIONARY) be copied to the user's computer into the folder defined like so: private static final String DIC_NAME = "WordHelp.dic"; private static final String DIC_FOLDER = System.getProperty("user.home"); private static final String PATH_SEP = System.getProperty("file.separator"); public static final String DICTIONARY = DIC_FOLDER + PATH_SEP + DIC_NAME; Here's what works on MY computer, where all the Java stuff is: public static void createDictionaryIfNecessary() throws IOException{ Path out_path = FileSystems.getDefault().getPath(DICTIONARY); boolean dic_exists = Files.exists(out_path, new LinkOption[]{LinkOption.NOFOLLOW_LINKS}); if(dic_exists) return; File file = new File("src/dictionary"); // here's problem for user ************ Path in_path = file.toPath(); try { Files.copy(in_path, out_path, REPLACE_EXISTING, COPY_ATTRIBUTES, NOFOLLOW_LINKS); } catch (IOException e) { JOptionPane.showMessageDialog(null, e); } } But user gets this error: java.nio.file.NoSuchFileException: src\dictionary SOURCE file (internal to .jar file) can't be found. If I look at in_path while debugging, the value is: (sun.nio.fs.Windowspath) src/dictionary And below is a bunch of info about in_path: This all works on MY computer and I could have sworn that it ONCE worked on a user's computer... How should I define file (see line with ********** to enable copying internal file (src/dictionary) onto a user's computer? Here's Netbeans project view:
has answer: http://stackoverflow.com/a/26438515
type: AnsweredQuestion

http://stackoverflow.com/comment/41453928
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26402229
type: QuestionComment
has text: In Android you use xml to provide layouts and other resources used by your java files.

http://stackoverflow.com/q/26477692
has answer: http://stackoverflow.com/a/35886544
tagged with: macos
favorite count: 0
has answer: http://stackoverflow.com/a/33119953
has comment: http://stackoverflow.com/comment/46918566
has comment: http://stackoverflow.com/comment/41683319
linked to: http://stackoverflow.com/q/14341865
has comment: http://stackoverflow.com/comment/41696613
score: 32
has body: I used to have Eclipse configured well and work fine before. But I just uninstalled it and installed Eclipse Juno again on my Mac OS 10.10 today. But I kept getting this error: "The specified JRE does not exist." I know it's a pretty simple and commonly seen problem, I just needed to install JRE and/or JDK into this clean Eclipse, however things didn't get work out. And I've searched extensively on Stack Overflow: The posts I've looked at including: How to install JRE 1.7 on Mac OS X and use it with Eclipse? I followed exactly what the accepted answer said, but after having downloaded the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html and installed it, I was going to add it to Eclipse via Preferences -> Java -> Installed JREs, however, I didn't see it as expected, the following is a screenshot of what I saw when I went to Preferences -> Java -> Installed JREs But the screenshot just says the installed JREs list is BLANK, I couldn't add any JRE into my Eclipse. Help please? Also, I've tried other things that people have suggested: Properties -> Java Build Path what I see here is: JRE System Library OSGi/Minimum-1.2 with a red crossing sign in front of it (indicating something wrong with it?) So, I'm also blocked with this approach.
upvote count: 32
has answer: http://stackoverflow.com/a/57707639
linked to: http://stackoverflow.com/q/10352715
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11170263
accepted answer: http://stackoverflow.com/a/26559889
tagged with: java
tagged with: eclipse
type: Question
answer count: 8
downvote count: 0
has answer: http://stackoverflow.com/a/43999119
has title: Eclipse: The specified JRE installation does not exist
has answer: http://stackoverflow.com/a/57088575
has answer: http://stackoverflow.com/a/31693702
possible better answer: http://stackoverflow.com/a/37914655
has answer: http://stackoverflow.com/a/37914655
tagged with: android
has answer: http://stackoverflow.com/a/26559889
tagged with: osx-yosemite

http://stackoverflow.com/comment/41888051
has text: If I remember correctly on my Mac Java 6 did not support 24 bit output, this was changed in Java 7 - so you may get further with Java 7 or 8.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26455240

http://stackoverflow.com/comment/41697998
type: Comment
type: QuestionComment
has text: When you say "at once", do you mean "at the same time"? Rather than trying to coordinate distinct timers for each beans, can you instead create a single timer that invokes a method on all the individual beans?
score: 0
comment on: http://stackoverflow.com/q/26436027

http://stackoverflow.com/a/26429338
has comment: http://stackoverflow.com/comment/41714002
has comment: http://stackoverflow.com/comment/41521152
answers question: http://stackoverflow.com/q/26423014
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26423014
has comment: http://stackoverflow.com/comment/41545981
has comment: http://stackoverflow.com/comment/41543588
has comment: http://stackoverflow.com/comment/41525631
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Background: The GLSurfaceView surface is a completely independent layer, composited by the system, not the app. It will either appear above or below all Views, and cannot be sandwiched between them. There are three possible Z-orderings relative to the View layer, two below and one above. Grafika's "multi-surface test" demonstrates multiple overlapping transparent SurfaceView surfaces, sharing the screen with Views. By default, the surface appears behind the View, which appears to be what you want. If you're not seeing the GLSurfaceView surface, it's probably because the View on top of it has an opaque background. My guess is that the default UI theme is different between your different devices, and one is providing transparency while another isn't. On API 14+, the framework provides a way to intermix Views and surfaces, using TextureView. Using GLES with a TextureView isn't much harder than GLSurfaceView -- you just have to do your own EGL setup. Grafika's GLES library demonstrates how to do this.
has comment: http://stackoverflow.com/comment/41521276
type: Answer
has comment: http://stackoverflow.com/comment/41547831

http://stackoverflow.com/q/26394864
duplicate of: http://stackoverflow.com/q/153724
score: 0
has comment: http://stackoverflow.com/comment/41442508
has answer: http://stackoverflow.com/a/26395020
answer count: 1
has title: Rounding to a certain decimal place and rounding to ceil or floor
linked to: http://stackoverflow.com/q/153724
has comment: http://stackoverflow.com/comment/41441860
has comment: http://stackoverflow.com/comment/41442149
accepted answer: http://stackoverflow.com/a/26395020
type: AnsweredQuestion
tagged with: numbers
has comment: http://stackoverflow.com/comment/41441808
has body: private static double round (double value, int precision) { int scale = (int) Math.pow(10, precision); return (double) Math.round(value * scale) / scale; } I would like this code to not only be able to round to any given decimal place, but also to either always round up or down, this could be given as another paramter. But I am having trouble with how to implement this. For example, I want to round 11.1436 to 11.15. Please help.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41442259
tagged with: rounding

http://stackoverflow.com/comment/41485574
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26419538
score: 0
has text: Why don't you use a `BufferedReader` instead?

http://stackoverflow.com/a/26450353
upvote count: 1
answers question: http://stackoverflow.com/q/26445795
score: 1
accepted answer of: http://stackoverflow.com/q/26445795
type: AcceptedAnswer
downvote count: 0
has body: I think for this you can use following code , It worked for me. It will start your activity after 10 seconds. new Handler().postDelay(new Runnable() { @Override public void run() { Start Your activity here. } }, 10000); but one of the best solution will be (I just found it from develoer site): new CountDownTimer(10000, 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { strat your activity here. } }.start();
type: Answer

javafx
tags question: http://stackoverflow.com/q/26394701
tags question: http://stackoverflow.com/q/26432404
type: Tag
tags question: http://stackoverflow.com/q/26406313
tags question: http://stackoverflow.com/q/26473613
tags question: http://stackoverflow.com/q/26471270
tags question: http://stackoverflow.com/q/26447451
tags question: http://stackoverflow.com/q/26502636
tags question: http://stackoverflow.com/q/26367457
tags question: http://stackoverflow.com/q/26506401
tags question: http://stackoverflow.com/q/26466079
tags question: http://stackoverflow.com/q/26385618
tags question: http://stackoverflow.com/q/26366354
tags question: http://stackoverflow.com/q/26420683
tags question: http://stackoverflow.com/q/26386028
tags question: http://stackoverflow.com/q/26457611
tags question: http://stackoverflow.com/q/26411415
tags question: http://stackoverflow.com/q/26445088
tags question: http://stackoverflow.com/q/26361559
tags question: http://stackoverflow.com/q/26446808
tags question: http://stackoverflow.com/q/26471605
tags question: http://stackoverflow.com/q/26513720
tags question: http://stackoverflow.com/q/26453531
tags question: http://stackoverflow.com/q/26497006
tag name: javafx
tags question: http://stackoverflow.com/q/26451990
tags question: http://stackoverflow.com/q/26379809
tags question: http://stackoverflow.com/q/26439042
tags question: http://stackoverflow.com/q/26494865
tags question: http://stackoverflow.com/q/26373130
tags question: http://stackoverflow.com/q/26474481
tags question: http://stackoverflow.com/q/26369227
tags question: http://stackoverflow.com/q/26482047
tags question: http://stackoverflow.com/q/26384028
tags question: http://stackoverflow.com/q/26420773
tags question: http://stackoverflow.com/q/26481242
tags question: http://stackoverflow.com/q/26473087
tags question: http://stackoverflow.com/q/26439728
tags question: http://stackoverflow.com/q/26490403
tags question: http://stackoverflow.com/q/26414820
tags question: http://stackoverflow.com/q/26392333
tags question: http://stackoverflow.com/q/26360380
tags question: http://stackoverflow.com/q/26389072
tags question: http://stackoverflow.com/q/26512518
tags question: http://stackoverflow.com/q/26434481
tags question: http://stackoverflow.com/q/26453484
tags question: http://stackoverflow.com/q/26378999
tags question: http://stackoverflow.com/q/26467090
tags question: http://stackoverflow.com/q/26448474
tags question: http://stackoverflow.com/q/26487402
tags question: http://stackoverflow.com/q/26433919

http://stackoverflow.com/q/26398915
type: Question
tagged with: recursion
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26399721
answer count: 3
has comment: http://stackoverflow.com/comment/41448472
downvote count: 1
has answer: http://stackoverflow.com/a/26399658
favorite count: 0
has comment: http://stackoverflow.com/comment/41449082
has comment: http://stackoverflow.com/comment/41448749
has comment: http://stackoverflow.com/comment/41449057
has title: Java implementation power function With Recursion Efficiently
has comment: http://stackoverflow.com/comment/41448635
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/28207648
accepted answer: http://stackoverflow.com/a/28207648
has comment: http://stackoverflow.com/comment/41449846
has body: We should try long for this sort of methods long genericPow(int base,int exp){ if(exp==0)return 1; if(exp==1)return base; if(exp==2)return base*base; if(exp==3)return base*base*base; return genericPow(base, 3)*genericPow(base, exp-3); } For instance, if you want to compute x^15, the method of exponentiation by squaring will give you: x^14 = (x^3)*(x^11) x^11 = (x^3)*(x^8) x^8 = (x^3)*(x^5) x^5 = (x^3)*(x^2) x^3 = x*x*x thus it will turn down the loop complexity by 3.
possible better answer: http://stackoverflow.com/a/26399658

http://stackoverflow.com/comment/41399876
score: 0
type: Comment
type: QuestionComment
has text: The prime symbol is used for feet, and double prime for inches. They are often represented in ASCII with single and double quotes. You have them backwards in your question.
comment on: http://stackoverflow.com/q/26371070

http://stackoverflow.com/comment/41424943
score: 0
has text: @ChristianSisti I assumed you knew, but wasn't entirely sure so thought it would help. Glad `SSS` solved the problem :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26385211

http://stackoverflow.com/q/26469256
tagged with: hbase
type: UnansweredQuestion
has title: exception like Check the value configured in 'zookeeper.znode.parent'
has body: I'm using hbase0.94.3, hadoop-2.2.0 and jdk 1.7.71 version. Everything was working fine. Now, all of a sudden HBase is failing to start. At first I got error: ERROR zookeeper.RecoverableZooKeeper: ZooKeeper exists failed after 3 retries 14/10/17 20:27:44 WARN zookeeper.ZKUtil: hconnection Unable to set watcher on znode /hbase/master Then I started the zookeeper service (in bin of hbase hbase-daemon start zookeeper) and re-installed the operating system itself. Then started getting 14/10/17 20:35:38 ERROR client.HConnectionManager$HConnectionImplem Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master. In HBase shell after running command list, I get the above mentioned error. In the net I found one solution HBase Error : zookeeper.znode.parent mismatch zookeeper.znode.parent /hbase-unsecure I added the above mentioned configuration in hbase-site.xml. I am still facing the same error. Kindly help me to resolve the issue.
linked to: http://stackoverflow.com/q/24008207
score: 3
downvote count: 0
tagged with: java
type: Question
tagged with: hadoop
tagged with: apache-zookeeper
upvote count: 3
favorite count: 0
answer count: 0

http://stackoverflow.com/q/26416596
has comment: http://stackoverflow.com/comment/41480426
has comment: http://stackoverflow.com/comment/41481460
has body: Which would be considered the better practice(if any) between using the less/greater than or equal to- and using the less/greater than operator? For instance, if I want to test whether an integer is in a specific range, like between 5- and 10 inclusive, if(integerNumber &gt;= 5 &amp;&amp; integerNumber &lt;= 10){ \\do something } versus if(integerNumber &gt; 4 &amp;&amp; integerNumber &lt; 11){ \\do something } Is one considered to be the preferred practice? EDIT: I am not asking for an alternative method for checking numbers in a range, my question concerns the practice of using &gt;= &lt;= VS &gt; &lt;.
has title: Better Practice: Less\greater than or equal to- OR less\greater than operator
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41481290
has comment: http://stackoverflow.com/comment/41481218
has comment: http://stackoverflow.com/comment/41481160
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41480684
linked to: http://stackoverflow.com/q/10988968
upvote count: 1
has comment: http://stackoverflow.com/comment/41480583
answer count: 1
has answer: http://stackoverflow.com/a/26416669
downvote count: 1
has comment: http://stackoverflow.com/comment/41480458
duplicate of: http://stackoverflow.com/q/10988968
has comment: http://stackoverflow.com/comment/41480536
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41481142
has comment: http://stackoverflow.com/comment/41480633

http://stackoverflow.com/q/26361722
has body: I'm new in Java. I've ran a toolkit in Ubuntu. to run the toolkit, i must export Apache Ant, Apache HADOOP , SWIG and another source code. So, i want to compile the source code in Eclipse. The source code contains these files: -Bin -Class -Data: it contains *.itg files -Lib: it contains .jar files -Scripts: Two files contain *.pl and shell script A file contains *.py and *.sh A file contains *.sh , *.pl and .py A file contains files that include *.cpp, .pl,.pm -Build.xml -Logging.properties please help me, which compilers can compile these codes?
tagged with: java
has comment: http://stackoverflow.com/comment/41381306
type: Question
tagged with: hadoop
tagged with: apache
tagged with: ant
tagged with: compilation
accepted answer: http://stackoverflow.com/a/26362210
score: 0
answer count: 1
has title: how can i compile a source code that contains different types?
has answer: http://stackoverflow.com/a/26362210
type: AnsweredQuestion

http://stackoverflow.com/comment/41369644
comment on: http://stackoverflow.com/q/26355232
type: QuestionComment
score: 0
has text: You find it strange that the exception gets thrown? `and all finally clauses of those try statements can complete normally` that describes this behavior.
type: Comment

http://stackoverflow.com/a/26474446
has comment: http://stackoverflow.com/comment/41586928
has comment: http://stackoverflow.com/comment/41586794
score: -1
has comment: http://stackoverflow.com/comment/41588175
upvote count: 0
has body: try this : try { ConexionBd(); System.out.println("rut "+rut); System.out.println("estado "+estado); if(conexion!=null){ PreparedStatement enunciado = conexion.prepareStatement("update alumno set alu_estado = ? " + "where alu_rut = ? ;"); }else{ System.out.println("conexion not initialized (null)"); } enunciado.setString(1, rut); enunciado.setString(2, estado); enunciado.execute(); conexion.close(); return 1; } catch (SQLException e) { return 0; }
type: Answer
has comment: http://stackoverflow.com/comment/41594982
answers question: http://stackoverflow.com/q/26474139
downvote count: 1
has comment: http://stackoverflow.com/comment/41587003
has comment: http://stackoverflow.com/comment/41588228

http://stackoverflow.com/q/26479798
type: AnsweredQuestion
has title: How to find File ID of Uploaded Doc using Google API
has body: Below is the code I am using to upload a file using Java. File is getting uploaded, but I want to know the File ID of uploaded file? URL feedUrl = new URL("https://docs.google.com/feeds/default/private/full/"); DocsService docService = new DocsService("Doc"); docService.setUserCredentials("email@gmail.com","password"); DocumentListEntry uploadFile = new DocumentListEntry(); uploadFile.setTitle(new PlainTextConstruct("FileName")); uploadFile.setFile(new File("/path/test.csv"), "text/plain"); uploadFile = docService.insert(feedUrl, uploadFile); How to find the File ID of uploaded file? I wanted to upload a doc &amp; share it using Google API.
type: Question
has answer: http://stackoverflow.com/a/27013642
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/27013642
tagged with: google-sheets
answer count: 1
tagged with: google-docs-api
tagged with: google-drive-api

http://stackoverflow.com/q/26375128
has answer: http://stackoverflow.com/a/26375322
tagged with: java
tagged with: loops
type: Question
type: AnsweredQuestion
has body: My goal is to build a pyramid as such: I am supposed to use a loop (for or while) to get this effect. I have accomplished this with the following code: package finalprob1; public class FinalProb1 { public static void main(String[] args) { int row = 1; int input = 6; int rowcount = 11; int blocknum = 1, blockperrow = 1; while (row &lt;= rowcount) { while(blocknum &lt; blockperrow) { System.out.print(input * blocknum + " "); blocknum = blocknum +1 ; } blocknum = 1; System.out.println(); blockperrow = blockperrow + 1; row = row +1; } } // END OF MAIN } // END OF CLASS The code is very messy.. I am sure that there is a very simple way to get this done with two loops but I cant seem to figure it out. any help would be greatly appreciated.
accepted answer: http://stackoverflow.com/a/26375195
score: 0
answer count: 3
tagged with: for-loop
has title: Loop tuning- I need to re-write this Java program snippet
has answer: http://stackoverflow.com/a/26375244
tagged with: while-loop
has comment: http://stackoverflow.com/comment/41406369
possible better answer: http://stackoverflow.com/a/26375244
has answer: http://stackoverflow.com/a/26375195

persistence
tags question: http://stackoverflow.com/q/26409737
tag name: persistence
type: Tag
tags question: http://stackoverflow.com/q/26452742
tags question: http://stackoverflow.com/q/26367983
tags question: http://stackoverflow.com/q/26387539

http://stackoverflow.com/comment/41566474
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26463876
has text: Me too. Hope that helps (i think we have kind of a race-condition here ;-) )
type: Comment

http://stackoverflow.com/q/26491184
favorite count: 0
has answer: http://stackoverflow.com/a/27917901
tagged with: android
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26491824
score: 1
tagged with: java
has title: ActivityOptions returns NoClassDefFoundError on some android versions
type: Question
answer count: 2
upvote count: 1
has body: I developed an android app with ACRA for crash reporting. I got some crashes when trying to make an animation for startActivity(). I know that ActivityOptions is not supported before API 16, so I added a check for the android version when the app starts. This is a snippet of Wheel.java: public static void ini() { sdk = android.os.Build.VERSION.SDK_INT; if(sdk &lt; android.os.Build.VERSION_CODES.JELLY_BEAN) api16 = true; else api16 = false; } public static boolean isAPI16() { return api16; } @SuppressLint("NewApi") public static Bundle getNextAnimation(Context context) { Bundle animation = null; if(isAr()) animation = ActivityOptions.makeCustomAnimation(context, R.anim.rtl_enter, R.anim.rtl_exit).toBundle(); else animation = ActivityOptions.makeCustomAnimation(context, R.anim.ltr_enter, R.anim.ltr_exit).toBundle(); return animation; } And this is how I used it all over my app: if(Wheel.isAPI16()) startActivity(i); else startActivity(i, Wheel.getNextAnimation(getApplicationContext())); That code gave me those crashes: Android Version Phone Error 4.0.3 samsung samsung GT-N7000 java.lang.NoClassDefFoundError: android.app.ActivityOptions : at com.nasseralsalmi.wheel.Wheel.getNextAnimation(Wheel.java:103) 4.0.4 HTC htc_ara HTC One X java.lang.NoClassDefFoundError: android.app.ActivityOptions : at com.nasseralsalmi.wheel.Wheel.getNextAnimation(Wheel.java:101) Then I tried to fix it like this: api16 = false; try { Bundle animation = ActivityOptions.makeCustomAnimation(context, R.anim.rtl_enter, R.anim.rtl_exit).toBundle(); } catch (Exception e) // NoClassDefFoundError { api16 = true; } Unfortunately: Android Version Phone Error 4.0.4 samsung google Galaxy Nexus java.lang.NoClassDefFoundError: android.app.ActivityOptions : at com.nasseralsalmi.wheel.Wheel.ini(Wheel.java:50)

http://stackoverflow.com/comment/41654738
has text: just increasing the heap with Xmx should do the trick. Have you monitored your heap size with jvisualvm to see how much heap your app gets and what is using it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26511903

http://stackoverflow.com/a/26474444
downvote count: 0
has body: Null pointer exceptions occur when you are trying to refer to an object, say you're calling a method of that object, thinking the object exists but during the runtime the object doesn't exist at all. For all the possibilities in the code where an object could be null depending on the runtime scenarios you have to put a null pointer check. I have tried to put some null pointer checks in your code, take a look below. I have also tried to correct your code a little, but it can be improved further as well. In the below code, I'm assuming conexion is a class level variable getting initialized outside of the given method. One quick note, when it's about Null pointer exceptions, you cannot be sure of anything that goes at runtime :) public int actualizarEstadoAlumno(String rut,String estado) { try { ConexionBd(); System.out.println("rut "+rut); System.out.println("estado "+estado); if(conexion!=null){ PreparedStatement enunciado = conexion.prepareStatement("update alumno set alu_estado = ? " + "where alu_rut = ? ;"); if(enunciado!=null){ enunciado.setString(1, rut); enunciado.setString(2, estado); enunciado.execute(); return 1; } } } catch (SQLException sqlEx) { //return 0; This isn't a good way to handle exception. How will you know that SQL Exception has occurred? You need to handle the exceptions/weird things your code can run into. //log exception, use logger //print stack trace, handle the exception or throw it } catch (Exception ex){ //log exception, use logger //print stack trace, handle the exception or throw it }finally{ conexion.close(); // this is why finally was born. } }
has comment: http://stackoverflow.com/comment/41590062
type: Answer
has comment: http://stackoverflow.com/comment/41590181
accepted answer of: http://stackoverflow.com/q/26474139
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26474139
has comment: http://stackoverflow.com/comment/41586861
has comment: http://stackoverflow.com/comment/41586991
has comment: http://stackoverflow.com/comment/41586749
type: AcceptedAnswer

http://stackoverflow.com/q/26499583
downvote count: 0
possible better answer: http://stackoverflow.com/a/26499596
tagged with: replace
tagged with: char
has answer: http://stackoverflow.com/a/26499633
score: 1
tagged with: string
answer count: 4
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26499609
has answer: http://stackoverflow.com/a/26499606
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26499633
has title: How to replace some character in a string with a single character of type char?
tagged with: java
has answer: http://stackoverflow.com/a/26499596
has body: As an example I have abcdbab and I want to replace all ab with A. The output is AcdbA. I try this one but it gives an error. char N = 65; String S = "abcdbab"; S = S.replaceAll("ab", N); System.out.print(S); Is there any method to do this?
type: Question

http://stackoverflow.com/comment/41576583
type: Comment
type: QuestionComment
has text: It is simple good practice to do so. The same to encapsulate members with private and access only thru getter/setter, catch Exception properly, etc, etc. All that stuff we know we should do and we don't.
comment on: http://stackoverflow.com/q/26469408
score: 0

http://stackoverflow.com/comment/41497380
comment on: http://stackoverflow.com/q/26426083
score: 0
has text: Are you executing that insert as a native query? Because IMO you're mixing JPA and SQL in a way that's not really needed, and that makes things complicated. Also, you should only apply @Id to [field of certain types](http://docs.oracle.com/javaee/6/api/javax/persistence/Id.html)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/100094466
type: AnswerComment
score: 0
type: Comment
has text: @CamHart Taken directly from oracle docs. https://docs.oracle.com/javaee/7/api/javax/json/JsonReader.html
comment on: http://stackoverflow.com/a/52115443

http://stackoverflow.com/q/26480064
type: Question
has answer: http://stackoverflow.com/a/26637959
upvote count: 5
linked to: http://stackoverflow.com/q/25385173
tagged with: java
has comment: http://stackoverflow.com/comment/41596257
has answer: http://stackoverflow.com/a/26480140
has answer: http://stackoverflow.com/a/26481226
has comment: http://stackoverflow.com/comment/41635259
has answer: http://stackoverflow.com/a/26480141
favorite count: 0
has body: I'm trying to answer project Euler #10, which is to find the sum of primes between 1-2000000. Every time I run my code, it gives me 0, and I can't figure out why. public static boolean isPrime (int n) { double a = Math.sqrt(n); for(int i = 1; i &lt; a; i++){ if(n % i == 0){ return false; } } return true; } public static void main (String[] args) { long sum = 0; for(int i = 2; i &lt; 2000000; i++){ if(isPrime(i)==true){ sum+= i; } } System.out.println(sum); }
answer count: 5
has answer: http://stackoverflow.com/a/26480144
score: 2
type: UnansweredQuestion
downvote count: 3
tagged with: primes
has title: Sum of Primes - why does my code return 0?

http://stackoverflow.com/comment/41448095
type: Comment
has text: @GaryTsui I'm not sure what is B-tree sorry
comment on: http://stackoverflow.com/q/26398393
score: 0
type: QuestionComment

http://stackoverflow.com/a/26532568
upvote count: 1
has body: try this ObjectMapper objectMapper = new ObjectMapper(); try { Unit[] unit = objectMapper.readValue(jsonString, Unit[].class); Log.i("TEST", String.valueOf(unit.length)+" ******* "+unit[1].getUnitEmail()+" ******* "+unit[1].getUnitName()); // or List&lt;Unit&gt; unit1 = objectMapper.readValue(jsonString, new TypeReference&lt;List&lt;Unit&gt;&gt;() { }); Log.i("TEST_1", String.valueOf(unit1.size())+" ****11111*** "+unit1.get(1).getUnitEmail()+" **1111111**** "+unit1.get(1).getUnitName()); } catch (IOException e) { e.printStackTrace(); }
downvote count: 0
answers question: http://stackoverflow.com/q/26502867
score: 1
type: Answer

http://stackoverflow.com/comment/41515597
comment on: http://stackoverflow.com/q/26435429
score: 0
has text: Also instead of just binary (which would work), the fan-out could be for each letter (e.g a..z). I added a link to my previous comment to Wikipedia.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26401525
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26401216
downvote count: 0
has body: I'm guessing you're trying to parse a csv line. Your "," is both the separator and a character within your cells. Maybe try to parse the line using https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVParser.html the csv parser - then you can replace the , in each string with spaces after the splitting.

http://stackoverflow.com/comment/41559070
type: QuestionComment
has text: Did you enable the plugin's rule(s) on your quality profile(s)?
comment on: http://stackoverflow.com/q/26440330
score: 0
type: Comment

http://stackoverflow.com/q/26464371
downvote count: 0
answer count: 3
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has body: I have the following line in my maven.properties file. MY_VARIABLE = www.google.com My pom file code looks like this src/test/resources true org.apache.maven.plugins maven-failsafe-plugin 2.16 validate read-project-properties **/*Test*.java **/*Tests*.java **/Test*.java src/test/resources/maven.properties <systemPropertyVariables> ${MY_VARIABLE} </systemPropertyVariables> org.apache.maven.plugins maven-surefire-plugin 2.16 And finally i have a piece of code to retrieve the value in the message variable. public static String getMsg() { final String msg = System.getProperty("message"); if (StringUtils.isEmpty(msg) || url.startsWith("${")) { return "Empty message"; } return msg; } So when i am calling the getMsg() method, it always returns the value of msg as Empty Message. Is it some error in the pom.xml declaration or is it some problem in the getMsg() function that is being used. It would be nice of someone could throw some light on this. Thanks in advance ....
has answer: http://stackoverflow.com/a/26500937
has title: Java unable to read variables from pom
has answer: http://stackoverflow.com/a/26464647
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26464589

http://stackoverflow.com/comment/41397087
score: 0
type: AnswerComment
type: Comment
has text: theString is the original string entered at the start of the program. It is what I am trying to count the characters in
comment on: http://stackoverflow.com/a/26369931

http://stackoverflow.com/comment/41637257
has text: I'm fairly certain this.getArtist() did the trick, since it is now working after doing a full Run of the Main Project. Not sure why it wasn't immediately after doing your suggestion. So, thanks! [http://i.imgur.com/OWExf2R.png](http://i.imgur.com/OWExf2R.png)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26502543

http://stackoverflow.com/comment/41498540
type: QuestionComment
type: Comment
score: 0
has text: @MarkoTopolnik So the **and** means: "in combination with" and not "as well as" - is that right? So the metadata need to be declared in front of a collection and not in front of a symbol. `(def m ^:static [1 2 3 4])` works, while `(def ^:static m [1 2 3 4])` does not work.
comment on: http://stackoverflow.com/q/26425098

searchactivity
tag name: searchactivity
tags question: http://stackoverflow.com/q/26450290
type: Tag

catch-block
tag name: catch-block
type: Tag
tags question: http://stackoverflow.com/q/26460992
tags question: http://stackoverflow.com/q/26421668

http://stackoverflow.com/q/26429672
possible better answer: http://stackoverflow.com/a/64376473
has answer: http://stackoverflow.com/a/64376473
has comment: http://stackoverflow.com/comment/41504233
favorite count: 0
tagged with: multithreading
tagged with: interruption
has answer: http://stackoverflow.com/a/26430210
has comment: http://stackoverflow.com/comment/41504724
type: AnsweredQuestion
score: 3
tagged with: interrupted-exception
tagged with: java
accepted answer: http://stackoverflow.com/a/26430210
tagged with: concurrency
has body: I am testing InterruptedException with the following test code: Runnable runMe = new Runnable() { @Override public void run() { for(int i=0; i&lt;6; i++) { System.out.println("i = "+i); if(i==3) { System.out.println("i==3, Thread = " +Thread.currentThread().getId()); //I invoke interrupt() on the working thread. Thread.currentThread().interrupt(); try { Thread.currentThread().join(); } catch (InterruptedException e) { //I caught InterruptedException System.out.println(Thread.currentThread().getId() + " is interrupted!"); Thread.currentThread().interrupt(); } } } } }; Thread workingThread = new Thread(runMe); workingThread.start(); try { workingThread.join(); } catch (InterruptedException e) { //Swallow } //the following log shows me workingThread.isInterrupted() is false, why? System.out.println("workingThread(" + workingThread.getId()+") interrupted ? " + workingThread.isInterrupted()); In run() , I interrupt() current working thread, and caught a InterruptedException. In main thread, my last line of code is a System.out.println(...) which prints out the interrupt status of working thread. Since I have caught InterruptedException in run(), I though I should get the message that workingThread.isInterrupted() is true, but I got false, why?
downvote count: 1
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/23930189
has title: Thread is interrupted by calling interrupt(), but Thread.isInterrupted() returns false
has comment: http://stackoverflow.com/comment/41505241
answer count: 2

http://stackoverflow.com/a/26506033
has body: I believe you are referring to the System Tray in Java, have a look at this tutorial provided by Oracle: http://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html.
has comment: http://stackoverflow.com/comment/41644626
score: 2
answers question: http://stackoverflow.com/q/26505815
upvote count: 2
has comment: http://stackoverflow.com/comment/41645644
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41644360

http://stackoverflow.com/comment/41369306
type: QuestionComment
score: 3
has text: _Please provide data of your text file._
comment on: http://stackoverflow.com/q/26355115
type: Comment

http://stackoverflow.com/q/26495337
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41624257
linked to: http://stackoverflow.com/q/9029795
tagged with: java
has comment: http://stackoverflow.com/comment/41624041
has comment: http://stackoverflow.com/comment/41625704
has comment: http://stackoverflow.com/comment/41624111
has answer: http://stackoverflow.com/a/26495646
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/41625475
type: Question
has title: Can I change the text of a label from a Thread in Java?
accepted answer: http://stackoverflow.com/a/26495646
tagged with: jlabel
has comment: http://stackoverflow.com/comment/43129389
has comment: http://stackoverflow.com/comment/41624078
score: 0
tagged with: multithreading
upvote count: 1
tagged with: swing
has body: I have another question for this forum. I am writing a small application with Java in which I have multiple Threads. I have two Threads that are in two different classes. I have one Thread (thread1) dedicated to defining all of the JFrame components. (JPanels, JButtons, ActionListeners, etc.) In another Thread, (thread2) I am checking for a variable (v) to equal a certain value. (98) When this variables does change to equal 98, that same thread is supposed to update a JLabel. (Let's call this label label for now.) It does not. Is there something I am doing wrong. I have tried writing a method for the class - that declares all of the JFrame components - that changes the text of label, but when I call this method from thread2 it does not update the label. I have tried calling a super class containing thread1, but that did not seem to make a difference. Also, I have been calling the repaint() method, but that does not seem to help. Please let me know what I can do to update these JLabels from the two different Threads. Thanks in advance, ~Rane Code: Class1: JFrame frame = new JFrame(); JPanel panel = new JPanel(); JLabel label = new JLabel("V does not equal 98 Yet..."); Thread thread1 = new Thread(){ public void run(){ panel.add(label); frame.add(panel); System.out.println("Components added!"); } }); public void setLabelText(String text){ label.setText(text); } Class1=2: v = 0; Thread thread2 = new Thread(){ public void run(){ while(v &lt; 98){ System.out.println("V equals -" + v + "-."); v ++; } Class1 otherClass = new Class1(); otherClass.label.setText("V is now equal to: " + v); otherClass.repaint(); otherClass.setLabelText("V is now equal to: " + v); otherClass.repaint(); } });

http://stackoverflow.com/comment/41638583
has text: What do you mean by "Address have employeeList with LazyInitializingException". Did you mean employeeList in address is lazily initialized.
comment on: http://stackoverflow.com/q/26502944
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26488252
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/41610667
has body: I have a REST Client written on Jersey. It uses JAXB and JAX-RS. But when I try to add jar file with client to my Android application it crushes with error like this: java.lang.NoClassDefFoundError: javax.ws.rs.client.ClientBuilder Seams that Android actually doesn't support JAX-RS. Or maybe I'm wrong?
type: Question
score: 2
has title: Android and JAX-RS
answer count: 1
downvote count: 0
tagged with: rest
tagged with: android
tagged with: jax-rs
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33278480

http://stackoverflow.com/a/26367192
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26366858
answers question: http://stackoverflow.com/q/26366858
has comment: http://stackoverflow.com/comment/41391916
has comment: http://stackoverflow.com/comment/41391841
has body: Closing scanner will close underlying stream (System.in). So next time you create scanner on System.in which is closed, you will get such exception. Create scanner at start of program, use it everywhere and close it at end of program. Like: static Scanner scan; static int displayMenu(){ // display menu. return scan.nextInt(); } public static void main(String [] args){ scan = new Scanner(System.in); // start work. // end of work. scan.close(); } Check this: http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#close()

http://stackoverflow.com/q/26450019
score: 0
answer count: 1
tagged with: arrays
has body: I am making a Calculator and have the classes called addition, subtraction, multiplication and division and another class called Calculation and need them all to take the data from Calculation and then change it's Operator an example of the code: public static void addition(){ calculation(); //imports calculation for(int counter=0; counter &lt; list.size(); counter++){ answer += list.get(counter); } System.out.println("The sum of these numbers is " + answer); } I simplified my Calculation class so it's easier to understand: public static void calculation(){ List&lt;Double&gt; list = new ArrayList&lt;Double&gt;(); do{ list.add(scan.nextDouble()); }while(true) After this I want to be able to use the List in my Addition class yet I keep getting errors on list that say "list cannot be resolved" and it wants me to create a local variable. I want it to take the list from Calculation and then allow me to change it's outcome. How can I allow it to use 'list' in my Addition class?
has answer: http://stackoverflow.com/a/26450068
tagged with: list
type: AnsweredQuestion
has title: How to call on something from another class in Java and use it's Array?
tagged with: java
accepted answer: http://stackoverflow.com/a/26450068
type: Question

http://stackoverflow.com/comment/41524806
type: Comment
has text: the file has values 1,2,3,4 the output was absolutely blank..
comment on: http://stackoverflow.com/a/26440508
type: AnswerComment
score: 0

http://stackoverflow.com/a/26366126
accepted answer of: http://stackoverflow.com/q/26366046
has body: One difference: The Mod operator in VBScript always returns an integer. Java's % operator can return a fractional value. So 5.2 Mod 2 evaluates to 1 in VBScript, but 5.2 % 2 evaluates to 1.2 in Java. Edit: Based on your edit, this appears to be the Luhn algorithm. The only real problem with the Java code is a typo; nothing to do with the mod operator. Here you assign a variable currrentNumber (with a triple R): currrentNumber = Integer.valueOf(currentNumberString); Then you use a different variable (double R): Integer ModNumber = currentNumber * 2; Edit: Another difference is that because VBScript string indices start at 1, and Java string indices start at 0, the code is using different alternate digits. Either If (i mod 2) &lt;&gt; 0 should be If (i mod 2) = 0, or if (i % 2 != 0) should be if (i % 2 == 0), I'm not sure which.
has comment: http://stackoverflow.com/comment/41433247
has comment: http://stackoverflow.com/comment/41435587
has comment: http://stackoverflow.com/comment/41435678
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41434748
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26366046

http://stackoverflow.com/a/26387861
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41430319
type: Answer
has body: It's simply to do with Joda-time library. compareTime method will looks like: /** * @param time1 dateFrom in millis. E.g. returned by System.currentTimeMillis() * @param time2 dateTo in millis * @param mHour hours in your time zone * @param mMinute minutes in your time zone */ public static boolean compareTime(long time1, long time2, int mHour, int mMinute) { final LocalTime timeFrom = new LocalTime(time1); final LocalTime timeTo = new LocalTime(time2); final LocalTime time = new LocalTime(mHour, mMinute); final boolean isSameDay = timeFrom.isBefore(timeTo); // it is correct, because (time2 - time1 &lt; 24 hours) return isSameDay ? (time.isAfter(timeFrom) &amp;&amp; time.isBefore(timeTo)) : (time.isAfter(timeFrom) || time.isBefore(timeTo)); }
has comment: http://stackoverflow.com/comment/41433359
upvote count: 1
answers question: http://stackoverflow.com/q/26375469
accepted answer of: http://stackoverflow.com/q/26375469

http://stackoverflow.com/a/26471757
has body: So I found out how to do this: 1) I needed to uncomment a dependency in the pom.xml file: com.atlassian.jira jira-core ${jira.version} provided 2) I looked at this this post here: https://answers.atlassian.com/questions/9390368/adding-field-screens-programatically-in-a-plugin
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26412525
type: Answer
answers question: http://stackoverflow.com/q/26412525

http://stackoverflow.com/q/26362470
score: 0
has comment: http://stackoverflow.com/comment/41384769
answer count: 1
type: UnansweredQuestion
has body: I have two entities with oneToMany releationship: @Entity @Table(name="FATHER") @Audited(withModifiedFlag=true) @XmlType public class Father{ @Column(name="FATHER_ID") private Long id; @OneToMany(fetch = FetchType.EAGER, mappedBy = "father", orphanRemoval = true, cascade = {CascadeType.ALL}) List&lt;Son&gt; childrens; //getter and setter for id, only getter for childrens. } @Table(name="CHILDREN") @Entity @Audited(withModifiedFlag=true) public class Children{ @Column(name="CHILDREN_ID") private Long id; @ManyToOne @JoinColumn(name = "FATHER_ID", nullable = false, insertable = false, updatable = false) private Father father; } Now in the Father DAO i want to remove all children using this: Father persistentFather = entityManager.find(Father.class, fatherId); persistentFather.getChildrens().clear(); entityManager.merge(persistentFather); And i'm getting the following exception: 3:51:17 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [appServlet] in context with path [/sample.web] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL into ("MYDB"."CHILDREN_AUD"."FATHER_ID") Why can't hibernate understand the father_id from the father object ? Should i have a father_id field in Children ? I know that nothing is special here but i couldn't find any solution after searching for couple of hours... Hope someone can help
has comment: http://stackoverflow.com/comment/41383981
has answer: http://stackoverflow.com/a/26363241
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has title: hibernate one to many remove list

http://stackoverflow.com/q/26384146
has title: How to avoid lock exception in informix
upvote count: 3
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27418820
tagged with: java
has body: I have one table of uuid which contains four columns: id, uuid, used(true/false) and version for optimistic locking. There are about 10000 records. When I want to insert new person to table person I read first not used uuid from table. Then I update this records that is already used and insert new person. But when I run performance test I have problem with table uuid and with selecting or updating records. There are lot of timeout lock ISAM error: Caused by: java.sql.SQLException: ISAM error: Lock Timeout Expired at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413) ~[ifxjdbc.jar:?] at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3982) ~[ifxjdbc.jar:?] at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2698) ~[ifxjdbc.jar:?] at com.informix.jdbcx.IfxXASqli.receiveMessage(IfxXASqli.java:116) ~[ifxjdbcx.jar:?] at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:939) ~[ifxjdbc.jar:?] at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:304) ~[ifxjdbc.jar:?] at com.informix.jdbc.IfxStatement.c(IfxStatement.java:1283) ~[ifxjdbc.jar:?] at com.informix.jdbc.IfxPreparedStatement.executeUpdate(IfxPreparedStatement.java:421) ~[ifxjdbc.jar:?] at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteUpdate(WSJdbcPreparedStatement.java:1187) ~[com.ibm.ws.runtime.jar:?] at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeUpdate(WSJdbcPreparedStatement.java:804) ~[com.ibm.ws.runtime.jar:?] How can I avoid this exception ? Isolation level in webshere is set to TRANSACTION_READ_COMMITTED lock mode wait is set to 2s and table has row lock
type: Question
accepted answer: http://stackoverflow.com/a/27418820
has comment: http://stackoverflow.com/comment/42743751
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
tagged with: informix

http://stackoverflow.com/q/26473841
score: 1
tagged with: httpurlconnection
favorite count: 0
type: Question
tagged with: android
tagged with: java
upvote count: 1
has body: I'm trying to setDoOutput in my HttpURLConnection but i keep getting this damn exception, and i dont know what to do because the code is basically a CTRL+C/V from around the web!!! check this it out: url = new URL(Constants.Shared.API_URL+"registration"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true);//BOOM! Right after i execute conn.setDoOutput i get a free ticket to the catch block, and the exception is java.lang.IllegalStateException: Already connected!!! The funny is that even google documentation (see Posting Content part) tells me to do as i am doing!!! What am i doing wrong here?!? Edit1: Stack Trace [java.net.URLConnection.checkNotConnected(URLConnection.java:464), java.net.URLConnection.setDoOutput(URLConnection.java:878), br.com.aec.acs.service.IntegracaoService.RegisterCloudUser(IntegracaoService.java:118), br.com.aec.acs.service.IdentityService.RegisterNewACS(IdentityService.java:49), br.com.aec.acs.RegistrationActivity.ButtonOkClicked(RegistrationActivity.java:40), br.com.aec.acs.RegistrationActivity_$1.onClick(RegistrationActivity_.java:52), android.view.View.performClick(View.java:4240), android.view.View$PerformClick.run(View.java:17721), android.os.Handler.handleCallback(Handler.java:730), android.os.Handler.dispatchMessage(Handler.java:92), android.os.Looper.loop(Looper.java:137), android.app.ActivityThread.main(ActivityThread.java:5103), java.lang.reflect.Method.invokeNative(Native Method), java.lang.reflect.Method.invoke(Method.java:525), com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737), com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553), dalvik.system.NativeStart.main(Native Method)]
has title: IllegalStateException: Already connected right after openConnection
has comment: http://stackoverflow.com/comment/41585553
answer count: 0
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/41618150
tagged with: urlconnection

http://stackoverflow.com/comment/41623823
type: AnswerComment
score: 0
type: Comment
has text: I am all for ignoring optimization in favor of readability, especially when the compiler can handle the optimization. Hence the question. But if you have an array of 500,000 elements, that's 1,000,000 unnecessary method invocations and, to calculate a mean 1,000,000 * 500,000 unnecessary calculations (accumulator += array[inx]). I think this is worth some consideration.
comment on: http://stackoverflow.com/a/26494774

http://stackoverflow.com/q/26360160
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/41381886
has title: Spring Roo project failed to run with Spring 4.1
type: Question
has body: I have created a spring project with spring roo 1.2.5 and I changed the in the pom.xml file to 4.1.1.RELEASE. The project failed to start with the following error from the tomcat 8 server: 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 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#0': Cannot create inner bean '(inner bean)#bc1b9c' of type [org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#bc1b9c': Cannot resolve reference to bean 'applicationConversionService' while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.test.test.web.ApplicationConversionServiceFactoryBean] for bean with name 'applicationConversionService' defined in ServletContext resource [/WEB-INF/spring/webmvc-config.xml]; nested exception is java.lang.ClassNotFoundException: com.test.test.web.ApplicationConversionServiceFactoryBean Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.test.test.web.ApplicationConversionServiceFactoryBean] for bean with name 'applicationConversionService' defined in ServletContext resource [/WEB-INF/spring/webmvc-config.xml]; nested exception is java.lang.ClassNotFoundException: com.test.test.web.ApplicationConversionServiceFactoryBean at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:548) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCap…
tagged with: beancreationexception
has answer: http://stackoverflow.com/a/26361684
has comment: http://stackoverflow.com/comment/41378268
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41382114
tagged with: spring-roo
has answer: http://stackoverflow.com/a/37845969

http://stackoverflow.com/a/26457732
type: Answer
has body: Start an internal data model for the object at the startElement event which represents the object. Accumulate data for the object in variables/data-structures in your program. When you reach the endElement for that object, use the data you've stored to construct/configure the object. If the objects can be nested, you may need to maintain a context stack. If they're related in other ways, you may have to map IDs and IDREFs to references to those objects. Many examples can be found on the web. Several competing semi-standard representations exist, plus a whole bunch of custom approaches.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26457604
answers question: http://stackoverflow.com/q/26457604

http://stackoverflow.com/a/26377003
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You have Scanner variable named scan and you are using it as input.nextLong() so in that sense your input is obviously undefined for the compiler. You have to change it to input. Scanner input = new Scanner(System.in);
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26376968
answers question: http://stackoverflow.com/q/26376968

http://stackoverflow.com/a/26375465
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26375411
has body: You do not need to declare this variables inside the loop because you have already declared them. Just remove String before those lines: for(int i = 0; i &lt; matrix.length; i++) { for(int j = 0; j &lt; matrix[i].length; j++) { strElement = String.valueOf(matrix[i][j]); strRow = strRow + strElement + "\t"; } strMatrix = strMatrix + strRow + "\n"; } return strMatrix;

http://stackoverflow.com/q/26447451
has body: Following is my code. Everything is fine. I can load a remote page. I can put HTML content but my img tag shows a X sign meaning that it is not able to load the images. Note: My images are located in the same package along with the class JavaFX in a folder Smiley and I can list all the images which means there is not problem with the path. import java.awt.BorderLayout; import java.io.File; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class JavaFX { static WebView webView; static WebEngine webEngine; static String imgs = ""; public JavaFX() { File f = new File(getClass().getResource("/Smiley").getFile()); for (File fs : f.listFiles()) { imgs += " "; } System.out.println(imgs); } private void initAndShowGUI() { // This method is invoked on Swing thread JFrame frame = new JFrame("FX"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel, BorderLayout.CENTER); frame.setVisible(true); frame.setSize(800, 800); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); } private void initFX(final JFXPanel fxPanel) { Group group = new Group(); Scene scene = new Scene(group); fxPanel.setScene(scene); webView = new WebView(); group.getChildren().add(webView); webEngine = webView.getEngine(); webEngine.loadContent(" "+imgs+" "); } public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JavaFX fx = new JavaFX(); fx.initAndShowGUI(); } }); } } Following is output
upvote count: 3
answer count: 3
favorite count: 0
tagged with: javafx-webengine
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26451382
possible better answer: http://stackoverflow.com/a/26450104
has answer: http://stackoverflow.com/a/26451542
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26451542
downvote count: 0
tagged with: javafx
tagged with: webview
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26450104
has title: JavaFX: in WebView img tag is not loading local images

http://stackoverflow.com/q/26407203
has comment: http://stackoverflow.com/comment/41463279
has body: I have seen in the link(http://bigocheatsheet.com/) the complexity for insertion sort is same as bubble sort, and also heap sort is better than both these two. But when I created a sample program and compared the time taken insertion sort is unbelievable. Class Used to test the sorting algorithms. public class TestSorts { public static void main(String[] args) { System.out.println("starting"); Calendar startInstance = null; Calendar endInstance = null; //Getting the array to sort startInstance= Calendar.getInstance(); //int[] arrayToSort = ArrayClass.getArray(1000); int[] arrayToSort = ArrayClass.getWorstArray(10000000); endInstance= Calendar.getInstance(); long timeTakenToGetArray = endInstance.getTimeInMillis()- startInstance.getTimeInMillis(); System.out.println("StartTime : "+startInstance.getTimeInMillis()); System.out.println("EndTime : "+endInstance.getTimeInMillis()); System.out.println("TimeTakenToGetArray : "+timeTakenToGetArray); //Bubble Sort startInstance= Calendar.getInstance(); int[] bubbleSorted = BubbleSort.sort(arrayToSort); endInstance= Calendar.getInstance(); long timeTakenBubble = endInstance.getTimeInMillis() - startInstance.getTimeInMillis(); System.out.println("StartTime : "+startInstance.getTimeInMillis()); System.out.println("EndTime : "+endInstance.getTimeInMillis()); System.out.println("Bubble : "+timeTakenBubble); //InsertionSort startInstance= Calendar.getInstance(); int[] insertionSorted = InsertionSort.sort(arrayToSort); endInstance= Calendar.getInstance(); long timeTakenInsertion = endInstance.getTimeInMillis() - startInstance.getTimeInMillis(); System.out.println("StartTime : "+startInstance.getTimeInMillis()); System.out.println("EndTime : "+endInstance.getTimeInMillis()); System.out.println("Insertion : "+timeTakenInsertion); //HeapSort startInstance= Calendar.getInstance(); int[] heapSorted = HeapSort.sort(arrayToSort); endInstance= Calendar.getInstance(); long timeTakenHeap = endInstance.getTimeInMillis() - startInstance.getTime…
accepted answer: http://stackoverflow.com/a/26407377
possible better answer: http://stackoverflow.com/a/26407378
upvote count: 1
has answer: http://stackoverflow.com/a/26408038
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41463243
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/41463531
type: Question
tagged with: algorithm
tagged with: sorting
score: 0
answer count: 3
has title: Why is Insertion Sort faster than Bubble Sort and Heap Sort in practice?
has answer: http://stackoverflow.com/a/26407378
has answer: http://stackoverflow.com/a/26407377
favorite count: 0

http://stackoverflow.com/a/26436309
answers question: http://stackoverflow.com/q/26436223
has body: The error you're seeing is caused by having an incorrect classpath. I'm assuming that when you compiled the class, you somehow provided a classpath (either by passing the '-classpath' arg or by setting the 'CLASSPATH' environment variable). The problem is that the compilation classpath is separate from the runtime classpath. So, you just need to ensure that all of the dependencies (other jar files, most likely) that were on the classpath when you compiled the class are also added to the classpath when running the jar. For a jar file, this is typically done by adding a 'Class-Path'header to the manifest. An alternative method would be to specify the classpath using either the command line arg or the environment variable and include your Example2.jar file in that classpath, and run java Example2 (without the '-jar').
score: 0
has comment: http://stackoverflow.com/comment/41517541
has comment: http://stackoverflow.com/comment/41517200
type: Answer

http://stackoverflow.com/comment/41501579
type: Comment
type: QuestionComment
has text: I created a totally new project and re-tried running the project without touching anything. Finally, my phone showed up and the program displayed perfectly. However, I'm still curious as to what I did to deserve all those errors.
comment on: http://stackoverflow.com/q/26427966
score: 0

http://stackoverflow.com/a/26357961
type: Answer
has body: Short answer : You won't be able to magically convert your node.js Javascript code to Java. However : You could have a look at Nodyn, which allows you to run Node.js apps on the JVM and helps Node integrating with existing Java apps. I haven't tested it but it seems very serious.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42206217
upvote count: 1
answers question: http://stackoverflow.com/q/26357833

hash
tags question: http://stackoverflow.com/q/26495918
tags question: http://stackoverflow.com/q/26372725
tags question: http://stackoverflow.com/q/26410622
type: Tag
tags question: http://stackoverflow.com/q/26414211
tag name: hash

http://stackoverflow.com/comment/41514518
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26434905
has text: You should open it as a resource if it's bundled in the apps classpath.

http://stackoverflow.com/a/26453924
score: 1
has comment: http://stackoverflow.com/comment/41549029
downvote count: 0
has comment: http://stackoverflow.com/comment/41548826
answers question: http://stackoverflow.com/q/26453894
has body: You don't use String concatenation. Try changing from: con = DriverManager.getConnection("url+dbName,UserId=?&amp;password=?"); To: con = DriverManager.getConnection(url + dbName, UserId, password);
type: Answer
upvote count: 1

http://stackoverflow.com/q/26378452
has answer: http://stackoverflow.com/a/26378642
upvote count: 1
accepted answer: http://stackoverflow.com/a/26378642
has body: I have xlsx with this date in cell: 03-09-2014 when I read xlsx cell using apache POI, it writes this: 41883.0. This is the way how I do that: while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); cell.setCellType(Cell.CELL_TYPE_STRING); System.out.print(cell.getStringCellValue() + ";"); } Since I have converted all cells to become type of String, I would expect no deformation of the date... Any solution? apache poi DataFormatter on cell containing date This is the solution :)
favorite count: 0
tagged with: apache-poi
linked to: http://stackoverflow.com/q/16891181
tagged with: excel
type: AnsweredQuestion
has title: XLSX custom date format read as String
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 1
tagged with: http://stackoverflow.com/tag/xlsx

http://stackoverflow.com/q/26427436
has answer: http://stackoverflow.com/a/26427558
accepted answer: http://stackoverflow.com/a/26427558
downvote count: 0
tagged with: io
answer count: 1
favorite count: 0
tagged with: blocking
has title: available and read: can we actually be nonblocking while using blocking Java I/O?
linked to: http://stackoverflow.com/q/3695372
has body: Based on this question I would like to ask the following. Assuming blocking I/O and I have a piece of code like the following: byte[] data = new byte[10]; someInputStream.read(data) This code snippet is going to block in the read call until it has some bytes to read. I'm familiar that read might actually read less bytes and the number of bytes read is going to be returned by the read method. My question is this. Assume I have: byte[] data = new byte[10]; if (someInputeStream.available() &gt;= 10) { someInputStream.read(data); // *** } Is *** line guaranteed to not block? Again, I'm aware that this read might still read less than 10 bytes.
type: AnsweredQuestion
score: 2
tagged with: nonblocking
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/a/26510694
upvote count: 27
has body: Your configuration starts with &lt;Configuration status="debug" ... Change this to &lt;Configuration status="warn" ... and you will only see WARN-level internal log4j messages (which is probably what you want).
accepted answer of: http://stackoverflow.com/q/26505468
answers question: http://stackoverflow.com/q/26505468
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 27

client-server
tags question: http://stackoverflow.com/q/26456071
tags question: http://stackoverflow.com/q/26382660
type: Tag
tags question: http://stackoverflow.com/q/26505854
tags question: http://stackoverflow.com/q/26418069
tags question: http://stackoverflow.com/q/26437834
tag name: client-server

http://stackoverflow.com/a/26469554
type: Answer
score: 0
has body: There is no need to mention layout.findViewById(R.id.EditText); You can simply refer the id of view i.e EditText view. EditText Text = (EditText) findViewById(R.id.EditText); String string = Text.getText().toString();
answers question: http://stackoverflow.com/q/26469346
has comment: http://stackoverflow.com/comment/41576772

http://stackoverflow.com/q/26506249
tagged with: java
tagged with: cad
type: Question
tagged with: cnc
has body: I'm evaluating the possibilities to track tool movement using nc programs in different formats as input. Using a lexer to tokenize the different program types into a meta layer, where only uniform tools and points, etc. exist seemed like a good idea. But, I don't know anything about lexical analysis. Is there an easy way to create a lexer? Maybe out of an EBNF? What do you think about my approach, do you see a more viable way to extract the data and support multiple nc file formats? Additional information The information on which concrete type of NC program is provided is known beforehand. I don't have to check the syntax of the NC program. I assume that they are valid, since they are already used in production.
has title: Lexer for CAD NC programs
has answer: http://stackoverflow.com/a/26508866
accepted answer: http://stackoverflow.com/a/26508866
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41645650
tagged with: jflex
has comment: http://stackoverflow.com/comment/41646573
type: AnsweredQuestion
tagged with: lexer

http://stackoverflow.com/a/26374909
has body: First of all this is not compile. Long userRole = new Long(-1); userRole = 8; // can't assign int to Long You can change this to serRole = (long) 8; Or userRole = 8L; Then come to other part. Long userRole = new Long(-1); userRole = 9L; boolean showSave=true; if (userRole != 8&amp;&amp;userRole!=7) { // userRole is not equal to 8 and 7 then showSave = false; } System.out.println(showSave); You should use &amp;&amp; not || Out put: false
accepted answer of: http://stackoverflow.com/q/26374838
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26374838
downvote count: 0

http://stackoverflow.com/q/26405950
has answer: http://stackoverflow.com/a/26406332
type: UnansweredQuestion
score: -3
tagged with: web-services
has answer: http://stackoverflow.com/a/26406285
tagged with: java
has answer: http://stackoverflow.com/a/26406289
has body: I am very new to web service world. Here is the my problem: I have a set of servers running in UNIX and a gateway(running in tomcat) which uses some wsdl files. The gateway converts the soap request from external client into the api transaction which is server understandable format. The gateway returns back the soap reply. Could you tell me how to test the whole gateway? The external client we haven't developed till now.
type: Question
downvote count: 6
upvote count: 3
answer count: 3
tagged with: soap
has title: What is the best way of testing web service gateway?
favorite count: 0
tagged with: soapui

http://stackoverflow.com/comment/41584547
has text: try rename ldapSetup to ldapDirectoryContext
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26473333
score: 0

http://stackoverflow.com/comment/72800283
type: AnswerComment
type: Comment
has text: Instead of using `VoidWork`, I found it much simpler to start the unit test with `Closeable ofy = ObjectifyService.begin()` and after each asynchronous save, close the ofy service and open a new one through `ofy.close(); ofy = ObjectifyService.begin();`
comment on: http://stackoverflow.com/a/26367410
score: 0

http://stackoverflow.com/q/26495441
has answer: http://stackoverflow.com/a/26496903
has comment: http://stackoverflow.com/comment/41624204
has body: In the web application I am testing I have a list of elements that are displayed on a page. Depending on the number of elements in the list, the list becomes paginated. The pagination is like this: If there is 1 page no pagination occurs. If there are 2 pages a next (>) button appear at the bottom of the page. If there are 3 or more pages, besides the next button(>) there will also be a last page button (>>). I am currently using the following method to make sure that I always get to the last page of the list. I need this to then assert that the element I created is displayed since the element is always on the last page. It works just fine but my problem is that when my tests reach this points, it takes about 20 seconds to run through this statement and since I use it on all tests it greatly slows down my testing process. Is there a quicker method for the case I described? public void jumpToLastPage(){ List&lt;WebElement&gt; lastPage = driver.findElements(locator for last page button)); if (lastPage.size() == 0){ List&lt;WebElement&gt; nextPage = driver.findElements(locator for next page button)); if(nextPage.size() &gt;= 1){ nextPage.get(0).click(); } } else lastPage.get(0).click(); }
has title: What would be a faster method for handling pagination?
type: UnansweredQuestion
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/41639952
tagged with: java
tagged with: pagination
tagged with: selenium
has comment: http://stackoverflow.com/comment/41626010
has comment: http://stackoverflow.com/comment/41637108
type: Question
has comment: http://stackoverflow.com/comment/41633945
answer count: 2
has comment: http://stackoverflow.com/comment/41634136
has comment: http://stackoverflow.com/comment/41624351
has comment: http://stackoverflow.com/comment/41624315
score: 0
has answer: http://stackoverflow.com/a/26510488

http://stackoverflow.com/comment/41660359
type: QuestionComment
comment on: http://stackoverflow.com/q/26507479
score: 0
type: Comment
has text: @laalto : can you please see if I am inserting and retrieving values correctly?

http://stackoverflow.com/q/26429967
has answer: http://stackoverflow.com/a/30956481
tagged with: spring-security
favorite count: 0
has title: How to get a reference to SessionAuthenticationStrategy without configuring the strategy explicit?
answer count: 4
upvote count: 11
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/64581309
score: 11
tagged with: spring
has answer: http://stackoverflow.com/a/39715342
has answer: http://stackoverflow.com/a/26455611
type: Question
has answer: http://stackoverflow.com/a/26583562
tagged with: java
downvote count: 0
has body: In a Spring Security 3.2 based application I have a explicit configured UsernamePasswordAuthenticationFilter, that need an reference to the sessionAuthenticationStrategy (in order to invoke .onAuthentication).* The sessionAuthenticationStrategy is the default one created by &lt;security:http&gt; (HttpSecurityBeanDefinitionParser). My question: Is how can I get an reference to the SessionAuthenticationStrategy without configuring the complete SessionAuthenticationStrategy explicite, so that I can inject this reference in XML configuration? &lt;security:http auto-config="false" use-expressions="true" entry-point-ref="loginUrlAuthenticationEntryPoint" access-decision-manager-ref="httpAccessDecisionManager"&gt; ... &lt;security:custom-filter ref="usernamePasswordAuthenticationFilter" position="FORM_LOGIN_FILTER"/&gt; ... &lt;/security:http&gt; ... &lt;bean id="usernamePasswordAuthenticationFilter" class=" o.s.scurity.web.authentication.UsernamePasswordAuthenticationFilter"&gt; &lt;property name="sessionAuthenticationStrategy" ref="????"&gt; &lt;!-- ?? -&gt; ... &lt;/bean&gt; *my real UsernamePasswordAuthenticationFilter is a customized subclass, but that should not matter for this question

scenebuilder
tags question: http://stackoverflow.com/q/26420683
type: Tag
tags question: http://stackoverflow.com/q/26490403
tag name: scenebuilder

http://stackoverflow.com/comment/41601711
score: 0
has text: I don't understand. You want to add a panel _under_ the `container` (therefore making `conatainer` like an overlay)? Please elaborate. You don't have much context in your description. If you mean _under_ position-wise, then you must consider that call `add` with the default BorderLayout will add the CENTER, if position is not specified. So when you `add` another, it kicks out the `container`. If you want a second panel below it, use `add(secondPanel, BorderLayout.PAGE_END)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26483178

http://stackoverflow.com/q/26436804
answer count: 2
tagged with: version
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26437294
has body: I know this sounds like an odd "problem" but stick with me. I have a graphics card which supports OpenGL 3.3. However, I am writing code to target OpenGL 2.0 and therefore GLSL version 1.1. I have the following GLSL code: #version 110 in vec4 position; // x,y,z,w (ignores w) uniform mat4 mvpMatrix; void main() { gl_Position = mvpMatrix * position; } As you can see, I have specified the GLSL version to be #version 110. You might also notice that I use the 'in' keyword for the vec4 position. This keyword is not available in the version of GLSL that's specified but it compiles without error on my graphics card (which again, supports OpenGL 3.3). The correct keyword should be 'attribute'. When tested on a computer that only has OpenGL 2.1 the shader code gets a compile error. Why does my compiler not also compile with an error? Shouldn't it being compiling the shaders with version 110 compliance and report the appropriate error? Is there anyway to check for this? Maybe it's a warning or something? I don't know. Help! Also, I am programming in Java using LWJGL. If that helps any, but I don't think it has anything to do with the problem. Edit: I added code to always check the info log after a shader compile and it still doesn't report anything when using the 'in' keyword.
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: glsl
type: Question
has answer: http://stackoverflow.com/a/26441200
tagged with: opengl
has title: OpenGL GLSL code is compiling when it shouldn't be
tagged with: java
tagged with: compilation

http://stackoverflow.com/comment/41535095
score: 1
comment on: http://stackoverflow.com/q/26446263
type: Comment
type: QuestionComment
has text: What your asking for is a 'transpose' method for a 2D array. As far as I know, Java doesn't have a method for that readily available, but writing one yourself should be easy. Create a new 2D array and fill it in with the values you have there.

http://stackoverflow.com/a/26461938
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26386008
has body: The chart has a series array property, you should remove the series you do not want to display from this array. There is no built in support for this behaviour.

http://stackoverflow.com/comment/41447031
type: AnswerComment
comment on: http://stackoverflow.com/a/26397693
type: Comment
has text: HotelB2BDomainPrefix is an inner class of HotelDomainPrefixUtil
score: 0

http://stackoverflow.com/q/26447519
downvote count: 0
has answer: http://stackoverflow.com/a/26459973
answer count: 3
has answer: http://stackoverflow.com/a/26452029
favorite count: 0
tagged with: netbeans-8
tagged with: netbeans
has body: I was accustomed to using GlassFish server all the times. I'm migrating a Java EE application from GlassFish (4.0) to WildFly 8.1.0 final. I tried using WildFly 8.1.0 final on NetBeans 8.0 using this plugin for the server, since there was no built-in plugin for the server. Unlike GlassFish, the application is however, not deployed on saving project data even though the deploy on save option on the IDE is enabled. The application leads to very strange/unknown/unusual problems. For example, this question is full of (merely) some of those problems. I upgraded NetBeans to 8.0.1 (with JSF to 2.2.8-02) which has a built-in WildFly-Plugin but it also brought all most no difference anyway than the previous version of the IDE. In this comment of a bug report, it is mentioned that a fix was made by changing/adding some XML corresponding to a JDBC driver as follows, com.mysql.jdbc.jdbc2.optional.MysqlDataSource I also made this change to the standalone-full.xml file. This particular part looks like as follows. jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE h2 sa sa jdbc:mysql://localhost:3306/projectdb com.mysql.jdbc.Driver mysql 5 15 root root false false <share-prepared-statements>false</share-prepared-statements> org.h2.jdbcx.JdbcDataSource com.mysql.jdbc.jdbc2.optional.MysqlDataSource But all in vain. Doing so made nothing new. Anyway, is it possible to use WildFly (8.1.0 or higher, whenever available) with NetBeans for now (maybe by making somewhere some changes)? It appears that I'm almost left with staying away with WildFly for now. Is it? :) I do not precisely know whether the plugin is the problem or not. It might be something different. Update : It took me at least three weeks to encounter this situation. So, please do not think that the entire thing I wrote here is wrong/meaningless, if you could not reproduce the same thing just within a moment (as mentioned in the linked question - including the strike-through text) - I just cannot say anything more abo…
type: UnansweredQuestion
tagged with: wildfly
has answer: http://stackoverflow.com/a/33668052
has title: Using the WildFly application server with NetBeans IDE
tagged with: java
type: Question
score: 5
upvote count: 5
tagged with: wildfly-8
linked to: http://stackoverflow.com/q/26433574

http://stackoverflow.com/comment/41456748
type: AnswerComment
score: 0
has text: This is more a comment, than an answer. Provide more information, why you think that his approach would be the best.
type: Comment
comment on: http://stackoverflow.com/a/26403879

http://stackoverflow.com/q/26474909
has comment: http://stackoverflow.com/comment/41591280
favorite count: 0
linked to: http://stackoverflow.com/q/22240328
linked to: http://stackoverflow.com/q/10836832
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/10055336
tagged with: http://stackoverflow.com/tag/gif
tagged with: java
linked to: http://stackoverflow.com/q/22188940
tagged with: image
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26521381
has body: Hello, I have a gif in a JFrame. It all works fine except the gif is frozen on the first time as though it is an jpeg or png. Also, the stackoverflow is telling me I need to add more details even though I have added all the details required in order to state my problem, so feel free to ignore this. Here is the code: import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.io.*; import javax.imageio.*; import javax.swing.*; public class LoadImageApp extends Component { BufferedImage img; public void paint(Graphics g) { g.drawImage(img, 0, 0, this); } public LoadImageApp() { try { img = ImageIO.read(new File("spooky.gif")); } catch (IOException e) { } } public Dimension getPreferredSize() { if (img == null) { return new Dimension(100,100); } else { return new Dimension(img.getWidth(null), img.getHeight(null)); } } public static void main(String[] args) { JFrame f = new JFrame("Load Image Sample"); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e) { System.exit(0); } }); f.add(new LoadImageApp()); f.pack(); f.setVisible(true); } }
score: 0
upvote count: 1
downvote count: 1
has title: Gif not playing in JFrame
has answer: http://stackoverflow.com/a/26524194

http://stackoverflow.com/comment/41445766
type: QuestionComment
score: 0
has text: Does the screenshot shows 7 times the ECG I values that you have listed in the beginning, or there are also other points used for drawing that (screenshot)? In short: should the 7 heartbeats look the same?
comment on: http://stackoverflow.com/q/26397261
type: Comment

http://stackoverflow.com/a/26404863
accepted answer of: http://stackoverflow.com/q/26404538
answers question: http://stackoverflow.com/q/26404538
type: AcceptedAnswer
downvote count: 0
has body: The attribut "title" of the book should be public or you must annotate his getter like this: @JsonProperty("title") public String getTitle() { return title; }
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/41398071
has text: @Gagravarr, I will search for it, because I am not familiar to those Apache POI converters. Totally new in this. Do you have any tutorial that you recommend?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26369824
type: QuestionComment

http://stackoverflow.com/q/26409773
type: Question
tagged with: java
has title: standard Java class that takes java.lang.Readable as input parameter?
score: 0
has body: I have a class (high performance file reader) that implements java.lang.Readable. how can I make use of it? I have found zero classes in the JDK that take a Readable as input (e.g., to convert it into something more generally useful). does such a thing exist? Background: I wrote a simple CSV reader that I would like to improve the performance of. Then I found a class from another project that maintains 2 buffers, writes to one of those buffers in a background thread, then flips to the other buffer once the first is full, and does the same. From the outside is looks like any other Readable, but the wonderful magical thing about it is this background thread makes sure that you are almost always reading from memory when you access this Readable. I want that. (At present my CSV reader uses a BufferedReader, and hence uses the Reader interface) thanks in advance!
has comment: http://stackoverflow.com/comment/41467973
answer count: 1
has comment: http://stackoverflow.com/comment/41468288
has comment: http://stackoverflow.com/comment/41468469
type: UnansweredQuestion
tagged with: io
has comment: http://stackoverflow.com/comment/41469005
has comment: http://stackoverflow.com/comment/41468887
has comment: http://stackoverflow.com/comment/41468989
has answer: http://stackoverflow.com/a/32644489
has comment: http://stackoverflow.com/comment/41468402

http://stackoverflow.com/q/26416332
has answer: http://stackoverflow.com/a/26418549
upvote count: 1
has answer: http://stackoverflow.com/a/26421991
accepted answer: http://stackoverflow.com/a/26421991
favorite count: 0
has answer: http://stackoverflow.com/a/26418700
tagged with: android
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/26416546
type: Question
has title: Parsing JSON using GSON in java and populating a list view
has body: I realize my questions have been asked a lot but I have spent a considerable amount of time scouring both SO and google trying to get a better understanding of this concept with no success. I've seen many different implementations, which is what leads me to get some advice about my specific situation. MY OBJECTIVE I need to perform a post request to a php file and the goal is to ultimately populate fields in a list activity with some of the json data. HTTP POST RESPONSE Here is the format of the response data I'm getting back from the server, which appears to be a JSON object of arrays(?). {"expense":[{"cat_id_PK":237,"cat_name":"Name1","cat_amount":"100.00","is_recurring":0}, {"cat_id_PK":238,"cat_name":"Name2","cat_amount":"200.00","is_recurring":0}, {"cat_id_PK":239,"cat_name":"Name3","cat_amount":"300.00","is_recurring":0}, {"cat_id_PK":240,"cat_name":"Name4","cat_amount":"400.00","is_recurring":0}], "expense_rec": [{"cat_id_PK":207,"cat_name":"Name5","cat_amount":"500.00","is_recurring":1}]} FIRST QUESTION The code below is what I'm using to read the response. Is this how I should be handling that? It seems weird to get a json encoded response and then change it to a string, only to try and access elements of a json object again. Am I on the wrong track here? //This code is in the doInBackground method of my "sendPostRequest" async task. HttpResponse httpResponse = httpClient.execute(httpPost); InputStream inputStream = httpResponse.getEntity().getContent(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); StringBuilder stringBuilder = new StringBuilder(); String bufferedStrChunk = null; while ((bufferedStrChunk = bufferedReader.readLine()) != null) { stringBuilder.append(bufferedStrChunk); } //Returns string to onPostExecute() return stringBuilder.toString(); SECOND QUESTION I have another file called "PostResponse.java" that holds the following code I modeled after…
possible better answer: http://stackoverflow.com/a/26418700

http://stackoverflow.com/q/26473951
has title: Eclipse IDE upgrade from Kepler to Luna went very bad
has comment: http://stackoverflow.com/comment/41585531
has comment: http://stackoverflow.com/comment/41585333
linked to: http://stackoverflow.com/q/11263423
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41585548
has comment: http://stackoverflow.com/comment/41591906
answer count: 2
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/29742924
has comment: http://stackoverflow.com/comment/41591718
has answer: http://stackoverflow.com/a/26474402
accepted answer: http://stackoverflow.com/a/26474402
tagged with: eclipse-kepler
type: AnsweredQuestion
downvote count: 0
tagged with: eclipse-luna
score: 1
tagged with: java
has body: I upgraded my Eclipse IDE for Java developers from Kepler to Luna using the worst possible upgrade feature of Eclipse and it messed up my current workspace totally. I added the update site for Luna - http://download.eclipse.org/eclipse/updates/4.4 and selected all and installed. Then it took an hour to figure out the conflicts and finally when it installed, my Eclipse is behaving very erratic. I can see welcome screen changed and couple of new menu items. Eclipse market place is gone, I don't know how to get it back. Intermittent freezes forcing me to restart. My Grails setup is gone and I can't install from Market was gone. Can anybody suggest what is the right procedure to upgrade? (I read the wiki and it doesn't work) and I am looking for methods that actually worked for you. These are the times I some times cringe in pain and crave for a managed or paid IDE, as a simple task like "upgrade" should be so damn easy and click of a button"
type: Question
has answer: http://stackoverflow.com/a/29742924

http://stackoverflow.com/a/26511787
score: 0
has body: Concurrency bugs like this are sometimes hard to reproduce on single-socket hardware since the time during which core see different values at memory locations is short, due to shared (L3) caches. On multi-socket server hardware, it may be easier since the time to synchronize memory across nodes is longer. This is also what limits scalability on larger machines. If you develop and test on small machines, but run on big iron, this will bite you a lot. Anyway, this is a classic concurrency trap and easily avoided by using final, as you and others have mentioned. So, you may see it easier/more often on multi-socket hardware, but there is of course no guarantee.
type: Answer
has comment: http://stackoverflow.com/comment/41676081
answers question: http://stackoverflow.com/q/26507130

http://stackoverflow.com/a/26454683
has comment: http://stackoverflow.com/comment/41550738
type: AcceptedAnswer
has body: You are mistaken by the way how JFrames work. A JFrame does not stall the execution of the code until it is closed. So, basically, your code creates a JFrame and then grabs the filePath variable in that object, before the user could have possibly specified a file. So, to solve this, move the code that outputs the filepath to stdout to the ActionListener you have. Get rid of the System.exit() call, and use dispose() instead. Update: You should have this code for the ActionListener: this.button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { filePath = new String(textArea.getText()); if(filePath == null){ System.out.println("String is null."); } else { System.out.println(filePath); } dispose(); } }); And as main method: public static void main(String[] args) { FileBrowser x = new FileBrowser(); }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26454539
has comment: http://stackoverflow.com/comment/41550844
answers question: http://stackoverflow.com/q/26454539
type: Answer
has comment: http://stackoverflow.com/comment/41550554
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41551841
has comment: http://stackoverflow.com/comment/41551829
has comment: http://stackoverflow.com/comment/41550910
has comment: http://stackoverflow.com/comment/41550766

http://stackoverflow.com/a/26457631
has comment: http://stackoverflow.com/comment/41563307
score: 0
has body: public class Main { public static void main(String[] args) { char[] keyArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; char[] valueArray = {'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'p', 'q', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'}; String myString = "abcxyz"; char[] myStringArray = myString.toCharArray(); for(int x = 0; x&lt;myString.length(); x++) { for(int i = 0; i&lt;keyArray.length; i++) { if(myStringArray[x] == keyArray[i]) { //System.out.println(valueArray[i]); would give the output "zyxcba" as expected myStringArray[x] = valueArray[i]; // this will only change the characters in the first half of keyArray break; //Introduced break so that when the answer is set, break and move to the next iteration of myStringArray } } } System.out.println(myStringArray); //Outputs "abccba" instead of "zyxcba" } } I introduced break in between to control when the item is matched. There are many other ways of making this optimal though. But the main thing is you should not make x*i comparison when it is not required.
has comment: http://stackoverflow.com/comment/41555424
has comment: http://stackoverflow.com/comment/41593416
type: Answer
has comment: http://stackoverflow.com/comment/41738790
answers question: http://stackoverflow.com/q/26457381

http://stackoverflow.com/comment/41381306
has text: You have tons of diferents languages here... .jar are packaged java programms, .py are python scrypt, .sh are shell script, .pl are perl script and .cpp are C++ sources files. I don't really anderstand what you are doing
comment on: http://stackoverflow.com/q/26361722
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26460013
upvote count: 26
has answer: http://stackoverflow.com/a/26469983
favorite count: 0
type: UnansweredQuestion
has title: ANTLR4 mutually left-recursive error when parsing
tagged with: recursion
has body: I have this ANTLR 4 grammar: constantFixedExpresion : term (('+'|'-') term)+; term : factor (('*'|'//'|'REM')factor)+; factor : ('+'|'-')* ( wholeNumberConstant | constantFixedExpresion | 'TOFIXED' (stringConstant | bitCodeConstant) | identifier) ('FIT'constantFixedExpresion)*; I get the following error: error(119): LanguageA.g4::: The following sets of rules are mutually left-recursive [constantFixedExpresion, factor, term] I tried so many ways but can't fix it. What is the problem and how can I solve it?
tagged with: java
score: 23
tagged with: antlr
type: Question
answer count: 1
downvote count: 3

http://stackoverflow.com/comment/41632999
score: 0
type: QuestionComment
has text: I think from your description of your requirement it would just be @Column(updatable=false) to property C. This will allow you to insert a value but not any subsequent updates to this column.
type: Comment
comment on: http://stackoverflow.com/q/26499982

opennlp
type: Tag
tags question: http://stackoverflow.com/q/26493924
tag name: opennlp

http://stackoverflow.com/q/26404866
type: Question
type: AnsweredQuestion
tagged with: java
has title: HtmlElements finds 3 elements instead of only one in block when searching with XPath
accepted answer: http://stackoverflow.com/a/26404960
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26404960
score: 0
has body: I have a block: @Block(@FindBy(xpath = "//tr[contains(@class,'bg-success')]")) public class ShareContentRowBlock extends HtmlElement { @FindBy(xpath = "//h3[@class='fileName']/span/a") private TextBlock contentNameText; public String getContentName() { return contentNameText.getText(); } .... // some other elements and methods } I described a page: public class DocumentLibraryPage extends SitePage { private List&lt;ShareContentRowBlock&gt; shareContentRowBlocks; ..... public ShareContentRowBlock getShareContentRowBlock(String name){ for (ShareContentRowBlock conentRowBlock: shareContentRowBlocks){ if(name.equals(conentRowBlock.getContentName())){ return conentRowBlock; } } return null; } } When I try to get element, it returns not exactly element that I want to see. I have html with elements tree: html h3.fileName span a h3.fileName span a table.bg-success h3.fileName span a I want to get element &lt;a&gt; inside table, but it returns all 3 &lt;a&gt; elements. When i try to debug it really finds all &lt;a&gt; elements with ignoring parent block xpath. What wrong with it? Am I need to change selectors, or describe block in other way?
tagged with: xpath
tagged with: selenium
upvote count: 1
tagged with: htmlelements
downvote count: 1

http://stackoverflow.com/a/26395086
has body: This may be off topic, but have you tried implementing Dijkstra's Algorithm in Java. In the following algorithm, the code u := vertex in Q with min dist[u], searches for the vertex u in the vertex set Q that has the least dist[u] value. length(u, v) returns the length of the edge joining (i.e. the distance between) the two neighbor-nodes u and v. The variable alt on line 17 is the length of the path from the root node to the neighbor node v if it were to go through u. If this path is shorter than the current shortest path recorded for v, that current path is replaced with this alt path. The previous array is populated with a pointer to the "next-hop" node on the source graph to get the shortest route to the source. (taken from Wikipedia's artice on Dijkstra's Algorithm. This work is not my own. function Dijkstra(Graph, source): dist[source] := 0 // Distance from source to source for each vertex v in Graph: // Initializations if v ≠ source dist[v] := infinity // Unknown distance function from source to v previous[v] := undefined // Previous node in optimal path from source end if add v to Q // All nodes initially in Q (unvisited nodes) end for while Q is not empty: // The main loop u := vertex in Q with min dist[u] // Source node in first case remove u from Q for each neighbor v of u: // where v has not yet been removed from Q. alt := dist[u] + length(u, v) if alt &lt; dist[v]: // A shorter path to v has been found dist[v] := alt previous[v] := u end if end for end while return dist[], previous[] end function
type: Answer
answers question: http://stackoverflow.com/q/26394957
score: 0

http://stackoverflow.com/comment/41419782
comment on: http://stackoverflow.com/a/26382697
score: 0
type: AnswerComment
type: Comment
has text: that's an interesting looking output

http://stackoverflow.com/a/26443812
score: 1
upvote count: 1
type: Answer
has body: The best method is 2nd one and you can made a modification as follows, public class Foo{ private int score; private int age; private int type; // getters and setters for the variables } And do as, for(int col = 0; col &lt; 10; col++){ for(int row = 0; row &lt; 10; row++){ Foo tempFoo = Foo[col][row]; int temp = tempFoo.getScore(); int temp_two = tempFoo.getAge(); int temp_three = tempFoo.getType(); } }
downvote count: 0
answers question: http://stackoverflow.com/q/26443726

http://stackoverflow.com/comment/41421333
type: AnswerComment
comment on: http://stackoverflow.com/a/26382272
score: 0
type: Comment
has text: I tried with that but for every folder in my SideProject Eclipse create a different package. Is that ok?

myo
tag name: myo
type: Tag
tags question: http://stackoverflow.com/q/26445268

http://stackoverflow.com/comment/41393696
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/20117500/java-one-line-variable-declaration and http://stackoverflow.com/questions/100633/why-do-you-not-declare-several-variables-of-the-same-type-on-the-same-line
score: 0
comment on: http://stackoverflow.com/q/26368221

http://stackoverflow.com/q/26457113
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41554692
has comment: http://stackoverflow.com/comment/41554526
has comment: http://stackoverflow.com/comment/41554554
has answer: http://stackoverflow.com/a/26457302
score: 0
has comment: http://stackoverflow.com/comment/41554623
answer count: 1
has comment: http://stackoverflow.com/comment/41554999
has comment: http://stackoverflow.com/comment/41554798
has comment: http://stackoverflow.com/comment/41554565
has body: I was having trouble getting my program to read from a file "lexicon.txt" My task was to have the program scan a user input and getting the word count for the program in return. Do you guys know what's going on in my code? import java.io.*; import java.util.Scanner; public class searchFile { public static void main (String args[]) throws IOException { Scanner reader = new Scanner(System.in); System.out.println("Please enter the file name (e.g: nonamefile.txt)"); String objective = reader.nextLine(); if (!(objective.equals("lexicon.txt"))) { System.out.println("ERROR: Missing File"); } else { Scanner reader2 = new Scanner(System.in); Scanner lexicon = new Scanner(new File("lexicon.txt")); int wordCount = 0; System.out.println("What word do you need to look up?"); String objective2 = reader2.nextLine(); while (lexicon.hasNext()) { String word = lexicon.next(); if (word.equalsIgnoreCase(objective2)){ wordCount++; } } System.out.println("Word count = " + wordCount); } } // end main method (String Args[]) } // end class searchFile
has comment: http://stackoverflow.com/comment/41554538
accepted answer: http://stackoverflow.com/a/26457302
has comment: http://stackoverflow.com/comment/41554535
has comment: http://stackoverflow.com/comment/41554562
has title: Program does not scan a text file (Java)
tagged with: text
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41554666

http://stackoverflow.com/a/26480403
answers question: http://stackoverflow.com/q/26480342
upvote count: 2
has body: You can't. When you print the exception it contains the StackTraceElement This is the responsible method for above result public StackTraceElement(String declaringClass, String methodName, String fileName, int lineNumber) { this.declaringClass = Objects.requireNonNull(declaringClass, "Declaring class is null"); this.methodName = Objects.requireNonNull(methodName, "Method name is null"); this.fileName = fileName; this.lineNumber = lineNumber; } Here there is no way to set column number. Also StackTraceElement is a final class. you can't extend it and override either.
score: 2
accepted answer of: http://stackoverflow.com/q/26480342
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26421499
answers question: http://stackoverflow.com/q/26421390
has comment: http://stackoverflow.com/comment/41489135
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/41492831
has comment: http://stackoverflow.com/comment/41489167
has body: If your goal is to be able to use absolute paths, without caring (and knowing) about the context path of the webapp (/terminal-company in your second example), then use the JSTL &lt;c:url&gt; tag to generate all your URLs: &lt;link href="&lt;c:url value='/resources/css/bootstrap.min.css'/&gt;" rel="stylesheet"&gt; The second example will send a request to /resources/css/bootstrap.min.css, and not to /terminal-company/resources/css/bootstrap.min.css, unless there is a &lt;base&gt; tag in the generated HTML page. EDIT: your original question didn't say you were using spring, and mapped / to the dispatcher servlet. Spring is thus in charge of service resources. The documentation explains how to configure it. But that doesn't change anything to the above answer: to be independant of the context path, use c:url.
accepted answer of: http://stackoverflow.com/q/26421390
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41413478
score: 0
type: Comment
type: QuestionComment
has text: Take a look here: https://www.eclipse.org/m2e/download/
comment on: http://stackoverflow.com/q/26371195

http://stackoverflow.com/q/26376635
downvote count: 1
type: Question
tagged with: java
score: -1
has title: Conversion issue Integer to int
has comment: http://stackoverflow.com/comment/41408985
has comment: http://stackoverflow.com/comment/41408957
upvote count: 0
has comment: http://stackoverflow.com/comment/41409751
favorite count: 0
has body: Unable to add the values in collections, when i`m trying to add the element getting below error message. Error message that i`m getting "The method add(int, Integer) in the type List is not applicable for the arguments (int)". public static void additem(String type, List&lt;Integer&gt; list) { long st=System.currentTimeMillis(); for(int i=0;i&lt;1E5;i++) { list.add(i); } long st1=System.currentTimeMillis(); System.out.println("Added Item is : " +list.get(0) + type+ "Time" +(st-st1)); }
has answer: http://stackoverflow.com/a/26376924
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26376933
has comment: http://stackoverflow.com/comment/41408906
has answer: http://stackoverflow.com/a/26376684
tagged with: collections

http://stackoverflow.com/comment/41510061
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26432490
type: AnswerComment
has text: I'm not really sure what the `Set` and `HashSet` do you have any idea how to do it without this? I appreciate the answer and I understand the problem now, but the answer was a little out of my league :/ The idea is to remove them after a consecutive number of mouse clicks after they were initially hit. I need to remove them 1 by 1

storage
tag name: storage
tags question: http://stackoverflow.com/q/26401050
type: Tag

http://stackoverflow.com/comment/41500470
has text: I updated hibernate version to 3.6.0.Final, according to http://stackoverflow.com/questions/14958708/java-lang-nosuchmethoderror-org-hibernate-cfg-configuration-addannotatedclass, but again it returned me an error "nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [config.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider"
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26425073

http://stackoverflow.com/q/26452742
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
has body: I'm trying to create a simple Android program that has text boxes for name, address, phone number, etc. When the user puts this information in and hits save it clears the text boxes, and when they hit the load button it retrieves the info. I know how to do it with one EditText box, but I can't figure out multiple. Can I do this inside one try/catch statement, or do I need more than one? This is what I have right now: public class MainActivity extends ActionBarActivity { private EditText textBoxName; private EditText textBoxAddress; private EditText textBoxCity; private EditText textBoxPhone; private EditText textBoxEmail; private static final int READ_BLOCK_SIZE = 100; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textBoxName = (EditText) findViewById(R.id.txtName); textBoxAddress = (EditText) findViewById(R.id.txtAddress); textBoxCity = (EditText) findViewById(R.id.txtCity); textBoxPhone = (EditText) findViewById(R.id.txtPhone); textBoxEmail = (EditText) findViewById(R.id.txtEmail); Button saveBtn = (Button) findViewById(R.id.btnSave); Button loadBtn = (Button) findViewById(R.id.btnLoad); saveBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String strName = textBoxName.getText().toString(); String strAddress = textBoxAddress.getText().toString(); String strCity = textBoxCity.getText().toString(); String strPhone = textBoxPhone.getText().toString(); String strEmail = textBoxEmail.getText().toString(); try { FileOutputStream fOut = openFileOutput("textfile.txt", MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(fOut); //write the string to the file osw.write(strName); osw.flush(); osw.close(); //display file saved messages Toast.makeText(getBaseContext(), "File saved successfully!", Toast.LENGTH_SHORT).show(); //clears the EditText textBoxName.setText(""); textBoxAddress.setText(""); textBoxCity.setText(""); textBoxPhone.se…
tagged with: textbox
tagged with: persistence
score: 0
has answer: http://stackoverflow.com/a/26453558
has title: How to save information in multiple text boxes with save and load buttons
tagged with: android
has answer: http://stackoverflow.com/a/26453637

http://stackoverflow.com/q/26467427
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41572636
has comment: http://stackoverflow.com/comment/41572777
has body: I have a folder with pairs of files. Pairs share filename but have different extension (in this case, they are pairs of .txt and .png). I am looking to store them into a HashMap&lt; File, File > by pairs. Here is what I did to find the pairs: LinkedList&lt;File&gt; fileList = new LinkedList&lt;File&gt;(Arrays.asList(fileArray)); LinkedList&lt;File&gt; alreadyCompared = new LinkedList&lt;File&gt;(); HashMap&lt;File, File&gt; filePairs = new HashMap&lt;File, File&gt;(); for (Iterator&lt;File&gt; itr1 = fileList.iterator(); itr1.hasNext(); ) { File comparator = itr1.next(); if (!alreadyCompared.contains(comparator)) { String stringComparator = comparator.getName().split("\\.")[0]; alreadyCompared.add(comparator); for (Iterator&lt;File&gt; itr2 = fileList.iterator(); itr2.hasNext(); ) { File compared = itr2.next(); if (!alreadyCompared.contains(compared)) { String stringCompared = compared.getName().split("\\.")[0]; if (stringComparator.equals(stringCompared)) { if (comparator.getName().endsWith("txt")) { filePairs.put(comparator, compared); } else { filePairs.put(compared, comparator); } } } } } } return filePairs; Now, this takes a lot of time when I have more than 1000 files to sort, and I'd like to find a more efficient way of doing it. What other way can I sort these files? Thanks a lot!
has title: More efficient sorting for pairs of files
score: 1
has comment: http://stackoverflow.com/comment/41573262
tagged with: java
has comment: http://stackoverflow.com/comment/41586793
has comment: http://stackoverflow.com/comment/41573210
has comment: http://stackoverflow.com/comment/41586601
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41573077
has comment: http://stackoverflow.com/comment/41572571
has comment: http://stackoverflow.com/comment/41573053
tagged with: sorting
has answer: http://stackoverflow.com/a/26474773
has comment: http://stackoverflow.com/comment/41572990
answer count: 2
has comment: http://stackoverflow.com/comment/41586672
has comment: http://stackoverflow.com/comment/41572918
downvote count: 0
has answer: http://stackoverflow.com/a/26467453

http://stackoverflow.com/comment/41636789
comment on: http://stackoverflow.com/q/26502491
score: 0
type: Comment
type: QuestionComment
has text: Not sure what you mean by "read the 3th collum from text file and if this colum is S\*\*ei or P\*\*\*ei". Do you mean "If there is an asterisk '*' in the third column?

http://stackoverflow.com/comment/41617626
score: 0
comment on: http://stackoverflow.com/a/26489981
type: AnswerComment
type: Comment
has text: @RyanDwyer From https://www.java.net/node/683927 "You can try, but it will only draw the "current" frame of the GIF to the BufferedImage. BufferedImage objects are just static buckets of pixels so they can't "animate"."

http://stackoverflow.com/a/26382009
answers question: http://stackoverflow.com/q/26381579
has body: Is the FilterResults object that you are passing to publishResults the one that you are building in performFiltering? If so, notice that the values field is of type String[], not ArrayList&lt;UserSelect&gt;. A cast operator only works if the underlying object actually has that type.
score: 0
type: Answer

http://stackoverflow.com/q/26407432
has body: I'm using onClick() method by implementing OnClickListener class. Using below code but it does not work! There are no errors but it doesn't work. When I click on the button nothing happens. What is wrong? package com.behnam.PhoneCh.main; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity implements OnClickListener { EditText mainEt; TextView mainTv; Button mainBtn; Button mainBtn2; String vaje; Javab javab; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mainEt = (EditText) findViewById(R.id.editText1); mainTv = (TextView) findViewById(R.id.textView1); mainBtn = (Button) findViewById(R.id.button1); mainBtn2 = (Button) findViewById(R.id.button2); vaje = new String(); javab = new Javab(); } @Override public void onClick(View aaaaa) { switch (aaaaa.getId()) { case R.id. Log.i("mylog", "start button1"); vaje = mainEt.getText().toString(); mainTv.setText(javab.startJ(vaje)); break; case R.id.button2: int c = 3; break; } } }
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26407454
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26407603
tagged with: android
has answer: http://stackoverflow.com/a/26407570
tagged with: onclicklistener
upvote count: 1
linked to: http://stackoverflow.com/q/18319711
has title: OnClick listener implementation not working
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26407718
answer count: 4

http://stackoverflow.com/q/26473351
answer count: 3
has comment: http://stackoverflow.com/comment/41585144
has comment: http://stackoverflow.com/comment/41584114
has comment: http://stackoverflow.com/comment/41584744
favorite count: 0
has comment: http://stackoverflow.com/comment/41584118
has body: I have a class with two methods (one is boolean) and I want to pass that boolean method to the other one. So, if the movement of the Rook piece on a chessboard is valid, then proceed to the drawing of the piece: public class Rook extends AbstractPiece { @Override public boolean isMoveValid(int srcRow, int srcCol, int destRow, int destCol) { boolean valid; if ((destRow == srcRow) || (destCol == srcCol)) { valid = true; } else { valid = false; } return valid; } @Override public void draw() { if (isMoveValid == true){ //or if(valid == true) or something like that //draw stuff } } }
has answer: http://stackoverflow.com/a/26473433
has answer: http://stackoverflow.com/a/26473395
type: UnansweredQuestion
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41584157
downvote count: 3
has title: How to pass a boolean method to another method in Java
type: Question
has answer: http://stackoverflow.com/a/26473412
score: -2

http://stackoverflow.com/a/26407676
has body: Matches return true if the whole string matches the given pattern. For this it prefix ur matcher with '^' and suffix with '$' sign and hence it is not going to look for a substring. find() return true in case of substring matches also. Have a look - Difference between matches() and find() in Java Regex
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26407040
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41568000
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26463155
has text: Either read the entire data, save and then populate or store all the `comboboxes` in an array and then read line by line and get the `coboboxes` and populate.

http://stackoverflow.com/q/26450556
has comment: http://stackoverflow.com/comment/41542649
downvote count: 1
has body: I'm trying to make a project to create a piechart when I click on piechart button i have this error: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jfree/util/PublicCloneable I used this jar file for the project: jfreechart-0.9.21.jar Any help please?! This is my code: private void pieChartActionPerformed(java.awt.event.ActionEvent evt) { DefaultPieDataset pieDataset=new DefaultPieDataset(); pieDataset.setValue("first", new Integer(10) ); pieDataset.setValue("second", new Integer(20) ); pieDataset.setValue("third", new Integer(30) ); pieDataset.setValue("fourth", new Integer(40) ); JFreeChart chart = ChartFactory.createPieChart("My Pie Chart", pieDataset, true, true, true); PiePlot p = (PiePlot)chart.getPlot(); // p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("Pie Chart!",chart); frame.setVisible(true); frame.setSize(450,500); }
has comment: http://stackoverflow.com/comment/41542799
favorite count: 0
has comment: http://stackoverflow.com/comment/41542579
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41542447
has comment: http://stackoverflow.com/comment/41542740
has comment: http://stackoverflow.com/comment/41543764
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41542963
has comment: http://stackoverflow.com/comment/41542502
has comment: http://stackoverflow.com/comment/41542654
has comment: http://stackoverflow.com/comment/41542975
has comment: http://stackoverflow.com/comment/41542470
type: Question
has comment: http://stackoverflow.com/comment/41542517
has comment: http://stackoverflow.com/comment/41542708
has comment: http://stackoverflow.com/comment/41542694
has title: Thread error while running NetBeans project
score: 0
upvote count: 1

http://stackoverflow.com/comment/41632024
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26499850
has text: possible duplicate of [Do spurious wakeups actually happen?](http://stackoverflow.com/questions/1050592/do-spurious-wakeups-actually-happen)
score: 0

http://stackoverflow.com/a/26486014
type: Answer
accepted answer of: http://stackoverflow.com/q/26485864
has comment: http://stackoverflow.com/comment/41636153
answers question: http://stackoverflow.com/q/26485864
has body: First I suggest a read on what Spring Boot can do for you, you are trying very hard not to use Spring boot. I suggest dropping all the annotations apart from @Configuration, @EnableAutoConfiguration and @ComponentScan. Everything else will be added/provided by Spring Boot. I also suggest merging your Config and Application class into one. Leaving you with the following (yes without the @Bean methods).. @Configuration @EnableAutoConfiguration @ComponentScan public class Application { public static void main(String[] args) { SpringApplication.run(Config.class, args); } } You only need to add spring-boot-starter-web and spring-boot-starter-data-jpa as dependencies, the other necessary dependencies (spring-webmvc etc.) will be added automatically. Of course you still need to add hibernate as a dependency. Spring Boot will detect Spring Web and configure the DispatcherServlet and other beans for you. Next the src/resources directory isn't known so it will not be available as a resource and as such will not be found. I would also suggest NOT using JSP as a view layer. There are some issues with JSP and Spring Boot as explained in the reference guide. If you really must don't explicitly configure the InternalResourceViewResolver but add an application.properties file to src/main/resources and add the following to properties. spring.view.prefix= spring.view.suffix=.jsp Which correspond to a the prefix and suffix properties of the InternalResourceViewResolver. For a list of properties check the reference guide. I suggest not using the src/main/resources/resources folder for storing the JSP pages, as that directory is also publicly readable (by default in Spring Boot). I suggest a views directory for instance. Which would lead to the following properties spring.view.prefix=/views/ spring.view.suffix=.jsp A final note Spring Boot powered applications don't detect WebApplicationInitializer so if you are doing something inside it it will not be done for Spring Boot applications …
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41656197
comment on: http://stackoverflow.com/a/26497615
has text: One additional question. This solution just fades in to the "highlighted" color. What If I want to go to red immediately, and then fade back to white?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26378946
has comment: http://stackoverflow.com/comment/41415492
tagged with: java
has comment: http://stackoverflow.com/comment/41413302
has comment: http://stackoverflow.com/comment/41416877
has answer: http://stackoverflow.com/a/26380649
has title: ArrayUtils has a bug? it does actually delete but
has comment: http://stackoverflow.com/comment/41413072
has comment: http://stackoverflow.com/comment/41416795
upvote count: 0
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/41414389
has comment: http://stackoverflow.com/comment/41416745
has comment: http://stackoverflow.com/comment/41415336
has comment: http://stackoverflow.com/comment/41415480
favorite count: 0
has body: In case You want to test it your self: [link]https://gist.github.com/anonymous/091750563384024e0ffa [link]https://gist.github.com/anonymous/1f05cdd1d1685d103326 Everything worked fine in deleteItem function it deleted what i wanted, but when i tried to see the array again it shows the original array again even though I already return a new array public static ItemTracker[] deleteItem(ItemTracker[] listItems) { for(int i = 0; i &lt; listItems.length; i++) { if (listItems[i] == null) { break; } else if(input.equalsIgnoreCase("Everything")){ listItems = ArrayUtils.remove(listItems, i); // ArrayUtils is actually deleting it but... see output in other function System.out.println("Content of Array : " + Arrays.toString(listItems)); // It deleted the index that i want and return a new array // return listItems; I tried to return here as well but same result } } } return listItems; // which is here } Original array: [naufal,joker,batman,null,null,null,null,null,null,null] Output after delete items, I'm deleting joker as in index 1: [naufal,batman,null,null,null,null,null,null,null] It worked but.. After i run displayArray method: public static void displayArray(ItemTracker[] listItems) System.out.println("Content of Array : " + Arrays.toString(listItems)); } I get: [naufal,joker,batman,null,null,null,null,null,null,null] same array; I posted multiple of same questions, and tried all the solutions from people here but it doesn't work. What is the real problem over here?, seems like i couldn't of anything else. For the sake of this problem this only applies to array not List or ArrayList
has comment: http://stackoverflow.com/comment/41413445
score: -3
accepted answer: http://stackoverflow.com/a/26380649
has comment: http://stackoverflow.com/comment/41413250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41413153
has comment: http://stackoverflow.com/comment/41413395
has comment: http://stackoverflow.com/comment/41413377
has comment: http://stackoverflow.com/comment/41413257
has comment: http://stackoverflow.com/comment/41414349
downvote count: 3
has comment: http://stackoverflow.com/comment/41413458
type: Question
has comment: http://stackoverflow.com/comment/41415518
has comment: http://stackoverflow.com/comment/41415533

http://stackoverflow.com/a/26398348
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26398217
has body: package com.shutter2000.www.shutter_2000_oms; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import android.view.View.OnClickListener; public class SiteVisitDetails extends Activity implements OnClickListener{ public EditText mCusName; public EditText mOrderID; public EditText mProjectID; public EditText mHeightWidth; public EditText mNote; public Button mSubmitButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_site_visit_details); //initialize text fields mCusName = (EditText) findViewById(R.id.txtCusName); mOrderID = (EditText) findViewById(R.id.txtOrderID); mProjectID = (EditText) findViewById(R.id.txtProjectID); mHeightWidth = (EditText) findViewById(R.id.txtHeightWidth); mNote = (EditText) findViewById(R.id.txtNote); mSubmitButton = (Button) findViewById(R.id.btnSubmit); //listen to submit button click event mSubmitButton.setOnClickListener(this); } @Override public void onClick(View v) { if (v.getId() == R.id.mSubmitButton) { Toast.makeText(this,"Successfully sent!",Toast.LENGTH_LONG).show(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.site_visit_details, menu); return true; } public void addItemsToProductSpinner() { Spinner spinner = (Spinner) findViewById(R.id.spnProducts); // Create an ArrayAdapter using the string array and a default spinner layout ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(this, R.array.products, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears android.R.layout.simple_spin…
answers question: http://stackoverflow.com/q/26398217
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41450850
score: 1
has comment: http://stackoverflow.com/comment/41447672

http://stackoverflow.com/comment/43129389
type: Comment
comment on: http://stackoverflow.com/q/26495337
score: 0
type: QuestionComment
has text: Again, the links are all here, you just have to read them.

http://stackoverflow.com/q/26494540
has answer: http://stackoverflow.com/a/26746855
has title: reading apple pay token using a ACR122 NFC reader
tagged with: iphone
upvote count: 3
answer count: 1
favorite count: 0
tagged with: nfc
tagged with: applepay
has body: I have a ACR122 NFC reader and trying to see if I can read the token generated by Apple Pay. Below is some code in Java I am trying but only returns a 4 alpha numeric character every time. The Apple Pay iphone senses the nfc reader - are there specific apdu commands I need to send to retrieve the token? import java.io.*; import java.util.*; import javax.smartcardio.*; public class CardTest { final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); public static String bytesToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; int v; for ( int j = 0; j &lt; bytes.length; j++ ) { v = bytes[j] &amp; 0xFF; hexChars[j * 2] = hexArray[v &gt;&gt;&gt; 4]; hexChars[j * 2 + 1] = hexArray[v &amp; 0x0F]; } return new String(hexChars); } public static void main(String[] args) throws Exception { TerminalFactory factory = TerminalFactory.getInstance("PC/SC", null); System.out.println(factory); List&lt;CardTerminal&gt; terminals = factory.terminals().list(); System.out.println("Terminals: " + terminals); if (terminals.isEmpty()) { throw new Exception("No card terminals available"); } CardTerminal terminal = terminals.get(0); // Keep looping looking for cards until the application is closed while( true ) { terminal.waitForCardPresent( 0 ); try { Card card = terminal.connect("*"); CardChannel channel = card.getBasicChannel(); CommandAPDU command = new CommandAPDU(new byte[]{(byte)0xFF,(byte)0xCA,(byte)0x00,(byte)0x00,(byte)0x04}); ResponseAPDU response = channel.transmit(command); byte[] byteArray = response.getBytes(); System.out.println( bytesToHex( byteArray ) ); Thread.sleep(1000); } catch (CardException e) { e.printStackTrace(); } } } }
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: acr122
type: Question

http://stackoverflow.com/comment/41610189
score: 0
type: QuestionComment
has text: It's an error in R, not in Java.
type: Comment
comment on: http://stackoverflow.com/q/26487081

http://stackoverflow.com/a/26470042
accepted answer of: http://stackoverflow.com/q/26469679
answers question: http://stackoverflow.com/q/26469679
type: Answer
score: 2
has body: You can use a Resource like so @Autowired public MyClass(@Value("classpath:path/to/a/file") Resource resource) { // access to resource input stream } Note that the @Autowired is required to mark this constructor as the one to use. Otherwise, Spring would look for a parameterless constructor.
has comment: http://stackoverflow.com/comment/41578277
upvote count: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41544960
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26451569
has text: You're missing a closing bracket where you call `System.out.println()`
score: 0

regex
tags question: http://stackoverflow.com/q/26454374
tags question: http://stackoverflow.com/q/26458684
tags question: http://stackoverflow.com/q/26388572
tags question: http://stackoverflow.com/q/26504925
tags question: http://stackoverflow.com/q/26490670
tags question: http://stackoverflow.com/q/26434342
tags question: http://stackoverflow.com/q/26393792
tags question: http://stackoverflow.com/q/26428538
tags question: http://stackoverflow.com/q/26423072
tags question: http://stackoverflow.com/q/26371070
tag name: regex
tags question: http://stackoverflow.com/q/26393708
tags question: http://stackoverflow.com/q/26508424
tags question: http://stackoverflow.com/q/26475409
tags question: http://stackoverflow.com/q/26372393
tags question: http://stackoverflow.com/q/26474567
tags question: http://stackoverflow.com/q/26447009
tags question: http://stackoverflow.com/q/26473596
tags question: http://stackoverflow.com/q/26498378
tags question: http://stackoverflow.com/q/26355257
tags question: http://stackoverflow.com/q/26449204
tags question: http://stackoverflow.com/q/26513576
tags question: http://stackoverflow.com/q/26361544
tags question: http://stackoverflow.com/q/26507391
tags question: http://stackoverflow.com/q/26374973
tags question: http://stackoverflow.com/q/26363159
tags question: http://stackoverflow.com/q/26505090
tags question: http://stackoverflow.com/q/26385271
tags question: http://stackoverflow.com/q/26436356
tags question: http://stackoverflow.com/q/26459858
tags question: http://stackoverflow.com/q/26452985
tags question: http://stackoverflow.com/q/26509118
tags question: http://stackoverflow.com/q/26418306
tags question: http://stackoverflow.com/q/26368489
tags question: http://stackoverflow.com/q/26470429
tags question: http://stackoverflow.com/q/26498712
tags question: http://stackoverflow.com/q/26416026
tags question: http://stackoverflow.com/q/26469148
tags question: http://stackoverflow.com/q/26469200
tags question: http://stackoverflow.com/q/26491216
tags question: http://stackoverflow.com/q/26433706
tags question: http://stackoverflow.com/q/26436460
tags question: http://stackoverflow.com/q/26394956
tags question: http://stackoverflow.com/q/26433079
tags question: http://stackoverflow.com/q/26376191
tags question: http://stackoverflow.com/q/26451008
tags question: http://stackoverflow.com/q/26357684
tags question: http://stackoverflow.com/q/26505085
tags question: http://stackoverflow.com/q/26402186
tags question: http://stackoverflow.com/q/26440302
tags question: http://stackoverflow.com/q/26411357
tags question: http://stackoverflow.com/q/26413592
tags question: http://stackoverflow.com/q/26488854
tags question: http://stackoverflow.com/q/26402877
tags question: http://stackoverflow.com/q/26439728
tags question: http://stackoverflow.com/q/26377954
tags question: http://stackoverflow.com/q/26388294
tags question: http://stackoverflow.com/q/26407193
tags question: http://stackoverflow.com/q/26356605
tags question: http://stackoverflow.com/q/26499930
tags question: http://stackoverflow.com/q/26459727
tags question: http://stackoverflow.com/q/26471928
tags question: http://stackoverflow.com/q/26433864
tags question: http://stackoverflow.com/q/26385667
tags question: http://stackoverflow.com/q/26483049
tags question: http://stackoverflow.com/q/26468279
tags question: http://stackoverflow.com/q/26371900
tags question: http://stackoverflow.com/q/26434225
tags question: http://stackoverflow.com/q/26453992
tags question: http://stackoverflow.com/q/26397604
tags question: http://stackoverflow.com/q/26426464
tags question: http://stackoverflow.com/q/26359138
tags question: http://stackoverflow.com/q/26367015
tags question: http://stackoverflow.com/q/26373253
tags question: http://stackoverflow.com/q/26511939
tags question: http://stackoverflow.com/q/26404790
tags question: http://stackoverflow.com/q/26423690
tags question: http://stackoverflow.com/q/26509080
tags question: http://stackoverflow.com/q/26413844
type: Tag

http://stackoverflow.com/q/26454418
score: 0
has comment: http://stackoverflow.com/comment/41549796
has body: I would like to know the best practice for documentating the following method that simplifies a rational number. /** * Simplifies a rational number * * @return ... * | result == new Rational(this.getNumerator() / gcd, this.getDenominator()/ gcd); */ public Rational simplify() { long gcd = ExtMath.gcd(Math.abs(this.getNumerator()), Math.abs(this.getDenominator())); if (this.getDenominator() &lt; 0) gcd *= -1; return new Rational(this.getNumerator() / gcd, this.getDenominator() / gcd); }
has comment: http://stackoverflow.com/comment/41549763
has answer: http://stackoverflow.com/a/26454489
accepted answer: http://stackoverflow.com/a/26454489
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41549660
answer count: 1
has title: Documentation of method
has comment: http://stackoverflow.com/comment/41549726
tagged with: documentation

http://stackoverflow.com/comment/138331752
type: Comment
has text: new TestAbortedException("Inconclusive") if you can't find AssumptionViolatedException
comment on: http://stackoverflow.com/a/43209183
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41569743
type: QuestionComment
has text: @deepak825 my query is correct everything works fine
comment on: http://stackoverflow.com/q/26465913
score: 0
type: Comment

http://stackoverflow.com/comment/41521909
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26430639
has text: @user46688 - for sure I don't follow your infrastructure set up, but the obstacle might be between your client and server. As far as I *guess* downloading software updates happens elsewhere (not between these two). Anyway, I am just guessing blindly.
score: 0

http://stackoverflow.com/comment/41392592
type: Comment
type: QuestionComment
has text: @user1803551 - Yes. Like I edited to say, I'm still using parts of the original application which are intended to be multipurpose and can take some very complex objects, but I'm never going to be calling those constructors that way in the standalone, so I don't need whatever third-party libraries support those objects.
comment on: http://stackoverflow.com/q/26366666
score: 0

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/26356305
tags question: http://stackoverflow.com/q/26372572
type: Tag

http://stackoverflow.com/a/26453386
score: 1
has body: You could try something like this: @Override protected void onResume() { super.onResume(); if(done){ return; } done = true; final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), YourActivity.class)); finish(); overridePendingTransition(0, 0); } }, 5000); } That will start YourActivity after 5 seconds approximately. Hope it helps.
downvote count: 0
answers question: http://stackoverflow.com/q/26453335
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41558468
comment on: http://stackoverflow.com/a/26459098
type: AnswerComment
type: Comment
has text: @JacquesRamsden you're right, and that might be something I would do too, but his assignment says only to check if it is empty, so that's all I put in.
score: 0

http://stackoverflow.com/comment/41633417
has text: Do you have the Landlord code Chris?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26500461

vbo
tags question: http://stackoverflow.com/q/26412374
type: Tag
tag name: vbo

http://stackoverflow.com/comment/41658114
has text: JTA is part of J2EE not Spring. You can still do JTA with Spring but there is no added value because Spring has its own transaction abstraction layer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26504919

http://stackoverflow.com/q/26468633
has answer: http://stackoverflow.com/a/26469172
score: 0
answer count: 2
has body: I have designed a java program that open in its main file a JFrame, where different panel are then opened. I found that using the program of different machine with different screen size it can be that some panel are "cut" and , for instance I loose some bottom in the panels. What is the better designing solution to solve this issue? Thanks in advance to who can help.
has comment: http://stackoverflow.com/comment/41574928
has answer: http://stackoverflow.com/a/26469165
tagged with: jframe
type: UnansweredQuestion
tagged with: screen
type: Question
has title: adapt windows and its content to screen size in java
tagged with: java
tagged with: jpanel

http://stackoverflow.com/comment/41375922
type: QuestionComment
has text: Nothing in Field "Startin" !!
comment on: http://stackoverflow.com/q/26356506
score: 0
type: Comment

http://stackoverflow.com/comment/41540722
type: AnswerComment
comment on: http://stackoverflow.com/a/26449146
type: Comment
has text: tnx bro , but when I click tvComment should to change tvlikes background , it changed but some other rows in listview changed too ! I really dont know what to work :-(
score: 0

http://stackoverflow.com/comment/41469022
type: AnswerComment
has text: Do i want to remove all try blocks in DAO and service layer.I have added HibernateException and normal EXception in Service.Do u like to see my controller code?
score: 0
comment on: http://stackoverflow.com/a/26410395
type: Comment

http://stackoverflow.com/comment/41559073
score: 2
comment on: http://stackoverflow.com/q/26459729
type: Comment
type: QuestionComment
has text: "I was curious if there were methods" - so why didn't you use Google or the Java documentation then?

http://stackoverflow.com/comment/41528586
type: QuestionComment
has text: @keshlam i try it but unexpectedly start variable value change 3 to 2
type: Comment
comment on: http://stackoverflow.com/q/26441362
score: 0

http://stackoverflow.com/q/26511950
has title: Java + TomEE. Websockets and Servlets in one project?
type: Question
tagged with: java
tagged with: apache-tomee
tagged with: servlets
has answer: http://stackoverflow.com/a/26514327
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41657027
has comment: http://stackoverflow.com/comment/41849299
type: UnansweredQuestion
tagged with: sockets
has body: I'm writing a simple game with JavaEE Websocket technology. Using JSR356, my server-side socket class looks like following: @ServerEndpoint( value = "/sock", decoders = { SocketDecoder.class } ) public class CardsSocket { .... @OnMessage public void onMessage(final SocketInput message, final Session session) { ... } ... } It works perfectly fine, and has no issues. But then I decided to create also some web page for info and stuff. So, without changing anything on previous class, I have created a new one: @ServerEndpoint(value = "/cards") public class CardsWebPage extends HttpServlet { @Override public void doGet(...) { ... } } And configured web.xml file in WEB-INF directory. <?xml version="1.0" encoding="UTF-8"?> CardsWebPage server.CardsWebPage CardsWebPage /cards And there began troubles. My servelet works - browser shows page on localhost:8080/cards, but client-side socket class can no longer initiate - it falls with Exception: "javax.websocket.DeploymentException: The HTTP response from the server [HTTP/1.1 404 Not Found] did not permit the HTTP upgrade to WebSocket" , and nothing seems to fix it. Have I missed some documentation? Is it impossible for a single project to contain both servlets and websocket classes? Because, if I delete web.xml file, then sockets are starting to work like before. Server startup logs containing no warnings or errors in both cases.
has answer: http://stackoverflow.com/a/26619015

http://stackoverflow.com/q/26374023
tagged with: http://stackoverflow.com/tag/json
has title: Display json to textview force close
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/26374396
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41408324
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/26374262
tagged with: php
score: -1
has answer: http://stackoverflow.com/a/26374157
has body: I want to display product details from mysql database through php and display it in android textview. The scenario is like this: When list of product clicked. it's passed product id to new intent called productdetail. that id will be use for get a detail products in mysql db through php. The PHP file has successfully return data in json format. but when i run program it's keep force closing when open productdetail intent. the problem i found arroud this method new GetProductDetails().execute(); here is my code: getproductdetail.java public class ProductDetail extends Activity { TextView txtName; TextView txtVersion; TextView txtDesc; String pid; //progress dialog private ProgressDialog pDialog; //Creating JSON Parser object JSONParser jsonParser = new JSONParser(); //url to get all products list private static String url_product_details = "http://visioinformatika.com/demo/appswitcher/bin/get_product_details.php"; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCTS = "products"; private static final String TAG_PID = "pid"; private static final String TAG_NAME = "product_name"; private static final String TAG_VERSION = "app_version"; private static final String TAG_PDETAIL = "product_detail"; // products JSONArray JSONArray products = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_product_detail); // getting product details from intent Intent i = getIntent(); // getting product id (pid) from intent pid = i.getStringExtra(TAG_PID); //txtName = (TextView) findViewById(R.id.app_name); //txtName.setText(pid); // Getting complete product details in background thread new GetProductDetails().execute(); } /** * Background Async Task to Get complete product details * */ class GetProductDetails extends AsyncTask&lt;String, String, String&gt; { /** * Before starting background thread Show Progress Dialog * */ @Override protected …
tagged with: java

http://stackoverflow.com/a/26394620
answers question: http://stackoverflow.com/q/26394586
type: Answer
has body: You have two variables named rnum, one member of your class, and a different one local in your reverse() function. Fix that.
has comment: http://stackoverflow.com/comment/41441887
score: 0

http://stackoverflow.com/q/26512064
upvote count: 1
has body: I'm stuck at this part of my program. These are 2 options for my Student Information System (not using GUI/JOption and without linking to a database. I already have a 2-dimensional array (String records[][] = new String [5][3];) that has the first 2 "rows" ([0][0] to [0][2] and [1][0] to [1][2]) filled up with pre-assigned data (First Name, Last Name, Course). If you look below, the part where "b" or "B" option is selected, this is for adding new values to a new array (incremented so that when option B is used, it will assign first [2][0], then [3][0] and so on). It seemed to work since it does show that all the data I've entered was added and is displayed in the proper order. THE PROBLEM IS: when I choose 'Y" to return to the top menu and select option A to VIEW the newly added record (using ID number 2), it shows that it contains all "null". Is there something I've missed? This is the missing step I need in order to finish this program. Thanks ahead for the help. if("a".equals(option1)|| "A".equals(option1)){ System.out.println("Please enter the Student ID for the record to view."); String a = reader1.readLine(); idcheck = Integer.parseInt(a); x1=idcheck; for(int y=0;y&lt;3;y++){ System.out.print(records[x1][y] + " "); } System.out.println("\nReturn to Main Menu or Exit? (Y/N)"); cont1= reader1.readLine(); } else if("b".equals(option1)||"B".equals(option1)){ arr_count++; for (int y = 0; y&lt;3;y++){ System.out.println("Enter Value for "+ option [y]+":" ); String X = reader1.readLine(); records[arr_count][y] = X; }
has comment: http://stackoverflow.com/comment/41654469
favorite count: 0
has comment: http://stackoverflow.com/comment/41655000
has comment: http://stackoverflow.com/comment/41654646
tagged with: multidimensional-array
type: UnansweredQuestion
has title: How to retain newly added values on a two-dimensional array (JAVA)
has comment: http://stackoverflow.com/comment/41654349
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/41654452

http://stackoverflow.com/comment/41380492
comment on: http://stackoverflow.com/q/26361161
type: Comment
score: 0
type: QuestionComment
has text: @charen you have written properties in a 2 files .so if you want to set property of file one to value of file 2 ,you first need to read property2 from file 2 then you have to over write propery1 of file1 from that value

http://stackoverflow.com/comment/41550554
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26454683
has text: I added my main into the ActionListener. but I am still getting the output as null. Also how do I use the `dispose()` ?

http://stackoverflow.com/q/26452903
has answer: http://stackoverflow.com/a/50943796
tagged with: websocket
score: 131
linked to: http://stackoverflow.com/q/1982530
favorite count: 0
possible better answer: http://stackoverflow.com/a/26467775
has answer: http://stackoverflow.com/a/35934800
has title: javax.websocket client simple example
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26454417
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/73909824
type: Question
has answer: http://stackoverflow.com/a/26467775
has answer: http://stackoverflow.com/a/26454417
answer count: 6
has answer: http://stackoverflow.com/a/58161467
upvote count: 133
has body: Can someone please provide me very simple example of websocket client using javax.websocket? I want to connect to websocket (ws://socket.example.com:1234), send message (add channel) and listen to messages. All messages (sent &amp; listened) are in JSON format. And btw is this library the best for simple websocket communication?

http://stackoverflow.com/comment/41644700
comment on: http://stackoverflow.com/q/26507039
has text: Does field1, field2 mean that you want to concatenate the values of each field?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41373343
score: 0
comment on: http://stackoverflow.com/q/26357009
has text: @laalto Ok Thanks . I forget to put this.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41506071
score: 1
comment on: http://stackoverflow.com/a/26430495
type: AnswerComment
has text: The `|` syntax is actually valid in java for exceptions. (At least, usually; clearly OP is having an issue with it).
type: Comment

http://stackoverflow.com/a/26400155
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26400045
upvote count: 1
has body: You start with an array size of zero... int count = 0; String[] array = new String[count];
score: 1

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/26359308
type: Tag
tags question: http://stackoverflow.com/q/26395994

http://stackoverflow.com/a/26353974
downvote count: 0
has body: System.out.println(al.get(index).name);
has comment: http://stackoverflow.com/comment/41368059
type: Answer
answers question: http://stackoverflow.com/q/26353862
upvote count: 1
score: 1

http://stackoverflow.com/a/26396957
has body: While returning the value do not write "()" after the variable name.
answers question: http://stackoverflow.com/q/26396839
score: 0
type: Answer

http://stackoverflow.com/q/26432162
type: Question
has comment: http://stackoverflow.com/comment/41509314
linked to: http://stackoverflow.com/q/10579348
tagged with: hashset
accepted answer: http://stackoverflow.com/a/26432289
linked to: http://stackoverflow.com/q/10626414
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26432289
has comment: http://stackoverflow.com/comment/41509076
favorite count: 0
type: AnsweredQuestion
tagged with: java
has body: I'm implementing the non-deterministic finite automaton described in this post and this other post, using Konrad Rudolph's proposed algorithm. Instead of using a C++ multimap, I used a HashSet&lt;Character&gt; [][] transitions array (this is homework and Google's guava library cannot be used). The 1st dimension is the origin state, 2nd dimension is the destiny state and the HashSet defines the symbols for transition between origin and destiny states. The constructor for my Automaton class is: Automaton (int numberOfStates) { this.numberOfStates = numberOfStates; alphabet = new HashSet&lt;&gt;(); finalStates = new HashSet&lt;&gt;(); transitions = new HashSet[numberOfStates][numberOfStates]; for (int i = 0; i &lt; numberOfStates; i++) { for (int j = 0; j &lt; numberOfStates; j++) { transitions[i][j] = new HashSet&lt;Character&gt;(); } } } This is my implementation of Konrad Rudolph's algorithm using this transitions array: public String readStringInAutomaton (char[] inputString, int initialState) { HashSet&lt;Integer&gt; currentStates = new HashSet&lt;&gt;(); HashSet&lt;Integer&gt; nextStates = new HashSet&lt;&gt;(); currentStates.add(initialState); // for each char in inputString for (int charIndex = 0; charIndex &lt; inputString.length; charIndex++) { char currentTransitionChar = inputString[charIndex]; // for each state in currentStates for (Integer originState : currentStates) { // for each transition starting from originState, current // char for (int destinyStateIndex = 0; destinyStateIndex &lt; numberOfStates; destinyStateIndex++) { if (transitions[originState][destinyStateIndex] .contains(currentTransitionChar)) { nextStates.add(destinyStateIndex); } } } currentStates = nextStates; } } I've tried replacing every instantiation of HashSet with Collections.synchronizedSet(new HashSet&lt;&gt;());, as recommended in Oracle's HashSet documentation. But then I get a java.lang.ArrayStoreException: java.util.Collections$SynchronizedSet when initializing transitions. fo…
has title: java.util.ConcurrentModificationException with HashSet
tagged with: concurrency

http://stackoverflow.com/comment/41650435
comment on: http://stackoverflow.com/a/26510059
type: AnswerComment
type: Comment
score: 0
has text: Thank you very mutch, could you please write the correct code to wait until all other threads end? and its not an exercice i realy need this

ant
tags question: http://stackoverflow.com/q/26485777
tags question: http://stackoverflow.com/q/26375186
tags question: http://stackoverflow.com/q/26468024
tags question: http://stackoverflow.com/q/26361722
tags question: http://stackoverflow.com/q/26433681
tags question: http://stackoverflow.com/q/26509118
tags question: http://stackoverflow.com/q/26416071
type: Tag
tags question: http://stackoverflow.com/q/26461061
tags question: http://stackoverflow.com/q/26470385
tags question: http://stackoverflow.com/q/26410290
tags question: http://stackoverflow.com/q/26489966
tag name: ant
tags question: http://stackoverflow.com/q/26459392
tags question: http://stackoverflow.com/q/26483963
tags question: http://stackoverflow.com/q/26403719
tags question: http://stackoverflow.com/q/26423371
tags question: http://stackoverflow.com/q/26495505
tags question: http://stackoverflow.com/q/26356505
tags question: http://stackoverflow.com/q/26492198

http://stackoverflow.com/comment/41472118
comment on: http://stackoverflow.com/q/26411358
has text: Thanks a lot. Rserve is definitely very helpful!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41566361
has text: It is important to remember that regular expressions are used to get/match a charecter sequence inside a string. So it is very important to know the format of the Surname. SURNAME=[^,]+ can be a good solution, but doesn't work if a surname can contain a comma character... so you have to exactly define the format of the all possible surnames before trying to match it by a regex
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26463866

http://stackoverflow.com/comment/41483588
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26418255
has text: Please show the content of your configuration file. Also show the output when running your program with `-Dlog4j.debug=true` in the command line
type: QuestionComment

http://stackoverflow.com/comment/41583534
has text: This is the final code except for the fact that the getters are not the same, as you noticed. Thus, the values would contain different values. Also, the code was part of an HTTP request...but I didn't include that code either since I thought that would distract from my main question.
comment on: http://stackoverflow.com/q/26472867
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26513633
has body: Is it possible for two applications to share the same context root is they're in separate managed servers/cluster? What if they're in the same managed server/cluster, can you have something like one application use /path1 and another one use /path1/path2
linked to: http://stackoverflow.com/q/1797620
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: WebLogic context roots
has answer: http://stackoverflow.com/a/26518693
type: UnansweredQuestion
upvote count: 1
tagged with: war
type: Question
tagged with: jakarta-ee
tagged with: weblogic
tagged with: java
linked to: http://stackoverflow.com/q/9818961

http://stackoverflow.com/q/26387186
has comment: http://stackoverflow.com/comment/41429129
downvote count: 4
has body: I want to log in to this website programmatically. This site asks for username, password and captcha. I don't know whether it is possible to log in automatically to a website which uses captcha. I searched stackoverflow but I didn't get any solution to this. This is the JAVASCRIPT function of login button.. function submitData(){ document.getElementById('txtSN').value=document.getElementById('txtReg').value; document.getElementById('txtPD').value=document.getElementById('txtPw').value; if(document.getElementById('txtSN').value == '' || document.getElementById('txtSN').length == 0) { alert(' Please Enter Student Register No/Studen ID'); document.getElementById('txtSN').focus(); return false; } if(document.getElementById('txtPD').value == '' || document.getElementById('txtPD').length == 0) { alert(' Please Enter Password'); document.getElementById('txtPD').focus(); return false; } if(document.getElementById('txtverifycode').value == '' || document.getElementById('txtverifycode').length == 0) { alert(' Please Enter Verification Code'); document.getElementById('txtverifycode').focus(); return false; } document.getElementById('txtPA').value=1; document.getElementById('txtReg').value="iamalsouser"; document.getElementById('txtPw').value="thanksandregards"; document.getElementById('frmStudentMain').action="http://evarsity.srmuniv.ac.in/srmswi/usermanager/youLogin.jsp"; document.getElementById('frmStudentMain').submit(); }
upvote count: 1
has comment: http://stackoverflow.com/comment/41428305
has comment: http://stackoverflow.com/comment/41428218
answer count: 1
tagged with: httpclient
has comment: http://stackoverflow.com/comment/41429265
has comment: http://stackoverflow.com/comment/41428806
favorite count: 0
has comment: http://stackoverflow.com/comment/41520091
has comment: http://stackoverflow.com/comment/41519709
has comment: http://stackoverflow.com/comment/41519528
has comment: http://stackoverflow.com/comment/41428744
has comment: http://stackoverflow.com/comment/41519576
has comment: http://stackoverflow.com/comment/41519899
has comment: http://stackoverflow.com/comment/41520041
has comment: http://stackoverflow.com/comment/41428163
has comment: http://stackoverflow.com/comment/41428629
has comment: http://stackoverflow.com/comment/41525737
has comment: http://stackoverflow.com/comment/41519781
has comment: http://stackoverflow.com/comment/41428885
has comment: http://stackoverflow.com/comment/41525698
has comment: http://stackoverflow.com/comment/41519932
has comment: http://stackoverflow.com/comment/41428267
has comment: http://stackoverflow.com/comment/41428560
has comment: http://stackoverflow.com/comment/41519604
linked to: http://stackoverflow.com/q/9331939
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41519491
has comment: http://stackoverflow.com/comment/41519565
score: -3
tagged with: authentication
has comment: http://stackoverflow.com/comment/41519740
has answer: http://stackoverflow.com/a/26387263
has comment: http://stackoverflow.com/comment/41519786
has title: How to programmatically log in to a website which asks captcha using java?
has comment: http://stackoverflow.com/comment/41428441
tagged with: captcha
has comment: http://stackoverflow.com/comment/41519684
has comment: http://stackoverflow.com/comment/41428760
tagged with: java
has comment: http://stackoverflow.com/comment/41428984
linked to: http://stackoverflow.com/q/2285250
has comment: http://stackoverflow.com/comment/41519514
type: Question
has comment: http://stackoverflow.com/comment/41519502

http://stackoverflow.com/q/26361514
has comment: http://stackoverflow.com/comment/41381508
answer count: 0
type: UnansweredQuestion
tagged with: managed-bean
has title: javalang.illegalstateException :setAttributeSessionaalredyInvalidated
tagged with: java
has comment: http://stackoverflow.com/comment/41381780
type: Question
has body: i got the following error --> javalang.illegalstateException :setAttributeSessionaalredyInvalidated in my managedBean @ManagedBean(name = "cAcessoSistema") @RequestScoped public class CAcessoSistema implements Serializable { private static final long serialVersionUID = 1L; private transient Password password; private transient InputText login; private transient InputText email; private String paginaAutenicado; private Acesso acesso; private Usuario usuario; private String horaAtual; private boolean btnEntrarDisable; private boolean estaNaHR; private Map&lt;String, String&gt; ipsHrtech; @PostConstruct public void inicioSessao() { LogManager.getLogger(CAcessoSistema.class).info("teste info"); System.out.println("verificarIP"); acesso = new Acesso(); usuario = new Usuario(); public String actAutenticar() { HttpSession sessao = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true); paginaAutenicado = "/protegido/index.jsf?faces-redirect=true"; acesso = new Acesso(login.getValue().toString(), password.getValue().toString()); usuario = new Usuario(acesso); System.out.println("Acesso" + acesso); System.out.println("usuario" + usuario); try { new AutenticadorUsuario().autenticar(usuario); FacesContext.getCurrentInstance().getExternalContext().dispatch("/j_spring_security_check?j_username=" + usuario.getAcesso().getLogin() + "&amp;j_password=" + usuario.getAcesso().getSenha()); new ContadorSessao().gravarDadosSessao(sessao); System.out.println("Esotou no metodo 1"); if (Boolean.FALSE.equals(usuario.isAbreVisita())) { System.out.println("Esotou no metodo 2"); sessao.setAttribute("estaNaHR", true); System.out.println("estaNaHR ????? " + sessao.getAttribute("estaNaHR")); System.out.println("Esotou no metodo 3"); usuario.setClienteAlocado(usuario.getCliente()); new CadastradorUsuario().atualizarClienteAloca(usuario); sessao.setAttribute("paginaInicial", paginaAutenicado); sessao.setAttribute("usuario", usuario); the exception is in this part -----…
score: 0
tagged with: illegalstateexception
has comment: http://stackoverflow.com/comment/41381817
has comment: http://stackoverflow.com/comment/41381191

http://stackoverflow.com/a/26392092
upvote count: 4
answers question: http://stackoverflow.com/q/26392015
downvote count: 0
has comment: http://stackoverflow.com/comment/41437205
has body: Your code does absolutely no multithreading. Thread.join means wait until that thread has finished executing, then continue the current thread of execution. Right now, your code is executing each thread serially. You want to interleave your calls to start and join. Thread first = new Thread(calculate); Thread third = new Thread(calculate); Thread second = new Thread(calculate); first.start(); second.start(); third.start(); first.join(); second.join(); third.join();
has comment: http://stackoverflow.com/comment/41437155
has comment: http://stackoverflow.com/comment/41437124
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/26392015
type: Answer

http://stackoverflow.com/a/26422766
has comment: http://stackoverflow.com/comment/41499100
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41500179
has comment: http://stackoverflow.com/comment/41492767
has comment: http://stackoverflow.com/comment/41498824
has comment: http://stackoverflow.com/comment/41499559
has comment: http://stackoverflow.com/comment/41499877
has body: Use Main from bellow: public static void main(String[] args) throws Exception { JobConf conf = new JobConf(artistandTrack.class); conf.setJobName("artisttrack"); FileInputFormat.setInputPaths(conf, new Path(args[0])); FileOutputFormat.setOutputPath(conf, new Path(args[1])); conf.setMapperClass(Map.class); //conf.setCombinerClass(Reduce.class); conf.setReducerClass(Reduce.class); //conf.setOutputKeyClass(Text.class); //conf.setOutputValueClass(IntWritable.class); conf.setMapOutputKeyClass(Text.class); conf.setMapOutputValueClass(Text.class); conf.setInputFormat(TextInputFormat.class); conf.setOutputFormat(TextOutputFormat.class); JobClient.runJob(conf); }
has comment: http://stackoverflow.com/comment/41497867
has comment: http://stackoverflow.com/comment/41499604
answers question: http://stackoverflow.com/q/26420512

http://stackoverflow.com/comment/41627887
type: Comment
comment on: http://stackoverflow.com/a/26497437
has text: @user3751576, That question doesn't make sense to me. What are you trying to ask? What's the real goal here?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/45713963
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26447360
has text: Since Dagger is a code generation based DI framework, how is it supposed to wire up the object graph based on generics? Guice is reflection based, meaning at runtime it can figure all that out.

http://stackoverflow.com/q/26473871
has body: When extending a Java class, it can be very useful to have quick access to the implementation of all available methods, regardless of whether they are explicitly implemented in said class or inherited from one of its parent classes. The closest tool that I have been able to find within Eclipse for this purpose is the "Type Hierarchy" view with the "Show all inherited members" option enabled. Unfortunately, that option really does show all inherited members, including the ones that have already been overridden in a parent class. This makes it difficult to tell at a glance which method implementation is the one that is relevant, and things become even more complex with the use of default methods in interfaces. Is there an option, view, plugin or other technique that would allow quick access only to the method implementations that are relevant to a specific class, including any inherited implementations?
favorite count: 0
has title: How to list all available methods of a class in Eclipse?
has answer: http://stackoverflow.com/a/26473954
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26474613
answer count: 4
score: 7
tagged with: java
tagged with: methods
upvote count: 7
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/54804647
has answer: http://stackoverflow.com/a/26474024
downvote count: 0

http://stackoverflow.com/comment/41406393
has text: In java there in inbuilt method which can be used for sorting. Java.util.Arrays. it can sort primitive type data . see oracle docs for more details.
comment on: http://stackoverflow.com/a/26375129
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41452679
type: Comment
comment on: http://stackoverflow.com/q/26401426
type: QuestionComment
has text: What are you trying to achieve?
score: 0

http://stackoverflow.com/comment/41487149
score: 0
type: AnswerComment
type: Comment
has text: That's what i have done right? my getResultSet() returns rs object.
comment on: http://stackoverflow.com/a/26418968

http://stackoverflow.com/q/26412052
tagged with: java
has body: Sorry if this is an obvious problem. I'm trying to read integers from users and store them in an array. The thing is that I want to use arraylist, because the size of the input is not for sure If I know the size then I know a way to do that, which is class Test1 { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.println("Please input your numbers"); int num; // integer will be stored in this variable ArrayList&lt;Integer&gt; List = new ArrayList&lt;Integer&gt;(); // for example if I know the size of the input is 5, // then I read one single number and put it into the arraylist. for (int i = 0; i &lt;= 4; i++) { num = reader.nextInt(); List.add(num); } System.out.println(List); } } How to do this if I don't know the size? Except for reading one number in each loop, is there any better way to do that? Can I use BufferedReader instead of Scanner? Thanks a lot for any help!
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26412110
has answer: http://stackoverflow.com/a/26412110
tagged with: arrays
has answer: http://stackoverflow.com/a/26412364
answer count: 3
downvote count: 0
has title: how to read integers and store them in an array in java
favorite count: 0
has answer: http://stackoverflow.com/a/26412105
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26412105
score: 1

http://stackoverflow.com/q/26406672
tagged with: java
has comment: http://stackoverflow.com/comment/41462463
type: Question
has title: how to merge two projects
has comment: http://stackoverflow.com/comment/41462834
has body: im trying to merge two projects with refactor first I copied layout ,values and others then refactor package ,lib and gen and I have no errors also declared in the manifest orginal one still working but when i start activity from other the app stop working in the elmnator if there is no solution how to merge with making tabs project library?? all code >>>http://www27.zippyshare.com/v/95879181/file.html activity_main.xml <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v4.view.ViewPager> MainActivity package info.androidhive.tabsswipe; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Top Rated", "Games", "Movies" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavi…
has comment: http://stackoverflow.com/comment/41462217
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41462067
score: 0
has comment: http://stackoverflow.com/comment/41464158
answer count: 1
has answer: http://stackoverflow.com/a/26406924
has comment: http://stackoverflow.com/comment/41462392
accepted answer: http://stackoverflow.com/a/26406924
tagged with: android
has comment: http://stackoverflow.com/comment/41462421
has comment: http://stackoverflow.com/comment/41465167
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41462260

http://stackoverflow.com/comment/41601536
comment on: http://stackoverflow.com/a/26483074
type: Comment
has text: Thank you very much. This is the solution I was looking for. Great help.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26474468
upvote count: 0
score: -5
tagged with: arrays
has comment: http://stackoverflow.com/comment/41586478
favorite count: 0
has comment: http://stackoverflow.com/comment/41586375
type: Question
has body: int m; Scanner obj=new Scanner(System.in); System.out.println("limit of array start from 0"); m=obj.nextInt(); int[] array=new int[m]; int[] pro=new int[m]; int front=0; int rear=m; System.out.println("Array element entry"); for(int i=0;i&lt;array.length;i++) array[i]=obj.nextInt(); System.out.println("size"+array.length); array[front]=array[front]+array[rear]; for(int j=0;j&lt;pro.length;j++) System.out.println(" the array"+array[j]);
has comment: http://stackoverflow.com/comment/41586329
has comment: http://stackoverflow.com/comment/41586393
has answer: http://stackoverflow.com/a/26474503
answer count: 2
has title: Why here array out of bound exception ocuur?
tagged with: java
downvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26474520

http://stackoverflow.com/comment/41446435
comment on: http://stackoverflow.com/a/26397120
type: Comment
has text: @fge Thanks for the info. Then in this case the `URI` class itself is capable to properly encode. Example: `String query="data=Something wierd+"`, using `URI`: `new URI("http", null, "somehost.com", 80, "/something", query, null)` results in `"http://somehost.com:80/something?data=Something%20wierd+"`. Here space is converted to `%20` and the plus sign is left intact. Can you confirm this is correct?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26458438
accepted answer: http://stackoverflow.com/a/26458496
has body: I would like to check whether a string contains a sub list. For example, str1 = "qwertyuiop" and str2 = "tyu" returns true. I have written an iterative method. public static boolean checkString(String str1, String str2) { for (int i=0; i&lt;str2.length(); i++) { int j = 0; for (; j&lt;str1.length()&amp;&amp; str1.charAt(j)!=str2.charAt(i); j++) { } if (j== str1.length()) return false; } return true; } I am trying changing it to recursive method but not sure how as there are two nested for loops. Thank you in advance.
answer count: 2
possible better answer: http://stackoverflow.com/a/26458488
has title: java iterative to recursive 2 nested for loop
has answer: http://stackoverflow.com/a/26458488
downvote count: 0
has comment: http://stackoverflow.com/comment/41556915
favorite count: 0
has comment: http://stackoverflow.com/comment/41556841
has answer: http://stackoverflow.com/a/26458496
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/41556847

http://stackoverflow.com/a/26436376
type: AcceptedAnswer
has body: You can use this code in your manifest. This will hide the Keyboard when the activity starts. &lt;activity android:name="com.your.package.ActivityName" android:windowSoftInputMode="stateHidden" /&gt; or you can use this in java code. getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); this will keep the keyboard hidden until and unless you touch edit text. HOPE this helps :)
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26435996
answers question: http://stackoverflow.com/q/26435996
upvote count: 1

http://stackoverflow.com/comment/41525572
type: QuestionComment
comment on: http://stackoverflow.com/q/26434320
score: 0
has text: see http://www.coderanch.com/t/366059/Servlets/java/encodeURL-purpose-place
type: Comment

http://stackoverflow.com/a/26455984
has body: If you are new to programming, i suggest that you start by desining the procces and when you are done start programming... passing this block String line = null; while((line = br.readLine()) != null){ String [] entryData = line.split(","); AddressEntry a = new AddressEntry(); a.firstName = entryData[0]; a.lastName = entryData[1]; a.unitNumber = entryData[2]; a.bedRoomQty = Integer.parseInt(entryData[3]); a.bathRoomQty = Integer.parseInt(entryData[4]); a.rent = Integer.parseInt(entryData[5]); addressMap.put(a.firstName, a); } br.close(); all tenants information should be loaded in addressMap. So, at this point you should iterate over addressMap and start adding up the rent... double total = 0.0; double sum = 0.0; for(Entry&lt;String, AdressEntry&gt; entry : addressMap.entrySet()) { total++; sum = sum + entry.getValue().rent; } double average = sum / total; so, the procces is: read the file and recover info of tenants. calculate average rent. bye!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26455898

http://stackoverflow.com/q/26418798
has comment: http://stackoverflow.com/comment/41484360
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/26419227
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41485957
has comment: http://stackoverflow.com/comment/41484599
upvote count: 0
answer count: 1
has title: Explain about the volatile in this case in java
favorite count: 0
type: UnansweredQuestion
has body: I have a following code as below: class Example { private volatile int testValue = 0; public int getTestValue() { return testValue; } public void setTestValue(int testValue) { this.testValue = testValue; } public void increment() { this.testValue += 1; } } class PrintThread extends Thread { private Example example; private int x = 0; public PrintThread(Example example) { this.example = example; x = example.getTestValue(); } public void run() { while(true) { if(x != example.getTestValue()) { // block 1 System.out.println("printThread: " + example.getTestValue()); x = example.getTestValue(); } } } } class IncrementorThread extends Thread { private Example example; public IncrementorThread(Example example) { this.example = example; } public void run() { while(true) { example.increment(); System.out.println("incrementorThread: " + example.getTestValue()); try { Thread.sleep(800); } catch(Exception ex) { } } } } public class VolatileExample { public static void main(String args[]) { Example ex = new Example(); new IncrementorThread(ex).start(); new PrintThread(ex).start(); } } When I remove volatile keyword in Example class then I never see the output of PrintThread. In PrintThread when I print out the testValue of example, value of example object still updated but the code in 'block 1' never be executed. Both thread still access the same object, can anyone explain me more detail about this? About the volatile keyword affected in this case

http://stackoverflow.com/comment/41438955
score: 0
type: AnswerComment
has text: I tried that, but it doesn't help any. I know that the `pathid` is getting set properly, since I can use is for the classpath in the `taskdef`.
type: Comment
comment on: http://stackoverflow.com/a/26391475

http://stackoverflow.com/comment/41612452
type: QuestionComment
has text: @big The problem is here, Collections.sort uses compareTo many times, about N log N times for merge sort (if you use java6). So your calculate method is called more than once for each element. Use the answer below, guy is trying really hard.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26488688

http://stackoverflow.com/comment/41541296
comment on: http://stackoverflow.com/q/26449721
type: Comment
type: QuestionComment
has text: @S.D. How else do I pass in the context of ContactActivity class?
score: 0

http://stackoverflow.com/q/26462860
has title: What is the best way to run my program every morning and email report?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26462909
has comment: http://stackoverflow.com/comment/41564386
has body: I currently have a java program that analyses data and outputs a report to the console. I run this every morning, as the data is pulled from a webpage which changes daily. What is the best way for me to automate this program and get it to run every morning and maybe email the report to me? Is there some way of uploading it online? Thanks in advance for your help, Rob
type: AnsweredQuestion
tagged with: report
tagged with: java
has answer: http://stackoverflow.com/a/26462909
type: Question
tagged with: automation

http://stackoverflow.com/a/26507338
accepted answer of: http://stackoverflow.com/q/26504832
answers question: http://stackoverflow.com/q/26504832
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Use a recursive approach. If you can have zeros (i.e. don't have to use all exponents), you can do this: boolean has_a_representation(int n) { return has_a_representation(n, Integer.MAX_VALUE); } boolean has_a_representation(int n, int max_exponent) { if (n == 0) return true; for (int digit: allowedNumbers) { int power = digit; for (int exp = 1; exp &lt; max_exponent &amp;&amp; power &lt;= n; ++exp) { if (has_a_representation(n - power, exp)) return true; power *= digit; } } return false; } If you have to use all exponents, it becomes even easier and faster: boolean has_a_representation(int n) { return has_a_representation(n, 1); } boolean has_a_representation(int n, int exp) { for (int digit: allowedNumbers) { int power = digit; for (int i = 1; i &lt; exp; ++i) power *= digit; if (n == power) return true; if (n &lt; power) // allowedNumbers must be sorted break; if (has_a_representation(n - power, exp + 1)) return true; } return false; } Some results from that latter code, augmented to collect the digits: 100 = 21 + 32 + 23 + 34 25 = 81 + 81 + 32 + 23 19 = 21 + 21 + 32 + 23 100000 = 21 + 22 + 33 + 44 + 35 + 46 + 47 + 28 + 39 + 310 1234567 = 21 + 21 + 22 + 23 + 44 + 65 + 56 + 57 + 48 + 39 + 210 + 211 + 212 + 213 + 214 + 215 + 216 + 217 + 218 + 219 234567 = 21 + 21 + 22 + 23 + 64 + 95 + 56 + 57 + 38 + 29 + 310 + 211 + 212 + 213 As you can see, this prefers smaller numbers. If you don't want that, you'd have to reverse the allowedNumbers array and adapt the n &lt; power code path.

http://stackoverflow.com/q/26498522
possible better answer: http://stackoverflow.com/a/26499871
answer count: 2
has answer: http://stackoverflow.com/a/26499871
accepted answer: http://stackoverflow.com/a/26498548
favorite count: 0
tagged with: constructor
tagged with: return
downvote count: 8
score: -4
has comment: http://stackoverflow.com/comment/41630454
has title: "Missing return statement" error in Java
has body: I don't know what's wrong with this one. I have done this with examples of other codes. And now I'm stuck just because of this single thing. import java.util.Scanner; import java.util.Calendar; public class Praktikum3 { Scanner scan = new Scanner(System.in); Calendar cal = Calendar.getInstance(); String NIP, nama, kelamin, jabat, sub1, sub2, sub3, sub4; int a, b, c, d, e, umur, menjabat, tgllhr, blnlhr, thnlhr, lhr, blnjbt, thnjbt, date, month, year; public Praktikum3() //constructor { System.out.printf("DATA KARYAWAN\n\n"); //menginisialkan constructor } public void setNama() { System.out.printf("Nama: " ); nama = scan.next(); } public String getNama() { return nama; } public void setNIP() { System.out.printf("NIP : " ); while (!scan.hasNextLong()) { System.out.printf("!HARUS ANGKA!\n"); System.out.printf("NIP : "); scan.next(); } NIP = scan.next(); if(NIP.length() != 18) { System.out.printf("!HARUS 18 KARAKTER!\n"); System.out.printf("NIP : "); scan.next(); } sub1 = NIP.substring(0,8); /*substring Tanggal lahir*/ sub2 = NIP.substring(8,14); /*substring Masa menjabat*/ sub3 = NIP.substring(14,15); /*substring Jenis kelamin*/ sub4 = NIP.substring(15,18); /*substring Nomor urut*/ date = cal.get(Calendar.DATE); month = cal.get(Calendar.MONTH); year = cal.get(Calendar.YEAR); a = Integer.parseInt(sub1.substring(6,8)); b = Integer.parseInt(sub1.substring(4,6)); c = Integer.parseInt(sub1.substring(0,4)); d = Integer.parseInt(sub2.substring(4,6)); e = Integer.parseInt(sub2.substring(0,4)); } public String getSub1() { return sub1; } public String getSub2() { return sub2; } public String getSub3() { return sub3; } public String getSub4() { return sub4; } public int getTgllhr() { return a; } public int getBlnlhr() { return b; } public int getThnlhr() { return c; } public int getUmur() { tgllhr = date - a; blnlhr = month - b; if(blnlhr &lt; 0) lhr = -1; else if(tgllhr &lt; 0) lhr = -1; else lhr = 0; thnlhr = year - c; umur = thnlhr + lhr; return umur; } public String getKelami…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41629967
has comment: http://stackoverflow.com/comment/41629769
type: Question
has comment: http://stackoverflow.com/comment/41629823
has comment: http://stackoverflow.com/comment/41629853
upvote count: 4
has answer: http://stackoverflow.com/a/26498548

http://stackoverflow.com/comment/123413032
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26409796
has text: Note, if you are writing a library where it might be uncouth to take over the one-and-only instance of URLStreamHandlerFactory, you might want to check my answer, which uses a different mechanism to add support for a given protocol: without taking over the only instance of URLStreamHandlerFactory.
type: AnswerComment

http://stackoverflow.com/a/26460563
has body: I presume there is only one issue, the transaction isolation level is allowing dirty reads even before the procedure transaction is committed. I recommend that you put the reading the table section in a new transaction block by using commit after the procedure transaction. And also please check the transaction isolation level.
answers question: http://stackoverflow.com/q/26460159
score: 0
type: Answer

http://stackoverflow.com/comment/41553072
comment on: http://stackoverflow.com/a/26456279
has text: Thanks Stephen, It totally make sense now, I think I didn't reach at this scale of allocation in Java 7 example that is why I didn't see it in Java 7
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41471260
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26411454
has text: You're quite a bit ahead of the pack by understanding the stack trace. With array bounds the important thing to remember is that arrays are origin-zero, so an array of two elements only has elements 0 and 1 in it. And of course, an array with zero elements does not even have element 0 in it. Your check on `currentFrameNumber` probably should be `>=` vs `>`, and maybe should reset to zero.

methods
tags question: http://stackoverflow.com/q/26457267
tags question: http://stackoverflow.com/q/26438651
tags question: http://stackoverflow.com/q/26373962
tags question: http://stackoverflow.com/q/26413398
tags question: http://stackoverflow.com/q/26449633
tags question: http://stackoverflow.com/q/26452633
tags question: http://stackoverflow.com/q/26497549
tags question: http://stackoverflow.com/q/26396554
tags question: http://stackoverflow.com/q/26454675
tags question: http://stackoverflow.com/q/26455325
tags question: http://stackoverflow.com/q/26414950
tag name: methods
tags question: http://stackoverflow.com/q/26459978
tags question: http://stackoverflow.com/q/26448821
tags question: http://stackoverflow.com/q/26361285
tags question: http://stackoverflow.com/q/26501447
tags question: http://stackoverflow.com/q/26495327
tags question: http://stackoverflow.com/q/26464545
tags question: http://stackoverflow.com/q/26429681
tags question: http://stackoverflow.com/q/26361311
tags question: http://stackoverflow.com/q/26395747
type: Tag
tags question: http://stackoverflow.com/q/26509458
tags question: http://stackoverflow.com/q/26408143
tags question: http://stackoverflow.com/q/26359200
tags question: http://stackoverflow.com/q/26458704
tags question: http://stackoverflow.com/q/26479493
tags question: http://stackoverflow.com/q/26455711
tags question: http://stackoverflow.com/q/26451569
tags question: http://stackoverflow.com/q/26367288
tags question: http://stackoverflow.com/q/26364996
tags question: http://stackoverflow.com/q/26382226
tags question: http://stackoverflow.com/q/26511648
tags question: http://stackoverflow.com/q/26473871
tags question: http://stackoverflow.com/q/26436889
tags question: http://stackoverflow.com/q/26431030
tags question: http://stackoverflow.com/q/26425049
tags question: http://stackoverflow.com/q/26431566
tags question: http://stackoverflow.com/q/26392558
tags question: http://stackoverflow.com/q/26441071
tags question: http://stackoverflow.com/q/26445584
tags question: http://stackoverflow.com/q/26452291
tags question: http://stackoverflow.com/q/26458524
tags question: http://stackoverflow.com/q/26499910
tags question: http://stackoverflow.com/q/26396532
tags question: http://stackoverflow.com/q/26471588
tags question: http://stackoverflow.com/q/26394505
tags question: http://stackoverflow.com/q/26354721
tags question: http://stackoverflow.com/q/26484382
tags question: http://stackoverflow.com/q/26367544
tags question: http://stackoverflow.com/q/26394586
tags question: http://stackoverflow.com/q/26432883
tags question: http://stackoverflow.com/q/26477233
tags question: http://stackoverflow.com/q/26371945

http://stackoverflow.com/comment/41440317
score: 0
type: Comment
type: QuestionComment
has text: Order of predence...
comment on: http://stackoverflow.com/q/26393982

http://stackoverflow.com/comment/41431925
type: Comment
comment on: http://stackoverflow.com/a/26389036
has text: netstat -a Active Connections Proto Local Address Foreign Address State TCP 0.0.0.0:80 RafiAbro-PC:0 LISTENING TCP 0.0.0.0:135 RafiAbro-PC:0 LISTENING TCP 0.0.0.0:445 RafiAbro-PC:0 LISTENING TCP 0.0.0.0:554 RafiAbro-PC:0 LISTENING
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41444386
type: Comment
has text: "Write a service" refers to #1, where you rely on a service for a functionality.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26389283

http://stackoverflow.com/a/26439880
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41524772
has comment: http://stackoverflow.com/comment/41524801
answers question: http://stackoverflow.com/q/26439839
has body: You're probably getting an ACTION_DOWN and an ACTION_MOVE and counting both. Try moving your ++ to inside the switch case for ACTION_DOWN.
upvote count: 2

http://stackoverflow.com/q/26498772
answer count: 0
has title: libGDX - Texture Mapping issues
tagged with: java
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/41631574
score: 0
tagged with: 3d
has comment: http://stackoverflow.com/comment/41630269
type: UnansweredQuestion
has body: I am currently in the process of creating a small, 3D game in libGDX. Unfortunately, I am having some issues with texturing. This is a very simple game, so I am using boxes with pictures on them for the monsters. From what I can tell the createBox method in ModelBuilder takes the texture you pass in and slaps it on the front of the box, then rotates it 90 degrees and slaps it on the right side, and so on. I would like for the box to look the same no matter which side you are viewing it from (top and bottom don't matter). Is there a way I can modify the current box to change how it deals with textures, or is there another solution? Example Code: // Adds new box to list of models using createBox method of ModelBuilder models.add(modelBuilder.createBox(3f, 3f, 6f, minM, Usage.Position | Usage.Normal | Usage.TextureCoordinates)); // Increments count to keep track of model count++; // Adds instance of model to list of instances to be rendered later using ModelBatch instances.add(new ModelInstance(models.get(count), (m.getEnd().getX() * spacing), (m.getEnd().getY() * spacing), z)); Problem: When rendered the front of the box looks like this: but the right side, it looks like this: I want every side to look like the front. Thanks for the replies so far!

http://stackoverflow.com/comment/41445740
score: 0
type: AnswerComment
has text: @michdraftlord, you have to use table for subclass approach in that case, see my updated answer.
comment on: http://stackoverflow.com/a/26354414
type: Comment

mysql
tags question: http://stackoverflow.com/q/26418131
tags question: http://stackoverflow.com/q/26424184
tags question: http://stackoverflow.com/q/26489171
tags question: http://stackoverflow.com/q/26491815
tags question: http://stackoverflow.com/q/26389566
tags question: http://stackoverflow.com/q/26495794
tags question: http://stackoverflow.com/q/26402487
tags question: http://stackoverflow.com/q/26453894
tags question: http://stackoverflow.com/q/26379410
tags question: http://stackoverflow.com/q/26429913
tag name: mysql
tags question: http://stackoverflow.com/q/26424723
tags question: http://stackoverflow.com/q/26430854
tags question: http://stackoverflow.com/q/26411343
tags question: http://stackoverflow.com/q/26356224
tags question: http://stackoverflow.com/q/26369165
tags question: http://stackoverflow.com/q/26446357
tags question: http://stackoverflow.com/q/26372572
tags question: http://stackoverflow.com/q/26480418
tags question: http://stackoverflow.com/q/26382452
tags question: http://stackoverflow.com/q/26372994
tags question: http://stackoverflow.com/q/26399633
tags question: http://stackoverflow.com/q/26388465
tags question: http://stackoverflow.com/q/26449259
tags question: http://stackoverflow.com/q/26389011
tags question: http://stackoverflow.com/q/26458525
tags question: http://stackoverflow.com/q/26474903
tags question: http://stackoverflow.com/q/26448475
tags question: http://stackoverflow.com/q/26422320
tags question: http://stackoverflow.com/q/26385029
tags question: http://stackoverflow.com/q/26397598
tags question: http://stackoverflow.com/q/26488999
tags question: http://stackoverflow.com/q/26421889
tags question: http://stackoverflow.com/q/26499215
tags question: http://stackoverflow.com/q/26470117
tags question: http://stackoverflow.com/q/26513330
tags question: http://stackoverflow.com/q/26369819
tags question: http://stackoverflow.com/q/26457219
tags question: http://stackoverflow.com/q/26508163
tags question: http://stackoverflow.com/q/26421859
tags question: http://stackoverflow.com/q/26362701
tags question: http://stackoverflow.com/q/26445897
tags question: http://stackoverflow.com/q/26468245
tags question: http://stackoverflow.com/q/26500574
tags question: http://stackoverflow.com/q/26449538
tags question: http://stackoverflow.com/q/26438141
tags question: http://stackoverflow.com/q/26496408
tags question: http://stackoverflow.com/q/26385780
type: Tag
tags question: http://stackoverflow.com/q/26479773
tags question: http://stackoverflow.com/q/26427068
tags question: http://stackoverflow.com/q/26358833
tags question: http://stackoverflow.com/q/26357332
tags question: http://stackoverflow.com/q/26366368
tags question: http://stackoverflow.com/q/26490057
tags question: http://stackoverflow.com/q/26358221
tags question: http://stackoverflow.com/q/26375269
tags question: http://stackoverflow.com/q/26510344
tags question: http://stackoverflow.com/q/26425045
tags question: http://stackoverflow.com/q/26416847
tags question: http://stackoverflow.com/q/26396677
tags question: http://stackoverflow.com/q/26363571
tags question: http://stackoverflow.com/q/26461605
tags question: http://stackoverflow.com/q/26512373
tags question: http://stackoverflow.com/q/26440255
tags question: http://stackoverflow.com/q/26378831
tags question: http://stackoverflow.com/q/26394885
tags question: http://stackoverflow.com/q/26482849
tags question: http://stackoverflow.com/q/26450686
tags question: http://stackoverflow.com/q/26444253
tags question: http://stackoverflow.com/q/26415059
tags question: http://stackoverflow.com/q/26479333
tags question: http://stackoverflow.com/q/26484161
tags question: http://stackoverflow.com/q/26448300
tags question: http://stackoverflow.com/q/26438423
tags question: http://stackoverflow.com/q/26374660
tags question: http://stackoverflow.com/q/26426878
tags question: http://stackoverflow.com/q/26376776
tags question: http://stackoverflow.com/q/26358973
tags question: http://stackoverflow.com/q/26441303

http://stackoverflow.com/comment/41381894
has text: I did think of something like that. Of course, you'd need to apply `round` and `abs` to make it a positive integer. I don't think the distribution would be very uniform. That's not a problem in my current use case, but it hurts the perfectionist inside :)
comment on: http://stackoverflow.com/a/26361766
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/68074394
comment on: http://stackoverflow.com/a/26434468
type: AnswerComment
has text: How can dependency injection share state between classes?
score: 0
type: Comment

http://stackoverflow.com/a/26506612
upvote count: 1
answers question: http://stackoverflow.com/q/26505997
has body: You can try in this way return Integer.toString(age); public class intToS { public String whatAge() { int age = 25; if (age % 2 == 0) { age += 2; } else age += 3; return Integer.toString(age); } public static void main(String[] args) { intToS obj = new intToS(); System.out.println("Age = "+obj.whatAge()); } }
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41404070
has text: Okay, thank you, that is what I really was getting at
score: 0
comment on: http://stackoverflow.com/q/26373160
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41503816
type: AnswerComment
has text: @user182944 I have no idea what that command is supposed to do and it doesn't work in run on my computer. Is there a program on your computer named `start demo` that you are trying to run?
comment on: http://stackoverflow.com/a/26408118
type: Comment
score: 0

http://stackoverflow.com/q/26454322
has comment: http://stackoverflow.com/comment/41549476
has comment: http://stackoverflow.com/comment/41549509
has answer: http://stackoverflow.com/a/26473796
score: 0
tagged with: exception
tagged with: throw
has comment: http://stackoverflow.com/comment/41586856
has body: In my CS class, we have to write a program that throws an exception if the user enters a negative number; the program should prompt the user to enter only positive numbers and then let them retype the number. But every time I throw an exception, my program gets suspended. What am I doing wrong, or is there no way to continue a program if an exception is thrown? Does the program automatically get suspended when an exception is thrown? try{ do { N = kb.nextDouble(); if(N&lt;0) { throw new NegativeArraySizeException(); } else j++; } while(j==0); fill.size(N); } catch(NegativeArraySizeException e) { System.out.println("The number you entered must be positive. Please try again."); }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26454343
has title: How to use an exception?
tagged with: java
has comment: http://stackoverflow.com/comment/41586902
type: Question
tagged with: try-catch
answer count: 2

http://stackoverflow.com/comment/41382038
comment on: http://stackoverflow.com/q/26362069
type: Comment
type: QuestionComment
score: 1
has text: If its a good practice or not, shouldn't this work?

http://stackoverflow.com/comment/41619588
has text: Yes, @loader_path is relative to the location of the jnilib on the file system, it acts in the same manner as the $ORIGIN variable for rpath under Linux
comment on: http://stackoverflow.com/a/26480551
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26422366
possible better answer: http://stackoverflow.com/a/26422928
has answer: http://stackoverflow.com/a/26422734
score: 1
accepted answer: http://stackoverflow.com/a/26422734
has comment: http://stackoverflow.com/comment/41490972
favorite count: 0
has comment: http://stackoverflow.com/comment/41490666
upvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26422928
downvote count: 0
has body: I've got a text file which look like below : ap apple og orange gp grape I would want the jcombobox to show apple,orange,grape in the dropdown but when select it output ap , og and gp
has title: Jcombobox reading from textfile with 2 mapping value

http://stackoverflow.com/q/26501661
has answer: http://stackoverflow.com/a/27612241
score: 0
has title: Jetty - Jersey and Jar issue
answer count: 1
tagged with: jetty
accepted answer: http://stackoverflow.com/a/27612241
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has body: i'm new in Jetty. I always works on Tomcat but for this project i need to use an embedded jetty server. My project structure is: src package controller main ... WebContent META-INF WEB-INF lib web.xml I created a main inside package.main like this: public class ServerLauncher { public static void main(String[] args) throws Exception { new ServerLauncher().configureServer(); } public void configureServer() throws Exception{ Server server = new Server(8080); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar("WebContent"); server.setHandler(webapp); server.start(); server.join(); } } My problem is: When i execute it from eclipse, it correctly works. When i export a RunnableJar File, it doesn't find me Webcontent: SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version - Logging initialized @248ms - jetty-9.3.z-SNAPSHOT - Web application not found WebContent - Failed startup of context o.e.j.w.WebAppContext@7d19979e{/,null,null}{WebContent} java.io.FileNotFoundException: WebContent at org.eclipse.jetty.webapp.WebInfConfiguration.unpack(WebInfConfiguration.java:493) at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:72) at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:460) at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) at org.eclipse.jetty.server.Server.start(Server.java:388) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) at org.eclipse.jetty.server.Server.doStart(Server.java:355) at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) at package.main.…
type: Question

http://stackoverflow.com/a/26492465
accepted answer of: http://stackoverflow.com/q/26489072
answers question: http://stackoverflow.com/q/26489072
type: Answer
upvote count: 1
score: 1
has body: As Cesar mentioned above, there is no clean way to get notified about rebalancing. However note that rebalancing happens when a reader or broker connects or disconnects and also when the number of partitions for a topic changes. So you can monitor Zookeeper nodes where brokers and readers are registered. Note that it may be brittle though as the Kafka related ZK node layout may change in future Kafka versions. See Broker Node Registry, Consumer Id Registry and Partition Owner registry sections in Kafka docs Also, it is not immediately obvious but rebalancing may fail and high level consumer may throw ConsumerRebalanceFailedException. So it is something you need to take into consideration as well. See Kafka rebalancing for a high level overview of rebalancing process.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41594383
type: Comment
has text: I was simply offering another solution for reference purposes. Personally, I'd choose your solution.
comment on: http://stackoverflow.com/a/26478898
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41555625
comment on: http://stackoverflow.com/a/26403314
type: Comment
has text: @MarkoTopolnik can you please elaborate a bit more on the low level, extra linguistic Magic part? Thanks.
score: 0
type: AnswerComment

guid
tags question: http://stackoverflow.com/q/26417127
type: Tag
tag name: guid
tags question: http://stackoverflow.com/q/26390488

http://stackoverflow.com/a/26494332
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26430562
answers question: http://stackoverflow.com/q/26430562
type: AcceptedAnswer
has body: So to fix the issue I did a few things. I set the entire transfer process in a separate thread using an executor with a timeout ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); final Future&lt;Boolean&gt; handler = executor.submit(new Callable&lt;Boolean&gt;() { @Override public Boolean call() throws Exception { return processTransfer(); } }); success = handler.get(10, TimeUnit.MINUTES); That way if the transfer takes longer than 10 minutes, it exits with an exeption. The second thing was change the original code to detect starvation: long lastDataRecvTime = System.currentTimeMillis(); byte[] input; while (true) { if(System.currentTimeMillis() - lastDataRecvTime &gt;= 5 * 60 * 1000) { throw new RuntimeException("Nothing received for 5 minutes. Transfer starved. Exiting"); } int availableBuf = request.getAvailableBufferSize(); if(availableBuf == 0) { request.flush(); continue; } input = new byte[Math.min(4096, availableBuf)]; int length = bis.read(input); if (length == -1) break; if(length == 0) { try { Thread.sleep(1); } catch (Exception ignored){} continue; } lastDataRecvTime = System.currentTimeMillis(); request.write(input, 0, length); } request.flush(); request.close(); bis.close(); Thanks for the help

jvm
tags question: http://stackoverflow.com/q/26488707
tags question: http://stackoverflow.com/q/26425510
type: Tag
tags question: http://stackoverflow.com/q/26397959
tags question: http://stackoverflow.com/q/26377827
tags question: http://stackoverflow.com/q/26361742
tags question: http://stackoverflow.com/q/26382989
tags question: http://stackoverflow.com/q/26430499
tags question: http://stackoverflow.com/q/26357186
tags question: http://stackoverflow.com/q/26420450
tags question: http://stackoverflow.com/q/26512900
tags question: http://stackoverflow.com/q/26404976
tags question: http://stackoverflow.com/q/26430465
tag name: jvm
tags question: http://stackoverflow.com/q/26356506
tags question: http://stackoverflow.com/q/26396074
tags question: http://stackoverflow.com/q/26491727
tags question: http://stackoverflow.com/q/26502836
tags question: http://stackoverflow.com/q/26455482
tags question: http://stackoverflow.com/q/26367081

http://stackoverflow.com/comment/60064253
type: Comment
comment on: http://stackoverflow.com/a/26452450
type: AnswerComment
has text: Did this really work ? I tried it and it doesn't work
score: 0

http://stackoverflow.com/comment/41471512
score: 0
comment on: http://stackoverflow.com/q/26410872
type: Comment
type: QuestionComment
has text: You might have to call v.save(). Alternately, you might try using @ElementCollection, but that might not be compatible with your Model base class.

http://stackoverflow.com/comment/41647200
comment on: http://stackoverflow.com/q/26508128
has text: I think you can create a family of classes by using <T extends YourParentClass>. You could also write a factory instead, give your parent class a type enum and use the factory to convert your classes into specific types based on the enum value passed.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26503382
tagged with: import
type: Question
has body: I have a gradle project; I have some scala classes in scala.com.EssencePVP.models that I want to import into my java code, which has the same package name for that matter. The structure looks something like this: src/main/java/com/EssencePVP/ src/main/scala/com/EssencePVP/models/ when I try to import my scala package (import com.EssencePVP.models.*) into java, I get this error message: EssencePVPMod/build/sources/java/com/EssencePVP/EssencePVP.java:56: error: package com.EssencePVP.models does not exist clearly the problem is that is trying to look in the java directory, and not the scala directory. How do I fix this issue? Thanks you.
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/23261075
has answer: http://stackoverflow.com/a/26505475
has title: How does one import a scala package in java?
favorite count: 0
tagged with: scala
upvote count: 1
accepted answer: http://stackoverflow.com/a/26505475
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41642440
has comment: http://stackoverflow.com/comment/41640240
score: 1
tagged with: java

http://stackoverflow.com/q/26416071
type: UnansweredQuestion
tagged with: google-app-engine
downvote count: 2
has body: I have downloaded the source code of Google App Engine and I would like to change the behavior of some methods (for example, DatastoreService.put(Entity e)) used in this example: import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import static com.google.appengine.api.datastore.FetchOptions.Builder.withLimit; import com.google.appengine.api.datastore.Query; import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig; import com.google.appengine.tools.development.testing.LocalServiceTestHelper; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; public class LocalDatastoreTest { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } // run this test twice to prove we're not leaking any state across tests private void doTest() { DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); assertEquals(0, ds.prepare(new Query("yam")).countEntities(withLimit(10))); ds.put(new Entity("yam")); ds.put(new Entity("yam")); assertEquals(2, ds.prepare(new Query("yam")).countEntities(withLimit(10))); } @Test public void testInsert1() { doTest(); } @Test public void testInsert2() { doTest(); } } The problem is that I do not see that the build.xml file provided with the source code makes any compilation of the source .java files. For example, when I add some garbage to one of the source files and try to build the SDK using ant dist it returns BUILD SUCCESSFUL rather than a compile time error. Any ideas where can I find the source file of the put(Entity e) method? and how can I compile the source code?
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/26416610
type: Question
upvote count: 0
tagged with: ant
answer count: 1
has title: How can I build Google App Enging Java SDK?
favorite count: 0

http://stackoverflow.com/q/26477170
has answer: http://stackoverflow.com/a/26477499
has comment: http://stackoverflow.com/comment/41592191
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26478472
possible better answer: http://stackoverflow.com/a/26477244
tagged with: java
has answer: http://stackoverflow.com/a/26477244
answer count: 6
type: Question
tagged with: binary-search
has comment: http://stackoverflow.com/comment/41592241
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26477285
favorite count: 0
has answer: http://stackoverflow.com/a/26481776
has answer: http://stackoverflow.com/a/26478472
has title: Searching for a sum in an array
has answer: http://stackoverflow.com/a/26477967
score: 2
has body: I have a method which counts how many sums of 3 elements,which are equal to 0, does the array contains. I need help finding the way to stop counting the same triplets in the loop. For instance, 1 + 3 - 4 = 0, but also 3 - 4 +1 = 0.Here is the method: private static int counter(int A[]) { int sum; int e = A.length; int count = 0; for (int i=0; i&lt;e; i++) { for (int j=i+1; j&lt;e; j++) { sum=A[i]+A[j]; if(binarySearch(A,sum)) { count++; } } } return count; edit: I have to use the Binary Search (the array is sorted). Here is the binarySearch code: private static boolean binarySearch(int A[],int y) { y=-y; int max = A.length-1; int min = 0; int mid; while (max&gt;=min) { mid = (max+min)/2; if (y==A[mid]) { return true; } if (y&lt;A[mid]) { max=mid-1; } else { min=mid+1; } } return false;
upvote count: 2

http://stackoverflow.com/comment/41600491
has text: I don't know so many methods. Currently I'm using table.getSelectedRow(); and I also want to use table.getSelectedColumn();
type: Comment
comment on: http://stackoverflow.com/q/26482182
score: 0
type: QuestionComment

http://stackoverflow.com/q/26392278
has answer: http://stackoverflow.com/a/44373198
has comment: http://stackoverflow.com/comment/41438745
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26392377
tagged with: textview
possible better answer: http://stackoverflow.com/a/26392386
has comment: http://stackoverflow.com/comment/41438147
accepted answer: http://stackoverflow.com/a/44373198
favorite count: 0
has body: I've added to my TextView, after it has been modified with set.Text, a variable of type int (CONT1) How do I change only the color of the variable cont1? part of my code: TextView cpu=(TextView) findViewById(R.id.cpu); cpu.setText("CPU: " + cont1); I tried to put the value of cont1 in a new TextView and then add it to the first TextView in this way: TextView cpu=(TextView) findViewById(R.id.cpu); TextView color=new TextView(this); color.setText(cont1); color.setTextColor(220); cpu.setText("CPU: " + color); but the output gives me strange values,how can I do to change only the color of the variable CONT1? the problem is that I'm not merge two TextView cpu.setText("CPU: " + color); this code no work ,Why can not I merge two TextView?
has answer: http://stackoverflow.com/a/26392386
tagged with: android
score: 1
tagged with: java
upvote count: 1
has title: TextView + variable
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/41550396
type: AnswerComment
has text: How could I store the value instead of reference? I mean if I change the "a" by a.add(4); The whole "test" would change. But I hope test would stay the same. What should I do?
type: Comment
comment on: http://stackoverflow.com/a/26454796
score: 0

http://stackoverflow.com/a/26492687
score: 3
has body: I found the answer. Just like in java: groovy -classpath groovy-all-1.8.6.jar Generator.groovy
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26492512

http://stackoverflow.com/comment/41580508
has text: You have some android 5.0 code
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26471482

http://stackoverflow.com/q/26437881
linked to: http://stackoverflow.com/q/19819837
score: 0
has comment: http://stackoverflow.com/comment/41520762
has comment: http://stackoverflow.com/comment/41520805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41521406
tagged with: executorservice
answer count: 0
has body: How to apply wait, notify to java ExecutorService after declaring thread pool as ExecutorService es = Executors.newFixedThreadPool(10); The future work no define previously
has comment: http://stackoverflow.com/comment/41521563
tagged with: java
tagged with: multithreading
has title: wait, notify in java ExecutorService if future work not define previously?
type: Question
tagged with: threadpool
has comment: http://stackoverflow.com/comment/41520758
has comment: http://stackoverflow.com/comment/41520007

http://stackoverflow.com/comment/41415507
comment on: http://stackoverflow.com/q/26376937
score: 0
type: QuestionComment
type: Comment
has text: Where is `stmt` initialized?

http://stackoverflow.com/comment/41436898
comment on: http://stackoverflow.com/q/26391899
type: Comment
type: QuestionComment
has text: I see no reason to go for a while loop for exactly that reason. Honestly I'd just put a `break;` in after `found = m;` to avoid unnecessary iterations after you've already found what you're looking for.
score: 2

http://stackoverflow.com/comment/41452769
type: AnswerComment
comment on: http://stackoverflow.com/a/26401478
type: Comment
has text: /** Please add avobe of the code */ public class test { int y = (60 * 40); public static JLabel timer = new JLabel("");
score: 0

http://stackoverflow.com/comment/41543874
score: 0
comment on: http://stackoverflow.com/q/26450910
type: Comment
type: QuestionComment
has text: This might be a silly question, but how do encode the password?

http://stackoverflow.com/comment/41635269
comment on: http://stackoverflow.com/q/26501306
type: Comment
has text: Seems this could use the [Command pattern](http://en.wikipedia.org/wiki/Command_pattern)..
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41628653
score: 0
type: QuestionComment
type: Comment
has text: Can you turn your logs to debug and check Spring's output?
comment on: http://stackoverflow.com/q/26497955

http://stackoverflow.com/a/26505572
has comment: http://stackoverflow.com/comment/134817557
has body: Assuming that the range of integers in Java is actually "–2147483648 &lt;= n &lt;= 2147483647", the expression ((+a)|0) == a will work as specified. +a evaluates the expression a as a number; |0 converts the number to 32-bit integer The comparison will fail, when a is not exactly representable by an 32-bit integer.
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/134835671
downvote count: 0
has comment: http://stackoverflow.com/comment/41672580
answers question: http://stackoverflow.com/q/26504604
type: Answer

http://stackoverflow.com/q/26373234
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26376307
has comment: http://stackoverflow.com/comment/41403102
has comment: http://stackoverflow.com/comment/41404014
has comment: http://stackoverflow.com/comment/41404736
has comment: http://stackoverflow.com/comment/41403152
has body: So I'm not CS major or anything and I've been just poking around stuff to practice some Java skills I watched from a video. I know this isn't the major way to do it but please, let me. So I extracted a .jar file of this: http://www.zenlunatics.com/quizcards/ (i also have its outright source version). It's open source. I used JD gui to get the source code and got everything in .java. However, once I imported it and tried to run it in Eclipse, it says there is "no main type." I've searched around and it seems there has to be a public static ... String[] args and I don't see that in any of the generated .java files. I tried searching about it on youtube and he's getting .class instead of .java files. So, say I renamed .jar to .zip and extracted class files, do I just edit the main .class and build? Any tips, please. Thanks!
has title: Classpath of a decompiled Jar file
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/41403092
has comment: http://stackoverflow.com/comment/41403121
has comment: http://stackoverflow.com/comment/41403133

http://stackoverflow.com/comment/41407977
type: Comment
has text: @KickButtowski: It's because the overflow-wrapping happens at a power of two. Essentially, the OP is computing {10 x 11 x 12 x ... x 98} modulo 2^32. Since multiples of 2 appear many more than 32 times in that product, the result is zero.
type: AnswerComment
score: 8
comment on: http://stackoverflow.com/a/26375995

http://stackoverflow.com/q/26404761
has comment: http://stackoverflow.com/comment/41458405
answer count: 4
has title: Android How can I see my SQLite?
linked to: http://stackoverflow.com/q/19093458
has answer: http://stackoverflow.com/a/26404804
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41459673
has answer: http://stackoverflow.com/a/26404862
score: 0
has comment: http://stackoverflow.com/comment/41458685
has body: I used Eclipse to open data/data/your.package.name/databases,but there's nothing in data. Some people say I didn't get the "root privileges". How can I see my SQLite?
has answer: http://stackoverflow.com/a/26404828
has answer: http://stackoverflow.com/a/26405342
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41458617

http://stackoverflow.com/a/26447408
downvote count: 0
has body: Your question is not clear to me. By the way, I think your query should be: "SELECT * FROM " + TABLE_NAME + " WHERE " + KEY_AGE + " &gt; 20 "; Edit "SELECT * FROM " + TABLE_NAME + " WHERE cast(age as INTEGER) &gt; 20 ";
accepted answer of: http://stackoverflow.com/q/26447287
answers question: http://stackoverflow.com/q/26447287
has comment: http://stackoverflow.com/comment/41537097
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41537046
type: Answer
score: 2

http://stackoverflow.com/comment/41632051
has text: Please explain how a very basic JSON object **is not** a `String`?
type: QuestionComment
comment on: http://stackoverflow.com/q/26499828
score: 0
type: Comment

http://stackoverflow.com/comment/41628056
has text: Then you should talk to your instructor, not us. In broad lines, start by keeping track of how much each weapon is used. Then based on that, determine an answer.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26497549

http://stackoverflow.com/q/26463696
has title: No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] local
tagged with: maven
has body: While I am trying to creating maven project in command prompt, i am facing build failure error.I tried by changing proxy setting in still i am getting same build failure error. please tell where i am doing mistake
accepted answer: http://stackoverflow.com/a/26478961
has comment: http://stackoverflow.com/comment/41567476
has comment: http://stackoverflow.com/comment/41565878
tagged with: build
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26478961
score: 0
answer count: 1

http://stackoverflow.com/comment/41586771
type: AnswerComment
has text: Oh, I see. But now what do I call in the main method? It tells me the constructor game is undefined when I use Game myGameTable = new Game(); myGameTable.window();
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26472783

openssl
tags question: http://stackoverflow.com/q/26430425
type: Tag
tags question: http://stackoverflow.com/q/26369558
tag name: openssl
tags question: http://stackoverflow.com/q/26356195

http://stackoverflow.com/q/26482449
type: Question
has comment: http://stackoverflow.com/comment/41636520
tagged with: libgdx
tagged with: java
linked to: http://stackoverflow.com/q/15413501
has answer: http://stackoverflow.com/a/38934324
has comment: http://stackoverflow.com/comment/56782653
has body: After creating a new LibGdx project using the setup.jar file. I have followed the instructions for configuring my new application using IntelliJ and launching the desktop application. But I'm getting the following error: Exception in thread "main" java.lang.ClassNotFoundException: com.mygdx.game.desktop.DesktopLauncher at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113) DesktopLauncher.java: package com.mygdx.game.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.mygdx.game.MyGdxGame; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); new LwjglApplication(new MyGdxGame(), config); } } The IDE is saying "unused imports" suggested it can't find them at all. Update: 11:54:56 Gradle 'newgame' project refresh failed: Cause: org.gradle.plugins.ide.internal.IdeDependenciesExtractor.extractRepoFileDependencies(Lorg/gradle/api/artifacts/ConfigurationContainer;Ljava/util/Collection;Ljava/util/Collection;ZZ)Ljava/util/List;
answer count: 2
tagged with: intellij-idea
downvote count: 0
favorite count: 0
upvote count: 8
tagged with: android
has comment: http://stackoverflow.com/comment/41603920
has comment: http://stackoverflow.com/comment/41638232
score: 8
has answer: http://stackoverflow.com/a/35856592
type: UnansweredQuestion
has title: LibGdx Desktop launcher error: main class not found
has comment: http://stackoverflow.com/comment/41603621

http://stackoverflow.com/comment/41369542
score: 0
has text: Two consecutive calls to `desktop.browse` will work as expected, so the issue has to be related to how you obtain that list of URLs. There's not enough info in your question to help you there, so I'm voting to close.
comment on: http://stackoverflow.com/q/26355115
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/66723700
has text: @NightOwl888 - I'll have to look around for the source on my old PC. There were a few forks around you could look for.
comment on: http://stackoverflow.com/a/26392794
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/41536186
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26434449
has text: Shouldn't you pre-compute the pngs before deployment?

http://stackoverflow.com/comment/41476345
has text: Your solution seems the right way. I would say you try to implement the aggregate design pattern. Maybe the thougts help a little bit: http://commons.oreilly.com/wiki/index.php/Use_the_Aggregate_Design_Pattern_to_Reduce_Coupling
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26413871
score: 0

http://stackoverflow.com/comment/41457887
type: QuestionComment
type: Comment
has text: @MartinWickman : no output of cat /var/log/dmesg | egrep -i '16248'
comment on: http://stackoverflow.com/q/26403536
score: 0

http://stackoverflow.com/q/26414295
has body: I am going through a book to learn ajax and I am stuck as my Servlet response (just text) is not showing up in my JavaScript in an alert. When the button is clicked it calls a JavaScript function and then an http request get sent asynchronously. I don't understand why the String is not showing in the response. Thanks for any light anyone can shed on this. EDIT: Also, I get a status code of 200 after sending the "get" request. When I look at firebug under console I see the Get request with 200 status code. There a 3 tabs - Params, Headers, and XML. Under Params I see my dummy parameter that I send in the request. Under Headers there are 2 nodes - Response Headers and Request Headers. When I expand the Response Header node I see a thing called content-length with a 0 after it. Does that mean there is nothing in my response??? Here is my HTML Boards 'R' Us Boards 'R' Us :: How Much Butt We're Kicking Snowboards Sold 1672 What I Sell 'em For $249.95 What it Costs Me $84.22 Boots Sold 312 What I Sell 'em For $175.47 What it Costs Me $54.23 Bindings Sold 82 What I Sell 'em For $146.92 What it Costs Me $98.03 Cash for the Slopes: $318936.42 and my JavaScript function getNewTotals() { console.log("Getting new totals"); var url = "boards.do"; url = url + "?dummy=" + new Date().getTime(); request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } function updatePage() { if (request.readyState == 4) { if (request.status == 200) { var reply = request.responseText; alert("returned: " + reply); } else { alert("Error! Request status = " + request.status); } } } and my Servlet import java.io.IOException; import java.io.PrintWriter; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.gmail.gmjord.controller.Board…
tagged with: servlets
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/41477678
tagged with: ajax
upvote count: 2
has answer: http://stackoverflow.com/a/26414418
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41476651
has comment: http://stackoverflow.com/comment/41500366
has title: Why is servlet response not showing in my JavaScript
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41492988

http://stackoverflow.com/a/27498524
score: 0
has body: To configure multiple realms set your krb5.conf like so: [libdefaults] default_realm = XYZ.LOCAL [realms] XYZ.LOCAL = { kdc = abc.xyz.local default_domain = XYZ.LOCAL } SECOND.NET = { kdc = abc.second.net } [domain_realm] .xyz.local = .XYZ.LOCAL xyz.local = XYZ.LOCAL .second.net = .SECOND.NET second.net = SECOND.NET
answers question: http://stackoverflow.com/q/26382936
type: Answer

http://stackoverflow.com/q/26501549
type: Question
has comment: http://stackoverflow.com/comment/41635747
has answer: http://stackoverflow.com/a/26501666
has comment: http://stackoverflow.com/comment/41635478
has comment: http://stackoverflow.com/comment/41635323
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/26501666
favorite count: 0
accepted answer: http://stackoverflow.com/a/26502465
has comment: http://stackoverflow.com/comment/41635565
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41635277
type: AnsweredQuestion
score: 2
has body: In Jetty source code, the jetty-xml module, XmlConfiguration has the following code: java private static final XmlParser __parser = initParser(); private synchronized static XmlParser initParser() { XmlParser parser = new XmlParser(); URL config60 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_6_0.dtd"); URL config76 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_7_6.dtd"); URL config90 = Loader.getResource(XmlConfiguration.class, "org/eclipse/jetty/xml/configure_9_0.dtd"); parser.redirectEntity("configure.dtd", config90); parser.redirectEntity("configure_1_0.dtd", config60); parser.redirectEntity("configure_1_1.dtd", config60); ... return parser; the __parser variable use the static method initParser() initialization.the __parser should be thread-safe,only load once by the classloader, why the initParser() need to use synchronized? Whether excess? Further explanations：I debug the Jetty source code, from the jetty-start module, then invoke the jetty-xml module.
has answer: http://stackoverflow.com/a/26502465
downvote count: 0
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/41635392
has title: Why static final variable use static method initialization need synchronized?

http://stackoverflow.com/comment/41584271
type: Comment
comment on: http://stackoverflow.com/a/26473395
score: 1
type: AnswerComment
has text: i mean there is no need to mention == true

http://stackoverflow.com/q/26395295
possible better answer: http://stackoverflow.com/a/26396345
tagged with: java
has answer: http://stackoverflow.com/a/26396345
type: Question
answer count: 2
has body: I am fairly new to osgi and bndtools and started with the bndtools tutorial the tutorial worked fine and then i tried to play around with my own test project where i implement an interface , and in the implementation , i am trying to deserialize an xml file to a java class using org.simpleframework I get the following classnotfound exception. Also , I did include the package(which the class in question is a part of) as a part of the private packages in the bundle that i am running java.lang.ClassNotFoundException: packagename.classname 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 org.simpleframework.xml.strategy.Loader.load(Loader.java:50) at org.simpleframework.xml.strategy.TreeStrategy.readValue(TreeStrategy.java:163) at org.simpleframework.xml.strategy.TreeStrategy.read(TreeStrategy.java:102) at org.simpleframework.xml.core.Source.getOverride(Source.java:370) at org.simpleframework.xml.core.Factory.getConversion(Factory.java:207) at org.simpleframework.xml.core.Factory.getOverride(Factory.java:139) at org.simpleframework.xml.core.ObjectFactory.getInstance(ObjectFactory.java:63) at org.simpleframework.xml.core.Composite.read(Composite.java:141) at org.simpleframework.xml.core.Composite.readVariable(Composite.java:687) at org.simpleframework.xml.core.Composite.readInstance(Composite.java:635) at org.simpleframework.xml.core.Composite.readUnion(Composite.java:610) at org.simpleframework.xml.core.Composite.readElement(Composite.java:593) at org.simpleframework.xml.core.Composite.readElements(Composite.java:506) at org.simpleframework.xml.core.Composite.readSection(Composite.java:388) at org.simpleframework.xml.core.Composite.read(Composit…
score: 0
has answer: http://stackoverflow.com/a/26397601
has title: cannot deserialize an xml in a bndtools osgi project
tagged with: osgi
tagged with: xml-serialization
linked to: http://stackoverflow.com/q/13861342
accepted answer: http://stackoverflow.com/a/26397601
type: AnsweredQuestion
tagged with: bndtools

http://stackoverflow.com/q/26416966
has comment: http://stackoverflow.com/comment/41481226
has comment: http://stackoverflow.com/comment/41481281
has comment: http://stackoverflow.com/comment/41481611
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/4716503
has title: PrintWriter won't stop writing in Java, stuck in infinite loop
upvote count: 1
has comment: http://stackoverflow.com/comment/41481574
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41481080
has comment: http://stackoverflow.com/comment/41481446
has comment: http://stackoverflow.com/comment/41481529
has comment: http://stackoverflow.com/comment/41481110
has comment: http://stackoverflow.com/comment/41481452
has comment: http://stackoverflow.com/comment/41481498
score: 0
has comment: http://stackoverflow.com/comment/41481210
has comment: http://stackoverflow.com/comment/41481524
has comment: http://stackoverflow.com/comment/41481660
has comment: http://stackoverflow.com/comment/41481345
has body: This code is part of program I wrote which is a contact book using vectors for a data structures class I am currently in this semester. I had no issues with writing to a file originally until I wrote another method to read from a file. With this code it writes the contents of an array over and over with no end. Even once I have quit the program it will keep writing. Get to a certain line and restarts. I included the read from file method as a reference incase the problem is there. public void writeFinalToFile() { try { FileWriter fw = new FileWriter("file.txt"); PrintWriter pw = new PrintWriter(fw); for (int x=0; x&lt;size; x++) { pw.println(people[x].toString()); } pw.close(); fw.close(); } catch (IOException e) { System.out.println("Can not write file?1?"); return; } } public void readInitialFromFile() { String str; String[] pieces; Scanner in =null; Contact c; try { in = new Scanner(new File("file.txt")); } catch(IOException e) { System.out.println("File not found"); } while (in.hasNext()) { str = in.nextLine(); pieces = str.split(":"); c = new Contact(); c.setName(pieces[0]); c.setNum(Long.parseLong(pieces[1].trim())); c.setComment(pieces[2]); addContact(c); } } Sample output : vrezh:8182645322:me arthur:8183252314:brother vrezh:8182645322:me arthur:8183252314:brother Forever... In this case I only entered two elements in the array Add Contact method per request public void addContact(Contact c) { if (size==capacity) { Contact[] tmp = new Contact[capacity+5]; capacity += 5; for (int i=0; i&lt;size; i++) tmp[i] = people[i]; people = tmp; } people[size++] = c; } This is where in main I call readInitialFromFile(); and on the bottom where I writeFinalToFile once the user decides to quit. public static void main(String [] args){ String entry; long phone; Scanner input = new Scanner(System.in); Scanner input1 = new Scanner(System.in); System.out.println("Welcome to Contact Book"); System.out.println("Would you like to use a vector or an ordered vector?"); entry = inpu…
has comment: http://stackoverflow.com/comment/41481668
duplicate of: http://stackoverflow.com/q/4716503
favorite count: 0
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/41481135
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41481539
tagged with: printwriter

http://stackoverflow.com/comment/41428950
has text: Did you try with only one value in you IN list?
comment on: http://stackoverflow.com/q/26387302
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41456771
comment on: http://stackoverflow.com/q/26373376
score: 0
type: Comment
type: QuestionComment
has text: Maybe the command line for Windows that gets generated behind the scenes is too long for the Windows limits. Did you try the workaround with setting the classpath via an environment variable?

http://stackoverflow.com/q/26379889
score: 3
answer count: 6
tagged with: glassfish
has comment: http://stackoverflow.com/comment/41695978
has body: I'm trying to debug some Rest service in Glassfish 4 and I want to see exactly what is being sent over the wire (HTTP connection). Is there a way to make Glassfish print that out? My project uses Apache HTTP Client and I know is it possible to configure it there, but I couldn't get it to work with our logging framework(java.util.logging). EDIT: Alternatively is there a way to debug Jersey that will make it printout this info?
has comment: http://stackoverflow.com/comment/41499748
has comment: http://stackoverflow.com/comment/41414891
has comment: http://stackoverflow.com/comment/41496885
downvote count: 0
has comment: http://stackoverflow.com/comment/41414842
favorite count: 0
has comment: http://stackoverflow.com/comment/41497000
possible better answer: http://stackoverflow.com/a/26508169
has answer: http://stackoverflow.com/a/26457580
has answer: http://stackoverflow.com/a/26508169
has answer: http://stackoverflow.com/a/26544012
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26547116
accepted answer: http://stackoverflow.com/a/26457580
upvote count: 3
tagged with: java
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/26518620
has title: How to debug everything that goes over the wire (http)
has comment: http://stackoverflow.com/comment/41414985
linked to: http://stackoverflow.com/q/10210645
has answer: http://stackoverflow.com/a/26546988
has comment: http://stackoverflow.com/comment/41496786
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/41416991

uuid
tags question: http://stackoverflow.com/q/26417127
tag name: uuid
tags question: http://stackoverflow.com/q/26465656
type: Tag
tags question: http://stackoverflow.com/q/26390488

ftp
tags question: http://stackoverflow.com/q/26420836
type: Tag
tags question: http://stackoverflow.com/q/26430056
tag name: ftp
tags question: http://stackoverflow.com/q/26467439

http://stackoverflow.com/comment/41461169
score: 0
type: Comment
type: QuestionComment
has text: Its just the way the line copied. In the text file all of that is on one line
comment on: http://stackoverflow.com/q/26406107

http://stackoverflow.com/comment/85095117
type: QuestionComment
has text: The actual question and the question in the topic are completely distinct.
comment on: http://stackoverflow.com/q/26451590
score: 1
type: Comment

string
tags question: http://stackoverflow.com/q/26394240
tags question: http://stackoverflow.com/q/26365176
tags question: http://stackoverflow.com/q/26436271
tags question: http://stackoverflow.com/q/26376191
tags question: http://stackoverflow.com/q/26478445
tags question: http://stackoverflow.com/q/26411368
tags question: http://stackoverflow.com/q/26413608
tags question: http://stackoverflow.com/q/26446822
tags question: http://stackoverflow.com/q/26395671
tags question: http://stackoverflow.com/q/26497213
tags question: http://stackoverflow.com/q/26444299
tags question: http://stackoverflow.com/q/26474106
tags question: http://stackoverflow.com/q/26380982
tags question: http://stackoverflow.com/q/26464401
tags question: http://stackoverflow.com/q/26368221
tags question: http://stackoverflow.com/q/26467789
tags question: http://stackoverflow.com/q/26413592
tags question: http://stackoverflow.com/q/26463381
tags question: http://stackoverflow.com/q/26357469
tags question: http://stackoverflow.com/q/26363220
tags question: http://stackoverflow.com/q/26453765
tags question: http://stackoverflow.com/q/26457830
tags question: http://stackoverflow.com/q/26439322
tags question: http://stackoverflow.com/q/26406014
tags question: http://stackoverflow.com/q/26371945
tags question: http://stackoverflow.com/q/26353793
tags question: http://stackoverflow.com/q/26393647
tags question: http://stackoverflow.com/q/26458872
tags question: http://stackoverflow.com/q/26431715
tags question: http://stackoverflow.com/q/26372738
tags question: http://stackoverflow.com/q/26449040
tags question: http://stackoverflow.com/q/26470914
tags question: http://stackoverflow.com/q/26501129
tags question: http://stackoverflow.com/q/26380009
tags question: http://stackoverflow.com/q/26396554
tags question: http://stackoverflow.com/q/26509568
tags question: http://stackoverflow.com/q/26496487
tags question: http://stackoverflow.com/q/26361426
tags question: http://stackoverflow.com/q/26513030
tags question: http://stackoverflow.com/q/26500492
tags question: http://stackoverflow.com/q/26409461
tags question: http://stackoverflow.com/q/26409907
tags question: http://stackoverflow.com/q/26451503
tags question: http://stackoverflow.com/q/26385798
tags question: http://stackoverflow.com/q/26483963
tags question: http://stackoverflow.com/q/26374896
tags question: http://stackoverflow.com/q/26506083
tags question: http://stackoverflow.com/q/26420076
tags question: http://stackoverflow.com/q/26504151
tags question: http://stackoverflow.com/q/26359138
tags question: http://stackoverflow.com/q/26440897
tags question: http://stackoverflow.com/q/26424720
tag name: string
tags question: http://stackoverflow.com/q/26424734
tags question: http://stackoverflow.com/q/26509092
tags question: http://stackoverflow.com/q/26373764
tags question: http://stackoverflow.com/q/26400325
tags question: http://stackoverflow.com/q/26432197
tags question: http://stackoverflow.com/q/26482524
tags question: http://stackoverflow.com/q/26511939
tags question: http://stackoverflow.com/q/26474582
tags question: http://stackoverflow.com/q/26401426
tags question: http://stackoverflow.com/q/26456854
tags question: http://stackoverflow.com/q/26372393
tags question: http://stackoverflow.com/q/26450915
tags question: http://stackoverflow.com/q/26508762
tags question: http://stackoverflow.com/q/26417069
tags question: http://stackoverflow.com/q/26362478
tags question: http://stackoverflow.com/q/26358990
tags question: http://stackoverflow.com/q/26407131
tags question: http://stackoverflow.com/q/26474527
type: Tag
tags question: http://stackoverflow.com/q/26500578
tags question: http://stackoverflow.com/q/26384764
tags question: http://stackoverflow.com/q/26505692
tags question: http://stackoverflow.com/q/26463545
tags question: http://stackoverflow.com/q/26360974
tags question: http://stackoverflow.com/q/26464938
tags question: http://stackoverflow.com/q/26458684
tags question: http://stackoverflow.com/q/26416455

http://stackoverflow.com/q/26425098
downvote count: 0
has answer: http://stackoverflow.com/a/26426244
tagged with: clojure
favorite count: 0
has comment: http://stackoverflow.com/comment/41497239
tagged with: static
has comment: http://stackoverflow.com/comment/41498755
tagged with: gen-class
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41496757
tagged with: java
accepted answer: http://stackoverflow.com/a/26426244
has comment: http://stackoverflow.com/comment/41496845
has comment: http://stackoverflow.com/comment/41495516
has title: How to generate generate static methods with clojure's Gen-class?
type: Question
has comment: http://stackoverflow.com/comment/41497407
linked to: http://stackoverflow.com/q/2181774
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/41496915
has comment: http://stackoverflow.com/comment/41496256
has comment: http://stackoverflow.com/comment/41498450
has comment: http://stackoverflow.com/comment/41498540
tagged with: static-methods
has body: In My Clojure-code I'd like to generate a class-file that contains a static method (named staticMethod), which is later on called by in a static context from a Java-program. I tried (Clojure): (ns com.stackoverflow.clojure.testGenClass (:gen-class :name com.stackoverflow.clojure.TestGenClass :prefix "java-" :methods [ [#^{:static true} staticMethod [String String] String] ])) (def ^:private pre "START: ") (defn #^{:static true} java-staticMethod [this text post] (str pre text post)) and (Java): package com.stackoverflow.clojure; public class TestGenClassTest { private TestGenClassTest() { } public static void main(String[] args) { TestGenClass.staticMethod("Static call from Java!", " :END"); } } On https://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html I read: By adding metadata – via #^{:static true} – to a method declaration you can also define static methods. No matter where I put the #^{:static true} the Java compiler always says: Cannot make a static reference to the non-static method staticMethod(String, String) from the type TestGenClass How can I define static methods in Clojure? Would #^{:static true} and ^:static mean the same? Where is this documented?
answer count: 1

swing
tags question: http://stackoverflow.com/q/26386422
tags question: http://stackoverflow.com/q/26452656
tags question: http://stackoverflow.com/q/26511329
tags question: http://stackoverflow.com/q/26384803
tags question: http://stackoverflow.com/q/26383012
tags question: http://stackoverflow.com/q/26500817
tags question: http://stackoverflow.com/q/26386254
tags question: http://stackoverflow.com/q/26413111
tags question: http://stackoverflow.com/q/26477744
tags question: http://stackoverflow.com/q/26404240
tags question: http://stackoverflow.com/q/26414077
tags question: http://stackoverflow.com/q/26472604
tags question: http://stackoverflow.com/q/26427866
tags question: http://stackoverflow.com/q/26394429
tags question: http://stackoverflow.com/q/26476645
tags question: http://stackoverflow.com/q/26510220
tags question: http://stackoverflow.com/q/26422848
tags question: http://stackoverflow.com/q/26442746
tags question: http://stackoverflow.com/q/26451272
tags question: http://stackoverflow.com/q/26451716
tags question: http://stackoverflow.com/q/26498950
tags question: http://stackoverflow.com/q/26460870
tags question: http://stackoverflow.com/q/26395710
tags question: http://stackoverflow.com/q/26411775
tags question: http://stackoverflow.com/q/26361948
tags question: http://stackoverflow.com/q/26463147
tags question: http://stackoverflow.com/q/26394008
tags question: http://stackoverflow.com/q/26373210
tags question: http://stackoverflow.com/q/26424841
tags question: http://stackoverflow.com/q/26471926
tags question: http://stackoverflow.com/q/26453521
tags question: http://stackoverflow.com/q/26485706
tags question: http://stackoverflow.com/q/26479333
tags question: http://stackoverflow.com/q/26363239
tags question: http://stackoverflow.com/q/26445520
tags question: http://stackoverflow.com/q/26399870
tags question: http://stackoverflow.com/q/26421836
tags question: http://stackoverflow.com/q/26493457
tags question: http://stackoverflow.com/q/26366331
tags question: http://stackoverflow.com/q/26373788
tags question: http://stackoverflow.com/q/26513532
tags question: http://stackoverflow.com/q/26483178
tags question: http://stackoverflow.com/q/26499704
tags question: http://stackoverflow.com/q/26477521
tags question: http://stackoverflow.com/q/26384294
tags question: http://stackoverflow.com/q/26458937
tags question: http://stackoverflow.com/q/26453520
tags question: http://stackoverflow.com/q/26455633
tags question: http://stackoverflow.com/q/26509154
tags question: http://stackoverflow.com/q/26433846
tags question: http://stackoverflow.com/q/26391803
tags question: http://stackoverflow.com/q/26403008
tags question: http://stackoverflow.com/q/26511457
tags question: http://stackoverflow.com/q/26360602
tags question: http://stackoverflow.com/q/26476529
tags question: http://stackoverflow.com/q/26439899
tags question: http://stackoverflow.com/q/26472986
tags question: http://stackoverflow.com/q/26494389
tags question: http://stackoverflow.com/q/26435443
tags question: http://stackoverflow.com/q/26456518
tags question: http://stackoverflow.com/q/26376329
tags question: http://stackoverflow.com/q/26419320
tags question: http://stackoverflow.com/q/26368156
tags question: http://stackoverflow.com/q/26415499
tags question: http://stackoverflow.com/q/26452905
tags question: http://stackoverflow.com/q/26452109
tags question: http://stackoverflow.com/q/26456978
tags question: http://stackoverflow.com/q/26427212
tags question: http://stackoverflow.com/q/26442590
tags question: http://stackoverflow.com/q/26434034
tags question: http://stackoverflow.com/q/26495725
tags question: http://stackoverflow.com/q/26467780
tags question: http://stackoverflow.com/q/26469829
tags question: http://stackoverflow.com/q/26453514
tags question: http://stackoverflow.com/q/26408686
tags question: http://stackoverflow.com/q/26414290
tags question: http://stackoverflow.com/q/26407453
type: Tag
tags question: http://stackoverflow.com/q/26364223
tags question: http://stackoverflow.com/q/26472497

http://stackoverflow.com/q/26468966
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/26469376
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Android Update UI from another file
score: -1
has answer: http://stackoverflow.com/a/26469150
has answer: http://stackoverflow.com/a/26469503
type: Question
has answer: http://stackoverflow.com/a/26469347
upvote count: 0
possible better answer: http://stackoverflow.com/a/26469150
tagged with: user-interface
has answer: http://stackoverflow.com/a/26469376
linked to: http://stackoverflow.com/q/12575068
has body: I'want to update my UI from another class PrayerTime.java. First Method : I used this and I got (cannot resolve methode findViewById(int) error PrayerTime.java : protected void onPostExecute(String s) { TextView rs = (TextView) findViewById(R.id.result); rs.setText(s); } Seconde Method : In PrayerTime.java I made this : public class PrayerTime extends AsyncTask&lt;String, String, String&gt; { public String fr = null; .. protected void onPostExecute(String s) { this.fr = s; } And in MainActivity.java : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); PrayerTime pr = new PrayerTime(); pr.execute(); TextView rs = (TextView) findViewById(R.id.result); rs.setText(pr.fr); } Here no error is shown but Also the Textview is not updated after The AsynTask is done. I need you'r help to correct this or find another solution to update my UI
tagged with: android
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/41482826
score: 0
has text: Why is that? Aren't spaces valid unicode character separators?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26415922

http://stackoverflow.com/q/26501786
tagged with: utf-8
tagged with: http://stackoverflow.com/tag/xml
has title: XML encoding UTF-8 not working for turkish characters
accepted answer: http://stackoverflow.com/a/26502047
type: Question
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/16435525
has body: I have a method to create and record to xml file. It produces corrupted result. My turkish characters writing as hexadecimal expressions. While i'm using UTF-8, i couldn't solve the problem. By the way i checked both with Sublime and Notepad++ editors. public boolean add(BatFile batFile) throws Exception { File inputFile = new File(fileLocation); DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(inputFile); Element rootElement = doc.getDocumentElement(); Element batFileElement = doc.createElement("BatFile"); rootElement.appendChild(batFileElement); Element batJobName = doc.createElement("Name"); batJobName.appendChild(doc.createTextNode(batFile.getName())); batFileElement.appendChild(batJobName); Element batFileBriefDesc = doc.createElement("BriefDesc"); batFileBriefDesc .appendChild(doc.createTextNode(batFile.getBriefDesc())); batFileElement.appendChild(batFileBriefDesc); Element batFileDesc = doc.createElement("Desc"); batFileDesc.appendChild(doc.createTextNode(batFile.getDesc())); batFileElement.appendChild(batFileDesc); Element batFileName = doc.createElement("FileName"); batFileName.appendChild(doc.createTextNode(batFile.getFileName())); batFileElement.appendChild(batFileName); Element batCommandArgs = doc.createElement("CommandArgs"); for (int k = 0; k < batFile.getCommandArgs().size(); k++) { Element commandArg = doc.createElement("CommandArg"); // commandArg.setAttribute("ID", String.valueOf(k)); commandArg.appendChild(doc.createTextNode(batFile.getCommandArgs() .get(k))); batCommandArgs.appendChild(commandArg); } batFileElement.appendChild(batCommandArgs); Element batCreationTime = doc.createElement("CreationTime"); batCreationTime.appendChild(doc.createTextNode(batFile .getCreationTime())); batFileElement.appendChild(batCreationTime); Element batSchedulerPattern = doc.createElement("SchedulerPattern"); batSchedulerPattern.appendChild(doc.c…
tagged with: encoding
answer count: 1
has answer: http://stackoverflow.com/a/26502047
score: 0

datetime
tags question: http://stackoverflow.com/q/26409483
tags question: http://stackoverflow.com/q/26403911
tags question: http://stackoverflow.com/q/26393594
tags question: http://stackoverflow.com/q/26384955
tags question: http://stackoverflow.com/q/26425880
tags question: http://stackoverflow.com/q/26356104
tags question: http://stackoverflow.com/q/26454129
tag name: datetime
tags question: http://stackoverflow.com/q/26505217
type: Tag
tags question: http://stackoverflow.com/q/26431882
tags question: http://stackoverflow.com/q/26415225

http://stackoverflow.com/comment/42257448
type: Comment
comment on: http://stackoverflow.com/a/26370298
score: 1
has text: Though your answer didn't helped me but gave me hope that it can be solved and I finally figured out to solve it.
type: AnswerComment

http://stackoverflow.com/q/26473087
accepted answer: http://stackoverflow.com/a/26473263
tagged with: dictionary
has comment: http://stackoverflow.com/comment/41583651
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: javafx
upvote count: 1
type: Question
has title: Add data to Java FX ListView from Map?
tagged with: listview
has answer: http://stackoverflow.com/a/26473263
has body: I have the following code, and would like to add each "dog" to the ListView. The only way I have found to do this so far is by using an ObservableList, but I have been trying this for a long while and still can't get the hang of it. Does anyone know how I could display each "dog" from the Map, in a JavaFX Listview? Document doc = Jsoup.connect( "http://www.sportinglife.com/greyhounds/abc-guide").get(); Element tableHeader = doc.select("tbody").first(); Map&lt;String, String&gt; data = new HashMap&lt;&gt;(); for (Element element : tableHeader.children()) { // Here you can do something with each element if (element.text().indexOf("Pelaw Grange") &gt; 0 || element.text().indexOf("Shawfield") &gt; 0 || element.text().indexOf("Shelbourne Park") &gt; 0 || element.text().indexOf("Harolds Cross") &gt; 0) { // do nothing } else { String dog = element.select("td:eq(0)").text(); String race = element.select("td:eq(1)").text(); data.put(dog, race); }
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26486503
type: Answer
upvote count: 1
score: 1
has body: I am not straightly providing a solution to your answer rather I will tell you how you can delete. First when you do a session.delete(object); One query(select) is fired to get the persistance state of the object than delete query is fired to delete the record. You can delete records by the following ways. session.delete(object); - This will delete the record but you need to construct the object Using Query - This would be my choice as I can have as many conditions I want to have using "and" Query query = session.createQuery("delete from TABLE where COL1 = :value"); query.setParameter("value", 10);
answers question: http://stackoverflow.com/q/26484810
downvote count: 0
has comment: http://stackoverflow.com/comment/41608269

event-handling
tag name: event-handling
type: Tag
tags question: http://stackoverflow.com/q/26414261

http://stackoverflow.com/comment/41543272
score: 0
comment on: http://stackoverflow.com/a/26450969
type: AnswerComment
type: Comment
has text: @Gasper Romih try this

http://stackoverflow.com/a/26491776
score: 0
has body: Without seeing the class or method we're trying to retrieve, but looking at the exception cause you provided, I don't believe Class#getMethod is throwing the ClassNotFoundException. Instead, the target method "adapt" likely has a return type of com.ca.eai.model.canonical.OrderToolResponse and that class is not in the Classpath.
type: Answer
answers question: http://stackoverflow.com/q/26490227
has comment: http://stackoverflow.com/comment/41618206
has comment: http://stackoverflow.com/comment/41617688
has comment: http://stackoverflow.com/comment/41617779

http://stackoverflow.com/q/26454773
tagged with: java
type: Question
answer count: 2
has title: Java arraylist clear or reinitiate
accepted answer: http://stackoverflow.com/a/26454796
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/26454832
has answer: http://stackoverflow.com/a/26454832
has body: Consider the following code: import java.util.ArrayList; public class Main{ public static void main(String args[]){ ArrayList&lt;ArrayList&lt;Integer&gt;&gt; test = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt; a = new ArrayList&lt;Integer&gt;(); a.add(7); test.add(a); System.out.println(test); a.clear() System.out.println(test); } } The output of test would be different(One is [[7]], the other is [[]]) If we use a = new ArrayList() instead of a.clear(), the result would be different. I thought the "test" had already recorded the "a" so I can do anything about "a" without changing "test". Anyone can tell me what happens when I use a.clear() and correct my thought? Thanks.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26454796

http://stackoverflow.com/comment/41572988
type: QuestionComment
has text: `if(i==42)` should be `if(array[i]==42)`.
comment on: http://stackoverflow.com/q/26467672
score: 4
type: Comment

http://stackoverflow.com/a/26421936
has comment: http://stackoverflow.com/comment/41493955
has comment: http://stackoverflow.com/comment/41489790
has body: I guess you might loose the precision you need when you use default Math.log multiplied by float i. I think this can be handled by using an appropriate RoundingMode. Please see setRoundingMode
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26421825

http://stackoverflow.com/comment/41585452
type: Comment
has text: thanks anyway but I solve, can you take a look at my comment before this? thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26473589

http://stackoverflow.com/a/26487799
answers question: http://stackoverflow.com/q/26487587
upvote count: 1
score: 1
has body: Inlining statements doesn't improve the generated code. All you saved are some newline characters in the input source file... It may even yield the same bytecode. The most reliable estimation of performance is benchmarking. Compilers change. Code changes. You rarely know what is faster, until you have benchmarked alternatives. Beware of premature optimization! Premature optimization is the root of all evil (or at least most of it) in programming. -- Donald Knuth, Computer Programming as an Art (1974)
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42077059
score: 0
type: Comment
has text: are you around? I am in the chat room. Have some basis quick question
comment on: http://stackoverflow.com/a/26437002
type: AnswerComment

http://stackoverflow.com/a/26504401
answers question: http://stackoverflow.com/q/26503981
has comment: http://stackoverflow.com/comment/41654019
downvote count: 0
type: Answer
has body: int i = 0; while (x % 2 == 0) { x = x / 2; i++; } i keeps a record of the number of times you have already divided by 2 and when the loop is finished will be the number of times x will divide (eg in your example it is 6 and then 4). The loop will keep iterating until WHILE x is divisible by 2. "i" will be the number at the end that will be the number of 2's in your answer, ie what you call z.
score: 1
upvote count: 1

http://stackoverflow.com/comment/41647250
type: Comment
has text: possible duplicate of [HashMap allows duplicates?](http://stackoverflow.com/questions/20537898/hashmap-allows-duplicates)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26508380

http://stackoverflow.com/q/26393408
has body: I am attempting to write a subList method, which returns a list consisting of the current object list inclusively between indexes fromIndex and toIndex. For example, if I had list consisting of 9 11 20 23 28 30 and I called subList(1,4), I should get a new list of 11 20 23 28 returned. For my subList() method, I tried running it but I end up entering an infinite loop. When the next node is empty, it is supposed to exit the loop but that is not happening so I need help figuring out why this infinite loop is happening and what I can do about it. Any help is appreciated! private class Node&lt;N extends Comparable&lt;N&gt;&gt; { private N data; private Node&lt;N&gt; next; } private Node&lt;L&gt; head; public List() { head = null; } private void add(Node&lt;L&gt; node) { if(head == null) { head=node; } else { getFinal().next = node; } } public Node&lt;L&gt; getFinal(){ Node&lt;L&gt; node = head; while (node.next != null) { node = node.next; } return node; } public int size() { if (head == null) return 0; int counter = 0; for (Node&lt;L&gt; curr = head; curr != null; curr = curr.next) counter++; return counter; } public List&lt;L&gt; subList(int fromIndex, int toIndex) throws IndexOutOfBoundsException { if(fromIndex &lt; 0 || fromIndex &gt; size()-1 || toIndex &lt; 0 || toIndex &gt; size()-1) { throw new IndexOutOfBoundsException(); } List&lt;L&gt; n = new List&lt;L&gt;(); Node&lt;L&gt; startNode = head; int counter = 0; while(startNode != null) { if(counter &gt;= fromIndex &amp;&amp; counter &lt;= toIndex) { //infinite loop happens here n.add(startNode); } startNode=startNode.next; counter++; } return n; }
has answer: http://stackoverflow.com/a/26393704
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has title: java-linked list sublist method
has comment: http://stackoverflow.com/comment/41439634
tagged with: nodes
type: Question
accepted answer: http://stackoverflow.com/a/26393704
possible better answer: http://stackoverflow.com/a/26393890
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41439695
has answer: http://stackoverflow.com/a/26393890
tagged with: sublist

http://stackoverflow.com/q/26369558
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: rsa
type: Question
has title: How to use a PKCS8 Encoded Private Key in PHP
has body: The following code in java does the job: InputStream is = CipherRunnable.class.getClassLoader().getResourceAsStream("privateKey.pem"); byte[] bytes = new byte[is.available()]; is.read(bytes); PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(bytes); KeyFactory keyFactory; keyFactory = KeyFactory.getInstance("RSA"); Key key = keyFactory.generatePrivate(privateKeySpec); What is the equivalent code in PHP?
has answer: http://stackoverflow.com/a/26441329
accepted answer: http://stackoverflow.com/a/26441329
tagged with: openssl
answer count: 2
possible better answer: http://stackoverflow.com/a/29224578
tagged with: private-key
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/29224578
tagged with: php

http://stackoverflow.com/comment/41589350
score: 0
type: AnswerComment
type: Comment
has text: Yes. It is the correct answer. I don't know why a guy flagged my question... before asking it I saw the other questions and none of the answers worked. However thank you so much. I learned smth new today. :)
comment on: http://stackoverflow.com/a/26473491

http://stackoverflow.com/q/26372920
answer count: 1
accepted answer: http://stackoverflow.com/a/26372980
type: AnsweredQuestion
score: 0
has title: Consecutive "X"s drawLine() Java
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/41402559
has body: So I am currently trying to figure out how to make a program that draws 5 consecutive "X"s using a for-loop. I'm trying to make the lines spaced apart by 30 px like so \ ...\ ...\ ...\ ...\ This is what I have so far: int y = 50; int x = 70; for (int z = 0; z &lt;= 150; z += 30){ g.setColor(Color.BLUE); g.drawLine(x+z*2, y+30, x+z, y); } This code only draws only draws one line of the X, but I need to figure out how to draw one line before I can draw the second one. Currently it's printing the lines evenly spaced 30 pixels apart, but through every loop the angle of the line is getting larger and larger, when it should be 45. Btw I am aware there are plenty of other ways for me to do this, but I am required to only use for-loops.
tagged with: java
has answer: http://stackoverflow.com/a/26372980
tagged with: draw
tagged with: for-loop

http://stackoverflow.com/a/26379101
score: 0
answers question: http://stackoverflow.com/q/26378610
has body: You can try below. Collections.sort(artworks, new Comparator&lt;ArtWork&gt;() { public int compare(ArtWork left, ArtWork, right) { return Integer.compare(artworkIds.indexOf(left.getId()), listA.indexOf(left.getId())); } });
type: Answer

http://stackoverflow.com/a/35934800
type: Answer
has comment: http://stackoverflow.com/comment/107626370
has body: Have a look at this Java EE 7 examples from Arun Gupta. I forked it on github. Main /** * @author Arun Gupta */ public class Client { final static CountDownLatch messageLatch = new CountDownLatch(1); public static void main(String[] args) { try { WebSocketContainer container = ContainerProvider.getWebSocketContainer(); String uri = "ws://echo.websocket.org:80/"; System.out.println("Connecting to " + uri); container.connectToServer(MyClientEndpoint.class, URI.create(uri)); messageLatch.await(100, TimeUnit.SECONDS); } catch (DeploymentException | InterruptedException | IOException ex) { Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); } } } ClientEndpoint /** * @author Arun Gupta */ @ClientEndpoint public class MyClientEndpoint { @OnOpen public void onOpen(Session session) { System.out.println("Connected to endpoint: " + session.getBasicRemote()); try { String name = "Duke"; System.out.println("Sending message to endpoint: " + name); session.getBasicRemote().sendText(name); } catch (IOException ex) { Logger.getLogger(MyClientEndpoint.class.getName()).log(Level.SEVERE, null, ex); } } @OnMessage public void processMessage(String message) { System.out.println("Received message in client: " + message); Client.messageLatch.countDown(); } @OnError public void processError(Throwable t) { t.printStackTrace(); } }
downvote count: 0
score: 24
answers question: http://stackoverflow.com/q/26452903
upvote count: 24

http://stackoverflow.com/comment/41408275
comment on: http://stackoverflow.com/a/26374900
score: 0
type: AnswerComment
type: Comment
has text: How could I test that?

http://stackoverflow.com/comment/41722986
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26508163
has text: I added the other information in my settings.xml to the question. I checked the central repository and it seems to be there

http://stackoverflow.com/comment/41664195
has text: IMO yours is not "fully functional", what I tried to do with my different approaches. But hey, I didn't especialy ask for that.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26515288

http://stackoverflow.com/a/26383821
type: Answer
has comment: http://stackoverflow.com/comment/41424595
has comment: http://stackoverflow.com/comment/41423175
has comment: http://stackoverflow.com/comment/41439493
has comment: http://stackoverflow.com/comment/41425489
has comment: http://stackoverflow.com/comment/41423882
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26382515
has comment: http://stackoverflow.com/comment/41424948
answers question: http://stackoverflow.com/q/26382515
score: 3
has comment: http://stackoverflow.com/comment/41423569
has body: The whole matter starts at TableModel implementation, so let's take a look to it: public class VehicleTableModel extends AbstractTableModel { private ArrayList&lt;Vehicle&gt; vehicles; // Most of your code here, didn't examine it closer though public void addRow(Vehicle vehicle) { int rowIndex = vehicles.size(); vehicles.add(vehicle); fireTableRowsInserted(rowIndex, rowIndex); // just notify last row == vehicles.size() == getRowCount() } public void removeRow(int row) { vehicles.remove(row); fireTableRowsDeleted(row, row); // is right? yes, it looks ok. } @Override public void setValueAt(Object value, int row, int col) { Vehicle v = vehicles.get(row); if (v != null) { COLUMNS column = header[col]; switch (column) { case TARGA_COLUMN:...; break; case MARCA_COLUMN:...; break; // others... } fireTableCellUpdated(row, column); // this is the appropriate fire method. } } /** * Convenience method to notify if a vehicle was updated in * the outside, not through setValueAt(...). */ public void notifyVehicleUpdated(Vehicle vehicle) { Vehicle[] elements = (Vehicles[])vehicles.toArray(); for (int i = 0; i &lt; elements.length; i++) { if (elements[i] == vehicle) { fireTableRowsUpdated(i, i); } } } } Some other hints: Never use repaint() nor updateUI() to refresh table's data. It's table model responsibility to notify the view about the right event. Never use fireTableDataChanged() (as someone suggested) unless the whole table model data has changed. There are appropriate fireXxxx() methods for rows, columns and cells changes. As far as I understand the problem, both tables share the vehicles list and thus you have to keep them in synch. If so, I'm wondering why do you need two different table models? If the only reason is the status available/parked (mutually exclusive) then you can have a single table model shared along two tables and apply different filters accordingly to the vehicle's status. On status field update, both tables will be notified and vehicle will be transferre…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41440465
has comment: http://stackoverflow.com/comment/41449144

http://stackoverflow.com/comment/41583664
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26473099
has text: don't you want `sum += j`?
type: Comment

complex-event-processing
tags question: http://stackoverflow.com/q/26437902
tag name: complex-event-processing
type: Tag

http://stackoverflow.com/q/26396282
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26396444
tagged with: java
has comment: http://stackoverflow.com/comment/41444249
type: Question
possible better answer: http://stackoverflow.com/a/26396444
answer count: 2
accepted answer: http://stackoverflow.com/a/26397517
linked to: http://stackoverflow.com/q/6726963
score: 0
has comment: http://stackoverflow.com/comment/41444102
has body: I need to use public static void PrintCard (int number, int suit) as the header in my program to print 5 random cards (number &amp; suit) example "Ace of Spades". I'm not entirely sure where to go about it, but I was wondering if there was a way to make a randomly generated number = Ace or etc., because Ace isn't a variable I get a error. example: 0 = Ace (won't work because variable on wrong side) and number == 0 return Ace; those are things I've tried, sorry if its really broad or etc. I'm just pretty lost and novice when it comes to coding. edit: # Card _______ 0 Ace 1 Two 2 Three 3 Four 4 Five 5 Six 6 Seven 7 Eight 8 Nine 9 Ten 10 Jack 11 Queen 12 King # Suit _______ 0 Spaces 1 Hearts 2 Clubs 3 Diamonds Structure of your program import.... class { main method { num suit loop { loop 5x { num = generate random number 0-12 suit = generate random number 0-3 PrintCard (num, suit) } Prompt the user to continue read input from the user into a string if (input is yes) stay inside this loop, otherwise get out } } PrintCard (number, suit) { switch (number) // print the word for the card value print " of " switch (suit) // print the word for the card suit } }
has title: Methods to generate random PrintCard
has answer: http://stackoverflow.com/a/26397517

http://stackoverflow.com/q/26364475
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26403125
favorite count: 0
tagged with: rest
tagged with: scala
has comment: http://stackoverflow.com/comment/41386873
has comment: http://stackoverflow.com/comment/41388514
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41386651
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26403125
has comment: http://stackoverflow.com/comment/41453808
has title: Call a REST API of a module controller in a play application
has body: I am writing a Play 2.3.2 application. I've the main application written in Java, and a module used by the main application written in Scala. My module application provides some REST API that get the data from JSON and returns a JSON output. How can I call the REST API of the module from my main application? And how can parse the results of the computation returned by the module's Controller?? @edit In a my module controller I have some methods like the following: object BridgeController extends Controller { def addTagToUser = CorsAction.async { request =&gt; //update the tag of a user def updateTagToUserDB(user: User, tag: Tag): Future[Boolean] = { println(tag) val query = Json.obj("id" -&gt; user.id, "email" -&gt; user.email) //the query object Users.find(query).toList.flatMap { users =&gt; val oldUser = if (users.size &gt; 0) users(0) else user val newUser = oldUser.addTags(List(tag)) //create the updated user //update the document find, and create if doesn't exists Users.update(query, newUser, upsert = true).flatMap{error =&gt; error match { case LastError(ok, _, _, _, _,_, _) =&gt; Future{true} case _ =&gt; Future{false} //error on update the document }} } } val jsonData = request.body.asJson //get the json data jsonData match { case Some(x) =&gt; val user = x \ "user"; val tag = x \ "tag"; (user \ "id", user \ "email", tag \ "category", tag \ "attr") match { case (userId: JsString, userEmail: JsString, tagCat: JsString, tagAtr: JsString) =&gt; val myUser = new User(userId.as[String], Some(userEmail.as[String])) val newTag = new Tag(tagCat.as[String], tagAtr.as[String]) updateTagToUserDB(myUser, newTag).flatMap(status =&gt; status match { case true =&gt; Future{Ok}//the update was executed correctly case false =&gt; Future{InternalServerError("Cannot access to the db now")}//update fail } ) case _ =&gt; Future{BadRequest("json bad formed")} // the json is bad formed } case None =&gt; Future{BadRequest("need a json value")} } } } In a controller of my main appli…
tagged with: playframework
has comment: http://stackoverflow.com/comment/41387225

http://stackoverflow.com/q/26419855
possible better answer: http://stackoverflow.com/a/26419913
has answer: http://stackoverflow.com/a/26419913
has answer: http://stackoverflow.com/a/26419969
has answer: http://stackoverflow.com/a/26419904
type: Question
has comment: http://stackoverflow.com/comment/41486064
has comment: http://stackoverflow.com/comment/41486022
score: 0
tagged with: java
has body: I am getting an the java.lang.nullpointerexception error in my code. Though I am not sure why it is not correct. I should be a quick fix, but I can't seem to figure it out. It seems that the array in line 45 is giving me the error. Any help would be greatly appreciated. Thank you in advance. import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; class readFile { private String fileName; private double lowestNum; private double highestNum; private double totalNum; private double averageNum; private int[] array; public readFile(String input) { fileName = input; lowestNum = 0; highestNum = 0; totalNum = 0; averageNum = 0; } public void readArray() throws FileNotFoundException { Scanner s = new Scanner(new File(fileName)); array = new int[s.nextInt()]; for(int i = 0; i &lt; array.length; i++) { array[i] = s.nextInt(); } s.close(); } \\ERROR IS HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! public void findLowest() { lowestNum = array[0]; for(int i = 1; i &lt; array.length; i++) { if(array[i] &lt; lowestNum); lowestNum = array[i]; } System.out.println("Lowest number: " + lowestNum); } public void findHighest() { highestNum = array[0]; for(int i = 1; i &lt; array.length; i++) { if(array[i] &gt; highestNum); highestNum = array[i]; } System.out.println("Highest number: " + highestNum); } public void findTotalNum() { for(int i = 0; i &lt; array.length; i++) { totalNum = totalNum + array[i]; } System.out.println("Total of all numbers: " + totalNum); } public void findAverage() { averageNum = (totalNum / array.length); System.out.println("Average of all numbers: " + averageNum); } } public class NumberAnalysis { public static void main(String[] args) throws FileNotFoundException { String fileName = "Numbers.txt"; readFile myClass = new readFile(fileName); myClass.findLowest(); myClass.findHighest(); myClass.findTotalNum(); myClass.findAverage(); } }
has comment: http://stackoverflow.com/comment/41486054
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26419957
has title: Java: "exception in thread main java.lang.nullpointerexception"
tagged with: arrays
duplicate of: http://stackoverflow.com/q/218384
tagged with: java.lang.class
accepted answer: http://stackoverflow.com/a/26419957
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/41570111
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26466148
has text: I believe you need to add `<context:component-scan base-package="my_base_package_name.*" />`
type: Comment

http://stackoverflow.com/comment/41522065
score: 0
has text: May be you have another MessageSource bean that takes precedence? Try adding @Order(Ordered.HIGHEST_PRECEDENCE) annotation to your VerticalDatabaseMessageSource bean
comment on: http://stackoverflow.com/q/26436775
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41645512
type: QuestionComment
comment on: http://stackoverflow.com/q/26505364
has text: @laalto : i have posted a new question as suggested by you. Can you see that now please?
score: 0
type: Comment

http://stackoverflow.com/comment/41519223
type: Comment
score: 0
has text: You definitely caught the error, but why does this error cause the behavior? That is actually something I don't have an explanation for. `TreeSet.first()` should definitely return an object which belongs to the set, right? So then why can it not remove this object? (I suspect it has something to do with how the `TreeSet` object searches for elements, but I'm not sure).
comment on: http://stackoverflow.com/a/26437327
type: AnswerComment

http://stackoverflow.com/a/26503989
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26442342
has comment: http://stackoverflow.com/comment/41676825
answers question: http://stackoverflow.com/q/26442342
type: AcceptedAnswer
downvote count: 0
score: 1
has body: Your type arguments are a bit muddled. Your mapper is taking a &lt;LongWritable,Text&gt; pair, and outputting a &lt;Text,IntWritable&gt; pair. However your class declaration says: implements Mapper&lt;IntWritable, Text, IntWritable, Text&gt; Which should read implements Mapper&lt;LongWritable, Text, Text, LongWritable&gt; The rest looks OK.

http://stackoverflow.com/q/26497676
has answer: http://stackoverflow.com/a/37914153
has comment: http://stackoverflow.com/comment/41629461
has answer: http://stackoverflow.com/a/26502433
answer count: 3
has title: JPA's @UniqueConstraint annotation doesn't seem to guarantee uniqueness
tagged with: unique-constraint
has comment: http://stackoverflow.com/comment/41628185
linked to: http://stackoverflow.com/q/27740929
has comment: http://stackoverflow.com/comment/41629423
favorite count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41628789
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/64401703
has comment: http://stackoverflow.com/comment/41628246
tagged with: java
tagged with: hibernate
tagged with: h2
has body: I have this code: @Table(uniqueConstraints = @UniqueConstraint(columnNames = {"name", "color"})) @MappedSuperclass public abstract class AbstractInstance extends Model { @NotNull public String name; public String color; ... } but for some reason the @UniqueConstraint has no effect - I succeed in putting in the DB multiple instances with the exact same name and color (when I query for color='green' AND name='MyName' I get multiple results). Am I doing something wrong? Should I do something else for this compound uniqueness constraint to take effect? Another evidence of the problem might be that when I query the DB's INFORMATION_SCHEMA.CONSTRAINTS regarding my relevant table, I get this result which doesn't seem to mention 'name' and 'color' as unique: CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | CONSTRAINT_TYPE | UNIQUE_INDEX_NAME | CHECK_EXPRESSION | COLUMN_LIST | SQL ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ play | public | fkcb0e606fe2f3066d | REFERENTIAL | PRIMARY_KEY_8 | null | CONTAINER_ID | ALTER TABLE PUBLIC.UNLABELEDINSTANCE ADD | | | | | | | CONSTRAINT PUBLIC.FKCB0E606FE2F3066D FOREIGN | | | | | | | KEY(CONTAINER_ID) INDEX | | | | | | | PUBLIC.FKCB0E606FE2F3066D_INDEX_C REFERENCES | | | | | | | PUBLIC.DATASET(ID) NOCHECK ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ play | public | constraint_d7 | PRIMARY KEY | PRIMARY_KEY_C | null | ID | ALTER TABLE PUBLIC.UNLABELEDINSTANCE ADD | | | | | | | CONSTRAINT PUBLIC.CONSTRAINT_D7 PRIMARY KEY(ID) | | | | | | | INDEX PUBLIC.PRIMARY_KEY_C I am using: Java 1.7 Hibernate via the maven dependency: org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final (I am not sure how to infer from this the version of JPA\Hibernate) Play Framework 1.2.7 H2 databas…
type: Question
tagged with: jpa
downvote count: 0
linked to: http://stackoverflow.com/q/438146

http://stackoverflow.com/a/26383270
has comment: http://stackoverflow.com/comment/41432082
has comment: http://stackoverflow.com/comment/41490495
accepted answer of: http://stackoverflow.com/q/26382269
has comment: http://stackoverflow.com/comment/41432615
answers question: http://stackoverflow.com/q/26382269
has comment: http://stackoverflow.com/comment/41451632
score: 1
has body: If you have 3 pojos in the list then each one have 4 fields added to the list by default, so 3*4 = 12. The code is working fine, but if you change it like &lt;s:iterator value="pojoList" status="stat"&gt; &lt;s:textarea name="pojoList[%{#stat.index}].field1"&gt; &lt;s:textarea name="pojoList[%{#stat.index}].field2"&gt; &lt;s:textarea name="pojoList[%{#stat.index}].field3"&gt; &lt;s:textarea name="pojoList[%{#stat.index}].field4"&gt; &lt;/s:iterator&gt; it will use the same index for each field, so 3 pojos will be created/updated.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41445391
type: Answer

http://stackoverflow.com/q/26451548
tagged with: java
linked to: http://stackoverflow.com/q/7056749
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/26451567
duplicate of: http://stackoverflow.com/q/7056749
score: 0
has comment: http://stackoverflow.com/comment/41544356
answer count: 1
tagged with: variables
has title: java exception with Scanner class
has body: I'm trying to write a simple calculator I asked the user to enter the first number then the second and the operation that is a character (ie : +,-,*,/) but i get an exception when using the same object on Scanner class however when I create a new object it works !! Scanner sc = new Scanner (System.in) ; int a , b,res ; char c ; a=0 ; b=0 ; System.out.print("Entrer the frst num ") ; a = sc.nextInt() ; System.out.print("entre the second : ") ; b= sc.nextInt() ; System.out.print("the operation plz ") ; c = sc.nextLine().charAt(0) ; In this case i get this exception : Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at javatut.tut.main(tut.java:21) but it work when i change : Scanner sc = new Scanner (System.in) ; Scanner sc2 = new Scanner (System.in) ; int a , b,res ; char c ; a=0 ; b=0 ; System.out.print("Entrer the frst num ") ; a = sc.nextInt() ; System.out.print("entre the second : ") ; b= sc.nextInt() ; System.out.print("the operation plz ") ; c = sc2.nextLine().charAt(0) ; Why ??
type: UnansweredQuestion
tagged with: java.util.scanner

http://stackoverflow.com/q/26394075
answer count: 1
has comment: http://stackoverflow.com/comment/41440521
has comment: http://stackoverflow.com/comment/41440598
has body: I've tried to call this State I made in my main class and then call it in a subclass, and it works for one subclass but not for the other. My main class is called MonGame, the subclasses using the States are Keying and MouseInput. I put the keying functions in the Keying class and the mouse listener functions inside of MouseInput, respectively. So in MonGame (my main class) here's what I declared: public static enum STATE{ MENU, BATTLE, FEED, PET, AGE } public static STATE State = STATE.MENU; And in MouseInput (which works fine) I put this: @Override public void mousePressed(MouseEvent e) { int mx = e.getX(); int my = e.getY(); //battleMenu if (mx &gt;= 190 &amp;&amp; mx &lt;= 250){ if (my &gt;= 290 &amp;&amp; my &lt;= 310){ MonGame.State = MonGame.STATE.BATTLE; } } //feedMenu if (mx &gt;=320 &amp;&amp; mx &lt;= 360){ if (my &gt;= 290 &amp;&amp; my &lt;= 310){ MonGame.State = MonGame.STATE.FEED; } } //petMenu if (mx &gt;= 200 &amp;&amp; mx &lt;= 240){ if (my &gt;= 320 &amp;&amp; my &lt;= 340){ MonGame.State = MonGame.STATE.PET; } } //ageMenu if (mx &gt;= 325 &amp;&amp; mx &lt;= 345){ if (my &gt;= 320 &amp;&amp; my &lt;= 340){ MonGame.State = MonGame.STATE.AGE; } } } Here's the issue. In the Keying class, I call this: public void Battle(){ if (State == STATE.BATTLE){ } } But it returns an error for (State) in the if statement. I've tried placing the enum and STATE values into the Keying class, and then get an error in the MouseInput class. Switching them up doesn't work, so how can I get the enum and State values into both subclasses? I've even tried importing all of my main class.
has comment: http://stackoverflow.com/comment/41440467
type: AnsweredQuestion
tagged with: enums
has title: Can't call a State in subclass?
has comment: http://stackoverflow.com/comment/41440509
tagged with: java
accepted answer: http://stackoverflow.com/a/26394114
type: Question
has answer: http://stackoverflow.com/a/26394114
score: 0
has comment: http://stackoverflow.com/comment/41440638

http://stackoverflow.com/q/26398055
has body: currently I am developing an Android Application (Native). In my application, I need to load many images and that cause a problem. The problem is: 1. When I first open the app after deploy it on my android phone, it works fine. However, after I close the application (by clicking the back button), and then I open the application again, the app closed unexpectedly. When I check the logcat, I found out that it was closed because of OutOfMemory error. 2. Second problem: after I open my application, and I go to the next page, it also give me OutOfMemory error. I guess, the problem occur because I load too many images. After I do some searching on the internet, it suggest me to do System.gc But unfortunately, it did not work for me. Here is my code: Homepage_Activity.java package dev.com.friseur; import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import dev.friseur.insert.AddComment; import dev.friseur.rest.Photo; import android.support.v7.app.ActionBarActivity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.os.SystemClock; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toa…
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26398170
linked to: http://stackoverflow.com/q/20627849
has comment: http://stackoverflow.com/comment/41447241
tagged with: runtime-error
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26398273
accepted answer: http://stackoverflow.com/a/26398273
tagged with: out-of-memory
has title: Android Java Error OutOfMemory
tagged with: android
has answer: http://stackoverflow.com/a/26398170
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41447401

http://stackoverflow.com/q/26488232
score: 0
tagged with: android
type: UnansweredQuestion
has body: I've make an application that could track the user's location but sometimes the GPS doesn't seem to send the location. Also it doesn't seem the GPS get disconnected because I've put logs for that and there is no log indicating a gps disconnect. It just looks like it stop calling the onLocationChanged for some sometime then it works again. Here is an example of the issue. As you can see I'm going through buildings .... I've even put a partial wake lock after some research online but it doesn't seem to work. So what I do is start my application and then push the power button on my phone to turn the screen off and start driving. Arriving at destination I open the app and stop my application. It doesn't happen all the time. Any idea on what could be causing this? Thanks, Here is the code : public class LocationService extends Service implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener { private static Logger LOGGER = LoggerFactory.getLogger(LocationService.class); private final IBinder _binder = new LocalBinder(); private LocationClient _locationClient; private LocationRequest REQUEST = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) .setInterval(5000) .setFastestInterval(1000) .setSmallestDisplacement(5); public class LocalBinder extends Binder { public LocationService getService() { return LocationService.this; } } private PowerManager.WakeLock wakeLock; @Override public void onCreate() { super.onCreate(); LOGGER.debug("onCreate"); PowerManager mgr = (PowerManager)this.getSystemService(Context.POWER_SERVICE); wakeLock = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Wake Lock"); } public int onStartCommand (Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); LOGGER.debug("onStartCommand"); return START_STICKY; } @Override public IBinder onBind(Intent intent) { return _binder; } @Override public void onDestroy(){ super.onDestroy(); LOGGER.debug("onDestroy"); if(_locationClient !…
has title: Android Google Play Services GPS not sending location
tagged with: gps
tagged with: java
has answer: http://stackoverflow.com/a/26488499
type: Question
has answer: http://stackoverflow.com/a/26488865
answer count: 2

http://stackoverflow.com/q/26408651
has comment: http://stackoverflow.com/comment/41487801
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41490647
has title: WebSphere 7: WSCallbackHandlerImpl + InitialContext
tagged with: jndi
tagged with: java
type: Question
tagged with: websphere
has body: When performing a programmatic login using WSCallbackHandlerImpl and there is no java.naming.provider.url set as a system property or in the jndi.properties file, one needs to call: Object obj = initialContext.lookup(""); prior to performing the login. Afterwards the following code works: LoginContext lc = null; try { lc = new LoginContext("WSLogin", new WSCallbackHandlerImpl("userName", "realm", "password")); } catch (LoginException le) { System.out.println("Cannot create LoginContext. " + le.getMessage()); // insert error processing code } catch(SecurityException se) { System.out.printlin("Cannot create LoginContext." + se.getMessage(); // Insert error processing } See: http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/xsec_jaas.html Neither the obj nor the initialContext gets passed to the WSCallbackHandlerImpl or the LoginContext. According to the Javadoc, InitialContext.lookup("") returns a new instance of the context. Questions: Why is this empty string lookup needed in this case? How does WSCallbackHandlerImpl get the server URL? Is this WebSphere specific?
has comment: http://stackoverflow.com/comment/41478603
score: 0
tagged with: jaas

http://stackoverflow.com/q/26427866
tagged with: focus
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26427955
has comment: http://stackoverflow.com/comment/41500773
possible better answer: http://stackoverflow.com/a/26427937
has body: I am new to java GUI and I have 2 JTextField's txtMessage1 and txtMessage2. I'd like to archive this: if one textfiled has focus the other one will be emptied, is that possible and how to archive it? I tried: if (txtMessage1.isFocusOwner()) txtMessage2.setText(""); if (txtMessage2.isFocusOwner()) txtMessage1.setText(""); But it doesn't work, not throwing anything....
tagged with: swing
tagged with: jtextfield
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to empty JTextField if gained focus
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26427937
downvote count: 0
accepted answer: http://stackoverflow.com/a/26427955

http://stackoverflow.com/q/26497522
type: Question
has answer: http://stackoverflow.com/a/26497682
accepted answer: http://stackoverflow.com/a/26497682
has comment: http://stackoverflow.com/comment/41628004
answer count: 1
upvote count: 1
favorite count: 0
downvote count: 0
tagged with: maven
has body: I have a project that uses maven profiles to set a properties file so I can use different properties for different environments. With maven version 3.2.1 (default version bundled with Eclipse Luna) this all works swimmingly. However, I downloaded the latest version of maven, 3.2.3, and when I set that as my maven version, it all blows up. The values are read as empty strings. Should I submit a Maven bug for this? I couldn't find anything in the release notes for 3.2.2 or 3.2.3 that looked like it should've caused this. Here's the profile: dev src/main/config/local Then I use Spring to add the file to the classpath: @Bean public static PropertySourcesPlaceholderConfigurer propertyPlaceHolderConfigurer() { PropertySourcesPlaceholderConfigurer props = new PropertySourcesPlaceholderConfigurer(); props.setLocations(new Resource[] { new ClassPathResource("service.properties") }); return props; } And eventually import its values: @Value(value = "${db.username}") private String DB_USERNAME;
tagged with: spring
has title: maven 3.2.3 fails to import resources correctly
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41628122
score: 1
tagged with: java

http://stackoverflow.com/q/26465804
tagged with: session
tagged with: java
type: UnansweredQuestion
has body: I want to get values from HttpSession object, using EL. &lt;body&gt; HttpSession session = request.getSession(true); session.setAttribute("timLim", 50); &lt;script&gt; var min="${session.timLim}"; alert(min); //Getting no output &lt;/script&gt; &lt;/body&gt; How to assign value of min back to timLim using EL session.timLim ?
tagged with: jsp
tagged with: el
type: Question
has answer: http://stackoverflow.com/a/26465841
score: 0
has title: JSP - How to use EL session.attr?
linked to: http://stackoverflow.com/q/17590620
answer count: 1

http://stackoverflow.com/q/26360974
accepted answer: http://stackoverflow.com/a/26361084
type: Question
has body: In java I need to display 'time of the program start' It must be in String. How do I get the current time, and then convert it to a String?
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/41387835
score: 20
has title: Convert timestamp to string
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/26361056
upvote count: 23
tagged with: timestamp
tagged with: java
possible better answer: http://stackoverflow.com/a/26361056
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26361084
linked to: http://stackoverflow.com/q/1459656
tagged with: string
favorite count: 0

http://stackoverflow.com/q/26498609
score: 1
accepted answer: http://stackoverflow.com/a/26498680
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26498671
has answer: http://stackoverflow.com/a/26498671
answer count: 2
has body: I could use some help/guidance on this. I'm trying to develop a program that accepts input for over 200 true/false responses. Currently I only know how to do this by putting 200+ items in the XML and then do something like: etRaw[0] = (EditText) findViewById(R.id.etRaw0); etRaw[1] = (EditText) findViewById(R.id.etRaw1); etRaw[2] = (EditText) findViewById(R.id.etRaw2); etRaw[3] = (EditText) findViewById(R.id.etRaw3); all the way down to the last item followed by a loop to read it all into an array. It seems this is a long hard way of doing something that might be infinitely easier. I know this is somewhat vague, but if someone can advise me or point me in the right direction it would be greatly appreciated. Thanks in advance!
downvote count: 0
has answer: http://stackoverflow.com/a/26498680
favorite count: 0
tagged with: android
tagged with: input
has title: Best way to code over 200 true/false items in Android?
type: AnsweredQuestion

http://stackoverflow.com/comment/41614431
score: 0
has text: I'd say the correct practice would be: If it's ever a list, make sure it's *always* a list (even if the list has only one entry).
type: Comment
comment on: http://stackoverflow.com/q/26490300
type: QuestionComment

http://stackoverflow.com/comment/41600517
type: QuestionComment
comment on: http://stackoverflow.com/q/26482147
score: 0
has text: sorry Frunk I am confused where I must took or replace that code ? sorry I am Newbie in Java
type: Comment

http://stackoverflow.com/comment/41497042
comment on: http://stackoverflow.com/q/26424030
score: 0
type: QuestionComment
type: Comment
has text: That was careless of him :) Yes, Rich Hickey has a peculiar coding style, but you may still want to reuse that code, deleting everything excessive. I think Rich's approach is really good.

http://stackoverflow.com/a/26410542
answers question: http://stackoverflow.com/q/26410506
score: 3
has comment: http://stackoverflow.com/comment/41469994
upvote count: 3
type: Answer
has body: int interestRate=kbd.nextInt()/100; Since interestRate is an int, it gets rounded down to zero. So this line: currentBal=currentBal*interestRate+currentBal; resolves to: =&gt; currentBal=currentBal*0+currentBal; =&gt; currentBal=0+currentBal; =&gt; currentBal=currentBal; So the value never increases, so will never reach double its initial value, so infinite loop. You would have to replace the line with: double interestRate=kbd.nextInt()/100.0;
downvote count: 0

ajax
tags question: http://stackoverflow.com/q/26353839
tags question: http://stackoverflow.com/q/26412260
tags question: http://stackoverflow.com/q/26425881
type: Tag
tags question: http://stackoverflow.com/q/26414295
tags question: http://stackoverflow.com/q/26450316
tags question: http://stackoverflow.com/q/26461605
tags question: http://stackoverflow.com/q/26450067
tags question: http://stackoverflow.com/q/26508925
tags question: http://stackoverflow.com/q/26357835
tags question: http://stackoverflow.com/q/26493800
tags question: http://stackoverflow.com/q/26376640
tags question: http://stackoverflow.com/q/26357584
tags question: http://stackoverflow.com/q/26442873
tags question: http://stackoverflow.com/q/26443944
tag name: ajax

http://stackoverflow.com/comment/41507099
score: 0
has text: equals returns a boolean, so this doesn't work at all.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26431159

http://stackoverflow.com/q/26441981
has comment: http://stackoverflow.com/comment/41552843
type: Question
score: 0
tagged with: playframework
has title: error play framework
has comment: http://stackoverflow.com/comment/41535302
has body: Good evening, I have a problem with my web application in java app, I would like to create a new object "appuntamento", that object is also linked to another object "people." My idea is to initially choose a value for the "people" and then bring it back in the form editAppuntamento. Here is the code of the controller object "appointment" //show list people public static Result scegliCliente(int page, String sortBy, String order, String filter, String filterNome, String filterTel, Long idApp) { return ok( scegliCliente.render(People.pagePeople(page, 25, sortBy, order, filter, filterNome, filterTel), sortBy, order, filter, filterNome, filterTel, idApp)); } //redirect to method editappuntamento public static Result sceltaCliente(Long idCliente, Long idApp) { models.Appuntamento app = models.Appuntamento.find.byId(idApp); People cliente = People.find.byId(idCliente); app.cliente = cliente; return redirect( controllers.appuntamenti.routes.GestioneApp.editAppuntamento(idApp, idCliente) ); } //method edit appuntamento public static Result editAppuntamento(Long idApp, Long idCliente) { Form&lt;Appuntamento&gt; thisForm = Form.form(Appuntamento.class).fill(Appuntamento.find.byId(idApp)); return ok( editAppuntamento.render(thisForm, idApp, idCliente) ); } //save object public static Result saveAppuntamento(Long idAppuntamento, Long idCliente) { Form&lt;Appuntamento&gt; thisForm = Form.form(Appuntamento.class).bindFromRequest(); if(thisForm.hasErrors()) { Logger.debug("form: "+thisForm); flash("error","Tipo e Data obbligatori."); return badRequest(editAppuntamento.render(thisForm, idAppuntamento, idCliente)); } People people = People.find.byId(idCliente); Appuntamento appuntamento = thisForm.get(); appuntamento.cliente = people; if(idAppuntamento == 0){ appuntamento.save(); }else{ appuntamento.update(); } return redirect( controllers.appuntamenti.routes.GestioneApp.list(0,"","","","","")); } what is wrong? thanks so much
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41527551
has comment: http://stackoverflow.com/comment/41527230
tagged with: java

http://stackoverflow.com/comment/41429285
score: 0
type: Comment
has text: yes, write your own json to java object mapper.
type: QuestionComment
comment on: http://stackoverflow.com/q/26386889

http://stackoverflow.com/q/26412260
has answer: http://stackoverflow.com/a/26414569
type: Question
has title: Java Library in Android Project
score: 0
has body: I want to make a java library (so I can compile it into a jar) that makes calls to a server. I then want to share this amongst android application projects so that I can access those simple calls. Is using HTTPRequest the best way to do this? http://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html Something about making web calls in the java way and sharing them in android apps seems odd to me. should this be an Android Library instead? (I believe those should only be used when resources are involved) Sorry for the potentially simple question.
answer count: 1
tagged with: ajax
tagged with: rest
tagged with: android
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/41636929
score: 3
type: Comment
comment on: http://stackoverflow.com/q/26502593
type: QuestionComment
has text: You never initialized serviceCode

http://stackoverflow.com/comment/41490372
score: 0
has text: the datatype of input (key,value) pair and datatype of output (key,value) pair for reducer class should be equal or that can be different?
type: AnswerComment
comment on: http://stackoverflow.com/a/26421753
type: Comment

http://stackoverflow.com/a/26413568
has comment: http://stackoverflow.com/comment/41475355
has body: In this kind of binary tree it's simplest to relabel the child pointers as children (left child) and sibling (right child) because that's what they represent. Since you don't have parent pointers, when you find a node that might be a parent, you must pass it on as you search future nodes. I need to make lots of assumptions because you gave so little information. If Position is your node type and your desired function is member of a Tree, then then it will look something like: private Position&lt;E&gt; parentImpl(Position&lt;E&gt; v, Position&lt;E&gt; node, Position&lt;E&gt; parent) { if (node.equals(v)) { return parent; } for (Position&lt;E&gt; child = v.children; child != null; child = child.sibling) { Position&lt;E&gt; rtn = parentImpl(v, child, node); // current node is parent if (rtn != null) { return rtn; } } return null; } Now the function you want just calls this one. public Position&lt;E&gt; parent(Position&lt;E&gt; v) { return parentImpl(v, root, null); // Root has no parent. } This will return null both when v is not in the tree at all and when it's the root of the tree.
answers question: http://stackoverflow.com/q/26412113
type: Answer
has comment: http://stackoverflow.com/comment/41477528
score: 0

http://stackoverflow.com/q/26508225
type: AnsweredQuestion
has title: StreamCorruptedException while trying to parse a byte array in Java
type: Question
tagged with: low-level
accepted answer: http://stackoverflow.com/a/26508370
tagged with: java
has comment: http://stackoverflow.com/comment/41646980
answer count: 1
has comment: http://stackoverflow.com/comment/41647029
tagged with: bluetooth
score: 0
has body: I'm writing an Android app, trying to parse some binary data received via Bluetooth, containing various signed and unsigned 1-4 byte integers. I'm given to understand that the best (or possibly only) way to interpret bytes as unsigned numbers is via an input stream. My code is: ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInput in = new ObjectInputStream(bis); The second line, for some reason, throws a StreamCorruptedException with no data in it. What am I doing wrong? Also how is it conceptually possible to "corrupt" a bunch of bytes?
tagged with: android
has answer: http://stackoverflow.com/a/26508370

http://stackoverflow.com/q/26492512
score: 0
tagged with: groovy
has title: loading JsonBuilder from external jar in groovy
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26492687
tagged with: java
type: Question
has body: I have written a groovy class that uses JsonBuilder. It works in eclipse, but when I try to run it outside of eclipse it complains and spits this Unable to resolve class JsonBuilder error. I googled this error and somewhere mentioned that groovy doesn't have JsonBuilder in it directly and I have to get it through a different jar. I downloaded groovy-all.jar and unzipped it under the same project dir, it works, but I was wondering how can I use it without unzipping it?
answer count: 1

http://stackoverflow.com/q/26386006
tagged with: dependency-injection
tagged with: java
type: Question
score: 5
answer count: 1
tagged with: jersey-2.0
tagged with: hk2
favorite count: 0
has answer: http://stackoverflow.com/a/28145940
accepted answer: http://stackoverflow.com/a/28145940
upvote count: 5
downvote count: 0
has body: Kind of a follow up to my previous question. I'm trying to inject application configuration data using JSR-330 standard annotations and the HK2 framework bundled with jersey. Ideally I'd like to create a custom InjectionResolver for the Named annotation, which will lookup the desired values in a Map or Properties object that I will populate from data read elsewhere. In my first attempt I've created an Application instance like public class MyApplication extends ResourceConfig { ... packages(MY_PACKAGES); property(MY_CONFIG_PROPERTY, someValue); register(new AbstractBinder() { @Override protected void configure() { bind(ConfigurationInjectionResolver.class) .to(new TypeLiteral&lt;InjectionResolver&lt;Named&gt;&gt;(){}) .in(Singleton.class) } }); } and then my InjectionResolver looks like public class ConfigurationInjectionResolver implements InjectionResolver&lt;Named&gt; { @Context Application application; @Override public Object resolve(Injectee injectee, ServiceHandle&lt;?&gt; serviceHandle) { // lookup data in application.getProperties(); } } My problem is that application.getProperties() is empty. Any idea what's wrong? Also, could I bind an instance of my Injector instead of binding the class? That way I could construct the instance passing my Map data as a parameter.
has title: Using a custom hk2 InjectionResolver to inject application configuration
linked to: http://stackoverflow.com/q/26365077
type: AnsweredQuestion

http://stackoverflow.com/comment/41546183
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26449664
has text: Did you try apache-poi?

http://stackoverflow.com/q/26452484
has comment: http://stackoverflow.com/comment/41546221
accepted answer: http://stackoverflow.com/a/26452725
has comment: http://stackoverflow.com/comment/41546245
has comment: http://stackoverflow.com/comment/41546104
has comment: http://stackoverflow.com/comment/41546358
upvote count: 1
has comment: http://stackoverflow.com/comment/41546296
has comment: http://stackoverflow.com/comment/41546208
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41546146
tagged with: loops
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26452739
downvote count: 0
has answer: http://stackoverflow.com/a/26452725
has answer: http://stackoverflow.com/a/26452739
has body: In the program I'm writing, I have a list of words, and for each word this method is supposed to run through an entire dictionary and compare the given word to the dictionary. For some reason, it only compares the first word, but continues to increment through the givenWordCounter without running it through the dictionary. It must be something wrong with my logic but I don't know what it is. Below is the pseudocode that I came up with and also the code itself, do you see any huge mistake I am making? pseudo code: for each word in the givenWords list: while dictionaryCounter &lt; dictionary.size(): run word in givenWord list at givenWordCounter index through the dictionary increment thousandCounter by 1000 increment givenWordCounter by 1 program should loop through every word in givenWords list &amp; for each givenWord loop through dictionary.prefix once. after dictionary.prefix loop is done move on to next givenWord and the code: public static void runProgram(){ int givenWordCounter = 0; int thouCount = 1000; while (givenWordCounter &lt; givenWords.size()){ while (thouCount &lt; theDictionary.size()){ Dictionary.prefix(givenWords.get(givenWordCounter), theDictionary, counter, thouCount); thouCount = thouCount + 1000; } givenWordCounter++; } } from my understanding of how I wrote the code it should work but i'm somehow making a big mistake, I guess? edit: I was asked to include the code called in the Dictionary class, here it is (required to be recursive by assignment): public static void prefix (String origWord, List&lt;String&gt; theDictionary, int beginFrom, int endAt){ // if the words don't match recurse through this same method in order to move on to the next word if (beginFrom &lt; theDictionary.size() &amp;&amp; counter &lt; endAt){ if ( origWord.charAt(0) != theDictionary.get(beginFrom).charAt(0) || origWord.length() != theDictionary.get(beginFrom).length()){ counter = counter + 1; prefix(origWord, theDictionary, beginFrom+1, endAt); } // if the words first l…
tagged with: logic
favorite count: 0
has title: while loop breaks before it's supposed to, logic issue?

http://stackoverflow.com/comment/41530994
type: AnswerComment
score: 0
type: Comment
has text: Thanks. I'll try to implement SwingWorkers!
comment on: http://stackoverflow.com/a/26443898

http://stackoverflow.com/comment/41513351
score: 0
has text: And check you current layout manager.
type: QuestionComment
comment on: http://stackoverflow.com/q/26434283
type: Comment

http://stackoverflow.com/q/26413245
accepted answer: http://stackoverflow.com/a/26413294
score: 1
favorite count: 0
has body: Is it thread-safe to access (read/write) different elements of the same ArrayList from different threads, when no add/remove operations are performed on the list and every thread accesses a fixed set of indexes which do not intersect among threads? I see no need to use particular precautions here (like locking blocks), but I just wanted to be sure: can something possibly go wrong?
type: Question
tagged with: multithreading
answer count: 1
has title: Accessing different list elements in different threads
tagged with: java
has answer: http://stackoverflow.com/a/26413294
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41474505
has comment: http://stackoverflow.com/comment/41486172
type: AnsweredQuestion

http://stackoverflow.com/q/26477350
favorite count: 0
has title: Loop not ending when it is supposed to
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26477425
score: 1
has answer: http://stackoverflow.com/a/26477458
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26477434
has answer: http://stackoverflow.com/a/26477427
downvote count: 0
has body: I am trying to get my loop to end when the user inputs the character N or n but when I run my program it will not end properly. It seems like the char for answer isn't being read by the loop itself so can someone please help me? import java.util.Scanner; public class Project4_Baker { public static void main(String[] args) { Scanner s = new Scanner(System.in); char answer; System.out.println("============="); System.out.println("Prime or Not?"); System.out.println("============="); do { System.out.print("Enter a whole number ==&gt;"); int n = s.nextInt(); System.out.println(); if(isPrime(n)) { System.out.println(n + " is a prime number."); } else { System.out.println(n + " is a composite number."); } System.out.println(); System.out.print("Do another (Y/N)==&gt;"); answer = s.next().charAt(0); }while(answer != 'N'|| answer != 'n'); } public static boolean isPrime(int n) { if(n &lt;= 1) { return false; } for (int i = 2; i &lt; Math.sqrt(n); i++) { if (n%i==0) { return false; } } return true; } } my code will not end when it is supposed to
answer count: 4

http://stackoverflow.com/q/26404343
has answer: http://stackoverflow.com/a/52465584
has comment: http://stackoverflow.com/comment/41457708
downvote count: 0
has comment: http://stackoverflow.com/comment/41459838
favorite count: 0
has comment: http://stackoverflow.com/comment/41457848
has comment: http://stackoverflow.com/comment/41458950
answer count: 4
upvote count: 11
has comment: http://stackoverflow.com/comment/41457726
linked to: http://stackoverflow.com/q/11500533
type: UnansweredQuestion
tagged with: maven
has body: I have added a node in my pom.xml: &lt;properties&gt; &lt;getdownload-webapp.version&gt;1.5&lt;/getdownload-webapp.version&gt; &lt;/properties&gt; how could I get this 1.5 value in code? String version = System.getProperty("getdownload-webapp.version"); // output version = null This code gave me null while running( ps: there is no settings.xml in this project
score: 11
has answer: http://stackoverflow.com/a/52466732
has comment: http://stackoverflow.com/comment/90953433
tagged with: java
has answer: http://stackoverflow.com/a/26408615
has title: how to get property value from pom.xml?
type: Question
has answer: http://stackoverflow.com/a/26404395

http://stackoverflow.com/comment/41434333
has text: Is there any particular reason you have one line in Spanish in an otherwise English post?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26390522

http://stackoverflow.com/comment/41496726
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26425889
has text: http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#scheduling-quartz is worth a read.
score: 0

http://stackoverflow.com/comment/41553696
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26456518
type: QuestionComment
has text: @EJP But `ProductObj` contains Swing components as well as the `TableModel`s

http://stackoverflow.com/q/26361252
has body: I am trying to make actor move randomly each X seconds. The code for act is like this: @Override public void act(float delta) { super.act(delta); if (delta &gt; (float)(rand.nextInt(5)+3)) { switch(rand.nextInt(3)) { case 0: moveBy(3,0); break; case 1: moveBy(-3,0); break; case 2: moveBy(0,3); break; case 3: moveBy(0,-3); break; } } } Debug shows only X increasing overtime, and it stops on ~103. What can the problem be? Random is inited in constructor with System.currentTimeMillis() seed.
type: Question
type: AnsweredQuestion
tagged with: libgdx
has title: libGDX actor would not behave corectly on movement
accepted answer: http://stackoverflow.com/a/26364128
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41383947
tagged with: android
has answer: http://stackoverflow.com/a/26364128
tagged with: java

http://stackoverflow.com/comment/41551894
score: 0
comment on: http://stackoverflow.com/q/26455521
type: Comment
type: QuestionComment
has text: Something like `newActivity.setTheme(android.R.style.Theme_Dialog);` might work if I'm remembering correctly.

http://stackoverflow.com/q/26510169
has answer: http://stackoverflow.com/a/26511152
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4199794
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/20190350
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JSON deserialization issue with jackson
has body: I have a json object like this { "id":23 , "key": "AKEY", "description": { "plain": { "value": "This is an example", "representation": "plain" } } } I'd like to map it to this object public class JsonResponse { private int id; private String key; private String name; private String type; private String description; /*usual getters and setters*/ } I use the JSONSerialiser like this JSONObject jsonObject = (JSONObject) JSONSerializer.toJSON(responseEntity); But how do I map the "description.plain.value" to "JsonResponse.description"? Can this be done using jackson annotations? thanks for your help
answer count: 1
downvote count: 0
tagged with: deserialization
tagged with: jackson
has comment: http://stackoverflow.com/comment/41650533
favorite count: 0

http://stackoverflow.com/comment/41489196
type: QuestionComment
comment on: http://stackoverflow.com/q/26421232
score: 0
has text: Depends on what you're trying to achieve there. If you want to set a specific entry, then use the same algorithm you used in `getNumSubscriptionsForPeriod`: `subscriptions[subscriptions[0].getYear()-year] = new SubscriptionYear(year, subscription);`. And don't forget to do some checks. For example if `subscriptions[0].getYear()-year` is smaller than 0 or larger than the array length. Or you're in risk of getting an `ArrayIndexOutOfBoundsException`.
type: Comment

http://stackoverflow.com/q/26486844
has answer: http://stackoverflow.com/a/26487095
has body: we are using Hibernate to get Data from a DB. The Problem is that we have sometimes to change our Tables. Infact of that we got several times the Problem that the Database Mapping from Hibernate is not valid with the database. Can someone give me a hint how to solve that problem? Simple Example: Today User Table looks like: id Name Forename Adress sex username In the Futur it can look like: id Name Forename fk_Adress sex username fk_Usergroup fk_rightgroup It's important to hold it easy as possible. We're using MsSQL and XML Mapping. Im thankfull for every contructiv Answer.
type: UnansweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41607949
downvote count: 0
tagged with: schema
tagged with: java
tagged with: hibernate
tagged with: database
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41608287
linked to: http://stackoverflow.com/q/438146
has answer: http://stackoverflow.com/a/26487411
upvote count: 3
favorite count: 0
has title: Hibernate Database changes
tagged with: mapping

http://stackoverflow.com/comment/41522559
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26439059
has text: @AmolTate yes i tried just but not working
score: 0

http://stackoverflow.com/q/26403573
tagged with: web-services
has answer: http://stackoverflow.com/a/26403687
has title: Generating different types of serial key for different subscriptions for java application
tagged with: java
type: Question
answer count: 1
has body: I want to add a serial key feature in my java application where the client has to purchase key for a certain peroid (1 month, 6 months, 1 year, etc) after that the client should not be allowed to use the premium features of the software. Its just like windows software where we are allowed to buy serial key and use the premimum features of the software. How would I do that. I have seen some other relavant questions but didn't get the working answer
score: 0
tagged with: trialware
type: UnansweredQuestion

http://stackoverflow.com/a/26427791
has comment: http://stackoverflow.com/comment/41500836
downvote count: 0
score: 1
has body: Every instance of your ServiceLocator has own cache of some beans (datasources, service, etc). Your ServiceLocator is not singleton because few threads can create few instances easy. For singleton implementation you can use: synchronized static method Pugh's solution (nested static class) Next problem is getDataSource() method. You're right that few threads can break its implementation. Even service locator is singleton you have not synchronization on your cache. Every dataSource has own connection pool. So you will get problem with connection count to your DB. Number of User depends on connection count at datasource. If datasource has only one connection, yes, only one user is allowed. Steps to solve your problems: make ServiceLocator as singleton or bean cache as singleton synchronize access to cache setup acceptable connection count
type: Answer
answers question: http://stackoverflow.com/q/26427240
upvote count: 1
has comment: http://stackoverflow.com/comment/41500758

http://stackoverflow.com/q/26409483
has comment: http://stackoverflow.com/comment/41467364
has body: I am getting a date/time string from web in the format of yyyy-mm-dd HH:MM:SS and it is in UTC. I have to create a Date object and print the date object in GMT format, but I don't want the to change, for example if I read the date as 2014-10-22 09:00:00, then it should be displayed as 2014-10-22 09:00:00 GMT instead of 2014-10-22 13:30:00 How do I do this? Please suggest me. (FYI, Currently, UTC time is 10:25 AM, in india current time is 3:55 PM). I am using Jaxb parser to parse the XML. Any suggestions are invited
has title: Convert String to GMT timezone date. JAVA
tagged with: datetime
type: Question
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/4772425
has comment: http://stackoverflow.com/comment/41467391
tagged with: java
has answer: http://stackoverflow.com/a/26409653
type: UnansweredQuestion

http://stackoverflow.com/q/26394586
duplicate of: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/41441360
upvote count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/41441511
linked to: http://stackoverflow.com/q/40480
has body: I have a simple program I am supposed to write. In three methods I need to read in integers, reverse them, and determine if they are palindromes or not. For some reason the numbers always come back as not palindromes even when they obviously are. This is my code: import java.io.*; import java.util.*; import java.lang.*; public class main { public static boolean isPal; public static void main(String[] args) throws FileNotFoundException, IOException { int num; int ctr = 0; Scanner input = new Scanner(new File("data4.txt")); num = input.nextInt(); while(num != -999) { ctr++; reverse(num); isPalindrome(isPal, num); if(isPal == true) { System.out.println (num + " is a palindrome"); } else { System.out.println(num + " is not a palindrome"); } num = input.nextInt(); } System.out.println(ctr + " numbers were processed."); System.out.println("End of Program"); } public static int reverse(int num) { int dig; int rnum = 0; while(num != 0) { dig = num % 10; num = num / 10; rnum = rnum * 10 + dig; } return rnum; } public static boolean isPalindrome(boolean isPal,int num) { if(num == rnum) { isPal = true; } else { isPal = false; } return isPal; } } and the inputs are 3579 6336 5115 -999
downvote count: 4
has title: values not passing correctly?
tagged with: java
has answer: http://stackoverflow.com/a/26394620
tagged with: methods
type: Question
answer count: 1
tagged with: variables
favorite count: 0

http://stackoverflow.com/a/26486113
type: Answer
answers question: http://stackoverflow.com/q/26481500
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26481500
upvote count: 2
has comment: http://stackoverflow.com/comment/41636335
type: AcceptedAnswer
has body: TableViews that are larger than needed to contain all the data in the table fill the extra space with empty cells. Your TableCell needs to check whether or not the cell is empty before deciding whether or not to include a button in there. You can do this with a listener on the cell's emptyProperty(), or a binding to it: public class RemovingCell extends TableCell&lt;Client, Client&gt; { private HoverButton hb = new HoverButton(Color.RED); public RemovingCell(ObservableList&lt;Client&gt; data) { super(); setAlignment(Pos.CENTER); try { ImageView imgv = new ImageView(new Image(new FileInputStream( "img/Remove.png"))); imgv.setFitWidth(15); imgv.setPreserveRatio(true); imgv.setSmooth(true); hb.setGraphic(imgv); hb.setTooltip(ControlFactory.getTooltip("Klient entfernen")); hb.setOnAction(event -&gt; { data.remove(getTableRow().getIndex()); }); // conditionally set the graphic: // setGraphic(hb); emptyProperty().addListener( (obs, wasEmpty, isNowEmpty) -&gt; { if (isNowEmpty) { setGraphic(null); } else { setGraphic(hb); } }); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } catch (FileNotFoundException e) { e.printStackTrace(); } } } With a binding you can do graphicProperty().bind(Bindings.when(emptyProperty()) .then((Node)null) .otherwise(hb)); instead of adding the listener to the emptyProperty(). The choice between the two is just a matter of style.

http://stackoverflow.com/q/26465974
has comment: http://stackoverflow.com/comment/41569799
score: -3
has comment: http://stackoverflow.com/comment/41569888
has answer: http://stackoverflow.com/a/26466068
has title: How do I use a add method for another class
tagged with: java
upvote count: 1
type: Question
has body: I am trying to use an add method that is in another class so I can test my program but I am stuck on how to proceed. In my Apartment class I have created an add method public void addApartment(Apartment newApartment) { House ApartmentEntry = new Apartment(); ApartmentEntry= newApartment; ArrayList.add(ApartmentEntry); } In the Company class I am trying to use the method above to add an Apartment as in below example (in Company) : addApartment(price, numberofbaths, numberofbedrooms, squarefeet);
tagged with: inheritance
tagged with: class
tagged with: arraylist
downvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/41569834
has answer: http://stackoverflow.com/a/26474006
favorite count: 0
has answer: http://stackoverflow.com/a/26466233
type: UnansweredQuestion

http://stackoverflow.com/comment/41558441
type: QuestionComment
comment on: http://stackoverflow.com/q/26459372
score: 0
has text: Maybe you're looking for AND, not OR.
type: Comment

http://stackoverflow.com/q/26364039
tagged with: sql
accepted answer: http://stackoverflow.com/a/26364106
has title: Move rs to method causes Exception
upvote count: 0
has comment: http://stackoverflow.com/comment/41385669
has answer: http://stackoverflow.com/a/26364106
type: AnsweredQuestion
tagged with: java
type: Question
score: -2
answer count: 1
favorite count: 0
downvote count: 2
has body: I have some duplicated following code rs = prepStmt.executeQuery(); rs.next(); I want to move it to a method so that I can reuse the code. The method is like: public static void point(ResultSet rs, PreparedStatement prepStmt){ rs = prepStmt.executeQuery(); result = rs.next(); } Then I want to get a column value, like, String gender = rs.getString("gender"); And I get the following exception: java.sql.SQLException: Invalid column name gender. The error does not show up when I did't encapsulate the logic in the method. So the column name is correct. Any ideas? Thanks!

http://stackoverflow.com/q/26359840
tagged with: java
has comment: http://stackoverflow.com/comment/41377752
has answer: http://stackoverflow.com/a/26360085
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/26360085
score: 6
favorite count: 0
has answer: http://stackoverflow.com/a/26359968
has title: Labeled continue statement within while loop
type: Question
upvote count: 6
has body: The following simple examples cause compile-time error. But It's not clear why. public static void main (String[] args) throws java.lang.Exception { int i = 0; d: { System.out.println("d"); } while(i &lt; 10){ i++; continue d; } } --and-- public static void main (String[] args) throws java.lang.Exception { int i = 0; d: { System.out.println("d"); while(i &lt; 10){ i++; continue d; } } } DEMO But the following works fine: public static void main (String[] args) throws java.lang.Exception { int i = 0; d: while(i &lt; 10){ { System.out.println("d"); } i++; continue d; } } Does it allow to tranfer control to the only while, for or do statement? It doesn't say in the JLS. What it actual says is: A continue statement with label Identifier attempts to transfer control to the enclosing labeled statement (§14.7) that has the same Identifier as its label; that statement, which is called the continue target, then immediately ends the current iteration and begins a new one.
answer count: 2
accepted answer: http://stackoverflow.com/a/26359968
has comment: http://stackoverflow.com/comment/41378028

http://stackoverflow.com/a/26375441
type: AcceptedAnswer
type: Answer
has body: You define those String variables twice. public String toString() { String strMatrix; // once String strRow; // once String strElement; // once for(int i = 0; i &lt; matrix.length; i++) { for(int j = 0; j &lt; matrix[i].length; j++) { String strElement = String.valueOf(matrix[i][j]); // twice String strRow = strRow + strElement + "\t"; // twice } String strMatrix = strMatrix + strRow + "\n"; // twice } return strMatrix; } Fix : public String toString() { String strMatrix = null; String strRow = null; String strElement = null; for(int i = 0; i &lt; matrix.length; i++) { for(int j = 0; j &lt; matrix[i].length; j++) { strElement = String.valueOf(matrix[i][j]); strRow = strRow + strElement + "\t"; } strMatrix = strMatrix + strRow + "\n"; } return strMatrix; }
accepted answer of: http://stackoverflow.com/q/26375411
score: 0
answers question: http://stackoverflow.com/q/26375411

http://stackoverflow.com/q/26454916
answer count: 4
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26585678
has answer: http://stackoverflow.com/a/26454968
linked to: http://stackoverflow.com/q/9354099
tagged with: download
linked to: http://stackoverflow.com/q/16375365
possible better answer: http://stackoverflow.com/a/26627866
type: Question
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26627866
linked to: http://stackoverflow.com/q/2244272
tagged with: java
tagged with: scroll
upvote count: 1
has title: Download the entire webpage
has comment: http://stackoverflow.com/comment/41735789
accepted answer: http://stackoverflow.com/a/26585678
has answer: http://stackoverflow.com/a/26600925
tagged with: javascript
has body: There are ways to download an entire webpage, using HTMLEditorKit. However, I need to download an entire webpage which needs scrolling in order to load its entire content. This technology is achieved most commonly through JavaScript bundled with Ajax. Q.: Is there a way to trick the destined webpage, using only Java code, in order to download its full content? Q.2: If this is not possible only with Java, then is it possible in combination with JavaScript? Simple notice, what I wrote: public class PageDownload { public static void main(String[] args) throws Exception { String webUrl = "..."; URL url = new URL(webUrl); URLConnection connection = url.openConnection(); InputStream is = connection.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); HTMLEditorKit htmlKit = new HTMLEditorKit(); HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument(); HTMLEditorKit.Parser parser = new ParserDelegator(); HTMLEditorKit.ParserCallback callback = htmlDoc.getReader(0); parser.parse(br, callback, true); for (HTMLDocument.Iterator iterator = htmlDoc.getIterator(HTML.Tag.IMG); iterator.isValid(); iterator.next()) { AttributeSet attributes = iterator.getAttributes(); String imgSrc = (String) attributes.getAttribute(HTML.Attribute.SRC); if (imgSrc != null &amp;&amp; (imgSrc.endsWith(".jpg") || (imgSrc.endsWith(".jpeg")) || (imgSrc.endsWith(".png")) || (imgSrc.endsWith(".ico")) || (imgSrc.endsWith(".bmp")))) { try { downloadImage(webUrl, imgSrc); } catch (IOException ex) { System.out.println(ex.getMessage()); } } } } private static void downloadImage(String url, String imgSrc) throws IOException { BufferedImage image = null; try { if (!(imgSrc.startsWith("http"))) { url = url + imgSrc; } else { url = imgSrc; } imgSrc = imgSrc.substring(imgSrc.lastIndexOf("/") + 1); String imageFormat = null; imageFormat = imgSrc.substring(imgSrc.lastIndexOf(".") + 1); String imgPath = null; imgPath = "..." + imgSrc + ""; URL i…

http://stackoverflow.com/q/26510089
has comment: http://stackoverflow.com/comment/41651226
has comment: http://stackoverflow.com/comment/41650625
tagged with: rest
tagged with: alfresco
has comment: http://stackoverflow.com/comment/41796949
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41766210
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/41730164
has comment: http://stackoverflow.com/comment/41766159
has comment: http://stackoverflow.com/comment/41651323
has comment: http://stackoverflow.com/comment/41780502
has title: Json getting corrupted over http POST when recieved by alfresco webscript
has comment: http://stackoverflow.com/comment/41805008
downvote count: 0
has body: I am working on developing a REST-API, ie Alfresco based java-backed webscript. Where I am supposed to pass a Json as POST request parameter field. When I try to retrieve the parameter field on server side using: webScriptRequest.getParameter(json); I am recieving a corrupted Json. Based on analysis its getting corrupted because of one of the below fields or may be combination of them, I don't know exactly which special character is causing this corruption problem. Can anybody help me out in figuring-out this issue. My hunch is some special character combination in below field is corrupting the json: 2014-04-23T13:42:24.962-04:00 /case/77777777/doc/x-search-found.pdf http://temp.com/doc/source/url /case/77777777/doc/my-findings.pdf 2014-04-23T13:42:24.962-04:00 "docGroupNames": ["working", "suggested"] If I remove above fields, I start receiving the healthy json on server side. Below is the sample JSON: { "documentAlias": "DocNameForTmngUiDisplay", "modifiedByUserId": "User XYZ", "sourceSystem": "TMNG", "sourceMedia": "electronic", "sourceMedium": "upload", "accessLevel": "public", "scanDate": "2014-04-23T13:42:24.962-04:00", "docList": [ { "documentId": "/case/77777777/doc/x-search-found.pdf", "metadata": { "modifiedByUserId": "User XYZ", "documentAlias": "nickname", "sourceMedia": "paper", "docSourceUrl": "http://test/doc/source/url", "docCategory": "web" } }, { "documentId": "/case/77777777/doc/my-findings.pdf", "metadata": { "sourceMedium": "fax", "accessLevel": "public", "scanDate": "2014-04-23T13:42:24.962-04:00", "evidenceSourceTypeId": "123", "docGroupNames": [ "working", "suggested" ] } } ] } Additional Disclosure: This looks like REST-Client issue, try changing your Rest Client is one probable solution to json corruption issue. This issue is happening specifically on SoapUI 5.0.0 Above issue is NOT happening on DHC 0.7.2.2 (Chrome based rest client extension)
favorite count: 0

http://stackoverflow.com/comment/41515695
has text: ImageIcon chromo = createImageIcon("res/icon.png");
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26435443
score: 0

http://stackoverflow.com/q/26366256
answer count: 1
has body: I have a Java HashMap&lt;String, String&gt;. Firstly I populate this map with 100 known string keys. Next I use multiple callables to add random string keys, two thousand keys in total. I also use multiple callables to call HashMap.containsKey() for the 100 known keys. I execute these callables all concurrently, Why do I see many of these containsKey() calls fail? Surely String implements the hashCode() and equals() methods "properly". What do I need to do to ensure my 100 known keys are always found within the map?
has comment: http://stackoverflow.com/comment/41390196
has comment: http://stackoverflow.com/comment/41390112
has comment: http://stackoverflow.com/comment/41391590
has comment: http://stackoverflow.com/comment/41389930
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26376824
accepted answer: http://stackoverflow.com/a/26376824
tagged with: java
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/41389944
has comment: http://stackoverflow.com/comment/41396345
has comment: http://stackoverflow.com/comment/41390280
score: 0
has comment: http://stackoverflow.com/comment/41390053
has title: Java HashMap<String, String> containsKey() fails
has comment: http://stackoverflow.com/comment/41390097
has comment: http://stackoverflow.com/comment/41390476

http://stackoverflow.com/q/26499904
type: AnsweredQuestion
upvote count: 38
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41632202
has title: Shorthand for "If/Throw, Else/Return" logic in Java 8?
possible better answer: http://stackoverflow.com/a/26500500
type: Question
has body: Is there a shorter syntax to if/throw else/return in Java 8? java.util.Optional provides a means to accomplish this in one statement, but it requires creating an Optional instance with every call that has a non-null reference. Can this be accomplished in a single statement? public static MyEnum fromString(String value) { MyEnum result = enumMap.get(value); if (result == null) throw new IllegalArgumentException("Unsupported value: " + value); return result; } Optional Example (bad, requires Optional instance every time) public static MyEnum fromString(String value) { return Optional.ofNullable(enumMap.get(value)).orElseThrow( () -&gt; new IllegalArgumentException("Unsupported value: " + value)); }
answer count: 2
has comment: http://stackoverflow.com/comment/41644174
has comment: http://stackoverflow.com/comment/41639398
linked to: http://stackoverflow.com/q/36476338
linked to: http://stackoverflow.com/q/54443944
has comment: http://stackoverflow.com/comment/41632162
favorite count: 0
score: 38
has answer: http://stackoverflow.com/a/26503758
accepted answer: http://stackoverflow.com/a/26503758
has comment: http://stackoverflow.com/comment/41646661
has comment: http://stackoverflow.com/comment/41634631
tagged with: java-8
has answer: http://stackoverflow.com/a/26500500

http://stackoverflow.com/comment/41450973
score: 0
comment on: http://stackoverflow.com/q/26399871
type: Comment
type: QuestionComment
has text: Refer http://stackoverflow.com/questions/4049705/resultset-not-open-verify-autocommit-is-off-apache-debry

http://stackoverflow.com/comment/41497178
type: Comment
has text: Don't have any logs beyond the basic chart - the top left graph plots CPU/GC activity, and as you can see, there is no activity corresponding to the large drop in permgen usage (top right) - I will look more into the gc logs, but visualvm usually plots GC/CPU pretty accurately the rest of the time.
score: 0
comment on: http://stackoverflow.com/q/26424221
type: QuestionComment

http://stackoverflow.com/a/26373970
has comment: http://stackoverflow.com/comment/41404461
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41404401
answers question: http://stackoverflow.com/q/26373962
has body: I believe you want to use || instead of | here: if (newDescription.isEmpty() | newCost &lt; 0) { change it to if (newDescription.isEmpty() || newCost &lt; 0) { | is used for bitwise OR operation while || is used for conditional OR
type: Answer

http://stackoverflow.com/q/26387444
has answer: http://stackoverflow.com/a/26387675
type: AnsweredQuestion
has body: i'm working on an online examinatiion software which connects to a Ms Sql server using a JDBC ODBC connection. I want to move the Result Set cursor to the next row and backwards. The connection works and the program can retrieve the fields from the database, so there's no issue with that. The code that I have here is a on a button labeled "Submit". When you click this button it should move to the next row in the database and retrieve the data from that row. The data retrieved should be displayed in the "textarea". The problem is that when I click next it displays the last result? class Abc extends JFrame implements ActionListener { JLabel l1, l2, l3, l4; JButton b1, b2; JTextArea j1, j2; JCheckBox c1, c2, c3, c4; ButtonGroup group = new ButtonGroup(); JPanel panel2; Abc () { j1 = new JTextArea(); j2 = new JTextArea(); c1 = new JCheckBox(); c2 = new JCheckBox(); c3 = new JCheckBox(); c4 = new JCheckBox(); j1.setEditable(false); c1.setSelected(false); c2.setSelected(false); c3.setSelected(false); c4.setSelected(false); group.add(c1); group.add(c2); group.add(c3); group.add(c4); Connection conn = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:xe", "system", "java"); System.out.println("Dc is obtained"); } catch (Exception e2) { System.out.println("conne" + e2.getMessage()); } try { String sq = "select * from questionans"; Statement st = conn.createStatement(); ResultSet rs = st.executeQuery(sq); System.out .println("------------------------------------------"); if (rs.next()) { j1.setText(rs.getString(2)); c1.setText(rs.getString(3)); c2.setText(rs.getString(4)); c3.setText(rs.getString(5)); c4.setText(rs.getString(6)); } System.out .println("-------------------------------------------"); } catch (Exception e1) { System.out.println("query" + e1.getMessage()); } finally { try { conn.close(); } catch (Exception e) { System.out.println("close conn" + e.getMessage()); } } b1 = new JButton(…
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26387675
score: 0
possible better answer: http://stackoverflow.com/a/26387607
has answer: http://stackoverflow.com/a/26387607
tagged with: jdbc
has title: move rs.next() forward in jdbc application
tagged with: swing

javafx-8
tags question: http://stackoverflow.com/q/26423496
tags question: http://stackoverflow.com/q/26420773
tags question: http://stackoverflow.com/q/26433056
tag name: javafx-8
tags question: http://stackoverflow.com/q/26373130
tags question: http://stackoverflow.com/q/26395544
tags question: http://stackoverflow.com/q/26453484
tags question: http://stackoverflow.com/q/26509420
tags question: http://stackoverflow.com/q/26433919
tags question: http://stackoverflow.com/q/26481500
tags question: http://stackoverflow.com/q/26471270
tags question: http://stackoverflow.com/q/26411415
tags question: http://stackoverflow.com/q/26361559
type: Tag
tags question: http://stackoverflow.com/q/26485475
tags question: http://stackoverflow.com/q/26453531
tags question: http://stackoverflow.com/q/26494865
tags question: http://stackoverflow.com/q/26361683
tags question: http://stackoverflow.com/q/26474481

http://stackoverflow.com/q/26444423
type: UnansweredQuestion
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/41531578
upvote count: 3
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26444512
has title: How do I get out of this freaking loop
tagged with: java
has body: I understand that while the state is true the loop will keep running. I thought if I simply typed in loop=false, after the } bracket for the loop I could continue to code. Obviously I was wrong, it wont run anything. SOMEONE please show me how to get out of this hell of a while loop. System.out.println("You total balance is 0.00, " + "please deposit coins and type done when finished"); while(loop){ if (input.hasNextInt()){ deposit = input.nextBigDecimal();} String change = input.next(); switch (change){ case "quarter": balance= quarter.multiply(deposit); total=total.add(balance); System.out.println("Your balance is "+ total +" :Make addiontal deposit(s)"); break; case "dime": balance=dime.multiply(deposit); total=total.add(balance); System.out.println("Your balance is "+ total +" :Make addiontal deposit(s)"); break; case "nickel": balance=nickel.multiply(deposit); total=total.add(balance); System.out.println("Your balance is "+ total +" :Make addiontal deposit(s)"); break; case "penny": balance=penny.multiply(deposit); total=total.add(balance); System.out.println("Your balance is "+ total +" :Make addiontal deposit(s)"); break; case"done": System.out.println("Your total is $"+total); fee=total.multiply(feeRate); System.out.println("The exchance fee is 9.1% which amounts to $"+fee); grandTotal=total.subtract(fee); System.out.println("Your total balance minus the exchange fee is $"+grandTotal); break; default: System.out.println("There is a issue at "+change);} } System.out.println("4"); } }
has answer: http://stackoverflow.com/a/26444465
has answer: http://stackoverflow.com/a/26444453
favorite count: 0
has answer: http://stackoverflow.com/a/26444496

http://stackoverflow.com/comment/41407608
type: Comment
comment on: http://stackoverflow.com/a/26375772
has text: Catching Exception is extremely bad practice. Please dont encourage it.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26463899
has comment: http://stackoverflow.com/comment/41583990
has comment: http://stackoverflow.com/comment/41566673
has comment: http://stackoverflow.com/comment/41566549
type: AnsweredQuestion
tagged with: filtering
tagged with: java
has comment: http://stackoverflow.com/comment/41566266
possible better answer: http://stackoverflow.com/a/26464049
has answer: http://stackoverflow.com/a/26464049
has title: android: How to filter items based on child items?
type: Question
has answer: http://stackoverflow.com/a/26464116
answer count: 2
accepted answer: http://stackoverflow.com/a/26464116
has body: This is my model: public class AudioFile { private int id; private String fileName; private String[] subStrings; public AudioFile(int id, String fileName, String[] subStrings){ this.id = id; this.fileName = fileName; this.subStrings = subStrings; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public String[] getSubStrings() { return subStrings; } public void setSubStrings(String[] subStrings) { this.subStrings = subStrings; } @Override public String toString() { return fileName; } } I populated my list view, and use my custom adapter. Now I want to filter the list view based on subStrings array: @SuppressLint("DefaultLocale") @Override protected FilterResults performFiltering(CharSequence constraint) { constraint = constraint.toString().toLowerCase(); if (constraint != null) { suggestions.clear(); for (AudioFile _data : itemsAll) { if (_data.getSubStrings().contains(constraint)) { suggestions.add(_data); } } FilterResults filterResults = new FilterResults(); filterResults.values = suggestions; filterResults.count = suggestions.size(); return filterResults; } else { return new FilterResults(); } } As you can see, I just filter result based on _data.getSubStrings().equals(constraint) But it doesn't work. Any idea?
score: 0
has comment: http://stackoverflow.com/comment/41566644
tagged with: android
has comment: http://stackoverflow.com/comment/41566696
has comment: http://stackoverflow.com/comment/41566243

http://stackoverflow.com/q/26446660
tagged with: tomcat
tagged with: rest
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41545711
type: Question
score: 0
has body: I am running a REST service on Tomcat and a client service from Eclipse. My program keeps stopping when on it's second run through. I am not receiving any exceptions in the console running Tomcat The first time my Controller is called, there is no issue and everything runs fine. After everything executes in the Controller, the user is redirected back to a JSP page. When a button is clicked on the JSP page, the Controller code shown below is run again. However this time, the program stops in the function: getOrderDetails(id, order, service); while executing the line: String orderXML = service.path("rest").path("coffee").header("user", "customer-123").accept(MediaType.APPLICATION_XML_TYPE).get(String.class); This line calls the REST service which will interact with my SQLite database and then return some `XML. I really cannot work out why it is stopping on the second attempt! Any help with this would be GREATLY appreciated! Thank you! Update 1: If it's of any significance, I find that when the program hangs, I need to not only quit Eclipse and restart it, but I also need to restart the server. Otherwise, the client program won't work properly. Update 2: I have defined only one ClientResponse to be used at all points in the program. Update 3: I've been using ClientResponse.close() after each of my requests. NOTE: Code updated to reflect comment below Controller: static ClientConfig config = new DefaultClientConfig(); static Client client = Client.create(config); static WebResource service = client.resource(getBaseURI()); ClientResponse clientResp; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request,response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } private void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOExcept…
has comment: http://stackoverflow.com/comment/41553547
has title: Program hanging at call for REST service
answer count: 1
has comment: http://stackoverflow.com/comment/41587463
tagged with: jsp
has answer: http://stackoverflow.com/a/26521585
accepted answer: http://stackoverflow.com/a/26521585

http://stackoverflow.com/comment/41636909
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26502528
has text: I think that you will find that it is atomic, however the print spool is not. If you had some global incrementing counter, I think that you would find that they are in order.

http://stackoverflow.com/comment/41434127
score: 1
has text: In the `public static void main(String[] args)` method, create an instance of `BankDisplay` and use the methods accordingly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26390413

http://stackoverflow.com/comment/41558024
type: AnswerComment
type: Comment
has text: @sam_rox Exception would occur if both the divisor and the dividend are int/long and the divisor is 0.
comment on: http://stackoverflow.com/a/26458956
score: 0

http://stackoverflow.com/comment/41399686
has text: `public static void ruler(){` looks pretty static to me...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26370025
type: Comment

http://stackoverflow.com/q/26475477
has answer: http://stackoverflow.com/a/26475806
score: 1
tagged with: java
has body: I'm writing a Java program that should ssh to an IP and run a shell script code. The problem is the script is too long and should be carry by the java code. I used sshxcute library. I have two solutions: putting all scripts line by line to JAVA code as an string and execute them at once.(how to do that?) or separate that script code to 80 lines as strings and run them in JAVA one by one.(I don't think this is an efficient way! but the only way I know how to do that) Put that shell script code in JAVA file and execute it by JAVA (I don't know how to do that.). where should I put it (main package?) and who to address to that?
answer count: 1
downvote count: 0
tagged with: shell
favorite count: 0
type: UnansweredQuestion
has title: How to run a long shell script code in a java program?
upvote count: 1
type: Question

http://stackoverflow.com/comment/41535302
has text: @MirkoVolpi, please, at least put the error message or tell us more about the problem you have. With the actual information very dificult to know what is wrong
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26441981
score: 0

http://stackoverflow.com/a/26360846
answers question: http://stackoverflow.com/q/26360518
upvote count: 1
score: 0
downvote count: 1
type: Answer
has body: please change your AnotherClass like below code. public class AnotherClass&lt;T extends MyInterfacee&gt; { public void doSomethingWith(AnotherClass&lt;? extends MyInterfacee&gt; another) { System.out.println(another.toString()); } } thanks.

maven-3
tags question: http://stackoverflow.com/q/26422259
tags question: http://stackoverflow.com/q/26365857
tags question: http://stackoverflow.com/q/26504491
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/26411305
tags question: http://stackoverflow.com/q/26471404
tags question: http://stackoverflow.com/q/26374281
tags question: http://stackoverflow.com/q/26354674
tags question: http://stackoverflow.com/q/26421754
tags question: http://stackoverflow.com/q/26420762

http://stackoverflow.com/a/26457433
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26456674
has body: Enumerated types in Java provide the ability to define additional properties and methods. public enum DAY_INDICATOR { SUNDAY(1,true), MONDAY(2,false), TUESDAY(3,false), WEDNESDAY(4,false), THURSDAY(5,false), FRIDAY(6,false), SATURDAY(7,true) private final int dayNumber; private final bool weekendDay; public DAY_INDICATOR(int dn, bool wd) { dayNumber = dn; weekendDay = wd; } public bool isWeekendDay() { return weekendDay; } ... more accoutrements of an enumerated type } Now you can extend the underlying type with whatever predicates you need to distinguish members of the set of enumerated values according to your business rules.

http://stackoverflow.com/q/26357851
has answer: http://stackoverflow.com/a/26357991
score: 7
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26358127
tagged with: arrays
has title: How to use enumMap in java
has comment: http://stackoverflow.com/comment/41374240
answer count: 3
has comment: http://stackoverflow.com/comment/41374407
has comment: http://stackoverflow.com/comment/41374468
accepted answer: http://stackoverflow.com/a/26358127
favorite count: 0
upvote count: 8
possible better answer: http://stackoverflow.com/a/26357963
has answer: http://stackoverflow.com/a/26357963
type: AnsweredQuestion
tagged with: enums
has body: How do you use enumMap in java? I want to use an enumMap to get constant named values that go from 0 to n where n is size. But I don't understand the description on the oracle site > EnumMap. I tried to use one here package myPackage; import java.util.EnumMap; public class Main{ public static enum Value{ VALUE_ONE, VALUE_TWO, SIZE } public static EnumMap&lt;Value, Integer&gt; x; public static void main(String[] args){ x.put(Value.VALUE_ONE, 0); x.put(Value.VALUE_TWO, 1); x.put(Value.SIZE, 2); int[] myArray = new int[SIZE]; } } This doesn't work. How are you supposed to use an enumMap? is there also a way to do without x.put(Value.VALUE_ONE, 0); for every single element in the enum?

http://stackoverflow.com/comment/41438975
type: Comment
comment on: http://stackoverflow.com/a/26392779
score: 0
type: AnswerComment
has text: That's another disadvantage of the regex approach : it is harder to automatize if you want a different range. For 1-24, you could do : `1[0-9]?|2[0-4]?|[3-9]`. I don't know if something simpler is possible, but you can see that this approach can become complicated if you need flexibility

http://stackoverflow.com/comment/41600350
has text: @OrenSarid Does the parent of the `Combo` have a layout or are you setting the size manually?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26482203

http://stackoverflow.com/comment/41477442
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26414460
has text: Thanks for the help. And also thanks for pointing out my other mistakes, been beating myself up trying to figure this out all day!

http://stackoverflow.com/comment/41439314
type: AnswerComment
has text: thanks for ur answer! I did what you said, but unfortunately still getting compile time error on line `return new ErrorCaptchaRequired("abc", "abc", "abc");` `Incompatible types`
type: Comment
comment on: http://stackoverflow.com/a/26393303
score: 0

pane
tags question: http://stackoverflow.com/q/26434152
tag name: pane
tags question: http://stackoverflow.com/q/26505001
type: Tag

http://stackoverflow.com/comment/77315575
score: 0
comment on: http://stackoverflow.com/a/26432840
type: AnswerComment
type: Comment
has text: @dinesh I only run create() once and store that as a class variable

http://stackoverflow.com/comment/41537863
type: QuestionComment
comment on: http://stackoverflow.com/q/26447578
score: 0
type: Comment
has text: Your `for` looks start with checking `0 < list.size()`. Then, your `if` statements inside check if the size() > 0. For the first loop, if `tel.size()` is `null`, then `i` (which is 0) is not less then 0 or null, so the for loop evaluates as false. It may help to try printing the .size() values before the for loop, to ensure contato.size() != null or 0

http://stackoverflow.com/a/26526353
downvote count: 0
has comment: http://stackoverflow.com/comment/41992400
type: Answer
has body: If the embedded db shall be created at application start and be shut down when the application is stopped, just do the following: @ApplicationScoped @Startup public class AnyNameForYourApplicationClass { @PostConstruct public void connectDB() { // creates the db connection at startup } @PreDestoy public void disconnectDB() { // disconnects from the db } } This should do it. Alternatively you could also use a CDI producer to create an application scoped db connection. Then you can disconnect from the db using a disposer method. In your case the behavior is correct since when the web listener is called the application must still be alive. So the shutdownDB method with @PreDestroy is called afterwards when the application scoped bean is destroyed. And since you are referencing it in your listener, it must stay alive until the listener is destroyed.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26510194
accepted answer of: http://stackoverflow.com/q/26510194
type: AcceptedAnswer

http://stackoverflow.com/comment/41485344
type: QuestionComment
comment on: http://stackoverflow.com/q/26418840
score: 0
type: Comment
has text: Just an observation, `REQUEST_DATE='01-AUG-2014'` That is such an incorrect way of dealing with dates. You will be sooner running into performance issues due to implicit data conversion. If request date is date data type then use `TO_DATE(01-AUG-2014)`.

http://stackoverflow.com/comment/63711404
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26401514
type: QuestionComment
has text: have your problem solved?

http://stackoverflow.com/comment/41611366
score: 0
type: Comment
type: QuestionComment
has text: What is the delimiter character?
comment on: http://stackoverflow.com/q/26488681

http://stackoverflow.com/comment/41383738
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26362976
has text: So it means i have two getter methods? 1 in Car another in Manufacturer?
type: AnswerComment

http://stackoverflow.com/comment/41388529
comment on: http://stackoverflow.com/q/26365457
has text: Why add another JAR dependency to your project when `HashSet` works perfectly well? Unless of course you're developing low latency applications and you *know* that you have performance or heap memory issues
type: Comment
type: QuestionComment
score: 7

http://stackoverflow.com/comment/41501168
type: AnswerComment
score: 0
type: Comment
has text: @RonaldinhoState I edited the question, you now have an anonymos inner type. You can use this code inside your Method/Constructor
comment on: http://stackoverflow.com/a/26427955

http://stackoverflow.com/q/26369353
score: 0
has comment: http://stackoverflow.com/comment/41396874
has comment: http://stackoverflow.com/comment/41396954
has comment: http://stackoverflow.com/comment/41396262
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has title: Spring MVC: Bind Input field to multiple properties
answer count: 0
tagged with: java
type: Question
has body: I am trying to get Spring MVC to bind the value from one input field to multiple properties. My use-case is a forum, that contains a form to create a new topic. That dialog actually create a topic and a post, which both have the same title, so only one input field exists for the title. If I copy the value myself in the controller method, using the "@Validated" annotation in the signature won't work, since the validator is called before I can copy the value, and so the title would still be missing in one field. Of course I can call the validator myself after copying the value, but if at all possible I would prefer if Spring would bind that value itself, just to get a clean solution (and to learn if and how it is possible). Best regards, Christian

http://stackoverflow.com/comment/41481631
type: Comment
has text: @alfasin centos + open-jdk 7
type: QuestionComment
comment on: http://stackoverflow.com/q/26417239
score: 0

http://stackoverflow.com/a/26489056
score: 0
has comment: http://stackoverflow.com/comment/41612283
type: Answer
has comment: http://stackoverflow.com/comment/41612329
has comment: http://stackoverflow.com/comment/41612372
has comment: http://stackoverflow.com/comment/41612031
answers question: http://stackoverflow.com/q/26488941
has comment: http://stackoverflow.com/comment/41612084
accepted answer of: http://stackoverflow.com/q/26488941
type: AcceptedAnswer
has body: public void averageGrade() { int sum = 0; float average = 0.0f; for(int i = 0; i &lt; scores.size(); i++) sum += scores.get(i); // Compute total score average = (float)sum / scores.size(); // Compute average System.out.println(average); }

http://stackoverflow.com/a/26484381
has body: Simple servlet containers such as Apache Tomcat come with this API (look for servlet-api.jar).
type: Answer
answers question: http://stackoverflow.com/q/26483173
has comment: http://stackoverflow.com/comment/41606280
score: 0

http://stackoverflow.com/comment/41426801
comment on: http://stackoverflow.com/a/26370091
has text: A PreparedStatement would avoid your problem, be faster, and would prevent sql injection.
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/comment/41500581
type: Comment
comment on: http://stackoverflow.com/a/26427114
score: 0
type: AnswerComment
has text: +1. This question actually be put on MathOverflow for reverse function calculation.

http://stackoverflow.com/q/26505414
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/26505532
has body: if i have these functions public void methodA(){ synchronized (ObjectAlwaysDifferent) { .... } } public void methodB(){ } And threads that can enter inside the synchronized block so, Thread1 enter with Object1 Thread2 enter with Object2 and another thread Thread3 want to enter with Object1 if thread loop is: public void run(){ while(true){ methodA(); methodB(); } } thread3 will wait inside the methodA,until the lock of object1 will released? or it ' s able to go to execute the methoB if it's monitor object is locked by another thread? it is possible to rewrite the methodA() using Lock and condition of (concurrent API)?
type: Question
type: AnsweredQuestion
upvote count: 2
answer count: 1
favorite count: 0
has title: waiting threads in a syncronized block
accepted answer: http://stackoverflow.com/a/26505532
score: 2
downvote count: 0

http://stackoverflow.com/q/26414370
tagged with: for-loop
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26414445
downvote count: 0
has answer: http://stackoverflow.com/a/26414445
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26414460
has title: Distance Traveled loop help Java
upvote count: 2
tagged with: java
answer count: 2
has body: I've been racking my brain trying to figure out why my program isn't looping right. Rather than getting each hour increments I'm only getting the final hour/speed. So if I put that I'm going 40 mph for 3 hours I only get 120. Here is the problem: The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. Write a program that asks for the speed of a vehicle (in mph) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph for a three-hour time period, it should display a report similar to the one that follows: Hour Distance Traveled 1 40 2 80 3 120 import java.util.Scanner; public class Distance{ public static void main(String [] args){ Scanner keyboard = new Scanner(System.in); int time , speed , hour; double distance; System.out.println("How fast were you going ?"); speed = keyboard.nextInt(); while(speed&lt;=0) { System.out.println("Please enter a valid speed "); speed = keyboard.nextInt(); } System.out.println(" How long did you ride / drive ?"); time = keyboard.nextInt(); while(time&lt;=0) { System.out.println("Please enter a valid time "); time = keyboard.nextInt(); } System.out.println(" Hour Distance"); System.out.println("---------------------------------"); hour = 0; for( int x = 1; x&lt;=time; x++) { hour++; if(hour&gt;1) { distance = time * speed; System.out.println(time+ " " +distance); } } } }
has comment: http://stackoverflow.com/comment/41476679
has answer: http://stackoverflow.com/a/26414460
has comment: http://stackoverflow.com/comment/41476657

http://stackoverflow.com/a/26454148
accepted answer of: http://stackoverflow.com/q/26454094
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41549653
has comment: http://stackoverflow.com/comment/41549412
answers question: http://stackoverflow.com/q/26454094
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41549682
has comment: http://stackoverflow.com/comment/41549141
upvote count: 2
has comment: http://stackoverflow.com/comment/41549196
has body: You have strange conditions on the end of the source code: if(operation.equals("multiply")); total = total * secondnum; this won't multiply because of semicolon on the end of if this is better: if(operation.equals("multiply")) total = total * secondnum; And I cant understand your block of codes here, if you want to make if do this: if(condition){ command1; command2; } and not: { if(condition) command1; command2; }
has comment: http://stackoverflow.com/comment/41549294

http://stackoverflow.com/q/26510841
has answer: http://stackoverflow.com/a/26513340
has body: I'm trying to run a batch script that would create a new glassfish domain (v 3.1) and right after the creation it would continue with some administrative tasks, like removing other directories or copying files to the newly-created domain. Problem is, I have to wait until the glassfish intallation script finishes its work. I have tried to create a new window with: Start /WAIT "" asadmin --user admin --interactive=false create-domain --adminport 4848 --instanceport 8080 --nopassword new_domain and running some simple commands (like xcopy, rd) after it, in the same .bat file. The problem is, after the asadmin script has finished its work new window does not close, but stays opened and the whole script hangs waiting for the job to terminate. I can close it manually and the script continues its flow, but this solution is not satisfactory. I have even tried to modify the asadmin.bat script to force it to shutdown after creation in this way: %JAVA% -jar "%~dp0..\glassfish\modules\admin-cli.jar" %* &amp;&amp; exit exit But it does not help.
tagged with: windows
has title: Continuing batch file after executing jar
has answer: http://stackoverflow.com/a/26511640
accepted answer: http://stackoverflow.com/a/26511640
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26513340
type: Question
has comment: http://stackoverflow.com/comment/41674274
tagged with: java
tagged with: glassfish
score: 0
has comment: http://stackoverflow.com/comment/41651908
tagged with: batch-file
answer count: 2

http://stackoverflow.com/comment/41581118
has text: yes but that public method is something i want to unit test. it's just so that i can ignore private void method's outcome (especially the exception which is inherently there)
type: Comment
comment on: http://stackoverflow.com/q/26458133
score: 0
type: QuestionComment

http://stackoverflow.com/a/26430210
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26429672
type: Answer
score: 4
has body: Oracle's Java concurrency tutorial says (my emphasis added): The Interrupt Status Flag The interrupt mechanism is implemented using an internal flag known as the interrupt status. Invoking Thread.interrupt sets this flag. When a thread checks for an interrupt by invoking the static method Thread.interrupted, interrupt status is cleared. The non-static isInterrupted method, which is used by one thread to query the interrupt status of another, does not change the interrupt status flag. By convention, any method that exits by throwing an InterruptedException clears interrupt status when it does so. However, it's always possible that interrupt status will immediately be set again, by another thread invoking interrupt. What you're seeing is that the thread gets interrupted, the method being exited is the join (actually join is implemented by calling Object.wait, so I would expect the stacktrace would show that wait is the method the exception is thrown from), and the flag gets cleared like the tutorial says. It's up to the handler of the exception to decide whether the thread's interrupt status flag should be set again or not. Unless the handler is coded to do something differently the default assumption is that the exception was handled and there's no need for the flag to be set anymore. The API documentation for Thread#interrupt is consistent with this: If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException. I have an answer that goes more into why interruption was designed this way here.
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26429672

http://stackoverflow.com/q/26367457
favorite count: 0
has title: JavaFX - Which method of event listener is more efficient?
accepted answer: http://stackoverflow.com/a/26367891
has body: I just started using event listener in JavaFX . I stumbled upon two methods for the same purpose. Any advantage of one or the other? test1.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.print("PPT"); } }); and test1 .selectedProperty().addListener(new ChangeListener&lt;Boolean&gt;() { public void changed(ObservableValue&lt;? extends Boolean&gt; ov, Boolean old_val, Boolean new_val) { log("ggggggg"); } }); Also test1 is the name of the checkbox
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: javafx
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26367891
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26405934
has comment: http://stackoverflow.com/comment/41462502
answer count: 0
has comment: http://stackoverflow.com/comment/41460615
type: UnansweredQuestion
upvote count: 1
has title: Automize way of Reading file from classpath or fullpath
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41460565
tagged with: servlets
has body: Is there are way of automatically detect whether file will be read from classpath or full path? I want an API method do samething that done by following method (readFile). there are two generic definitions like classpath:filename or file:filename public readFile(String path){ if(path.startswith("classpath")) { getClass().getResourceAsStream(path); }else if(path.startswith("file")) { // FileInoutStream(new File(path)) } Using: Servlet 3.0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/77802312

http://stackoverflow.com/a/26358760
has body: Double.MIN_VALUE holds a positive number, so 0 < Double.MIN_VALUE. /** * A constant holding the smallest positive nonzero value of type * double, 2-1074. It is equal to the * hexadecimal floating-point literal * 0x0.0000000000001P-1022 and also equal to * Double.longBitsToDouble(0x1L). */ public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324 You should use some arbitrary negative value instead (or perhaps Double.NEGATIVE_INFINITY).
score: 2
accepted answer of: http://stackoverflow.com/q/26358726
upvote count: 2
answers question: http://stackoverflow.com/q/26358726
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26507892
has comment: http://stackoverflow.com/comment/41674010
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26507376
has comment: http://stackoverflow.com/comment/42682394
score: 0
answers question: http://stackoverflow.com/q/26507376
has body: You should use x.append(line.trim()); instead of x.append(line); FileInputStream fi = new FileInputStream(file); byte[] downloadStream = new byte[(int) file.length()]; fi.read(downloadStream); InputStream is = new ByteArrayInputStream(downloadStream); // read it with BufferedReader BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; while ((line = br.readLine()) != null) { x.append(line.trim()); }
type: Answer
has comment: http://stackoverflow.com/comment/41647125
has comment: http://stackoverflow.com/comment/41646536
has comment: http://stackoverflow.com/comment/41647124
has comment: http://stackoverflow.com/comment/42682337
has comment: http://stackoverflow.com/comment/41647304

http://stackoverflow.com/q/26384090
has answer: http://stackoverflow.com/a/32216680
has comment: http://stackoverflow.com/comment/41423480
has comment: http://stackoverflow.com/comment/41427884
favorite count: 0
tagged with: apache-poi
has title: How can I check if an information is present or not in Excel file using Apache POI and Java Code
upvote count: 1
has body: I have a question: I'm reading some information from my Excel file using this Java code: HSSFWorkbook workbook = null; try { workbook = new HSSFWorkbook(file); }catch (IOException ex) { ... } SummaryInformation summaryInfo = workbook.getSummaryInformation(); if (summaryInfo.getTitle() != null) { System.out.println(summaryInfo.getTitle()); } if (summaryInfo.getAuthor() != null) { System.out.println(summaryInfo.getAuthor()); } but I get this error I don't have the "Title" information: java.lang.NullPointerException I have this error on this line: if (summaryInfo.getTitle() != null) { Now, How can I check if the "Title" value (or other value) is present or not if this condition give me an error?
accepted answer: http://stackoverflow.com/a/32216680
type: AnsweredQuestion
tagged with: if-statement
score: 1
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/41423033
type: Question
tagged with: import-from-excel
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/41506604
score: 0
type: Comment
type: QuestionComment
has text: I revised the code above to more closely match the real world code. The issue seems to stem from the fact that Object1 extends ArrayList<Object2>. All I was doing was overriding the add() method so I could insert some extra functionality. Removing "extends ArrayList<Object2>" resolved the issue, though I'm not understanding WHY extending the ArrayList class caused this.
comment on: http://stackoverflow.com/q/26415550

http://stackoverflow.com/comment/41921479
comment on: http://stackoverflow.com/a/26657218
type: Comment
score: 0
type: AnswerComment
has text: I want to use a prefix for all the columns in each table.

http://stackoverflow.com/a/26616041
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/53259703
score: 0
type: Answer
has body: After a long struggle, here are my observations and I was able to find a solution to the issue. Any feedback about my solution is welcome The Edit holds the answer. I simply modified the code from Runnable to a Thread When the code which connects to the chat server was in a Runnable, I got a android.os.NetworkOnMainThreadException. For some reason, I am not able to find the stack trace of NetworkOnMainThreadException. The ConnectionConfiguration was carrying the NetworkOnMainThreadException when the connection is made using a Runnable. Hope this helps someone who face a similar issue to mine. I sincerely thank @Flow for his effort in helping me resolve this issue. Your smack work is very commendable and a blessing for the android community. See the image attached for the exception.
answers question: http://stackoverflow.com/q/26497773
accepted answer of: http://stackoverflow.com/q/26497773

http://stackoverflow.com/comment/41445718
type: Comment
comment on: http://stackoverflow.com/a/26394949
has text: It's a throwback to the C language, really. The `&` operator produces the storage location (memory address) of a variable, in this case a pointer to a float (`float*`). The cast tells the compiler "this is actually a pointer to an `uint` value (a `uint*`)". The `*` operator retrieves the value at the storage location described by the pointer. So, basically, you're telling the compiler to read an `uint` value from the memory location where `f` is stored. You're getting whatever integer happens to have the same bitwise representation of the float value.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26388599
has body: When a file is uploaded to a php server, I am trying to figure out a way to get files sorted. What I want to do is add a custom tag to each file programmaticly in android, upload it to the server (which I have alreay done), and read that tag through a php script. Thanks for the help
tagged with: java
type: Question
tagged with: tags
has title: How to add a custom tag to a file (mostly images) which is uploaded to a server, and the tag is read through a php script to sort it?
linked to: http://stackoverflow.com/q/8851425
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: php
has answer: http://stackoverflow.com/a/26388804

http://stackoverflow.com/comment/41581599
type: Comment
comment on: http://stackoverflow.com/q/26471930
has text: I know its not the project class , because its a shared repository and all the junit test are passing for everyone else. I also had this project running before, and there have not been any changes except that I had to manually set the JRE and other dependencies. I get the same error in every test null pointer exception at at java.util.Properties$LineReader.readLine(Unknown Source
score: 0
type: QuestionComment

http://stackoverflow.com/a/26462191
answers question: http://stackoverflow.com/q/26400627
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41563339
type: Answer
downvote count: 0
has body: This is surely a bad idea, but if that's what you want then here it is. Modify your panel to override its getPreferredSize to be its default height, but its parent's width: JPanel panel = new JPanel() { @Override public Dimension getPreferredSize() { int h = super.getPreferredSize().height; int w = getParent().getSize().width; return new Dimension(w, h); } }; The parent class is the JViewport which is the "window through which you look" at the component in the scroll pane. Now the line scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); does nothing because it is guaranteed that the width of the panel is the width of the viewport, which means you have nowhere to scroll to and by default the scrollbar won't appear. The only way to see the remaining text is to resize the scroll pane through resizing of the frame. I won't be surprised if anything breaks with this.
score: 3
accepted answer of: http://stackoverflow.com/q/26400627

http://stackoverflow.com/a/31759040
has body: you can't use dataSourceClassName approach in application.properties configurations as said by @Andy Wilkinson. if you want to have dataSourceClassName anyway you can use Java Config as: @Configuration @ComponentScan class DataSourceConfig { @Value("${spring.datasource.username}") private String user; @Value("${spring.datasource.password}") private String password; @Value("${spring.datasource.url}") private String dataSourceUrl; @Value("${spring.datasource.dataSourceClassName}") private String dataSourceClassName; @Value("${spring.datasource.poolName}") private String poolName; @Value("${spring.datasource.connectionTimeout}") private int connectionTimeout; @Value("${spring.datasource.maxLifetime}") private int maxLifetime; @Value("${spring.datasource.maximumPoolSize}") private int maximumPoolSize; @Value("${spring.datasource.minimumIdle}") private int minimumIdle; @Value("${spring.datasource.idleTimeout}") private int idleTimeout; @Bean public DataSource primaryDataSource() { Properties dsProps = new Properties(); dsProps.put("url", dataSourceUrl); dsProps.put("user", user); dsProps.put("password", password); dsProps.put("prepStmtCacheSize",250); dsProps.put("prepStmtCacheSqlLimit",2048); dsProps.put("cachePrepStmts",Boolean.TRUE); dsProps.put("useServerPrepStmts",Boolean.TRUE); Properties configProps = new Properties(); configProps.put("dataSourceClassName", dataSourceClassName); configProps.put("poolName",poolName); configProps.put("maximumPoolSize",maximumPoolSize); configProps.put("minimumIdle",minimumIdle); configProps.put("minimumIdle",minimumIdle); configProps.put("connectionTimeout", connectionTimeout); configProps.put("idleTimeout", idleTimeout); configProps.put("dataSourceProperties", dsProps); HikariConfig hc = new HikariConfig(configProps); HikariDataSource ds = new HikariDataSource(hc); return ds; } } reason you cannot use dataSourceClassName because it will throw and exception Caused by: java.lang.IllegalStateException: both driverClassName and dataSou…
answers question: http://stackoverflow.com/q/26490967
has comment: http://stackoverflow.com/comment/85100299
score: 8
type: Answer
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/41434142
has text: Thank you for your help! I've managed to get OpenGL 4.1 running on Mavericks using this guide: [link](http://lwjgl.org/wiki/index.php?title=Version_selection) Next step: Adding a GLSL shader!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26373864

http://stackoverflow.com/q/26435678
has body: I have an application that makes use of a FixedThreadPool with 10 threads for running database queries. If there is a constant high number of queries to perform it starts to use a significant amount of memory and queries start taking longer to be executed. Is there a way of making a FixedThreadPool block when all threads are in use or when the queue reaches a certain size so that I don't end up with this problem?
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41516150
upvote count: 1
has comment: http://stackoverflow.com/comment/41516132
type: Question
tagged with: threadpool
has title: Blocking FixedThreadPool
downvote count: 0
has comment: http://stackoverflow.com/comment/41516218
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41516109

http://stackoverflow.com/q/26426245
tagged with: database
has title: Is it possible to find an image file extension from its byte array contents?
tagged with: image
accepted answer: http://stackoverflow.com/a/26426351
possible better answer: http://stackoverflow.com/a/26426657
answer count: 2
upvote count: 7
has answer: http://stackoverflow.com/a/26426351
favorite count: 0
linked to: http://stackoverflow.com/q/1915317
has body: Having an image file already stored into a database as a byte array, is it possible to find the image file extension from the byte array contents? I can get the byte array from the database. I need to show the image file into the screen. Before displaying it, I want to have the image file extension, such as .png,.jpg or .jpeg, etc..
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26426657
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/41500268
has comment: http://stackoverflow.com/comment/41497534
type: Question
duplicate of: http://stackoverflow.com/q/1915317
tagged with: arrays

http://stackoverflow.com/comment/41626010
type: QuestionComment
type: Comment
has text: Your algorithm seems fine. Consider restructuring how you are calling this! For example: is it possible to navigate to the last page in a `@BeforeClass` method (assuming [tag:JUnit4]), and then run all your tests from that point?
comment on: http://stackoverflow.com/q/26495441
score: 0

http://stackoverflow.com/a/28541332
type: Answer
upvote count: 23
has body: Try changing q1.setParameter("names", list1); to q1.setParameterList("names", list1);
downvote count: 0
answers question: http://stackoverflow.com/q/26448110
score: 23

http://stackoverflow.com/q/26499930
answer count: 1
has comment: http://stackoverflow.com/comment/41632181
has answer: http://stackoverflow.com/a/26500038
has comment: http://stackoverflow.com/comment/41632212
has body: I don't believe I saw this when searching (believe me, I spent a good amount of time searching for this) for a solution to this so here goes. Goal: Match regex in a string and replace it with something that contains the matched value. Regex used currently: \b(Connor|charries96|Foo|Bar)\b For the record I suck at regex incase this isn't the best way to do it. My current code (and several other methods I tried) can only replace the text with the first match it encounters if there are multiple matches. private Pattern regexFromList(List&lt;String&gt; input) { if(input.size() &lt; 1) { return ""; } StringBuilder builder = new StringBuilder(); builder.append("\\b"); builder.append("("); for(String s : input) { builder.append(s); if(!s.equals(input.get(input.size() - 1))) { builder.append("|"); } } builder.append(")"); builder.append("\\b"); return Pattern.compile(builder.toString(), Pattern.CASE_INSENSITIVE); } Example input: charries96's name is Connor. Example result using TEST as the data to prepend the match with TESTcharries96's name is TESTcharries96. Desired result using example input: TESTcharries96's name is TESTConnor. Here is my current code for replacing the text: if(highlight) { StringBuilder builder = new StringBuilder(); Matcher match = pattern.matcher(event.getMessage()); String string = event.getMessage(); if (match.find()) { string = match.replaceAll("TEST" + match.group()); // I do realise I'm using #replaceAll but that's mainly given it gives me the same result as other methods so why not just cut to the chase. } builder.append(string); return builder.toString(); } EDIT: Working example of desired result on RegExr
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/26500038
tagged with: regex
has title: Replace text with data & matched group contents
score: 0
tagged with: java

http://stackoverflow.com/comment/41656535
type: QuestionComment
comment on: http://stackoverflow.com/q/26431368
has text: You would need to include the Logcat lines from the crash in order for us to really be able to figure out why it's crashing.
score: 0
type: Comment

http://stackoverflow.com/a/26502538
score: 0
answers question: http://stackoverflow.com/q/26366331
type: Answer
has body: Check out the ButtonGroup for a more elegant solution. http://docs.oracle.com/javase/tutorial/uiswing/components/buttongroup.html

http://stackoverflow.com/a/26505224
has body: You could use the following one: ^@[^=]+=(?:[^@]|(?&lt;!^)@)+$ Debuggex Demo Don't forget the multiline flag.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26505090
accepted answer of: http://stackoverflow.com/q/26505090

http://stackoverflow.com/a/26417250
score: 0
has comment: http://stackoverflow.com/comment/41481873
answers question: http://stackoverflow.com/q/26416888
has body: Here's one way to do it class X { @SuppressWarnings("unchecked") public &lt;T extends Enum&lt;T&gt; &amp; Bar&gt; String getMe(Z z, String fooValue) { Class&lt;T&gt; fooEnum = (Class&lt;T&gt;) z.getMyEnum(); return Enum.valueOf(fooEnum, fooValue).getMe(); } } Externally, the type parameter is useless. Internally, it lets us declare a type that is both a subtype of Enum and of Bar. The cast to Bar is also no longer necessary.
type: Answer
has comment: http://stackoverflow.com/comment/41481803
has comment: http://stackoverflow.com/comment/41481861
has comment: http://stackoverflow.com/comment/41481751

http://stackoverflow.com/comment/41654077
type: QuestionComment
has text: My guess is that you're in fact returning something from the finally block. you should provide a complete, reproducible test case.
comment on: http://stackoverflow.com/q/26511892
score: 0
type: Comment

http://stackoverflow.com/comment/41616194
type: QuestionComment
type: Comment
has text: You have a loop in which you process each number that the user inputs. If you want to test each number to see if it's between 1 and 100, you have to put the test **inside** the loop. If you put it outside the loop, you won't be able to look at every input number.
comment on: http://stackoverflow.com/q/26491038
score: 0

http://stackoverflow.com/comment/41393458
comment on: http://stackoverflow.com/q/26366666
score: 0
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63054/discussion-between-glazius-and-user1803551).
type: Comment

http://stackoverflow.com/q/26501684
accepted answer: http://stackoverflow.com/a/26502251
has comment: http://stackoverflow.com/comment/78590580
favorite count: 0
has comment: http://stackoverflow.com/comment/41635229
has comment: http://stackoverflow.com/comment/41635170
has comment: http://stackoverflow.com/comment/41635615
score: -3
tagged with: swing
possible better answer: http://stackoverflow.com/a/26502018
has body: This is my code here in this i want to get output as following but some error is there ---Outputs---- Name Arun.Gender Male. He likes nothing. Name Arun.Gender Male. He likes Cricket only Name Arun.Gender Male. He likes Cricket and Tennis. Name Arun.Gender Male. He likes Cricket ,Football and Tennis /* * Register.java * * Created on 8 October, 2014, 9:27 AM */ package Register; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * * @author DELL */ public class Register extends javax.swing.JFrame { /** Creates new form Register */ public Register() { initComponents(); initListener() ; } /** 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() { bg = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); rb_female = new javax.swing.JRadioButton(); cb_cricket = new javax.swing.JCheckBox(); txt_name = new javax.swing.JTextField(); lbl_name = new javax.swing.JLabel(); cb_tennis = new javax.swing.JCheckBox(); jScrollPane1 = new javax.swing.JScrollPane(); ta_show = new javax.swing.JTextArea(); rb_male = new javax.swing.JRadioButton(); cb_football = new javax.swing.JCheckBox(); btn_show = new javax.swing.JButton(); lbl_hobbies = new javax.swing.JLabel(); lbl_gender = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Register", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 14))); // NOI18N bg.add(rb_female); rb_female.setFont(new java.awt.Font("Times New Roman", 1, 14)); rb_female.setText("Female"); cb_cricket.setFont(new j…
has answer: http://stackoverflow.com/a/26502018
type: AnsweredQuestion
has title: JCheckBox issue in Java?
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26502251
type: Question
tagged with: actionlistener
answer count: 2
tagged with: jcheckbox
upvote count: 0

http://stackoverflow.com/comment/41654718
comment on: http://stackoverflow.com/q/26510200
score: 0
type: Comment
type: QuestionComment
has text: @TravisDykhoff Upvoted + retracted close vote. Thank you for editing!

http://stackoverflow.com/q/26467948
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26468590
has title: How do I continue to add items to array and print
has answer: http://stackoverflow.com/a/26468597
has comment: http://stackoverflow.com/comment/41574324
tagged with: java
type: Question
tagged with: casting
has body: Tried to simplify my program I am trying to create this tester to test my add and remove methods for my other class and print the list of properties in the array list I am stuck on how to proceed Please Help public class Tester { public static void main (String[] args) { } public Tester () { Apartment testingApartment = new Apartment(); Basement testingBasement = new Basement(); Company testingCompany = new Company();// Contains list of // properties to sell // in arraylist // elements with a 2 after the name are used for the Basement // elements String Apartmentneighbourhood = "Parkdale"; String Basementneighbourhood = "Rexdale"; double price = 400000.99; double price2 = 5000000.99; int numberofbaths = 3; int numberofbaths2 = 5; int numberofbedrooms = 2; int numberofbedrooms2 = 4; int squarefoot = 3000; int squarefoot2 = 5000; int floors = 4; int floorlevel = 4; testingApartment.setneighbourhood(apartmentneighbourhood); testingBasement.setneighbourhood(Basementneighbourhood); testingApartment.setprice(price); testingBasement.setprice(price2); testingApartment.setbathNum(numberofbaths); testingBasement.setbathNum(numberofbaths2); testingApartment.setbedNum(numberofbedrooms); testingBasement.setbedNum(numberofbedrooms2); testingApartment.setsqrft(squarefoot); testingBasement.setsqrft(squarefoot2); testingApartment.setNumFloors(floors); testingBasement.setFloorLevel(floorlevel); } } Here is my add method from my Apartment Class public void addApartment(Apartment newApartment) { Apartment ApartmentInput = new Apartment(); ApartmentInput = newApartment; Arraylist.add(ApartmentInput); }
tagged with: arrays
has comment: http://stackoverflow.com/comment/41573972
tagged with: inheritance
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41573936
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41574038
has comment: http://stackoverflow.com/comment/41574849

http://stackoverflow.com/q/26395602
has body: Are there any issues if I were to compile with IBM JDK and run with Sun JRE Assuming we use the same major version of IBM and SUN
answer count: 1
has comment: http://stackoverflow.com/comment/41443558
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41443046
type: UnansweredQuestion
score: 3
downvote count: 0
linked to: http://stackoverflow.com/q/115184
favorite count: 0
has title: Are there any issues if I compile with IBM JDK and run with Sun JRE
type: Question
has answer: http://stackoverflow.com/a/26396236

http://stackoverflow.com/a/26356186
has body: You can either use a try-catch-finally block and close the connection within the finally. Connection con; try { con = new Connection(...); } catch (Exception e) { //Error Handling } finally { connection.close(); } Or you use a try-with-resource and let the VM take care of closing the connections (In this case, you do not need to declare the Connection as field but have one for each action): try(Connection con = new Connection(...)) { } catch() { }
type: Answer
answers question: http://stackoverflow.com/q/26356079
score: 0
has comment: http://stackoverflow.com/comment/41371496

http://stackoverflow.com/q/26422727
accepted answer: http://stackoverflow.com/a/26461551
favorite count: 0
has body: I am localizing a web application using a java.util.ResourceBundle class and property files. I have two locales, fr_FR and en_US, and I want to use en_US as the default, so I wrote the following files : messages_fr_FR.properties with fr_FR messages messages.properties with en_US messages My problem is that the ResourceBundle.getBundle(BUNDLE_NAME, locale) method fall back Locale.getDefault() before using the default property file, which means if the JVM Locale is set to fr_FR, ResourceBundle.getBundle("name", new Locale("en", "US")) returns the fr_FR bundle. I could rename the messages.properties file, but this could returns a MissingResourceException with other desired and default locales. How can I ignore the System Locale, without duplicating the property file or calling Locale.setDefault ?
tagged with: localization
possible better answer: http://stackoverflow.com/a/51874621
upvote count: 6
has answer: http://stackoverflow.com/a/51874621
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: resourcebundle
has answer: http://stackoverflow.com/a/26461551
has title: How to ignore the system default Locale to retrieve resourceBundle
downvote count: 0
score: 6
answer count: 2

http://stackoverflow.com/q/26394429
has comment: http://stackoverflow.com/comment/41442400
tagged with: swing
has body: Im trying to space out all the buttons on the left side and the right side to a certain number of pixels from each bottom above and below it. When I put the message and message 2 JLabels to size of 1 pixel, then the spacing seems to work more closely to what I had anticipated.
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: gridbaglayout
has answer: http://stackoverflow.com/a/26394635
accepted answer: http://stackoverflow.com/a/26394635
score: 0
answer count: 1
tagged with: user-interface
has title: Spacing multiple buttons using Gridbag on Java
tagged with: spacing

http://stackoverflow.com/a/26468864
has comment: http://stackoverflow.com/comment/41576964
has comment: http://stackoverflow.com/comment/41576612
has comment: http://stackoverflow.com/comment/41576348
has comment: http://stackoverflow.com/comment/41577252
has comment: http://stackoverflow.com/comment/41576405
score: 0
has comment: http://stackoverflow.com/comment/41577545
has body: As I can see here you have JSON formated string as a response. There are many JSON APIs, you can use provided in Android. Just make JSONObject and get the data you are interested in. JSONObject playlist = new JSONObject(response); // list items JSONArray items = playlist.getJSONObject("data").getJSONArray("items"); // traverse items array and get video url for(int i=0; i&lt;items.length(); i++) { JSONObject item = items.getJSONObject(i); // video url String videoURL = item.getJSONObject("video").getJSONObject("player").getString("default"); } You need to wrap all this in try-catch block. EDIT As I understood you need to parse the strings you have in the list links. for(String link : links) { String id = link.split("&amp;")[0].split("v=")[1]; // do what you need with the link }
type: Answer
answers question: http://stackoverflow.com/q/26468396
has comment: http://stackoverflow.com/comment/41576994
has comment: http://stackoverflow.com/comment/41576811
has comment: http://stackoverflow.com/comment/41576511
has comment: http://stackoverflow.com/comment/41576775

http://stackoverflow.com/comment/41404207
type: QuestionComment
has text: How would i put that into my code could you show me? becuase im a little confused
score: 0
comment on: http://stackoverflow.com/q/26373788
type: Comment

http://stackoverflow.com/comment/41598270
comment on: http://stackoverflow.com/q/26477965
has text: Can you add the configuration for the `LocalSessionFactoryBean` as that is missing as well as the xml configuration for hibernate.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41415105
comment on: http://stackoverflow.com/q/26379518
type: Comment
type: QuestionComment
has text: Maybe you can take a look what the api says: http://fasterxml.github.io/jackson-dataformat-csv/javadoc/2.0.6/com/fasterxml/jackson/dataformat/csv/class-use/CsvSchema.html there are also a method withoutQuoteChar(Char c). Maybe you should try a few methods ;)
score: 0

http://stackoverflow.com/comment/41636410
has text: I think it's important to consider all relevant tags when offering an answer.
comment on: http://stackoverflow.com/a/26501983
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/a/40785426
answers question: http://stackoverflow.com/q/26416706
type: Answer
has body: public static void main(String[] args) { int i=6; int n=i; int r=0; while(i&gt;0){ i--; if(i&gt;0 &amp;&amp; n%i==0){ if (i!=0) r=r+i; } } System.out.println(r); if (r==n) System.out.println("its True"); else System.out.println("its False"); }
score: 0

compiler-construction
tags question: http://stackoverflow.com/q/26427080
tag name: compiler-construction
type: Tag
tags question: http://stackoverflow.com/q/26441749

http://stackoverflow.com/q/26504212
tagged with: servlets
has answer: http://stackoverflow.com/a/42785301
has answer: http://stackoverflow.com/a/46591743
downvote count: 0
has title: Why do I get "Error parsing HTTP request header" when POSTing a JSON string?
has answer: http://stackoverflow.com/a/30911041
favorite count: 0
has answer: http://stackoverflow.com/a/47257892
score: 8
has body: I am trying to send a POST request from browser to my server(local host). My request URL is : http://localhost:8080/myPath/myServlet?requestData={ .......//Json String......}; requestData is a json String (I am using GSON for the purpose.) Everything is working fine until the data in the json string exceeds a particular limit. Say, I am sending array of objects in the json string. If the number of objects in the list exceed 67 then I get following error : AM org.apache.coyote.http11.AbstractHttp11Processor process INFO: Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. Why is this so? I am totally confused. Why does this happen and what needs to be done to fix this? I want to understand the reason behind this, for I don't understand that after particular number of objects it suddenly stops working and I get this error in my console.
has comment: http://stackoverflow.com/comment/69955859
upvote count: 8
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41639846
has comment: http://stackoverflow.com/comment/41639888
linked to: http://stackoverflow.com/q/417142
has answer: http://stackoverflow.com/a/52216209
tagged with: java
has comment: http://stackoverflow.com/comment/41640601
has comment: http://stackoverflow.com/comment/41639849
has comment: http://stackoverflow.com/comment/43445478
tagged with: http
linked to: http://stackoverflow.com/q/18819180
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/26504360

http://stackoverflow.com/a/26430331
answers question: http://stackoverflow.com/q/26430189
downvote count: 1
has comment: http://stackoverflow.com/comment/41505881
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/41505685
has body: If you want to be exact, I don't see any way around using BigDecimal. But depending what you do with this numbers you can always round using Math.round to "ensure" you have the "correct" decimals set. Round a double to 2 decimal places
type: Answer

http://stackoverflow.com/q/26420450
answer count: 1
downvote count: 1
tagged with: tomcat
tagged with: jvm
favorite count: 0
has title: Why my Windows suddenly encounters the error 'java.security.AccessControlException accessDeclaredMembers?
has body: I encountered a problem when I'm starting my Tomcat in Windows 7, which like a security problem: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers") How should I solve this problem? I follow somebody's instructions to add permission java.lang.RuntimePermission "accessDeclaredMembers"; in java.proxy file, but it causes another problem that java/lang/Object can't be found. I just get very confused why this happened. Can anybody gives me ideas on fixing it? Thanks!
tagged with: security
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26444410
has comment: http://stackoverflow.com/comment/55709335
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/41567419
type: Comment
has text: but I tried to do it but it says thread1.java:9: error: <identifier> expected t1.start(); ^
comment on: http://stackoverflow.com/q/26464499
score: 0
type: QuestionComment

http://stackoverflow.com/q/26430073
favorite count: 0
has title: What is the compile group, name etc...?
accepted answer: http://stackoverflow.com/a/26430238
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: gradle
has body: I come across the following method invocation: dependencies { compile group: 'commons-collections', name : 'commons-collections', version: '3.2' } Well, dependencies(Closure closure)'s defined in Project and the code above is just its invocation. But what is the closure's body in the Groovy point of view? compile group: 'commons-collections', name : 'commons-collections', version: '3.2'
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/26366653
has answer: http://stackoverflow.com/a/26430252
has answer: http://stackoverflow.com/a/26430238
possible better answer: http://stackoverflow.com/a/26430252
score: 0
answer count: 2
tagged with: groovy

http://stackoverflow.com/comment/41531169
type: Comment
comment on: http://stackoverflow.com/q/26444223
type: QuestionComment
score: 1
has text: Explain the difference between "prints it all out", and "when there are no more tokens, the loop exits".

oracle10g
tags question: http://stackoverflow.com/q/26420080
tag name: oracle10g
type: Tag

http://stackoverflow.com/comment/41494328
type: Comment
comment on: http://stackoverflow.com/a/26422221
score: 0
type: AnswerComment
has text: You mean that they certainly built their own package based on JOGL, but different from JOGL official ? Guess you are right, I'll have a look at their forum to make sure ...

http://stackoverflow.com/a/26457084
has body: Change the end condition of your for statement to num1&lt;=userNum.
score: 0
answers question: http://stackoverflow.com/q/26457062
type: Answer

http://stackoverflow.com/a/26404395
answers question: http://stackoverflow.com/q/26404343
has body: I assume you want to get it in the code to check something right? You can use filtering from maven that will inject the value in the source code, similar to the filtering option http://mojo.codehaus.org/templating-maven-plugin/
has comment: http://stackoverflow.com/comment/41458457
score: 0
has comment: http://stackoverflow.com/comment/41460139
type: Answer
has comment: http://stackoverflow.com/comment/41457653
has comment: http://stackoverflow.com/comment/41457916

http://stackoverflow.com/q/26477685
has answer: http://stackoverflow.com/a/26477872
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Button click not launching intent?
has body: Whenever i click on a button with a set intent, and nothing happens. I've tried and tried and i can't figure out what is wrong with my code. The button: Button viewMedsButton = (Button)findViewById(R.id.viewMedicationButton); viewMedsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Intent to open view meds Intent medView = new Intent("android.intent.action.VIEWMEDS"); startActivity(medView); } }); The intent in the manifest: &lt;activity android:theme="@style/MainTheme" android:name=".viewMeds" android:label="@string/app_name" android:parentActivityName=".MainActivity" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEWMEDS" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; And viewMeds.java: package ibettergetagoodgradeforthisorillbepissed.sciencefair.beta.mmmeds.com.mmmeds; import android.app.ActionBar; import android.app.Activity; import android.app.Fragment; import android.app.FragmentManager; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.support.v4.widget.DrawerLayout; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class viewMeds extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_meds); String SDRoot = Environment.getExternalStorageDirectory().getPath(); final File output = getFileStreamPath("output.txt"); //Get the text file File file = new File(SDRoot,"output.txt"); //Read text from file StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader…

http://stackoverflow.com/q/26401568
linked to: http://stackoverflow.com/q/7628103
has body: my data file and hence my stage table in hive, has time in the following format 1/1/2013 5:27:35 PM. I want to load this data into another table that has time in the TIMESTAMP data type format. So basically the above format needs to be transformed to 2013-01-01 17:27:35. How to do this ?
has title: converting string to timestamp hive
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41453057
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41452905
type: UnansweredQuestion
downvote count: 2
tagged with: timestamp
has answer: http://stackoverflow.com/a/26401676
tagged with: java
type: Question

http://stackoverflow.com/q/26489171
tagged with: sql
has comment: http://stackoverflow.com/comment/41613590
answer count: 1
has comment: http://stackoverflow.com/comment/41612839
tagged with: ms-access
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26492874
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41613194
has comment: http://stackoverflow.com/comment/41615150
type: Question
has comment: http://stackoverflow.com/comment/41615058
has body: I have a table in ms access 2007.The table contains 10 rows .The table contains a date column. There are rows having date as-21-07-2014,25-07-2014.. When selecting i want to get 25-07-2014.That is only one row on that month on that year.. I have to select the rows that have different month/year part in date field.That is,when selecting the rows,I want to select single row from multiple rows based on the month and year part of date_field. Please help me..I have tried different queries..But nothing worked. eg: SELECT DISTINCT (DATE_FIELD),ID_PK_FIELD,AMOUNT_FIELD,DATE_FIELD FROM TBL_MONTH WHERE MON__STRE__FK= ? ORDER BY DATE_FIELD DESC
tagged with: database
has comment: http://stackoverflow.com/comment/41612642
has title: select rows based on month part in ms access database
score: 0

http://stackoverflow.com/comment/41451769
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26400923
type: Comment
has text: Sounds like the job for `==`-Man! `ob1 == ob2` will return true if and only if the two references point to the same object.

http://stackoverflow.com/comment/41565211
comment on: http://stackoverflow.com/q/26463343
has text: Please post code that you may have tried. In order to handle JSON in java, as [Thusitha Thilina Dayaratne](http://stackoverflow.com/users/2125973/thusitha-thilina-dayaratne) pointed out there a lot of JSON libraries; Most of these libraries depend on you creating a POJO class. You may want to look at GSON library.
type: QuestionComment
type: Comment
score: 2

applet
tags question: http://stackoverflow.com/q/26399782
tags question: http://stackoverflow.com/q/26466175
tags question: http://stackoverflow.com/q/26477999
tags question: http://stackoverflow.com/q/26377241
tags question: http://stackoverflow.com/q/26399771
tags question: http://stackoverflow.com/q/26494672
tags question: http://stackoverflow.com/q/26504109
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/26388933
tags question: http://stackoverflow.com/q/26407417
tags question: http://stackoverflow.com/q/26500817
tags question: http://stackoverflow.com/q/26406824
tags question: http://stackoverflow.com/q/26509053
tags question: http://stackoverflow.com/q/26497210
tags question: http://stackoverflow.com/q/26433285
tags question: http://stackoverflow.com/q/26507332
tags question: http://stackoverflow.com/q/26392664
tags question: http://stackoverflow.com/q/26489349
tags question: http://stackoverflow.com/q/26512430
tags question: http://stackoverflow.com/q/26378732
tags question: http://stackoverflow.com/q/26433987
tags question: http://stackoverflow.com/q/26491937

http://stackoverflow.com/a/53980356
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: RE: "Am I missing a simpler way, like method "connection.setCA(String caCertPath)" ?" I guess it depends on the java class you use to implement the application. But as far as my knowledge goes the answer is: no. You indeed need to first store the certificate in a keystore to be consumed by the class you are using. I am not aware of any class that would work the way you expect the certificates to be consumed, but I guess you could just write that class to sit on top of the class you don't like.
type: Answer
accepted answer of: http://stackoverflow.com/q/26355442
answers question: http://stackoverflow.com/q/26355442

http://stackoverflow.com/a/36288606
type: Answer
has body: You can use the library SectionedRecyclerViewAdapter to group your items in sections and add a header to each section, like on the image below: First you create your section class: class MySection extends StatelessSection { String title; List&lt;String&gt; list; public MySection(String title, List&lt;String&gt; list) { // call constructor with layout resources for this Section header, footer and items super(R.layout.section_header, R.layout.section_item); this.title = title; this.list = list; } @Override public int getContentItemsTotal() { return list.size(); // number of items of this section } @Override public RecyclerView.ViewHolder getItemViewHolder(View view) { // return a custom instance of ViewHolder for the items of this section return new MyItemViewHolder(view); } @Override public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) { MyItemViewHolder itemHolder = (MyItemViewHolder) holder; // bind your view here itemHolder.tvItem.setText(list.get(position)); } @Override public RecyclerView.ViewHolder getHeaderViewHolder(View view) { return new SimpleHeaderViewHolder(view); } @Override public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) { MyHeaderViewHolder headerHolder = (MyHeaderViewHolder) holder; // bind your header view here headerHolder.tvItem.setText(title); } } Then you set up the RecyclerView with your sections and change the SpanSize of the headers with a GridLayoutManager: // Create an instance of SectionedRecyclerViewAdapter SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter(); // Create your sections with the list of data MySection section1 = new MySection("My Section 1 title", dataList1); MySection section2 = new MySection("My Section 2 title", dataList2); // Add your Sections to the adapter sectionAdapter.addSection(section1); sectionAdapter.addSection(section2); // Set up a GridLayoutManager to change the SpanSize of the header GridLayoutManager glm = new GridLayoutManager(getCont…
upvote count: 3
score: 1
answers question: http://stackoverflow.com/q/26448717
downvote count: 2

http://stackoverflow.com/a/26512972
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26512835
upvote count: 1
has body: Yes they are kind of Observer pattern, or a specialization of this pattern.. However i found in a blog about Android-useful design patterns and they are mentioning Adapter Pattern as a separate thing.
type: Answer

http://stackoverflow.com/q/26369227
has comment: http://stackoverflow.com/comment/41395906
has title: Java FX - Removing a node if the user unchecks a checkbox
answer count: 0
tagged with: java
tagged with: javafx
type: Question
has body: I am making a GUI using JavaFx, I want a name field to appear if the check box is checked and disappear if it is not checked. Here is the code I wrote test1.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { Boolean b = test1.isSelected(); log(b); Label label1 = new Label("Name:"); TextField textField = new TextField(); HBox hb = new HBox(); if (test1.isSelected()) { hb.getChildren().addAll(label1, textField); hb.setSpacing(10); grid.add(hb, 3, 3); } else { **hb.getChildren().removeAll(label1 , textField);** &lt;---look at this! } } }); I am removing the node if it is unchecked but it doesn't execute it accordingly. What am I doing wrong? Incase it is required, here is how I execute my scene. Scene scene = new Scene(grid, 500, 500); primaryStage.setScene(scene); primaryStage.show();
has comment: http://stackoverflow.com/comment/41395869
score: 0
has comment: http://stackoverflow.com/comment/41395957
type: UnansweredQuestion

http://stackoverflow.com/q/26356224
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/41373363
has comment: http://stackoverflow.com/comment/41371701
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41371684
has comment: http://stackoverflow.com/comment/41372164
has comment: http://stackoverflow.com/comment/41371414
has title: DataSource Connection Pool jdbc issue
tagged with: jdbc
has body: I have the next problem. I have searched through the Internet and tried to find the solution and also tried many different tutorials to set up a project with DataSource Connection Pool to MySQL. So here are my mysql connection settings: private static final String DBNAME = "picturizedb"; private static final String DB_USERNAME = "root"; private static final String DB_PASSWORD = ""; private static final String MYSQL_DB_URL = "jdbc:mysql://localhost:3306/picturizedb"; public static DataSource getMySQLDataSource() { MysqlDataSource mysqlDS = null; mysqlDS = new MysqlDataSource(); mysqlDS.setURL(MYSQL_DB_URL); mysqlDS.setUser(DB_USERNAME); mysqlDS.setPassword(DB_PASSWORD); return mysqlDS; } And here is the error I am getting exactly on the line dataSource.getConnection(); [2014-10-14 08:58:47,544] Artifact Instagrim:war: Artifact is deployed successfully [2014-10-14 08:58:47,544] Artifact Instagrim:war: Deploy took 17,390 milliseconds Unable to validate user / password in database com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:729) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Con…
answer count: 0
score: 0

http://stackoverflow.com/q/26463728
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26463928
has body: I am developing Spring mvc application. I have a controller in which I am injecting more than 10 Services. I am exposing 10+ url from this controller and at a time I am using one or two service objects in each method. I was thinking of 2 approaches. Directly inject all services using @Autowired. Fetch Service from ApplicationContext at runtime whenever required. Please suggest me which approach is better or both approach are equal in terms of memory usage and time Thanks
answer count: 1
tagged with: applicationcontext
favorite count: 0
has title: Which approach should I use to inject 10+ services in Spring controller?
tagged with: spring
tagged with: autowired
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26463928
tagged with: java

http://stackoverflow.com/q/26485492
tagged with: cassandra
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41605568
tagged with: windows
has title: How restrict java virtual memory usage (not virtual machine memory usage)?
tagged with: memory-management
tagged with: java
has answer: http://stackoverflow.com/a/26485573
type: Question
tagged with: memory
score: 0
linked to: http://stackoverflow.com/q/192876
answer count: 1
has body: I have some java application on windows 7 x64 and pass a parameters to it: -Xms256m -Xmx256m Then I run Process explorer and see columns (values) on java process: Private bytes (414 620K), Working Set (328 876K) and Virtual Size (1 890 352K). It is easy to see that after I specify max and min heap size java.exe process allocates more memory in virtual size. And this influence on Page file size on windows to grow. So how to restrict java virtual memory usage? P.S. If you want to reproduce this situaltion you can download cassandra, edit bin\cassandra.bat with -Xms256m -Xmx256m and after start you can see a difference between heap memory size and virtual. However cassandra is just a java program, so the question about how to run java program, not how to run cassandra.
duplicate of: http://stackoverflow.com/q/192876

http://stackoverflow.com/comment/41583578
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26395975
type: Comment
has text: When you have more the two class types to return, I would start using a switch statement or if statement as it will make it easier to manage. When the values are read from the file, they are parsed to double automatically...

http://stackoverflow.com/comment/41899219
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26461736
type: Comment
has text: Two things - try to import the CA certificate into your keystore using `keytool -import -keystore .\jre\lib\security\cacerts -file path\to\ca.crt -trustcacerts` and if that does not help, try to use your own keystore using `Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() );` and `System.setProperty( "javax.net.ssl.trustStore", <your-ldap-keystore> );`

http://stackoverflow.com/comment/41636952
type: QuestionComment
has text: Have a look into buffer classes in `nio` package. Possible helpful methods could be `flip` and `compact`.
comment on: http://stackoverflow.com/q/26502379
score: 0
type: Comment

http://stackoverflow.com/q/26372738
tagged with: string
has comment: http://stackoverflow.com/comment/41402404
has comment: http://stackoverflow.com/comment/41402455
has title: StringIndexOutOfBoundsException on very large string
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41402538
has body: I am trying to parse a String that is the HTML from a page from my web browser application, for the HTML that is the data that I am trying to retrieve. (In short, I am doing some web-scraping of Google Images results.) My function, find(), seems to work really well for decently-sized Strings, but the minute that it encounters the full String that is the HTML of the code that I am trying to parse, it complains of a StringIndexOutOfBoundsException. Here is my find() function, and the function that I am trying to call it from: find(): // helper functions public static int find(String stringToFind, int startPos, String str) throws NullPointerException, IllegalArgumentException { // make sure that neither argument is null and not an empty String if ((stringToFind == null) || (str == null)) throw new NullPointerException("null arguments are not allowed."); if ((stringToFind.equals("")) || (str.equals(""))) throw new IllegalArgumentException("String arguments must be non-empty."); int position = startPos; // while we are not at the end of the String and the stringToFind is not found while (position != str.length()) { // find the first character in the string position = str.indexOf(stringToFind.charAt(0), position+1); // if found if (position != -1) { int j = 0; // search the other characters in str for the other characters in stringToFind // while there is a character in str that matches its respective character in // stringToFind and we are not at the end of either str,stringToFind int firstCharacterPosition = -1; while ((str.charAt(position) == stringToFind.charAt(j)) &amp;&amp; ((position &lt; str.length()) &amp;&amp; (j &lt; stringToFind.length()))) { if (firstCharacterPosition == -1) firstCharacterPosition = position; // compare the next character in str with the next character in stringToFind // if the characters match and the characters being matched is the last // character in stringToFind if ((str.charAt(++position) == stringToFind.charAt(++j)) &amp;&amp; (j == st…
favorite count: 0
accepted answer: http://stackoverflow.com/a/26373295
has comment: http://stackoverflow.com/comment/41402172
upvote count: 2
has comment: http://stackoverflow.com/comment/41402345
has comment: http://stackoverflow.com/comment/41402425
has answer: http://stackoverflow.com/a/26373295
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41402270
has comment: http://stackoverflow.com/comment/41402255
tagged with: java
has comment: http://stackoverflow.com/comment/41402386
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26469621
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41579683
possible better answer: http://stackoverflow.com/a/26469746
has title: JFrame opens over and over again
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26469694
tagged with: java
has answer: http://stackoverflow.com/a/26469752
type: Question
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/26469746
accepted answer: http://stackoverflow.com/a/26469694
has body: I'm having troubles with this program. Everything works, but the program keeps opening the JFrame over and over again (and obviously, I only want just one JFrame to be opened). What is wrong with my code? Thank you in advance, Stefan import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ColoredWords { JFrame frame; JPanel controlPanel, wordsPanel; JButton match, nomatch; ColoredWords() { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { frame = new JFrame("Colored Words Experiment"); wordsPanel = new JPanel(); controlPanel = new JPanel(); frame.setLayout(new BorderLayout()); frame.add(wordsPanel, BorderLayout.NORTH); frame.add(controlPanel, BorderLayout.SOUTH); frame.setSize(1000, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); match = new JButton("Matching"); nomatch = new JButton("Non-Matching"); controlPanel.add(match, BorderLayout.WEST); controlPanel.add(nomatch, BorderLayout.CENTER); ClicksReporter clicksreporter; clicksreporter = new ClicksReporter(); match.addActionListener(clicksreporter); nomatch.addActionListener(clicksreporter); } } ); } class ClicksReporter extends ColoredWords implements ActionListener { Labeling labeling = new Labeling(); public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Matching")) { wordsPanel.add(labeling); } else if (e.getActionCommand().equals("Non-Matching")) { wordsPanel.add(labeling); } } } public static void main(String[] arg) { new ColoredWords(); } } class Labeling extends JPanel { JLabel[] labelsList = new JLabel[20]; int i = 0; public Labeling() { while (i &lt; 5) { labelsList[i] = new JLabel("black"); setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10)); labelsList[i].setOpaque(true); labelsList[i].setBackground(Color.white); add(labelsList[i]); i++; } } }

http://stackoverflow.com/q/26391181
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41438534
has body: I have a thread safe class like the following public class ThreadedClass extends Thread { public ThreadedClass() { // Some code listener(); } public void run() { // Some code } public void listener() { // Code that's checking for messages from a server String test = // lots of stuff here } } This is being executed in a test class like the following public class Test { public static void main(String[] args) { ThreadedClass t1 = new t1(); t1.start(); } } The problem is, I want to have a callback from the thread that's running, so when listener() get's a message I can notify Test(), check the message, and perform some action. To do this I wrote an interface and added the following to listener() this.callback.messageRecieved(message); This executes, but terminates the thread. Thoughts? Thanks!
has comment: http://stackoverflow.com/comment/41435606
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41435575
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41435888
has title: Thread safe class is being terminated
has answer: http://stackoverflow.com/a/26391294
tagged with: java

http://stackoverflow.com/q/26411117
has title: App not loading. Never ending Loop in oncreate method in initial activity
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41471053
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/41470799
has comment: http://stackoverflow.com/comment/41470763
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41471025
upvote count: 1
score: 1
tagged with: java
has body: My problem is since a recent change, my app is not loading anymore. I have no exception, app doesn't crash, just not loading. When I debug, I see my app is calling in loop onCreate.... I don't know why. I've recently made a change in my SQLite management. MyApplication.java public class MyApplication extends Application { public static DbHandler handler; .... @Override public void onCreate() { super.onCreate(); handler = new DbHandler(this); } } Class DbHandler(this) public class DbHandler extends SQLiteOpenHelper { public static final int DATABASE_VERSION = 2; public static final String DATABASE_NAME = "myapp.db"; public DbHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); DatabaseManager.initializeInstance(this); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { db.execSQL("DROP TABLE IF EXISTS " + PdvHandler.TABLE_SHOP); db.execSQL("DROP TABLE IF EXISTS " + PdvHandler.TABLE_PROJECT); // db.execSQL("DROP TABLE IF EXISTS " + TABLE_CAPTURE_INFO); db.execSQL(PdvHandler.CREATE_PDV_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { int upgradeTo = oldVersion + 1; while (upgradeTo &lt;= newVersion) { switch (upgradeTo) { case 2: try{ db.execSQL(AlertaHandler.DROP_ALERT); db.execSQL(AlertaHandler.CREATE_ALERT); }catch (Exception e) { Crashlytics.logException(e); } break; } upgradeTo++; } } } Finally DatabaseManager.java public class DatabaseManager { private AtomicInteger mOpenCounter = new AtomicInteger(); private static DatabaseManager instance; private static SQLiteOpenHelper mDatabaseHelper; private SQLiteDatabase mDatabase; public static synchronized void initializeInstance(SQLiteOpenHelper helper) { if (instance == null) { instance = new DatabaseManager(); } mDatabaseHelper = helper; } public static synchronized DatabaseManager getInstance() { if (instance == null) { throw new IllegalStateException( DatabaseManager.class.getSimpleName() + " is not initialized, call ini…

http://stackoverflow.com/a/26416414
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26416378
has body: Your second print doesn't format the double you've parsed. // System.out.println(nf.parse(s)); System.out.println(nf.format(nf.parse(s))); // &lt;-- 987.12346 To get the output you asked for, you can add a call to NumberFormat#setRoundingMode(RoundingMode) - something like nf.setMaximumFractionDigits(5); nf.setRoundingMode(RoundingMode.DOWN);
accepted answer of: http://stackoverflow.com/q/26416378
upvote count: 2

http://stackoverflow.com/comment/41663111
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26512315
has text: I improved the regex based on the answer by @Pshemo (thank you), take note of the edit
score: 0

http://stackoverflow.com/comment/41593276
comment on: http://stackoverflow.com/a/26456826
score: 0
type: Comment
type: AnswerComment
has text: I didn't think the enclosing class would add much, but I'll include it for clarity. The private members were accessible because they were part of an inner class, but I'll add getters as well to make it more general.

http://stackoverflow.com/q/26429695
has body: How do I send an email using the Java Mail API that contains large attachments (~25 MB)? The attachments are files stored online with our cloud storage provider (Google Cloud Storage). The API for the service returns an InputStream object or a ReadableByteChannel object for each file. I can't use ByteArrayDataSource to create a MimeBodyPart because it creates a copy of the entire file that resides in the memory, and we get a OutOfMemoryError. If its a physical file, we can create a FileDataSource object and attach to the email. But can we do it with an InputStream object? I can't increase the heap size because increasing it to 25MB seems like a very bad idea. If you have any other ideas too, please let me know. We're working on the Google App Engine platform.
has comment: http://stackoverflow.com/comment/41504432
tagged with: java
tagged with: inputstream
tagged with: google-cloud-storage
has answer: http://stackoverflow.com/a/26429877
type: Question
tagged with: email-attachments
has title: How to attach large files (stored online) to an email without copying the entire file to memory
score: 0
tagged with: jakarta-mail
answer count: 2
has comment: http://stackoverflow.com/comment/41504489
has answer: http://stackoverflow.com/a/26429858
type: UnansweredQuestion

http://stackoverflow.com/q/26488999
tagged with: mysql
has title: How to store HTML text in sql database using Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26489419
accepted answer: http://stackoverflow.com/a/26489419
tagged with: sql-server
has comment: http://stackoverflow.com/comment/41612716
has comment: http://stackoverflow.com/comment/41625151
has comment: http://stackoverflow.com/comment/41625090
type: Question
has body: I am trying to store the text generated from Java FX html editor to sql database. But I am recieving an SQL error. I tried to use varchar(1000), varchar(max) and text data types. Error: Java FX HTML Editor Text Generated from Editor Line 1 Line 2 Code: public String insertDept(Department dept){ String query = "INSERT INTO " + TABLE_NAME + "VALUES(" +"'"+dept.getName()+"'," + "'"+dept.getEmail()+"'" + ")"; return query; }
tagged with: sql
tagged with: javafx-2
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41612025
tagged with: java

http://stackoverflow.com/comment/41619252
has text: Is it annotated with `javax.persistence.Entity`?
comment on: http://stackoverflow.com/q/26492183
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/131500487
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26430692
has text: Does not work. Eclipse 2022-09 (4.25.0), openjdk 17, openjdk 17 docs
type: AnswerComment

http://stackoverflow.com/comment/41582546
comment on: http://stackoverflow.com/q/26458563
has text: @aegean there's the logcat info
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41409412
type: Comment
type: QuestionComment
score: 6
has text: Your scanner variable is called `scan`, not `input`.
comment on: http://stackoverflow.com/q/26376968

http://stackoverflow.com/a/26432508
type: Answer
has body: Log4j 2 Configuration : <?xml version="1.0" encoding="UTF-8"?> <!-- No need to set system property "Log4jContextSelector" to any value when using or <asyncRoot>. --> %d %p %class{1.} [%t] %location %m %ex%n <AppenderRef ref="RandomAccessFile"/> <AppenderRef ref="RandomAccessFile"/> Above configuration taken from Mixing Synchronous and Asynchronous Loggers You can add Exception in log file as :- Logger logger = LogManager.getLogger(Your_Class_Name.class); try { // do something } catch (Exception e) { StringWriter stack = new StringWriter(); e.printStackTrace(new PrintWriter(stack)); logger.fatal(stack.toString()); };
score: 0
answers question: http://stackoverflow.com/q/26428021

http://stackoverflow.com/q/26472117
downvote count: 1
favorite count: 0
answer count: 5
tagged with: android
has title: Cannot refer to local variable
upvote count: 0
has comment: http://stackoverflow.com/comment/41582106
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26472316
has answer: http://stackoverflow.com/a/26472255
has answer: http://stackoverflow.com/a/26472602
type: Question
has comment: http://stackoverflow.com/comment/41581660
has answer: http://stackoverflow.com/a/26472185
has answer: http://stackoverflow.com/a/26472744
score: -1
has body: I'm new to the world of Android programming and I want to, when a button is clicked, to do stuff. Here's what I did so far: public class MainActivity extends Activity { protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Spinner s1,s2,s3,s4,s5,s6,s7; TextView txt3,txt4,txt5,txt6,txt7,txt8,txt9; EditText ed1; s7 = (Spinner) findViewById(R.id.spinner7); s1 = (Spinner) findViewById(R.id.spinner1); s2 = (Spinner) findViewById(R.id.spinner2); s3 = (Spinner) findViewById(R.id.spinner3); s4 = (Spinner) findViewById(R.id.spinner4); s5 = (Spinner) findViewById(R.id.spinner5); s6 = (Spinner) findViewById(R.id.spinner6); txt4 = (TextView) findViewById(R.id.textView4); txt3 = (TextView) findViewById(R.id.textView3); txt5 = (TextView) findViewById(R.id.textView5); txt6 = (TextView) findViewById(R.id.textView6); txt7 = (TextView) findViewById(R.id.textView7); txt8 = (TextView) findViewById(R.id.textView8); txt9 = (TextView) findViewById(R.id.textView9); ed1 = (EditText) findViewById(R.id.editText1); s7.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView&lt;?&gt; parent, View view, int position, long id) { String val = s7.getSelectedItem().toString(); txt4.setText(val); } public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }); s2.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView&lt;?&gt; parent, View view, int position, long id) { String val2 = s2.getSelectedItem().toString(); txt5.setText(val2); } public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }); s3.setOnItemSelectedListener( new OnItemSelectedListener() { public void onItemSelected( AdapterView&lt;?&gt; parent, View view, int position, long id) { String val3 = s3.getSelectedItem().toString(); txt6.setText(val3); } public …
has comment: http://stackoverflow.com/comment/41582208

arrays
tags question: http://stackoverflow.com/q/26510299
tags question: http://stackoverflow.com/q/26479656
tags question: http://stackoverflow.com/q/26415631
tags question: http://stackoverflow.com/q/26417069
tags question: http://stackoverflow.com/q/26477340
tags question: http://stackoverflow.com/q/26446132
tags question: http://stackoverflow.com/q/26473400
tags question: http://stackoverflow.com/q/26508137
tags question: http://stackoverflow.com/q/26496752
tags question: http://stackoverflow.com/q/26491767
tags question: http://stackoverflow.com/q/26500578
tags question: http://stackoverflow.com/q/26394183
tags question: http://stackoverflow.com/q/26401076
tags question: http://stackoverflow.com/q/26441619
type: Tag
tags question: http://stackoverflow.com/q/26394957
tags question: http://stackoverflow.com/q/26357842
tags question: http://stackoverflow.com/q/26358850
tags question: http://stackoverflow.com/q/26463545
tags question: http://stackoverflow.com/q/26467948
tags question: http://stackoverflow.com/q/26452518
tags question: http://stackoverflow.com/q/26512319
tags question: http://stackoverflow.com/q/26457982
tags question: http://stackoverflow.com/q/26440658
tags question: http://stackoverflow.com/q/26458664
tags question: http://stackoverflow.com/q/26368081
tags question: http://stackoverflow.com/q/26492690
tags question: http://stackoverflow.com/q/26436182
tags question: http://stackoverflow.com/q/26450316
tags question: http://stackoverflow.com/q/26450019
tags question: http://stackoverflow.com/q/26405495
tags question: http://stackoverflow.com/q/26503855
tags question: http://stackoverflow.com/q/26364459
tags question: http://stackoverflow.com/q/26484177
tags question: http://stackoverflow.com/q/26356521
tags question: http://stackoverflow.com/q/26478228
tags question: http://stackoverflow.com/q/26437149
tags question: http://stackoverflow.com/q/26457142
tags question: http://stackoverflow.com/q/26446597
tags question: http://stackoverflow.com/q/26356503
tags question: http://stackoverflow.com/q/26356327
tags question: http://stackoverflow.com/q/26499611
tags question: http://stackoverflow.com/q/26512064
tags question: http://stackoverflow.com/q/26446263
tags question: http://stackoverflow.com/q/26357805
tags question: http://stackoverflow.com/q/26445384
tags question: http://stackoverflow.com/q/26498714
tags question: http://stackoverflow.com/q/26471266
tags question: http://stackoverflow.com/q/26474958
tags question: http://stackoverflow.com/q/26416770
tags question: http://stackoverflow.com/q/26503887
tags question: http://stackoverflow.com/q/26396469
tags question: http://stackoverflow.com/q/26430688
tags question: http://stackoverflow.com/q/26447429
tags question: http://stackoverflow.com/q/26444049
tags question: http://stackoverflow.com/q/26398195
tags question: http://stackoverflow.com/q/26375911
tags question: http://stackoverflow.com/q/26452051
tags question: http://stackoverflow.com/q/26372451
tags question: http://stackoverflow.com/q/26380983
tags question: http://stackoverflow.com/q/26502593
tags question: http://stackoverflow.com/q/26495792
tags question: http://stackoverflow.com/q/26436276
tags question: http://stackoverflow.com/q/26430738
tags question: http://stackoverflow.com/q/26404678
tags question: http://stackoverflow.com/q/26454902
tags question: http://stackoverflow.com/q/26511903
tags question: http://stackoverflow.com/q/26441604
tags question: http://stackoverflow.com/q/26492069
tags question: http://stackoverflow.com/q/26511023
tags question: http://stackoverflow.com/q/26412052
tags question: http://stackoverflow.com/q/26508058
tags question: http://stackoverflow.com/q/26373712
tags question: http://stackoverflow.com/q/26444354
tags question: http://stackoverflow.com/q/26463343
tags question: http://stackoverflow.com/q/26501614
tags question: http://stackoverflow.com/q/26446465
tags question: http://stackoverflow.com/q/26432607
tags question: http://stackoverflow.com/q/26477266
tags question: http://stackoverflow.com/q/26500275

http://stackoverflow.com/q/26357458
answer count: 2
has comment: http://stackoverflow.com/comment/41374329
has body: I have one to many mapping in my Pojo classes. A shop has a branch and a branch has many shops Here's Shop's Code: @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name="Shop") public class Shop { @XmlID private String name; @XmlIDREF @XmlElement(name="ShopBranch",type=Branch.class) private Branch branch; //Getter Setter } Below is Branch Code: @XmlAccessorType(XmlAccessType.FIELD) public class Branch { @XmlID private String name; private String address; @XmlIDREF @XmlElement(nillable=false,required=true) private List<Shop> shops; //Getter and Setters } I'm publishing a webservice with some basic methods. and my wsimport is generating Branch class as below @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "branch", propOrder = { "branchName", "address", "branchShop" }) public class Branch { @XmlElement(name = "BranchName") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @XmlSchemaType(name = "ID") protected String branchName; protected String address; @XmlElementRef(name = "BranchShop", type = JAXBElement.class) protected List<JAXBElement<Object>> branchShop; //Getter-Setter } I have no idea why it is List<JAXBElement<Object>> and not List<JAXBElement<Shop>>. But anyway. I have a method which returns all branches and that is working fine. When i extract branchShop from branch's instance i'm getting correct size for branchShop list but for all of the items in list getValue is returning NULL. Below is brief code: PencilCatalog service= new PencilCatalog(); com.pencilhouse.webservices.PencilService port=service.getPencilCatalogPort(); ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, Constant.PENCIL_SERVICE); List<Branch> branches= port.getAllBranches(); for(Branch b:branches) { System.out.println("******************Branch:"+b.getBranchName()+" "+b.getAddress()+"******************"); JAXBElement<Object>o=b.getBranchShop().get(0); System.out.println(o+"Value"+o.getScope()+" "+o.getValue()); } o/p ***************…
downvote count: 0
accepted answer: http://stackoverflow.com/a/26515995
has comment: http://stackoverflow.com/comment/41376484
has title: JAXBElement.getValue() is returning null
favorite count: 0
has comment: http://stackoverflow.com/comment/41375277
score: 3
has comment: http://stackoverflow.com/comment/41566664
possible better answer: http://stackoverflow.com/a/26502150
has answer: http://stackoverflow.com/a/26502150
upvote count: 3
tagged with: web-services
has answer: http://stackoverflow.com/a/26515995
type: AnsweredQuestion
tagged with: java
tagged with: wsimport
tagged with: jaxb
has comment: http://stackoverflow.com/comment/41594687
type: Question
has comment: http://stackoverflow.com/comment/41374213

http://stackoverflow.com/q/26371907
has title: Parameterized types in Linked Lists
answer count: 1
tagged with: generics
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
type: Question
score: 0
has body: I have a data structure and I need to compare data to previous elements that occurred at the same time. Something like: dataStruct{ long startTime; long endTime; long data; } part of my implementation involves adding these elements to a linked list and comparing data between nodes that exist at overlapping times. Do I need a parameterized type or can I add dataStructures to the list and access their members by the dot operator. Something like: dataStructure data = new DataStructure(time, time2, data); dataStructure moreData = new DataStructure(time3, time4, data2); LinkedList list = new LinkedList(); list.add(data); if(list.peek().endTime &gt; moreData.startTime){ moreData.data = list.peek().data + moreData.data; list.pop(); }
has answer: http://stackoverflow.com/a/26371961
accepted answer: http://stackoverflow.com/a/26371961

http://stackoverflow.com/comment/41531190
score: 2
type: Comment
has text: Sorry to be a prude, but we do try to avoid [vulgar language](http://stackoverflow.com/help/be-nice) here...
type: QuestionComment
comment on: http://stackoverflow.com/q/26444223

http://stackoverflow.com/q/26372949
type: AnsweredQuestion
has body: I got these FFT algorithm in java here http://www.ee.columbia.edu/~ronw/code/MEAPsoft/doc/html/FFT_8java-source.html and another one here http://introcs.cs.princeton.edu/java/97data/FFT.java.html However, I will like to use them in analysing mp3 file in other to plot some graphical representation of them probably in sin wave among others graphical representation. My question is how can I pass my mp3 files to any of these algorithm to compute my fft for me. All I know is how to retrieve my mp3 file as byte array. However, AudioInputStream won't work in my use case as I have being such implementation. Best Regards
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26416624
tagged with: codenameone
downvote count: 0
answer count: 1
score: 1
has title: analysing fft of mp3 file in java
favorite count: 0
accepted answer: http://stackoverflow.com/a/26416624

http://stackoverflow.com/comment/41626893
score: 0
has text: Please show us the code that calls `run()` and where `println()` is defined.
comment on: http://stackoverflow.com/q/26496892
type: Comment
type: QuestionComment

authentication
tags question: http://stackoverflow.com/q/26386663
tags question: http://stackoverflow.com/q/26391954
tags question: http://stackoverflow.com/q/26389358
tags question: http://stackoverflow.com/q/26461140
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/26378407
tags question: http://stackoverflow.com/q/26429555
tags question: http://stackoverflow.com/q/26387186
tags question: http://stackoverflow.com/q/26362353
tags question: http://stackoverflow.com/q/26433053
tags question: http://stackoverflow.com/q/26477965
tags question: http://stackoverflow.com/q/26380778
tags question: http://stackoverflow.com/q/26466215
tags question: http://stackoverflow.com/q/26393864
tags question: http://stackoverflow.com/q/26438230
tags question: http://stackoverflow.com/q/26390854

http://stackoverflow.com/q/26367565
tagged with: vaadin6
has comment: http://stackoverflow.com/comment/41494493
type: Question
accepted answer: http://stackoverflow.com/a/26462237
has comment: http://stackoverflow.com/comment/41563238
downvote count: 0
has comment: http://stackoverflow.com/comment/41470538
answer count: 1
linked to: http://stackoverflow.com/q/26413325
favorite count: 0
has comment: http://stackoverflow.com/comment/41562345
has title: How to display images in a Vaadin 6 table?
upvote count: 2
has comment: http://stackoverflow.com/comment/41525953
has comment: http://stackoverflow.com/comment/41395190
has body: I have a Vaadin 6 application, in which I want to display several images in a table. To do this, I define following data model. private BeanContainer&lt;byte[],UserProductImageBean&gt; productImageData; productImageData = new BeanContainer&lt;byte[], UserProductImageBean&gt;(UserProductImageBean.class); productImageData.setBeanIdProperty("userProductImageId"); Table is defined as follows. productImagesTable = new Table("Product images", productImageData); productImagesTable.setItemIconPropertyId("imageResource"); I get the image data from the server in form of UserProductImage instances: public class UserProductImage { private byte[] userProductImageId; private byte[] imageData; private byte[] userProductId; private String fileName; private String creatorEmail; private String mimeType; public byte[] getImageData() { return imageData; } public void setImageData(final byte[] aImageData) { imageData = aImageData; } public byte[] getUserProductId() { return userProductId; } public void setUserProductId(final byte[] aUserProductId) { userProductId = aUserProductId; } public String getFileName() { return fileName; } public void setFileName(final String aFileName) { fileName = aFileName; } public String getCreatorEmail() { return creatorEmail; } public void setCreatorEmail(final String aCreatorEmail) { creatorEmail = aCreatorEmail; } public String getMimeType() { return mimeType; } public void setMimeType(final String aMimeType) { mimeType = aMimeType; } public byte[] getUserProductImageId() { return userProductImageId; } public void setUserProductImageId(final byte[] aUserProductImageId) { userProductImageId = aUserProductImageId; } } When I update the table data, I convert UserProductImage instances into UserProductImageBean: final List&lt;UserProductImage&gt; userProductImages = response.getUserImages(); for (final UserProductImage curImage : userProductImages) { productImageData.addBean(UserProductImageBean.create(curImage, My.getInstance())); } UserProductImageBean ad…
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41497067
has comment: http://stackoverflow.com/comment/41494441
tagged with: java
has comment: http://stackoverflow.com/comment/41561937
has answer: http://stackoverflow.com/a/26462237
tagged with: vaadin

http://stackoverflow.com/comment/41631302
has text: @Holger There are a couple rules being applied here. One, packages are not split across modules. Two, there should be no circular dependencies among modules. The module graph in [JEP 200](http://openjdk.java.net/jeps/200) shows that the `java.desktop` module (which contains beans) depends on the `java.logging` module. The removed APIs created a dependency in the opposite direction, which would have introduced a circularity. Similarly, `Pack200` (in package `java.util.jar`) is part of the `java.base` module, and that certainly must not depend on `java.desktop`.
score: 1
comment on: http://stackoverflow.com/a/26415589
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26438830
possible better answer: http://stackoverflow.com/a/26438980
downvote count: 0
has answer: http://stackoverflow.com/a/26438980
has answer: http://stackoverflow.com/a/26439003
favorite count: 0
score: 3
has comment: http://stackoverflow.com/comment/41521618
has comment: http://stackoverflow.com/comment/41521617
upvote count: 3
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26439003
has comment: http://stackoverflow.com/comment/41521654
has comment: http://stackoverflow.com/comment/41521630
type: AnsweredQuestion
tagged with: java
has body: I just found out what threads are (at least I think I know what they are :s ). I'm programming in java and I created a function that generates Strings. Every time the methode finds a string it calls the update methode and passes the founded string to it. (the stringfinder methode is a recurssive methode). In the update() methode I want to process that string on another thread. But I don't know how to do this. At the moment it looks like this private void update(String input){ new ProcessThread(input).createThreadAndRun(); } This works. But that isn't how it's done I guess, since the update method is called a few thousand times per second. And every time I create a new thread. The createThreadAndRun methode looks like this: @Override public void createThreadAndRun() { Thread thread=new Thread(this,"processThread"); thread.start(); } But for the moment it is still spamming ProcessThreads, because every time I find a string , I create a new thread. Does anyone know how this can be fixed? So I only create 1,2 or 3 threads for StringProcessing?
type: Question
has title: Spawning too many threads in java
answer count: 2

http://stackoverflow.com/comment/41634842
comment on: http://stackoverflow.com/q/26500817
score: 0
has text: *"I know that already this question is asked here.."* Where? Link to it.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26481500
tagged with: java
has title: JavaFX-8 TableView with Buttons renders too many of them?
type: Question
tagged with: tableview
has answer: http://stackoverflow.com/a/26486113
has body: I want to create a TableView with Buttons in each row to delete the specific row. Therefore I created a class extending TableCell with a Button in it. So I set the CellFactory of the column like this: clmRemoveButtons.setCellFactory(c -&gt; new RemovingCell(clients)); Everything works fine. I'm able to delete the rows and the buttons are displayed correctly, but there is one problem. There are buttons in the whole column. It doesn't matter how many items are in the ObservableList of data. The buttons in rows with items work correctly, but when I click on a button out of this range I get a IndexOutOfBoundsException (that's correct, because there is no data to remove at this point). So my question is, what do I do wrong and how can I avoid this issue? best regards EDIT: Code of RemovingCell (Note: HoverButton is a control extending JavaFX Button with some settings (size etc.), so nothing special. public class RemovingCell extends TableCell&lt;Client, Client&gt; { private HoverButton hb = new HoverButton(Color.RED); public RemovingCell(ObservableList&lt;Client&gt; data) { super(); setAlignment(Pos.CENTER); try { ImageView imgv = new ImageView(new Image(new FileInputStream( "img/Remove.png"))); imgv.setFitWidth(15); imgv.setPreserveRatio(true); imgv.setSmooth(true); hb.setGraphic(imgv); hb.setTooltip(ControlFactory.getTooltip("Klient entfernen")); hb.setOnAction(event -&gt; { data.remove(getTableRow().getIndex()); }); setGraphic(hb); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
score: 0
tagged with: javafx-8
answer count: 1
tagged with: button
accepted answer: http://stackoverflow.com/a/26486113
has comment: http://stackoverflow.com/comment/41602459
has comment: http://stackoverflow.com/comment/41605169
type: AnsweredQuestion

http://stackoverflow.com/comment/50676144
type: Comment
comment on: http://stackoverflow.com/a/27030202
score: 1
has text: Why is it not available to record one's own app, with MediaProjection?
type: AnswerComment

http://stackoverflow.com/q/26414726
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41477555
has comment: http://stackoverflow.com/comment/41477419
upvote count: 1
linked to: http://stackoverflow.com/q/2730388
answer count: 1
tagged with: java
tagged with: hibernate
has body: How can I reattach a detached object to a Hibernate Session. The Object has not changed since it was last associated with a (different) Session, so I do not want Hibernate to issue an UPDATE or other SQL statement.
downvote count: 0
has answer: http://stackoverflow.com/a/26414904
score: 1
has comment: http://stackoverflow.com/comment/41477587
has comment: http://stackoverflow.com/comment/41477331
has title: Reattach an object in Hibernate without issuing a SQL statement?
accepted answer: http://stackoverflow.com/a/26414904
type: AnsweredQuestion

http://stackoverflow.com/q/26433691
tagged with: private-methods
duplicate of: http://stackoverflow.com/q/20290991
answer count: 1
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/26433824
has title: Code is wont output what i input, and wont calculate the input numbers
tagged with: if-statement
type: UnansweredQuestion
has body: So this is a calculator problem. We are to have a Calculator class (which contains the other three classes), Number class (for type-checking the quantities to be processed), Operation class (for the five operations)), and Memory class (for the memory functions)). When I input numbers it wont output the number and it also wont calculate the inputted numbers. Sorry if there is any confusion. Any help will be appreciated. import java.util.*; public class calculatortest{ private Num num; private Ope ope; public static void main(String args[]){ calculatortest c = new calculatortest(); c.start(); } public calculatortest() { } public void start() { describeProgram(); getInput(); displayOutput(); //getMemory(); } private void describeProgram() { System.out.println("this is kc program and it starts from here"); } private void displayOutput() { System.out.println("Input number 1: " + num.number1()); System.out.println("Input operator: " + ope.operator()); System.out.println("Input number 2: " + num.number2()); System.out.println("Answer is: " + ope.answer()); } private void getInput() { double number11; String operator2; double number22; Scanner scanner = new Scanner(System.in); System.out.print("Number 1: "); number11 = scanner.nextDouble(); System.out.print("Operator: "); operator2 = scanner.next(); System.out.print("Number 2: "); number22 = scanner.nextDouble(); //operation = new Operation(number11,operator2, number33); num = new Num (number11, number22); ope = new Ope (number11, number22); } } class Num{ private double number11; private double number22; public Num (double number11, double number22) { } public double number1() { return number11; } public double number2() { return number22; } } class Ope { String operator2; double answer; double num1, num2; public Ope(double number11, double number22 ) { setNumber11(number11); setNumber22(number22); } public String operator() { // TODO Auto-generated method stub return ("does not work"); } /*public String Ope(String operato…
tagged with: class
score: 1
tagged with: public
linked to: http://stackoverflow.com/q/20290991
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/41582603
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26472497
has text: General answer: you either need a reference to `Die` inside your `Game` class by calling the constructor `Die die = new Die()` and then calling the paint method `die.paint()` or inside `Die` class you make the `paint()` method `static` and then call it as such `Die.paint()`.

http://stackoverflow.com/q/26405930
answer count: 1
has comment: http://stackoverflow.com/comment/41461351
has body: What should be the value value to add a new enum constant to the type type? public void addEnumConstant(IType type, String value){ if(type.isEnum()){ type.createField(value, null, false, null); } } Edit: I guess I was too brief, so I add more information about my problem I am using the JavaModel framework and want to add an enum constant to IType object. I want to avoid explicit use of AST. It is easy to add a new method to a type, by following code: IType type = [...]; type.createMethod("public void method(){}", null, false, null); Also I can add a variable field: type.createField("public int var", null, false, null); but I have no idea how to add an enum constant.
tagged with: enums
tagged with: java
tagged with: eclipse-jdt
type: UnansweredQuestion
tagged with: eclipse
has title: How to add enum constant field to IType
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/12878710
has answer: http://stackoverflow.com/a/26417866
upvote count: 2
score: 0
has comment: http://stackoverflow.com/comment/41461384
downvote count: 2
has comment: http://stackoverflow.com/comment/41460648

http://stackoverflow.com/q/26369301
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41395855
score: 3
has body: I am beginner in Java. I cannot understand this line even after a long try. byte num=(byte)135; this line gives result -121 why it is in signed number ? Can any one elaborate it ?
favorite count: 0
has title: Casting of primitives type
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26369325
has comment: http://stackoverflow.com/comment/41395800
tagged with: java
type: Question

http://stackoverflow.com/a/26473612
answers question: http://stackoverflow.com/q/26473494
has body: Yes, we can use predefined class name as variable. following code will work perfectly public class Test { public static void main(String[] args) { int BufferedOutputStream = 3; //BufferedOutputStream is predefined class System.out.println(BufferedOutputStream); } } it is also possible to use user defined class name as variable name. example public class Test { public static void main(String[] args) { Test2 Test2 = new Test2(); System.out.println(Test2.a); } } public class Test2 { public int a = 2; }
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26473494

apache-httpclient-4.x
tags question: http://stackoverflow.com/q/26450715
tags question: http://stackoverflow.com/q/26421193
tags question: http://stackoverflow.com/q/26388808
tags question: http://stackoverflow.com/q/26370898
tags question: http://stackoverflow.com/q/26511437
tags question: http://stackoverflow.com/q/26500807
tag name: apache-httpclient-4.x
type: Tag
tags question: http://stackoverflow.com/q/26415284
tags question: http://stackoverflow.com/q/26488667
tags question: http://stackoverflow.com/q/26429751

http://stackoverflow.com/comment/41677968
type: AnswerComment
has text: If it's bundled with EE server it should be available to all applications on that server out of the box and so you shouldn't add it to WAR. There shouldn't be any need to adding it manually to classpath as well. If you want to deploy to some other server which may not have it, simply make 2 versions of a WAR and deploy the one suitable for the server.
comment on: http://stackoverflow.com/a/26420432
type: Comment
score: 0

http://stackoverflow.com/comment/41424139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26384639
has text: Ok but do you run the sending in a separate program or as part of the same program? to test the client server stuff you would need 1 sender and 1 receiver program (or thread, ofcourse), as the receiver will block until it gets new input, which means your code would never reach the place where you would send. That's why I am curious about your sending code.
score: 0

http://stackoverflow.com/comment/41642301
has text: Some one had edited my question just as I edited the question to add the response so lost it. Edited to add it.. :) Thanks for the response
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26505624
score: 0

http://stackoverflow.com/q/26371990
linked to: http://stackoverflow.com/q/10018431
type: Question
tagged with: google-app-engine
tagged with: bitmap
answer count: 1
has title: What class(es) should I use for basic bitmap operations in GAE?
score: 0
tagged with: java
has body: I have to get some code running on the GAE and it does some very basic bitmap manipulation. What I fundamentally need to do is: Convert a bitmap from one format to another (usually to PNG). Get the metadata of an image: size in pixels, DPI, &amp; bitmap format. Resize an image. Walk the pixels in a bitmap to read and/or set them (this can be slow - rarely used). Also, it would be terrific if there's a class that will convert metafiles to a bitmap? thanks - dave
type: UnansweredQuestion
tagged with: image
has answer: http://stackoverflow.com/a/26382517

http://stackoverflow.com/comment/41431747
comment on: http://stackoverflow.com/a/26374376
type: AnswerComment
type: Comment
has text: The best documentation available is of course at the Android developers website. You can find some of the best complete project with code examples on Commnware's Github page under the title cw-omnibus. The projects there are the companion source code to Mark Murphy's excellent book "The busy coder's guide to Android development" published by Commonsware. The Commonsware subscription costs like some $40 or so for a year and you get every edition of the book released during that year. It's the most comprehensive book for Android and by far the best.
score: 0

http://stackoverflow.com/a/26429592
has body: Declare your sum variable outside the loop: int sumOfGames = 0; The increment the value inside the loop: int sumOfGames = 0; for (int i = 0; i &lt;= n; i++) { int value = oneGame(); sumOfGames += value; }
downvote count: 0
answers question: http://stackoverflow.com/q/26429530
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41424953
score: 0
type: QuestionComment
has text: My expected output: hello\n i try!!\n every thing\n man\n 123456
type: Comment
comment on: http://stackoverflow.com/q/26384764

http://stackoverflow.com/q/26417739
tagged with: java
answer count: 1
has body: I have a 'DBF' file I need to update a column from my field, I am using xBaseJ API to do the 'DBF' manipulations, my code as follows: DBF classDB=new DBF("ABC.dbf"); NumField xval = (NumField) classDB.getField("X"); classDB.read(); System.out.println(" X= " + xval.get()); xval.update(xval++); Update not working. please help guys
type: UnansweredQuestion
tagged with: dbf
type: Question
has answer: http://stackoverflow.com/a/27830556
has title: xBaseJ update not working
score: 0

http://stackoverflow.com/comment/41481726
comment on: http://stackoverflow.com/q/26417331
score: 0
has text: it seems to be **can you do my homework for me?**
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41607324
comment on: http://stackoverflow.com/q/26486471
type: QuestionComment
has text: set the object in the request attribute in your action class and fetch the same from the request in the forwarded jsp. please google you will find your answer quicker than here
type: Comment
score: 0

http://stackoverflow.com/q/26465624
upvote count: 1
type: Question
tagged with: dll
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26465936
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26465936
favorite count: 0
has title: call c++ dll from java
tagged with: c++
type: AnsweredQuestion
has body: I am using c dll in java, I want to load c Dll in java, I use JNA library but I get error “Exception in thread "main" java.lang.UnsatisfiedLinkError: The application has failed to start because its side-by-side configuration is incorrect.”, please tell me how can I solve my problem, if you have another solution please guidance me. import com.sun.jna.Native; public class ConectorTJna { public static void main(String args[]) { IConectorT lib = (IConectorT) Native.loadLibrary("add", IConectorT.class); int teste=lib.add(4, 5); System.out.println("RESULT: " + teste); } }

http://stackoverflow.com/comment/41610060
type: AnswerComment
has text: Here is my new code, the image loads but it is supposed to be an animated gif, and it is frozen on the first frame as if it is a jpeg or png. The edit is there, it just needs to be peer-reviewed.
type: Comment
comment on: http://stackoverflow.com/a/26485998
score: 0

http://stackoverflow.com/comment/41430579
comment on: http://stackoverflow.com/q/26387666
score: 0
has text: @PedroOliveira : why don't u post it as answer. I saw many post u only comments although that is the correct answer [like this one](http://stackoverflow.com/questions/26350158/cannot-resolve-symbol-createfromresource/26350321#26350321)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41517149
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26436223
has text: I think the reason is its not able to find the class file which is generated so that is why its giving error. and from where u running this jar and is it containing any external libraries. ?
score: 0

http://stackoverflow.com/comment/42778529
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26491708
has text: please see my answer in another thread: http://stackoverflow.com/a/27140347/847478
score: 0

http://stackoverflow.com/q/26376545
tagged with: httpsession
answer count: 1
tagged with: .net
type: UnansweredQuestion
tagged with: vb.net
type: Question
has body: I have a java application running like a server in Tomcat for my web app and my app cordova (same as the web application but with functions like a BarCode Scanner). With this application the server works perfectly. But now I am developing a little part of the aplication in VB.NET with compact framework 3.5 and when I log in the server store my session variable... Ok, that's fine but if I make a new request, my server detects a new session and for this my session variable is not here and for each request is opening a new Http Session. I think the problem is in VB. That's my code where I open requests to my server Try Dim url = "http://192.168.2.166:8084/SCTraker_Servidor/api/Session" Dim httpWebRequest As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest) httpWebRequest.Method = "POST" httpWebRequest.ContentLength = byteArray.Length httpWebRequest.ContentType = "application/json" Dim dataStream = httpWebRequest.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim httpWebResponse As HttpWebResponse httpWebResponse = DirectCast(httpWebRequest.GetResponse, HttpWebResponse) If httpWebResponse.StatusCode = 200 Then Me.Hide() httpWebRequest.Abort() httpWebResponse.Close() Home.Show() Else BarraEstado.Text = "No ha rellenado el campo usuario o contraseña" End If Catch webException As WebException BarraEstado.Text = webException.Message Dim respuesta = webException.Response Catch socketException As Sockets.SocketException BarraEstado.Text = socketException.Message End Try
has title: My java server does not recognize the HTTP session. Client on VB.NET
tagged with: java
has answer: http://stackoverflow.com/a/26377018
score: 0

http://stackoverflow.com/q/26414546
has comment: http://stackoverflow.com/comment/41479178
has comment: http://stackoverflow.com/comment/41508059
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/41494400
type: UnansweredQuestion
tagged with: audio
has body: I'm getting an exception ONLY when the program is run with a jar file. When I run it through IntelliJ i don't get the exception. Here's my code: opening the SourceDataLine (clip is an InputStream): Frmt = new AudioFormat(44100, 16, 2, true, false); Info = new DataLine.Info(SourceDataLine.class, Frmt); Bfr = new byte[409600]; NBToRead = 409600; try { LineIn = (SourceDataLine) AudioSystem.getLine(Info); LineIn.open(Frmt); TotalToRead = Clip.available(); } catch (LineUnavailableException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } playing the audio: LineIn.start(); try { while (Total &lt; TotalToRead &amp;&amp; !Stopped) { NBRead = Clip.read(Bfr, 0, NBToRead); if (NBRead == -1) { break; } Total += NBRead; LineIn.write(Bfr, 0, NBRead); } } catch (IOException e) { e.printStackTrace(); } LineIn.stop(); I'm getting an IllegalArgumentException on this line: LineIn.write(Bfr, 0, NBRead);
answer count: 0
has title: Getting illegal request to write non-integral number of frames exception ONLY when running with jar
score: 0
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41478160

http://stackoverflow.com/q/26489540
has title: would you mock the class under test as well like "inherit and override"?
type: UnansweredQuestion
has body: When I use mockito framework I usually mock only collaborators of the class under test (CUT). However I saw in "Working effectively with legacy code" a way to write UT sometimes. Where there is too much logic in one method. you would: 1) extract some logic code to a separate method 2) inherit the CUT and override this method 3) mock this method if we don't want to run this code (it's less relevant to our test) Then I have thought that I never mocked methods in my CUT, only collaborators. Would you ever mock methods of CUT? How would you mock methods of CUT and collaborators of CUT at the same time?
has answer: http://stackoverflow.com/a/26492977
tagged with: java
tagged with: unit-testing
type: Question
tagged with: mocking
tagged with: mockito
answer count: 1
score: 0

http://stackoverflow.com/q/26498074
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/30016446
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42674170
tagged with: jemos-podam
type: Question
score: 1
tagged with: java
has body: I found this useful library PODAM, but I troubles to get automatic byte Array. I used implemented AttributeStrategy public class LogoStrategy implements AttributeStrategy&lt;byte[]&gt;{ private static final int MAX_SIZE_FILE = 512*1024; @Override public byte[] getValue() throws PodamMockeryException { byte[] b = new byte[20]; new Random().nextBytes(b); return b; } } but when I used I got this Error: 2014-10-21 20:13:04 PodamFactoryImpl [ERROR] The type of the Podam Attribute Strategy is not java.lang.String but [B. An exception will be thrown. Exception in thread "main" uk.co.jemos.podam.exceptions.PodamMockeryException: An illegal argument was passed at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1569) at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:129) at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:119) at cl.molavec.jpa.entities.singleton.QuotationPropertiesSingleton.getNewInstance(QuotationPropertiesSingleton.java:26) at cl.molavec.main.InsertDummyData.main(InsertDummyData.java:66) Caused by: java.lang.IllegalArgumentException: The type of the Podam Attribute Strategy is not java.lang.String but [B. An exception will be thrown. at uk.co.jemos.podam.api.PodamFactoryImpl.returnAttributeDataStrategyValue(PodamFactoryImpl.java:2888) at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1493) ... 4 more I implemented AttributeStrategy but with char[] attribute and all nice. The error I couldn't understand why is expecting a String. Any suggestions? Thanks in advance.
has title: How to get byte[] atributte with PODAM
upvote count: 1

http://stackoverflow.com/q/26410465
upvote count: 2
has answer: http://stackoverflow.com/a/26411249
accepted answer: http://stackoverflow.com/a/26411249
answer count: 1
has comment: http://stackoverflow.com/comment/41469805
favorite count: 0
has comment: http://stackoverflow.com/comment/41470093
tagged with: dojo
score: 2
has comment: http://stackoverflow.com/comment/41469290
type: AnsweredQuestion
tagged with: dijit.form
downvote count: 0
has title: How to dynamically construct and set options for dijit.form.select widget?
tagged with: java
type: Question
has body: I have a select widget as follows var pulseLen = new Select({ id : "_PulseLength", label:"PulseLength", name: "pulseLength", value : 100, options: [ { label : "5", value :"5" }, { label : "10", value :"10" }, { label : "30", value :"30" }, { label : "100", value :"100" }, { label : "300", value :"300" } ] }); Now based on the value selected in the above pulseLength widget i have to change the options of the below Select Range widget Its part of GUI validations. var range = new Select({ id:"_Range", label:"Range"), name: "range", value: "5000", options: [ { label : "5", value :"5000" }, { label : "10", value :"10000" }, { label : "20", value :"20000" }, { label : "40", value :"40000" }, { label : "80", value :"80000" }, { label : "160", value :"160000" }, { label : "260", value :"260000" } ] }); API to generate dynamic options function getRangeArray(pulselen){ var myOptions = ""; var array = [0.5,1,2,5,10,20,40]; console.log("Length got is " + pulselen); for(i=0;i&lt;array.length;i++){ var myTmp = "{label : '" + array[i] + "', value : '"+array[i] * 1000 + "'}"; //console.log(myTmp); if(i==array.length-1){ myOptions = myOptions + myTmp; }else{ myTmp=myTmp+","; myOptions = myOptions + myTmp; } //console.log(myOptions); } //console.log(myOptions); myOptions = "[" + myOptions + "];"; return myOptions; } OnChange event of the pulseLength trying to change the options var newOptions = getRangeArray(value); console.log(newOptions); registry.byId("_Range").set("options", newOptions); Sample Output [{label : '0.5', value : '500'}, {label : '1', value : '1000'}, {label : '2', value : '2000'}, {label : '5', value : '5000'}, {label : '10', value : '10000'}, {label : '20', value : '20000'}, {label : '40', value : '40000'}];
tagged with: javascript

http://stackoverflow.com/comment/41606532
has text: Does it work if you try starting a jvm with the same flags on your client machine?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26483184
type: Comment

http://stackoverflow.com/q/26376640
has title: How to get more than 1 response in ajax called
tagged with: java
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26376852
has comment: http://stackoverflow.com/comment/41409093
tagged with: servlets
type: AnsweredQuestion
has body: I am uploading a file from JSP and processing it in a servlet and returning data to JSP. JSP file that uploads the file: $(document).ready(function() { $(':file').change(function(){ var fileObj = this.files[0]; var form = $('#upload'); var fd = new FormData(); fd.append( 'file', fileObj); $.ajax({ url: form.attr('action'), type: form.attr('method'), data: fd, processData: false, contentType: false, async: false, }).done(function(data){ alert('ajax complete'); $('#previewForm').append("&lt;div&gt;" + data + "&lt;/div&gt;"); $('#ldiv').hide(); }).fail(function() { alert("error"); $('#ldiv').hide(); }); } Servlet file. That read file which is upload by the jsp suppose upload Excel file. read that file data and convert that data into jsonString. Now I want to send that string as response of ajax call I need to return more then 1 value System.out.print("test.xlsx"); //File name System.out.print(jsonSting); // jsonSting is variable that is data of excel file which convert in json System.out.print("chintan"); //other parameter. So how can i Handel 3 response in JSP while ajax called....?
downvote count: 0
has answer: http://stackoverflow.com/a/26376878
tagged with: jsp
score: 1
tagged with: jquery
favorite count: 0
tagged with: ajax
linked to: http://stackoverflow.com/q/6475238
type: Question
accepted answer: http://stackoverflow.com/a/26376852
possible better answer: http://stackoverflow.com/a/26376759
has comment: http://stackoverflow.com/comment/41408897
has answer: http://stackoverflow.com/a/26376759

http://stackoverflow.com/q/26378774
answer count: 1
tagged with: cassandra
has answer: http://stackoverflow.com/a/26391874
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/41416966
has body: I have large CF I need to export. What can I do? COPY can't help, shows "Request did not complete within rpc_timeout." There is on idea to make a SELECT with WHERE clause and use TimeUUID, but how I can get UUID from the first record(Java Code will be perfect)? And than what would be CQL statement for SELECT(SELECT * FROM "HISTORY_ENTITY" WHERE UUID >= uuidofthefirstrow LIMIT 1000;).
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41412923
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41423933
has title: Cassandra 1.2 How to export large CF to csv file
score: 0
tagged with: datastax

http://stackoverflow.com/comment/41436576
type: Comment
has text: @wrongAnswer Yes, I did edit my question, forgot to mention that. Updated code is at the bottom of it. I've tried changing && to || but I still enter an infinite loop
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26383648

http://stackoverflow.com/q/26478190
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26479498
tagged with: netty
upvote count: 1
type: AnsweredQuestion
has title: Netty Bootstrap java.lang.IllegalStateException: localAddress not set
has body: I have been trying to learn Netty and set up a simple server client connection following a tutorial but whenever I run this part of the code: public void start() throws Exception{ EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .remoteAddress(new InetSocketAddress(host,port)) .handler(new ChannelInitializer&lt;SocketChannel&gt;() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new EchoClientHandler()); } }); ChannelFuture f = b.bind().sync(); System.out.println("ChannelFuture bind is a success"); f.channel().closeFuture().sync(); System.out.println("ChannelFuture has been closed"); } finally { group.shutdownGracefully().sync(); } } This is part of the client program which is trying to connect to 127.0.0.1 on port 1234. I run this after I set up the server program which is running on the same computer on port 1234. The error I get is: Exception in thread "main" java.lang.IllegalStateException: localAddress not set at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:235) at EchoClient.EchoClient.start(EchoClient.java:39) at EchoClient.EchoClient.main(EchoClient.java:57) The line java:39 is referencing is "ChannelFuture f = b.bind().sync();" I don't quite understand what localAddress is and why I would need a local address if it is the client program. I'm running this program on a Linux Virtual Machine if that makes a difference.
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26479498

http://stackoverflow.com/q/26483343
type: Question
linked to: http://stackoverflow.com/q/389741
has title: how to end if and move to other line
has body: My problems starts when I want to see the condition and then move to another line but there is no "goto" in java so I have no clue how to move from inside of this if and go to the next line one ther hand when I put return after that it doesn't run the code .... I would aprieciate I f you guys help me with this problem... source code is here ::: //package CaloriesCalculator import java.util.Scanner; class Main { // @SuppressWarnings("null") @SuppressWarnings("resource") public static void main(String[] args) { // Initiate a new Scanner // here I have tried to use scanner boolean run = true; while(run){ @SuppressWarnings("resource") Scanner userInputScanner = new Scanner(System.in); System.out.print("\nIf you are Male Press 1, If you are Female Press 2 "); int G = userInputScanner.nextInt(); if(G == 1) { System.out.print("Please Enter your Weight.."); int W = userInputScanner.nextInt(); if((W &lt;300) &amp;&amp; (W &gt; 1)) {//error message // my problems start here !! I need to have the next input here but it doesn't work } System.out.print("Please Enter your Weight.."); W= userInputScanner.nextInt(); return; // int m; System.out.print("Please Enter your Height"); int H = userInputScanner.nextInt(); System.out.print("Please Enter your Age.."); int A = userInputScanner.nextInt(); double BMR = 10*W + 6.25*H - 5*A +5 ; if( BMR &gt; 0) {System.out.print(" Your body needs the amount of calories : "+ BMR );} else { System.out.print("Do you know you are a mess ? " );} //int H = userInputScanner.nextInt(); // else {System.out.print("Please Enter valid weight");} } else if(G == 2) { System.out.print("Please Enter your Weight.."); int W = userInputScanner.nextInt(); System.out.print("Please Enter your Height"); int H = userInputScanner.nextInt(); System.out.print("Please Enter your Age.."); int A = userInputScanner.nextInt(); double BMR = 10*W + 6.25*H - 5*A -161 ; if(BMR &gt; 0) { System.out.print(" Your body needs the amount of calories : "+ BMR ); } else { System.out.print(…
answer count: 1
linked to: http://stackoverflow.com/q/886955
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26483532
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/7056749
accepted answer: http://stackoverflow.com/a/26483532

http://stackoverflow.com/comment/41411537
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26377568
has text: When comparing c1 to c4 it gives the value -1 instead of 1, what is causing this?
type: Comment

http://stackoverflow.com/comment/41413580
type: Comment
comment on: http://stackoverflow.com/q/26379124
type: QuestionComment
has text: As soon as you execute a System command, the threat is here. Whatever the API you use
score: 0

http://stackoverflow.com/a/26442629
downvote count: 0
answers question: http://stackoverflow.com/q/26442550
score: 4
has comment: http://stackoverflow.com/comment/41529213
has comment: http://stackoverflow.com/comment/41528708
has body: The syntax of the SQLite query is wrong: create tableBowlingScoresTable... Should be something like: create table BowlingScoresTable... Forgot a space? Edit: Okay you've supplied code now. Another syntax error I can see is: + GAME3 + " integer," There shouldn't be a comma in the end since a ) follows.
type: Answer
upvote count: 4

http://stackoverflow.com/comment/41373074
comment on: http://stackoverflow.com/q/26357157
has text: You are trying to build a JSONObject from a JSONArray format String.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41445163
has text: @user3705478, That's not clear about your **unique** criteria.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26394594

http://stackoverflow.com/comment/41539095
type: QuestionComment
score: 1
has text: possible duplicate of [Hibernate HQL Query : How to set a Collection as a named parameter of a Query?](http://stackoverflow.com/questions/570229/hibernate-hql-query-how-to-set-a-collection-as-a-named-parameter-of-a-query)
comment on: http://stackoverflow.com/q/26448110
type: Comment

http://stackoverflow.com/a/26369380
has comment: http://stackoverflow.com/comment/41401857
score: 0
has body: Yes, you can write your own plugin for IntelliJ IDEA, which implements your quick fix variant. Default quick-fixes are not modifiable.
type: Answer
answers question: http://stackoverflow.com/q/26368943

http://stackoverflow.com/comment/41484862
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26418775
score: 0
has text: Thanks Rakke, I have to different methods, one uses openList which is a FILO queue, and A* method is using openListP which is a priority queue

http://stackoverflow.com/comment/41500590
has text: this is a constraint that i have, and it matters.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26427693

http://stackoverflow.com/a/26458647
has comment: http://stackoverflow.com/comment/41725851
has comment: http://stackoverflow.com/comment/41569345
answers question: http://stackoverflow.com/q/26431111
type: Answer
score: 0
has body: Does the browser enablement test pass? Is the issue seen on some specific site or any website ? If all the sites have the issue then I wud suspect it to be browser enablement issue.[Browser enablement requires Java to be enabled as well]. Also in IE tools>Addons make sure the Rational IEEnablerClass is enabled. Check the Next Gen plugin in the Java Control Panel under Advanced Tab. It should be unchecked. Check the browser zoom level (it should be 100%). And cud you tell .. if you try to insert an object in the browser using the (Insert Test Object Wizard) what is the class of object that RFT is able to highlith .. I mean is it Html.HtmlBrowser or Html.HtmlDocument or something else.

http://stackoverflow.com/a/26453255
type: Answer
downvote count: 0
score: 1
has body: One of ways of doing this can be as follows: Set the text node as unmanagable for its parent and determine its place manually Text t1 = new Text(); t1.setText(Integer.toString(222)); t1.setManaged(false); t1.setLayoutX(-t1.getLayoutBounds().getWidth() / 2); t1.setLayoutY(r2.getHeight() + t1.getLayoutBounds().getHeight());
answers question: http://stackoverflow.com/q/26445088
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26445088

http://stackoverflow.com/comment/41524617
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26422879
has text: One out of topic question "Which book/source is good for learning java net & Collections and threading concepts ?"

http://stackoverflow.com/comment/41421680
comment on: http://stackoverflow.com/q/26382515
has text: @mKorbel 1 and 2: by using DefaultTableModel I can't do it a lot of other things, for example the dynamic change of the icon that correspond the type of vehicle. I have defined this column in my VehicleTableModel and the icon's change is automatic. Otherwise, with DTM I must always pass the value of the Icon when I add a row. I don't want this. And if I remember, is very complicate manage the rows: I want that correspond at vehicles. If the vehicle changes, the row must change and viceversa. With DTM this is impossible or very difficult. If I remember, DTM works only on Vector & object arrays.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26415225
upvote count: 2
tagged with: datetime
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26415270
has title: Java time formatting
type: Question
possible better answer: http://stackoverflow.com/a/26430088
has answer: http://stackoverflow.com/a/26430088
accepted answer: http://stackoverflow.com/a/26415270
answer count: 2
has body: I have the method public static void testDateFormat() throws ParseException { DateFormat dateFormat=new SimpleDateFormat("HH:mm:ss"); Date hora; hora=dateFormat.parse("00:00:01"); System.out.println(hora.getHours()+" "+hora.getMinutes()); System.out.println("Date "+hora); System.out.println("Seconds "+TimeUnit.MILLISECONDS.toSeconds(hora.getTime())); } The output is 0 0 Date Thu Jan 01 00:00:01 COT 1970 Seconds 18001 Why the number of seconds is 18001? I expected to get 1 second.
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26402708
downvote count: 0
has comment: http://stackoverflow.com/comment/41455145
has comment: http://stackoverflow.com/comment/41480417
has comment: http://stackoverflow.com/comment/41485143
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41484992
has comment: http://stackoverflow.com/comment/41456188
accepted answer of: http://stackoverflow.com/q/26402632
has comment: http://stackoverflow.com/comment/41484949
type: Answer
answers question: http://stackoverflow.com/q/26402632
score: 2
has body: To convert a byte[] to String and convert the encoding, you don't need external frameworks. Use String original = new String(myByteArray, myOriginalEncoding) to get a String from your byte[] given the expected encoding. Then, initialize a new String again to convert to whichever encoding (ASCII here): String converted = new String(original.getBytes(myOriginalEncoding), "Cp1252") Note You must know the encoding for your original String to be interpreted with, i.e. UTF-8, ISO Latin 1, etc.

http://stackoverflow.com/a/26415208
has comment: http://stackoverflow.com/comment/41500562
type: Answer
answers question: http://stackoverflow.com/q/26414158
upvote count: 1
has comment: http://stackoverflow.com/comment/41499952
score: 1
accepted answer of: http://stackoverflow.com/q/26414158
has comment: http://stackoverflow.com/comment/41499693
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41497599
downvote count: 0
has comment: http://stackoverflow.com/comment/41499161
has body: Just a thought that may help don't know without seeing the whole template. Try wrapping the menu bar inside a SimplePanel or FlowPanel and add a style for display:block. This is just a guess as I am not completely sure what your problem looks like. You should also set a width on the DockPanel too, to keep it from resizing all the time. It would be best if it had a width so it knows initially where to center the menu bar. Otherwise it will move when the container grows or shrinks. &lt;style&gt; .menubar-wrapper { width: 100px; margin: 0 auto; } &lt;/style&gt; &lt;g:DockPanel&gt; &lt;g:Dock direction='NORTH' &gt; &lt;g:SimplePanel styleName="{style.menubar-wrapper}"&gt; &lt;g:MenuBar ui:field="mainMenu"/&gt; &lt;/g:SimplePanel&gt; &lt;/g:Dock&gt; &lt;/g:DockPanel&gt; If this doesn't help you may try to add a style to the menu bar for float:left;

http://stackoverflow.com/q/26498904
tagged with: android-toast
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26499066
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26499101
has answer: http://stackoverflow.com/a/26499066
type: Question
tagged with: try-catch
answer count: 2
has answer: http://stackoverflow.com/a/26499101
has body: I'm creating an android app that has a login screen. What I did was that whenever the user clicks the submit button, it runs a progressdialog. then call a new thread to verify the login. When I try to run a toast on the function inside the login, the app suddenly crashes. What I did with it is this: loginButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ dialog = ProgressDialog.show(MainActivity.this, "", "Validating user...", true); new Thread(new Runnable(){ public void run(){ login(); } }).start(); } }); then my login function is this: void login(){ try{ //some code } catch(Exception e){ dialog.dismiss(); Context context = getApplicationContext(); CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } But for some reason once it goes to the catch function the app suddenly crashes only when I add the code for the toast. What is wrong with my code and why is it crashing only when I am using toasts?
has comment: http://stackoverflow.com/comment/41630417
tagged with: android
has title: Android app crashing when toast is run in try catch

http://stackoverflow.com/q/26370570
tagged with: java
tagged with: wsimport
accepted answer: http://stackoverflow.com/a/26853256
type: Question
has body: I'm generating .java files using wsimport in the command line as follows: C:\temp&gt;"%JAVA_HOME%\bin\wsimport" -d . -p com.package.name -keep -extension -Xnocompile File.wsdl I'm successfully generating .java files from the .wsdl files I'm giving it, but the .java files' source version is at least 5.0 as it includes varargs [function(Integer... myInts)] and annotations (@WebServiceClient(...) etc.). It's easy enough to comment out the annotations, but the varargs are proving a little more difficult to convert for compliance to my source version (1.3). Is there a simple way to tell wsimport to generate source code at a certain compliance level? Or is there a better solution?
score: 0
tagged with: generated-code
has title: When generating .java files in Java by using wsimiport on .wsdl file, is there a way to specify the source code version?
tagged with: version
answer count: 1
tagged with: wsdl
has answer: http://stackoverflow.com/a/26853256
type: AnsweredQuestion

http://stackoverflow.com/comment/43212867
comment on: http://stackoverflow.com/a/26471486
has text: @userX I found this while searching on my SEO: http://programmerguru.com/android-tutorial/android-restful-webservice-tutorial-how-to-call-restful-webservice-in-android-part-3/ Tutorial TL;DR the method that invokes the external web service is `invokeWS`. I do not support that tutorial.
score: 1
type: AnswerComment
type: Comment

avro
tags question: http://stackoverflow.com/q/26468484
tags question: http://stackoverflow.com/q/26504670
tag name: avro
type: Tag
tags question: http://stackoverflow.com/q/26470639

http://stackoverflow.com/a/26438980
score: 0
type: Answer
has body: You should use thread pooling. I think this example will give you enough information for your implementation. For more information look at Java docs With thread poll you achieve this (paraphrasing): "With a limit on the number of the threads that can be created, the application will not be servicing your background jobs (worker threads) as quickly as they come in, but it will be servicing them as quickly as the system can sustain." You can create fixed thread pool executor like this ExecutorService executor = Executors.newFixedThreadPool(8); and execute worked with something like executor.submit(worker); where worker is instance of your job class which implements Runnableor Callable&lt;T&gt;
answers question: http://stackoverflow.com/q/26438830

http://stackoverflow.com/comment/85723713
type: Comment
has text: This will return JSON object
comment on: http://stackoverflow.com/a/33344776
score: 0
type: AnswerComment

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/26430922

http://stackoverflow.com/q/26482400
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26482608
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Java pick up JSON as value not as Integer
linked to: http://stackoverflow.com/q/26464017
has body: I wanted to know if anyone knows a way to pick up JSON Object as a value instead of an Integer or Long. Since i am trying to use a barcode application, alot of the codes contain Letters and breakpoints (like dots . and dashes -). I got the json parsing working find, except it parses the value of the JSONObject I need as an Integer. so, i can only use numbers and no whitespaces, dots or any other breaking points in that matter. But since the database contains numbers and numbers with letters like : 100.100.ab.100 and 100100100, simple using .replaceAll(".","") .replaceAll("%20", "") would just not cut it. So the problem at hand is, can I convert a JSONObject which is received by URL and JSON parsing, to get it to accept any value entered? I looked at the following post, Link 1 And i have tried to adapt my code accordingly. for (int i = 0; i &lt; user.length(); i++) { String c = user.getString(i); if (c.equals(xyz) { } } Another possible thought i had, was to use REGEX, or Regular Expressions to make the value searched for accept anything necessary, then again.. An Integer cannot accept anything besides numbers and it will crash and Burn.
upvote count: 0

http://stackoverflow.com/q/26469679
has body: I would like to inject a FileInputStream as a constructor argument using spring annotation. Lets say I have the following class (before doing constructor arg injection) @Component public class MyClass{ private BlaClass xy; public MyClass(InputStream is) { this.xy = new BlaClass(is); } } So now my question is if I can use the @Value annotation or a similar one in order to inject the input stream? Should be something like this: @Component public class MyClass{ private BlaClassTakingAnInputStream xy; //this is of course not correct public MyClass(@Value("classpath:path/to/a/file") is) { this.xy = new BlaClassTakingAnInputStream(is); } } p.s.: I know how it works using xml configuration but I would like to do it using annotations since its less verbose.
tagged with: java
has answer: http://stackoverflow.com/a/26470042
upvote count: 1
answer count: 1
has title: Spring DI: Injection of FileInputStream in Constructor using annotation
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/41576959
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26470042
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41577355
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/26507614
has title: CLI How to continuously check for change
tagged with: java.util.scanner
score: 0
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26507660
tagged with: command-line-interface
type: Question
answer count: 1
has body: Im trying to check for input continuously from the cli. But for some reason when I enter say "r" into the cli ill have to do it a few times before it actually goes into the if statement. Im not sure why it has to do this. Then when it does and I enter say "s" it might never read it. Does anyone know why this is or a better way to continuously check for user input and be able to act on it Thanks Scanner sc = new Scanner(System.in); while (sc.hasNextLine()) { if (sc.next().equals("r")) { thread1.start(); System.out.println("r"); } if (sc.next().equals("s")) { thread1.interrupt; System.out.println("s"); } }
accepted answer: http://stackoverflow.com/a/26507660
tagged with: input

http://stackoverflow.com/comment/41657210
comment on: http://stackoverflow.com/q/26513492
has text: Does anything change if the `for` loop consists of: `{ TransactionType tmp = type[i]; if (tmp != null && tmp == this) return true; }`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41403570
score: 0
comment on: http://stackoverflow.com/a/26373489
has text: @EJP It's 2014, it irks me when file protocols don't support > 2 GB files. Anyway, I included BufferedOutputStream in my original post but I've edited it to try and clarify.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41504745
has text: @pbars23 2 comments. (1) arr should be an array of Strings, not of doubles. (2) The main() method is void, rather than returning an int.
comment on: http://stackoverflow.com/a/26429754
type: Comment
score: 0
type: AnswerComment

pivot-table
tag name: pivot-table
tags question: http://stackoverflow.com/q/26447770
type: Tag

http://stackoverflow.com/q/26483603
has title: how to invoke dao method crrectly from same dao method
answer count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41603314
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41605474
type: Question
score: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/41607296
has body: I have 2 dao. @EnableTransactionManagement() @Repository public class TTTestFirstImpl implements TTestFirstDao { protected EntityManager entityManager; ... @Autowired public TTestSecondDao secondDao; @Override @Transactional(propagation=Propagation.REQUIRED) public void first() { entityManager.persist(new TableTest1().setName("first dao persist")); try { secondDao.second(); } catch (Exception e) { e.printStackTrace(); } } And Also second dao looks like this: @EnableTransactionManagement() @Repository public class TTTestSecondImpl implements TTestSecondDao { protected EntityManager entityManager; ... @Override @Transactional(propagation=Propagation.REQUIRES) public void second() { entityManager.persist(...); throw new RuntimeException(); // to roll back } First and Second method persists data in DB. in First Dao I have injected Second dao. I invoke second() method from first() method. Everything is well, because of second() method have Propagation.REQUIRES all persist data is roll backed well (which was persisted from first() and from second() method). There is no data in DB. Very good! Now I have created third() method in First Dao Implementation which is similar of second() mehtod. Only difference is that third() method id written in TTEstFirstImpl class. Now my class looks like this: @EnableTransactionManagement() @Repository public class TTTestFirstImpl implements TTestFirstDao { @Autowired private ApplicationContext applicationContext; private TTestFirstDao getSpringProxy() { return applicationContext.getBean(this.getClass()); } @Transactional(propagation=Propagation.REQUIRED) public void third() { entityManager.persist(...); throw new RuntimeException(); } @Override @Transactional(propagation=Propagation.REQUIRED) public void first() { entityManager.persist(...); try { // dao.second(); getSpringProxy().third(); } catch (Exception e) { e.printStackTrace(); } } When I invoke third() method, which have Propagation.REQUIRED, I do not have same result. Only third() …
has comment: http://stackoverflow.com/comment/41605077

http://stackoverflow.com/a/26498414
type: Answer
has comment: http://stackoverflow.com/comment/41632217
has comment: http://stackoverflow.com/comment/41631066
has comment: http://stackoverflow.com/comment/41632040
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/26497955
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26497955
has body: If deblan is the context root then don't put it in the servlet mapping. You've got this url: http://localhost:8080/deblan/cuenta/cCuenta if you've deployed this app with deblan as the context root then: http://localhost:8080/deblan takes you to your app /cuenta/cCuenta now maps to your controller, so try: appServlet /* Which means http://localhost:8080/deblan + whatever comes after.

http://stackoverflow.com/comment/41494180
has text: The problem is the error appears once i have removed the xml-apis dependencies.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26420609

http://stackoverflow.com/comment/41505467
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26430327
has text: Yes, it will, as the requirements say it should do.

http://stackoverflow.com/a/26474662
upvote count: 3
score: 3
has body: I recommend either using a MultiThreadedHttpConnectionManager if you're using HttpClient 3 or PoolingHttpClientConnectionManager if you're using HttpClient 4. I'm fairly confident that the default connection manager for both HttpClient 3 and HttpClient 4 are expecting only single thread access.
accepted answer of: http://stackoverflow.com/q/26474571
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41623249
has comment: http://stackoverflow.com/comment/41625784
type: Answer
answers question: http://stackoverflow.com/q/26474571

http://stackoverflow.com/comment/41525858
score: 0
has text: upvote my question please guys. I need some nice reputation.
comment on: http://stackoverflow.com/q/26430630
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26488806
score: 3
has body: The reason is that in Generics the keyword extends is used in a different context. In Generics, T extends Something denotes that T will be a sub-class of Something or will implement Something (in the cases of an interface). The type of the bound doesn't really matter (class or interface) - what matters is T to be sub-type of the provided bound. More info: Why extends interface instead of implements interface?
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26488639
type: Answer
accepted answer of: http://stackoverflow.com/q/26488639
upvote count: 3
has comment: http://stackoverflow.com/comment/41612005
has comment: http://stackoverflow.com/comment/41611963

http://stackoverflow.com/q/26443075
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27625234
has title: Do you validate login form before forwarding to j_spring_security_check?
tagged with: spring-security
score: 0
tagged with: validation
has body: Option 1: Set form's action to j_spring_security_check and let spring handle it Option 2: Validate the login form inside the controller and then forward to j_spring_security_check Which one is the best practice? I guess option 2 but maybe there is no need to do that so that's why I ask. Oh, and I'm talking about server side validation, no javascript here. Thanks in advance.
accepted answer: http://stackoverflow.com/a/27625234
tagged with: spring
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26443185
has answer: http://stackoverflow.com/a/26443185

http://stackoverflow.com/comment/41463974
type: AnswerComment
comment on: http://stackoverflow.com/a/26407220
has text: Maybe the applet needs to accept calls from Javascript?
type: Comment
score: 0

http://stackoverflow.com/comment/41488327
type: QuestionComment
has text: Do you mean to say that your methods should be `synchronized`?
comment on: http://stackoverflow.com/q/26421239
score: 0
type: Comment

http://stackoverflow.com/a/26452615
has body: synchronize your NOTIFY method. Also use watek.NOTIFY() instead of TH.NOTIFY().
score: 1
answers question: http://stackoverflow.com/q/26452570
downvote count: 0
has comment: http://stackoverflow.com/comment/41546578
has comment: http://stackoverflow.com/comment/41546711
has comment: http://stackoverflow.com/comment/41547208
type: Answer
upvote count: 1

http://stackoverflow.com/a/26498847
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26498496
has comment: http://stackoverflow.com/comment/41631194
type: Answer
accepted answer of: http://stackoverflow.com/q/26498496
has body: Elements pgElem = doc.select("div.thumb").select("div.meta").select("[data-track]"); Elements ownerElements = new Elements(); for(Element element:pgElem){ if(!element.getElementsByAttributeValueContaining("data-track","owner").isEmpty()){ ownerElements.add(element); } } actually, I just gave it another spin and this works for me: doc.select("div.thumb").select("div.meta").select("[data-track=owner]")

http://stackoverflow.com/q/26419288
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26419455
tagged with: awt
has comment: http://stackoverflow.com/comment/41485086
downvote count: 4
has comment: http://stackoverflow.com/comment/41485081
has comment: http://stackoverflow.com/comment/41485133
answer count: 1
favorite count: 0
has title: Creating a Rectangle object and finding area
type: UnansweredQuestion
score: -4
has body: How can I create a Rectangle object and use its methods to determine the area? I have tried to create a Rectangle object and print it to console like this: import java.awt.Rectangle; public class Rectangle { public static void main(String []args) { Rectangle box = new Rectangle(5,10,20,30); System.out.println(box); } } I expected it to print the area but it doesn't. What am I doing wrong?
has comment: http://stackoverflow.com/comment/41485649
tagged with: sbt
tagged with: rectangles
tagged with: java

http://stackoverflow.com/a/26419199
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26402279
accepted answer of: http://stackoverflow.com/q/26402279
has comment: http://stackoverflow.com/comment/41599483
upvote count: 2
type: AcceptedAnswer
has body: Try switching to the latest release of the Java SDK. I wrote up a very basic how-to guide on getting going with it here that might help you get past your JKS issue. Looks like the namespaces you're using are from an earlier release. http://azure.microsoft.com/blog/2014/09/15/getting-started-with-the-azure-java-management-libraries/
type: Answer

http://stackoverflow.com/comment/41619342
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26492163
has text: Yes, and finding a way to do it before returning the view :/

http://stackoverflow.com/a/26377000
downvote count: 0
answers question: http://stackoverflow.com/q/26376638
accepted answer of: http://stackoverflow.com/q/26376638
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: Spring is able to use constructors with parameters In java configuration, it is very simple : @Configuration public class MyConf { ... @Bean private foo() { return new Foo&lt;ClassName&gt;(ClassName.class); } ... } It is also possible with XML config &lt;bean id="foo" class="...Foo"&gt; &lt;constructor-arg type="java.lang.Class" value="...ClassName"/&gt; &lt;/bean&gt;

http://stackoverflow.com/a/26436745
answers question: http://stackoverflow.com/q/26436699
score: -1
upvote count: 0
has body: try using just setVisible(true) in your init method as a last member...and remove it from EventQueue run() method public void init() { OutputStream out = new OutputStream() { @Override public void write(int b) throws IOException { updateTextArea(String.valueOf((char) b)); } @Override public void write(byte[] b, int off, int len) throws IOException { updateTextArea(new String(b, off, len)); } @Override public void write(byte[] b) throws IOException { write(b, 0, b.length); } }; System.setOut(new PrintStream(out, true)); System.setErr(new PrintStream(out, true)); System.out.print("Hello"); setIconImage(Toolkit.getDefaultToolkit().getImage(JFrame_CSD200_FpCaptureAccess.class.getResource("/img/3M_Logo.gif"))); dialog = null; fingerprintCaptureApi = new mmm.cogent.fpCaptureApi.MMMCogentCSD200DeviceImpl(); fingerprintCaptureApi.initDevice(); fp1BMPBytes = null; fp1BMPBytes = null; fp1FMRBytes = null; fp2FMRBytes = null; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 765, 622); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); lblCaptureImg = new JLabel(""); lblCaptureImg.setBounds(68, 120, 114, 172); lblCaptureImg.setBorder(new LineBorder(Color.black)); contentPane.add(lblCaptureImg); btnInitialize = new JButton("Initialize"); btnInitialize.setBounds(28, 315, 105, 23); btnInitialize.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setDisplayedImageByteArray(null); repaint(); Thread initThread = new Thread( new initWorker() ); initThread.setDaemon(true); initThread.start(); } }); btnInitialize.setFont(new Font("Tahoma", Font.PLAIN, 11)); contentPane.add(btnInitialize); btnCapture = new JButton("Capture"); btnCapture.setBounds(28, 349, 105, 23); btnCapture.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setDisplayedImageByteArray(null); repaint(); …
type: Answer
downvote count: 1

http://stackoverflow.com/q/26423361
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41492879
tagged with: mapreduce
type: Question
tagged with: hadoop
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41492746
has comment: http://stackoverflow.com/comment/41493228
favorite count: 0
accepted answer: http://stackoverflow.com/a/26425978
has body: I have chained mapreduce jobs in the following way: map1 -> reduce1 -> map2 -> reduce2 During map1 step as a side effect I calculate data that will be needed only during reduce2 step, so I don't want to pass it all the way through the chain. What is the best way to pass this data so that on reduce2 step I could get data from both map2 and map1? Thanks
has comment: http://stackoverflow.com/comment/41492941
has answer: http://stackoverflow.com/a/26425978
type: AnsweredQuestion
has title: Hadoop: passing data between consecutive mapreduce tasks

http://stackoverflow.com/q/26463008
answer count: 2
has title: difference between /** and /* in Spring
has comment: http://stackoverflow.com/comment/41564785
has comment: http://stackoverflow.com/comment/41565212
favorite count: 0
has answer: http://stackoverflow.com/a/42850518
has comment: http://stackoverflow.com/comment/41564841
tagged with: spring
has answer: http://stackoverflow.com/a/26463249
accepted answer: http://stackoverflow.com/a/26463249
tagged with: spring-mvc
type: AnsweredQuestion
has body: probably it's a very stupid question, but I couldn't find anything on the internet. What the difference between writing &lt;mvc:mapping path="/**"/&gt; and &lt;mvc:mapping path="/*"/&gt; in Spring?
tagged with: java
has comment: http://stackoverflow.com/comment/41564921
upvote count: 10
downvote count: 1
possible better answer: http://stackoverflow.com/a/42850518
type: Question
score: 9
has comment: http://stackoverflow.com/comment/118902441
has comment: http://stackoverflow.com/comment/41564781
has comment: http://stackoverflow.com/comment/41564725

http://stackoverflow.com/a/26440022
has body: You can use Processing which has a nice serial library that works on Windows/OSX/Linux, however it has a dependency on Processing's main class: PApplet (which as name hints, is an Applet subclass). The library, as Processing is opensource, so you can adjust the RXTX wrapper it provides to work without PApplet (as a Daemon/service/etc.) if you need too. Have a look at this answer to see what I mean.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26437791

http://stackoverflow.com/comment/41569051
comment on: http://stackoverflow.com/a/26461923
type: Comment
has text: @Shekhar Put some logs in onCreate() to make sure database is created.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41388358
type: QuestionComment
comment on: http://stackoverflow.com/q/26360954
has text: The code compiles. For the moment, I'm using @SuppressWarnings("all"), but it's not ideal. I want to explicitly say in the code "I'm aware of this warning and it can be ignored" but only for that one call on obtainStyledAttributes. I could create a method containing only that line to extract the TypedArray and annotate that method, but it's seems like a work around.
score: 0
type: Comment

http://stackoverflow.com/q/26452894
has answer: http://stackoverflow.com/a/42247749
has comment: http://stackoverflow.com/comment/41546853
accepted answer: http://stackoverflow.com/a/26453159
score: 34
has answer: http://stackoverflow.com/a/26453049
type: AnsweredQuestion
upvote count: 34
has comment: http://stackoverflow.com/comment/41547157
tagged with: java
possible better answer: http://stackoverflow.com/a/26453049
type: Question
has body: At work, we found a problem when trying to divide a large number by 1000. This number came from the database. Say I have this method: private static BigDecimal divideBy1000(BigDecimal dividendo) { if (dividendo == null) return null; return dividendo.divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP); } When I make the following call divideBy1000(new BigDecimal("176100000")) I receive the expected value of 176100. But if I try the line below divideBy1000(new BigDecimal("1761e+5")) I receive the value 200000. Why this occurs? Both numbers are the same with different representation and the latest is what I receive from database. I understand that, somehow, the JVM is dividing the number 1761 by 1000, rounding up and filling with 0's at the end. What is the best way to avoid this kind of behavior? Keep in mind that the original number is not controlled by me.
has title: Java's Bigdecimal.divide and rounding
has answer: http://stackoverflow.com/a/55052430
tagged with: bigdecimal
linked to: http://stackoverflow.com/q/35435691
has answer: http://stackoverflow.com/a/26453096
has answer: http://stackoverflow.com/a/70824616
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/41547133
has answer: http://stackoverflow.com/a/26453159
favorite count: 0
has answer: http://stackoverflow.com/a/26452994

http://stackoverflow.com/q/26508133
type: AnsweredQuestion
has title: Why doesn't the Java compiler flag this as an error?
type: Question
tagged with: enums
has body: I have created an enumerated type in my Java webapp as a way of abstracting the procedure of adding objects to the session attributes. The idea being to precipitate an error if I try and map the wrong object type to a particular key. The enum code looks like this: public enum SessionVariables { CURRENT_BRIEF { @Override public &lt;Briefable&gt; void setValue(Briefable item) { FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(this.toString(), item); } @Override @SuppressWarnings("unchecked") public &lt;Briefable&gt; Briefable getValue() { return (Briefable) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(this.toString()); } }; public abstract &lt;T&gt; void setValue(T item); public abstract &lt;T&gt; T getValue(); } All fine so far, no compilation problems. However, if I actually try and use the methods with a wrong type, no error is found by the compiler, for instance: SessionVariables.CURRENT_BRIEF.setValue("String value"); compiles normally. Any ideas why this is the case? Have I missed something out? I'm using Java SE 8, EE7 on a Windows 7 machine.
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26508164
accepted answer: http://stackoverflow.com/a/26508164
tagged with: generics

http://stackoverflow.com/q/26460978
accepted answer: http://stackoverflow.com/a/26469719
favorite count: 0
has comment: http://stackoverflow.com/comment/41562606
has answer: http://stackoverflow.com/a/26469719
tagged with: refresh
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41569519
tagged with: java
has title: Vaadin 7 - update textarea at value changed
tagged with: vaadin
has body: I'm new at vaadin and I want to display some infologs in a textarea. Currently I have set the pushmode in my CustomComponent to PushMode.AUTOMATIC ( @Push(PushMode.AUTOMATIC) ). But this works only the first time. To refresh the text I have to resize the window manual or click a button. I found something called ICEPush but I do not understand this stuff :( and do not found good tutorials... Has anybody a hint for me? Thanks for help!
type: Question
tagged with: icepush
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41562083

http://stackoverflow.com/a/34903423
answers question: http://stackoverflow.com/q/26512432
upvote count: 5
downvote count: 0
type: Answer
has body: I ran into approximately this same issue. Here is generally the scala class that I was writing for scala/spark practice: package practice.spark import org.apache.spark.SparkContext._ import org.apache.spark._ import org.apache.spark.sql._ object SparkService { def sparkInit(sparkInstanceConfig: Configuration): SparkService = { val sparkConf = new SparkConf().setAppName(sparkInstanceConfig.appName) val instanceSpark = new SparkService(sparkConf) return instanceSpark } } class SparkService(sparkConf: SparkConf) { val sc = new SparkContext(sparkConf) val sql = new org.apache.spark.sql.SQLContext(sc) } In my eclipse project properties>Java Build Path>Libraries I had jre8 library, scala 2.11 library, spark-core_2.11, and spark-sql_2.11. I was getting the error Description Resource Path Location Type missing or invalid dependency detected while loading class file 'SparkContext.class'. Could not access term hadoop in package org.apache, because it (or its dependencies) are missing. Check your build definition for missing or conflicting dependencies. (Re-run with -Ylog-classpath to see the problematic classpath.) A full rebuild may help if 'SparkContext.class' was compiled against an incompatible version of org.apache. BinAnalysisNew Unknown Scala Problem I then added the hadoop-core jar to my Java build path and it cleared up this issue. I used the latest version of that jar. This issue may also be able to be cleared up by using gradle or some other build tool that will pick up all the dependencies of each jar used in the project.
score: 5

http://stackoverflow.com/q/26383377
type: Question
upvote count: 2
has body: I am attempting to write a subList method, which returns a list consisting of the current object list inclusively between indexes fromIndex and toIndex. For example, if I had list consisting of 3 5 7 9 11 20 23 and I called subList(0,3), I should get a new list of 3 5 7 9 returned. I am using helper methods to assist in writing the method. My logic in writing this method is that I assign the head node to to be the node at index fromIndex while assigning the last node in the list to the node at index toIndex, but nothing gets returned. Any help is appreciated! EDIT: I am created an add method that that adds nodes to a list. I am still trying to write my own subList method to work. EDIT2: I have updated some codes, which can be seen at the bottom (disregard older ones above). The fromIndex and toIndex are inclusive in the new sublist. private class Node&lt;N extends Comparable&lt;N&gt;&gt; { private N data; private Node&lt;N&gt; next; } private Node&lt;L&gt; head; public List() { head=null; } public void add(Node&lt;L&gt; node) { Node&lt;L&gt; add = new Node&lt;L&gt;(); add.data = node.data; add.next = null; getFinal().next = add; } public Node&lt;L&gt; getFinal(){ Node&lt;L&gt; node = head; while (node.next != null) { node = node.next; } return node; } public int size() { if (head == null) return 0; int counter = 0; for (Node&lt;L&gt; curr = head; curr != null; curr = curr.next) counter++; return counter; } public List&lt;L&gt; subList(int fromIndex, int toIndex) throws IndexOutOfBoundsException { List&lt;L&gt; n=new List&lt;L&gt;(); Node&lt;L&gt; tail= new Node&lt;L&gt;(); n.head=nthItem(fromIndex); tail=n.getFinal(); tail=nthItem(toIndex); return n; } public Node&lt;L&gt; nthItem(int index) { if (index &lt; 0 || index &gt;= size()) throw new IndexOutOfBoundsException(); Node&lt;L&gt; ptr = head; int i = 0; while (ptr != null) { if (i == index) return ptr; i++; ptr = ptr.next; } throw new IndexOutOfBoundsException(); } updated code private void add(Node&lt;L&gt; nod…
has answer: http://stackoverflow.com/a/26383647
favorite count: 0
has answer: http://stackoverflow.com/a/26383649
tagged with: sublist
answer count: 4
type: UnansweredQuestion
has title: linked list sublist method-java
score: 2
tagged with: linked-list
downvote count: 0
has answer: http://stackoverflow.com/a/57765497
has answer: http://stackoverflow.com/a/26383648
tagged with: java
tagged with: nodes

http://stackoverflow.com/q/26411379
has comment: http://stackoverflow.com/comment/41472522
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41470759
has comment: http://stackoverflow.com/comment/41471094
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41472211
has comment: http://stackoverflow.com/comment/41470872
tagged with: gson
has comment: http://stackoverflow.com/comment/41475066
has title: JodaTime LocalDate/LocalTime not Parsing with custom JSON Serializer classes
type: Question
has answer: http://stackoverflow.com/a/26600045
tagged with: jodatime
answer count: 2
has comment: http://stackoverflow.com/comment/41470798
upvote count: 2
has comment: http://stackoverflow.com/comment/41472174
linked to: http://stackoverflow.com/q/26287074
has comment: http://stackoverflow.com/comment/41475101
has comment: http://stackoverflow.com/comment/41475163
has comment: http://stackoverflow.com/comment/41474913
tagged with: android
has comment: http://stackoverflow.com/comment/41475195
has body: I have an object called ReportEvent which takes in a LocalTime as well as a LocalDate from the JodaTime API/framework. This ReportEvent is able to be written to JSON via google's GSON conversion API. However when deserializing the JodaTime partial causes problems. Logcat Error Report: 10-16 13:23:01.812: E/AndroidRuntime(8884): FATAL EXCEPTION: main 10-16 13:23:01.812: E/AndroidRuntime(8884): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nanospark.cnc/com.nanospark.cnc.MainActivity}: java.lang.IllegalArgumentException: Invalid format: "{"iChronology":{"iBase":{"iMinDa..." 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.app.ActivityThread.access$600(ActivityThread.java:141) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.os.Handler.dispatchMessage(Handler.java:99) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.os.Looper.loop(Looper.java:137) 10-16 13:23:01.812: E/AndroidRuntime(8884): at android.app.ActivityThread.main(ActivityThread.java:5103) 10-16 13:23:01.812: E/AndroidRuntime(8884): at java.lang.reflect.Method.invokeNative(Native Method) 10-16 13:23:01.812: E/AndroidRuntime(8884): at java.lang.reflect.Method.invoke(Method.java:525) 10-16 13:23:01.812: E/AndroidRuntime(8884): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 10-16 13:23:01.812: E/AndroidRuntime(8884): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-16 13:23:01.812: E/AndroidRuntime(8884): at dalvik.system.NativeStart.main(Native Method) 10-16 13:23:01.812: E/AndroidRuntime(8884): Caused by: java.lang.IllegalArgumentException: Invalid format: "{"iC…
favorite count: 0
has comment: http://stackoverflow.com/comment/41471062
possible better answer: http://stackoverflow.com/a/26600045
has comment: http://stackoverflow.com/comment/41472803
has comment: http://stackoverflow.com/comment/41475273
has comment: http://stackoverflow.com/comment/41472660
has answer: http://stackoverflow.com/a/26413604
has comment: http://stackoverflow.com/comment/41472910
accepted answer: http://stackoverflow.com/a/26413604
has comment: http://stackoverflow.com/comment/41472708
has comment: http://stackoverflow.com/comment/41474844

http://stackoverflow.com/comment/41452039
has text: The command IntelliJ uses to run the project is displayed on the first line in the Run tab (it is collapsed by default) when you run the project. Is that what you need?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26400893

http://stackoverflow.com/comment/41533598
comment on: http://stackoverflow.com/a/26445492
score: 0
type: AnswerComment
type: Comment
has text: What would (1 + 1) % 10 return?

http://stackoverflow.com/a/26498179
answers question: http://stackoverflow.com/q/26497975
type: Answer
has comment: http://stackoverflow.com/comment/41656164
has comment: http://stackoverflow.com/comment/41657612
has body: You can call with -new-tab option: firefox.exe -new-tab www.google.com Reference: https://developer.mozilla.org/en-US/docs/Mozilla/Command_Line_Options
has comment: http://stackoverflow.com/comment/41658404
has comment: http://stackoverflow.com/comment/41652489
score: 0

http://stackoverflow.com/comment/111499223
comment on: http://stackoverflow.com/a/63048192
score: 0
has text: Sure, but i think it's self explainatory
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26384622
tagged with: continuous-integration
tagged with: automated-tests
has answer: http://stackoverflow.com/a/26386233
has body: We have a big multi module maven project, wich uses cargo to start a tomcat with some wars, a plugin to insert sql data in a postgres database and then using cucumber we run the integration test suit. I was reading a lot about Docker, and I could play around with it. So here my question, Can Docker replace my integration test that uses cargo? What are the benefits? What about the performance in comparison with the deploy using cargo? Could a suite that starts containers with postgres and tomcat images improve the build time? Hope someone can help me here cause I'm pretty exited about docker!
answer count: 1
favorite count: 0
tagged with: docker
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: maven
type: Question
has title: Java Maven Project Docker Integration Tests
tagged with: java
upvote count: 2

http://stackoverflow.com/comment/41439461
score: 0
comment on: http://stackoverflow.com/q/26392299
type: Comment
type: QuestionComment
has text: Hi there; I looked into making some Regex code based on @ChrisS example, however I agree with Matt that using Regex's is hard with addresses. You might want to use something else.

http://stackoverflow.com/comment/41528158
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26442382
has text: Your first question can be answered by answering your second question. Your second question can be answered by inspecting the value. There is nothing useful here.
type: Comment

http://stackoverflow.com/q/26398393
tagged with: search
has comment: http://stackoverflow.com/comment/41449641
has title: Nested ArrayList Object and Binary Search
score: 0
has answer: http://stackoverflow.com/a/26398574
answer count: 1
has comment: http://stackoverflow.com/comment/41447746
has comment: http://stackoverflow.com/comment/41447805
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41448165
accepted answer: http://stackoverflow.com/a/26398574
type: AnsweredQuestion
tagged with: binary
has body: If I have an ArrayList of an object that also contains another ArrayList as an element how can I declare it and initialize it at once and also how can I use binarysearch. What I'm trying to do is initialize on 1 line without having to declare an arrayList of type obj2 and storing int on another variable. For the binary search I'm over my head on that one. import java.util.*; public class nested{ public static void main(String[] args) { //im thinking something like this ArrayList&lt;obj1&gt; ex1 = new ArrayList&lt;&gt;(); ex1.add(new obj1("exa1","exb1", new ArrayList&lt;obj2&gt; ) //this are giving me errors ex1.add(new obj1("exa2","exb2", new ArrayList&lt;obj2&gt; ) ex1.add(new obj1("exa3","exb3", new ArrayList&lt;obj2&gt; ) Collections.sort(ex1); int a = Collections.binarySearch(ex1,new obj1("exa1",null, new ArrayList&lt;obj2&gt;)) ; } //obj1 class with 2 string elements and 1 arraylist of type obj2 public class obj1 implements Comparable { String a; String b; ArrayList&lt;obj2&gt; myobj2 public obj1(String a, String b, ArrayList&lt;obj2&gt; myobj2) { this.a = a; this.b = b; this.myobj2 = myobj2; } public String geta(){return a;} public String getb(){return b;} public ArrayList&lt;obj2&gt; getmyobj2(){return myobj2;} public int compareTo(Object anB) { return getb().compareTo(((obj1)anB).getb()); } } //obj2 class that stores a string public class obj2 implements Comparable { String c; public obj2(String c) { this.c = c; } public String getc(){return c;} public int compareTo(Object myC) { return getc().compareTo(((obj2)myC).getc()); } } public class Acomparator implements Comparator&lt;obj1&gt; { public int compare(obj1 o1, obj1 o2) { return o1.geta().compareto(o2.geta(); } }
has comment: http://stackoverflow.com/comment/41448095
type: Question
has comment: http://stackoverflow.com/comment/41448245
has comment: http://stackoverflow.com/comment/41448398
tagged with: java

http://stackoverflow.com/comment/41511528
type: Comment
comment on: http://stackoverflow.com/q/26433351
has text: Press VK_SHIFT, press VK_4, release in reverse order ;)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41565754
has text: Please read this: http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26463545
score: 0

http://stackoverflow.com/a/31154402
downvote count: 0
answers question: http://stackoverflow.com/q/26448717
has comment: http://stackoverflow.com/comment/79037134
has comment: http://stackoverflow.com/comment/64228785
has comment: http://stackoverflow.com/comment/53896244
has body: I had to add a footer to my RecyclerView and here I'm sharing my code snippet as I thought it might be useful. Please check the comments inside the code for better understanding of the overall flow. import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import java.util.ArrayList; public class RecyclerViewWithFooterAdapter extends RecyclerView.Adapter&lt;RecyclerView.ViewHolder&gt; { private static final int FOOTER_VIEW = 1; private ArrayList&lt;String&gt; data; // Take any list that matches your requirement. private Context context; // Define a constructor public RecyclerViewWithFooterAdapter(Context context, ArrayList&lt;String&gt; data) { this.context = context; this.data = data; } // Define a ViewHolder for Footer view public class FooterViewHolder extends ViewHolder { public FooterViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Do whatever you want on clicking the item } }); } } // Now define the ViewHolder for Normal list item public class NormalViewHolder extends ViewHolder { public NormalViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Do whatever you want on clicking the normal items } }); } } // And now in onCreateViewHolder you have to pass the correct view // while populating the list item. @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v; if (viewType == FOOTER_VIEW) { v = LayoutInflater.from(context).inflate(R.layout.list_item_footer, parent, false); FooterViewHolder vh = new FooterViewHolder(v); return vh; } v = LayoutInflater.from(context).inflate(R.layout.list_item_normal, parent, false); NormalViewHolder vh = new NormalViewHolder(v); return vh; } // Now bind the ViewHolder in onBindViewHolder …
upvote count: 129
has comment: http://stackoverflow.com/comment/64232502
has comment: http://stackoverflow.com/comment/64712998
has comment: http://stackoverflow.com/comment/98586034
type: AcceptedAnswer
score: 129
has comment: http://stackoverflow.com/comment/79051964
type: Answer
accepted answer of: http://stackoverflow.com/q/26448717
has comment: http://stackoverflow.com/comment/64694463
has comment: http://stackoverflow.com/comment/79044098

http://stackoverflow.com/comment/41599995
type: AnswerComment
has text: I added some code to the question in response to this, though I think I've misunderstood.
type: Comment
comment on: http://stackoverflow.com/a/26474874
score: 0

http://stackoverflow.com/a/26770679
answers question: http://stackoverflow.com/q/26472041
score: 0
has body: I ended up just editing Guice, it was the quickest way to get the results that I knew of. JProfiler would of came in handy. Thanks
type: Answer

xss
tags question: http://stackoverflow.com/q/26398763
type: Tag
tag name: xss

http://stackoverflow.com/q/26418255
has comment: http://stackoverflow.com/comment/41484007
type: Question
accepted answer: http://stackoverflow.com/a/26418904
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41483502
has comment: http://stackoverflow.com/comment/41483741
has comment: http://stackoverflow.com/comment/41483558
has body: I am working with xBaseJ and in compilation I am not getting an error but while in compilation I am getting warnings like the following: log4j:WARN No appenders could be found for logger (org.xBaseJ.Util). log4j:WARN Please initialize the log4j system properly. I reffered a lot. All of them saying about IDEs Eclipse and all. I dont use IDE, I am using notepad. What change I need to do to avoid this? Please help guys?? Dont mark this us duplicate please help.
has comment: http://stackoverflow.com/comment/41483888
has title: log4j warning in xbasej integration
has answer: http://stackoverflow.com/a/26418904
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41484044
has comment: http://stackoverflow.com/comment/41483588
tagged with: log4j

http://stackoverflow.com/q/26392883
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26392937
has answer: http://stackoverflow.com/a/26392935
tagged with: while-loop
type: UnansweredQuestion
has body: I tried to create a simple program that finds all divisors of a number. I was instructed to store every divisor into a string and use a while loop. I don't know why, but my program does not run. It compiles without errors, but gives no output. import static java.lang.System.*; public class Divisors { public static String getDivisors( int number ) { String divisors=""; int n=1; while(n &lt; number) { if (number % n==0) { divisors +=" "+ n; } } return number+ " has divisors:"+ divisors; } } Here is my tester class: import static java.lang.System.*; public class Lab09f { public static void main( String args[] ) { Divisors d = new Divisors(); out.println(d.getDivisors(10)); out.println(d.getDivisors(45)); out.println(d.getDivisors(14)); out.println(d.getDivisors(1024)); out.println(d.getDivisors(1245)); out.println(d.getDivisors(33)); out.println(d.getDivisors(65535)); } }
has comment: http://stackoverflow.com/comment/41438533
has title: Finding factors of integers
type: Question
has comment: http://stackoverflow.com/comment/41442876

http://stackoverflow.com/comment/91361792
type: QuestionComment
has text: hi @edmond, were you able to resolve this finally? we are facing something similar at the moment, on WildFly 10.1
comment on: http://stackoverflow.com/q/26402452
type: Comment
score: 0

http://stackoverflow.com/q/26478386
has answer: http://stackoverflow.com/a/26478685
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41673294
type: Question
has answer: http://stackoverflow.com/a/26478941
tagged with: text-manipulation
answer count: 2
has title: Print uppercase/lowercase and reverse from input to output using a Thread
type: UnansweredQuestion
tagged with: multithreading
has body: I'm trying to read each line from input.txt and print each line so each letter in the input line turns uppercase if it is lowercase, and turns lowercase if it is uppercase. Additionally, I'd like to use a Thread to do this, as I'd also like to print the reverse of each line also. I get an error for printUppLow uppLow = new printUppLow(); and printRev rev = new printRev(); non-static variable this cannot be referenced from a static context. Code public static void main(String args[]) { String inputfileName="input.txt"; // A file with some text in it String outputfileName="output.txt"; // File created by this program String oneLine; try { // Open the input file FileReader fr = new FileReader(inputfileName); BufferedReader br = new BufferedReader(fr); // Create the output file FileWriter fw = new FileWriter(outputfileName); BufferedWriter bw = new BufferedWriter(fw); printRev rev = new printRev(); printUppLow uppLow = new printUppLow(); rev.start(); uppLow.start(); // Read the first line oneLine = br.readLine(); while (oneLine != null) { // Until the line is not empty (will be when you reach End of file) // Print characters from input file System.out.println(oneLine); bw.newLine(); // Read next line oneLine = br.readLine(); } // Close the streams br.close(); bw.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } public class printUppLow extends Thread { public void run(String str) { String result = ""; for (char c : str.toCharArray()) { if (Character.isUpperCase(c)){ result += Character.toLowerCase(c); // Convert uppercase to lowercase } else{ result += Character.toUpperCase(c); // Convert lowercase to uppercase } } return result; // Return the result } } public class printRev extends Thread { public void run() { StringBuffer a = new StringBuffer("input.txt"); System.out.println(a.reverse()); } }

http://stackoverflow.com/q/26413608
possible better answer: http://stackoverflow.com/a/26413641
has answer: http://stackoverflow.com/a/26413641
has comment: http://stackoverflow.com/comment/41475459
has comment: http://stackoverflow.com/comment/41475455
favorite count: 0
has comment: http://stackoverflow.com/comment/41475484
accepted answer: http://stackoverflow.com/a/26413637
downvote count: 1
tagged with: indexing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41475425
has comment: http://stackoverflow.com/comment/41475399
tagged with: java
has answer: http://stackoverflow.com/a/26413707
score: -1
has answer: http://stackoverflow.com/a/26413775
has answer: http://stackoverflow.com/a/26416562
has title: Splitting a string into multiple int form using indexOf()
has comment: http://stackoverflow.com/comment/41475285
type: Question
has comment: http://stackoverflow.com/comment/41475223
has body: This is my first post so go easy on me. This IS a homework question, but I have spent about 7 hours working through various means to complete this goal and have had no success. I am building various methods for an assignment, and I need to figure out how to split a String into several int variables. Ex: given the String "100 200 300" I need to change it to three int of 100, 200, 300. I have to use indexOf(), and cannot use split() or arrays. String scores="100 200 300"; int n=scores.indexOf(" "); String sub=scores.substring(0,n); Integer.parseInt(sub); This lets me get the first string "100" and parse it. However, I do not know how to continue the code so it will get the next ones. For my method, I will need the new int variables for later arguments. EDIT: I think I need to use a for loop: something like: for(int i=0; i&lt;=scores.length; i++) {//I do not know what to put here}
upvote count: 0
has answer: http://stackoverflow.com/a/26413637
has comment: http://stackoverflow.com/comment/41476083
answer count: 6
tagged with: string
has comment: http://stackoverflow.com/comment/41476157
has answer: http://stackoverflow.com/a/26413929

http://stackoverflow.com/a/26474838
answers question: http://stackoverflow.com/q/26474782
upvote count: 2
has body: The order of a + b + c is that of (a + b) + c (left associativity).
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/41464566
comment on: http://stackoverflow.com/q/26407874
has text: You most likely have a character encoding problem. Which means, there could be a lot going on that is causing your problem. Setting the page encoding as @Superdrac suggests might help. But my recommendation is to check the character encoding at every step and make sure everything is lined up correctly. Lower probability at this point, but you could also be dealing with microsoft special characters.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26469102
has comment: http://stackoverflow.com/comment/41575957
answer count: 1
accepted answer: http://stackoverflow.com/a/26469181
has comment: http://stackoverflow.com/comment/41575897
has comment: http://stackoverflow.com/comment/41576073
type: AnsweredQuestion
tagged with: treeset
has comment: http://stackoverflow.com/comment/41575998
tagged with: java
has body: I have this peace of code: final SortedSet&lt;NisType&gt; lAllNNisType = new TreeSet&lt;NisType&gt;(new NisTypeComparator()); lAllNisType.addAll(pAllNisType); // where pAllNisType is of type ArrayList&lt;NisType&gt; thats my comparator class: private class NisTypeComparator implements Comparator&lt;NisType&gt; { @Override public int compare(NisType pNisType, NisType pNisType2) { if (pNisType.getPrio()&gt;pNisType2.getPrio()) return 1; else if (pNisType.getPrio()&lt;pNisType2.getPrio()) return -1; else return 0; } } My ArrayList pAllNisType is filled with 6 different objects(based on the equals and hashCode method). Nevertheless after this line was executed: lAllNisType.addAll(pAllNisType); lAllNisType contains only 5 objects. There is one comparison that returns 0. And as a result of this one object was removed from lAllNisType. I have no idear what happens here. The objects are different. If I do something like that: final Set&lt;NisType&gt; lAllNisType = new HashSet&lt;NisType&gt;(pAllNisType); lAllNisType has 6 elements. Thanks for your help Stefan
has title: Elements removed after execute Comparator in TreeSet
has comment: http://stackoverflow.com/comment/41576022
has answer: http://stackoverflow.com/a/26469181
type: Question
has comment: http://stackoverflow.com/comment/41575975
tagged with: comparator
score: 0

http://stackoverflow.com/q/26482779
answer count: 2
tagged with: bytearrayoutputstream
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/35802870
has title: compress file with Java ByteArrayOutputstream
has answer: http://stackoverflow.com/a/26482967
type: UnansweredQuestion
tagged with: compression
downvote count: 1
tagged with: java
score: -1
type: Question
has body: I am trying to compress file with Java ByteArrayOutputstream,but I failed.If I change the ouputstream to FileOutput stream,it can work.What should I do to make it work?and why? Here is my code(Sorrry,my english is so poor): import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.Charset; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import org.apache.commons.io.FileUtils; public class ZipOutputStreamTest { public static void main(String args[]) throws IOException { test1(); test2(); } /*this failed, the exported file can't be open*/ public static void test1() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream zos = genZip(baos); byte[] bytes = baos.toByteArray(); FileUtils.writeByteArrayToFile(new File("d:\\test1.zip"), bytes); FileOutputStream fos = new FileOutputStream(new File("d:\\test1.zip")); for(byte b : bytes){ fos.write(b); } fos.close(); zos.close(); baos.close(); } /*this can work*/ public static void test2() throws IOException { FileOutputStream fileOutputStream = new FileOutputStream("d:\\test2.zip"); ZipOutputStream zos = genZip(fileOutputStream); zos.close(); fileOutputStream.close(); } public static ZipOutputStream genZip(OutputStream os) throws IOException{ ZipOutputStream zos = new ZipOutputStream(os, Charset.forName("gbk")); for(int i=0;i&lt;5;i++){ ZipEntry entry = new ZipEntry("ab"+i+".txt"); zos.putNextEntry(entry); zos.write("中文asaf".getBytes()); zos.closeEntry(); } return zos; } } Thanks!

http://stackoverflow.com/comment/41561359
comment on: http://stackoverflow.com/q/26460974
score: 0
type: Comment
type: QuestionComment
has text: This has to be possible with java. Saw an implementation in Java 6 but Oracle changed a lot. I tried to rebuild it, but I failed. So I cannot be the only one who need´s this.

http://stackoverflow.com/a/26434916
answers question: http://stackoverflow.com/q/26434875
upvote count: 2
type: Answer
has body: You forgot to initialize the alertTime variable in the receiving activity. public Date alertTime = new Date();
has comment: http://stackoverflow.com/comment/41540124
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26434875

http://stackoverflow.com/comment/41455346
type: QuestionComment
comment on: http://stackoverflow.com/q/26403105
has text: You are sorting a `Collection`, not an array. Try `Collections.sort()` instead of `Arrays.sort()`.
score: 1
type: Comment

http://stackoverflow.com/comment/41566483
has text: *"... but I've never seen any official confirmation for that."* - Not surprising. I don't think is is true. In Java 7 and earlier, the Old generation and Permgen were separate. And in Java 8 and onwards, permgen is replaced with the "metaspace"
comment on: http://stackoverflow.com/a/26462943
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41565195
has text: use replace('\\|','.')
type: QuestionComment
comment on: http://stackoverflow.com/q/26463381
score: 0
type: Comment

http://stackoverflow.com/a/26417389
answers question: http://stackoverflow.com/q/26391938
has body: You need to call #setContentView(R.layout.whatever_your_layout_is_called); prior to looking for View resources from the layout.
has comment: http://stackoverflow.com/comment/41524692
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26391938

http://stackoverflow.com/q/26394957
tagged with: arrays
downvote count: 0
has title: Recursion (done)
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26395086
upvote count: 2
has answer: http://stackoverflow.com/a/26411681
tagged with: recursion
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26411681
has body: I wrote this path finding algorithm that should be working, but I'm getting tons of java.lang.ArrayIndexOutOfBoundsException. The goal of the program is to find the shortest path from one point to another that costs the least. Here's my code: public boolean travel(int[][] path, int cX, int cY, int eX, int eY) { boolean returned = false; System.out.println("the current X position on the GRID is: "+cX+"the current y position on the GRID is: "+cY); path[cX][cY]=1; if(cost&gt;lowestCost - grid[cX][cY]){ return false; } cost += grid[cX][cY]; if(cX&gt;=eX &amp;&amp; cY&gt;=eY){ return true; } if(cX+1&gt;=eX &amp;&amp; cY+1&lt;eY){ return false; } if(cY+1&gt;=eY &amp;&amp; cX+1&lt;eX){ return false; } if(travel(path,cX+1,cY+1,eX,eY)==true){ returned=true; replace(newBest, path); } if(travel(path,cX,cY+1,eX,eY)==true){ returned=true; replace(newBest, path); } if(travel(path,cX+1,cY,eX,eY)==true){ returned=true; replace(newBest, path); } return(returned); } cX is the current X position in the array, cY is the current Y position in the array, eX and eY are the destination coordinates. path[][] is the array used to store the path. If you have any answers please tell me! also don't suggest any other algorithms, just some edits to the actual code. grid[][] is the array that stores the cost to go from one to another. Thanks very much if(travel(newBest,0,0,rows,columns)==true) { lowestCost=cost; } This is how I call the method to find the shortest path. This is the entire applet: import java.applet.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class GridWorld extends Applet implements Runnable, MouseListener, KeyListener, MouseMotionListener { public int worldx; public int worldy; public int columns; public int rows; public int destX, destY; public int cost, lowestCost; public boolean sizeD; public int[][] grid; public int[][] prevBest; public int[][] newBest; Graphics bufferGraphics; //Set up double buffer Image offscreen; Thread thread;//Sets up a Thr…
has comment: http://stackoverflow.com/comment/41479366
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/41479468
type: Question
possible better answer: http://stackoverflow.com/a/26395788
has answer: http://stackoverflow.com/a/26395788

http://stackoverflow.com/comment/41577310
type: QuestionComment
has text: Oh, wait, I may be wrong. Check dynamic JAXB: http://docs.oracle.com/middleware/1212/toplink/TLJAX/dynamic_jaxb.htm But I don't have experience with this, sorry.
comment on: http://stackoverflow.com/q/26468894
score: 0
type: Comment

http://stackoverflow.com/comment/41562345
has text: @DanM Setting the width of the table (`table.setWidth("1000px"`) actually helped. You can submit your recommendations as an answer and then I'll accept it and give you the bounty.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26367565

http://stackoverflow.com/a/26436174
has comment: http://stackoverflow.com/comment/41516962
score: 0
answers question: http://stackoverflow.com/q/26436080
type: Answer
has comment: http://stackoverflow.com/comment/41516952
has body: Not sure what you want to explain because your snippet is not actually a jsp code but it is javascript function. Regarding jsp implementation in android is, JSP can't be implemented in Android. As JSP is build up using scriptlets and scripting tags which is deployed on server only. Server renders that jsp page whenever any request from client came. As a result it will convert data to pure HTML code and server to requester. So, that is not at all possible to do on mobile. But yes, if you want pure HTML to be display on android that can be possible using Web components of android. You can ajax call (in a way services) to server through it, get result (XML or JSON response), and render it back to your required view using JQuery or pure Javascript.

http://stackoverflow.com/comment/41656761
comment on: http://stackoverflow.com/a/26513352
type: AnswerComment
type: Comment
has text: If you share the object between threads - yes, it will definitely create more problems (nothing you can't solve with a proper locking mechanism, but it'll take some work - without seeing the actual code it's hard to say if it will be worth the hassle or not)
score: 1

http://stackoverflow.com/comment/41441503
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26394674
has text: I don't want to use deprecated methods.
type: AnswerComment

http://stackoverflow.com/a/26398176
has comment: http://stackoverflow.com/comment/41643606
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/41455244
has comment: http://stackoverflow.com/comment/41647120
upvote count: 1
has comment: http://stackoverflow.com/comment/41652681
has comment: http://stackoverflow.com/comment/43300963
answers question: http://stackoverflow.com/q/26367986
has body: You can do this only programatically. But if you want to do this using xml, you have to add the background image in a layout above the rounded corner layout with the help of Relative layout and set margin. This will not give a perfect solution but will solve your problem. The first is the XML way Create an xml file in your respective drawable folder for the round border. I have namedd it as popupborder.xml. <?xml version="1.0" encoding="utf-8"?> <solid android:color="#FFFFFF" /> <stroke android:width="2dp" /> <corners android:radius="15dip" /> The main layout <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Inner view with Background and margin" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#000000" />
downvote count: 0

http://stackoverflow.com/a/26391459
type: Answer
answers question: http://stackoverflow.com/q/26386422
score: 2
upvote count: 2
downvote count: 0
has body: The first thought you might have is to paint the image within the paintComponent method of the text area, while this might seem to work, once you start trying to type text, you'll find that, what is suppose to be the background image, is actually a foreground image and paints over the text. Okay, so, you could paint the image first and then call super.paintComponent after it, but the background color is actually painted as part of the paintComponent call... What you need to do, is trick the component into not painting the background color. The simplest solution would be to make the component transparent, for example... public class CustomTextArea extends JTextArea { private BufferedImage image; public CustomTextArea() { super(20, 20); setOpaque(false); try { image = ImageIO.read(new File("...")); } catch (IOException ex) { ex.printStackTrace(); } } @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setColor(getBackground()); g2d.fillRect(0, 0, getWidth(), getHeight()); if (image != null) { int x = getWidth() - image.getWidth(); int y = getHeight() - image.getHeight(); g2d.drawImage(image, x, y, this); } super.paintComponent(g2d); g2d.dispose(); } } This is based on this Inserting an image under a JTextArea answer Another option would be to render the image within the scrollPane, this gives you options on how you want to control the scrolling of the image (with the component or sticky), for example see Add background image in JTable

http://stackoverflow.com/q/26409243
has comment: http://stackoverflow.com/comment/41467195
has comment: http://stackoverflow.com/comment/41467182
tagged with: bigdecimal
duplicate of: http://stackoverflow.com/q/14772323
has comment: http://stackoverflow.com/comment/41467361
has title: Convert BigDecimal to String with no trailing zeros
answer count: 1
downvote count: 0
has body: I want to remove all trailing zeros from a BigDecimal and print it. But the trailingZeros method is not working as (I) expected. BigDecimal a = new BigDecimal("-11111111111111111111111111111111111111.111111111111111111111111111111"); BigDecimal b = new BigDecimal("11111111111111111111111111111111111111.111111111111111111111111111111"); BigDecimal c = a.add(b); System.out.println(c); System.out.println(c.toPlainString()); c = c.stripTrailingZeros(); System.out.println(c); System.out.println(c.toPlainString()); The output of this code is: 0E-30 0.000000000000000000000000000000 0E-30 0.000000000000000000000000000000 I would like a result of "0".
score: 1
has answer: http://stackoverflow.com/a/26409318
favorite count: 0
has comment: http://stackoverflow.com/comment/41467284
has comment: http://stackoverflow.com/comment/41467216
type: UnansweredQuestion
tagged with: string-formatting
tagged with: java
has comment: http://stackoverflow.com/comment/41467036
upvote count: 1
linked to: http://stackoverflow.com/q/14772323
type: Question
has comment: http://stackoverflow.com/comment/41467035

http://stackoverflow.com/a/26625146
type: AcceptedAnswer
type: Answer
has body: The problem was within the HTTP import internal component (was using SSL as a hardcoded configuration) so I wrote my own HTTP client in a custom Java and called it a day. No fix pack at that moment.
accepted answer of: http://stackoverflow.com/q/26508597
score: 0
answers question: http://stackoverflow.com/q/26508597

http://stackoverflow.com/comment/41382738
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26362441
has text: Same logic would apply regardless. I know its possible via indexof, as stated but wanted to know if there a neater way to do it. Guess there is not :s

http://stackoverflow.com/comment/41537639
score: 0
type: AnswerComment
has text: create hashmap in which each touch user will be recieved and befor drawing on the screen just check if these points exist in the hashmap already
type: Comment
comment on: http://stackoverflow.com/a/26447688

http://stackoverflow.com/comment/41622500
score: 5
type: Comment
has text: Where's the "method chaining" that you refer to in your title? That term is usually used to mean code such as `foo().bar().baz()`.
comment on: http://stackoverflow.com/q/26494578
type: QuestionComment

http://stackoverflow.com/comment/41391791
comment on: http://stackoverflow.com/a/26366917
has text: We really should start working together.. But anyway, have a look at [LZWDecoder.java](https://github.com/haraldk/TwelveMonkeys/blob/master/imageio/imageio-tiff/src/main/java/com/twelvemonkeys/imageio/plugins/tiff/LZWDecoder.java), it has a compatibility mode that kicks in when 0x00, 0x01 is discovered. It would really have been useful with more sample files, to see if that implementation is indeed correct. But then again... That's what we got.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41667513
type: Comment
comment on: http://stackoverflow.com/a/26510013
type: AnswerComment
score: 0
has text: OK, I tested this.. I cannot use `@Autowired @Lazy` with Spring 3, but I can with Spring 4 - and it works perfectly. I also took the time to work out how to use `javax.inject.Inject` and `javax.inject.Provider` as [Tom's Blog](http://zezutom.blogspot.com.au/2014/01/spring-series-part-4-lazy-on-injection.html) described, but it just takes way too much extra code because I would have to write a `Provider` type for every single web driver because they are each different classes.

http://stackoverflow.com/comment/41638659
has text: I don't think it should be inside the servlet. You should probably have a singleton instance of a bean which contains this data, which can be injected into any service that needs it. The bean itself would need the data source injecting into it so it can read from it when it's constructed. If you look at your injection framework for how it constructs singletons you may find the answer drops out.
score: 0
comment on: http://stackoverflow.com/q/26503325
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41647029
comment on: http://stackoverflow.com/q/26508225
score: 0
has text: @JonSkeet You appear to be correct! Might want to put that as an answer rather than comment :)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26378999
linked to: http://stackoverflow.com/q/8153227
tagged with: video
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26379201
type: Question
tagged with: java
tagged with: javafx
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/16756809
has body: I need to play the 3gp, mov and mp4 videos in the media player. Right now I am using JavaFx media player but it supports only mp4 videos. So what I can do to play the other two formats as well in this player or is there any other solution also available for this. Any help and suggestions please? jdk = 1.7 JavaFx: 2.1
has answer: http://stackoverflow.com/a/26379280
tagged with: media-player
has title: JavaFX : MediaException: MEDIA_UNSUPPORTED : media type not supported

http://stackoverflow.com/q/26407917
downvote count: 0
tagged with: global
tagged with: uncaughtexceptionhandler
has comment: http://stackoverflow.com/comment/41469097
has answer: http://stackoverflow.com/a/26414255
has comment: http://stackoverflow.com/comment/41469179
has comment: http://stackoverflow.com/comment/41475726
has comment: http://stackoverflow.com/comment/41464996
has title: Visibility in Java global exception handler
favorite count: 0
has comment: http://stackoverflow.com/comment/41471664
upvote count: 2
tagged with: exception
has comment: http://stackoverflow.com/comment/41465043
has comment: http://stackoverflow.com/comment/41473295
score: 2
type: AnsweredQuestion
has body: I'm writing a program in Java that will allow a person to input data into a form as jobs for a help desk. The submitted form is then used to create a helpRequest object which is entered into a generic Queue for storage in a binary file. However, the onus of the project (it's a school assignment) is to make the program failsoft using exceptions. One specific stipulation of the program is that it must handle any situation where it cannot continue by attempting to save the current helpRequest queue before terminating "gracefully". I've got all of this set up in code, but when the handler runs (by a division by zero in my test), the program hangs as soon as it tries to do anything with the helpQueue. I've tried looking up Java global variables and global exception handlers, but nothing seems to address the topic of using a structure or variable from another/the throwing class. Here is the code for the handler. I have helpQueue declared as public and static in the throwing class HelpDeskForm, and NetBeans accepts all the code I have here. The induced exception occurs after the queue has been worked with. public class GlobalExceptionHandler implements Thread.UncaughtExceptionHandler { BinaryOutputFile emergencyOutput; public void uncaughtException(Thread t, Throwable e) { Frame f = new Frame(); JOptionPane.showMessageDialog(f, "Program error. Please select a file for queue output."); emergencyOutput = new BinaryOutputFile(); while(!HelpDeskForm.helpQueue.isEmpty()) emergencyOutput.writeObject(HelpDeskForm.helpQueue.remove()); emergencyOutput.close(); System.exit(1); } } Rather than a specific solution to my issue, I'd appreciate it if someone could explain why helpQueue is seemingly not actually visible/usable in this exception handler, or what I'm doing horribly wrong. EDIT: I didn't want to overcomplicate my explanation, but here is the HelpDeskForm code up until my division by zero exception. public class HelpDeskForm { BinaryDataFile input; BinaryOutputFile output; Ch…
has comment: http://stackoverflow.com/comment/41471767
tagged with: java
has comment: http://stackoverflow.com/comment/41465097
linked to: http://stackoverflow.com/q/7240872
has comment: http://stackoverflow.com/comment/41465019
type: Question
has comment: http://stackoverflow.com/comment/41473450
has comment: http://stackoverflow.com/comment/41465826
has comment: http://stackoverflow.com/comment/41473279
accepted answer: http://stackoverflow.com/a/26414255
has comment: http://stackoverflow.com/comment/41469057
has comment: http://stackoverflow.com/comment/41469564
has comment: http://stackoverflow.com/comment/41469090
tagged with: visibility
answer count: 1

http://stackoverflow.com/comment/41607802
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26485275
has text: Indeed, I used the wrong method, I edited my response
type: Comment

http://stackoverflow.com/q/26406090
upvote count: 1
has answer: http://stackoverflow.com/a/26406465
has comment: http://stackoverflow.com/comment/41461076
tagged with: java
has comment: http://stackoverflow.com/comment/41461465
type: Question
has comment: http://stackoverflow.com/comment/41461185
answer count: 2
has comment: http://stackoverflow.com/comment/41461326
has comment: http://stackoverflow.com/comment/41461377
has body: public class MainActivity extends Activity { TextView output; EditText month, day; Button compute; @Override protected void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_main); day = (EditText) findViewById(R.id.editText1); month = (EditText) findViewById(R.id.editText2); output = (TextView) findViewById(R.id.textView3); compute = (Button) findViewById(R.id.button1); compute.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub int x = 0, y = 0, result = 0; x = Integer.parseInt(month.getText().toString()); y = Integer.parseInt(day.getText().toString()); if (x == 1 &amp;&amp; y &lt;= 31) { result = 359 - y; output.setText(result + "Days Before Christmass"); } else if (x == 2 &amp;&amp; y &lt;= 28) { result = 328 - y; output.setText(result + "Days Before Christmass"); } else if (x == 3 &amp;&amp; y &lt;= 31) { result = 297 - y; output.setText(result + "Days Before Christmass"); } else if (x == 4 &amp;&amp; y &lt;= 30) { result = 267 - y; output.setText(result + "Days Before Christmass"); } else if (x == 5 &amp;&amp; y &lt;= 31) { result = 236 - y; output.setText(result + "Days Before Christmass"); } else if (x == 6 &amp;&amp; y &lt;= 30) { result = 206 - y; output.setText(result + "Days Before Christmass"); } else if (x == 7 &amp;&amp; y &lt;= 31) { result = 175 - y; output.setText(result + "Days Before Christmass"); } else if (x == 8 &amp;&amp; y &lt;= 31) { result = 144 - y; output.setText(result + "Days Before Christmass"); } else if (x == 9 &amp;&amp; y &lt;= 30) { result = 114 - y; output.setText(result + "Days Before Christmass"); } else if (x == 10 &amp;&amp; y &lt;= 31) { result = 83 - y; output.setText(result + "Days Before Christmass"); } else if (x == 11 &amp;&amp; y &lt;= 30) { result = 53 - y; output.setText(result + "Days Before Christmass"); } else if (x == 12 &amp;&amp; y &lt;= 31) { result = 22 - y; output.setText(result + "Days Before Christmass"); } } …
downvote count: 4
has title: program that accepts an integer value & computes the remaining days
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/26406428

http://stackoverflow.com/q/26509905
tagged with: java
has answer: http://stackoverflow.com/a/26510083
possible better answer: http://stackoverflow.com/a/26510423
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26510083
has title: how can I use mechanize python in java
tagged with: mechanize
has body: I have a question about mechanize for java, I downloaded from http://gistlabs.com/software/mechanize-for-java/ and I can't find the jar because I want to import in my java project, please help me, thanks
has answer: http://stackoverflow.com/a/26510423
type: AnsweredQuestion

http://stackoverflow.com/comment/41500977
has text: Now, even with the tablemodel set as DefaultTableModel, it does not show errors, yet no row is added, nor is there any red text when I press the button.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26427624

http://stackoverflow.com/comment/41453825
score: 2
has text: If the components not transparent, then 1- It will paint the default background color over the image and 2- It could painting issues, as Swing only knows how to deal with fully opaque or fully transparent components...
comment on: http://stackoverflow.com/a/26387689
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26461061
tagged with: java
has title: Read a particular value xml file and replace values in property file using ant
tagged with: ant
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26463755
tagged with: http://stackoverflow.com/tag/xml
type: Question
has body: Suppose I have an xml file like abc.xml which contains &lt;datasource name="localmysql"&gt; &lt;inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="url" jdbc-username="username" jdbc-password="password"/&gt; &lt;/datasource&gt; &lt;datasource name="localmysqlolap"&gt; &lt;inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="url1" jdbc-username="username1" jdbc-password="password1"/&gt; &lt;/datasource&gt; &lt;datasource name="localmysqltenant"&gt; &lt;inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="url2" jdbc-username="username2" jdbc-password="password2"/&gt; &lt;/datasource&gt; Now I want to read the values of jdbc-uri, jdbc-username, jdbc-password in node datasource name="localmysql" and change the values of a property file which also contains jdbc-uri, jdbc-username, jdbc-password as keys. Is there a way to do it using ant
answer count: 1
score: 0

http://stackoverflow.com/q/26502528
has comment: http://stackoverflow.com/comment/41637937
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26503148
has comment: http://stackoverflow.com/comment/41636991
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41638180
linked to: http://stackoverflow.com/q/26490567
has body: In a previous question -> my question here i received a good solution (which works) to resolve my issue. But i haven't understand how exactly works. So if i have many threads that can enter concurrently on this synchronized block, and according to the java docs this code is: synchronized(...){ //atomic for the operation inside } So, i' m asking: why this operation is atomic: for (int j = 0; j &lt; column; j++) { matrix[row][j] += 1; } and not this one: System.out.println("begin print"); for (int i = 0; i &lt; this.row; i++) { System.out.println(); for (int j = 0; j &lt; column; j++) System.out.print(matrix[i][j]); } System.out.println(); System.out.println("end print"); my full function is this: public void increaseRow(Integer row) { synchronized (rows.get(row)) { for (int j = 0; j &lt; column; j++) { matrix[row][j] += 1; } System.out.println("begin print"); for (int i = 0; i &lt; this.row; i++) { System.out.println(); for (int j = 0; j &lt; column; j++) System.out.print(matrix[i][j]); } System.out.println(); System.out.println("end print"); } } Could someone provide me a useful explanation, i'll appreciate a lot.
has comment: http://stackoverflow.com/comment/41637032
has title: synchronize on multiple objects
tagged with: multithreading
has answer: http://stackoverflow.com/a/26503148
has comment: http://stackoverflow.com/comment/41636909
has comment: http://stackoverflow.com/comment/41637975
has comment: http://stackoverflow.com/comment/41638346
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41637845
upvote count: 3
possible better answer: http://stackoverflow.com/a/26502969
tagged with: java
has comment: http://stackoverflow.com/comment/41637764
has answer: http://stackoverflow.com/a/26502969

http://stackoverflow.com/a/26440976
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26440929
type: Answer
score: 2
upvote count: 2
has body: This will query for the img element having src attribute equal to /srmswi/Captcha: page.getByXPath("//img[@src='/srmswi/Captcha']");
answers question: http://stackoverflow.com/q/26440929

http://stackoverflow.com/comment/41435617
has text: Since the text is painted as part of the call to super.paintComponent, then this would paint the image over the text. Also, paintComponent doesn't ever need to be public and the JComponent can act as the ImageObserver for the call to drawImage
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26387689
score: 2

http://stackoverflow.com/q/26513576
tagged with: match
accepted answer: http://stackoverflow.com/a/26513603
has body: given the following string: foo().bar(norf.qux).fubar() I want to split it by the dots except when they're within parentheses, where the output would be: foo() bar(norf.qux) fubar() is this possible?
has answer: http://stackoverflow.com/a/26513828
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41657363
possible better answer: http://stackoverflow.com/a/26513828
has answer: http://stackoverflow.com/a/26513603
linked to: http://stackoverflow.com/q/25293099
type: AnsweredQuestion
tagged with: regex
has title: Java Regex match a special character excpet when it is within parentheses
type: Question
has comment: http://stackoverflow.com/comment/41657016
answer count: 2

http://stackoverflow.com/a/26405586
downvote count: 0
has body: I found the problem. Spring conf was OK, but my tomcat was running behind apache2 and I forgot to inform apache2 to conserve cookies (using command ProxyPassReverseCookiePath)
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26393864
score: 1

http://stackoverflow.com/comment/41594753
comment on: http://stackoverflow.com/q/26479143
type: QuestionComment
score: 0
type: Comment
has text: Size = [`File#length`](http://docs.oracle.com/javase/7/docs/api/java/io/File.html#length()), last modified = [`File#lastModified`](http://docs.oracle.com/javase/7/docs/api/java/io/File.html#lastModified()) in milliseconds since the unix epoch, wrap it in a `java.util.Date` and format as you need to, name = [`File#getName`](http://docs.oracle.com/javase/7/docs/api/java/io/File.html#getName())

http://stackoverflow.com/a/26408692
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26408534
type: Answer
accepted answer of: http://stackoverflow.com/q/26408534
has body: The working set interface org.eclipse.ui.IWorkingSet is not related to the IResource interfaces. You could try a separate adapter manager call: IWorkingSet workingSet = (IWorkingSet)adapterManager.getAdapter(projectObg, IWorkingSet.class); IAdaptable [] elements = workingSet.getElements(); The elements in a working set can be projects but may be other things. Loop through the elements and check for instanceof IProject.
upvote count: 3
score: 3

http://stackoverflow.com/q/26396074
type: Question
has comment: http://stackoverflow.com/comment/41443952
has comment: http://stackoverflow.com/comment/41443851
has comment: http://stackoverflow.com/comment/41443710
has comment: http://stackoverflow.com/comment/41443731
score: 0
tagged with: jvm
has title: method pool in java
has comment: http://stackoverflow.com/comment/41443804
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41443853
has body: What is method pool? my assumption is method pool is used for multi threading concept. when more one thread while come and execute one method in a object, the jvm will automatically create more than one method through a pool concept, its dynamically grow by jvm, my assumption is write or wrong? please answer about that concept or will explain how this work? sudo code example: class A{ method(obj o){ //500 line code //bla bla //bla bla //bla bla //bla bla } } Run(){ A aa=new A(); aa.method(); } thread1().start(); thread2().start(); . . . . thread99().start(); there is 99 object will be create or 99 method create in a pool? this is my question please help me.
has comment: http://stackoverflow.com/comment/41443827
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41443759

http://stackoverflow.com/comment/41640117
type: Comment
has text: What is the content of $theData?
score: 0
comment on: http://stackoverflow.com/q/26504418
type: QuestionComment

http://stackoverflow.com/comment/41540920
comment on: http://stackoverflow.com/q/26449111
score: 0
type: Comment
type: QuestionComment
has text: It sounds like you have very precise requirements. It might help if you posted them.

nullable
tag name: nullable
tags question: http://stackoverflow.com/q/26377805
type: Tag

http://stackoverflow.com/comment/41557384
type: QuestionComment
has text: @John3136: That question is specifically about *static* fields. This one is about *non-static* fields. (As it happens, the answers are quite similar, but I wouldn't consider them to be duplicates, since the lack of the `static` modifier makes this question much more interesting.)
score: 0
comment on: http://stackoverflow.com/q/26458756
type: Comment

http://stackoverflow.com/q/26482900
has answer: http://stackoverflow.com/a/26561135
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26502487
tagged with: java
has body: I have this Java code (source): // Deserialize Person person = new Person(); InputStream in; XmlIOUtil.mergeFrom(in, person, Person.getSchema()); // Do stuff... // Serialize back into XML OutputStream out; XmlIOUtil.writeTo(out, person, Person.getSchema()); Let's say my XML code contains unknown fields, that not are in the schema (i.e. the XML provided is generated by a newer version of the software). Is there a nice, clean way to preserve these fields when I serialize them again? I know Protocol Buffers preserves unknown fields. One solution would be to copy the original XML into a buffer, then merge the newly serialized XML with the original, but that seems overly complicated.
type: Question
answer count: 2
has title: Preserve unknown fields using Protostuff
accepted answer: http://stackoverflow.com/a/26502487
score: 0
tagged with: protostuff
tagged with: protocol-buffers
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/26561135

http://stackoverflow.com/q/26507388
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/41646539
tagged with: sparql
has body: I have used Construct Sparql query to extract an RDF graph from dbpedia. Now the problem is that the extracted graph stores the properties (e.g birthplace) associated with the individuals (e.g Maria Sharapova) as annotations to the individual. How can I specify properties while constructing the graph? My code: String service="http://dbpedia.org/sparql";String queryString = "PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt; "+ "PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; "+ "PREFIX dbp: &lt;http://dbpedia.org/property/&gt; "+ "PREFIX dbpedia: &lt;http://dbpedia.org/resource/&gt; "+ "PREFIX dbo: &lt;http://dbpedia.org/ontology/&gt; " + "CONSTRUCT { ?entity rdfs:label ?label . ?entity rdf:type dbo:TennisPlayer. ?entity dbp:birthPlace ?b.} " + "where { "+ "?entity rdfs:label ?label ."+ "?entity rdf:type dbo:TennisPlayer."+ "?entity dbp:birthPlace ?b." + "FILTER (lang(?label) = 'en')."+ "}\n" Query query = QueryFactory.create(queryString); System.out.println("Query Result Sheet"); QueryExecution qe =QueryExecutionFactory.sparqlService(service, query); Model results = qe.execConstruct(); results.write(System.out, "RDF/XML"); String fileName = "D:/tayybah/GATE data/GATE ontologies/dbpedia domain.owl"; FileWriter outfile = new FileWriter( fileName ); results.write(outfile, "RDF/XML");
has title: Crafting custom ontology/RDF graph from Dbpedia
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/24447249
tagged with: jena
answer count: 2
tagged with: dbpedia
has answer: http://stackoverflow.com/a/26509286
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26508985
has comment: http://stackoverflow.com/comment/41646537
favorite count: 0

http://stackoverflow.com/q/26470140
score: 7
tagged with: java
type: Question
downvote count: 0
tagged with: wait
favorite count: 0
tagged with: java-io
has answer: http://stackoverflow.com/a/26478142
accepted answer: http://stackoverflow.com/a/26470253
answer count: 3
tagged with: sockets
has answer: http://stackoverflow.com/a/26470246
has body: I have the following socket server in java, import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class MiddleSocket { private ServerSocket middleman; private int port = 1027; private Socket client; protected void createSocketServer() { try { middleman = new ServerSocket(port); client = middleman.accept(); middleman.close(); PrintWriter out = new PrintWriter(client.getOutputStream(),true); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); while(true) { System.out.println("echo: " + in.readLine()); out.println("test"); } } catch(IOException e) { System.out.println(e); } } } It works correctly in how it reads from the client and everything. However, I want the socket server to only try and read when there is a message from the client since in the loop it keeps reading even when no messages from the client are received this outputs a bunch of echo: null Is there some mechanism short of a wait() to have the while loop to know to just sit and wait and then fire when a message is sent from the client to read that message and once that message is read and a reply is sent, to then just sit idle until the next message from the client is received?
possible better answer: http://stackoverflow.com/a/26470246
upvote count: 7
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26470253
has title: Socket server that waits for message from client to read

http://stackoverflow.com/a/26505947
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26505692
has body: This should work. The readLine() function continues on to the next line in the input and hence you don't need to skip lines.
answers question: http://stackoverflow.com/q/26505692
type: Answer
has comment: http://stackoverflow.com/comment/41643116
has comment: http://stackoverflow.com/comment/41642839
score: 0

http://stackoverflow.com/a/27030202
accepted answer of: http://stackoverflow.com/q/26363669
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26363669
type: Answer
upvote count: 2
score: 2
has body: This API is not public to 3rd-party apps, so you need to sign your apps with platform key. if you have the platform source code, you can just add below line in your Android.mk to sign your app with platform key. LOCAL_CERTIFICATE := platform Or if you can get the platform sign key, you can sign it yourself to make it work.
has comment: http://stackoverflow.com/comment/50676144

http://stackoverflow.com/comment/41404142
has text: I always end up pondering why programming assignments end up in the general form of "Complete task _x_, without using any of the tools that make _x_ natural."
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26373463

http://stackoverflow.com/a/26409162
has body: Thanks to alain.janinm, I solved the problem. I needed to set my filter to be called before the LOGOUT_FILTER. The following configuration addition solved the problem: &lt;security:custom-filter ref="corsAwareAuthenticationFilter" before="LOGOUT_FILTER"/&gt; Note, using position="LOGOUT_FILTER" didn't work, as that put my filter in the same position as the Spring LOGOUT_FILTER. My filter doesn't do the same thing as the LOGOUT_FILTER -- all mine does is to add the CORS headers. So I actually need the Spring LOGOUT_FILTER to still be called.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26367540
answers question: http://stackoverflow.com/q/26367540
type: Answer

http://stackoverflow.com/q/26500817
has body: I have searched a lot on Google and I know that already this question is asked here but I am unable to find perfect answer what is the difference between applet and Swing and in which kind of application I should use applet or Swing?
score: -2
upvote count: 1
has comment: http://stackoverflow.com/comment/41633734
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/41634842
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/41633709
downvote count: 3
has answer: http://stackoverflow.com/a/26501473
has title: What is the difference between Swing and Applet?
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question

http://stackoverflow.com/a/26432031
type: Answer
has body: You don't need to have an objective function, but if you don't Gurobi will consider any feasible solution as good as the next, even one that is obviously (to you) not what you wanted. When solving a Gurobi model with Java (or pretty much any interface) you can separate values that are known before you have a Gurobi solution, and ones you don't know until you have a solution. The first case includes plain Java variables and hard-coded constants. The latter includes decision variables. In your example, you can write something like if (c > a) { grb.addConstr(x, '=', 0); } because both c and a are Java variables, not decision variables. If c or a are decision variables, you can still model the constraints, but you need to add binary variables.
upvote count: 1
answers question: http://stackoverflow.com/q/26387677
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26387677

http://stackoverflow.com/a/26492097
has body: Yes it will catch all Exception and subclass of Exception. One of the reason where you would catch specific exceptions is you have specific actions to perform incase of exception 1 then you catch that exception.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26492055
score: 1

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26439507
tags question: http://stackoverflow.com/q/26450378
tags question: http://stackoverflow.com/q/26510169
tags question: http://stackoverflow.com/q/26381166
tags question: http://stackoverflow.com/q/26373712
tag name: deserialization
tags question: http://stackoverflow.com/q/26465095
tags question: http://stackoverflow.com/q/26447995

http://stackoverflow.com/comment/79051964
has text: `int getItemViewType (int position)` - Return the view type of the item at position for the purposes of view recycling. The default implementation of this method returns 0, making the assumption of a single view type for the adapter. Unlike `ListView` adapters, types need not be contiguous. Consider using id resources to uniquely identify item view types. - From documentation. https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html
type: Comment
score: 2
comment on: http://stackoverflow.com/a/31154402
type: AnswerComment

http://stackoverflow.com/q/26481392
tagged with: java
has answer: http://stackoverflow.com/a/26481475
downvote count: 1
answer count: 4
has comment: http://stackoverflow.com/comment/41598606
has answer: http://stackoverflow.com/a/26481520
has body: I have a string of 12 digit coming n string format 000000003625 i want to make it 36.25 how i will do please help me while ((line = rd.readLine()) != null) { //Parse our JSON response JSONParser j = new JSONParser(); JSONObject jsonObject = (JSONObject)j.parse(line); String resCode = (String) jsonObject.get("RSP_CODE"); here i am getting in string format
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26481438
has title: How to show up to 2 decimal in a 12 digit string
accepted answer: http://stackoverflow.com/a/26481520
type: Question
possible better answer: http://stackoverflow.com/a/26481480
has answer: http://stackoverflow.com/a/26481480
score: -1

http://stackoverflow.com/comment/41471826
comment on: http://stackoverflow.com/q/26411839
score: 0
type: QuestionComment
type: Comment
has text: Sarcasm or genuine response?

http://stackoverflow.com/q/26430598
has comment: http://stackoverflow.com/comment/41506451
accepted answer: http://stackoverflow.com/a/26430726
has comment: http://stackoverflow.com/comment/41505968
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26430678
has title: Is it proper style to have blank lines tabbed properly?
tagged with: styles
has answer: http://stackoverflow.com/a/26430726
tagged with: git
possible better answer: http://stackoverflow.com/a/26430678
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41506377
tagged with: java
tagged with: whitespace
has body: In Java, let's say I had two method declarations in a class: class MyClass { public void myMethod() { // Some code } public void myOtherMethod() { // Some more code } } In between my methods, I can choose to either have a completely blank line, or have a space characters "properly" tabbing the line. I've noticed that prior to committing, my git diffs that sometimes otherwise unchanged files contain changes that are purely whitespace (either adding or erasing the above mentioned whitespace). This just got me thinking: Are there any style guidelines as to whether either is correct?
tagged with: tabbing
type: Question

http://stackoverflow.com/comment/73022068
type: AnswerComment
comment on: http://stackoverflow.com/a/28938316
has text: This will remove the first row in the partition right, not within the file?
type: Comment
score: 0

http://stackoverflow.com/comment/41372292
type: Comment
comment on: http://stackoverflow.com/q/26353865
type: QuestionComment
has text: This answer may prove helpful: http://stackoverflow.com/questions/26130982/java-odd-memory-consumption-between-x32-and-x64/26132364#26132364. The app will probably still use more than 20MB of HEAP memory (how much more, depends on the data structures it is using, as Compressed Ooops will only compress certain pointers). In terms of off heap memory, things will be different.
score: 0

http://stackoverflow.com/q/26354581
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26354710
has comment: http://stackoverflow.com/comment/41368506
has answer: http://stackoverflow.com/a/26354669
has answer: http://stackoverflow.com/a/26354694
has answer: http://stackoverflow.com/a/26354733
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/7962310
answer count: 7
has title: When should have customized exception?
score: 4
has answer: http://stackoverflow.com/a/26354711
tagged with: java
has body: I am wondering when is the best time to have a customized exception? Code public void myMethod() throws MyCustomizedException { try{ ... }catch(IOException e){ logger.log(e); } } caller.myMethod();
has answer: http://stackoverflow.com/a/26354652
upvote count: 4
has answer: http://stackoverflow.com/a/26354663

http://stackoverflow.com/comment/82165288
type: AnswerComment
comment on: http://stackoverflow.com/a/26375229
type: Comment
has text: Just wanted to not that I searched forever for that locking method, because for me the directory only went away after exiting the JVM. The culprit was `Files.list(...).forEach(...)`. That was quite surprising and frustrating at the same time...
score: 1

http://stackoverflow.com/q/26475502
tagged with: swing
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/26472497
has answer: http://stackoverflow.com/a/26475583
has comment: http://stackoverflow.com/comment/41588309
score: -1
has answer: http://stackoverflow.com/a/26475547
has comment: http://stackoverflow.com/comment/41588428
answer count: 2
has title: Calling paint method from class which doesn't extend JFrame
linked to: http://stackoverflow.com/q/26474594
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41595663
tagged with: jframe
has comment: http://stackoverflow.com/comment/41588420
has body: I have a class Game which extends JFrame and create the window I want to paint on. Then I have this class Diewhich paints what I want. From Game I can just call the setup() method in the Die class, but how do I then call the paint() method? public class Die { private int xA, yA; private int dieNumber; public void setup(int someX, int someY, int someValue) { dieNumber = someValue; xA = someX; yA = someY; } public void paint(Graphics pane) { drawBlank(pane); if (dieNumber == 1){ drawOne(pane); } else if (dieNumber == 2){ drawTwo(pane); } else if (dieNumber == 3){ ......
upvote count: 0
tagged with: paint
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41588483

http://stackoverflow.com/comment/41632767
comment on: http://stackoverflow.com/q/26500003
has text: This is my first time using SO, I'm not that accustomed to posting.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41494262
has text: @JavierPiquerasPascual Check your `dependency:tree` - are you sure they're completely gone? Or is there some other copy of the XML APIs somewhere else in weblogic?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26420609

http://stackoverflow.com/comment/41479201
type: AnswerComment
type: Comment
score: 1
has text: and copying the `LinkedList` to an `ArrayList` just to find the middle element kinda defeats the purpose...
comment on: http://stackoverflow.com/a/26415851

http://stackoverflow.com/comment/41557487
type: QuestionComment
has text: Take a look here: http://stackoverflow.com/a/8282951/2696690
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26458683

http://stackoverflow.com/a/26418401
upvote count: 0
type: AcceptedAnswer
has body: A few things here. You can only define one public class per java file. So your RegistrationValidator class should be in its own java file, separate from the LoginValidator class. Since you are catching the SQLException and logging some info, you don't need the "throws SQLException" for the constructor signature LoginValidator()
type: Answer
has comment: http://stackoverflow.com/comment/41483616
downvote count: 1
answers question: http://stackoverflow.com/q/26418131
accepted answer of: http://stackoverflow.com/q/26418131
score: -1

http://stackoverflow.com/a/26377353
has comment: http://stackoverflow.com/comment/41410507
type: Answer
answers question: http://stackoverflow.com/q/26377275
has comment: http://stackoverflow.com/comment/41412039
has comment: http://stackoverflow.com/comment/41411101
has body: You are getting the input with the next() method which Finds and returns the next complete token from this scanner. Therefore you only read the first word of the sentence. Try to replace next() with nextLine(). And if you want to compare the same String against multiple patterns, store that String in a variable. Currently each of your calls to contains() reads a new String from the scanner. You should write something like this : String input = m.nextLine(); boolean q=contains(input,"Badr"); if(q) { ba++; } boolean w=contains(input,"Shakira"); if(w) sh++; } boolean e=contains(input,"Fegla"); if(e) { fe++; } This would find "Shakira" in "liked Shakira's photo". Of course, there are more efficient ways to write the same code. String input = m.nextLine(); if (input.contains("Badr")) ba++; if (input.contains("Shakira")) sh++; if (input.contains("Fegla")) fe++;
has comment: http://stackoverflow.com/comment/41411052
score: 0
has comment: http://stackoverflow.com/comment/41411747

http://stackoverflow.com/q/26510006
answer count: 1
linked to: http://stackoverflow.com/q/6524196
has body: I have a colored textual Image to be in black and white. Specifically the text to be in black and background to be in white for whatever colored it might be I am using JAVA to perform this operation. Can anybody help me out to with a code snippet or point me to a discussion which is useful.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41653771
has title: Need a way to get the Text in the Image in Black/white
tagged with: java
tagged with: image-processing
type: Question
has answer: http://stackoverflow.com/a/26510481
score: 0
has comment: http://stackoverflow.com/comment/41650145

http://stackoverflow.com/a/26387183
has comment: http://stackoverflow.com/comment/73014916
has body: If I'm reading your requirements correctly, you want to wait to load the combo with a list until after they click on the drop-down arrow of the combo? (Keep in mind, this is not a typical way of loading a combobox.) If so, I had a similar requirement some years ago, that camickr helped me work out (back on the old Sun forums). The idea was that user input from elsewhere on the form would drive the list of items for the combo. Deriving this list would be an expensive database query, so we didn't want to do it on every change of user input. We also didn't want a separate "Build List" button. import java.awt.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; /* * https://community.oracle.com/thread/2225626 */ @SuppressWarnings("all") public class DelayedComboBoxDemo implements Runnable { private JCheckBox chkA, chkB, chkC; private JComboBox cboItems; private JFrame frame; public static void main(String[] args) { SwingUtilities.invokeLater(new DelayedComboBoxDemo()); } public void run() { chkA = new JCheckBox("A"); chkB = new JCheckBox("B"); chkC = new JCheckBox("C"); cboItems = new JComboBox(); cboItems.setPrototypeDisplayValue("X"); JPanel p = new JPanel(); p.add(chkA); p.add(chkB); p.add(chkC); p.add(cboItems); frame = new JFrame("Delayed ComboBox Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(p); frame.setSize(300, 100); frame.setLocationRelativeTo(null); frame.setVisible(true); cboItems.addPopupMenuListener(new PopupMenuListener() { public void popupMenuCanceled(PopupMenuEvent e) {} public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} public void popupMenuWillBecomeVisible(PopupMenuEvent e) { rebuildList(); } }); } private void rebuildList() { int oldCount = cboItems.getItemCount(); frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // simulate a long transaction try { Thread.sleep(200); } catch (InterruptedException ex) {} // for testing purposes, just create the list here Vector<String> items =…
has comment: http://stackoverflow.com/comment/74412403
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26383012

http://stackoverflow.com/comment/41603550
type: AnswerComment
comment on: http://stackoverflow.com/a/26484259
type: Comment
has text: Might be worth mentioning that String.join was added in Java 8, for those who aren't using it yet for whatever reason.
score: 0

http://stackoverflow.com/comment/41656479
score: 0
has text: I never had this problem, but if there is a problem with size of the data, maybe you should consider changing your code? You can also check if Product object is not too big (maybe you are loading some other unnecessary informations from database to it in this case create a DTO and send it. Unfortunately it requires rewriting objects.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26513217

http://stackoverflow.com/a/30417331
answers question: http://stackoverflow.com/q/26436463
has comment: http://stackoverflow.com/comment/67058925
upvote count: 1
type: Answer
downvote count: 0
has body: If your tomcat is version 8 use: javax.servlet javax.servlet-api 3.1.0 worked!
score: 1

http://stackoverflow.com/comment/41561747
type: QuestionComment
comment on: http://stackoverflow.com/q/26461312
score: 2
type: Comment
has text: How do you check the file for its content?

http://stackoverflow.com/q/26458350
tagged with: arrays
score: 0
has body: Hey I am trying to call a method "swapPairs(int[] nums)", but I am getting multiple errors - Syntax error on token "{", delete this token - The method swapPairs(int[]) in the type ArrayMethods is not applicable for the arguments (int, int, int, int) - Syntax error on token "swapPairs", @ expected before this token - Syntax error on token ";", @ expected after this token - Syntax error on token "}", delete this token" This is my code: public class ArrayMethods { public static void main(String[]args){ System.out.println(swapPairs({5,4,2,6})); allLess({5,4,3}, {4,7,5}); } public boolean allLess(int[] nums, int[] num){ int c=0; if(nums.length==num.length){ for(int i=0; i&lt;num.length; i++){ if(nums[i]&lt;num[i]) return true; } } return false; } public int[] swapPairs(int[] nums){ int[] x=new int[nums.length]; if(nums.length%2==0){ for(int i=0; i&lt;nums.length; i++) x[i]=nums[i+1]; return x; } else for(int i=0; i&lt;nums.length-1; i++) x[i]=nums[i+1]; return x; } public void printArray(int[] nums){ for(int i=0; i&lt;nums.length; i++) System.out.println(nums[i]); } } In the method swapPairs I might also have an error. The goal of that is to swap adjacent elements in an array, and if the length of the array is odd then to keep the last element where it is. Thanks!
answer count: 1
type: AnsweredQuestion
tagged with: oop
tagged with: java
has title: Error when calling method
has answer: http://stackoverflow.com/a/26458358
accepted answer: http://stackoverflow.com/a/26458358
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41439685
comment on: http://stackoverflow.com/q/26368982
type: Comment
type: QuestionComment
has text: Done that. Now, apparently, it takes ~1 second for the server to return the added value. Configuring it this way makes it work! But I don't understand how this makes sense...
score: 0

http://stackoverflow.com/comment/41485814
comment on: http://stackoverflow.com/a/26407508
score: 0
type: AnswerComment
type: Comment
has text: This is the way I achieve this. It works perfect in my projects. It gets any data from a custom list view. And this is all I can tell you without seeing your codes.

http://stackoverflow.com/comment/41515565
has text: Ahh. In that context, write it using a [*binary search*](http://en.wikipedia.org/wiki/Binary_search_algorithm). This will decrease the depth from `n` to `lg(n)` and avoid the stack overflow. The only requirement is the dictionary is sorted. Since the matching letters can "split" a i/2 division you will need to account for the back-out case to find the first/last word also matching.
type: QuestionComment
comment on: http://stackoverflow.com/q/26435429
score: 0
type: Comment

http://stackoverflow.com/q/26386008
score: 0
tagged with: apache-flex
upvote count: 1
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
has title: change the Column series display name dynamically in Flex
has answer: http://stackoverflow.com/a/26461938
favorite count: 0
type: Question
has body: How to change the display name of the column series of chart in flex, based on certain condition For (eg): If the condition is year it should the year column series else it should display the month series `&lt;mx:ColumnSeries displayName="YTD" fill="{sc11}" stroke="{s11}" yField="yearGrossCharge"/&gt; &lt;mx:ColumnSeries id="month_id" visible="false" includeInLayout="false" displayName="Month" yField="grossCharge"/&gt; &lt;mx:ColumnSeries id="year_id" displayName="year" includeInLayout="true" yField="grossCharge"/&gt;` I have tried by month_id.visible="False" but it doesn't work?? pls give me some idea...

http://stackoverflow.com/comment/41402515
has text: @Remixt upgrade to Java 7 lol
comment on: http://stackoverflow.com/q/26372873
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/41422985
type: AnswerComment
comment on: http://stackoverflow.com/a/26384357
has text: @YokupokuMaioku: Well you *do* have to lock if you're going to call `monitor.signal()`.
type: Comment
score: 2

http://stackoverflow.com/a/26469958
has body: You are including many duplicate and conflicting dependencies, one of which is a JSF-API 2.1 jar. That won't work as APIs are only for compilation purposes and not for actual deployment purposes, you need a JSF implementation such as the reference implementation Mojarra. See its site documentation on how to get it with Maven: https://javaserverfaces.java.net/download.html At the time of writing that happened to be: org.glassfish javax.faces 2.2.8 I would skim through your pom and clean up all the duplicates in there if I were you. Anything to do with JSF can be replaced with this one dependency.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26469120
has comment: http://stackoverflow.com/comment/41598030

http://stackoverflow.com/q/26421736
tagged with: android-notifications
answer count: 1
has answer: http://stackoverflow.com/a/26421849
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: generate notifications on screen
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I wanted to ask a question you have to see if I can help. I've started working on a (Android) application that should display a message on the android device. This message should be Push notification type, as would be when we get a whatsapp, with the only difference that this message does not come out, but will be a sort of alarm, since the user will mark what time to leave this notice. And want to know what kind of message should work, and if it's with Push notifications, if they know of any conditions or any manual tutorial, because I've seen so far the only thing that has made ​​me lose more. Thank you.
has comment: http://stackoverflow.com/comment/41489205

http://stackoverflow.com/a/26424076
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41496637
has comment: http://stackoverflow.com/comment/41497129
score: 1
has body: A Java thread that's waiting for a lock will wait indefinitely until the lock is released, yes. It will be waiting on a Java lock, not on anything directly involved with a UNIX process. If you have a synchronized block or method somewhere that spawns a UNIX process, then it'll be down to whatever code is in that block or method as to what happens if the UNIX process dies, but certainly it would be possible for the code just to block for ever. If you have something like public class SomeClass { public synchronized void methodA() { while (true) { //do nothing } } public synchronized void methodB() { //do something useful } } and one thread invokes methodA() on an instance of SomeClass, it'll acquire the lock, and never release it. If a second thread tries to invoke methodB() on that same instance, it'll block for ever because it won't be able to acquire the lock. It's critically important, when you write synchronized blocks, that they should be as short and as fast as possible, and that they should be checked very carefully to ensure that they will always terminate.
answers question: http://stackoverflow.com/q/26422912

http://stackoverflow.com/comment/41399358
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26370569
has text: @Waseem: As I say, on your system everything just happens to make it work. There's just no guarantee that it will.
type: AnswerComment

http://stackoverflow.com/a/26563121
type: Answer
has body: Considering the Biz.nf FAQ: How can I connect to my MySQL/PostgreSQL database? What settings should I use for my script/software? MySQL/PosgreSQL database connection can be established with script/software hosted only on your web hosting account (meaning no remote access is allowed due to security reasons). The following settings are needed: So, since biz.nf does not allow remote access, it will be difficult for you to interact with their MYSQL server for your application. The best solution and the most simple is probably to find a new provider which will allow the remote access. Heroku.com works very well. If you really want to use the biz.nf services, it will be more difficult. It's not a script or credential problem. Maybe you can (probably not), try to login by SSH to configure your server to enable remote access to your MYSQL database server. From the free plan, you will not have any access to the online SSH tool and you will need to configure your domain for a SSH connection. In SSH, and it probably will not work considering the FAQ, you could try to simply modify your /etc/mysql/my.cnf file by commenting the bind-address line wich by default only allows local access (127.0.0.1). Then, try to restart your MYSQL service with: a simple service mysql restart to verify if the remote connection works. If the remote connection still doesn't work after this, the only way I can find for the moment (unless you completely change your hosting provider) would be to create a kind of API hosted directly on the server and your Java program could interacts with your services (In JSON, by example).
answers question: http://stackoverflow.com/q/26389011
score: 0

http://stackoverflow.com/a/26496430
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: It really makes no difference to someone trying to read reverse engineered code whether they have to look up a constant or it's inline. But if you like you can add: -keep class your.package.Utility { public static *; } To your proguard-project.txt
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26496252
answers question: http://stackoverflow.com/q/26496252

http://stackoverflow.com/comment/41573120
has text: @Hovercraft Full Of Eels - I added code that you can test
type: QuestionComment
comment on: http://stackoverflow.com/q/26453520
type: Comment
score: 0

http://stackoverflow.com/a/26489206
has comment: http://stackoverflow.com/comment/41612965
upvote count: 4
answers question: http://stackoverflow.com/q/26488979
downvote count: 0
has comment: http://stackoverflow.com/comment/41612967
has body: Internally - it contains (number of chars) * 2 bytes, as each char in Java takes up two bytes (a normal character in Java is 16 bits unicode). The actual bytes are 0x20 and 0x14. However, the length function returns the number of characters, not the number of bytes.
score: 4
has comment: http://stackoverflow.com/comment/41612532
has comment: http://stackoverflow.com/comment/41613208
type: Answer

http://stackoverflow.com/q/26454880
accepted answer: http://stackoverflow.com/a/26457898
type: Question
tagged with: android
has body: public void update(float delta){ position.x = getX(); if(Gdx.input.justTouched()){ for(;position.x &lt; 864; position.x = position.x + 0.5f){ setX(getX() + 3f*delta); } } } The above code shows the loop that makes a block move which is like the character from one side of the screen to the other and stop when it reaches the x coordinate of 864. The loop runs fine when it's on it's own but it runs as soon as I compile the game. What I want it to do is to run the loop when the mouse is clicked anywhere on the screen. But what actually happens is that it runs the loop only once and I have to click the mouse multiple times before the loop is complete and the block is on the other side of the screen (images below). Can someone please shed some light on how I would go about setting it up so that it runs the whole loop and moves the block from left to right with a single mouse click. Thanks a lot. Images: This is where the block starts at: https://i.sstatic.net/n5CDU.png This is what I want it to end up like when the mouse is clicked: https://i.sstatic.net/lnZA1.png
tagged with: mouseclick-event
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26457898
tagged with: libgdx
tagged with: java
has title: LibGDX input only runs my loop once and not continuously when the mouse is just clicked
type: AnsweredQuestion

http://stackoverflow.com/comment/41621270
type: Comment
type: QuestionComment
has text: When I release a new version of my game onto my FTP server
comment on: http://stackoverflow.com/q/26493896
score: 0

http://stackoverflow.com/a/26465934
accepted answer of: http://stackoverflow.com/q/26465807
score: 3
type: AcceptedAnswer
downvote count: 0
has body: jama makes it for you documentation public Matrix inverse() Matrix inverse or pseudoinverse Returns: inverse(A) if A is square, pseudoinverse otherwise.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26465807

http://stackoverflow.com/comment/41420767
type: Comment
type: QuestionComment
has text: @GyroGearless Sorry.
comment on: http://stackoverflow.com/q/26379653
score: 0

http://stackoverflow.com/a/49198241
type: Answer
has body: The following Options annotation can be used: @Options(useCache=false, flushCache=FlushCachePolicy.TRUE)
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/26440362
downvote count: 0

http://stackoverflow.com/comment/41531653
type: QuestionComment
type: Comment
has text: `if (Txtval=false) ` --> Be careful what you're doing here.
score: 1
comment on: http://stackoverflow.com/q/26443352

http://stackoverflow.com/comment/42077462
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26727594
has text: Also I've tried the line of code you suggested `.setServiceAccountScopes(Arrays.asList(DriveScopes.DRIVE))` and I still get the same result - error 404.

http://stackoverflow.com/comment/41637740
comment on: http://stackoverflow.com/q/26489172
has text: Yes unfortunately this is not implemented yet. There is an issue for that: https://issues.gradle.org/browse/GRADLE-1254
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41648179
type: AnswerComment
has text: Can you give us the parsing code? Also have you printed out that this is actually the value within the variable?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26508904

http://stackoverflow.com/q/26439059
possible better answer: http://stackoverflow.com/a/26439473
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41522710
has answer: http://stackoverflow.com/a/26439473
tagged with: java
has comment: http://stackoverflow.com/comment/41522026
has comment: http://stackoverflow.com/comment/41522457
has comment: http://stackoverflow.com/comment/41522449
has comment: http://stackoverflow.com/comment/41522203
has answer: http://stackoverflow.com/a/26462313
type: Question
has comment: http://stackoverflow.com/comment/41522390
has comment: http://stackoverflow.com/comment/41522559
has comment: http://stackoverflow.com/comment/41522036
tagged with: android-layout
has comment: http://stackoverflow.com/comment/41522410
has comment: http://stackoverflow.com/comment/41522392
has comment: http://stackoverflow.com/comment/41522518
has comment: http://stackoverflow.com/comment/41522057
has comment: http://stackoverflow.com/comment/41522668
has comment: http://stackoverflow.com/comment/41521996
score: 0
has comment: http://stackoverflow.com/comment/41522576
has comment: http://stackoverflow.com/comment/41522377
has comment: http://stackoverflow.com/comment/41522386
has comment: http://stackoverflow.com/comment/41522162
answer count: 2
has title: textview is not showing text
has comment: http://stackoverflow.com/comment/41522401
accepted answer: http://stackoverflow.com/a/26462313
tagged with: textview
tagged with: android-activity
has body: I have created form which contain question text and input field suitable to question. I have spinner ,edittext and checkbox in my form. All are created dynamically using activity . Problem in the created layout is that input field displayed correctly but textview not displayed. private void showIssueForm(){ for (int i=0;i&lt;claimQuestionList.size();i++){ ClaimQuestion claimQuestion=claimQuestionList.get(i); LinearLayout linearLayout=ClaimUtils.createLayoutForClaimQuestion(claimQuestion,this); /*claimQuestionsLinearLayout.addView(linearLayout);*/ claimQuestionsLinearLayout.addView(linearLayout,i); } } private static TextView createTextView(ClaimQuestion claimQuestion,Context context){ TextView textView=new TextView(context); LinearLayout.LayoutParams textViewLayoutParams=new LinearLayout.LayoutParams(300,80,1); textView.setText("hi m printing the text what are you looking for");//claimQuestion.getOrder()+". "+claimQuestion.getLabel()); textView.setLayoutParams(textViewLayoutParams); //textView.setMinLines(1); // textView.setSingleLine(false); textView.setTextSize(R.dimen.system12); textView.setVisibility(View.VISIBLE); textView.setTextColor(context.getResources().getColor(R.color.light_white_)); return textView; } The linear layout where i added form element is given below public static LinearLayout createLayoutForClaimQuestion(ClaimQuestion claimQuestion,Context context){ LinearLayout linearLayout=new LinearLayout(context); LinearLayout.LayoutParams linearLayoutParams=new LinearLayout.LayoutParams(500,200); linearLayout.setLayoutParams(linearLayoutParams); linearLayout.setOrientation(LinearLayout.VERTICAL); TextView questionLabel=createTextView(claimQuestion,context); linearLayout.addView(questionLabel,0); if (claimQuestion.getQuestionType()==ClaimQuestion.QuestionTypeEnum.CQ_TEXT){ EditText editText=createEditText(claimQuestion,context); linearLayout.addView(editText,1); }else if(claimQuestion.getQuestionType()==ClaimQuestion.QuestionTypeEnum.CQ_CHECKBOX){ CheckBo…
has comment: http://stackoverflow.com/comment/41522647
has comment: http://stackoverflow.com/comment/41522722
tagged with: android

http://stackoverflow.com/q/26442334
type: Question
has body: I created a JPanel inside it i put a JCheckBox and two buttons: when checkbox is checked a glassPane with transparent color (alpha = 100) is showed above the panel and contains a label displaying the String "Loading...", the problem is that the location of checkbox changes when glassPane is displayed: and when i change the size of the frame the glassPane become opaque and all component which were visible under glasspane become invisible. and when i change the size to smaller size, the background of the glassPane changes and get darker and the label string "Loading" become blurred Here is my code which is inspired by Oracle tutorial about GlassPane GlassPane Tutorial package com.training.test; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; class Training extends JFrame { JCheckBox changeGlass; JButton button1, button2; public Training() { setBounds(100, 100, 400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Test Glass Pane"); getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel glass = (JPanel) getGlassPane(); glass.setOpaque(true); glass.setBackground(new Color(120, 120, 120, 100)); glass.setLayout(new BorderLayout()); glass.add(new JLabel("Loading ...")); changeGlass = new JCheckBox("Show Glass Pane", false); changeGlass.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { glass.setVisible(e.getStateChange() == ItemEvent.SELECTED); } }); button1 = new JButton("Select"); button2 = new JButton("Change"); getContentPane().add(changeGlass); getContentPane().add(button1); getContentPane().add(button2); glass.addMouseLi…
has title: GlassPane behaves weird
has comment: http://stackoverflow.com/comment/41527841
upvote count: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41528348
favorite count: 0
has comment: http://stackoverflow.com/comment/41528358
tagged with: glasspane
tagged with: swing
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26442756
accepted answer: http://stackoverflow.com/a/26442756

http://stackoverflow.com/a/26396818
has comment: http://stackoverflow.com/comment/41445205
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26396554
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26396554
has body: First of All, String index is start from 0. So in for loop you need to set i value to 0. Second mistake in your code is your modifying the string 's' value in for loop. that's why your getting 'i' as output. Try following code, you will get expected output //This method prints out the even indexes of a string public static String decrypt(String question, Scanner console) { String str = ""; System.out.print(question + " "); String s = console.nextLine(); for (int i = 0; i &lt; s.length(); i=i+2) { char x = (s.charAt(i)); str = str + String.valueOf(x); } return str; }

http://stackoverflow.com/comment/41541017
comment on: http://stackoverflow.com/a/26449619
has text: Knowing what you want to do with this calendar would help as Calendar class is not meant for formatting purposes.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26459823
has comment: http://stackoverflow.com/comment/41559486
has comment: http://stackoverflow.com/comment/41559436
upvote count: 3
has comment: http://stackoverflow.com/comment/41560129
score: 3
has comment: http://stackoverflow.com/comment/41563753
has body: Take a second to look at this piece of code... public static class MenuPanel extends JPanel { MainFrame mf; public MenuPanel() { this.mf = mf; Basically, you are assigning (this) mf to this.mf, but since mf is already null, this.mf will remain null... You should be passing a reference of MainFrame to your MenuPanel Now, because I hate passing around references of UI components to other parts of the program, which should have no idea about the rest of the UI and don't direct control over them, I would advice against passing MainFrame blinding like this. Instead, create a interface which provides the functionality you expect that MenuPanel should be allowed to perform (newGame, loadGame, showInstructions, exit) for example and allow the implementation of this interface (probably the MainFrame) to deal with it You would then pass the instance of this interface to MenuPanel...This limits the exposure of classes to other classes which don't need those classes functionality and decouples your code so you can pass any old instance of the interface to the class without having to rewrite whole sections of your code... Updated with a basic concept Start with some kind game controller interface, for example... public interface GameController { public void newGame(); public void loadGame(); public void showInstructions(); public void exit(); } This describes the actions that can take against the implementation of this interface. Use MainFrame and implement the GameController... public class MainFrame extends JPanel implements GameController { //... public void newGame() { } public void loadGame() { } public void showInstructions() { } public void exit() { } Change MenuPane to require an instance of GameController when it's constructed... public class MenuPanel extends JPanel { private GameController controller; public MenuPanel(GameController gameController) { this.controller = gameController; //... Now, when you handle the user interaction, you would pass the request to the co…
has comment: http://stackoverflow.com/comment/41560505
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26459688
accepted answer of: http://stackoverflow.com/q/26459688
type: Answer

http://stackoverflow.com/a/26445671
has body: You only check if there is data in Scanner but you never consume it. The java.util.Scanner.hasNext() method Returns true if this scanner has another token in its input. This method may block while waiting for input to scan. The scanner does not advance past any input. The below code will never end if there is any data in file, you increase your counter with out reading the data. while (data.hasNext()) { indices++; }
has comment: http://stackoverflow.com/comment/41533939
score: 0
has comment: http://stackoverflow.com/comment/41533919
has comment: http://stackoverflow.com/comment/41533965
answers question: http://stackoverflow.com/q/26445633
type: Answer
has comment: http://stackoverflow.com/comment/41533985

http://stackoverflow.com/q/26374022
score: 0
has answer: http://stackoverflow.com/a/26375640
tagged with: include
type: UnansweredQuestion
has body: In HFSJ , it is mentioned like "the include directive is to be used for static pages". But in tomcat 5.5 (and onwards) Jasper 2 JSp engine is been used which says Background JSP compilation - If you make a change to a JSP page which had already been compiled Jasper 2 can recompile that page in the background. The previously compiled JSP page will still be available to serve requests. Once the new page has been compiled successfully it will replace the old page. This helps improve availability of your JSP pages on a production server. Recompile JSP when included page changes - Jasper 2 can now detect when a page included at compile time from a JSP has changed and then recompile the parent JSP. My questions are: The second spec says that the jasper 2 will recompile the jsp. so that means translate and recompile . isnt it? -Isnt its possible now to include the dynamic pages with include directive
tagged with: java
tagged with: servlets
type: Question
answer count: 1
tagged with: jsp
tagged with: tomcat
has title: Automatic compilation of jsp page when using include directive

http://stackoverflow.com/comment/41505346
has text: Did you recompile and redeploy the new code? Did Tomcat do a hot redeploy? It doesn't show up by magic.
score: 0
comment on: http://stackoverflow.com/q/26430257
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26437605
has answer: http://stackoverflow.com/a/26437662
tagged with: java
tagged with: output
type: Question
answer count: 1
has title: Why bean id requires with same name into my example? and why bean file never returns my output as i change it values into bean configuration file?
accepted answer: http://stackoverflow.com/a/26437662
score: 0
tagged with: spring
has body: I'm completely a beginner in Spring framework. I'm playing with an example of creating an instance of an object at the time. So will need your help! Have a look into this example: MainApp.java: import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainApp{ public static void main(String[] args){ ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml"); HelloWorld obj1=(HelloWorld) context.getBean("helloBd2"); obj1.setMessage("fooo.."); obj1.getMessage(); HelloWorld obj2=(HelloWorld) context.getBean("helloBd2"); obj2.getMessage(); } } First Question: Why here bean id requires with the same name? otherwise it gives some errors as below.. Oct 18, 2014 1:28:44 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1c12fb0: startup date [Sat Oct 18 13:28:44 PDT 2014]; root of context hierarchy Oct 18, 2014 1:28:44 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [beans.xml] Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'helloBd1' is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1157) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:280) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) at MainApp.main(MainApp.java:8) Okay have a look into my beans.xml: &lt;?xml version="1.0" encoding="U…
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/41536985
comment on: http://stackoverflow.com/q/26447302
score: 0
type: QuestionComment
type: Comment
has text: It's hard to tell, it's possible that the images aren't been loaded. What does the `ImageSide` and `TextSide` classes look like

http://stackoverflow.com/q/26371108
answer count: 3
tagged with: compare
has title: Comparing elements of two arrays in a for loop (java)?
has answer: http://stackoverflow.com/a/26371234
type: UnansweredQuestion
tagged with: encryption
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java
has answer: http://stackoverflow.com/a/26371193
tagged with: char
has answer: http://stackoverflow.com/a/26371207
has body: It seems to be a very common question relating with arrays and comparing in java, however I couldn't find the right answer in all of these for my case. In this application I am trying to make a program which 'encrypts' text given by the user. For example: user gives characters 'a b c' and the program returns it as '@ # $'. But as you may notice I am having some issues in the code "pozita[i] = j;". Why won't this code work? It doesn't give me an error? Or is there anyway of doing it as "new pozita[i]" or anything like that? Well, I'd be glad if someone could help me through. I am stuck for a while. Thanks in advance! :) import java.util.*; import javax.swing.*; import java.awt.*; public class TestPerProgram extends JFrame { char[] alfabeti = {'a','b','c','r','n','t'}; char[] kodimi = {'@','#','%','*','^','$'}; int[] pozita; //Scanner merr = new Scanner(System.in); String fn = JOptionPane.showInputDialog("Jepe tekstin:"); char[] input = fn.toCharArray(); void numro() { for (int i=0; i&lt;=input.length; i++) { for(int j=0; j&lt;=input.length; j++) { if(alfabeti[j] == input[i]) { pozita[i] = j; System.out.println(pozita[i]); } } } /* for (int k=0; k&lt;=input.length; k++) { System.out.println(pozita[k]); } */ } public static void main(String[] args) { TestPerProgram pjesa = new TestPerProgram(); pjesa.numro(); } }
has comment: http://stackoverflow.com/comment/41399399
tagged with: arrays
favorite count: 0
score: 0

http://stackoverflow.com/comment/54342569
comment on: http://stackoverflow.com/a/33213802
score: 1
has text: I think this is a much better, more portable approach. Cheers!
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26471476
has body: One way is to create a fourth module which "wraps" the 3 modules as dependencies. This way you could depend on this wrapper module which would. connectors - packaging: pom connector1 - packaging: jar connector2 - packaging: jar connector3 - packaging: jar connectorWrapper - packaging: pom (depends on the above three) Although it would make more sense to explicitly declare a dependency for each connector especially that they are only three. Alternative solution: A more dynamic approach (although very much an overkill IMO) is to have this fourth module package the implementation modules in an assembly using a custom assembly descriptor. For example, inside connectorWrapper, you could write an assembly.xml: impl-modules jar false ${project.basedir} pom.xml true true *:connector* false Note that the descriptor tells the assembly plugin to: include all modules in the current project reactor, so when you run mvn clean package in the root project, it will include all modules include only implementation modules (the connector modules), as specified in the include element having *:connector*. Of course you'll need to configure the assembly plugin to use this descriptor in the connectorWrapper (or whatever other name you choose for this wrapper): maven-assembly-plugin assembly.xml make-assembly package single Then you can run mvn install on the root project to install the assembly artifact, after which you can depend on it from the other project: groupId connectorWrapper ... impl-modules
answers question: http://stackoverflow.com/q/26471404
type: Answer
has comment: http://stackoverflow.com/comment/41580501
has comment: http://stackoverflow.com/comment/60505864
has comment: http://stackoverflow.com/comment/60522421
score: 10
upvote count: 10
has comment: http://stackoverflow.com/comment/60547358
downvote count: 0

http://stackoverflow.com/a/26393294
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41445432
has body: I modified the configure(HttpSecurity http) method as follows, and it now authenticates through the Authentication provider using basic http security. Not sure this is the best approach though. @Override protected void configure(HttpSecurity http) throws Exception { log.warn("Configure http"); http.csrf().disable() .authorizeRequests() // .antMatchers("/**") .anyRequest() .authenticated() .and().httpBasic(); }
accepted answer of: http://stackoverflow.com/q/26393063
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26393063

http://stackoverflow.com/q/26403536
has comment: http://stackoverflow.com/comment/41456713
has answer: http://stackoverflow.com/a/39748386
has comment: http://stackoverflow.com/comment/41457210
has comment: http://stackoverflow.com/comment/41558518
has comment: http://stackoverflow.com/comment/41457081
tagged with: linux-kernel
has body: I am often facing issue in our production environment of the Tomcat process getting killed by Linux OOM. Checking /var/log/messages it says java not tainted and java invoked OOM killer. -Xms20480m -Xmx20480m on a 32 GB box. I see below crash - Is the OOM causing this crash ? or the crash happened because of OOM ? How can I debug this issue ? # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f4c3230aad7, pid=16248, tid=139964439296320 # # JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops) # Problematic frame: # V [libjvm.so+0x674ad7] JVM_Clone+0x97 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x0000000001313800): JavaThread "http-bio-14080-exec-17" daemon [_thread_in_native, id=18943, stack(0x00007f4c029f7000,0x00007f4c02af8000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=128 (), si_addr=0x0000000000000000 Registers: RAX=0x0000000000010000, RBX=0x80000001000004db, RCX=0x0000000302bd6fb0, RDX=0x00007f4c32acda50 RSP=0x00007f4c02af2c88, RBP=0x00007f4c02af2d70, RSI=0x00007f4c02af2d80, RDI=0x00000000013139e8 R8 =0x0000000000000001, R9 =0x00000002f8191228, R10=0x00007f4c2e231658, R11=0x00007f4c2e231638 R12=0x0000000302bd6fb0, R13=0x00000007e0002420, R14=0x0000000000000000, R15=0x0000000001313800 RIP=0x00007f4c3230aad7, EFLAGS=0x0000000000010202, CSGSFS=0x0000000000000033, ERR=0x0000000000000000 TRAPNO=0x000000000000000d Top of Stack: (sp=0x00007f4c02af2c88) 0x00007f4c02af2c88: 00007f4c3230aa63 00000000129196d1 0x00007f4c…
answer count: 3
downvote count: 0
linked to: http://stackoverflow.com/q/10996293
has title: Linux OOM Killer and Java Process
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/41531723
tagged with: linux
type: UnansweredQuestion
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/41457557
has answer: http://stackoverflow.com/a/39537732
has comment: http://stackoverflow.com/comment/41457887
tagged with: java
tagged with: memory
has answer: http://stackoverflow.com/a/72770048
type: Question

http://stackoverflow.com/a/26478802
type: Answer
has body: you probably want to do this: for(int i = (m -(m - 1)); i &lt;= m; i++) { System.out.print(multiple(n,i)+","); // call like this in you main method } This is recursive function : public static int multiple(int m,int n) { if (n == 1) return m; else return m+multiple(m,n-1); }
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41594526
answers question: http://stackoverflow.com/q/26478705
downvote count: 0
has comment: http://stackoverflow.com/comment/41596049
has comment: http://stackoverflow.com/comment/41594466
has comment: http://stackoverflow.com/comment/41595035
has comment: http://stackoverflow.com/comment/41594413

http://stackoverflow.com/comment/41527071
type: QuestionComment
type: Comment
score: 2
has text: When calling this method, it will always print something to the standard output stream. If "nothing shows in the console" you are either redirecting this stream or not calling the method.
comment on: http://stackoverflow.com/q/26441826

http://stackoverflow.com/q/26493738
has comment: http://stackoverflow.com/comment/41621859
tagged with: jnienv
score: 0
type: UnansweredQuestion
tagged with: android
has title: Android JNI Throwing Fault with no exceptions - Trying to call a callback
answer count: 0
has body: JNI causing a fault with no exception Seems to happen in a few different areas but usually within this code: void /*__stdcall*/ OutgoingCallbackHandler(int device_id, unsigned char* buffer, int size) { LockTools(); JNIEnv* env = ::GetJNIEnvForCurrentThread(); if (env == NULL) { LOGF("Environment couldn't be found for callback thread!"); return; } for (int scan = 0; scan &lt; callbacks.size(); ++scan) { if (callbacks[scan].type == CallbackInfo::OUTGOING) { jbyteArray jba = NULL; if (size &lt;= 0) { // we don't want to create a byte array if // we have no data to represent. } else { jba = env-&gt;NewByteArray(size); //THIS IS WHERE CRASH HAPPENS env-&gt;SetByteArrayRegion(jba, 0, size, (const jbyte*)buffer); } env-&gt;CallVoidMethod(callbacks[scan].object, callbacks[scan].callback, device_id, jba); env-&gt;DeleteLocalRef(jba); } } UnlockTools(); } We have checked the env still points to a valid memory location, the size passed in is within spec This starts to happen after its been called a few times Is there better ways to debug JNI issues? We have also checked for JNI specific exceptions directly above the line that seems to throw a fault
type: Question
has comment: http://stackoverflow.com/comment/41621437
tagged with: java-native-interface
tagged with: java

http://stackoverflow.com/a/26511768
has comment: http://stackoverflow.com/comment/41686779
type: Answer
has body: public static int convertDoubleToInt(double d){ //rounds off to the nearest 100 long l = Math.round(d); int i = (int) l; return i; } public static double convertCommaDoubleToInt(String s) throws ParseException{ NumberFormat nf = NumberFormat.getInstance(Locale.US); Number number = nf.parse(s); return number.doubleValue(); } public static void main(String[] args) throws ParseException { String[] moneys = {"12,000", "245.76"}; for(String n: moneys){ Double d = convertCommaDoubleToInt(n);//first remove the comma, if there System.out.println(convertDoubleToInt(d)); //then convert double into int } }
answers question: http://stackoverflow.com/q/26510384
score: 0

http://stackoverflow.com/comment/41451057
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26400323
has text: @Narmer project is like ERP. If we create it from java code means every time the code runs table will create knw it may create some problem but im not sure
score: 0

http://stackoverflow.com/q/26408992
type: Question
has title: Log4j filter marker data
score: 0
answer count: 2
has body: I use marker for inbound and outbound packets. All packets prefixed by int id. Sometimes for debug purpopses i need also filter packets by id. How i can for example log packets prefixed with 3? private static final Marker packets = MarkerManager.getMarker("Packets"); logger.debug(packets, "[IN:" + packetState + ":" + packet.getId() + "] " + packet.toString());
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26584122
has answer: http://stackoverflow.com/a/26417441
tagged with: java
upvote count: 1
tagged with: log4j2
downvote count: 1

http://stackoverflow.com/a/26455391
has body: You can enter the file name with the whole path: C:\\Path\\To\\The\\File.txt or /tmp/path/to/file.txt Or type in just the file name given that it is located under the same path than the executable java class. You may need to put the filename between quotes or double quotes if the path contains any spaces.
answers question: http://stackoverflow.com/q/26455340
score: 0
type: Answer

http://stackoverflow.com/q/26499828
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/26500017
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/41632021
has comment: http://stackoverflow.com/comment/41632083
has comment: http://stackoverflow.com/comment/41632339
score: 2
downvote count: 0
answer count: 1
has title: The most basic HttpGet request on Java
has answer: http://stackoverflow.com/a/26500017
favorite count: 0
has comment: http://stackoverflow.com/comment/41632051
has body: I need help performing a RESTful call to a website that returns a JSON object. I'm stuck with the options that are available but I would prefer to use something that comes right out of the box and not install any third party plugins. Here's what I currently have so far: import java.io.*; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGetRequest = new HttpGet("http://search.twitter.com/search.json?q=%40apple"); HttpResponse httpResponse = httpClient.execute(httpGetRequest); I know that the URL used in this example returns the following: {"errors":[{"message":"The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.","code":64}]} Which is fine by me, I just want to at least convert the JSON response into a string so that I can move on from here. I'm very familiar to how REST works and it's been pretty easy to get it working on Objective-C and Python but Java for some reason has a dozen implementations for getting it to work properly, I'm just looking for the most basic approach possible, I'm not doing anything crazy like uploading images to a server. So the issue with my code above is that I'm getting a ClientProtocolException error and the httpClient.execute() requires a try catch statement, this is something brand new to me, I've never had a compiler yell at me for not inserting try catch statements. How can I fix this to call a url that converts a very basic JSON object to a string?
has comment: http://stackoverflow.com/comment/41632010
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/a/26447082
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26447055
type: Answer
has body: You are using String methods on an array. To access the characters in the strings, you need to first get one of the String objects sitting in that array. Doing myName[0].charAt(0) for example will give you the first character of the first String in the array. If your intention is to do something with each character in each string in the array, you should use a loop like so: for (int i=0; i&lt;myName.length; i++){ for (int j=0; j&lt; myName[i].length(); j++){ myName[i].charAt(j); // Do something with ths value, I am just getting it here. } }
score: 2

http://stackoverflow.com/comment/41627057
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26496892
has text: Why does your `itunes` class extend ConsoleProgram? I don't know how the ACM library works, but it seems likely to me that you are only supposed to have one ConsoleProgram in your program.
score: 0

http://stackoverflow.com/comment/41480039
has text: Hi, tahnk you! I will try that out and let you know. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/26414197
score: 0
type: Comment

http://stackoverflow.com/a/26406698
upvote count: 2
has body: Fortify uses it's own JRE (look under [Fortify Install Root]\jre and [Fortify Install Root]\jre64). If you use -debug-verbose -logfile Project_Scan.txt you can see if there are issues the scanning engine is having with memory pressure anywhere since it dumps memory usage every so often. Be sure you are using the latest version of Fortify. If your scan is taking 20 hours, it could be that the latest version addresses the speed and memory issues. The latest is 4.20. To speed up the scan, have you looked at the Parallel Analysis Mode? This was introduced in 4.00 and you can read about it in the User Guide, Appendix B. I did some heavy memory tuning with the translation cycle at one point and the following worked well. It should also work for the scan cycle. Please note that this was an extreme memory usage case and this is not the best for all Fortify usage. -XX:MaxPermSize=256m -XX:NewRatio=4 -XX:SurvivorRatio=8 -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled -XX:+CMSScavengeBeforeRemark -XX:CMSInitiatingOccupancyFraction=68 You can / should use JConsole to watch the process.
answers question: http://stackoverflow.com/q/26401298
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/41530370
type: QuestionComment
comment on: http://stackoverflow.com/q/26443674
has text: I haven't used it yet, I figured that that would be how it should be used from this: http://en.wikipedia.org/wiki/Volatile_variable I am currently looking for the duplicate of my question, where is that? The suggested one doesn't address my issue at all. I know how the loop itself works, I want to know how the second argument is called if it isn't a field but a function call.
score: 0
type: Comment

http://stackoverflow.com/q/26442108
has answer: http://stackoverflow.com/a/26449695
accepted answer: http://stackoverflow.com/a/26449695
has comment: http://stackoverflow.com/comment/41527881
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41538774
has comment: http://stackoverflow.com/comment/41527429
tagged with: maven
type: Question
has title: creating new project in java with maven
has comment: http://stackoverflow.com/comment/41529719
has comment: http://stackoverflow.com/comment/41528956
has comment: http://stackoverflow.com/comment/41545304
tagged with: java
has comment: http://stackoverflow.com/comment/41541948
has body: I wanna create a java project with maven, when I type this command in cmd instead of creating a project it gives some error, I guess it is because of some internet problems but I don't know how to solve it. I don't use any proxy and I've tried this command even when my pc's firewall was turned off. the command I write in cmd is: mvn archetype:generate -DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false the rezult is: [INFO] Scanning for projects... Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.4/maven-install-plugin-2.4.pom [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.4 . . . [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.167 s [INFO] Finished at: 2012-05-18T21:09:38-07:00 [INFO] Final Memory: 3M/254M [INFO] ------------------------------------------------------------------------ [ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\a\.m2\repository), central (https://repo.maven.apache.o…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41528087
has comment: http://stackoverflow.com/comment/41527712
has comment: http://stackoverflow.com/comment/41540321
has comment: http://stackoverflow.com/comment/41527521
has comment: http://stackoverflow.com/comment/41527466
has comment: http://stackoverflow.com/comment/41528539

http://stackoverflow.com/comment/41479235
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26415340
has text: This is more flexiable solution, thanks for your advice

http://stackoverflow.com/comment/41524872
type: Comment
score: 0
has text: Sorry i missed ",". Please try with above code now.
type: AnswerComment
comment on: http://stackoverflow.com/a/26440508

http://stackoverflow.com/q/26361738
has body: I'm working on another issue with getting my build.gradle to understand a workspace project dependency in my Android project. I've been using Java and Android for a while and I'm still easily confused about all the different ways to add a dependency. One way is to put a .jar file in the libs/ folder. Another way is to have a workspace project dependency. Another way (if working with Android) is to add a project dependency in the Android options menu? I feel like if I truly understood why there are these different dependencies and how they work maybe I wouldn't constantly have issues with managing my dependencies (even with Gradle). Why would one want a project dependency instead of a normal .jar in the libs/ folder? I'm not even sure how a project dependency itself works. By project dependency, I mean something like the Google Play Services project that I have to import into my Eclipse workspace. When importing into Eclipse it doesn't copy the actual directory into the workspace but it's more like a link to the directory. I know this is a big topic, maybe someone can show me a concise place to gain information.
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: dependency-management
type: Question
tagged with: java
has title: What is the difference between a project dependency and other dependencies
tagged with: eclipse
tagged with: gradle
has answer: http://stackoverflow.com/a/26362190
answer count: 1

http://stackoverflow.com/comment/41778515
has text: @DavidWilliams: Your graph appears to be instance-method-M calls abstract-method-x. Imagine I have class X, which has a (possibly abstract) method x, and classes X1 and class X2 both inheriting from X with methods x' and x'' overriding x. The way you are constructing your graph, it appears that you know only that method m calls *some* x, but not specifically x, x' or x''. Is that what you really want for your call graph? If you want more information, you have to know *which* of X, X1, or X2 is used at the call site; that's why I said you need "points-to" analysis.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26519597

http://stackoverflow.com/a/77170585
answers question: http://stackoverflow.com/q/26481910
has comment: http://stackoverflow.com/comment/136044377
upvote count: 1
type: Answer
has body: Here is an alternate way to call the GraphViz native C functions without spawning any new processes. This method uses the very versatile and useful JNR-FFI library. Thanks @headius and co.! Step 1: Install graphviz on your system. Step 2: In your Java project add the required dependency to JNR-FFI. For example in a gradle project: implementation 'com.github.jnr:jnr-ffi:2.2.14' Step 3: The code (following this simple GraphViz C example): import jnr.ffi.LibraryLoader; import jnr.ffi.Pointer; public class GraphVizJNR { public interface LibGvc { Pointer gvContext(); Pointer agmemread(String dotText); int gvLayout(Pointer gvc, Pointer g, String engine); int gvRender(Pointer gvc, Pointer g, String format, Pointer out); int gvFreeLayout(Pointer gvc, Pointer g); int agclose(Pointer g); int gvFreeContext(Pointer gvc); } public interface LibC { Pointer fopen(String s, String mode); } public static void main(String[] args) { LibGvc libGvc = LibraryLoader.create(LibGvc.class).load("gvc"); LibC libc = LibraryLoader.create(LibC.class).load("c"); Pointer gvc = libGvc.gvContext(); Pointer g = libGvc.agmemread("digraph { a -> b; b -> c }"); int status = libGvc.gvLayout(gvc, g, "dot"); Pointer file = libc.fopen("/tmp/g.svg", "w"); status = libGvc.gvRender(gvc, g, "svg", file); status = libGvc.gvFreeLayout(gvc, g); status = libGvc.agclose(g); status = libGvc.gvFreeContext(gvc); } } The nice thing about JNR-FFI (similar to JNA), is that you only need to declare in the Java interface what you need from the native library.
downvote count: 0
score: 1

http://stackoverflow.com/a/26500689
has comment: http://stackoverflow.com/comment/41633931
has comment: http://stackoverflow.com/comment/41633916
has comment: http://stackoverflow.com/comment/41633523
type: AcceptedAnswer
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/41633469
accepted answer of: http://stackoverflow.com/q/26500655
has comment: http://stackoverflow.com/comment/41633599
answers question: http://stackoverflow.com/q/26500655
downvote count: 0
has comment: http://stackoverflow.com/comment/41633583
upvote count: 6
has body: Your book is wrong, and the serialVersionUID, which is static, is for dealing with different versions of the class itself. The idea of serialization is to take a live object (the one pointed to by usPresident) and save all its state into some external form (bytes, XML, JSON). You can then turn that state back into a copy of the object. It's like saving a file in your word processor. However, if you modify the object after serializing it, there's no connection. You've already written bytes out to disk, and they won't change because you call methods on the object. When you recreate the object from those bytes, it will have the same values it did when you saved it. If you forget to save your changes to your word-processing document, the file on disk still has the old contents. In your case, you're running into an quirk in Java serialization because you're writing the same object multiple times into the same ObjectOutputStream. So that you can serialize complex object relationships, Java serialization only saves an object once and then links back to it when it's saved again. Close and reopen the stream, and you should see updated values.

http://stackoverflow.com/comment/41407159
type: Comment
has text: I have static void main defined in that class. But it still gives no 'could not find or load main class Indexer'
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26375470

http://stackoverflow.com/comment/41610278
type: Comment
comment on: http://stackoverflow.com/q/26488012
has text: I have script which allows me to parse json, have strings setup to be able to receive the Strings the getJSONObject, allows to receive. So when someone entered 1, id 1 was returned in textviews, with corresponding info.. Now the product numbers have changed, now they contain letters.. Is there a way for me to be able to search for string or charsequence to still be able to return the id and corresponding info?
score: 0
type: QuestionComment

spring-test
tags question: http://stackoverflow.com/q/26469263
tag name: spring-test
type: Tag
tags question: http://stackoverflow.com/q/26400459

http://stackoverflow.com/q/26486534
upvote count: 2
tagged with: java
has body: I have a strange problem in Android. I am using Fragments and FragmentActivitys from the android.support.v4.app packages. However, it seems like FragmentActivity.getFragmentManager()'s returns an object of the type android.app.FragmentManager instead of android.support.v4.app.FragmentManager. The former is incompatible with the v4 Fragments, which causes me to have trouble using anything at all. For instance, the following code gives type mismatches: // "this" is a FragmentActivity, "frag" is a Fragment -- both from the v4 packages FragmentManager fm = this.getFragmentManager(); fm.beginTransaction() .replace(R.id.content_frame, frag) .commit(); This returns a type mismatch exception, because the replace() method does not accept a v4 Fragment as argument. Any thoughts on how to solve this strange problem?
accepted answer: http://stackoverflow.com/a/26486623
type: Question
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/26487911
has answer: http://stackoverflow.com/a/26487911
answer count: 2
score: 2
downvote count: 0
has title: Android: FragmentManager version mismatch
favorite count: 0
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26486623

http://stackoverflow.com/q/26364330
favorite count: 0
accepted answer: http://stackoverflow.com/a/26364729
has body: Is there a good reason why there is no: OptionalInt.ofNullable(Integer); It seems to be a perfect fit, if you want to convert an optional/nullable Integer to an OptionalInt. I'm currently using this util method I wrote: public static OptionalInt optionalIntOfNullable(Integer integer){ return integer == null ? OptionalInt.empty() : OptionalInt.of(integer); } what isn't that bad, however, I wonder if I have missed something.
has answer: http://stackoverflow.com/a/26364742
possible better answer: http://stackoverflow.com/a/26364742
downvote count: 1
tagged with: java-8
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/26327957
score: 21
tagged with: java
has comment: http://stackoverflow.com/comment/41386609
has title: Why isn't there an OptionalInt.ofNullable(Integer);
type: Question
tagged with: option-type
upvote count: 22
answer count: 2
has answer: http://stackoverflow.com/a/26364729

http://stackoverflow.com/a/26497142
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/26497055
has comment: http://stackoverflow.com/comment/41627432
has comment: http://stackoverflow.com/comment/41627587
has body: Change if(myObj.contains(MY_STRING)) { aBooleanFlag = true; } to if (myObj.getId().contains(MY_STRING)) { aBooleanFlag = true; }
type: Answer
has comment: http://stackoverflow.com/comment/41627492
upvote count: 1

http://stackoverflow.com/a/44253230
answers question: http://stackoverflow.com/q/26461226
score: 3
downvote count: 0
has body: Anyway the Permanent Generation is moved to native space and is out of GC competence in Java 8. So now it seems to be the same.
type: Answer
upvote count: 3

http://stackoverflow.com/comment/41505318
has text: But as far as I understand this method is not a method defined in Project. Why can we call it?
comment on: http://stackoverflow.com/a/26430238
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26390413
has comment: http://stackoverflow.com/comment/41434211
has title: My Object isn't being called in my main function
has comment: http://stackoverflow.com/comment/41434092
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26390591
has comment: http://stackoverflow.com/comment/41434739
tagged with: oop
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41434170
has comment: http://stackoverflow.com/comment/41434127
has answer: http://stackoverflow.com/a/26390467
has answer: http://stackoverflow.com/a/26390470
score: 0
answer count: 3
has body: I am trying to call my object via the main function. Since it needs static reference , but I somehow can't get to do it. Can someone please tell me what am I doing wrong? private double checking; private double saving; public BankDisplay(double checking,double saving) // Constructor for subclass { checking=1000; saving=1000; } public void setChecking(double checking){ this.checking=checking; } public double getChecking(){ return checking; } public void setSaving(double saving){ this.saving= saving; } public double getSaving(){ return saving; } BankDisplay checking1=new BankDisplay(checking, saving); BankDisplay savings1= new BankDisplay(checking,saving); When I am trying to print the object checking1 and saving1 in main it is showing "cant have a non static reference for a static function".

http://stackoverflow.com/comment/41638152
comment on: http://stackoverflow.com/q/26502955
has text: Don't post as multipart form or configure multipart support correctly.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26418346
has comment: http://stackoverflow.com/comment/41483441
has comment: http://stackoverflow.com/comment/41483795
has body: A simple regex could solve your problem : public static void main(String[] args) { String s = "s5656s"; System.out.println(s.replaceFirst("^[spr]", "")); // a String which begins with s,p or r } O/P: 5656s PS: regex here leads to smaller/simpler but inefficient code. Use Ruchira's answer for a rather long but efficient code. :)
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/41483809
has comment: http://stackoverflow.com/comment/41483477
has comment: http://stackoverflow.com/comment/41483845
has comment: http://stackoverflow.com/comment/41483653
has comment: http://stackoverflow.com/comment/41483820
upvote count: 4
answers question: http://stackoverflow.com/q/26418306

http://stackoverflow.com/q/26362920
has comment: http://stackoverflow.com/comment/41388601
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26365552
favorite count: 0
has comment: http://stackoverflow.com/comment/41388355
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26365552
tagged with: maven
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41387492
has body: I am using the maven-replacer-plugin together with the Maven build system to expand a template file to include the project's artifactId and version, but somehow seems to go wrong using the plugin, but I cannot figure out why as I seem to have a correct definition: Fragment from my pom.xml: com.google.code.maven-replacer-plugin maven-replacer-plugin 1.4.1 process-sources replace cardshifter-server.template.policy ${project.parent.build.directory}/${project.artifactId}-${project.version}.policy [artifactId] ${project.artifactId} [version] ${project.version} Running on the following cardshifter-server.template.policy: grant codeBase "file:./[artifactId]-[version].jar" { permission java.security.AllPermission; }; grant { //mod permissions }; with artifactId = cardshifter-server and version = 0.4-SNAPSHOT gives me the following output: gca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT ca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTBca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT "ca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOTca0.4-SNAPSHOTd0.4-SNAPSHOTh0.4-SNAPSHOTft0.4-SNAPSHOT0.4-SNAPSHOT-0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-SNAPSHOT0.4-…
has title: maven-replacer-plugin gives weirdly expanded output

http://stackoverflow.com/q/26512820
has comment: http://stackoverflow.com/comment/41658357
has comment: http://stackoverflow.com/comment/41658118
tagged with: struts2
score: 0
tagged with: exception
upvote count: 1
tagged with: junit
downvote count: 1
tagged with: action
favorite count: 0
type: UnansweredQuestion
has body: I am trying to instantiate a Struts Action class for Unit testing with JUnit. class MyAction extends ActionSupport implements ServletRequestAware, Preparable { // code goes here } My Unit test class: class MyActionTest { MyAction test; @Before public void setUp() { test = new MyAction(); // Throws error } } I get this error: [javac] MyActionTest.java:: cannot access com.opensymphony.xwork2.ActionSupport [javac] class file for com.opensymphony.xwork2.ActionSupport not found [javac] test = new MyAction(); What does it actually mean? It cannot find the class in the classpath? (If it is the case, then I thought it would throw ClassDefNotFound exception). Or is it an access issue? or something else?
answer count: 0
tagged with: java
has title: Struts 2 with JUnit- Instantiating Action class - class file for com.opensymphony.xwork2.ActionSupport not found
type: Question

http://stackoverflow.com/a/26367102
answers question: http://stackoverflow.com/q/26367015
has comment: http://stackoverflow.com/comment/41392142
upvote count: 1
type: Answer
has body: Your regex should be \\s{4} without the ^ in the beginning.
downvote count: 0
score: 1

http://stackoverflow.com/comment/41522813
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26358002
has text: You can play dim amount. lp.dimAmount=1f; make it black.
type: AnswerComment

http://stackoverflow.com/q/26439507
has title: How to serialize PKCS10CertificationRequest in BouncyCastle to send it over network?
answer count: 1
downvote count: 0
tagged with: deserialization
favorite count: 0
tagged with: serialization
tagged with: bouncycastle
upvote count: 2
linked to: http://stackoverflow.com/q/2914521
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has body: I have been trying to serialize the object PKCS10CertificationRequest for a while now. I figured the right way to do it is to create an ASN1Primitive class, send it over the network, then deserialize it. However, there seems to be only serialization into ASN1, but there seems to be no deserialization from ASN1, and I don't want to manually parse and reconstruct the Request. What should I do? My code so far is Security.addProvider(new BouncyCastleProvider()); KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "SC"); kpg.initialize(1024); KeyPair kp = kpg.genKeyPair(); System.out.println("Private: " + kp.getPrivate()); System.out.println("Public: " + kp.getPublic()); X500NameBuilder x500NameBld = new X500NameBuilder(BCStyle.INSTANCE); x500NameBld.addRDN(BCStyle.C, "AU"); x500NameBld.addRDN(BCStyle.O, "The Legion of the Bouncy Castle"); x500NameBld.addRDN(BCStyle.L, "Melbourne"); x500NameBld.addRDN(BCStyle.ST, "Victoria"); x500NameBld.addRDN(BCStyle.EmailAddress, "feedback-crypto@bouncycastle.org"); X500Name subject = x500NameBld.build(); PKCS10CertificationRequestBuilder requestBuilder = new JcaPKCS10CertificationRequestBuilder(subject, kp.getPublic()); PKCS10CertificationRequest req1 = requestBuilder.build(new JcaContentSignerBuilder("SHA1withRSA").setProvider("SC").build( kp.getPrivate())); JcaPKCS10CertificationRequest req2 = new JcaPKCS10CertificationRequest(req1.getEncoded()).setProvider("SC"); //serialization ByteArrayOutputStream abOut = new ByteArrayOutputStream(); ASN1OutputStream berOut = new ASN1OutputStream(abOut); berOut.writeObject(req2.toASN1Structure()); byte[] serializedData = abOut.toByteArray(); ASN1Primitive asn1Primitive = ASN1Primitive.fromByteArray(serializedData); System.out.println(""); System.out.println("" + asn1Primitive.toString()); And the output is [[0, [2.5.4.6, AU, 2.5.4.10, The Legion of the Bouncy Castle, 2.5.4.7, Melbourne, 2.5.4.8, Victoria, 1.2.840.113549.1.9.1, feedback-crypto@bouncycastle.org], [[1.2.…
tagged with: pem
has answer: http://stackoverflow.com/a/26439508
accepted answer: http://stackoverflow.com/a/26439508

http://stackoverflow.com/q/26508743
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: public static void main(String[] args){ try{ FileInputStream fileInputStream=new FileInputStream("sourcefile.txt"); File file1=new File("copy1.txt"); File file2=new File("copy2.txt"); //firstcopy FileOutputStream fileOutputStream1=new FileOutputStream(file1); fileCopy(fileInputStream, fileOutputStream1); fileOutputStream1.close(); //secondcopy FileOutputStream fileOutputStream2=new FileOutputStream(file2); fileCopy(fileInputStream, fileOutputStream2); fileOutputStream2.close(); }catch(FileNotFoundException fileNotFoundException){ System.err.println(fileNotFoundException.getMessage()); fileNotFoundException.printStackTrace(); }catch(IOException ioException){ ioException.printStackTrace(); } } //file copy function public static void fileCopy(FileInputStream fileInputStream,FileOutputStream fileOutputStream) throws IOException{ byte[] buffer = new byte[1024]; int length; //copy the file content in bytes while ((length = fileInputStream.read(buffer)) &gt; 0){ fileOutputStream.write(buffer, 0, length); } fileInputStream.close(); fileOutputStream.close(); System.out.println("File is copied successful!"); } Output: File is copied successful! java.io.IOException: Stream Closed at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:243) at FileCopier.fileCopy(FileCopier.java:38) at FileCopier.main(FileCopier.java:21) Why my secondcopy is not working? It is working when I am passing "new FileInputStream("sourcefile.txt")" directly instead of fileInputsteam object.
has answer: http://stackoverflow.com/a/26508786
tagged with: fileinputstream
answer count: 1
downvote count: 0
favorite count: 0
has title: FileInputStream is getting closed when passing second time to a function in java
accepted answer: http://stackoverflow.com/a/26508786
upvote count: 2

http://stackoverflow.com/comment/41638689
type: QuestionComment
has text: Not clear for me. sorry. give a dump code snapshot
comment on: http://stackoverflow.com/q/26503102
score: 0
type: Comment

http://stackoverflow.com/comment/41629907
has text: Please also post where you saw this example (links).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26498474
type: QuestionComment

http://stackoverflow.com/q/26427897
type: Question
has comment: http://stackoverflow.com/comment/41501179
tagged with: java
has comment: http://stackoverflow.com/comment/41942814
score: 0
tagged with: runtime
answer count: 1
has comment: http://stackoverflow.com/comment/41503063
has answer: http://stackoverflow.com/a/53754725
has body: On Windows, I try to execute a java command (java -version for example) using Runtime.getRuntime().exec("java -version"). There is no errors , but the command seems to be never executed. Or JAVA is called but do nothing. I put this command in a BAT file and try to execute Runtime.getRuntime().exec("file.bat"). I have the same bad result. Six months before, it was OK. Is there any RESTRICTIONS now to do that ? Only on Windows ? Thanks for your help.
has title: java exec a java command with failure
tagged with: exec
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/74561196

http://stackoverflow.com/q/26447643
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26447696
possible better answer: http://stackoverflow.com/a/26447673
score: -3
has body: i have the following files: 1006_3906_33824_Finder2.gif, 1006_3906_33824_MapE.gif, 1006_3906_33824_Summary.txt, 1007_334_33098_Finder2.gif, 1007_334_33098_MapE.gif, 1007_334_33098_Summary.txt i need to sort files by the numbers not the last part. The algorithm should read the string "1006_3906_33824_Finder2.gif" and make a folder with this part of the file: "1006_3906_33824" and "1007_334_33098_Finder2.gif" a folder named "1007_334_33098" etc etc. how do i do this in Java? Code: public class Sorter { public static void organizeIntoFolders() { File folder = new File("path"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { System.out.println(parseFilename(listOfFiles[i].getName())); } } } public static String parseFilename(String filename) { String s = filename.substring(0, filename.lastIndexOf('_') - 1); return s; } public static void makeDir(String dirname) { File dir = new File(dirname); if (!dir.exists()) { dir.mkdir(); } } }
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/26447673
upvote count: 1
has title: Reading beginning of filename and creating folder with that name in java
favorite count: 0
accepted answer: http://stackoverflow.com/a/26447696
downvote count: 4

http://stackoverflow.com/a/26375729
upvote count: 2
answers question: http://stackoverflow.com/q/26375678
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26375678
type: Answer
score: 2
has body: I would read the and parse the command line arguments before calling the constructor. public static void main (String[] args) { int numEach = 0; // or some other default value that makes sense int boatSize = 0; // or some other default value that makes sense if (args.length &gt; 1) numEach = Integer.parseInt(args[1]); if (args.length &gt; 3) boatSize = Integer.parseInt(args[3]); RiverCrossingPuzzle puzzle = new RiverCrossingPuzzle (numEach, boatSize); } You should also add exception handling in case the command line arguments cannot be parsed at int. BTW, based on your "-n", "4", "-b", "3" example, you should be reading args[1] and args[3].

http://stackoverflow.com/comment/41636923
score: 0
has text: I have nothing. sorry for not mentioning that. I googled a little after you posted the question, and did Add->Standard VM-> and in JRE Home, I pushed "Directory", however in the "Library" folder, there is no "Java" folder, I remind you I'm using mac
comment on: http://stackoverflow.com/a/26502440
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/116077749
type: AnswerComment
comment on: http://stackoverflow.com/a/26364729
score: 0
type: Comment
has text: @Holger if you use OptionalInt you pay one box cost, but subsequent code will not perform expensive boxed computations (because the methods to allow it don't exist). If you use Optional<Integer> you save the one box cost but you have a longer-lived Integer wrapper and also clients may use map, flatMap etc which will be expensive from a boxing perspective. So to me, it seems the choice would depend on context.

http://stackoverflow.com/q/26425889
score: 5
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41496751
has comment: http://stackoverflow.com/comment/41496726
has title: Scheduling task using java spring mvc
has body: I need to schedule a task to run automatically in java..I need the same functionality of window scheduling.I have done for daily,yearly but stuck when i came to weekly scheduling..not getting how to do this. I am using java calendar.Please help to find one good solutions. Any help or ideas would be appreciable
upvote count: 5
downvote count: 0
type: UnansweredQuestion
tagged with: calendar
tagged with: java
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/26425946
type: Question

http://stackoverflow.com/q/26387268
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/41428375
type: Question
has answer: http://stackoverflow.com/a/26387311
tagged with: duplicates
tagged with: arraylist
has body: First of all I've been reading to avoid possible duplicates and I have to say this doesn't seem any static declaration issue. I have this code: String[] bonoActual = (String[]) it.next(); String[] auxBono = new String[3]; ArrayList&lt;String[]&gt; bonosTemp = new ArrayList&lt;String[]&gt;(); ArrayList&lt;Integer&gt; abosTemp = new ArrayList&lt;Integer&gt;(); System.out.println("Añadiendo: "+bonoActual[0] + "a bonostemp"); bonosTemp.add(bonoActual); abosTemp.add(abo); auxBono[0] = aux; auxBono[1] = String.valueOf(udsPrecio[1]); auxBono[2] = fecValor; bonosTemp.add(auxBono); abosTemp.add(abo); System.out.println("Añadido: "+auxBono[0] + "a bonostemp"); The values of aux, abo and fecValor are correctly being assigned from other sources, bonoActual is being initialized in a loop and retrieving from other sources and this is the console output: Añadiendo: BONO DATOS 1 GIGA AGOSTO (-) BONO VOZ 100 MINUTOS AGOSTO (-)a bonostemp Añadido: BONO DATOS 1 GIGA SEPTIEMBRE (-)a bonostemp Which is correct, however when I look at bonosTemp while debugging, both entries have this value in the position 0 of the array values: BONO DATOS 1 GIGA SEPTIEMBRE (-) Any ideas why this may be happening?
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26387311
favorite count: 0
linked to: http://stackoverflow.com/q/19843506
has title: ArrayList being incorrectly updated, overwritting all with the last item
has comment: http://stackoverflow.com/comment/41428423
type: AnsweredQuestion

http://stackoverflow.com/q/26509053
has answer: http://stackoverflow.com/a/26509208
score: 0
answer count: 1
has body: I am trying to develop an applet in JavaCard which will have to compute operations with big values (500bits approximately). In more detail, I need to do an addition and a multiplication. As I am using JavaCard 2.2.2, my big values can only be represented by an array of bytes or an array of shorts. My question is the following : if I define how to do a multiplication and an addition of two arrays like described above, could I develop an applet to do what I want ? Thank you very much to help me :)
tagged with: java
accepted answer: http://stackoverflow.com/a/26509208
type: AnsweredQuestion
tagged with: applet
type: Question
has title: Computation with big values in JavaCard

http://stackoverflow.com/comment/41495468
has text: I am ok, that it depends on situation but on common sense I would expect default message will be resolved as "most meaningful". Ok In any case you can post this comment as an answer and I'd accept it. Thanks
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26418730
score: 0

http://stackoverflow.com/comment/41635529
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26470664
type: Comment
has text: tnx , its working that way , but is there way to put the chrome driver under 'BeforeTest' - and use it during the @Test ?

http://stackoverflow.com/comment/41654377
comment on: http://stackoverflow.com/q/26511402
type: QuestionComment
has text: lol that makes sense... But calling it in the main method simply gives me an error. I'm not sure which parameters to pass...
type: Comment
score: 0

http://stackoverflow.com/comment/41496415
comment on: http://stackoverflow.com/a/26425444
score: 0
type: Comment
has text: There is no XText version 2.7.2 in eclipse bug tracker. I can choose 2.7.1. Would be ok, if I add the bug to 2.7.1?
type: AnswerComment

http://stackoverflow.com/a/26354710
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26354581
has body: The oracle java tutorials on Creating Exception Classes Has this to say: You should write your own exception classes if you answer yes to any of the following questions; otherwise, you can probably use someone else's. Do you need an exception type that isn't represented by those in the Java platform? Would it help users if they could differentiate your exceptions from those thrown by classes written by other vendors? Does your code throw more than one related exception? If you use someone else's exceptions, will users have access to those exceptions? A similar question is, should your package be independent and self-contained? Additionally, I'd like to add that you should generally throw an exception if the current scope does not have enough information to effectively handle the exception. When you throw an exception, you pass it up the stack to be handled in a different scope.

http://stackoverflow.com/comment/41371033
comment on: http://stackoverflow.com/q/26356104
type: QuestionComment
has text: any effort from your side?
type: Comment
score: 0

http://stackoverflow.com/q/26380923
has comment: http://stackoverflow.com/comment/41421316
tagged with: linux
favorite count: 0
possible better answer: http://stackoverflow.com/a/26385826
tagged with: c++
has comment: http://stackoverflow.com/comment/41421443
upvote count: 1
has comment: http://stackoverflow.com/comment/41420025
tagged with: jakarta-ee
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41423295
has answer: http://stackoverflow.com/a/26385826
type: Question
has answer: http://stackoverflow.com/a/26383659
accepted answer: http://stackoverflow.com/a/26383659
answer count: 2
has body: I am calling a C application (console only) from my Java application. I am calling it with: Process proc = rt.exec("./Debug/CPP_CL --device 0"); The CPP_CL needs access to clinfo() hardware .. so the GPU hardware as its processing on the GPU's. Hence, in this case needs to run as sudo/root. Its all working fine at the moment but only if I run the Java JAR as sudo. Currently for testing only the CPG is chmod 777 (I know bad). What I would like to know is what’s the best way to do this ? Will the CPP run as SUDO if called by SUDO java ? Or does it need to be chmod'ed ? If so what’s the best chmod value ? Thanks.
downvote count: 0
has comment: http://stackoverflow.com/comment/41420831
has title: Sudo Java calling C app and Permissions

http://stackoverflow.com/comment/41452380
type: Comment
type: QuestionComment
score: 1
has text: Please post code of your `doFinal` method.
comment on: http://stackoverflow.com/q/26401076

http://stackoverflow.com/comment/41445024
type: Comment
type: QuestionComment
has text: When i run LoadAllCity it populate data in table but loadAll gives map size zero.
score: 0
comment on: http://stackoverflow.com/q/26396677

http://stackoverflow.com/comment/41491299
has text: i am using ms sql 2008 database....and this proc uses another database i want to pass as a parameter.....
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26422802

http://stackoverflow.com/a/26370930
has comment: http://stackoverflow.com/comment/41399811
upvote count: 3
has comment: http://stackoverflow.com/comment/41438045
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41438576
has comment: http://stackoverflow.com/comment/41438303
type: Answer
has comment: http://stackoverflow.com/comment/41399742
has comment: http://stackoverflow.com/comment/41419849
downvote count: 0
has comment: http://stackoverflow.com/comment/41438176
accepted answer of: http://stackoverflow.com/q/26366556
has comment: http://stackoverflow.com/comment/41438478
has body: I just can't resist, this is my final attempt to help. :) I'm writing this for you and for any users who may encounter similar issues. I believe you simply have a problem in the Eclipse project configuration. The paths in your Eclipse project do not seem correct. Normally, when you import an existing Maven project into Eclipse using File > Import... > Existing Maven Projects, m2eclipse should analyse the structure of the Maven project and create Eclipse project with (.classpath and .project files) automatically. The paths in these projects are derived from your Eclipse pom.xml. So you actually should not create/modify/add/remove/copy/move/whatever Eclipse source folders. If you do this, your Eclipse project will no longer be synchronized with your Maven project and you'll get really weird results. Sometimes m2eclipse does not do its job well. Sometimes you don't get the right source folders, things go missing etc. From my experience, this got radically better over the time and right now m2eclipse works like a charm. From what I saw in your struggles, it might be that you have an older version of m2eclipse. Maybe not, but I'd suggest to check it anyway. Next, sometimes m2eclispe still clamps. In this cases it is highly recommended to do the following things: Clean the project: Project > Clean... Update the Maven project (Alt + F5). Make sure to update the project configuration from pom.xml Finally you should get the following project structure: Specifically, you should get the following source folders: src\main\java - source folder for your main Java files src\main\resources - source folder for resources target\generated-sources\xjc - source folder for the generated code. Important: not target\generated-sources like you have but target\generated-sources\xjc. This folder contains the generated Java classes. (Hyperjaxb adds JPA annotations to them). It also contains META-INF\persistence.xml which is a persistence unit descriptor. The META-INF\persistence.xml resource i…
has comment: http://stackoverflow.com/comment/41402628
has comment: http://stackoverflow.com/comment/41433342
answers question: http://stackoverflow.com/q/26366556
has comment: http://stackoverflow.com/comment/41437968
score: 3
has comment: http://stackoverflow.com/comment/41430595

http://stackoverflow.com/a/26420123
type: Answer
upvote count: 4
has body: generally there is always a build manager associated with a project, for example maven or ant which abstracts out the complexity of managing dependency and packaging I would mavenize project
score: 3
answers question: http://stackoverflow.com/q/26420084
downvote count: 1

http://stackoverflow.com/comment/41634072
type: Comment
type: QuestionComment
has text: `alert.isShowing()` method.
score: 0
comment on: http://stackoverflow.com/q/26500996

http://stackoverflow.com/q/26408684
score: 0
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/26410494
tagged with: jtextfield
tagged with: jbutton
type: Question
has body: I'm working on a TextTwist java implementation and I'm currently working on the GUI. I was wondering if some of you Swing geniuses could help me out. I'm trying to do a GUI where whenever a button is clicked, the text of that button is written into the first empty textField below it. I'm having trouble thinking through how to do it. What I've tried so far makes the first button click fill all the TextFields. Any help or pointers in the right direction would be great. private void makeButtonLayout() { this.charArray = new char[6]; ArrayList&lt;Character&gt; charArrayList = new ArrayList&lt;Character&gt;(); this.charArray = this.randomString.toCharArray(); for(char tempCharacter : this.charArray){ charArrayList.add(tempCharacter); } for (int i = 0; i&lt; 6; i++){ JButton letterButton = new JButton(); Character buttonCharacter = charArrayList.get(i); charArrayList.remove(i); String letterString = buttonCharacter.toString(); letterButton.setText(letterString); this.letterButtonsArray.add(letterButton); } for (final JButton currentButton : this.letterButtonsArray){ this.buttonPanel.add(currentButton); currentButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { int i = 0; currentButton.setVisible(false); JTextField temporaryTextField = new JTextField(); String temporaryString = currentButton.getText(); temporaryTextField.setText(temporaryString); if(textFieldArray.get(i).getText().isEmpty()){ textFieldArray.get(i).setText(temporaryString); return; }else{ i++; return; } } }); } }
accepted answer: http://stackoverflow.com/a/26410494
answer count: 1
has title: Making a button write to one JTextField in an Array
type: AnsweredQuestion

http://stackoverflow.com/q/26459372
has comment: http://stackoverflow.com/comment/41558578
favorite count: 0
has comment: http://stackoverflow.com/comment/41558506
has comment: http://stackoverflow.com/comment/41558441
answer count: 5
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26459400
has body: I'm doing this little program, but unfortunately I ran into this issue.. if (ccnString.charAt(0) != '4' || ccnString.charAt(0) != '3') { System.out.println("The String entered does not fit any of the Credit card standards"); System.exit(0); } My program does not recognize if I put in any of the integers in my String. However, if I delete my || and the last part, the if statement recognizes the first integer. What am I missing here?
tagged with: java
downvote count: 1
has title: Java if and || issue
type: Question
tagged with: jgrasp
has comment: http://stackoverflow.com/comment/41558465
has comment: http://stackoverflow.com/comment/41558686
tagged with: if-statement
has answer: http://stackoverflow.com/a/26459390
has answer: http://stackoverflow.com/a/26459388
tagged with: boolean
score: 0
possible better answer: http://stackoverflow.com/a/26459739
has answer: http://stackoverflow.com/a/26459483
has answer: http://stackoverflow.com/a/26459400
has answer: http://stackoverflow.com/a/26459739

http://stackoverflow.com/comment/41520041
type: QuestionComment
has text: @getlost username, password and captcha is gonna be entered by students...no problem with that
comment on: http://stackoverflow.com/q/26387186
score: 0
type: Comment

http://stackoverflow.com/comment/41544258
score: 0
type: AnswerComment
has text: I didn't worry about using String as IDs it was just more convenient to use Long as all my entities have Long ids (using Objectify and String won't auto-generate ids), but I will use String when storing the facebook-id in the future. Thank you!
type: Comment
comment on: http://stackoverflow.com/a/26450717

http://stackoverflow.com/q/26393020
linked to: http://stackoverflow.com/q/7300309
has body: i have a problem when i try to insert data into my database. I am doing it with jpa (persist). Here is my code where i call the method insert private static ServiceTicketRemote serviceTicket; ...... ...... public void insertDevices(ActionEvent acteven) { java.sql.Date sqlDate = new java.sql.Date(dateDev.getTime()); if(modele.equals("")|| serialNumber.equals("") || sqlDate.equals("") || categorie.equals("Select device")) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Champ(s) vide(s)", ""); FacesContext.getCurrentInstance().addMessage(null, msg); } else { Devices device = new Devices(); Personnel as = getBeanLogin().getAgentSupport(); Agentinfo agent = getBeanAgentinfo().getSelectedAgentInfo(); device.setAgentinfo(agent); device.setPersonnel(as); device.setCategorie(categorie); device.setModele(modele); device.setNumeroSerie(serialNumber); device.setDateEnvoi(sqlDate); try { serviceTicket.insertDevices(device); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage (FacesMessage.SEVERITY_INFO,"Device added", "")); } catch(Exception e) { System.out.println("##########ERROR########createPers()########LoginBean#######" + e.getMessage()); FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,"echec de l'ajout : error", e.getMessage()); FacesContext.getCurrentInstance().addMessage(null, msg); } } } and in my class serviceTicketRemote i have the method insertDevices (Devices device) that i call like this: @PersistenceContext(unitName = "jpa") private EntityManager em; @Override public Devices insertDevices(Devices device) { try { em.persist(device); } catch (Exception e) { System.out.println("##ERROR# insertNewTicketting " + e.getMessage());} return device; } and this is my entity bean Devices: @Entity public class Devices implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="id_device") private int idDevice; //bi-directional many-to-one associat…
has comment: http://stackoverflow.com/comment/41451869
has comment: http://stackoverflow.com/comment/41451945
score: 0
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/41440241
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26398152
has title: JPA insertion in the database failed
has comment: http://stackoverflow.com/comment/41446999
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41447589

http://stackoverflow.com/q/26368081
score: 0
answer count: 3
has body: I have an array of N elements and contain 1 to (N-1) integers-a sequence of integers starting from 1 to the max number N-1-, meaning that there is only one number is repeated, and I want to write an algorithm that return this repeated element, I have found a solution but it only could work if the array is sorted, which is may not be the case. ? int i=0; while(i&lt;A[i]) { i++ } int rep = A[i];
tagged with: repeat
downvote count: 1
has comment: http://stackoverflow.com/comment/41402457
has comment: http://stackoverflow.com/comment/41393472
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41393710
has comment: http://stackoverflow.com/comment/41393872
has title: repeated element in Array
has comment: http://stackoverflow.com/comment/41394112
has answer: http://stackoverflow.com/a/26368276
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41394459
tagged with: java
has comment: http://stackoverflow.com/comment/41393726
has answer: http://stackoverflow.com/a/26368451
has comment: http://stackoverflow.com/comment/41393579
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/41394443
tagged with: arrays
has comment: http://stackoverflow.com/comment/41394958
has answer: http://stackoverflow.com/a/26368281
favorite count: 0

http://stackoverflow.com/a/57133574
score: 1
answers question: http://stackoverflow.com/q/26393906
upvote count: 1
has body: This happened to me as well when I tried to send email from ktor server app using SimpleEmail. The difference in my case was that I had my email at custom g-suit domain with 2-step verification turned on and I couldn't use "less secure apps" settings: This setting is not available for accounts with 2-Step Verification enabled. Such accounts require an application-specific password for less secure apps access I generated app spefific password and used it instead of my main gmail password and it worked. val email = SimpleEmail() email.hostName = "smtp.gmail.com" email.setSmtpPort(587) email.setAuthenticator(DefaultAuthenticator("info@customdomain.app", "APPLICATION_SPECIFIC_PASSWORD")) email.isSSLOnConnect = true email.setFrom("info@customdomain.app") email.subject = "TestMail" email.setMsg("This is a test mail... :-)") email.addTo("foo@bar.com") email.send() Create app password info
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41505607
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26430238
has text: With `apply` it's a bit easier because here You can find the method declaration that takes a `Map` as an argument: http://www.gradle.org/docs/current/javadoc/org/gradle/api/Project.html#apply(groovy.lang.Closure). With configurations it's a bit different because they're created at runtime.

http://stackoverflow.com/a/26459876
upvote count: 3
has comment: http://stackoverflow.com/comment/41559463
has comment: http://stackoverflow.com/comment/41559477
has body: ^[A-Za-z][A-Za-z0-9@.]*?(?:\babc\b|\bxyz\b)\\.com$ Try this.[abcxyz] will match just 1 character like a,b, etc.
type: Answer
answers question: http://stackoverflow.com/q/26459858
downvote count: 0
has comment: http://stackoverflow.com/comment/41559368
score: 3
has comment: http://stackoverflow.com/comment/41559392

http://stackoverflow.com/q/26428093
possible better answer: http://stackoverflow.com/a/26428601
has answer: http://stackoverflow.com/a/26428601
has title: confused with the design of servlet
accepted answer: http://stackoverflow.com/a/26428239
has body: I want to create servlet which receive data in Json format and store data in the database. When i send data to servlet through http request, it will establish connection with table, create table, and store the data. The code to create connection and table has to be done only for the first time. I am not able to come up with design of code which create connection and table for the first time and store data into rows for the rest of the time My code is as follows :- public class Master extends protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { handle(request, response); } private void handle(HttpServletRequest req, HttpServletResponse resp) { JSONObject jsonObject = null; if ( req.getMethod().equalsIgnoreCase("POST")) { try { String jsonString = extractJsonBody() /* code for connection with database create table store the data */ } catch (Exception e) { System.out.println("Json in bad format"); } } }
has comment: http://stackoverflow.com/comment/41501222
type: AnsweredQuestion
tagged with: web-applications
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41502056
has answer: http://stackoverflow.com/a/26428239
tagged with: servlets
score: 0
answer count: 2

http://stackoverflow.com/q/26374660
tagged with: date
type: Question
answer count: 2
has body: I'm trying to connect java with mysql but I'm having the next problem with an insert query, the values of a date keeps subtracting themselves for example if I put the date 1995-04-16 it will try to input the value 1975 in the database. The code I'm using is the next: public void insertIntoUsuario() { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); try { System.out.println("Ingrese su cedula: "); int cedula = scan.nextInt(); System.out.println("Ingrese sus nombres: "); String nombres = scan.next(); System.out.println("Ingrese sus apellidos: "); String apellidos = scan.next(); System.out.println("Ingrese la fecha de nacimiento: "); String date = scan.next(); java.sql.Date sqlDate = new java.sql.Date(format.parse(date).getTime()); System.out.println("Ingrese su ingreso mensual: "); float ingresos_mensuales = scan.nextFloat(); System.out.println("Ingrese un nombre de usuario: "); String nombre_usuario = scan.next(); System.out.println("Ingrese una pass virtual: "); String pass_virtual = scan.next(); System.out.println("Admin: por defecto es 0"); int is_admin = 0; System.out.println("Visita: "); int first_visit = scan.nextInt(); System.out.println(sqlDate + "f"); st.executeUpdate("insert into usuario (cedula, nombres, apellidos, fecha_nacimiento, ingresos_mensuales, nombre_usuario, pass_virtual, is_admin, first_visit) VALUES ('" + cedula + "','" + nombres + "','" + apellidos + "'," + sqlDate + ",'" + ingresos_mensuales + "','" + nombre_usuario + "','" + pass_virtual + "','" + is_admin + "','" + first_visit + "') "); } catch (Exception ex) { System.out.println(ex); } }
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/26374788
has title: Java: insert a date within a Mysql database
has comment: http://stackoverflow.com/comment/41405606
has comment: http://stackoverflow.com/comment/41405628
has answer: http://stackoverflow.com/a/26374768
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26374768
accepted answer: http://stackoverflow.com/a/26374788
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/26419841
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/41486023
has comment: http://stackoverflow.com/comment/41486150
tagged with: arrays
has comment: http://stackoverflow.com/comment/41486028
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26419966
has comment: http://stackoverflow.com/comment/41502726
has title: Split an array of Bytes previously read from a file
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41486104
has comment: http://stackoverflow.com/comment/41486002
has body: I have a recursive function, which takes as an argument an array of Bytes (read from a file) and then tries to split it into two parts for recursion calls. The file format is for example like this: word1 word2 word3 word4 .... word97 word98 word99 word100 So, to read it I use this code: byte[] content = new byte[(int) file.length()]; FileInputStream fileInputStream = null; fileInputStream = new FileInputStream(file); fileInputStream.read(content); But then I would like to Split the content array into two parts that each would represent the half of the original file. For example if the original file contains four lines, then the firstHalf array would contain the first two lines and the secondHalf array the last two lines of the original file. I used this: int halfTheLengthOfContent = (int) Math.ceil(content.length / 2.0); firstHalf = Arrays.copyOfRange(content, 0, halfTheLengthOfContent) and secondHalf = Arrays.copyOfRange(content, halfTheLengthOfContent + 1, content.length) But it doesn't work since the resulting arrays don't correspond to what I want. What I want is that the firstHalf array would contain the same content as if I've done this (with file1 this time containing the first half of the content of the original file and file2 the second half of it): byte[] firstHalf = new byte[(int) file1.length()]; FileInputStream fileInputStream = null; fileInputStream = new FileInputStream(file1); fileInputStream.read(firstHalf); and byte[] secondHalf = new byte[(int) file2.length()]; FileInputStream fileInputStream = null; fileInputStream = new FileInputStream(file2); fileInputStream.read(secondHalf); For example if the original file is this: word1 word2 word3 word4 word5 word6 word7 word8 Then file1 is: word1 word2 word3 word4 and file2 is this: word5 word6 word7 word8 Could you please help me ?
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/26419966

http://stackoverflow.com/a/26496493
answers question: http://stackoverflow.com/q/26496408
has body: Change your connection string to make it connect to the right database on localhost conn = DriverManager.getConnection("jdbc:mysql://localhost/employees?user=root&amp;password="); Alternatively you can specify the "full" path to the tables, i.e. database.tablename: sql = "SELECT id, first, last, age FROM employees.employees";
type: Answer
downvote count: 0
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26496408
upvote count: 3

http://stackoverflow.com/a/26442117
accepted answer of: http://stackoverflow.com/q/26441604
answers question: http://stackoverflow.com/q/26441604
has body: I need to fill the values of an array (double[] myArray) using Scanner input from a single line for multiple doubles. If I understand this correctly first you need to read entire line and then parse it to read all double values from it. To read entire line of doubles from user you can invoke nextLine from scanner which handles System.in stream. Then you can either split line on spaces and use Double.parseDouble(String) (to get double from String) on each String element from result array wrap this line with another Scanner and use its nextDouble. BTW if you want to read next line after nextDouble (or nextInt or nextAnythingExceptLine) you need to consume reminded line separators with another nextLine method (more info here Scanner is skipping nextLine() after using next(), nextInt() or other nextFoo() methods). So first part of your assignment can look like Scanner sc = new Scanner(System.in); System.out.println("Please input the size of array: "); int arraySize = sc.nextInt(); sc.nextLine();//consume line separator to let `nextLine` read actuall next line double[] myArray = new double[arraySize]; System.out.print("Please input " + arraySize + " double numbers in one line: "); String line = sc.nextLine(); System.out.println("your numbers are "+line); Scanner lineScanner = new Scanner(line); int j = 0; while (lineScanner.hasNextDouble()) { myArray[j++] = lineScanner.nextDouble(); } lineScanner.close(); Your second problem is that generics don't support primitive types so T in asList(T..) can be only object type. Unfortunately autoboxing works only on primitive types, so double[] can't be promoted to Double[] because every array is already an object (even arrays of primitive types). This means that result of Arrays.asList(T.. data) for argument myArray of type double[] will not return List&lt;double&gt; or List&lt;Double&gt; but List&lt;double[]&gt; — a list which holds one object, the passed array, not the elements of this array. That is why reversing doesn't work for…
has comment: http://stackoverflow.com/comment/41527511
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41527572
downvote count: 0

http://stackoverflow.com/a/26367410
has body: While you may also be troubled by issues of eventual consistency, it's also likely that you are not demarcating your requests correctly. This will have two effects: You'll get session contamination, and pending asynchronous operations will not be committed. Like JPA and JDO, Objectify is based on the idea of a session-of-work. In normal operation, this session of work is started and closed by the ObjectifyFilter; you get one session per request, and at the end of the session all pending async &amp; deferred operations are flushed to the datastore. In unit tests, there is no ObjectifyFilter and no implied notion of a request. For example, any individual test could make multiple requests! This is especially common if you are testing JAX-RS methods directly; each method is a separate request. Thus, it's up to you to establish this context. In Objectify 5.1 and later, you must explicitly start a context. The best way is this: ObjectifyService.run(new VoidWork() { public void vrun() { // the code you want to execute within a single request } }); You might call this multiple times within a test to simulate multiple requests. If, on the other hand, you are writing tests with the idea that each test executes fully within the context of a single request, you can set up and tear down that context in @Before/@After methods (or @BeforeMethod/@AfterMethod if using TestNG). See the static method ObjectifyService.begin(). These are not mutually exclusive options; you can perform a run() operation even while a prior context exists; Objectify contexts work like a stack.
score: 2
answers question: http://stackoverflow.com/q/26354832
has comment: http://stackoverflow.com/comment/72800283
downvote count: 0
type: Answer
upvote count: 2

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/26430475
tag name: google-oauth

http://stackoverflow.com/comment/41616315
score: 0
has text: if you are using `setListAdapter()` your activity must `extends ListActivity`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26491187

http://stackoverflow.com/q/26477658
has body: Just following the basic android documentation on FragmentTabHost (top example - FragmentTabHost in an Activity) and received the following error: 10-21 02:30:07.409 26265-26265/com.example E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.ClassCastException: com.example.Main cannot be cast to android.support.v4.app.Fragment What's strange is that I've followed everything properly and installed the necessary packages. Main.java import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTabHost; public class Main extends FragmentActivity { // Fragment TabHost as mTabHost private FragmentTabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost); mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("Tab1"), Main.class, null); mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Tab2"), ListNewItem.class, null); mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("Tab3"), Favourites.class, null); mTabHost.addTab(mTabHost.newTabSpec("tab4").setIndicator("Tab4"), Notifications.class, null); } } main.xml Note: Intellij displays the following in the side-window when attempting to display a preview: Rendering Problems Exception raised during rendering: No tab known for tag null Library bug maybe? &lt;android.support.v4.app.FragmentTabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0" android:orientation=…
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41592249
upvote count: 1
downvote count: 0
answer count: 1
tagged with: manifest
favorite count: 0
has answer: http://stackoverflow.com/a/26477731
accepted answer: http://stackoverflow.com/a/26477731
tagged with: android
has title: com.example.main cannot be cast to android.support.v4.app.Fragment
tagged with: android-tabhost
type: AnsweredQuestion

http://stackoverflow.com/comment/41491051
type: AnswerComment
comment on: http://stackoverflow.com/a/26406012
type: Comment
has text: Lets say my application URL is like this : https://one.two.three.com/context_root/firstrequest ..................So If I make " SetHandler server-status Order deny,allow Allow from all Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure "............So is this context root set correctly for this block?
score: 0

grouplayout
tags question: http://stackoverflow.com/q/26414788
type: Tag
tags question: http://stackoverflow.com/q/26452809
tags question: http://stackoverflow.com/q/26363239
tag name: grouplayout

http://stackoverflow.com/comment/41627381
comment on: http://stackoverflow.com/a/26496803
has text: I will update to show you how to configure the main class... let me one second.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41618537
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26492210
has text: What's with the random downvote? This is a totally legitimate question.

http://stackoverflow.com/comment/41379469
has text: Anony-Mousse, For testing and learning purpose what do i do? Can you just give what ever needed for this and links
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26360322
score: 0

http://stackoverflow.com/q/26407453
tagged with: java
accepted answer: http://stackoverflow.com/a/26407864
upvote count: 1
has body: I am adding dynamically values in a jlist from a jpane. When I double-click on an element of the jlist, I would like to change the value of that element. How to do this ? String bigList[] = new String[2]; bigList[0] = "first value"; bigList[1] = "second value"; final JList list = new JList(bigList); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); ??????? CHANGEVALUE(index,"MY NEW VALUE); ???????? } } }); JOptionPane jpane = new JOptionPane(); jpane.showMessageDialog(null, list, "MYTITLE", JOptionPane.PLAIN_MESSAGE);
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: swing
has answer: http://stackoverflow.com/a/26407864
type: AnsweredQuestion
has title: howto change a value of jlist element in jpane dialog
score: 1

http://stackoverflow.com/comment/125587981
score: 0
has text: What does `\\D+` mean?
comment on: http://stackoverflow.com/a/26474091
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41586460
has text: writing an answer....
score: 0
comment on: http://stackoverflow.com/q/26474281
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26466637
has comment: http://stackoverflow.com/comment/41571638
answer count: 1
has comment: http://stackoverflow.com/comment/41571453
favorite count: 0
type: UnansweredQuestion
has title: Logic behind semaphores for threading
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41572183
has answer: http://stackoverflow.com/a/26468767
has comment: http://stackoverflow.com/comment/41575126
has comment: http://stackoverflow.com/comment/41571234
has body: I am expecting 5 results i.e. 1, 2, 3, 4, 5 yet I am getting far more? can someone please help me understand semaphores? surely as each thread calls the run method using "start", it should add 1 to the int aNumber and then print aNumber. I don't understand why I get more than five results. // mainClass creates Semaphore, so Copier class no longer needed import java.util.concurrent.Semaphore; public class mainClass { public static void main(String[] args) throws InterruptedException { Semaphore cp1 = new Semaphore(1, true); Worker[] workers = new Worker[5]; for (int x=0;x&lt;5;x++) { workers[x] = new Worker("w" + x, cp1); } for (int x=0;x&lt;5;x++) { workers[x].start(); } for (int x=0;x&lt;5;x++) { workers[x].join(); } } } import java.util.concurrent.Semaphore; public class Worker extends Thread{ int aNumber = 0; String myName; Semaphore myCopier; public Worker(String nameIn, Semaphore copierIn) { myName = nameIn; myCopier = copierIn; } public void run() { for (int x=0;x&lt;5;x++) { try { sleep((int) (Math.random() * 5000)); // do some filing myCopier.acquire(); aNumber +=1; //System.out.println(myName + " doing some copying"); System.out.println(aNumber); sleep((int) (Math.random() * 1000)); // do some copying myCopier.release(); } catch (InterruptedException e) { } } } }
score: 2
tagged with: semaphore
has comment: http://stackoverflow.com/comment/41571838
downvote count: 0
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/41571713
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/41571201

http://stackoverflow.com/a/26517019
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41752046
accepted answer of: http://stackoverflow.com/q/26513398
has comment: http://stackoverflow.com/comment/41782691
score: 1
has comment: http://stackoverflow.com/comment/41751943
has comment: http://stackoverflow.com/comment/41663998
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41718223
has comment: http://stackoverflow.com/comment/41716720
answers question: http://stackoverflow.com/q/26513398
has body: I don't think the connection is the same. As far as I understand you will get 2 different connections on the same pool which is managed by the application server. If so you can't have a simple transaction shared across 2 connection. You must share the transaction manager between the 2 resources and so use XA.

http://stackoverflow.com/comment/41614388
has text: its just a simple update script, UPDATE TABLE_NAME SET FIELD_NAME = 'blah' @SylvainLeroux
comment on: http://stackoverflow.com/q/26469049
score: 0
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/26425278
tags question: http://stackoverflow.com/q/26438993
tags question: http://stackoverflow.com/q/26399308
tags question: http://stackoverflow.com/q/26468635
tags question: http://stackoverflow.com/q/26384187
tag name: eclipse
tags question: http://stackoverflow.com/q/26394453
tags question: http://stackoverflow.com/q/26463842
tags question: http://stackoverflow.com/q/26360851
tags question: http://stackoverflow.com/q/26471798
tags question: http://stackoverflow.com/q/26502917
tags question: http://stackoverflow.com/q/26423492
tags question: http://stackoverflow.com/q/26492070
tags question: http://stackoverflow.com/q/26507568
tags question: http://stackoverflow.com/q/26426187
tags question: http://stackoverflow.com/q/26445910
tags question: http://stackoverflow.com/q/26458728
tags question: http://stackoverflow.com/q/26376312
tags question: http://stackoverflow.com/q/26453250
tags question: http://stackoverflow.com/q/26411764
tags question: http://stackoverflow.com/q/26481954
tags question: http://stackoverflow.com/q/26470524
tags question: http://stackoverflow.com/q/26366301
tags question: http://stackoverflow.com/q/26397382
tags question: http://stackoverflow.com/q/26357157
tags question: http://stackoverflow.com/q/26424581
tags question: http://stackoverflow.com/q/26471930
tags question: http://stackoverflow.com/q/26358068
tags question: http://stackoverflow.com/q/26477692
tags question: http://stackoverflow.com/q/26457219
tags question: http://stackoverflow.com/q/26421370
tags question: http://stackoverflow.com/q/26387342
tags question: http://stackoverflow.com/q/26508163
tags question: http://stackoverflow.com/q/26423371
tags question: http://stackoverflow.com/q/26494538
tags question: http://stackoverflow.com/q/26373234
tags question: http://stackoverflow.com/q/26405930
tags question: http://stackoverflow.com/q/26487574
tags question: http://stackoverflow.com/q/26464545
tags question: http://stackoverflow.com/q/26501661
tags question: http://stackoverflow.com/q/26369950
tags question: http://stackoverflow.com/q/26471482
tags question: http://stackoverflow.com/q/26488685
tags question: http://stackoverflow.com/q/26416990
tags question: http://stackoverflow.com/q/26475592
tags question: http://stackoverflow.com/q/26403183
tags question: http://stackoverflow.com/q/26430955
tags question: http://stackoverflow.com/q/26409390
tags question: http://stackoverflow.com/q/26373455
tags question: http://stackoverflow.com/q/26440124
tags question: http://stackoverflow.com/q/26437253
tags question: http://stackoverflow.com/q/26502059
tags question: http://stackoverflow.com/q/26444219
tags question: http://stackoverflow.com/q/26431260
tags question: http://stackoverflow.com/q/26496180
tags question: http://stackoverflow.com/q/26355174
tags question: http://stackoverflow.com/q/26382145
tags question: http://stackoverflow.com/q/26469618
tags question: http://stackoverflow.com/q/26494486
tags question: http://stackoverflow.com/q/26358870
tags question: http://stackoverflow.com/q/26465150
tags question: http://stackoverflow.com/q/26492976
tags question: http://stackoverflow.com/q/26504905
tags question: http://stackoverflow.com/q/26379036
tags question: http://stackoverflow.com/q/26502374
tags question: http://stackoverflow.com/q/26481653
tags question: http://stackoverflow.com/q/26401347
tags question: http://stackoverflow.com/q/26387774
tags question: http://stackoverflow.com/q/26492198
tags question: http://stackoverflow.com/q/26435737
tags question: http://stackoverflow.com/q/26439055
tags question: http://stackoverflow.com/q/26461503
tags question: http://stackoverflow.com/q/26357332
tags question: http://stackoverflow.com/q/26448517
tags question: http://stackoverflow.com/q/26498721
tags question: http://stackoverflow.com/q/26483523
tags question: http://stackoverflow.com/q/26478815
tags question: http://stackoverflow.com/q/26375515
tags question: http://stackoverflow.com/q/26417811
tags question: http://stackoverflow.com/q/26494167

http://stackoverflow.com/q/26444790
score: 14
type: AnsweredQuestion
has title: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/52733369
has answer: http://stackoverflow.com/a/28058997
tagged with: jersey
has answer: http://stackoverflow.com/a/36472543
has answer: http://stackoverflow.com/a/38725812
has answer: http://stackoverflow.com/a/45156322
has answer: http://stackoverflow.com/a/26444864
accepted answer: http://stackoverflow.com/a/26444864
has answer: http://stackoverflow.com/a/31160773
favorite count: 0
upvote count: 14
tagged with: rest
has answer: http://stackoverflow.com/a/37986044
answer count: 10
has answer: http://stackoverflow.com/a/29952171
downvote count: 0
possible better answer: http://stackoverflow.com/a/29952171
has answer: http://stackoverflow.com/a/32418111
tagged with: web-services
has body: You may feel this is a duplicated question, but none of the questions with the same title solve my problems. I am using Jersey 2.0 creating a RESTful web service in Eclipse, I use Tomcat 7.0 as my server, I have the following web.xml: <?xml version="1.0" encoding="UTF-8"?> JAX-RS Servlet org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.shop.domain 1 JAX-RS Servlet /jaxrs/* I have a simple class called Hello: @Path("customers") public class Hello { @GET @Produces(MediaType.TEXT_PLAIN) public String getCustomer() { return "hello"; } } I have a Jersey library called jersey: Every time I ran this project, I got error of java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer Any ideas?

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/26457286

http://stackoverflow.com/q/26369521
upvote count: 2
accepted answer: http://stackoverflow.com/a/26369610
tagged with: java
possible better answer: http://stackoverflow.com/a/26371991
score: 2
type: AnsweredQuestion
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/26369610
favorite count: 0
type: Question
answer count: 2
has title: java.sql.SQLException: Exhausted Resultset while using select statement
tagged with: jdbc
has answer: http://stackoverflow.com/a/26371991
has body: I have following piece of code in which i am trying to create user id's ad jdoe, jdoe1, jdoe2, etc. for which I am checking uniqueness(or existence of user id against a sql table). I keep on getting Exhausted resultSet error. I understand that is happening because the select query did't find "jdoe" (which is good) but I am unable to handle it. PreparedStatement pstmt = conn.prepareStatement("SELECT DISTINCT name FROM t_av_accounts WHERE name = ? "); ResultSet rs = null; /*Some more code here*/ ret = builder.toString(); log.debug("** Start SUFFIX: " + suffix.toString() + "&amp;&amp; ret: " + ret); while(x){ pstmt.setString(1, ret); rs = pstmt.executeQuery(); if(rs != null){ rs.next(); if(rs.getString(1) == ret){ if(suffix==1) ret.concat(suffix.toString()); else ret.substring(ret.length()-1).concat(suffix.toString()); ++suffix; log.debug("** Current SUFFIX: " + suffix.toString() + "&amp;&amp; ret: " + ret); } else{ ctx.setUserVariable(WorkflowContext.VariableLevel.Job, "AFXUSERCUSTOM_"+user.getId()+"_CUSTOM_USERID", ret.toLowerCase()); x = false; } } }

http://stackoverflow.com/comment/41642939
has text: If you just want to decompile a .class file , you can check this [How do I “decompile” Java class files? ] (http://stackoverflow.com/questions/272535/how-do-i-decompile-java-class-files). This is not at the runtime though.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26505824

http://stackoverflow.com/q/26365036
has answer: http://stackoverflow.com/a/26424955
answer count: 3
tagged with: talend
has comment: http://stackoverflow.com/comment/41421206
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/26388581
has answer: http://stackoverflow.com/a/65393708
type: AnsweredQuestion
tagged with: row
downvote count: 0
has body: Background: I'm using Talend to do something (I guess) that is pretty common: generating multiple rows from one. For example: ID | Name | DateFrom | DateTo 01 | Marco| 01/01/2014 | 04/01/2014 ...could be split into: new_ID | ID | Name | DateFrom | DateTo 01 | 01 | Marco | 01/01/2014 | 02/01/2014 02 | 01 | Marco | 02/01/2014 | 03/01/2014 03 | 01 | Marco | 03/01/2014 | 04/01/2014 The number of outcoming rows is dynamic, depending on the date period in the original row. Question: how can I do this? Maybe using tSplitRow? I am going to check those periods with tJavaRow. Any suggestions?
tagged with: java
tagged with: etl
has comment: http://stackoverflow.com/comment/41421517
type: Question
accepted answer: http://stackoverflow.com/a/26424955
score: 5
has answer: http://stackoverflow.com/a/26388581
has title: Talend - generating n multiple rows from 1 row

http://stackoverflow.com/q/26409885
has comment: http://stackoverflow.com/comment/41468298
has title: make a JComponent opaque
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41468521
has comment: http://stackoverflow.com/comment/41468788
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26410293
has comment: http://stackoverflow.com/comment/41468150
has comment: http://stackoverflow.com/comment/41468036
has comment: http://stackoverflow.com/comment/41468350
answer count: 1
tagged with: paintcomponent
accepted answer: http://stackoverflow.com/a/26410293
has comment: http://stackoverflow.com/comment/41468114
has body: I'm trying to make a JComponent opaque in the right border. I want make a object with my specific characteristics so i'm using a JComponent that can be opaque this is because I will make a library, and I don't want to use JPanel or JLabel import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.image.BufferedImage; import java.util.ArrayList; public class ProbadorCodigos { JFrame Frame=new JFrame(); JComponent BORDEDE=new JComponent() {private static final long serialVersionUID = 2222L;}; public ProbadorCodigos() { Frame.setSize(500, 500); Frame.setResizable(false); Frame.setUndecorated(false); Frame.setLayout(null); Frame.setLocationRelativeTo(null); Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.getContentPane().setBackground(Color.darkGray); Format(); Action(); } private void Format() { BORDEDE.setBounds(Frame.getWidth()-100, 0, 100, Frame.getHeight()); BORDEDE.setOpaque(true); BORDEDE.setVisible(true); BORDEDE.setEnabled(true); BORDEDE.setFocusable(true); BORDEDE.setBackground(Color.red); System.out.println(BORDEDE); } private void Action() { Frame.add(BORDEDE); } public static void main(String[] args) { ProbadorCodigos Ventana=new ProbadorCodigos(); Ventana.Frame.setVisible(true); } } I don't know why it don't shows opaque, if I use a JLabel works so what I missing? thanks for your advices and answers
score: 0
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/41468392
tagged with: swing

http://stackoverflow.com/q/26426346
type: AnsweredQuestion
has body: Here is the code Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(this.redirectUrl+"?username="+getValue(loginString)+"&amp;password="+getValue(pwdString))); startActivity(browserIntent); I have this error : 10-17 15:30:35.288 5467-5467/com.example.android.navigationdrawerexample W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40cd7930) 10-17 15:30:35.298 5467-5467/com.example.android.navigationdrawerexample E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.IllegalStateException: Fragment PlanetFragment{41b91f78} not attached to Activity at this line : startActivity(browserIntent); This and this DOESN'T work for me. What i can do ?
tagged with: java
possible better answer: http://stackoverflow.com/a/26427382
has answer: http://stackoverflow.com/a/26427382
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26427592
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/10919240
has title: How i can open browser onPostExecute
has answer: http://stackoverflow.com/a/26427592

http://stackoverflow.com/comment/41556155
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26446458
has text: totalSize should equal the total number of bytes in the final byteArray. So, 1 byte for the keyType, 1 byte for the keyLength, <keyLength> bytes for the key, 8 bytes for the timestamp, 2 bytes for the dataSize, and <dataSize> bytes for the data.
score: 0

http://stackoverflow.com/comment/41509468
has text: And, if you are on `Windows` make sure the file format is what you think it is.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26432274

http://stackoverflow.com/q/26488667
upvote count: 7
has comment: http://stackoverflow.com/comment/41611468
answer count: 1
has comment: http://stackoverflow.com/comment/41631766
favorite count: 0
has body: I have tried to setup a self-signed TLS configuration for both client and server where the server is Tomcat 7 and the client is Apache httpclient 4.1. The server configuration is taken from this here and the client code is taken from here. My tomcat configuration looks like this: &lt;Connector clientAuth="true" port="8443" minSpareThreads="5" maxSpareThreads="75" enableLookups="true" disableUploadTimeout="true" acceptCount="100" maxThreads="200" scheme="https" secure="true" SSLEnabled="true" keystoreFile="keys/server.jks" keystoreType="JKS" keystorePass="password" truststoreFile="keys/server.jks" truststoreType="JKS" truststorePass="password" SSLVerifyClient="require" SSLEngine="on" SSLVerifyDepth="2" sslProtocol="TLS" /&gt; My client code looks like this: final HttpParams httpParams = new BasicHttpParams(); // load the keystore containing the client certificate - keystore type is probably jks or pkcs12 final KeyStore keystore = KeyStore.getInstance("pkcs12"); FileInputStream keystoreInput = = new FileInputStream("d:/dev/java/conf/keys/client.p12");; // TODO get the keystore as an InputStream from somewhere keystore.load(keystoreInput, "password".toCharArray()); // load the trustore, leave it null to rely on cacerts distributed with the JVM - truststore type is probably jks or pkcs12 KeyStore truststore = KeyStore.getInstance("JKS"); FileInputStream truststoreInput = = new FileInputStream("d:/dev/java/conf/keys/client.jks");; // TODO get the trustore as an InputStream from somewhere truststore.load(truststoreInput, "password".toCharArray()); final SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("https", new SSLSocketFactory(keystore, keystorePassword, truststore), 443)); final DefaultHttpClient httpClient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpParams, schemeRegistry), httpParams); I launch Tomcat with the following CATALINA_OPTS: set CATALINA_OPTS=%CATALINA_OPTS% -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 se…
tagged with: apache-httpclient-4.x
has comment: http://stackoverflow.com/comment/41619351
has comment: http://stackoverflow.com/comment/41624880
has comment: http://stackoverflow.com/comment/41657669
linked to: http://stackoverflow.com/q/3375121
type: AnsweredQuestion
has title: Tomcat 7 getting SSLv2Hello is disabled error when trying to make client server ssl authntication
downvote count: 0
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/41657651
type: Question
has answer: http://stackoverflow.com/a/26513998
accepted answer: http://stackoverflow.com/a/26513998
tagged with: ssl
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41625822

http://stackoverflow.com/q/26447287
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26447408
accepted answer: http://stackoverflow.com/a/26447408
answer count: 1
has title: Android sqlite query to get tables with values greater than a value
upvote count: 1
tagged with: sqlite
has body: I am using sqlite in my android app and it has (id, name, age) string tables. I want the query to get names with age greater than 20. I am using this query private static final String TABLE_NAME = "Favorite"; private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_AGE = "age"; SELECT * FROM TABLE_NAME WHERE age &gt; 20 But i am getting wrong tables, there are few tables with age less than 20.
favorite count: 0
downvote count: 0
tagged with: android

http://stackoverflow.com/comment/41604500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26484810
has text: Dibya / Ivan, Thanks for getting back to me so quickly. Can you provide a little more asistance, please? Where do I put @OneToOne and how exactly do I delete a record from the Entity? Thanks
score: 0

http://stackoverflow.com/q/26489318
tagged with: java
type: Question
tagged with: jsp
has comment: http://stackoverflow.com/comment/41614444
score: 0
has comment: http://stackoverflow.com/comment/41612857
tagged with: cas
type: UnansweredQuestion
has title: Set a parameter value in spring bean
tagged with: spring
tagged with: spring-mvc
has body: I am using CAS as a SSO solution in my web app, but my question is more spring related. I use several authentication methods, DB, x509, etc... and I have a requirement to display a message to the user as to what method of authentication worked or failed. So I have some beans defined in my deployerConfigContext that do the authentication, they look basically like this: &lt;bean id="myDBUsernameResolver" class="my.resolver.UsernameToIDResolver" p:dataSource-ref="oracleDS" p:sql = "select ID from blah blah blah" /&gt; What I need is access to the HTTPSession, or the request parameters, or SOMETHING that I can access in my view jsp's. I have NO access to the controllers, only the context file and the jsp. Is there any way to inject anything into this bean (Session, Context, whatever) that I would have access to in the view? I have tried the RequestContext, but I can only "get" I cannot "set." I Cant seem to the the http session at all. Any ideas?
has comment: http://stackoverflow.com/comment/41613781
answer count: 0

http://stackoverflow.com/q/26422720
has answer: http://stackoverflow.com/a/26422968
has body: All: I am running a simple Java application with Selenium WebDriver. I was able to successfully run a search on http://www.google.com using org.openqa.selenium.htmlunit.HtmlUnitDriver I tried to run the same search term on http://www.yahoo.com as shown in the following code excerpt: CharSequence[] searchTerm = { "bbc", "news" }; // Create a new instance of the html unit driver // Notice that the remainder of the code relies on the interface, // not the implementation. WebDriver driver = new HtmlUnitDriver(); // And now use this to visit Google driver.get("http://www.yahoo.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); //searchTerm = "bbc news"; // Enter something to search for element.sendKeys(searchTerm); // Now submit the form. WebDriver will find the form for us from the element element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); driver.quit(); Howefver, it gives me the following error: Oct 17, 2014 3:18:44 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Cookie rejected [DNR="deleted", version:0, domain:.www.yahoo.com, path:/, expiry:Thu Oct 17 15:18:45 IST 2013] Illegal domain attribute "www.yahoo.com". Domain of origin: "in.yahoo.com" Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element with name: q For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58' System info: host: , ip: , os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05' Driver info: driver.version: HtmlUnitDriver at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByName(HtmlUnitDriver.java:1001) Why does it work fine for http://www.google.com but fails for http://www.yahoo.com ? Why does it throw the "Exception in thread main org.openqa.selenium.NoSuc…
tagged with: selenium-webdriver
has title: Search using Selenium WebDriver works on google but Fails on yahoo
tagged with: selenium
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41491901
has comment: http://stackoverflow.com/comment/41491246
tagged with: java
tagged with: htmlunit-driver
accepted answer: http://stackoverflow.com/a/26422968
has comment: http://stackoverflow.com/comment/41493002
answer count: 1
score: 0

http://stackoverflow.com/q/26377928
answer count: 1
has body: I have a date type in oracle and i want insert unix timestamp data into it. I use this SQL query in PL/SQL which works. select TO_DATE('19700101','yyyymmdd') + 1413360712/86400 +TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24 from dual; the output is right. 2014/10/15 16:11:52 But when i use it in java, the output is different. String sql = "insert into appliance_application (id, emp_id, typeid, num, spec, action, actiontime, oper_id) VALUES(applianceapplication_seq.nextval, ?, ?, ?, ?, ?, TO_DATE('19700101','yyyymmdd') + 1413360712/86400 +TO_NUMBER(SUBSTR(TZ_OFFSET(sessiontimezone),1,3))/24, ?)"; pstmt = conn.prepareStatement(sql); for(int i=0; i &lt; list.size(); i++){ Itembean ib = (Itembean)list.get(i); pstmt.setObject(1, ib.getEmpid()); ... pstmt.setObject(5, ib.getAction()); // pstmt.setLong(6, ib.getActiontime()); // pstmt.setObject(7, ib.getOper_id()); pstmt.setObject(6, ib.getOper_id()); log.info(ib.getActiontime()+ "...."); pstmt.addBatch(); } ... I check the inserted data and find output is wrong. 2014/10/15 8:11:52 my sessiontimezone is +8. what's wrong?
tagged with: unix
favorite count: 0
has comment: http://stackoverflow.com/comment/41411300
has comment: http://stackoverflow.com/comment/41412614
type: UnansweredQuestion
tagged with: oracle-database
tagged with: timestamp
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41413287
tagged with: java
type: Question
has title: how to convert unix timestamp to oracle DATE
has answer: http://stackoverflow.com/a/26535355
tagged with: sql
upvote count: 1

http://stackoverflow.com/comment/41426583
type: QuestionComment
has text: @MarkoTopolnik You're right. I added the prefix to my code. But still no class file is generated.
comment on: http://stackoverflow.com/q/26385333
score: 0
type: Comment

http://stackoverflow.com/comment/41525420
type: Comment
comment on: http://stackoverflow.com/a/26402593
score: 0
type: AnswerComment
has text: @user2840965, let me know if it does not work for you.

http://stackoverflow.com/q/26414077
has body: I made a small JDialog that contains a JScrollPane and few other components, on Windows 8.1 OS. The problem is, that the scrollPane's scrolls are a little weird... not the native Windows 8.1 scrolls : I tried using the look and feel function as fallows: try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { // Handle exception } and that didn't help at all. So, am I using it just wrong, or is there any other way to use the native OS scrolls? Also, if anyone could explain how to customize the scrolls (like the arrow pictures, or customize the track and knob) I would be grateful. EDIT This is the code of the mentioned JDialog that iis having the problem: package home; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.LookAndFeel; import javax.swing.ScrollPaneLayout; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.JScrollPane; import net.miginfocom.swing.MigLayout; import javax.swing.JLabel; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Label; import java.awt.Font; import java.awt.List; import java.awt.Color; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; import java.awt.Button; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.WindowFocusListener; import jav…
answer count: 0
has comment: http://stackoverflow.com/comment/41497049
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/8208508
has comment: http://stackoverflow.com/comment/41497476
tagged with: native
has comment: http://stackoverflow.com/comment/41497199
has comment: http://stackoverflow.com/comment/41497192
score: 0
tagged with: jscrollpane
has title: JScrollPane doesn't use native OS scrolls (Swing)
has comment: http://stackoverflow.com/comment/41497203
type: UnansweredQuestion

http://stackoverflow.com/comment/41385701
has text: Not that it solves anything (or maybe it does), but wouldn't `div.barTextBelow` instead of `div[class=barTextBelow]` be better (simpler/shorter/easier to read)?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26364018

http://stackoverflow.com/a/26492604
has comment: http://stackoverflow.com/comment/41625405
type: AcceptedAnswer
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/41620968
answers question: http://stackoverflow.com/q/26492528
has body: Yes, it's a method. Here is its api doc (that I simply found by browsing the index of the javadoc).
accepted answer of: http://stackoverflow.com/q/26492528
type: Answer
has comment: http://stackoverflow.com/comment/41622419
has comment: http://stackoverflow.com/comment/41621052
score: 3

http://stackoverflow.com/a/26482500
type: Answer
accepted answer of: http://stackoverflow.com/q/26482271
downvote count: 0
answers question: http://stackoverflow.com/q/26482271
score: 1
has body: Simply register HttpSessionListener and remove those users details from map whose sessiopn will no longer exists as suggested by @Scary Wombat web.xml: com.x.y.z.MySessionListener HttpSessionListener: import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; public class MySessionListener implements HttpSessionListener { @Override public void sessionCreated(HttpSessionEvent e) { System.out.println("sessionCreated"); } @Override public void sessionDestroyed(HttpSessionEvent e) { System.out.println("sessionDestroyed"); // e.getSession() // remove users details from map } }
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/26473875
has answer: http://stackoverflow.com/a/28219925
accepted answer: http://stackoverflow.com/a/28219925
type: Question
has body: I am trying ported spidev.h to java using JNA. How i can port #define SPI_IOC_RD_MODE_IOR(SPI_IOC_MAGIC, 1, __u8) from c to java using JNA?
tagged with: http://stackoverflow.com/tag/c
upvote count: 1
answer count: 1
favorite count: 0
tagged with: jna
has title: JNA macro function in #define
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: macros

http://stackoverflow.com/q/26504418
answer count: 1
tagged with: php
has answer: http://stackoverflow.com/a/26504656
has comment: http://stackoverflow.com/comment/41640117
has title: java- Php curl_setopt options equivalent in apache HttpClient
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41640604
accepted answer: http://stackoverflow.com/a/26504656
score: 0
has body: I got a request that need me to translate or in other words finding the equivalent java code for the below PHP code. I currently using Apache HttpClient to handle the task. I have investigate for 4 hours but no result. There are some article about this on the internet but there is no exact answers. My knowledge about PHP is near 0. Any help would be very much appreciate. curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_TIMEOUT, 15); curl_setopt($curl, CURLOPT_VERBOSE, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);

http://stackoverflow.com/comment/41460484
score: 0
type: Comment
has text: So, we have non-US address which also have country and is it in the same format as in above example ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26392383

http://stackoverflow.com/comment/41577256
comment on: http://stackoverflow.com/a/26469252
score: 0
type: AnswerComment
type: Comment
has text: @zoltack429 Jan gave a nice implementation example, compare it to your own and see where the difference in logic lies

http://stackoverflow.com/a/26450068
answers question: http://stackoverflow.com/q/26450019
score: 2
accepted answer of: http://stackoverflow.com/q/26450019
type: AcceptedAnswer
downvote count: 0
has body: Okay, so I think that you have a fundamental misunderstanding of how Java methods work. When you call calculation(), you're going to execute the code in the method, then return to the same point in addition(). Now, list is declared inside calculation(), so the scope of list is inside that method. It can't be used outside of that method. As soon as calculation() is finished, it will destroy list. If you want to access list after calculation() is finished, then you should return it. return list; Then you can access it in your addition method as follows: List&lt;Double&gt; list = calculation(); Edit I've noticed that in your calculation() method, you've got an infinite loop: do{ list.add(scan.nextDouble()); }while(true) This will keep expecting a new double from the user. This is not desirable because the user isn't going to want to add an infinite series of double values together. Mainly because that's impossible. And parsing like that will only cause problems. I would recommend parsing the input as a String, checking if the value corresponds to a double and then parse it using the Double.parseDouble() method. Extra Reading I would read into returning data in Java. Check it out here. I would also look into Scope. Scope is a fundamental principle in most programming languages, so its best that you develop a good grasp on it. Read about it here. Finally, I would look at method calls. You seem to think that a method call imports the code, rather than executes it. Read about it here.
upvote count: 2
type: Answer

geometry
tags question: http://stackoverflow.com/q/26431974
tags question: http://stackoverflow.com/q/26373011
type: Tag
tags question: http://stackoverflow.com/q/26359264
tags question: http://stackoverflow.com/q/26367452
tag name: geometry

http://stackoverflow.com/a/26375244
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26375128
score: 1
has body: You can optimize your code as below. int size = 10; for(int row = 1; row &lt;= size; row++) { for(int col = 1;col &lt;= row; col++) { System.out.print( 6*col + " "); } System.out.println(); }

depth-first-search
tags question: http://stackoverflow.com/q/26512753
tags question: http://stackoverflow.com/q/26404678
tags question: http://stackoverflow.com/q/26363485
type: Tag
tag name: depth-first-search

http://stackoverflow.com/comment/41515482
score: 0
type: Comment
type: QuestionComment
has text: Don't create the object yourself. Spring can only autowire Spring-managed objects, ie. beans.
comment on: http://stackoverflow.com/q/26433174

http://stackoverflow.com/a/26388210
answers question: http://stackoverflow.com/q/26388108
score: 4
upvote count: 4
downvote count: 0
has body: No, there is no default value for method return types in Java. In plain old Java, you would write something like: if (value != null) { return value; else { return "default"; } or you could simplify that to return value != null ? value : "default"; In Java8, there is the possibility to use Optional&lt;T&gt;. That means, you can hold a value, or not. This would look like this: Optional&lt;String&gt; optionalVal = Optional.ofNullable(null); // or Optional.of("Foo"); return optionalVal.getOrElse("default");
type: Answer

http://stackoverflow.com/comment/41540877
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26449662
has text: There seem to be a lot of problems with your code, eg unused fields (like fileData), hardcoded magic number (like 10000 and 105, which is probably why you are getting a NPE), etc

http://stackoverflow.com/q/26459004
has comment: http://stackoverflow.com/comment/41557791
answer count: 2
score: 0
linked to: http://stackoverflow.com/q/2689122
has body: I have below XML response from third party webservice. How can I populate XML values into Java POJO ? Please help me! Thanks!
has comment: http://stackoverflow.com/comment/41557852
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/6920175
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/41557778
has comment: http://stackoverflow.com/comment/41557812
has comment: http://stackoverflow.com/comment/41557980
has answer: http://stackoverflow.com/a/26459407
tagged with: java
has answer: http://stackoverflow.com/a/26459191
type: Question
has title: How to populate Java POJO with the values from XML string?

http://stackoverflow.com/q/26376707
has answer: http://stackoverflow.com/a/43860470
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26385505
type: Question
tagged with: java
has title: Logstash - Is it possible to create a java program for logstash
has body: I need to create a java program for generating logstash output accouding to some configurations (conf file). But here my problem is i have the configurations in a Properties object also i need the output as a Json String object. But in examples i found from internet it will do like, need to run the command following through console and the output become appear on the console logstash -f config.conf But i need a java program instead of the above. Is it possible?
has answer: http://stackoverflow.com/a/53493098
downvote count: 0
tagged with: logstash
favorite count: 0
answer count: 3

ssl
tags question: http://stackoverflow.com/q/26387099
tags question: http://stackoverflow.com/q/26479463
tags question: http://stackoverflow.com/q/26407694
tags question: http://stackoverflow.com/q/26493360
tags question: http://stackoverflow.com/q/26497210
type: Tag
tags question: http://stackoverflow.com/q/26433285
tags question: http://stackoverflow.com/q/26513040
tags question: http://stackoverflow.com/q/26437581
tags question: http://stackoverflow.com/q/26359701
tags question: http://stackoverflow.com/q/26368982
tags question: http://stackoverflow.com/q/26461736
tag name: ssl
tags question: http://stackoverflow.com/q/26358232
tags question: http://stackoverflow.com/q/26387980
tags question: http://stackoverflow.com/q/26382540
tags question: http://stackoverflow.com/q/26438427
tags question: http://stackoverflow.com/q/26503762
tags question: http://stackoverflow.com/q/26488667
tags question: http://stackoverflow.com/q/26355270
tags question: http://stackoverflow.com/q/26381512
tags question: http://stackoverflow.com/q/26387227
tags question: http://stackoverflow.com/q/26508597
tags question: http://stackoverflow.com/q/26480988
tags question: http://stackoverflow.com/q/26485715
tags question: http://stackoverflow.com/q/26501582
tags question: http://stackoverflow.com/q/26402759
tags question: http://stackoverflow.com/q/26355442
tags question: http://stackoverflow.com/q/26388808
tags question: http://stackoverflow.com/q/26356657

http://stackoverflow.com/q/26424184
type: AnsweredQuestion
has title: Does Hibernate automatically restart transactions upon deadlocking?
accepted answer: http://stackoverflow.com/a/26496861
tagged with: java
tagged with: mysql
upvote count: 7
type: Question
has body: There has been a lot written about this topic: Restarting transaction in MySQL after deadlock Deadlock found when trying to get lock; try restarting transaction : @RetryTransaction MySQL JDBC: Is there an option for automatic retry after InnoDB deadlock? Working around MySQL error "Deadlock found when trying to get lock; try restarting transaction" ... many more I find particularly interesting the last accepted answer: If you are using InnoDB or any row-level transactional RDBMS, then it is possible that any write transaction can cause a deadlock, even in perfectly normal situations. Larger tables, larger writes, and long transaction blocks will often increase the likelihood of deadlocks occurring. In your situation, it's probably a combination of these. That would mean that we can never prevent them, but only to deal with them. Is that true? I wonder if you can ever prevent deadlocks on website with 1000 people online who invoke write DB operations. Googling over the topic does not get any interesting results. Only one I found was this (http://www.coderanch.com/t/415119/ORM/databases/Deadlock-problems-Hibernate-Spring-MS): public class RestartTransactionAdviser implements MethodInterceptor { private static Logger log = Logger.getLogger(RestartTransactionAdviser.class); public Object invoke(MethodInvocation invocation) throws Throwable { return restart(invocation, 1); } private Object restart(MethodInvocation invocation, int attempt) throws Throwable { Object rval = null; try { rval = invocation.proceed(); } catch (Exception e) { Throwable thr = ExceptionUtils.getRootCause(e); if (thr == null) { throw e; } if (StringUtils.contains(thr.getMessage(), "deadlock") || StringUtils.contains(thr.getMessage(), "try restarting transaction") || StringUtils.contains(thr.getMessage(), "failed to resume the transaction")) { if (attempt > 300) { throw e; } int timeout = RandomUtils.nextInt(2000); log.warn("Transaction rolled back. Restarting transaction."); log.debug("Spleep for "…
tagged with: transactions
score: 7
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41596227
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26496861
has comment: http://stackoverflow.com/comment/41613958
favorite count: 0
has comment: http://stackoverflow.com/comment/42281145
has comment: http://stackoverflow.com/comment/41619781
tagged with: spring
linked to: http://stackoverflow.com/q/2596005

http://stackoverflow.com/q/26413431
has title: Which artifacts should I use for JAXB RI in my Maven project?
has answer: http://stackoverflow.com/a/26413432
upvote count: 54
accepted answer: http://stackoverflow.com/a/26413432
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/74093729
score: 54
linked to: http://stackoverflow.com/q/13288735
has answer: http://stackoverflow.com/a/74093729
tagged with: maven
type: Question
has body: Historically, I always used the following JAXB RI artifacts in my Maven projects: com.sun.xml.bind:jaxb-impl - Runtime com.sun.xml.bind:jaxb-xjc - Schema compiler com.sun.xml.bind:jaxb-jxc - Schema generator Since approximately version 2.2.10* these artifacts are now described as "old": com.sun.xml.bind:jaxb-impl Old JAXB Runtime module. So it looks like these artifacts are now obsolete. The question is: Which artifacts should be used instead?
tagged with: java
tagged with: jaxb
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/51485137
favorite count: 0
tagged with: jaxb2

http://stackoverflow.com/comment/41567173
comment on: http://stackoverflow.com/q/26464503
type: Comment
type: QuestionComment
score: 1
has text: If it can't find java then there is something wrong with your environment variables. There is nothing wrong with making changes to environment variables.

http://stackoverflow.com/comment/41643697
has text: it may be the cell renderer, it may be the way you call `nodeChanged`, if you call `reload`, or else, difficult to tell without seeing at the least some code, or better the minimal program that reproduce the problem
score: 3
comment on: http://stackoverflow.com/q/26505936
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26437544
has body: I tried running the following code. It compiles, but throws a ClassCastException. I would be really glad if anyone can help me figure out why. double costprice = 0; Object[] possibilities = null; costprice = (double) JOptionPane.showInputDialog( alphaPOS, "Cost Price:", "Enter Values", JOptionPane.PLAIN_MESSAGE, null, possibilities, "");
tagged with: java
possible better answer: http://stackoverflow.com/a/26437567
has answer: http://stackoverflow.com/a/26437565
answer count: 2
tagged with: casting
upvote count: 0
favorite count: 0
has title: Class Cast Exception when casting double
accepted answer: http://stackoverflow.com/a/26437565
tagged with: joptionpane
type: AnsweredQuestion
tagged with: double
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/26437567
score: -2

http://stackoverflow.com/comment/41696260
comment on: http://stackoverflow.com/q/26492945
score: 0
type: Comment
type: QuestionComment
has text: @jtahlborn make your comment an answer and I will accept it.

http://stackoverflow.com/comment/41650334
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26510105
score: 0
has text: may be u need to make a browser extension

http://stackoverflow.com/q/26369824
type: Question
has comment: http://stackoverflow.com/comment/41428748
has comment: http://stackoverflow.com/comment/41397316
has comment: http://stackoverflow.com/comment/41428487
has comment: http://stackoverflow.com/comment/41398071
has comment: http://stackoverflow.com/comment/41397733
has comment: http://stackoverflow.com/comment/41400216
score: 0
linked to: http://stackoverflow.com/q/2885173
has body: I am having some trouble with my Java code. I use NetBeans 8.0.1. I am trying to read an Excel file, with several sheets and then print the reading to the output window. Something in the code is not allowing the printing. I add a for-loop in order to loop over the sheets -- will that work? Also I've been searching for how to print the reading into a .txt file, but I can't find a thing about it. Can anybody help me? This is my code: package read_write_excel_v2; import java.io.IOException; import java.util.Iterator; import javax.swing.JOptionPane; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class JIA_ReadingRewritingWorbooks_v5 { public static String GetFileExtension(String path2){ String pathName = path2; String path = ""; String ext = ""; int mid = pathName.lastIndexOf("."); path = pathName.substring(0, mid); ext = pathName.substring(mid + 1, pathName.length()); return ext; } /** * Excel 2007 (and newer) file reader function. Uses Apache POI. Returns excel content * @throws org.apache.poi.openxml4j.exceptions.InvalidFormatException * @throws java.io.IOException */ public static void main(String[] args) throws IOException, InvalidFormatException { String ExcelPath; //ExcelPath = JOptionPane.showInputDialog(null, "Enter Excel path: "); ExcelPath = "ExcelJAVAWrite_demo.xlsx"; try{ // OPCPackage eats less memory than a InputStream, which requires // more memory OPCPackage pkg; pkg = OPCPackage.open(ExcelPath); XSSFWorkbook wb = new XSSFWorkbook(pkg); // Declare XSSF WB String fileExtn = GetFileExtension(ExcelPath); //Sheet sheet = null; for(int i = 0; i &lt; wb.getNumberOfSheets(); i++){ Sheet sheet = wb.getSheetAt(i); // Iteration of rows - rows are ready from the sheet Iterato…
answer count: 0
has title: Attempting to read Excel file with Apache POI, cannot write output to System.out
type: UnansweredQuestion
tagged with: excel
has comment: http://stackoverflow.com/comment/41398020
has comment: http://stackoverflow.com/comment/41423254
tagged with: apache-poi
tagged with: java

http://stackoverflow.com/comment/41524261
has text: What do you mean by "doesn't work"?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26440356
score: 0

http://stackoverflow.com/comment/41630850
comment on: http://stackoverflow.com/a/26498844
type: Comment
score: 1
type: AnswerComment
has text: @macattack: the code you've posted above will not compile, so there's no way for me to tell you if it will work. Your best bet is to try it, test it, and see.

http://stackoverflow.com/comment/41537632
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26447578
has text: Try to manually debug it and see if you can spot the problem. From your information and your code I can't see what is wrong there.
score: 1

http://stackoverflow.com/q/26485428
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41605821
has body: I need to rename a file by replacing - with _ in the file name. Suppose if a file name is ab-9.xml, it should be ab_9.xml. renameTo() is not working for me. Is there any other way to do that? Here is my code: File replaceCheracter(File file) { File oldPath = new File(file.getPath()) String filePath = file.getPath() if(filePath.contains("-")){ String newFilePath = filePath.replace("-", "_") if(oldPath.renameTo(newFilePath)) { System.out.println("renamed"); } else { System.out.println("Error"); } } return oldPath }
score: 0
tagged with: groovy
has answer: http://stackoverflow.com/a/26485854
has comment: http://stackoverflow.com/comment/41605318
has title: renameTo() not working
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26485674
has comment: http://stackoverflow.com/comment/41605766
tagged with: java
has comment: http://stackoverflow.com/comment/41605579
has comment: http://stackoverflow.com/comment/41605437

http://stackoverflow.com/q/26418241
upvote count: 2
has comment: http://stackoverflow.com/comment/41483550
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/41485971
tagged with: permutation
favorite count: 0
has comment: http://stackoverflow.com/comment/41483456
has comment: http://stackoverflow.com/comment/41483610
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9368205
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/28330346
has comment: http://stackoverflow.com/comment/41483484
type: Question
has body: The problem is stated here. I wrote a code to accomplish the task. /** * Created by aditya on 16-10-2014. */ import java.io.BufferedInputStream; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(new BufferedInputStream(System.in)); int n = scan.nextInt(); int k = scan.nextInt(); ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(k); ArrayList&lt;Integer&gt; list_out = new ArrayList&lt;Integer&gt;(k); for (int i = 0; i &lt; k; i++) { list.add(scan.nextInt()); } for (int j = 0; j &lt; k; j++) { list_out.add(next_perm(list.get(j), n)); } for (int temp : list_out) { System.out.println(temp); } System.out.flush(); } public static int next_perm(int k, int n) { int perm = 0; int number = k; int num[] = new int[n]; for (int i = 0; i &lt; n; i++) { num[i] = number % 10; number /= 10; } int k_max = 0; for (int i = 0; i &lt; n; i++) { if (i == (n-1)) break; if (num[i + 1] &gt;= num[i]) { ++k_max; } else if (num[i + 1] &lt; num[i]) { break; } } if(k_max==(n-1))return k; int j_max = k_max+1; for (int i = k_max; i &gt;= 0; i--) { if (num[i] &gt; num[k_max + 1]) { --j_max; } else { break; } } int temp=num[j_max]; num[j_max]=num[k_max+1]; num[k_max+1]=temp; for(int i=k_max,j=0;i&gt;j;i--,j++){ int tempo = num[i]; num[i]=num[j]; num[j]=tempo; } for (int i = 0; i &lt; n; i++) { perm += num[i] * (int) Math.pow(10, i); } return perm; } } And I manually ran all permutations of 1,2,..n for n=1 to 4 and got the correct results. For those of you wondering about the logic see here. No warnings or errors are displayed. When submitted to the online judge it declares it a wrong answer (after conducting 9 tests). [See below for link and results] The 9 tests must be a subset of all permutations of n=1 to 9 corresponding to each test so at least my 4 tests should be correct, but my code passes no tests, please help me I see no bugs. Edit: See a sample input-output for the case of n=4 here.Added b…
has comment: http://stackoverflow.com/comment/41484511
has title: Returning Next Permutation of a number
has answer: http://stackoverflow.com/a/28330346

http://stackoverflow.com/comment/41381486
comment on: http://stackoverflow.com/a/26361756
type: Comment
score: 0
has text: thanks a lot! This really helped. So after packaging it as a runnable jar, will it be openable with a single click? And what program will it open in? Also, I use JCrator, is there a way to do it in this IDE?
type: AnswerComment

http://stackoverflow.com/a/39537732
has body: It's more likely that the OOM issue is causing the crash. One common reason for using more memory than the -Xmx argument is if you use native memory. This could happen because you're using a JNI library that allocates a lot of objects, or if you're memory mapping files, etc. You should try adding some log statements to your java code to print out the memory Java thinks it's using Runtime.totalMemory, etc. Then compare these to values you see via top, and see if there's something else consuming memory.
score: 0
answers question: http://stackoverflow.com/q/26403536
type: Answer

http://stackoverflow.com/comment/41511346
comment on: http://stackoverflow.com/q/26433278
score: 1
type: QuestionComment
type: Comment
has text: What is the type and value of `length`?

http://stackoverflow.com/comment/41611963
has text: A nice link to the answer. Thanks for the same. By the way, other than super and extends keywords, any other such incidence.
type: Comment
comment on: http://stackoverflow.com/a/26488806
score: 0
type: AnswerComment

http://stackoverflow.com/comment/58066702
has text: @David Phillips: when you have many parameters, it’s likely time to rethink the strategy, especially if many of them are optional. I’d resort to a parameter object, the builder pattern, or such alike.
comment on: http://stackoverflow.com/a/26364729
type: AnswerComment
type: Comment
score: 3

http://stackoverflow.com/q/26381796
score: 3
possible better answer: http://stackoverflow.com/a/26381872
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/26381877
answer count: 2
has title: Why IDEA import ambiguous Java
downvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/3348816
has answer: http://stackoverflow.com/a/26381872
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26381877
has body: I am using IDEA 13.1 import x.y.ClassA; import x.y.ClassB; import x.y.ClassC; import x.y.ClassD; public class MyClass{ //Something Else } When I want to import x.y.ClassE IDEA works like this import x.y.*; public class MyClass{ //Something Else } That's crazy! How to set import single class rather then ambiguous import!
linked to: http://stackoverflow.com/q/3348816
type: Question

http://stackoverflow.com/comment/41650643
comment on: http://stackoverflow.com/q/26510249
has text: When you compile it in any IDE it will tell you where the syntax errors are. Start by cleaning up those.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/26413024
tagged with: java
tagged with: hibernate
answer count: 2
has answer: http://stackoverflow.com/a/26413408
has title: How to use OneToMany?
score: 0
accepted answer: http://stackoverflow.com/a/26413234
has body: I want to link 2 entity: @Entity @Table(name = "company") public class Company { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @Column(nullable = false, name = "company_name") private String companyName; @OneToMany(mappedBy = "company", cascade = CascadeType.ALL) private List<Department> departments; public Company(){ departments = new ArrayList<Department>(); } // setters and getters } and @Entity @Table(name = "department") public class Department { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @Column(nullable = false, name = "department_name") private String departmentName; @ManyToOne @JoinColumn(name = "company_id", nullable = false) private Company company; public Department(){} // setters and getters } DAO class: @Service public class CompanyDAOImpl implements CompanyDAO { @Autowired private SessionFactory sessionFactory; @Override public void createCompany(Company company) { sessionFactory.getCurrentSession().save(company); } } And Service class: @Service public class CompanyServiceImpl implements CompanyService { @Autowired private CompanyDAO companyDAO; @Override @Transactional public List readCompany() { return companyDAO.readCompany(); } @Override @Transactional public void createCompany(Company company) { companyDAO.createCompany(company); } } When I want to write to database: public class Main { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.config.xml"); CompanyService companyService = (CompanyService) ctx.getBean("companyServiceImpl"); companyService.readCompany(); Company company = new Company(); company.setCompanyName("test1"); companyService.createCompany(company); } } I have so many exceptions: Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyDAOImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationEx…
possible better answer: http://stackoverflow.com/a/26413408
tagged with: spring
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26413234

http://stackoverflow.com/q/26440347
tagged with: image
tagged with: jscrollpane
linked to: http://stackoverflow.com/q/5853879
downvote count: 0
has title: How do I capture the contents of a Scrollpane using graphics
has answer: http://stackoverflow.com/a/26441025
score: 1
favorite count: 0
type: Question
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/41543465
upvote count: 1
tagged with: swing
answer count: 1
has body: I'm trying to create a buffered image from the contents of a JScrollpane. The Jscrollpane dimesions are 250x200. The contents spillover and only the visible section gets captured in the image. I'm using Java graphics 2D. Is there a way to capture the complete contents of the scrollpage?
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/q/26381166
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
downvote count: 0
tagged with: pojo
has comment: http://stackoverflow.com/comment/48872028
has body: I would like to create a POJO that wouldn't need to change when adding new fields to its JSON representation. It would have some basic and required fields but will store any new fields that will be added in the future. Examples of JSON: { "id": 12345, "name":"udy", "text": "hi, my name is udy", "data": { "gender": "male, "age": 65, "location":{"city":"nyc"} } } I thought about creating this POJO: public class Pojo{ private long id; private String name; private String text; private Map data; } But I'm not sure this is the best option. Couple of things in head are: Fast serialize/deserialize to json (boon) Flexible support for different types (lists, objects) in data field I know that jackson can handle unknown fields, however it is pretty slow comparing to boon
tagged with: deserialization
has title: Java POJO that supports unkonwn fields
favorite count: 0
tagged with: serialization
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2

embeddable
type: Tag
tag name: embeddable
tags question: http://stackoverflow.com/q/26375220

http://stackoverflow.com/comment/41642710
comment on: http://stackoverflow.com/q/26498908
score: 0
type: Comment
has text: Yes sir. That is what I want
type: QuestionComment

http://stackoverflow.com/q/26391490
score: 0
has body: This is basically a program that adds or tries to add patients details to an object array. The patients are created in the hospital constructor. import java.util.*; public class Hospital { public static String firstName; public static String lastName; public static int patientID = 1; public static int phoneNum; private static int i = 0; private static Hospital[] hosArray = new Hospital[100]; public Hospital(){ firstName = ""; lastName = ""; patientID = 0; phoneNum = 0; } public Hospital (String fName, String lName, int pID, int pNum){ firstName = fName; lastName = lName; patientID = patientID++; phoneNum = pNum; } public static void scanner(){ The user is prompted to add stuff like first name, last name, phone number. Scanner user = new Scanner(System.in); System.out.print("Enter 1 to add patient: "); int input = user.nextInt(); if (input == 1){ System.out.print("Enter first name: "); String fName = user.next(); System.out.print("Enter last name: "); String lName = user.next(); System.out.print("Enter phone number: "); int pNum = user.nextInt(); This is where I try and add each new object to the array and it seems to work. When I add one patient to the array it prints out that patient. However when I try and add more than one patient to the array then the last patient I enter is printed out the same number of times as the number of patients I tried to enter. :? if(hosArray[i] == null){ hosArray[i] = new Hospital(); hosArray[i] = new Hospital(fName, lName, Hospital.patientID, pNum); i++; } scanner(); } } public int getpID(){ return patientID; } public static void main(String[] args) { scanner(); for (int j = 0; j &lt; hosArray.length; j++){ if (hosArray[j] != null ) { System.out.println(hosArray[j].firstName); } } } } This is the output of my program. Enter 1 to add patient: 1 Enter first name: joe Enter last name: bloggs Enter phone number: 1234 Enter 1 to add patient: 1 Enter first name: john Enter last name: doe Enter phone number: 4321 Enter 1 to add patient: 0 j…
type: Question
tagged with: object
type: AnsweredQuestion
tagged with: java
has title: Adding objects to an object array and then printing out the objects from the array
answer count: 2
has answer: http://stackoverflow.com/a/26391664
tagged with: arrays
has answer: http://stackoverflow.com/a/26391693
possible better answer: http://stackoverflow.com/a/26391693
accepted answer: http://stackoverflow.com/a/26391664

http://stackoverflow.com/a/26504876
answers question: http://stackoverflow.com/q/26504826
has comment: http://stackoverflow.com/comment/41640833
upvote count: 2
has body: You're specifying the name of the source file. That's not what you provide to the java command - you specify the class name. java HelloWorld This assumes that HelloWorld.class is somewhere on the classpath, which would default to "the current directory". If you had a package, e.g. package foo; public class HelloWorld { ... } Then you would want to put HelloWorld.java in a directory called foo, and compile and run from the root directory: &gt; javac foo\HelloWorld.java &gt; java foo.HelloWorld Note how now the fully-qualified class name is foo.HelloWorld, not foo\HelloWorld.
has comment: http://stackoverflow.com/comment/41641196
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41642970
score: 2

http://stackoverflow.com/a/26394025
has comment: http://stackoverflow.com/comment/62898910
upvote count: 6
answers question: http://stackoverflow.com/q/26386155
downvote count: 0
has comment: http://stackoverflow.com/comment/41448017
has body: You could write a single ExceptionMapper against an exception superclass (i.e. java.lang.Exception) and then provide different behaviors based on the specific exception class, for example: public class MyExceptionMapper implements ExceptionMapper&lt;Exception&gt; { @Override public Response toResponse(Exception exception) { if (exception instanceof EntityNotFoundException) { ... } else (exception instanceof NumberFormatException) { ... } else { // The catch-all handler... } } } But in my opinion this isn't as clean as writing separate mappers for each type of exception. For one thing, this mapper will catch all Exceptions, and for another this class could grow to unwieldy dimensions over time. Perhaps it's a matter of code style.
score: 6
type: Answer

http://stackoverflow.com/q/26395511
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26397682
has body: In my project, in a method I see a following return statement : @RequestMapping(method=RequestMethod.GET, params="part=category-fieldset") public String partCategoryFieldset(@PathVariable String language, Model model) { CategoryTree categoryTree = categoryService.readCategoryTree(language); model.addAttribute("categoryTree", categoryTree); return "/article/create::#category-fieldset"; } So, i would like to ask: What is the purpose of double colon and sharp sign in return statement? What does this mean? Thank you!
tagged with: spring
score: 2
upvote count: 3
tagged with: java
has title: What is the purpose of "::#" in a string returned from a RequestMethod?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41445559
tagged with: controller
answer count: 1
has comment: http://stackoverflow.com/comment/41446382

http://stackoverflow.com/a/26400887
type: Answer
answers question: http://stackoverflow.com/q/26400779
has body: Add a unique string to each order ID, like the user's email (if it's unique in your database) or the user's id from your database. This makes the order ID truly unique String unique = timestamp + unique_user_field
score: 0

http://stackoverflow.com/comment/41464215
type: Comment
comment on: http://stackoverflow.com/a/26407220
score: 0
type: AnswerComment
has text: Javascript calling applet methods usually turns out to be quite a mess, but yes, I suppose that could be what's happening. I guess other applets could be doing the same (also a mess).

http://stackoverflow.com/q/26383897
has body: I'm using NetBeans 8.0.1 and I need a HSQLDB for a project in school. I was following this tutorial, but unfortunately I got the following error message: Cannot establish a connection to jdbc:hsqldb:hsql://localhost/ using org.hsqldb.jdbcDriver (java.net.SocketException: Malformed reply from SOCKS server) Can someone please help me? I tried it with HSQLDB 2.3.2.
score: 1
has comment: http://stackoverflow.com/comment/41423006
tagged with: java
tagged with: sql
upvote count: 1
tagged with: hsqldb
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41422908
tagged with: netbeans
downvote count: 0
answer count: 0
type: Question
has title: HSQLDB and NetBeans 8.0.1?
has comment: http://stackoverflow.com/comment/41422128

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/26366301
tags question: http://stackoverflow.com/q/26440896
tags question: http://stackoverflow.com/q/26458476
tags question: http://stackoverflow.com/q/26353865
type: Tag
tags question: http://stackoverflow.com/q/26511903
tags question: http://stackoverflow.com/q/26431093

http://stackoverflow.com/q/26424824
tagged with: keyword
type: Question
accepted answer: http://stackoverflow.com/a/26425444
has answer: http://stackoverflow.com/a/26425444
score: 0
tagged with: grammar
answer count: 1
tagged with: xtext
has title: The keyword 'system' generates InternalParser with errors
has body: When I add a keyword system to my grammar, the generated InternalParser shows errors, when the keyword is a java class. For Instance I use system, which is also used a class used in the following method. public static final int System=98; public final boolean synpred196_InternalDummyParser() { state.backtracking++; int start = input.mark(); try { synpred196_InternalFoStructuresParser_fragment(); // can never throw exception } catch (RecognitionException re) { System.err.println("impossible: "+re); } boolean success = !state.failed; input.rewind(start); state.backtracking--; state.failed=false; return success; } Is there a way to fix this. With XText 2.6.2 was everything working fine, but I have this error using XText 2.7.2.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26461251
type: Question
score: 0
has answer: http://stackoverflow.com/a/26476965
has answer: http://stackoverflow.com/a/26461354
answer count: 3
has comment: http://stackoverflow.com/comment/41561618
has answer: http://stackoverflow.com/a/26461336
has title: hibernate createSqlQuery - escape semicolon on date
tagged with: escaping
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26461354
tagged with: java
tagged with: hibernate
has body: I've tried running the following insert native query. queryInsert = "INSERT INTO abc(id,date1, date2) VALUES(5,\"2014-10-20 14:31:01\",\"2014-10-20 14:31:11\");"; SQLQuery sqlQuery = session.createSQLQuery(queryInsert); sqlQuery.executeUpdate(); And I got the following exception: org.hibernate.exception.SQLGrammarException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] .... at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45] Caused by: java.sql.SQLException: No value specified for parameter 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.PreparedStatement.checkAllParametersSet(PreparedStatement.java:2487) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2462) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2311) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262) ~[mysql-connector-java-5.1.31.jar:na] at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246) ~[mysql-connector-java-5.1.31.jar:na] at com.jolbox.bonecp.PreparedStatementHandle.executeUpdate(PreparedStatementHandle.java:205) ~[bonecp-0.8.0.RELEASE.jar:na] at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:187) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final] ... 29 common frames omitted The thing is hibernate is treating the colon (:) in my …
accepted answer: http://stackoverflow.com/a/26476965

http://stackoverflow.com/q/26501328
accepted answer: http://stackoverflow.com/a/26548544
tagged with: bluej
possible better answer: http://stackoverflow.com/a/26501382
has comment: http://stackoverflow.com/comment/41634645
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41635499
has body: I have recently started experimenting with the return statement, and I have a small doubt relating to it- When I have a method which calls another method, will the return statement of that method which I am calling be displayed? Let be give an example to make it clearer- /** Program to test return statment */ public class Test { public static void main(int a) { EvenOrOdd(a); } private static boolean EvenOrOdd(int a) {//I can declare as public and run directly but then what is the point in calling the method? if(a%2==0) { System.out.println("The output is true.");//Displays return true;//Does not display(As in that window does not pop up with the result.) } else { System.out.println("The output is false.");//Displays return false;//Does not display } } } If I were to simply remove the main method(or even make the second method public and run that directly), my return statement is displayed however if I attempt to call the method and run the program my return statement isn't displayed. So is this just a problem I am facing or is it a general rule in Java that the return statement doesn't work when you call another method(which has a return statement)? If it is the latter, then I apologise, I was not aware of this. Thanks... ***UPDATE*** It seems that nobody has understood what I exactly mean. I will give another example- Please run this program-: /** Program to test Return statment;simple program to return sum of two digits */ public class Return_Test { public static int main(int a,int b) { return a+b;//What I am lloking for is that box in which this is displayed. } }
has answer: http://stackoverflow.com/a/26501382
tagged with: method-call
has answer: http://stackoverflow.com/a/26501412
has answer: http://stackoverflow.com/a/26501419
type: Question
has comment: http://stackoverflow.com/comment/41634678
has answer: http://stackoverflow.com/a/26548544
tagged with: return
has answer: http://stackoverflow.com/a/26501407
score: 0
has comment: http://stackoverflow.com/comment/41635280
has comment: http://stackoverflow.com/comment/41634549
has comment: http://stackoverflow.com/comment/41635798
tagged with: java
answer count: 5
has title: Return statement not working when calling another method

http://stackoverflow.com/comment/86343762
comment on: http://stackoverflow.com/a/26364729
type: AnswerComment
has text: Brian Goetz's same statement also says: "You should almost never use it as a field". That's where the disconnect comes up. I use an `Integer` field to represent a possible value (and handle the nullability within my class) but I want to expose that as an `OptionalInt` to consumers of my API.
score: 0
type: Comment

http://stackoverflow.com/comment/41587778
has text: Thank You So much. That worked! I probably would have never figured that out!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26474539
type: AnswerComment

http://stackoverflow.com/comment/41651383
type: QuestionComment
has text: Thank you Farlan, that should work for what I am trying to do.
comment on: http://stackoverflow.com/q/26510299
score: 0
type: Comment

http://stackoverflow.com/comment/41507291
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26429555
has text: @Qualcuno i'm not looking for code. I want to know the right technique

http://stackoverflow.com/a/26527694
has comment: http://stackoverflow.com/comment/41683056
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/26422470
score: 5
downvote count: 0
has body: I would say that there are reasons to share information between steps, but I don't think that's the case in this scenario. If you propagate the user name via the test steps then it's not really clear from the feature what's going on. I think it's better to specifically say in the scenario what is expected. I would probably do something like this: Feature: Demo Scenario: Create user Given User creation form management When Create user with name "TEST" Then A user named "TEST" has been created Then, your actual test steps might look something like: @When("^Create user with name \"([^\"]*)\"$") public void Create_user_with_name(String userName) throws Throwable { userService.createUser(userName); } @Then("^A user named \"([^\"]*)\" has been created$") public void User_is_created_successfully(String userName) throws Throwable { assertNotNull(userService.getUser(userName)); }

http://stackoverflow.com/q/26446808
has title: Javafx Removing a node from htmleditor
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42154720
has body: I have a simple application developed in javafx. The problem is that I want to remove the two tool bars but find no way how to do that. Here in the code I have set the visibility of the bottom toolbar to false. For help if you need to answer: The id of the top toolbar is .top-toolbar while the id of the bottom toolbar is .bottom-toolbar. Your help will be appreciated greatly... Here is my code. Thanks in advance. import javafx.application.Application; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.web.HTMLEditor; import javafx.stage.Stage; public class PrivateHistory extends Application { @Override public void start(Stage stage) { stage.setTitle("HTMLEditor Sample"); stage.setWidth(400); stage.setHeight(300); final HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setPrefHeight(245); Scene scene = new Scene(htmlEditor); stage.setScene(scene); Node node = htmlEditor.lookup(".bottom-toolbar"); node.setVisible(false); //htmlEditor.setHtmlText("&lt;img src='"+getClass().getResource("ball.png")+"' /&gt;"); stage.show(); } public static void main(String[] args) { launch(args); } }
tagged with: css
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
type: Question
has answer: http://stackoverflow.com/a/26487623
accepted answer: http://stackoverflow.com/a/26487623
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/26450300
has body: Which annotation from Jax-RS api was used to retrieve the cookie value? I tried with the below code public String getCookieValue(@Context HttpHeaders headers){ headers.getCookies() } above code snippet gives a Map. how to retrieve a specific cookie value from it..! Thanks
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0
has title: How to get the cookie value from a Rest Webservice
type: Question
has answer: http://stackoverflow.com/a/26451052
accepted answer: http://stackoverflow.com/a/26450448
has answer: http://stackoverflow.com/a/34818750
possible better answer: http://stackoverflow.com/a/26451052
answer count: 3
upvote count: 1
tagged with: cookies
tagged with: java
has answer: http://stackoverflow.com/a/26450448
type: AnsweredQuestion

http://stackoverflow.com/comment/41440644
type: Comment
comment on: http://stackoverflow.com/q/26394169
score: 4
type: QuestionComment
has text: i don't see a prime find algorithm here

http://stackoverflow.com/q/26504151
possible better answer: http://stackoverflow.com/a/26504250
linked to: http://stackoverflow.com/q/1235179
has comment: http://stackoverflow.com/comment/41639635
has answer: http://stackoverflow.com/a/26504250
has body: In Java I need to construct a string of n zeros with n unknown at compile time. Ideally I'd use String s = new String('0', n); But no such constructor exists. CharSequence doesn't seem to have a suitable constructor either. So I'm tempted to build my own loop using StringBuilder. Before I do this and risk getting defenestrated by my boss, could anyone advise: is there a standard way of doing this in Java? In C++, one of the std::string constructors allows this.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26504317
tagged with: java
upvote count: 1
has title: Construct a string from a repeated character
has answer: http://stackoverflow.com/a/26504258
accepted answer: http://stackoverflow.com/a/26504252
type: Question
has comment: http://stackoverflow.com/comment/41639655
has answer: http://stackoverflow.com/a/26504365
downvote count: 0
has comment: http://stackoverflow.com/comment/41639708
score: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26504252
answer count: 5

http://stackoverflow.com/comment/41653303
comment on: http://stackoverflow.com/q/26511365
score: 0
type: Comment
type: QuestionComment
has text: I am enabling it in the handleSetEnableLogic() method just after adding it in the addMenuItems() method.

http://stackoverflow.com/comment/41376008
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26357332
has text: Did you double check your password and database name?
type: Comment

http://stackoverflow.com/q/26419949
score: 0
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/26420383
type: AnsweredQuestion
has body: I usually code in VB.NET, and I am kinda new with the Android/Java environment. So forgive my noobishness. I have made an application with a simple New/Edit/Save/Delete button and some EditText. In .NET I usually create my own "Mode" object which consist of 4 states which is "New/Edit/View/Idle" tied to ModeChanged Events which is then the class would be declared WithEvents so I could manage my Interface via ModeChanged Events. Now in android I tried to make the same feature using a ModeObject Class public class ModeObject { private enum Mode { IDLE, NEW, VIEW, EDIT } private Mode mode; public ModeObject() { mode = Mode.IDLE; } public void SetNew() { mode = Mode.NEW; } public void SetIdle() { mode = Mode.IDLE; } public void SetView() { mode = Mode.VIEW; } public void SetEdit() { mode = Mode.EDIT; } public String GetMode() { return mode.toString(); } public boolean isNew() { if(mode==Mode.NEW) return true; else return false; } public boolean isIdle() { if(mode==Mode.IDLE) return true; else return false; } public boolean isView() { if(mode==mode.VIEW) return true; else return false; } public boolean isEdit() { if(mode==mode.EDIT) return true; else return false; } } This is my main Activity public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.vehicle); private Button btnNew; private Button btnSave; private Button btnEdit; private Button btnCancel; private Button btnDelete; private Spinner spinner; private ModeObject mode = new ModeObject(); btnNew = (Button) findViewById(R.id.btnVehicle_New); btnSave = (Button) findViewById(R.id.btnVehicle_Save); btnEdit = (Button) findViewById(R.id.btnVehicle_Edit); btnCancel = (Button) findViewById(R.id.btnVehicle_Cancel); btnDelete = (Button) findViewById(R.id.btnVehicle_Delete); btnNew.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub mode.setNew(); } }); btnEdit.setOnClickListener(new OnClickListener() { @…
tagged with: java
accepted answer: http://stackoverflow.com/a/26420322
has answer: http://stackoverflow.com/a/26420329
type: Question
has answer: http://stackoverflow.com/a/26420383
has answer: http://stackoverflow.com/a/26420322
has title: Android/Java Class Event

http://stackoverflow.com/q/26450015
score: -4
has comment: http://stackoverflow.com/comment/41541566
has body: Basically, I want to parse, line by line, a Text file so that every line is in it's own array value. E.g. Hi There, My Name's Aiden, Not Really. Array[0] = "Hi There" Array[1] = "My Name's Aiden" Array[2] = "Not Really" But all the examples I have read already just confuse me and lead me to get frustrated. Maybe it's the way I approach it. I don't know how to go about it, a point in the right direction would be most satisfying.
has answer: http://stackoverflow.com/a/26450157
accepted answer: http://stackoverflow.com/a/26450157
downvote count: 4
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/41541556
tagged with: java
has comment: http://stackoverflow.com/comment/41541657
tagged with: loops
has comment: http://stackoverflow.com/comment/41541625
type: Question
tagged with: arrays
has title: Parsing A Text File, So That Every Line Is Stored As An Array Value
has comment: http://stackoverflow.com/comment/41541643
answer count: 1
favorite count: 0
tagged with: parsing
upvote count: 0

http://stackoverflow.com/a/26492826
has comment: http://stackoverflow.com/comment/41619898
downvote count: 0
has comment: http://stackoverflow.com/comment/41620464
has comment: http://stackoverflow.com/comment/41623382
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26492690
has body: you can try this : public class Test { /** * @param args */ public static void main(String[] args) { int[][]array={{3,4,5},{1,8,3},{33,7,5}}; print_array(array); placeBlock(array,2); print_array(array); } public static void placeBlock(int[][] array,int value) { Random rand=new Random(); int randRow=rand.nextInt(array.length); int randCol=rand.nextInt(array[0].length); array[randRow][randCol]=value; } public static void print_array(int[][] array) { for (int row = 0; row &lt; array.length; row++) { System.out.print("\n-----------------\n" + "| "); for (int col = 0; col &lt; array[row].length; col++) { if (col != array[row].length) { System.out.print(array[row][col] + "| "); if (col == array[row].length) { System.out.print("\n"); } } } } System.out.print("\n-----------------"); } }

http://stackoverflow.com/q/26507669
score: 0
accepted answer: http://stackoverflow.com/a/26507727
tagged with: jscrollpane
answer count: 1
has title: JPanel in JScrollPane not showing
linked to: http://stackoverflow.com/q/22593867
has body: I'm busy making a level designer for a game I'm planning to make in Java. I have a panel for settings, for example the size of the level or what the background will be. You can also select images to put on the other panel, the 'DesignerPanel' and then you should be able to click on that panel to put it in a specific place. I put the DesignerPanel in a JScrollPane to scroll around bigger levels. The problem is that the JScrollPane doesn't appear and neither does the panel that should be in it. I have found some questions about the scroll bars not appearing, but in my case nothing appears. Well, at least, almost nothing. You can see really small stripes of the DesignerPanel to the right and below. However, there is no trace of the JScrollPane or the rest of the panel. Resizing or minimizing and unminimizing the screen doesn't make a difference. I would post an image and I think it would surely help, but apparently I need reputation to do that, so sorry about that. Here's the relevant code I have so far. I have hidden most of the code because it is not important for this error. package games; import java.awt.*; import java.io.*; import javax.swing.*; class LevelDesignerScreen extends JFrame { private SettingsPanel sp; private DesignerPanel dp; private JScrollPane scroller = new JScrollPane(); LevelDesignerScreen() { sp = new SettingsPanel(this); add(sp, BorderLayout.WEST); dp = new DesignerPanel(sp); dp.setSize(1000, 1000); scroller.setPreferredSize(new Dimension(600, 600)); scroller.add(dp); add(scroller, BorderLayout.CENTER); } public static void main(String[] args) { new LevelDesignerScreen(); } }
has comment: http://stackoverflow.com/comment/41646042
duplicate of: http://stackoverflow.com/q/22593867
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26507727
tagged with: swing
type: Question
tagged with: jpanel

http://stackoverflow.com/a/26381266
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26381226
upvote count: 1
type: Answer
has body: You can give quartz scheduler a shot. Here you can find more infomation regarding the subject : http://quartz-scheduler.org/generated/2.2.1/html/qs-all/#page/Quartz_Scheduler_Documentation_Set/_qs_all.1.009.html# In a nutshell you can define an xml file, stating which task would work on which condition ( or time frame ). In the example below : <property name="targetObject" ref="orderRecorderJob"/> <property name="targetMethod" value="execute"/> <property name="jobDetail" ref="orderTask" /> <property name="cronExpression" value="0 0/5 * * * ?" /> A task is defined named orderTask, which is the execute method in orderRecorderJob. This task is associated with a cron expression, thereby the trigger is defined. So to sum it all up the example above would trigger execute method of orderRecorderJob class every five minutes as stated on its cron expression ( 0 0/5 * * * ?). More on cron expression syntax : http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

http://stackoverflow.com/comment/41396066
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26366556
has text: possible duplicate of [No Persistence provider for EntityManager named X](http://stackoverflow.com/questions/19322827/no-persistence-provider-for-entitymanager-named-x)

http://stackoverflow.com/a/38878920
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/115202194
answers question: http://stackoverflow.com/q/26462048
upvote count: 5
has body: Because this it the top hit on Google for rabbitmq/camel integration I feel the need to add a bit more to the subject. The lack of simple camel examples is astonishing to me. import org.apache.camel.CamelContext; import org.apache.camel.ConsumerTemplate; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Test; public class CamelTests { CamelContext context; ProducerTemplate producer; ConsumerTemplate consumer; Endpoint endpoint; @Test public void camelRabbitMq() throws Exception { context = new DefaultCamelContext(); context.start(); endpoint = context.getEndpoint("rabbitmq://192.168.56.11:5672/tasks?username=benchmark&amp;password=benchmark&amp;autoDelete=false&amp;routingKey=camel&amp;queue=task_queue"); producer = context.createProducerTemplate(); producer.setDefaultEndpoint(endpoint); producer.sendBody("one"); producer.sendBody("two"); producer.sendBody("three"); producer.sendBody("four"); producer.sendBody("done"); consumer = context.createConsumerTemplate(); String body = null; while (!"done".equals(body)) { Exchange receive = consumer.receive(endpoint); body = receive.getIn().getBody(String.class); System.out.println(body); } context.stop(); } }
score: 5

http://stackoverflow.com/comment/41525316
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26440739
has text: I've already said twice that there *isn't* an equivalent. But I've suggested you might use a generic method instead, and use the type parameter instead of a normal parameter.

http://stackoverflow.com/q/26438628
type: Question
upvote count: 12
has answer: http://stackoverflow.com/a/31303180
tagged with: jetbrains-ide
favorite count: 0
has answer: http://stackoverflow.com/a/26438706
has answer: http://stackoverflow.com/a/40270943
tagged with: osx-yosemite
possible better answer: http://stackoverflow.com/a/26438706
has answer: http://stackoverflow.com/a/27136035
answer count: 5
has body: This is a tip in reference to Yosemite ´s users (10.10). Yosemite erase 1.6 apple jdk and install 1.7, but JAVA´s IDE for example Intellij or Eclipse needs 1.6, if you haven´t reinstalled this version, your ide will crash at the beginning... after this process you can configure your ide with 1.7 version. Here the link : Apple JDK 1.6
has title: Crash Jetbrains ide with Yosemite Mac osX (Webstorm, intellij)
downvote count: 1
accepted answer: http://stackoverflow.com/a/27136035
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26466439
tagged with: eclipse
score: 11

shell
tags question: http://stackoverflow.com/q/26403272
tags question: http://stackoverflow.com/q/26427333
tags question: http://stackoverflow.com/q/26511185
tags question: http://stackoverflow.com/q/26475477
tags question: http://stackoverflow.com/q/26501677
tag name: shell
tags question: http://stackoverflow.com/q/26394737
type: Tag
tags question: http://stackoverflow.com/q/26459392
tags question: http://stackoverflow.com/q/26502592

http://stackoverflow.com/a/26413958
score: 0
answers question: http://stackoverflow.com/q/26413890
type: Answer
has comment: http://stackoverflow.com/comment/41475915
has body: I think you need to look into the Singleton Pattern. You cannot declare an instance of a class whose constructor is marked as private but you can always declare a static method in that class with a private property. So when you call that static method of the inner class, it returns the one and only instance of that class to the caller. http://en.wikipedia.org/wiki/Singleton_pattern
has comment: http://stackoverflow.com/comment/41475975

http://stackoverflow.com/comment/41639846
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26504212
has text: This seems to be a GET instead POST ...

http://stackoverflow.com/q/26388633
tagged with: java-7
has body: We have Java 7 installed on out machines but for some reason we deploy with Servlet 2.4. Where do I download the latest version of Servlet (3.1) and are there specific steps I have to take to install it?
downvote count: 0
answer count: 1
favorite count: 0
has title: How to upgrade to Servlet 3.1?
tagged with: java-6
upvote count: 3
type: UnansweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/26388871
tagged with: servlets
type: Question

http://stackoverflow.com/comment/41509521
type: AnswerComment
has text: It works but the problem is that if I write something , and write again, the text appends to the last one.. how can I clear the text before writing ? Just in one line
type: Comment
comment on: http://stackoverflow.com/a/26432130
score: 0

http://stackoverflow.com/comment/41663335
score: 0
type: QuestionComment
type: Comment
has text: @StriplingWarrior Already tested that. It gets roughly the same speed as doing the array search. Most of the arrays being checked just aren't big enough to benefit, `in` is generally used for 5 or less values (which can be iterated over really fast).
comment on: http://stackoverflow.com/q/26513492

http://stackoverflow.com/q/26386889
has comment: http://stackoverflow.com/comment/41462535
favorite count: 0
possible better answer: http://stackoverflow.com/a/26390236
tagged with: spring
downvote count: 1
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26387740
accepted answer: http://stackoverflow.com/a/26387740
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26390236
answer count: 2
has title: Is it possible to covert JSON to java bean with @RequestBody without any third party library
score: -1
has comment: http://stackoverflow.com/comment/41429285
has comment: http://stackoverflow.com/comment/41442782
has body: I have a AJAX request with data in json format like: ["name":"Some Name", "address":{"id":1, "street":"some street"}] and Java Bean would be look like: class Person { private String name; private Address address; //getters and setters } class Address { private int id; private String street; //getters and setters } is it possible to use @RequestBody in handler method to get Person without using any third party libraries like: Gson, Jackson etc. if yes how?

http://stackoverflow.com/q/26453100
has comment: http://stackoverflow.com/comment/41547131
has comment: http://stackoverflow.com/comment/41547218
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5563157
has comment: http://stackoverflow.com/comment/41547085
score: 2
has body: After some search for copying of multidimensional arrays manipulation in java I found this question: copy a 2d array in java and a downvoted answer suggests using the method in the title. So my questions are: 1) why is it bad? (becuase it looks quick and obvious) 2) is the best way still System.arraycopy each line?
downvote count: 0
has comment: http://stackoverflow.com/comment/41552354
has comment: http://stackoverflow.com/comment/41547231
type: Question
has comment: http://stackoverflow.com/comment/41547159
has title: What exactly is wrong with newarray = oldarray.clone() for md arrays?
has comment: http://stackoverflow.com/comment/41547261
linked to: http://stackoverflow.com/q/1686425
tagged with: java
has comment: http://stackoverflow.com/comment/41547199
upvote count: 2
has comment: http://stackoverflow.com/comment/41547344
has answer: http://stackoverflow.com/a/26453128
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/41552344
favorite count: 0
has comment: http://stackoverflow.com/comment/41547277

http://stackoverflow.com/q/26380983
answer count: 5
has body: i have an array of integers like this one : A={1,1,4,4,4,1,1} i want to count the each number once , for this example the awnser is 2 becuase i want to count 1 once and 4 once i dont want to use sorting methods i am unable to find a way to solve it using java. i did this but it gives me 0 public static void main(String args[]) { int a[] = { 1,1,4,4,4,4,1,1}; System.out.print(new Test4().uniques(a)); } public int uniques(int[] a) { int unique = 0; int tempcount = 0; for (int i = 0; i &lt; a.length; i++) { for (int j = 0; j &lt; a.length; j++) { if (a[i] == a[j]) { tempcount++; } } if (tempcount &lt;= 2) { unique=a[i]; } tempcount = 0; } return unique; } the purpose of the question is to understand the logic of it but not solving it using ready methods or classes
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26381445
type: Question
has comment: http://stackoverflow.com/comment/41416676
tagged with: arrays
has comment: http://stackoverflow.com/comment/41418155
has answer: http://stackoverflow.com/a/26381099
has answer: http://stackoverflow.com/a/26381630
has answer: http://stackoverflow.com/a/26381667
upvote count: 1
accepted answer: http://stackoverflow.com/a/26381667
has answer: http://stackoverflow.com/a/26381445
favorite count: 0
has title: Finding uniques integers in an array
tagged with: logic
has answer: http://stackoverflow.com/a/26382202

http://stackoverflow.com/comment/41489231
has text: @KANDROIDOS fragement is in one particular layout right. So add setcontentview() in your oncreate() method and try it.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26421108

http://stackoverflow.com/comment/41407083
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26375469
has text: http://stackoverflow.com/questions/883060/how-can-i-determine-if-a-date-is-between-two-dates-in-java

http://stackoverflow.com/comment/41539189
type: Comment
comment on: http://stackoverflow.com/a/26448660
has text: @RajaRassani You may refere this link http://stackoverflow.com/questions/5199811/android-sdk-manager-wont-open
score: 1
type: AnswerComment

http://stackoverflow.com/q/26396384
answer count: 2
has answer: http://stackoverflow.com/a/26396398
tagged with: arrays
tagged with: multidimensional-array
type: AnsweredQuestion
has title: ArrayIndexOutOfBoundsException in multi dimentional array
possible better answer: http://stackoverflow.com/a/26396398
tagged with: java
has comment: http://stackoverflow.com/comment/41444364
has comment: http://stackoverflow.com/comment/41444268
accepted answer: http://stackoverflow.com/a/26396406
type: Question
has body: I am getting the following Exception in thread "main" : java.lang.ArrayIndexOutOfBoundsException: 2 error: My code: int ia=445; int ja=445; double [][][]ma=new double [445][445][2]; ma=na; for (int kk=1;kk&lt;=2;kk++) { int jj=2; if (kk == 2) { jj=ja; } for (int ii=2;ii&lt;ia-1;ii++) { double uu=0.5*abs(ma[ii][jj][2]+ma[ii-1][jj][2]); System.out.println(uu); } } Though there are no ArrayIndexOutOfBoundsException issues, I am still getting this exception. Can some one explain how to fix this issue?
has comment: http://stackoverflow.com/comment/41444282
has answer: http://stackoverflow.com/a/26396406
score: 0

http://stackoverflow.com/comment/41406133
comment on: http://stackoverflow.com/a/26374883
score: 0
type: AnswerComment
has text: @ChrisJester-Young ya u are saying true that finding object in list with max area will reduce the load of the Program rather comparing each. plz make me correct if i got anything wrong :)
type: Comment

http://stackoverflow.com/a/26420609
has comment: http://stackoverflow.com/comment/41494180
has comment: http://stackoverflow.com/comment/41494262
answers question: http://stackoverflow.com/q/26420001
downvote count: 0
has comment: http://stackoverflow.com/comment/41500257
accepted answer of: http://stackoverflow.com/q/26420001
has body: Everything in xml-apis has been included in the core Java class library since Java 5, so you should exclude any transitive dependencies on xml-apis in your pom. The error message you're seeing tends to occur when you have different classloaders in the mix, with the xerces classes binding to interfaces from xml-apis but other code trying to cast them to the same interface as defined by rt.jar.
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41642598

http://stackoverflow.com/a/26511093
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26511023
has body: Hold on to the random index you generated, and use it to index the array: int index = random.nextInt(verben.length); System.out.println("Please enter correct form of verb!"); System.out.println(verben[index]); String enter = Input.readLine(); if(enter.equals(verbenAnswer[index])) { answer = true; points += 1; } You don't even need to keep the original word (glagol) anymore.
answers question: http://stackoverflow.com/q/26511023
type: Answer

http://stackoverflow.com/q/26468946
answer count: 1
upvote count: 6
tagged with: jackson
favorite count: 0
has title: jersey/jackson - filter properties based on query parameter
has comment: http://stackoverflow.com/comment/86970393
tagged with: rest
tagged with: filter
has comment: http://stackoverflow.com/comment/41595201
has answer: http://stackoverflow.com/a/26480224
accepted answer: http://stackoverflow.com/a/26480224
downvote count: 0
score: 6
type: AnsweredQuestion
tagged with: java
type: Question
has body: Filtering out properties with Jackson is pretty simple: final FilterProvider filters = new SimpleFilterProvider(). addFilter(... the name of the filter ..., SimpleBeanPropertyFilter.filterOutAllExcept(... enumeration of properties ...)); &lt;object mapper&gt;.writer(filters).writeValueAsString(... the bean ...); I am trying to integrate this in my Jersey REST application. The API user has the possibility to filter the properties by providing a query string: https://the-api/persons?fields=name,age,location,gender What is the most elegant way to do this in Jersey? I could easily execute the above in my resource methods, but this somehow kills the elegance of Jersey. Also, I believe that creating a new ObjectMapper for every request will have performance penalties. I could write a MessageBodyWriter which fetches the fields query parameter from the UriInfo context and serializes the entity to json while applying a filter based on the fields query parameter. Is this the best way to do this? Like this: @Provider @Produces(MediaType.APPLICATION_JSON) public class JustTesting implements MessageBodyWriter&lt;Object&gt; { @Context UriInfo uriInfo; @Context JacksonJsonProvider jsonProvider; public boolean isWriteable(Class&lt;?&gt; aClass, Type type, Annotation[] annotations, MediaType mediaType) { return MediaType.APPLICATION_JSON_TYPE.equals(mediaType); } public long getSize(Object object, Class&lt;?&gt; aClass, Type type, Annotation[] annotations, MediaType mediaType) { return -1; } public void writeTo(Object object, Class&lt;?&gt; aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap&lt;String, Object&gt; stringObjectMultivaluedMap, OutputStream outputStream) throws IOException, WebApplicationException { final FilterProvider filters = new SimpleFilterProvider().addFilter("MyFilter", SimpleBeanPropertyFilter.filterOutAllExcept(uriInfo.getQueryParameters().getFirst("fields"))); jsonProvider.locateMapper(aClass, mediaType).writer(filters).writeValue…
tagged with: jersey

http://stackoverflow.com/comment/41429764
comment on: http://stackoverflow.com/q/26387726
type: Comment
type: QuestionComment
score: 0
has text: @JonSkeet : There is only one Input which I provide for which I get 3 kinds of outputs. Input: phonenumber#message Outputs: 1. Transmitted. 2. Failed. 3. Transmitted. Delivered. I looked around the Internet and I think the encoding C# and Java uses on its strings are UTF-16?

http://stackoverflow.com/comment/41641157
has text: [From the specification](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#compareTo(T)): “The implementor must ensure `sgn(x.compareTo(y)) == -sgn(y.compareTo(x))` for all `x` and `y`.” So, *no*, this may *never* be a valid case.
type: AnswerComment
comment on: http://stackoverflow.com/a/26504950
type: Comment
score: 2

http://stackoverflow.com/q/26417069
tagged with: string
tagged with: parsing
favorite count: 0
upvote count: 1
has title: How to read values in a text document and then make then parse them to ints in JAVA
downvote count: 1
has body: I'm trying to read lines of a text document and take the average of the numbers. My plan was to first read ALL the data in the text file. Then split the string up into a String array, then parse each index into an int array. This is my code up to the point of reading the document. My Text Doc: 3, 7, 24, 66, 10, 50, 20, 40, 100, 20, 69, 911, import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class Testing { public static void main(String[] args) throws IOException { try { String path; path = "TestNumbers.txt"; File f = new File(path); FileReader re = new FileReader(f); BufferedReader in = new BufferedReader(re); String line = ""; String store = ""; while((line = in.readLine()) != null) { store = store + line; } System.out.println(store); } catch (FileNotFoundException e) { e.printStackTrace(); } } } Output: 3, 7, 24, 66, 10, 50, 20, 40,100, 20, 69, 911, In a perfect world I want the values to be separated by either "," or " ". I tried modifying the store = store + line + " "; but this failed because it would iterate the space even when readLine() was on a blank line. I can traverse the arrays to parse the int and take the average, but setting up this string to be split is stumping me. I tried String.replace(), String.trim(), and another one that failed me. This isn't homework, I'm in highschool AP CS and this is my own independent study. Thanks everyone for the help, you all showed plenty of ways to do it. Ended up going with .replace, and made the " " into "". Then just split via the commas. I do want to try out that regex thing though. Thanks everyone again.
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26417267
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41481255
tagged with: arrays
has comment: http://stackoverflow.com/comment/41481297
has answer: http://stackoverflow.com/a/26417231
has answer: http://stackoverflow.com/a/26419484
accepted answer: http://stackoverflow.com/a/26417267
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26419484
has comment: http://stackoverflow.com/comment/41481263

http://stackoverflow.com/q/26384347
has title: Hibernate one to many bidirectional association not loading with Spring Data
score: 0
has answer: http://stackoverflow.com/a/26385024
has comment: http://stackoverflow.com/comment/41431307
has body: I have a bi-directional mapping as below @Entity @Table(name = "Stock") public class StockEntity implements Serializable { private String planNum; private Set&lt;StockOptionEntity&gt; options = new HashSet&lt;StockOptionEntity&gt;(0); @OneToMany(fetch = FetchType.EAGER, mappedBy="stock") public Set&lt;StockOptionEntity&gt; getOptions() { return Options; } public void setOptions(Set&lt;StockOptionEntity&gt; Options) { this.Options = Options; } } Then I have another mapping as below.. @Entity @Table(name = "StockOption") @IdClass(StockOptionEntityPK.class) public class StockOptionEntity implements Serializable { private StockEntity stock; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "PlanNum", insertable = false, updatable = false) public StockEntity getStock() { return Stock; } public void setStock(StockEntity Stock) { this.Stock = Stock; } } I then have the Spring Beans declared as below for Session, Entity &amp; Transaction manager @Bean public DataSource msSqlDataSource() { SQLServerConnectionPoolDataSource dataSource = new SQLServerConnectionPoolDataSource(); ........... return dataSource; } @Bean @DependsOn({ "msSqlDataSource"}) public LocalSessionFactoryBean sessionFactory() { LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); try { sessionFactory.setDataSource(msSqlDataSource()); } catch (Exception e) { log.error("Failed to attach dataSource object to SessionFactory bean. " + "Exception: " + e.getMessage()); } sessionFactory .setPackagesToScan("com.firstx.db.entity.*"); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; } @Bean @DependsOn({ "sessionFactory","msSqlDataSource"}) public EntityManagerFactory entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setGenerateDdl(true); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesT…
type: UnansweredQuestion
tagged with: spring-data
tagged with: spring
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26386131
type: Question
answer count: 2

http://stackoverflow.com/comment/41481020
type: QuestionComment
comment on: http://stackoverflow.com/q/26416936
score: 0
has text: what does the data look like when you `console.log(chatMessage)`
type: Comment

http://stackoverflow.com/comment/41509834
has text: This is a great start for a first question :) Would you mind elaborating a bit and telling *us* what's wrong first? What specifically is the issue with "inserting the title and abstract into a single array position"?
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26432607

http://stackoverflow.com/q/26503404
score: 0
has comment: http://stackoverflow.com/comment/41709866
tagged with: android
accepted answer: http://stackoverflow.com/a/26609204
possible better answer: http://stackoverflow.com/a/29748306
has answer: http://stackoverflow.com/a/29748306
has body: I'm trying to build the simplest android chatting app based on firebase, I've taken the firebase list adapter for chats from their android chat example. and used my own model class but the damn thing won't work. here are the classes and log: Message model class: import java.util.Date; import org.json.JSONException; import org.json.JSONObject; import com.shaded.fasterxml.jackson.annotation.JsonIgnore; public class Message { int messageId; String messageContent; // int chatID; // int senderID; // int recieverID; // Date timeStamp; // String messageType; /** * Message constructor to create message object * * @param messageID * @param messageContent * @param chatID * {@link Chat} * @param senderID * {@link User} * @param recieverID * {@link User} * @param messageType */ // public Message(int messageID, String messageContent, int chatID, // int senderID, int recieverID, MessageType messageType) { // this.messageID = messageID; // this.messageContent = messageContent; // this.chatID = chatID; // this.senderID = senderID; // this.recieverID = recieverID; // this.messageType = messageType; // } @JsonIgnore public Message(int messageId, String messageContent) { // this.messageContent = messageContent; this.messageId = messageId; this.messageContent = messageContent; } /** * Message constructor to create message object This will be used when the * user send the message and still no status for this message * * @param messageContent * @param chatID * {@link Chat} * @param senderID * {@link User} * @param recieverID * {@link User} * @param messageType */ // public Message(String messageContent, int chatID, int senderID, // int recieverID, MessageType messageType) { // this.messageContent = messageContent; // this.chatID = chatID; // this.senderID = senderID; // this.recieverID = recieverID; // this.messageType = messageType; // } /** * Message constructor to create message object from JSON response This * constructor will be used to create an object from web service JSON * respo…
tagged with: firebase-realtime-database
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26609204
type: Question
answer count: 2
has title: Firebase simple chat client not retrieving values

graph-algorithm
tags question: http://stackoverflow.com/q/26447137
type: Tag
tag name: graph-algorithm

http://stackoverflow.com/a/26444094
upvote count: 9
answers question: http://stackoverflow.com/q/26424030
score: 9
has comment: http://stackoverflow.com/comment/130427493
downvote count: 0
has body: In your case you can use a ReadWriteLock to access a backed List, this allows multiple Threads to read your list. Only if one Thread needs write access all reader-Thread must wait for the operation to complete. The JavaDoc make's it clear: A ReadWriteLock maintains a pair of associated locks, one for read-only operations and one for writing. The read lock may be held simultaneously by multiple reader threads, so long as there are no writers. The write lock is exclusive. Here is a sample: public class ConcurrentArrayList&lt;T&gt; { /** use this to lock for write operations like add/remove */ private final Lock readLock; /** use this to lock for read operations like get/iterator/contains.. */ private final Lock writeLock; /** the underlying list*/ private final List&lt;T&gt; list = new ArrayList(); { ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); readLock = rwLock.readLock(); writeLock = rwLock.writeLock(); } public void add(T e){ writeLock.lock(); try{ list.add(e); }finally{ writeLock.unlock(); } } public void get(int index){ readLock.lock(); try{ list.get(index); }finally{ readLock.unlock(); } } public Iterator&lt;T&gt; iterator(){ readLock.lock(); try { return new ArrayList&lt;T&gt;( list ).iterator(); //^ we iterate over an snapshot of our list } finally{ readLock.unlock(); } }
has comment: http://stackoverflow.com/comment/41530928
type: Answer
has comment: http://stackoverflow.com/comment/41874423
has comment: http://stackoverflow.com/comment/41532510
has comment: http://stackoverflow.com/comment/41531317

http://stackoverflow.com/comment/41557309
type: QuestionComment
has text: Try `Gson` library from google `https://sites.google.com/site/gson`
comment on: http://stackoverflow.com/q/26458563
score: 0
type: Comment

http://stackoverflow.com/comment/41542056
score: 1
has text: see here http://stackoverflow.com/questions/20449836/error-could-not-find-or-load-main-class-org-codehaus-classworlds-launcher-while
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26449957

http://stackoverflow.com/comment/41443094
has text: Try with trim, int compareResult = x.compareTo(t.info.getLastName().trim());
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26395671

http://stackoverflow.com/a/26478578
type: Answer
answers question: http://stackoverflow.com/q/26478352
has comment: http://stackoverflow.com/comment/41620018
accepted answer of: http://stackoverflow.com/q/26478352
has comment: http://stackoverflow.com/comment/41606528
has comment: http://stackoverflow.com/comment/41605724
has comment: http://stackoverflow.com/comment/41620149
has body: Step 2 mean that the set u now become the union set of u and v, so you cannot assign set[v] = set[v] (u and v is short for boss[u], boss[v] , respectively). So, if set u is {u} and set v is {v}, after this step, set u will be {u,v}, one more example is set u = {1,2} , set v = {3,4}, so after this, set u = {1,2,3,4}. Depending on what data structure you are using, you will need to implement it differently. One way is using ArrayList ArrayList&lt;Integer&gt; set[] = new ArrayList[max]; //Initialize each set, add element into set for(int i = 0; i &lt; max; i++) set[i] = new ArrayList(); set[i].add(i); //For step 2 set[boss[u]].addAll(set[boss[v]]); And the last thing is, your step 4 is wrong, for your current implementation, you just add every element into set[boss[u]], but in this step, they only require those that are in set[boss[v]]. So: int bossV = boss[v];//This is important! Answer why this is needed by yourself. for(int z=0;z&lt;_boss.length;z++) { if(boss[z] == bossV) _boss[z]=_boss[u]; } Small notice: this version you are using is not the fastest version for union-find, try to read more about it!
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/26467341
has body: There are modules containing core jars available out-of-the-box: http://repository.jboss.org/nexus/content/groups/public/org/kie/kie-eap-distributions-bpms-layer/ The slim workbench war using these modules is available here: http://repository.jboss.org/nexus/content/groups/public/org/kie/kie-eap-distributions-bpms-webapp/ Note that the latest snapshots are targeted to eap 6.3.0.
answers question: http://stackoverflow.com/q/26455214
type: Answer
has comment: http://stackoverflow.com/comment/41573903
score: 0

http://stackoverflow.com/comment/41505603
has text: I found out, way too late, that Guid uses what I can only describe as "crazy endianness"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26417127
score: 2

http://stackoverflow.com/q/26458454
tagged with: android
favorite count: 0
answer count: 5
has body: idI am developeing an app in android, In the layout i am using more than 20 EditText. To, reduce the size of my coding i was trying to implement EditText in an array .So, help me with how to implement the Edittext in an array and also how i should name the EditText in XML file to use it as an array. I tried to implement this code but this is not working, edittext reference in java file EditText[] et1 = new EditText[20]; and putting this into a for loop, for(i=0;i&lt;20;i++) { et1[i]=(EditText)findViewById(R.id.edittext[i]); } but eclipse cannot properly resolve edittext[i]. tell me How do I properly create an array of EditText in my xml so that it is recognized
has answer: http://stackoverflow.com/a/26458537
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26458497
has answer: http://stackoverflow.com/a/26458515
accepted answer: http://stackoverflow.com/a/26458515
type: Question
possible better answer: http://stackoverflow.com/a/26458497
has answer: http://stackoverflow.com/a/26459350
has answer: http://stackoverflow.com/a/53057784
upvote count: 3
has title: Android : Array of EditText

http://stackoverflow.com/comment/41534794
comment on: http://stackoverflow.com/q/26446064
type: QuestionComment
type: Comment
has text: @guido: good catch! Always do increments/decrements on their own line. The extra line costs nothing to you, and it can save you some sleepless nights of debugging!
score: 0

http://stackoverflow.com/comment/41591538
has text: -1, Wow, you just copied the code from an answer in your last question (http://stackoverflow.com/a/26456606/131872) and you didn't even bother to accept the answer or thank MadProgrammer for the help.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26476645
type: Comment

http://stackoverflow.com/comment/41407403
has text: Thanks for the reply. As I am using @RequestMapping, it will map all urls to both servlet-mapping. How do I differentiate and make it to map the specific urls to /rest
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26375649
score: 0

http://stackoverflow.com/a/26367281
has body: The correct solution is really to not use aliases at all; they are intended as a convenience for interactive use. If you have a complex alias which you would like to use noninteractively, convert it to a regular shell script, save the file in your $PATH, and mark it as executable. Or convert it to a function. Even for interactive use, functions are actually superior to aliases, and work in noninteractive shells, too. Having said that, you can always wing it. The command you execute could be, for example, private static String[] commands = {"bash -O expand_aliases -c 'll /'", "df -h"}; You may need to smuggle a newline into that command line if you need to explicitly source the alias definition before you can use it; there is a caveat in the manual about this. (Do read all of it, and especially the last sentence.) Of course, for something this simple, the proper solution is to just run the standard command ls -l and forget about the alias. It's better for portability, too; while many sites have this alias, it's by no means guaranteed to exist. (Personally, the first thing I do when I set up an account is remove these "de facto standard" aliases.)
accepted answer of: http://stackoverflow.com/q/26359806
type: Answer
has comment: http://stackoverflow.com/comment/41407851
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26359806
type: AcceptedAnswer
downvote count: 0

junit
tags question: http://stackoverflow.com/q/26357751
type: Tag
tags question: http://stackoverflow.com/q/26387435
tags question: http://stackoverflow.com/q/26462554
tags question: http://stackoverflow.com/q/26360823
tags question: http://stackoverflow.com/q/26427450
tags question: http://stackoverflow.com/q/26398935
tags question: http://stackoverflow.com/q/26359882
tags question: http://stackoverflow.com/q/26471930
tags question: http://stackoverflow.com/q/26459166
tags question: http://stackoverflow.com/q/26354832
tags question: http://stackoverflow.com/q/26478146
tags question: http://stackoverflow.com/q/26474216
tags question: http://stackoverflow.com/q/26381403
tags question: http://stackoverflow.com/q/26366274
tags question: http://stackoverflow.com/q/26415573
tags question: http://stackoverflow.com/q/26420681
tags question: http://stackoverflow.com/q/26386474
tags question: http://stackoverflow.com/q/26376073
tag name: junit
tags question: http://stackoverflow.com/q/26377675
tags question: http://stackoverflow.com/q/26400459
tags question: http://stackoverflow.com/q/26421829
tags question: http://stackoverflow.com/q/26398703
tags question: http://stackoverflow.com/q/26375186
tags question: http://stackoverflow.com/q/26435207
tags question: http://stackoverflow.com/q/26508998
tags question: http://stackoverflow.com/q/26495940
tags question: http://stackoverflow.com/q/26418376
tags question: http://stackoverflow.com/q/26416697
tags question: http://stackoverflow.com/q/26512820
tags question: http://stackoverflow.com/q/26371032
tags question: http://stackoverflow.com/q/26415507
tags question: http://stackoverflow.com/q/26463741
tags question: http://stackoverflow.com/q/26421005
tags question: http://stackoverflow.com/q/26421021
tags question: http://stackoverflow.com/q/26416012
tags question: http://stackoverflow.com/q/26371441
tags question: http://stackoverflow.com/q/26422919
tags question: http://stackoverflow.com/q/26406205
tags question: http://stackoverflow.com/q/26466534
tags question: http://stackoverflow.com/q/26511532
tags question: http://stackoverflow.com/q/26381907
tags question: http://stackoverflow.com/q/26433889
tags question: http://stackoverflow.com/q/26462926
tags question: http://stackoverflow.com/q/26356403
tags question: http://stackoverflow.com/q/26442567

http://stackoverflow.com/a/26477434
has body: You try to compare String with Char in your while lopp statement. Convert your char to int and use unicode table to look up charcode, ex. n would be 110 Before your loop: int a = 0; Whithin your loop: a = (int)answer; ...(while a != 110 || ...)
upvote count: 0
has comment: http://stackoverflow.com/comment/41591977
answers question: http://stackoverflow.com/q/26477350
has comment: http://stackoverflow.com/comment/41591822
downvote count: 2
score: -2
type: Answer

phrase
type: Tag
tag name: phrase
tags question: http://stackoverflow.com/q/26493924

http://stackoverflow.com/comment/41496070
has text: EditTextMonitor is define in a package name "Models" ?
comment on: http://stackoverflow.com/q/26423862
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26401654
type: Answer
answers question: http://stackoverflow.com/q/26401524
downvote count: 0
has body: The equivalent of Date in the new API is Instant: Instant dbInstant = dbDate.toInstant(); You can then compare that instant with another instant: Instant aMonthAgo = ZonedDateTime.now().minusDays(30).toInstant(); boolean withinLast30Days = dbInstant.isAfter(aMonthAgo);
score: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41453762
upvote count: 20
has comment: http://stackoverflow.com/comment/41453249
accepted answer of: http://stackoverflow.com/q/26401524

http://stackoverflow.com/comment/41479340
has text: @JacobAronoff Post your input grid.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26411681

http://stackoverflow.com/a/26375654
answers question: http://stackoverflow.com/q/26375269
has body: a quick google search on your exception gives me an impression that this was a bug reported in sqoop. It looks like they have resolved it. Please look at this https://issues.apache.org/jira/browse/SQOOP-1400. Verify your sqoop and mysql connector version and update to newer version if required. Thanks.
has comment: http://stackoverflow.com/comment/41413194
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/26450641
type: Answer
score: 1
upvote count: 1
has body: I leave a current version of my code which does not lose a message from the other end point. I've divided Client to one as Subscriber which is instantiated only once during session and the other as Message Producer which is instantiated every time I need to send a message and have it disconnected. I don't know if this is a right way to do. But until now, all the messages ( chatting messages ) are safely received. import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.security.auth.login.LoginException; import com.lnisoft.ontocept.StringEscapeUtils; import net.ser1.stomp.Client; import net.ser1.stomp.Listener; import android.os.AsyncTask; // * Active MQ Stomp using Gozirra public class Communicator { private static Communicator instance; private Client subscriber = null; private Client stomp_client = null; private ConnectToOntoceptAsync connector = null; private String emailAsUserIdentifier = ""; private String topicName = null; private String messageToSend = "NO_MESSAGE"; private boolean isLoggedIn = false; private StreamConverter converter = null; private String errorMessage = ""; private boolean hasError = false; public HashMap&lt;String, MessageStack&gt; perCommunicatorUserMessageStackTbl = new HashMap&lt;String, MessageStack&gt;(); public Communicator() { converter = new StreamConverter(); } public static Communicator getInstance() { if ( instance == null ) { instance = new Communicator(); } return instance; } public boolean getIsLoggedIn() { return this.isLoggedIn; } public void initializeCommunicator( String _emailAsUserIdentifier ) throws LoginException, IOException { this.emailAsUserIdentifier = _emailAsUserIdentifier; topicName = "/topic/"+ this.emailAsUserIdentifier; connector = new ConnectToOntoceptAsync(); connector.execute(); } public boolean isIntialized() { if ( isLoggedIn == false ) { return false; } else { return true; } } protected class ConnectToOntoceptAsync extends AsyncTask&lt;String, Void, String&gt; { @Overri…
answers question: http://stackoverflow.com/q/26446285
downvote count: 0

http://stackoverflow.com/comment/41576837
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26467430
has text: You can't. You have to modify them, at least the `FromString` method, removing the decoding, removing the `BufferedReader` (using directly the `File` object) and reading a `String` insted of an object. And _OBVIOUSLY_ you have to create the file in the `toString` method
type: AnswerComment

http://stackoverflow.com/comment/41626510
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26475556
has text: it is the name of a java bean property. in my bean i have a field called "name". in the request i have the bean and the name of the property ("name"). i need to access the value of the property "name" of the java bean. i dont´t know the name of the property, i get it from the request
score: 0

http://stackoverflow.com/q/26429751
type: Question
has answer: http://stackoverflow.com/a/28413451
has title: Java http clients and POODLE
has body: Regarding the POODLE vulnerability, if I understand it correctly, it requires a client that automatically downgrades TLS protocol to SSLv3 when failing to establish a secure channel with a server using higher version protocol advertised by the server. Do the common java HTTP client libraries, specifically javax.net.ssl.HttpsURLConnection and Apache HttpClient, automatically downgrade the TLS protocol when failing to establish TLS session with a server? If not, am I correct that they are immune from he POODLE attack unless either (a) the server only supports SSLv3, or (b) a logic at a higher level performs the downgrade? I'm looking for something like http://blog.hagander.net/archives/222-A-few-short-notes-about-PostgreSQL-and-POODLE.html but for Java clients.
linked to: http://stackoverflow.com/q/26649389
accepted answer: http://stackoverflow.com/a/26439487
tagged with: security
has answer: http://stackoverflow.com/a/26793697
tagged with: poodle-attack
downvote count: 0
has comment: http://stackoverflow.com/comment/48014375
favorite count: 0
tagged with: apache-httpclient-4.x
possible better answer: http://stackoverflow.com/a/26578293
has answer: http://stackoverflow.com/a/26578293
upvote count: 16
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26439487
tagged with: java
score: 16
tagged with: https

http://stackoverflow.com/q/26357157
type: Question
accepted answer: http://stackoverflow.com/a/26357303
has comment: http://stackoverflow.com/comment/41373074
favorite count: 0
has comment: http://stackoverflow.com/comment/41373293
has answer: http://stackoverflow.com/a/26357296
tagged with: android
has comment: http://stackoverflow.com/comment/41373133
has body: I have following json string response string variable response = ""[{"firstname":"test","mobileno":"1234567890"},{"firstname":"Saleha","mobileno":"9960439495"},{"firstname":"Nayan","mobileno":"9960439495"},{"firstname":"Harsheen","mobileno":"9960439495"}]"" after executing bellow line i got exception JSONObject jsnobject = new JSONObject(response); Any solution?
answer count: 4
has answer: http://stackoverflow.com/a/26357262
has comment: http://stackoverflow.com/comment/41373874
has answer: http://stackoverflow.com/a/26357259
has comment: http://stackoverflow.com/comment/41373027
upvote count: 2
has answer: http://stackoverflow.com/a/26357303
possible better answer: http://stackoverflow.com/a/26357259
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41373171
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 5
tagged with: eclipse
score: -3
has title: Convert json string to JSONObject in java
has comment: http://stackoverflow.com/comment/41373129

http://stackoverflow.com/q/26488398
has comment: http://stackoverflow.com/comment/41611607
has comment: http://stackoverflow.com/comment/41611447
upvote count: 2
has comment: http://stackoverflow.com/comment/41669606
answer count: 1
has answer: http://stackoverflow.com/a/26488631
tagged with: pointers
accepted answer: http://stackoverflow.com/a/26488631
has comment: http://stackoverflow.com/comment/41667135
favorite count: 0
has comment: http://stackoverflow.com/comment/41611552
has comment: http://stackoverflow.com/comment/41610921
has comment: http://stackoverflow.com/comment/41610875
tagged with: pass-by-value
score: 2
type: AnsweredQuestion
has title: How does Java dereferencing work?
has body: I need to get some clarification on Java references (pointers). I have read this (Java is Pass-by-Value, Dammit! by Scott Stanchfield) excellent write up on Java's way of passing variables around. As far as I understand everything is passed around as memory pointers. public class foo{ int a; int b; public foo(a, b){ this.a = a; this.b = b; } } so in some code like this: foo aFoo = new foo(1,2); //new foo created at adress 0x40 for instance someFunc(aFoo); the argument to someFuncis actually the number 0x40 (albeit this might be a simplification, but to get a sense for the pattern). Now, suppose i created another class public class bar{ foo aFoo; public bar(){ this.aFoo = new foo(1,2); } } and instantiated the following variables bar aBar = new bar(); foo bFoo = new foo(3,4); now suppose i want to copy the values of aBar.aFoo into bFoo like bFoo = aBar.aFoo; If i now do bFoo.a = 1234; did i also just change aBar.aFoo.a into 1234 or does that variable still hold the value 1? By my own logic, bFoo.a is just a pointer, so assigning a new variable should alter both places, but this seems incorrect. So I guess i have not fully understood Java's "reference is really a pointer" concept. Or rather, i might understand the pointer part of it, but not the dereferencing of the pointers, since this is done implicitly compared to in C where you always know.
downvote count: 0
tagged with: pass-by-reference
has comment: http://stackoverflow.com/comment/41669262
type: Question
has comment: http://stackoverflow.com/comment/41610878
tagged with: java

http://stackoverflow.com/comment/60591404
score: 0
has text: You can check the method count of each dependency used in your project an android studio plugin, please check the answer http://stackoverflow.com/questions/30648172/gradle-library-duplicates-in-dependencies/36056607#36056607
comment on: http://stackoverflow.com/q/26357228
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26383717
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26557499
has comment: http://stackoverflow.com/comment/41714668
has answer: http://stackoverflow.com/a/32790533
type: Question
has title: error when compile android_x86 iso image
has body: I download the source code of android (kitkat-x86 branch) and then I compile it with Target product android_x86. make -j2 iso_img TARGET_PRODUCT=android_x86 I follow all instruction indicated at this link but I get this error message Copying: out/target/common/obj/APPS/ContactsProvider_intermediates/classes-jarjar.jar Copying: out/target/common/obj/APPS/SettingsProvider_intermediates/classes-jarjar.jar Copying: out/target/common/obj/APPS/SystemUI_intermediates/classes-jarjar.jar Copying: out/target/common/obj/APPS/TeleService_intermediates/classes-jarjar.jar target Symbolic: sqlite3 (out/target/product/x86/symbols/system/xbin/sqlite3) target Symbolic: binderAddInts (out/target/product/x86/symbols/data/nativebenchmark/binderAddInts) target Dex: telephony-common Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Copying: out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/classes-jarjar.jar Copying: out/target/common/obj/JAVA_LIBRARIES/services_intermediates/classes-jarjar.jar Copying: out/target/common/obj/APPS/BasicSmsReceiver_intermediates/classes-jarjar.jar target Symbolic: libandroidfw (out/target/product/x86/symbols/system/lib/libandroidfw.so) target Symbolic: libEGL (out/target/product/x86/symbols/system/lib/libEGL.so) target Strip: libinput (out/target/product/x86/obj/lib/libinput.so) target Strip: libstagefright_foundation (out/target/product/x86/obj/lib/libstagefright_foundation.so) target Strip: libbcc (out/target/product/x86/obj/lib/libbcc.so) Install: out/target/product/x86/system/lib/libinput.so Install: out/target/product/x86/system/lib/libstagefright_foundation.so Copying: out/target/common/obj/JAVA_LIBRARIES/android-support-v4-ics_intermediates/emma_out/lib/classes-jarjar.jar Copying: out/target/common/obj/APPS/Development_intermediates/emma_out/lib/classes-jarjar.jar target …
answer count: 2
downvote count: 0
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/26468299
score: 7
has comment: http://stackoverflow.com/comment/41574644
has comment: http://stackoverflow.com/comment/41574562
has body: You could do String[] array = x.split("/+");
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41574403
accepted answer of: http://stackoverflow.com/q/26468238
answers question: http://stackoverflow.com/q/26468238
upvote count: 7
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41574395
has comment: http://stackoverflow.com/comment/41574305

http://stackoverflow.com/comment/41634925
type: QuestionComment
has text: That should be your business logic. It should be out of the entity.
comment on: http://stackoverflow.com/q/26501436
score: 1
type: Comment

http://stackoverflow.com/comment/116077879
type: Comment
comment on: http://stackoverflow.com/a/26364729
score: 1
type: AnswerComment
has text: @AndyCribbens whether you have a longer lived wrapper, depends on what the client code does with the wrapper. And if they want to invoke map, flatMap, etc, there is no advantage in trying to deny them this opportunity. All you'd achieve is having them to box the value again, to be able to do what they want.

http://stackoverflow.com/comment/41543859
type: QuestionComment
comment on: http://stackoverflow.com/q/26450786
has text: @MeenalSharma the possible answers are updated every ten seconds according the LogCat
score: 0
type: Comment

http://stackoverflow.com/q/26423259
score: 2
has body: I want to develop a protegé plugin using Netbeans. So, someone suggest for me using Netbeans OSGIs dor that. I haven't yet known how it helps in my work. However, I chose Felix and I am following this link. Unfortunately, I followed it step by step and am blocked at this step However, for me, it doesn't workfor me. Instead, it displays me: Thank you for helping me and advise me if I am at the wrong way.
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41511105
type: Question
has title: Integrating Felix into Netbeans 8.0
tagged with: protege
upvote count: 2
answer count: 1
favorite count: 0
tagged with: netbeans-8
tagged with: apache-felix
tagged with: owl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41500925
has answer: http://stackoverflow.com/a/26742106

http://stackoverflow.com/a/26508293
accepted answer of: http://stackoverflow.com/q/26505936
type: Answer
answers question: http://stackoverflow.com/q/26505936
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41686272
upvote count: 2
has comment: http://stackoverflow.com/comment/41650279
type: AcceptedAnswer
has body: So a simple answer; this code: // Try and get a pre-loaded icon Icon controlIcon = icons.get(controlName); // It wasn't there, try loading it if (controlIcon == null) loadIcon(controlName); became this code: // Try and get a pre-loaded icon Icon controlIcon = icons.get(controlName); // It wasn't there, try loading it if (controlIcon == null) { loadIcon(controlName); controlIcon = icons.get(controlName); } Note that upon checking to see if our Icon variable is null, and then making sure an Icon has been loaded into the program, I now actually make sure that the Icon variable is updated so it is no longer null. The affected Nodes in my tree were not random or fluctuating as I previously thought. It was always the first node to be drawn with each of the icons (different depending on the order I opened up the tree). I am loading each icon once, then caching it (the tree is huge and re-loading the same icon many times was a big performance hit). Essentially the node was created with just text, then had an icon set after being shown, which shunted the text and caused the end to be cut off. As above, the solution was to not forget to set the icon after loading it for the first time. A better solution would be for my icons.get() to be wrapped in such a way as to guarantee an icon was returned and to encapsulate the cache optimisation.

http://stackoverflow.com/q/26488646
score: 0
has answer: http://stackoverflow.com/a/30193143
accepted answer: http://stackoverflow.com/a/30193143
answer count: 1
tagged with: stax
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Write unescaped attribute with XMLStreamWriter
tagged with: java
type: Question
has body: I'm trying to write a custom entity as an attribute value: out.writeAttribute("storeent_id", "&amp;MAR_STOREENT_ID;"); Desired: &lt;dmactivity dmactivity_id="@dmactivity_id_collateral_21003" storeent_id="&amp;MAR_STOREENT_ID;" optcounter="0" /&gt; actual &lt;dmactivity dmactivity_id="@dmactivity_BoysPantsRow2_Content" storeent_id="&amp;amp;MAR_STOREENT_ID;" optcounter="0" /&gt;
tagged with: dtd

http://stackoverflow.com/comment/41425836
type: Comment
has text: ALso, what is the difference among all the Oracle WebLogic server Tools. If I am doing this from STS, it doesn't tell me what STS belongs to. Only the version 3.4.0 release. How will I know which goes with STS among Luna, Juno, Kepler, etc
comment on: http://stackoverflow.com/a/26366498
type: AnswerComment
score: 0

http://stackoverflow.com/q/26452688
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26452715
favorite count: 0
has comment: http://stackoverflow.com/comment/41546415
possible better answer: http://stackoverflow.com/a/26452715
has answer: http://stackoverflow.com/a/26452844
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: stringtokenizer
type: Question
has title: How shoud I sort a phrase using compareTo in Java
tagged with: compareto
has answer: http://stackoverflow.com/a/26452756
accepted answer: http://stackoverflow.com/a/26452756
tagged with: sorting
has body: Hello I need to make a program that splits a phrase and afther that it sort it in alphabetical order. My teacher suggest that we shoud use StringTokenizer for the split and comapreTo for the sort. So far I have splited it and now I am struggling with the sorting part. public static void main(String[] args) { StringTokenizer st = new StringTokenizer("Afara este soare si frumos"); while (st.hasMoreTokens()) { System.out.println(st.nextToken()); } It results: "1Afara 2este 3soare 4si 5frumos" and afther the sorting part shoud be: "1Afara 2este 3frumos 4si 5soara" Any advice woud be good! Thanks in advance!

http://stackoverflow.com/a/26482877
has body: Websphere 7 is a Java-ee 5 application server and provides so both ejb and servlet container. It's so indeed possible to deploy a war. If your web-application (war) is part of your Java-ee application (ear) you have to package it inside the ear, otherwise you can deploy it alone. See packaging application
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26481527

http://stackoverflow.com/comment/41549652
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26454411
type: Comment
has text: You don't need the `{1}` to match exactly one character. That is what will happen with no quantifier at all. Just use `[a-z]`.

http://stackoverflow.com/q/26504670
tagged with: avro
downvote count: 0
answer count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/50401244
has comment: http://stackoverflow.com/comment/65782548
has body: I want to read avro events being sent through flume and update a user cache . Is there a java client already present to read avro events from a port and host? And what is the fail-safe way of doing so? I mean how is that java code supposed to handle a failure either in Flume or what if the tcp queue becomes full?
upvote count: 1
has title: How can we read avro events sent from flume?
tagged with: flume
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/a/27276857
answers question: http://stackoverflow.com/q/26363571
score: 0
type: Answer
has body: First, you shouldn't modify any .aj because Spring Roo will overwrite your changes next time you run it. To customize your field you have to move its declaration into related .java file (we call it push-in). To set the field validation, Roo uses the JSR-303 specification, using the Hibernate validation as implementation. So, to archive it, try: Push-in the phone declaration into User.java and add javax.validation.constraints.Size annotation: public class User { @Column(name = "phone", length = 10, unique = true) @NotNull @Size(max=10,min=10) private String phone; } Run Spring Roo console. After that, Roo will: remove phone definition from User_Roo_DbManaged.aj create the getter and setter on User_Roo_bean.aj Update User related .jspx Note that @Column definition refers to database declaration. Any other field validation you should use the javax.validation.constraints.* annotations or create yours (here you have an example) Good luck!

http://stackoverflow.com/a/26415311
has body: This line: while(correct == false); needs to lose the semicolon at the end. As it stands now, it's an infinite empty loop and your program won't proceed past that statement.
type: Answer
has comment: http://stackoverflow.com/comment/41478264
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26415271
answers question: http://stackoverflow.com/q/26415271
upvote count: 2
has comment: http://stackoverflow.com/comment/41478273
type: AcceptedAnswer

http://stackoverflow.com/comment/41421209
type: AnswerComment
type: Comment
has text: Sorry, edited the comment. By creating object for SampleDaoImple, I can directly mock the getJdbcTemplate(), as it is extending JdbcDaoSupport class
comment on: http://stackoverflow.com/a/26383216
score: 0

http://stackoverflow.com/comment/41640153
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26502192
has text: How I can inspect the network traffic? so for 1) I'm setting that: http://developer.android.com/reference/android/widget/VideoView.html#setVideoURI%28android.net.Uri,%20java.util.Map%3Cjava.lang.String,%20java.lang.String%3E%29 and for 2) I more sure it's correctly formated because i did the function by myself but the name of the cookie is good on the API, just the value is wrong.
score: 0

http://stackoverflow.com/a/26484428
answers question: http://stackoverflow.com/q/26483178
has body: What looks to be your problem is that container is locally scoped in the init method. So you can't access it (not without some component searching of the frame) to add other components to (which is what you want to do). You are probably trying to add other components to the frame, thinking that this will add them to container. Once you add another component to the frame by just doing add(secondPanel). What this basically does (with the frame BorderLayout) is add(secondPanel, BorderLayout.CENTER), implicitly. But you have already done add(container), which is the same as add(container, BorderLayout.CENTER), and each position can only have one component. So the conatiner is kicked out, leaving only the secondPanel So a simple fix would just be to take the container declaration out of the init method, and add components to the container Also keep in mind that JPanels are opaque by default, so adding a JPanel to container will cause the JPanels background to cover up the container background. So if you want to and a JPanel to the container, make sure to setOpaque(false) on the JPanel.
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/41492988
comment on: http://stackoverflow.com/q/26414295
score: 0
type: Comment
type: QuestionComment
has text: @Malvolio, thank you for reminding me that I can debug JavaScript - still new at this. I debugged it in firebug and request.responseText is showing a value of "". So I think somehow the Servlet is not sending the response properly. Still investigating.

http://stackoverflow.com/comment/41593384
comment on: http://stackoverflow.com/q/26478170
type: QuestionComment
type: Comment
has text: `main` is in class MergeSortNonRecursive. Not only is this not a public class, but it's not the first class, and likely your .java file is not called MergeSortNonRecursive.java. What `java` command have you been using to try to execute the class??
score: 0

http://stackoverflow.com/q/26381602
upvote count: 1
has comment: http://stackoverflow.com/comment/41417875
favorite count: 0
downvote count: 0
has title: Combine hibernate.xml and spring-dispatcher.xml
type: UnansweredQuestion
tagged with: spring
has body: I am new in the concept of spring and hibernate. I learnt hibernate and spring both separate. Now i have made project which uses both spring and hibernate. I have kept them separate and my project is working fine. But requirement is to merge both configuration. i am trying to do this but it seems very difficult because if i change little whole project is not working. my hibernate.cfg.xml is kept inside src folder and it is: <?xml version="1.0"?> <hibernate-configuration> org.postgresql.Driver jdbc:postgresql://localhost:5432/hibernatedb postgres root 1 org.hibernate.dialect.PostgreSQLDialect org.hibernate.cache.NoCacheProvider true update <mapping class="com.csc.StudentAdmission.Student" /> </hibernate-configuration> my spring-dispatcher-servlet.xml is kept inside WEB-INF folder, it is <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <context:component-scan base-package="com.csc.StudentAdmission" /> <mvc:annotation-driven/> /WEB-INF/ .jsp </beans> and finaly my web.xml is: <?xml version="1.0" encoding="UTF-8"?> SpringMVC spring-dispatcher org.springframework.web.servlet.DispatcherServlet spring-dispatcher / please help me in this concept.
tagged with: spring-mvc
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/41418605
type: Question
has comment: http://stackoverflow.com/comment/41417948
has answer: http://stackoverflow.com/a/26382620
has comment: http://stackoverflow.com/comment/41419069
answer count: 1

http://stackoverflow.com/comment/41403234
type: AnswerComment
comment on: http://stackoverflow.com/a/26373268
type: Comment
score: 0
has text: Wait a minute, what are you scanning, dates or dateFiles? I think the problem might come from there. Try changin String datesLine = dates.nextLine(); to String datesLine = dateFiles.nextLine();

http://stackoverflow.com/q/26427531
has body: I've been searching through this website for numerous hours now on how to get my button to an a row to an already existing table, this table created by simply clicking the swing Controls, and adding a table and altering the fields through the properties. The table's variable name is 'table'. And when confronted with this line of code: table.getModel().insertRow(table.getRowCount(),new Object[]{nome[i],data[i]}); The 'insertRow' part is redded and I can't seem to fix it. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String direcdate=direc1.getText(); File folder = new File(direcdate); File[] listOfFiles=folder.listFiles(); String[] nome = new String[250]; String[] data = new String[250]; int i=0; for (File listOfFile : listOfFiles) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); if (listOfFile.isFile()) { nome[i]= listOfFile.getName (); data[i] =sdf.format(listOfFile.lastModified()); i++; } else if (listOfFile.isDirectory()) { nome[i]= "Folder: " + listOfFile.getName (); data[i] =sdf.format(listOfFile.lastModified()); i++; } } for(int increm=0;increm&lt;i;increm++) { table.getModel().insertRow(table.getRowCount(),new Object[]{nome[i],data[i]}); } } Any ideas or suggestions? EDIT: where the table model is located: public class GAPAC_TESTE extends javax.swing.JFrame { public GAPAC_TESTE() { initComponents(); ultimaalt.setText("0"); jTextPane2.setText("Após escolher a diretoria, escolha uma das opções."); DefaultTableModel model = new javax.swing.table.DefaultTableModel(); table = new javax.swing.JTable(model); }
favorite count: 0
has title: Can't add a row to a jTable even when using getModel
possible better answer: http://stackoverflow.com/a/26427624
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26427624
type: Question
tagged with: defaulttablemodel
accepted answer: http://stackoverflow.com/a/26427865
tagged with: jtable
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26427865

http://stackoverflow.com/q/26509881
has answer: http://stackoverflow.com/a/26522541
tagged with: google-app-engine
has title: How can I customize the default html file returned on custom http error codes
type: UnansweredQuestion
score: 0
has body: In my app I would like to return error codes and set the error message on the server. This is what I use: response.setStatus(530); response.sendError(530, e.getMessage()); When I return a custom error like that, app engine always sends the error codes and status wrapped in a default html template. In javascript: $(document).ajaxError(function (event, request, settings) { // request.statusText is always "Internal Server Error" // and not my custom status message // request.responseText is an html string }); by the way, in the development server it's different. statusText is my custom error text
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/q/26454532
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41549905
score: 1
tagged with: java
has title: prevent users for using certain characters in a calculator
type: Question
has body: i'm making a calculator and i want to throw a window with a message saying that only numbers are accepted in case that the user types a character which isn't a number in the textField, so this is what i did and didn't work at all. Thanks for reading. private void txtPantallaActionPerformed(java.awt.event.ActionEvent evt) { String invalids; invalids = "|@#¢∞¬÷“”≠´‚πø ¥†®€æœå∫∂ƒ™¶§ ~–…„µ ß√©∑Ωqwertyuiopñlkjhgfdsazxcvbnm!$%&amp;/=?¿*^QWERTYUIOPÑLKJHGFDSAZXCVBNM"; for (int i = 0 ; i &lt; invalids.length() ; i++) { if(txtPantalla.getText().equals (invalids.substring(i, i+1))) { JOptionPane.showMessageDialog(null,"Only works with numbers"); } } }
has answer: http://stackoverflow.com/a/26454633
downvote count: 0
tagged with: user-interface
answer count: 1
tagged with: calculator
accepted answer: http://stackoverflow.com/a/26454633
favorite count: 0
upvote count: 1

dockpanel
tag name: dockpanel
type: Tag
tags question: http://stackoverflow.com/q/26414158

http://stackoverflow.com/a/26455078
score: 0
answers question: http://stackoverflow.com/q/26455051
type: Answer
has body: You are trying to call undeclared function randInt. It means you must first write this function in your class and then use it. However you may use java.util.Random: Random rand = new Random(); switch(rand.nextInt() % 10) ...

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/26426144
tag name: dayofweek
tags question: http://stackoverflow.com/q/26451569

http://stackoverflow.com/a/26438123
type: Answer
has body: There are many options for authentication as well as authorization. If you want to use simple authentication then 'Basic Auth' of HTTP. Check out https://www.rfc-editor.org/rfc/rfc2617 for details. Remember that this is unsafe because the username/password flows on wire. Anyone can sniff username/password. This is updated by new RFC7235 - https://www.rfc-editor.org/rfc/rfc7235#section-4 Safer choice is oAuth. Explained in RFC6749 https://www.rfc-editor.org/rfc/rfc6749. In this case an access token goes with each request. In both the cases the credential details travel with headers. No interference with parameters.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26437834
answers question: http://stackoverflow.com/q/26437834
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41576576
has text: Seems to be a bug in weblogic https://jira.spring.io/browse/SEC-2465 how did you get around the problem, when I add implements WebApplicationInitializer to the AbstractSecurityWebApplicationInitializer class I end up with the error ServletContext must not be null
comment on: http://stackoverflow.com/q/26370409
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26416881
score: 11
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: orm
has answer: http://stackoverflow.com/a/26417545
type: Question
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
has title: Hibernate mapping exception - Could not determine type for:
accepted answer: http://stackoverflow.com/a/26417545
tagged with: hibernate-mapping
upvote count: 11
has body: Im trying to configure my entities but hibernate throws the following exception: org.hibernate.MappingException: Could not determine type for: com.sd.entity.SDUserProductAcess, at table: SDUser, for columns: [org.hibernate.mapping.Column(productAccess)] [PersistEngine] Failed to initialize persistence engine!java.lang.NullPointerException These are my Entities: @Entity @Inheritance(strategy = InheritanceType.JOINED) public class SDObject { @Id @GeneratedValue private long sdId; private String sdType; public long getSdId() { return sdId; } public void setSdId(long sdId) { this.sdId = sdId; } public String getSdType() { return sdType; } public void setSdType(String sdType) { this.sdType = sdType; } } The next one: @Entity public class SDUser extends SDObject { @Column(unique = true) private String code; private String password; private SDUserProductAcess productAccess; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) public SDUserProductAcess getProductAccess() { return productAccess; } public void setProductAccess(SDUserProductAcess productAccess) { this.productAccess = productAccess; } The last one: @Entity public class SDUserProductAcess extends SDObject { private boolean adm; public boolean isAdm() { return adm; } public void setAdm(boolean adm) { this.adm = adm; } } Hibernate can't determine the type for column productAccess, located in SDUser entity. I'm new to Hibernate and I can't figure out what is happening. Should I provide some kind of ID? Thanks!!

http://stackoverflow.com/comment/41551192
has text: Posting the offending code snippets or generating some log files during code execution might be helpful.
comment on: http://stackoverflow.com/q/26455186
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26429998
has comment: http://stackoverflow.com/comment/51770086
downvote count: 0
has body: Stopping a thread is not a trivial task. The short answer to how to stop a thread is: do not stop a thread from within another thread; instead, ask the thread to stop itself. The reason for this is that a thread has to stop in a safe place. If the thread which is stopped holds a mutex, for example, a deadlock may occur if another thread also requires this mutex. First, probably it is better that you do not use the main method for polling the keyboard. Just create another thread to do this; this makes it easier to make a new thread doing the same thing later. Second, what you have to do is pass a reference to the main thread's Thread object to your RemindTask thread. Java offers a method Thread.stop() to stop a thread, but it has been deprecated for the reason I gave above. Instead, you have to ask the main thread to stop. Java offers a standard way of doing this. You call Thread.interrupt() on the Thread instance of the main thread. Then, in the main thread you regularly call the static method Thread.interrupted(). If it returns true, this means that some other thread has asked the current thread to terminate, and you can cleanly stop by returning from the run() method.
has comment: http://stackoverflow.com/comment/51769011
has comment: http://stackoverflow.com/comment/51765164
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26429616
has comment: http://stackoverflow.com/comment/41505874
answers question: http://stackoverflow.com/q/26429616
type: Answer

http://stackoverflow.com/comment/68576547
type: Comment
comment on: http://stackoverflow.com/a/26452450
score: 1
type: AnswerComment
has text: @Dhiraj could you share how you did that? I don't see how I can configure introspection on the MustacheFactory.

http://stackoverflow.com/a/26427727
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26427622
has body: The stack is storing Objects rather than Integers. You have to explicitly cast them to Strings. The compiler can't tell that they're Strings without you telling it, so it assumes you're trying to valueOf an Object, which is a superclass of String. int a = Integer.valueOf((String)stack.pop()); int b = Integer.valueOf((String)stack.pop()); Alternatively, you can mention the type you intend to store in your declaration for the stack. Stack&lt;String&gt; stack = new Stack&lt;String&gt;(); //Java 6 or Stack&lt;String&gt; stack = new Stack&lt;&gt;(); //Java 7+ For additional reading on inheritance and casting, you can check out this tutorial.
accepted answer of: http://stackoverflow.com/q/26427622
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41442708
comment on: http://stackoverflow.com/q/26395403
type: QuestionComment
type: Comment
has text: and please improve your variable names.. And they should be locals to the function, not globals
score: 0

http://stackoverflow.com/q/26425510
has comment: http://stackoverflow.com/comment/41496115
has title: Accessing Classes from another class
tagged with: java
has comment: http://stackoverflow.com/comment/41496155
has comment: http://stackoverflow.com/comment/41495947
type: Question
has comment: http://stackoverflow.com/comment/41496417
linked to: http://stackoverflow.com/q/4357250
has comment: http://stackoverflow.com/comment/41496097
tagged with: class
score: 0
answer count: 1
tagged with: jvm
has comment: http://stackoverflow.com/comment/41496272
has comment: http://stackoverflow.com/comment/41496189
has comment: http://stackoverflow.com/comment/41496210
has answer: http://stackoverflow.com/a/26425764
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41496824
has body: Assuming I am not using any IDE to build/run my Java codes. But using notepad and command prompt to do the compilation and running. Can I safely assume that: as long as I place my class files within the same folder, they will always be able to "see" each other even without stating the package? I came from another link with similar question title: Accessing other class files in Java but it is asking a different thing and the replies given are in context of having a IDE, and using IDE to change CLASSPATH. What I intends to find out here is the behaviour of JVM without an IDE. QUE: Can I safely assume classes can ALWAYS "see" each other by just placing them in the same folder?

http://stackoverflow.com/q/26379569
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/41414238
has answer: http://stackoverflow.com/a/26379689
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41414330
score: 0
has comment: http://stackoverflow.com/comment/41414988
has body: i want to get a connection variable conn to connect to the database.i want to retrieve an attribute which is previously set in ServletContext and typecast to specific object.i can do this in servlet but problem is arising in jsp page.how to cast application object when using scriptlet to get application object without using JSTL.please help me to solve the issue. i think error is [from server log] :MyDatabase cannot be resolved to a type. code in jsp page: MyDatabase mydata=(MyDatabase)getServletContext().getAttribute("Database"); Connection conn=mydata.getCon();
type: Question
accepted answer: http://stackoverflow.com/a/26379689
tagged with: java
has title: retrieving ServletContext and casting to specific object in jsp
tagged with: servlets

http://stackoverflow.com/q/26457074
has answer: http://stackoverflow.com/a/26457208
score: 0
tagged with: android
has body: I am trying to view the map and get an error. I do like in the tutorials, but I still get the same error. the main class of my application mainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } view based on the fragment activity_main.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.MapFragment"/&gt; and my manifest &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-permission android:name="com.example.test.permission.MAPS_RECEIVE" /&gt; &lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="16" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;!-- Required to show current location --&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;!-- Required OpenGL ES 2.0. for Maps V2 --&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.int…
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/26457208
type: Question
has title: Error inflating class fragment in Eclipse Android
tagged with: google-maps
answer count: 1

http://stackoverflow.com/comment/41400458
type: QuestionComment
comment on: http://stackoverflow.com/q/26371678
has text: Elliott, good point, I am making this too complicated, I can just read an array of Strings and then parse later. THANKS!!!! and thanks to all, very helpful introducing me to raw types. Awesome stuff!
score: 0
type: Comment

http://stackoverflow.com/q/26416888
score: 4
upvote count: 4
answer count: 3
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/26417351
has comment: http://stackoverflow.com/comment/41481045
has body: How can I cast Class&lt;? extends Enum&lt;?&gt;&gt; to Class&lt;T&gt;, where &lt;T extends Enum&lt;T&gt;&gt;? Specifically I need to pass an instance of Class&lt;? extends Enum&lt;?&gt;&gt; to the Enum.valueOf() method. http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html#valueOf(java.lang.Class,%20java.lang.String) Here are the classes I have: enum Foo1 implements Bar { VALUE1("A"), VALUE2("B"); String me; Foo1(String me) { this.me = me; } String getMe() {return me;} } enum Foo2 implements Bar { V1("A"), V2("B"); String me; Foo2(String me) { this.me = me; } String getMe() {return me;} } interface Bar { String getMe(); } enum Z { Z1(Foo1.class), Z2(Foo2.class); private final Class&lt;? extends Enum&lt;? extends Bar&gt;&gt; myEnum; Z(Class&lt;? extends Enum&lt;? extends Bar&gt;&gt; myEnum) { this.myEnum = myEnum; } Class&lt;? extends Enum&lt;? extends Bar&gt;&gt; getMyEnum() { return myEnum; } } class X { public getMe(Z z, String fooValue) { Class&lt;? extends Enum&lt;? extends Bar&gt;&gt; fooEnum = z.getMyEnum(); // does not compile return ((Bar)Enum.valueOf(fooEnum, fooValue)).getMe(); } }
possible better answer: http://stackoverflow.com/a/26417250
has answer: http://stackoverflow.com/a/26417611
accepted answer: http://stackoverflow.com/a/26417611
type: AnsweredQuestion
has title: Properly cast generics
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26417250

http://stackoverflow.com/comment/41374422
has text: But as per the client requirement that doen using JTDS api not the Micrs=osoft driver so need solution in JTDS api. Although it work fine MSSQL server 2008 but does not work in MSSQL server 2012.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26357192

http://stackoverflow.com/a/32590218
score: 1
answers question: http://stackoverflow.com/q/26453160
type: Answer
has body: When dealing with pom dependencies I use a WebArchive instead of a JavaArchive for wrapping all the required code generated by ShrinkWrap: String[] mavenLibs = { "junit:junit:4.8.1" }; WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war"); for (String dependency : mavenLibs) { war.addAsLibrary(Maven.resolver().resolve(dependency).withTransitivity().asSingle(JavaArchive.class)); } Using this mecanism I didn't have the issue you described.
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/42042378
type: Comment
has text: Yes, that's right. One-Jar project writes a JarClassLoader for this scenario.
type: AnswerComment
comment on: http://stackoverflow.com/a/26511786
score: 0

http://stackoverflow.com/a/26499218
type: Answer
has body: While the other two answers are technically correct here is slightly more detail. In your eclipse.ini file (which should be in the same directory as where you installed eclipse) add the lines -vm C:/path/to/java/jdk1.8.0_20\jre\bin\javaw.exe Then save and reopen eclipse
accepted answer of: http://stackoverflow.com/q/26492178
has comment: http://stackoverflow.com/comment/64953751
answers question: http://stackoverflow.com/q/26492178
upvote count: 7
score: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26359200
tagged with: methods
has answer: http://stackoverflow.com/a/26359314
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
type: Question
has body: I expect following Unit Test to fail with ClassCastException, but its passing. The class has a generic method whose second parameter and return value are of type V. On calling the method second time, with type of second parameter V as Integer, the return type should be Integer. But at runtime it actually returns String value. import java.util.HashMap; import java.util.Map; import org.junit.Test; public class GenericMethodTest { private class NonGenericClass { private final Map&lt;Object, Object&gt; myMap = new HashMap&lt;&gt;(); &lt;K, V&gt; V addGeneric(K key, V value) { V existingV = (V) myMap.get(key); // why no ClassCastException on this above line, when type of V is Integer, but myMap.get(key) returns value of // type String? if (existingV == null) { myMap.put(key, value); return value; } return existingV; } } @Test public void test() { NonGenericClass nonGenericClass = new NonGenericClass(); nonGenericClass.addGeneric("One", "One"); // String valueString = (String) nonGenericClass.addGeneric("One", Integer.valueOf(1)); // Compiler error as expected, if above line uncommented - Cannot cast from Integer to String. // But no error at run-time, and below call returns value of type String. nonGenericClass.addGeneric("One", Integer.valueOf(1)); } }
tagged with: generics
upvote count: 1
answer count: 1
tagged with: java
has title: How and when the type gets resolved for generic methods in java?

http://stackoverflow.com/a/32171417
downvote count: 0
answers question: http://stackoverflow.com/q/26494197
score: 1
has body: Just Use Iterator class to remove the Iterating Element as for (Iterator&lt;Map.Entry&lt;String, Integer&gt; it = map.entrySet().iterator(); while(it.hasNext()) { Map.Entry&lt;String, Integer&gt; e= itr.next(); key = e.getKey(); Value = e.getValue(); //Your Other Code Here it.remove(); //It removes the current Itertaion from Map }
upvote count: 1
type: Answer

http://stackoverflow.com/a/79190696
upvote count: 2
answers question: http://stackoverflow.com/q/26460299
type: Answer
downvote count: 0
has body: Unfortunately, the accepted answer has missed a crucial thing, Locale while parsing the date-time string. Therefore, that code will work merely by coincidence - only when the JVM on which it is executed, has an English Locale set. Check Always specify a Locale with a date-time formatter for custom formats to learn more about it. java.time In March 2014, Java 8 introduced the modern, java.time date-time API which supplanted the error-prone legacy java.util date-time API. Any new code should use the java.time API. Solution using modern date-time API Your date-time string has a time zone offset. So, parse your date-time string into an OffsetDateTime using DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss OOOO uuuu", Locale.ENGLISH) and format it using DateTimeFormatter.ofPattern("dd-MM-uuuu", Locale.ENGLISH). Demo: public class Main { private static final DateTimeFormatter parser = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss OOOO uuuu", Locale.ENGLISH); private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-uuuu", Locale.ENGLISH); public static void main(String[] args) { OffsetDateTime odt = OffsetDateTime.parse("Mon Oct 20 00:00:00 GMT+06:30 2014", parser); System.out.println(odt); // Formatted output System.out.println(odt.format(formatter)); } } Output: 2014-10-20T00:00+06:30 20-10-2014 Online Demo Note: For whatever reason, if you need an instance of java.util.Date from this object of OffsetDateTime, you can do so as follows: java.util.Date date = Date.from(odt.toInstant()); Learn more about the modern date-time API from Trail: Date Time.
score: 2

http://stackoverflow.com/a/26480084
score: 0
answers question: http://stackoverflow.com/q/26479694
type: Answer
has body: I do not know clearly your problem, but before you change page or when you have value, you can use this class: Class SavedDave extends Application(){ private static String data; //Contructor .... public void SetData(String value){ this.data = value; } public String getData(){ return data; } } By this class, you can set and get your value every where when application running, is it solve your problem?

http://stackoverflow.com/comment/41611288
has text: possible duplicate of [Converting Roman Numerals To Decimal](http://stackoverflow.com/questions/9073150/converting-roman-numerals-to-decimal)
comment on: http://stackoverflow.com/q/26488606
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26384664
downvote count: 0
has body: What about this : public class NetworkService extends IntentService { @Override protected void onHandleIntent(Intent intent) { if (intent != null) { ResultReceiver reciever = intent.getParcelableExtra(MyReciever.RESULT_RECEIEVER_EXTRA); } } As CREATOR has not been redefined in MyReciever, it creates ResultReceiver instances. Just receive your ResultReceiver instance from the intent as it is, a ResultReceiver.
has comment: http://stackoverflow.com/comment/41424740
type: Answer
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/124187153
answers question: http://stackoverflow.com/q/26383789
accepted answer of: http://stackoverflow.com/q/26383789
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41424686

executorservice
type: Tag
tags question: http://stackoverflow.com/q/26505170
tags question: http://stackoverflow.com/q/26454267
tag name: executorservice
tags question: http://stackoverflow.com/q/26437881
tags question: http://stackoverflow.com/q/26479432
tags question: http://stackoverflow.com/q/26481425
tags question: http://stackoverflow.com/q/26458660
tags question: http://stackoverflow.com/q/26377063

http://stackoverflow.com/a/26418430
score: 0
has body: The problem is because the script is not able to locate lib>there is one solution here Show local HTML file with JavaScript in SWT Browser widget in RAP . I have just solved this by changing src to Taken this link from W3Schools.com "Try Editor"
answers question: http://stackoverflow.com/q/26417811
type: Answer

http://stackoverflow.com/a/26445458
downvote count: 1
has comment: http://stackoverflow.com/comment/41634384
score: 5
has body: SSL/TLS encryption for your web site is nothing you can do in your web application. It's done via your web server's configuration. See Apache Tomcat 7, SSL Configuration HOW-TO. Additional info (repeated from my comment to the OQ, since comments are not that prominent and editable): You don't have to buy a certificate from one of the certification authorities (CA) to obtain a certificate. StartSSL offers 1-year SSL/TLS + S/MIME for free. On a different domain they offer now: No offer any more: Notice to all StartCom subscribers StartCom CA is closed since Jan. 1st, 2018 that don’t issue any new certificate from StartCom name roots. If you want to buy trusted SSL certificate and code signing certificate, please visit https://store.wotrus.com. If you want to apply free email certificate, please visit https://www.mesince.com to download MeSince APP to get free email certificate automatically and send encrypted email automatically. But there may be other companies meanwhile. You can easily create your own certificates with OpenSSL (thus being your own CA) and associate this certificate with your https:// site. If your visitors accept your certificate in the dialog that pops up in their browser it is stored in their browser's certificate store and the dialog will not appear again until the certificate's expiration date is reached.
accepted answer of: http://stackoverflow.com/q/26437581
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26437581
has comment: http://stackoverflow.com/comment/41534502
type: Answer
has comment: http://stackoverflow.com/comment/41535473
has comment: http://stackoverflow.com/comment/41551027
upvote count: 6
has comment: http://stackoverflow.com/comment/41639483
has comment: http://stackoverflow.com/comment/41739639

http://stackoverflow.com/q/26419755
score: -3
has answer: http://stackoverflow.com/a/26419778
tagged with: java
downvote count: 3
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26419853
has comment: http://stackoverflow.com/comment/41485850
favorite count: 0
has body: I managed to get an error in just 3 lines of code: import java.util.Random; public class Test { private Random rnumber; rnumber = new Random(); private int nmb = rnumber.nextInt(36); } The error is right after rnumber. I don't understand what is wrong. If i change it to: private Random rnumber = new Random(); private int nmb = rnumber.nextInt(36); The error disappears, but when I add println: private Random rnumber = new Random(); private int nmb = rnumber.nextInt(36); System.out.println("" + nmb); Same error comes back, but now right after println.
type: UnansweredQuestion
has title: <identifier expected> when declaring Random

http://stackoverflow.com/q/26377486
accepted answer: http://stackoverflow.com/a/26377561
tagged with: java
has body: My current code is as follows: public Class&lt;?&gt; getColumnClass(int columnIndex) { switch (columnIndex) { case 0: class = Integer.class; break; case 1: class = String.class; break; case 2: class = ArrayList.class; break; } return class; } Now, the problem is that I can not create that class object because Class has no public constructor. So the only alternative I can think of is using a different return sentence in each case, which I've always been told is a no-no. Is there any alternative I'm missing?
type: Question
has comment: http://stackoverflow.com/comment/41410350
answer count: 2
has answer: http://stackoverflow.com/a/26377561
has comment: http://stackoverflow.com/comment/41410516
has comment: http://stackoverflow.com/comment/41428045
tagged with: class
has comment: http://stackoverflow.com/comment/41410518
score: 0
possible better answer: http://stackoverflow.com/a/26377719
has comment: http://stackoverflow.com/comment/41410243
has comment: http://stackoverflow.com/comment/41413804
tagged with: constructor
has comment: http://stackoverflow.com/comment/41410614
has comment: http://stackoverflow.com/comment/41410335
has title: I'm trying to override a method that returns a different Class depending on different circumstances. What is the elegant way to do so?
has comment: http://stackoverflow.com/comment/41410655
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26377719
has comment: http://stackoverflow.com/comment/41410307
has comment: http://stackoverflow.com/comment/41432585

http://stackoverflow.com/comment/41587489
has text: It's probably because you need to associate the jar type with Java.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26473415
type: AnswerComment

http://stackoverflow.com/comment/41456725
type: QuestionComment
has text: yeah self executable
score: 0
comment on: http://stackoverflow.com/q/26403847
type: Comment

http://stackoverflow.com/a/26512948
has comment: http://stackoverflow.com/comment/61909524
score: 3
has body: The sequence of events is as follows: You create an iterator for the (empty) list. You add elements to the list. You start using the iterator created in step 1. This won't work because step 2 has invalidated the iterator. This is what the exception is telling you. From the Javadoc: The iterators returned by [ArrayList'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. You need to create the iterator just before you start iterating: public class Iteratorr { ... Iterator&lt;String&gt; it = null; void print() { it = list.iterator(); while(it.hasNext()) { String str = it.next(); System.out.println(str); } } (An even better way would be to declare it inside print rather than as a member of the class.) These days the idiomatic way to write such loops is void print() { for (String str : list) { System.out.println(str); } } It has the same effect as using an explicit iterator, but is much easier on the eye.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26512858
upvote count: 3

http://stackoverflow.com/comment/41490377
type: Comment
comment on: http://stackoverflow.com/q/26420500
has text: I don't think that labels have functionality at normal. I can't remove the label tag, otherwise aui takes automatically the name as label, that would be worse. I never created an own tag, how complex is it?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41483520
type: AnswerComment
has text: For the class that retrieves URLs from the DB, will it have 1 method for each url, or a general purpose method that takes a param?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26418263

http://stackoverflow.com/a/26359835
answers question: http://stackoverflow.com/q/26359370
has body: One disadvantage of using AbstractList like that is that you are limiting yourself to using list classes that extend AbstractList. It is quite possible to implement the List interface without having AbstractList as a superclass. A second disadvantage is that this won't compile: List&lt;String&gt; list = new ArrayList&lt;String&gt;(); AbstractList&lt;String&gt; list2 = list; The Java type system won't let you assume that every List&lt;String&gt; is an AbstractList&lt;String&gt;.
type: Answer
score: 0

http://stackoverflow.com/comment/41529620
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26426085
has text: @JBNizet The questions are legit nonetheless: Why is the tool raising a warning ? is it legit ? how should I fix it ?

http://stackoverflow.com/comment/41606189
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26484180
has text: Sorry don't get it. I am not using any software.

http://stackoverflow.com/q/26488707
has comment: http://stackoverflow.com/comment/41611459
type: Question
tagged with: dll
has body: Why it seems that is impossible to load a library (.dll) in Java, if it is not located in /jre/bin folder. It's crazy, but I have 2 dll's: aa.dll bb.dll, which depends on aa.dll If I copy these dll's in C:\Tmp the following code it is not working..... If copy these dll'd in C:\Program Files\Java\jre1.8.0_25\bin, the same code it's working. The code, very simple: public class Main { public static void main(String[] args) { System.load("C:\\Tmp\\ftd2xx.dll"); System.out.println("ftd2xx.dll loaded"); System.load("C:\\Tmp\\JD2XX.dll"); } } The error (result): ftd2xx.dll loaded Exception in thread "main" java.lang.UnsatisfiedLinkError: no jd2xx in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at jd2xx.JD2XX.&lt;clinit&gt;(JD2XX.java:729) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at Main_02.main(Main_02.java:7) To be more confusing, one library I can load from c:\Tmp (aa.dll), the other one I cannot (bb.dll). This last one requires to reside in C:\Program Files\Java\jre1.8.0_25\bin. If somebody has any useful idea, I will appreciate very much. I tought the JVM does not want to load possible dangerous, or untrusted native code? And if it resides in the jre folder it consider the code is safe? But it is jus an ideea. Thank you.
score: 0
tagged with: windows
answer count: 1
has comment: http://stackoverflow.com/comment/41611826
has answer: http://stackoverflow.com/a/39395814
tagged with: jvm
has comment: http://stackoverflow.com/comment/41611425
type: UnansweredQuestion
has title: java cannot load dll outside jre
has comment: http://stackoverflow.com/comment/41611661
tagged with: java
has comment: http://stackoverflow.com/comment/41613072

http://stackoverflow.com/comment/41606927
score: 0
type: Comment
has text: thanks, simply using get(i) to have a JsonValue to loop over seems to be the way to go
comment on: http://stackoverflow.com/a/26485275
type: AnswerComment

http://stackoverflow.com/a/26417379
downvote count: 0
answers question: http://stackoverflow.com/q/26358380
type: Answer
upvote count: 1
has body: Well, as you said, there are two options, if you care about readability and need to print doubles then: Method 1: (readable) #include &lt;limits&gt; void double_to_string(double the_double, int offset_to_max) { typedef std::numeric_limits&lt;double&gt; doublelimit; // ready to transfer std::cout.precision(doublelimit::digits10 + offset_to_max); std::cout &lt;&lt; the_double &lt;&lt; std::endl; } // Back to double double cstring_to_double(const char *s) { return std::atof(s); } int main(int argc, char *argv[]) { double the_double = 0.10000000000000002; //double the_double = 0.1; int offset = 2; double_to_string(the_double, offset); } This way, doubles printed will have aliasing using full precision (17). I recomend using 17 since the default will always try to round. Either way, a full correct print using this method will require a more powerful library. Method 2: (binary) Just memcpy the value, using and int64 is fine, double can store 53 bits max: template&lt;typename T, typename H = int64_t&gt; H write_data(T x) { H i; // Can we hold the data? if (sizeof(T) &gt; sizeof(H)) assert(false); // or write some error procesing // Now take the lower size of the two. memcpy(&amp;i, &amp;x, sizeof(H) &gt; sizeof(T) ? sizeof(T) : sizeof(H)); return i; } // union version template&lt;typename T, typename H = int64_t&gt; H write_data_u(T x) { // Can we hold the data? if (sizeof(T) &gt; sizeof(H)) assert(false); // or write some error procesing union { T d; H i; } n; n.d = x; return n.i; } int main(int argc, char *argv[]) { double the_double = 0.10000000000000001; int64_t double_holder = write_data&lt;double, int64_t&gt;(the_double); // Binary data as decimal string: ready to transfer the string, remember to convert to big_endian first if you transfer the binary representation. std::cout &lt;&lt; "double_as_int64:" &lt;&lt; double_holder &lt;&lt; std::endl; // Back to double (we know int64_t holds a double so we dont care about the remaining bits) double back_to_double = write_d…
score: 1

http://stackoverflow.com/comment/41556400
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26458160
type: AnswerComment
has text: i guess that is what you want, right? Please correct me if I'm not answering your question

http://stackoverflow.com/comment/41543415
score: 0
comment on: http://stackoverflow.com/a/26450921
type: Comment
has text: i did that and run again and there is another error: FATAL EXCEPTION: main java.lang.IllegalArgumentException: No view found for id 0x7f07003c (com.example.gasper.test:id/pager) for fragment GamesFragment{426229d0 #1 id=0x7f07003c android:switcher:2131165244:1}
type: AnswerComment

http://stackoverflow.com/comment/41594784
has text: Based on my research, I have to use imageIO for the BufferedImage. Is there any other way that I won't be able to use ImageIO for this?
comment on: http://stackoverflow.com/a/26461614
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26429178
accepted answer: http://stackoverflow.com/a/26429267
has title: Java Runtime exec method throwing error when using with a custom URI
type: AnsweredQuestion
upvote count: 2
tagged with: runtime.exec
tagged with: java
type: Question
tagged with: custom-url
has body: I am running this command using my command prompt and it is running fine: without any issues: start demo:" -ping -ip 172.18.102.65" In the above command, demo: is a custom uri which I created and I am passing the parameters to that custom uri which are -ping, -ip and &lt;an_ip_address&gt; to make this custom uri work. But when I run the same command using this code then it is not working: Runtime.getRuntime().exec(new String[] {"cmd.exe", "/c", "start", "demo:\" -ping -ip 172.18.102.65\""}); I am getting an error message: Windows Cannot find '-ping' Please suggest how to make this work.
score: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26429267
favorite count: 0
tagged with: windows

runnable
tags question: http://stackoverflow.com/q/26476679
type: Tag
tags question: http://stackoverflow.com/q/26358394
tags question: http://stackoverflow.com/q/26450712
tag name: runnable
tags question: http://stackoverflow.com/q/26453335
tags question: http://stackoverflow.com/q/26409390

http://stackoverflow.com/a/26485825
has comment: http://stackoverflow.com/comment/41605997
has comment: http://stackoverflow.com/comment/41606295
has body: When using Java 8 you can use String#join for this: String liker = String.join(", ", c); or the Stream API: String liker = c.stream().collect(Collectors.joining(", ")); Pre Java 8 you have use e.g. Guava for this or write our own function public static String listToString(final List&lt;String&gt; list) { final StringBuilder result = new StringBuilder(); for (int i = 0; i &lt; list.size() - 1; i++) { result.append(list.get(i)); result.append(", "); } result.append(list.get(list.size() - 1)); return result.toString(); }
type: Answer
answers question: http://stackoverflow.com/q/26485495
score: 0

http://stackoverflow.com/q/26442268
has comment: http://stackoverflow.com/comment/41527770
has comment: http://stackoverflow.com/comment/41527937
has title: program for nothing
has comment: http://stackoverflow.com/comment/41527649
answer count: 1
has body: public class evenVSodd { public static void main(String[] args) { int a; a = 4; if (a/2==0) { System.out.print("its an even number"); } else { System.out.print("its a odd number"); } } } the result is : ----jGRASP exec: java evenVSodd its a odd number ----jGRASP: operation complete.
has comment: http://stackoverflow.com/comment/41527809
favorite count: 0
has comment: http://stackoverflow.com/comment/41527884
has comment: http://stackoverflow.com/comment/41527746
has comment: http://stackoverflow.com/comment/41527818
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/41527805
downvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41527852
has comment: http://stackoverflow.com/comment/41527834
tagged with: java
has comment: http://stackoverflow.com/comment/41527902
type: Question
has answer: http://stackoverflow.com/a/26442487

http://stackoverflow.com/q/26446095
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/33386965
tagged with: swing
type: Question
tagged with: java
tagged with: taskbar
answer count: 1
downvote count: 0
score: 1
has body: i used splash screen (indicated inside manifest file) to show startup progress of my java (swing) application, but when the splash screen is displayed i want also to add task bar icon, because if the splash screen lost focus it become invisible and it's impossible to show it again until the first window is displayed, so with task bar icon it will be possible to show it again to see current loading progress. is it possible to show taskbar icon while splashScreen is visible before jvm starts or while program is loading and splashscreen is visible ? (like when eclipse starts it displays splash screen with task bar while loading application)
tagged with: splash-screen
has title: Display application icon on taskbar while splash screen is visible
favorite count: 0

parsing
tags question: http://stackoverflow.com/q/26488319
tags question: http://stackoverflow.com/q/26506466
tags question: http://stackoverflow.com/q/26366756
tags question: http://stackoverflow.com/q/26415101
tags question: http://stackoverflow.com/q/26411368
tags question: http://stackoverflow.com/q/26450015
tags question: http://stackoverflow.com/q/26364018
tags question: http://stackoverflow.com/q/26445061
tags question: http://stackoverflow.com/q/26491913
tag name: parsing
tags question: http://stackoverflow.com/q/26471928
tags question: http://stackoverflow.com/q/26399155
tags question: http://stackoverflow.com/q/26420910
tags question: http://stackoverflow.com/q/26395098
tags question: http://stackoverflow.com/q/26370017
tags question: http://stackoverflow.com/q/26385798
tags question: http://stackoverflow.com/q/26480990
tags question: http://stackoverflow.com/q/26355650
tags question: http://stackoverflow.com/q/26468348
tags question: http://stackoverflow.com/q/26457604
tags question: http://stackoverflow.com/q/26417069
type: Tag
tags question: http://stackoverflow.com/q/26414261
tags question: http://stackoverflow.com/q/26391485
tags question: http://stackoverflow.com/q/26401463
tags question: http://stackoverflow.com/q/26372038
tags question: http://stackoverflow.com/q/26404233
tags question: http://stackoverflow.com/q/26479493
tags question: http://stackoverflow.com/q/26441749
tags question: http://stackoverflow.com/q/26512178
tags question: http://stackoverflow.com/q/26363159
tags question: http://stackoverflow.com/q/26393594
tags question: http://stackoverflow.com/q/26379653

http://stackoverflow.com/q/26358839
has body: I wrote an own Exception (named MyOwnException) class in Java: package com.stackoverflow.clojure; import java.lang.RuntimeException; public class MyOwnException extends RuntimeException { private static final long serialVersionUID = 3020795659981708312L; public MyOwnException(String s) { super("My own exception says: " + s); } } Now I'd like to use MyOwnException within my Clojure code. I tried several things, But I always got Class not found exceptions (.java and .clj are in the same package com.stackoverflow.clojure): (ns com.stackoverflow.clojure.testForOwnExceptions) ;(import '[com.stackoverflow.clojure MyOwnException]) (defn casetest [x] (case x "a" "An a." "b" "A b." ; (-&gt; (clojure.core/format "Expression '%s' not defined." x)(MyOwnException.)(throw)) ; (-&gt; (clojure.core/format "Expression '%s' not defined." x)(com.stackoverflow.clojure.MyOwnException.)(throw)) (-&gt; (clojure.core/format "Expression '%s' not defined." x)(IllegalArgumentException.)(throw)) )) ;(prn(casetest "error")) Besides that: how would a solution purely in Clojure look like? (definition of Exception class + usage) Update (project.clj): (defproject com.stackoverflow.clojure/tests "0.1.0-SNAPSHOT" :description "Tests of Clojure test-framework." :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.6.0"] [instaparse "1.3.4"]] :source-paths ["src/main/clojure"] :java-source-paths ["src/main/java"] :test-paths ["src/test/clojure"] :java-test-paths ["src/test/java"] )
favorite count: 0
tagged with: exception
has title: How to use an own Java-Exception-class within Clojure?
tagged with: clojure
has answer: http://stackoverflow.com/a/26399647
accepted answer: http://stackoverflow.com/a/26399647
has answer: http://stackoverflow.com/a/26359377
score: 2
downvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41400595
tagged with: java
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/26359377
answer count: 2

http://stackoverflow.com/comment/41500003
has text: he said, t1 to t100 need the initial value of x and t1 change the value of x. I think just computethread() change the value x and others not change.
comment on: http://stackoverflow.com/q/26427080
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26389896
accepted answer of: http://stackoverflow.com/q/26389860
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41433340
has body: As you wrote it, getLargest expects the objects passed to it in the List to implement Measurable, but java.awt.Rectangle does not. When you write public static &lt;T extends Measurable&lt;T&gt;&gt; T getLargest(ArrayList&lt;T&gt; objects){ that declares a T that is different, but named the same, as the T in the Measurable class as a whole, which is likely to lead to total confusion. If you actually replace T with Rectangle in your code, you can see that you're trying to call Rectangle.getMeasure(), which is a method that does not exist.
answers question: http://stackoverflow.com/q/26389860
has comment: http://stackoverflow.com/comment/41433548
type: AcceptedAnswer

http://stackoverflow.com/comment/41541175
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26449788
has text: You should get the same SharedPreference with 'getDefaultSharedPreferences'. Can you try to use the way I suggested and see if it works? It should work unless I'm misreading your question somehow
score: 0

http://stackoverflow.com/q/26392340
tagged with: multipartentity
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26393688
has answer: http://stackoverflow.com/a/26393688
score: 0
answer count: 2
tagged with: file-upload
tagged with: android
has body: Problem: Trying to upload bigger than ~ 50 mb files, $_FILES return empty array. I try change limits on php (a lot of combination) but it useleass.. my class at java: public void upload() throws Exception { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(this.url); try { FileBody bin = new FileBody(this.file); @SuppressWarnings("deprecation") MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); reqEntity.addPart("file", bin); httppost.setEntity(reqEntity); System.out.println("Requesting : " + httppost.getRequestLine()); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); String responseBody = httpclient.execute(httppost, responseHandler); System.out.println("responseBody : " + responseBody); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { httpclient.getConnectionManager().shutdown(); } } my php code to print array for respawn: &lt;?php ini_set('file_uploads', 1); ini_set('max_file_uploads', '9999999999M'); ini_set('post_max_size', '2000M'); ini_set('max_input_time', 3600); ini_set('max_execution_time', 3600); print_r($_FILES); ?&gt;
tagged with: php
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26392760
accepted answer: http://stackoverflow.com/a/26392760
has title: Android JAVA $_FILE returms empty at files bigger than ~ 50 mb

http://stackoverflow.com/comment/41539283
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26448813
has text: Use an appropriate data representation (i.e. custom class), a `List` and a `Comparator` which works on the desired fields (with `Collections#sort`).

http://stackoverflow.com/q/26408160
answer count: 2
has answer: http://stackoverflow.com/a/26408386
accepted answer: http://stackoverflow.com/a/26408386
possible better answer: http://stackoverflow.com/a/26408498
has body: I am trying to convert an Object Object jObj; parser.parse(response); jObj = parser.parse(response); where response is {"as":false,"autoToggleOff":false,"autoToggleSeconds":0,"cs":false,"deviceId":"e4e4217f-eef2-4cd8-9a87-21264ddff836","deviceName":"Virtual Switch One","deviceType":1,"displayOrder":0,"et":null,"he":false,"il":false,"isControllerBacked":true,"lastLevelUpdate":"\/Date(1413470244538-0400)\/","level":99,"levelPresets":[],"name":"Virtual Switch One","newLevel":null,"newPowerState":null,"newPowerTimerSeconds":null,"nextEventPowerLevel":null,"nextEventPowerOn":null,"nextEventTime":null,"nodeId":0,"pd":true,"providerDeviceId":"141009173344","pushUpdates":false,"roomId":null,"shortId":2,"sr":null,"st":null,"visible":true} to a JSONObject from the Object JSONObject jsonObject; jsonObject = (JSONObject) jObj; I get 10-16 11:09:04.962: W/dalvikvm(14259): threadid=12: thread exiting with uncaught exception (group=0x41d21d40) The code is surrounded with a try / catch } catch (JSONException e) { e.printStackTrace(); } catch (ParseException e){ e.printStackTrace(); } Is there an Exception I should be trying to catch? The code was working fine a few hours ago so I'm really stumped as to what has changed... Thanks!
linked to: http://stackoverflow.com/q/20652284
has comment: http://stackoverflow.com/comment/41465012
has comment: http://stackoverflow.com/comment/41465080
tagged with: android
has comment: http://stackoverflow.com/comment/41465036
has title: Exception Converting Object to JSONObject
has comment: http://stackoverflow.com/comment/41465099
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41465227
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26408498
has comment: http://stackoverflow.com/comment/41465014
type: Question
has comment: http://stackoverflow.com/comment/41464952
score: 0

http://stackoverflow.com/q/26499064
tagged with: java
type: AnsweredQuestion
has title: Java Web Application on startup
downvote count: 0
tagged with: init
has body: Is there a way to execute java code, when a Java EE (Java web project) starts up (or receives a first request)? I know that servlets have init() methods, but is there such method for an entire application?
favorite count: 0
has answer: http://stackoverflow.com/a/26499072
type: Question
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/26499072
answer count: 1
tagged with: jakarta-ee

http://stackoverflow.com/a/26511549
upvote count: 1
answers question: http://stackoverflow.com/q/26510904
type: Answer
has comment: http://stackoverflow.com/comment/41656367
downvote count: 0
score: 1
has body: I do think you are breaking some principal concept there. For this type of scenario, having a base abstract class with JsonTypeInfo and JsonSubTypes annotations to describe your sub-object would probably be preferred. If you absolutely need the ability to set the three types via setDummy(...), would this work for you? Replace: public void setDummy(final FooType dummy) { this.dummyField = dummy; } public void setDummy(final BarType dummy) { this.dummyField = dummy; } public void setDummy(final String dummy) { this.dummyField = dummy; } With: @JsonDeserialize( using = DummyDeserializer.class ) public void setDummy(final Object dummy) { // If you really need to restrict to the three types, throw exception here if (! (dummy instanceof FooType || dummy instanceof BarType || dummy instanceof String) ) { throw new Exception("Cannot setDummy dummy!"); } this.dummyField = dummy; } This would require you to do the deserialization manually for all three classes in your DummyBuilder, but should solve your multi-setters problem. I've not tried to implement this, but think it works.

http://stackoverflow.com/a/26450245
answers question: http://stackoverflow.com/q/26450113
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41542023
downvote count: 0
has body: your class Students should implement Serialiazble
has comment: http://stackoverflow.com/comment/41542217
type: Answer

http://stackoverflow.com/comment/41608702
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26486685
has text: i have used the method but in jsp page its showing error 'HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 17 in the jsp file: /Findresult.jsp ResultSet cannot be resolved to a type 14: 15: 16: H World! 17: <% ResultSet rs = (ResultSet)session.getAttribute("myResultSet");%> 18: 19:
score: 0

http://stackoverflow.com/comment/41423567
type: AnswerComment
type: Comment
has text: Ive already seen this one but I didnt know there were that many styling options yet :) thx
comment on: http://stackoverflow.com/a/26384497
score: 0

http://stackoverflow.com/q/26438781
score: -1
has body: How can I identify programmatically whether the data connection used by the android phone is 2.75G, 3G or 4G? I am requiring this, for gathering data from multiple users using different data connections for data services.
answer count: 2
tagged with: 3g
upvote count: 0
has title: How can i identify that the data connection used by the android phone is 2.75G, 3G or 4G?
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26438963
tagged with: 4g
has comment: http://stackoverflow.com/comment/45062806
linked to: http://stackoverflow.com/q/9283765
has answer: http://stackoverflow.com/a/26462325
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/41524653
has text: Can I store a bundle in ComplexPreference? The library seems to be only for GSon objects. I could be wrong.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26440595
type: AnswerComment

http://stackoverflow.com/a/26499072
type: Answer
answers question: http://stackoverflow.com/q/26499064
has body: Have a class that implements ServletContextListener and in your web.xml &lt;listener&gt; &lt;listener-class&gt; myPackage.MyServletContextListener &lt;/listener-class&gt; &lt;/listener&gt; see http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContextListener.html and override void contextInitialized(ServletContextEvent sce)
has comment: http://stackoverflow.com/comment/41630693
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
has comment: http://stackoverflow.com/comment/41630712
accepted answer of: http://stackoverflow.com/q/26499064

http://stackoverflow.com/comment/41489098
type: QuestionComment
type: Comment
has text: Why do you need projection at all?
comment on: http://stackoverflow.com/q/26421371
score: 0

http://stackoverflow.com/comment/41421994
has text: @Vladimir indeed, in fact as its `for(initialisation; condition; incriminent)` I would say this is very appropriate use of tbe for loop
type: QuestionComment
comment on: http://stackoverflow.com/q/26383865
type: Comment
score: 1

http://stackoverflow.com/a/58714759
has body: Add this to yourapplication.properties: spring.mustache.expose-request-attributes=true Then you have access to the _csrf request attribute in your template.
type: Answer
answers question: http://stackoverflow.com/q/26397168
upvote count: 3
score: 3
downvote count: 0

http://stackoverflow.com/q/26496211
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
tagged with: spring
type: AnsweredQuestion
score: 2
tagged with: spring-integration
downvote count: 0
tagged with: java
has title: Spring int-xml:xpath-expression erros with node function
type: Question
accepted answer: http://stackoverflow.com/a/26502574
has body: I used XMLSpy to write the following XPath to determine the longest string length and it works in XMLSpy: string-length(//exception:ElementMessageAbcException/@exceptionMsg[not(string-length(.) &lt; //exception:ElementMessageAbcException/@exceptionMsg/string-length(.))] ) But when I put the same string into a xpath-expression in spring integration it errors: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xpathMaxLengthExceptionMsg': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public static org.springframework.xml.xpath.XPathExpression org.springframework.xml.xpath.XPathExpressionFactory.createXPathExpression(java.lang.String,java.util.Map) throws java.lang.IllegalStateException,org.springframework.xml.xpath.XPathParseException] threw exception; nested exception is org.springframework.xml.xpath.XPathParseException: Could not compile [//exception:MarkitMessageAciException/@exceptionMsg[not(string-length() &lt; //exception:MarkitMessageAciException/@exceptionMsg/string-length())]] to a XPathExpression: null; nested exception is javax.xml.xpath.XPathExpressionException Caused by: javax.xml.transform.TransformerException: Unknown nodetype: string-length &lt;int-xml:xpath-expression id="xpathMaxLengthExceptionMsg" expression="//exception:ElementMessageAciException/@exceptionMsg[not(string-length(.) &amp;lt; //exception:ElementMessageAciException/@exceptionMsg/string-length(.))]"&gt; &lt;map&gt; &lt;entry key="pricing" value="http://www.example.net/imdwrd/schemas/Element-pricing-aci" /&gt; &lt;entry key="security" value="http://www.example.net/imdwrd/schemas/Element-security-aci" /&gt; &lt;entry key="tns" value="http://www.example.net/imdwrd/schemas/Element-message-aci" /&gt; &lt;entry key="internalClassification" value="http://www.example.net/imdwrd/schemas/Element-internal-classification" /&gt; &lt;entry key="organization" value="http://www.examp…
linked to: http://stackoverflow.com/q/7923238
has answer: http://stackoverflow.com/a/26502574
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26402466
tags question: http://stackoverflow.com/q/26398233
tags question: http://stackoverflow.com/q/26501786
tags question: http://stackoverflow.com/q/26380247
tags question: http://stackoverflow.com/q/26476205
tags question: http://stackoverflow.com/q/26506881
tags question: http://stackoverflow.com/q/26371483
tags question: http://stackoverflow.com/q/26489006
tags question: http://stackoverflow.com/q/26461089
tags question: http://stackoverflow.com/q/26402654
tags question: http://stackoverflow.com/q/26463954
tags question: http://stackoverflow.com/q/26386175
tags question: http://stackoverflow.com/q/26439715
type: Tag
tags question: http://stackoverflow.com/q/26505334
tags question: http://stackoverflow.com/q/26502286
tags question: http://stackoverflow.com/q/26369701
tags question: http://stackoverflow.com/q/26427966
tags question: http://stackoverflow.com/q/26459004
tags question: http://stackoverflow.com/q/26420001
tags question: http://stackoverflow.com/q/26446139
tags question: http://stackoverflow.com/q/26473423
tags question: http://stackoverflow.com/q/26379653
tags question: http://stackoverflow.com/q/26461061
tags question: http://stackoverflow.com/q/26434783
tags question: http://stackoverflow.com/q/26460181
tags question: http://stackoverflow.com/q/26397647
tags question: http://stackoverflow.com/q/26433212
tags question: http://stackoverflow.com/q/26406506
tags question: http://stackoverflow.com/q/26354163
tags question: http://stackoverflow.com/q/26383417
tags question: http://stackoverflow.com/q/26369491
tags question: http://stackoverflow.com/q/26474469
tags question: http://stackoverflow.com/q/26402645
tags question: http://stackoverflow.com/q/26438065
tags question: http://stackoverflow.com/q/26456623
tags question: http://stackoverflow.com/q/26391383
tags question: http://stackoverflow.com/q/26471047
tags question: http://stackoverflow.com/q/26406982
tags question: http://stackoverflow.com/q/26367986
tags question: http://stackoverflow.com/q/26457074
tags question: http://stackoverflow.com/q/26406764
tags question: http://stackoverflow.com/q/26387435
tags question: http://stackoverflow.com/q/26364644
tags question: http://stackoverflow.com/q/26433544
tags question: http://stackoverflow.com/q/26365391
tags question: http://stackoverflow.com/q/26425278
tags question: http://stackoverflow.com/q/26400521
tags question: http://stackoverflow.com/q/26445731
tags question: http://stackoverflow.com/q/26385738
tags question: http://stackoverflow.com/q/26362373
tags question: http://stackoverflow.com/q/26512015
tags question: http://stackoverflow.com/q/26389376
tags question: http://stackoverflow.com/q/26364442
tags question: http://stackoverflow.com/q/26459916
tag name: xml
tags question: http://stackoverflow.com/q/26486653
tags question: http://stackoverflow.com/q/26463393
tags question: http://stackoverflow.com/q/26498474
tags question: http://stackoverflow.com/q/26512227
tags question: http://stackoverflow.com/q/26361729
tags question: http://stackoverflow.com/q/26462952
tags question: http://stackoverflow.com/q/26438185
tags question: http://stackoverflow.com/q/26482900
tags question: http://stackoverflow.com/q/26448934
tags question: http://stackoverflow.com/q/26405740
tags question: http://stackoverflow.com/q/26420478
tags question: http://stackoverflow.com/q/26378652
tags question: http://stackoverflow.com/q/26394387
tags question: http://stackoverflow.com/q/26457604
tags question: http://stackoverflow.com/q/26361348
tags question: http://stackoverflow.com/q/26422837
tags question: http://stackoverflow.com/q/26362941
tags question: http://stackoverflow.com/q/26392679
tags question: http://stackoverflow.com/q/26360404
tags question: http://stackoverflow.com/q/26425664
tags question: http://stackoverflow.com/q/26402229
tags question: http://stackoverflow.com/q/26361092
tags question: http://stackoverflow.com/q/26507900
tags question: http://stackoverflow.com/q/26507376

http://stackoverflow.com/comment/41646747
type: Comment
has text: I updated the answer to include some reasons why they are not listed. Is it using the global logger?
type: AnswerComment
comment on: http://stackoverflow.com/a/26492711
score: 0

http://stackoverflow.com/comment/41478603
type: Comment
type: QuestionComment
has text: Do you have any errors, if you don't provide that lookup? What is your need, as there might be a better solutions that to use LoginModule in that way.
comment on: http://stackoverflow.com/q/26408651
score: 0

http://stackoverflow.com/comment/41600000
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26449330
has text: `<T extends Number> E divide(E f, T s);` can be just `E divide(E f, Number s);`

http://stackoverflow.com/a/26401656
accepted answer of: http://stackoverflow.com/q/26401298
score: 2
answers question: http://stackoverflow.com/q/26401298
has comment: http://stackoverflow.com/comment/41456486
has body: There is also the option to increase PermGen space Increase permgen space -XX:MaxPermSize=128m There is also the option to enable garbage collection on PermGen space -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled Nevertheless you should check with HP whether it is actually needed to increase PermGen space, it could also be a bug in the software. PermGen space out of memory errors are often caused by memory leaks.
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/41497445
upvote count: 3
type: Answer

http://stackoverflow.com/q/26366301
tagged with: jboss
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26367390
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41390021
tagged with: heap-memory
has body: I have tried to increase the java memory heap size for jboss by making changes to the run.conf.bat file as suggested from How to increase heap size for jBoss server and set to rem # JVM memory allocation pool parameters - modify as appropriate. set "JAVA_OPTS=-Xms2048M -Xmx2048M -XX:MaxPermSize=1024M" If I run the jboss server from the jboss_dir/bin directory using windows command prompt it runs with above JAVA_OPTS values however if run the same jboss from eclipse IDE the eclipse console shows following message 22:31:46,457 INFO [ServerInfo] Java version: 1.6.0_31,Sun Microsystems Inc. 22:31:46,457 INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_31-b05) 22:31:46,457 INFO [ServerInfo] Java VM: Java HotSpot(TM) 64-Bit Server VM 20.6-b01,Sun Microsystems Inc. 22:31:46,457 INFO [ServerInfo] OS-System: Windows 7 6.1,amd64 22:31:46,458 INFO [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dfile.encoding=Cp1252 22:31:46,483 INFO [JMXKernel] Legacy JMX core initialized 22:31:47,761 INFO [ProfileServiceBootstrap] Loading profile: ProfileKey@4fe2fe5d[domain=default, server=default, name=default] I was wondering what eclipse configuration I may have missed so that the jboss is still starting with the JAVA_OPTS with values -Xms128m -Xmx512m -XX:MaxPermSize=256m 22:31:46,458 INFO [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms128m -Xmx512m -XX:MaxPermSize=256m -Dfile.encoding=Cp1252
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/41390473
upvote count: 3
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6252914
has title: how to increase jboss memory heap size in eclipse
has answer: http://stackoverflow.com/a/26367390

http://stackoverflow.com/comment/41706410
has text: I added a working sample to my answer. What do you mean by it doesn't work? Do you mean you don't see the `a` element at all? It maybe because the iconSclass is not applied correctly? Check the actual html output using browser developer tools.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26503871

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26359212
tags question: http://stackoverflow.com/q/26364009

http://stackoverflow.com/q/26506223
has answer: http://stackoverflow.com/a/26506267
has body: I'm trying to create a recall program that sends text messages to 200+ people and then searches an email that the replies are forwarded too. This method is supposed to search the array list of replies that is built using another method, but it doesn't work correctly. It will only work if the very first message on the array list matches the very first number in the contact list. Those are some other problems, but my main question here is why does it say that the code specifically inside of my for loop is dead code? public static boolean searchForPhone(String phone){ CharSequence phoneN = phone; for(int i=0;i&lt;myMessages.size();i++){ if(myMessages.get(i).contains(phone)){ return true; } else{ return false; } } return false; }
answer count: 5
has answer: http://stackoverflow.com/a/26506314
has comment: http://stackoverflow.com/comment/41643348
has answer: http://stackoverflow.com/a/26506469
score: 0
type: UnansweredQuestion
tagged with: dead-code
has answer: http://stackoverflow.com/a/26506420
has answer: http://stackoverflow.com/a/26506282
tagged with: java
has title: Why does Eclipse tell me that this is dead code?
tagged with: eclipse
type: Question
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41643272

http://stackoverflow.com/comment/41626507
type: AnswerComment
has text: always explain why this answer is the best, to improve answer quality :)
type: Comment
comment on: http://stackoverflow.com/a/26496315
score: 0

http://stackoverflow.com/comment/41506126
type: AnswerComment
has text: The bug I filed with Hibernate was linked by someone there to an existing bug. So it might just be that. Hibernate ORM HHH-9445 JPA 2.1 ConstructorResult Causing ClassCastException https://hibernate.atlassian.net/browse/HHH-9445
type: Comment
comment on: http://stackoverflow.com/a/26399309
score: 0

http://stackoverflow.com/q/26511747
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41654039
has body: I want to run docx4j on Android. I'm downloaded this eclipse project and extract the jar that when I import into my Android project and run, the application crashed with error message: java.lang.NoClassDefFoundError: org.apache.log4j.Logger. Including log4j in Android project and app crashed with other errors and etc. Can anyone share how they have been dealt with this problem ?
type: UnansweredQuestion
has title: How to use docxj4 in Android project
tagged with: build
tagged with: java
has comment: http://stackoverflow.com/comment/41653674
has comment: http://stackoverflow.com/comment/41654037
type: Question
tagged with: docx4j
score: 0
has answer: http://stackoverflow.com/a/26538367

http://stackoverflow.com/a/26381869
has comment: http://stackoverflow.com/comment/101761535
has comment: http://stackoverflow.com/comment/126117014
has comment: http://stackoverflow.com/comment/101768030
score: 68
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26379522
answers question: http://stackoverflow.com/q/26379522
has body: First thing, you should read this Spring blog post. Second, according to the JpaSpecificationExecutor interface, that your repositories should implement, the following method take a Specification argument: count(Specification&lt;T&gt; spec) List&lt;T&gt; findAll(Specification&lt;T&gt; spec) Page&lt;T&gt; findAll(Specification&lt;T&gt; spec, Pageable pageable) List&lt;T&gt; findAll(Specification&lt;T&gt; spec, Sort sort) T findOne(Specification&lt;T&gt; spec) So, you can't mix a @Query definition with a Specification. However, since you can express the firstName &lt;&gt; ?1 condition using a Specification and because you combine as many specifications as you want, you can rewrite the whole @Query using Specification(s) only.
has comment: http://stackoverflow.com/comment/41437663
type: Answer
has comment: http://stackoverflow.com/comment/41451762
has comment: http://stackoverflow.com/comment/56028270
upvote count: 68

http://stackoverflow.com/q/26354651
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: vaadin
possible better answer: http://stackoverflow.com/a/26354891
accepted answer: http://stackoverflow.com/a/26361619
has answer: http://stackoverflow.com/a/26354891
answer count: 2
tagged with: intellij-idea
downvote count: 0
tagged with: jprofiler
favorite count: 0
has title: Jprofiler + Vaadin + Intellij Idea : program arguments
has answer: http://stackoverflow.com/a/26361619
type: AnsweredQuestion
has body: I have small problem. I would like to run Intellij Idea with Vaadin and JProfiler on Tomcat. Everything is fine and works good until I wanted to add profiler to this. In Eclipse I had (source: kermeta.org) And in Idea it is also, but in java SE, Java Eclipse. I have build project with this tutorial https://vaadin.com/book/-/page/getting-started.idea.html and I can not find any place for this program arguments :) When I run my project in idea it runs only Tomcat and deploys my software on it. And that's it. Does anybody know where I can put this JProfiler settings to attach to my session in tomcat?

http://stackoverflow.com/a/26453083
type: Answer
answers question: http://stackoverflow.com/q/26452985
has body: (?===)|(?&lt;===)|\s|(?&lt;!=)(?==)|(?&lt;==)(?!=)|(?=\p{P})|(?&lt;=\p{P})|(?=\+) You can try this.Se demo. http://regex101.com/r/wQ1oW3/18
score: 0

http://stackoverflow.com/comment/41637992
has text: See my answer, I guess I was not clear here. Keeping single lock would decrease performance and parallelism, if you only ever need to lock on a row.
comment on: http://stackoverflow.com/a/26502969
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26405313
downvote count: 0
score: 3
has body: @dic19 gave me an idea to send Ctrl+C command to server before disconnecting channel and session in order to interrupt zgrep command execution on server side. I found this post in JSch mailing list which helped me to solve my problem. So to send Ctrl+C command you should enable putty mode for channel object ((ChannelExec)channel).setPty(true); and write 3 value to channel OutputStream: ((ChannelExec)channel).setPty(true); ((ChannelExec)channel).setCommand(cmd); channel.setInputStream(null); ((ChannelExec)channel).setErrStream(System.err); InputStream in=channel.getInputStream(); OutputStream out = channel.getOutputStream(); channel.connect(); ........... if (isCancel) { log.debug("Search was canceled by user... "); channel.setInputStream(null); if (in != null) { in.close(); in = null; } if (br != null) { br.close(); br = null; } out.write(3); out.flush(); try{Thread.sleep(1000);}catch(Exception ee){log.error(ee);} }
answers question: http://stackoverflow.com/q/26403422
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26403422
upvote count: 3
has comment: http://stackoverflow.com/comment/105362125
type: Answer
has comment: http://stackoverflow.com/comment/41459724

http://stackoverflow.com/comment/41579885
comment on: http://stackoverflow.com/a/26470236
type: Comment
has text: When it comes to parent dir if You run the script in the same directory where zip is processed it will be existing. Steam changed.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26364742
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26364330
upvote count: 1
has body: OptionalInt wraps an int, not an Integer value, so the content can be present or not, but can never be null. It's a bit a question of philosophy. As Sotirios Delimanolis has pointed out, if you really require it, just resort to Optional&lt;Integer&gt;.
downvote count: 1
has comment: http://stackoverflow.com/comment/41387159

http://stackoverflow.com/comment/41719490
comment on: http://stackoverflow.com/a/26532024
type: AnswerComment
has text: This produces the same results with less code and operations, which is nice! But there is a flaw, it should be `int waste = 31 - to;`. Anyway, do you know any downsides of this code in comparison to approaches using a mask? Because most advices I've got from different people (not in this question) include using a mask.
type: Comment
score: 0

http://stackoverflow.com/comment/41616213
comment on: http://stackoverflow.com/a/26490209
type: AnswerComment
score: 0
type: Comment
has text: still not clear i have add the same code into jframe class in the startup and i have made method but still showing error please can you help am still in middle of the road

http://stackoverflow.com/comment/41627096
comment on: http://stackoverflow.com/a/26496980
score: 0
type: AnswerComment
has text: Would I want to set a double payRate within each set of braces and also do a setPayRate() within each braces? Also... I changed it so the average would print if gross income ended up being -1 instead of payCounter != 0. It keeps counting properly, but the total income is only -1. It doesn't seem to be picking up any previously entered figures. I know I am missing something vital, but I can't pin point what it would be. Why are my values not sticking?
type: Comment

http://stackoverflow.com/comment/41563653
type: AnswerComment
score: 0
type: Comment
has text: That's true, but he asked for performance not for compatibility :-)
comment on: http://stackoverflow.com/a/26462374

http://stackoverflow.com/comment/41479378
comment on: http://stackoverflow.com/a/26411681
score: 0
type: AnswerComment
has text: @JacobAronoff In what corrdinates x, y you start the search?. And what is the initial value of `cost`, and `lowestCost`?
type: Comment

http://stackoverflow.com/a/26659679
downvote count: 0
answers question: http://stackoverflow.com/q/26433681
type: Answer
score: 1
upvote count: 1
has body: Looks like you have an ivy file for each project, but you do not have a build file for each project. As Mark said in the above comment, each project should build individually. For example: Build ProjectB to a directory like "SharedLibrary" on your drive. (Nice little JAR file) Take note of ProjectB's IVY file. It sets the org, artifact name, version, etc Add the "SharedLibrary" to your ivy &lt;resolvers&gt; list so that IVY looks for dependencies there Add the ProjectB as a dependency of ProjectA (Using the noted information from ProjectB's ivy) That should get you off to the races! Pro Tip: instead of a "SharedLibrary" directory, consider using something like Artifactory to manage the artifacts and pull from there instead.

http://stackoverflow.com/a/26383323
answers question: http://stackoverflow.com/q/26382936
has comment: http://stackoverflow.com/comment/41452806
has comment: http://stackoverflow.com/comment/41447444
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41482627
has body: You can control which keytab is used with a jaas config file of the form: client { com.sun.security.auth.module.Krb5LoginModule required refreshKrb5Config=true useKeyTab=true keyTab="&lt;path to keytab&gt;" principal="&lt;user&gt;@&lt;realm&gt;"; }; This config file is set with the system property: -Djava.security.auth.login.config=&lt;path to jaas config&gt; If you want to change the settings during a single run of the VM you will need to clear the cached user configuration in the VM with: Configuration.setConfiguration(null); To use different realms you need to specify both of the following properties: -Djava.security.krb5.realm=&lt;realm&gt; -Djava.security.krb5.kdc=&lt;kdc&gt;
type: Answer

http://stackoverflow.com/comment/41380549
has text: They are all straight lines, and i want the code to be able to say : from the following image extract all the lines or in order words for each line give me their paths(x,y coordinated used to draw each line so that a particular line would have an array of x,y coordinates)
comment on: http://stackoverflow.com/q/26361152
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41714002
comment on: http://stackoverflow.com/a/26429338
has text: I've just managed to replace SurefaceView by TextureView with the same structure of layouts as in the question, but unfortunately I've got the same issue! It works on my Samsung S3 and fails on Xperia.. I set theme in my android manifest for activity and application. Please give any advise why this may happen.. :C
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26359968
score: 5
accepted answer of: http://stackoverflow.com/q/26359840
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41378406
has comment: http://stackoverflow.com/comment/41378102
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26359840
type: Answer
has body: A continue means go to the start of a loop. So when you continue to a label, the label has to be on a loop. (It is not a goto statement ...) Does it allow to tranfer control to the only while, for or do statement? It doesn't say in the JLS. Actually, it does say. Here's what JLS 14.6 (Java 8 revision) really says: "A continue statement with label Identifier attempts to transfer control to the enclosing labeled statement (§14.7) that has the same Identifier as its label; that statement, which is called the continue target, then immediately ends the current iteration and begins a new one. To be precise, a continue statement with label Identifier always completes abruptly, the reason being a continue with label Identifier. The continue target must be a while, do, or for statement, or a compile-time error occurs." (Bolded in original!) The bolded sentence says that the statement that the label is attached to (referred to as the "continue target") has to be a loop statement of some kind.

http://stackoverflow.com/q/26455021
has title: Which one is the best way to iterate the elements of a particular collection?
has answer: http://stackoverflow.com/a/26457429
downvote count: 0
has answer: http://stackoverflow.com/a/26457300
has comment: http://stackoverflow.com/comment/41550861
score: 4
has comment: http://stackoverflow.com/comment/41551659
favorite count: 0
has body: I always use for each loop while going through the elements of a particular collection. Just to check how much time each looping process consumes, i coded like this, public class LoopingDemo { static ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); static double start; static double end; public static void iterator() { simpleForLoop(); System.out.println(); forEachLoop(); System.out.println(); useWhileLoop(arrayList); System.out.println(); useForLoop(arrayList); System.out.println(); enumerator(); } public static void simpleForLoop(){ start = System.nanoTime(); for(int i=0;i&lt;arrayList.size();i++){ String str = arrayList.get(i); System.out.println(": "+str); } end = System.nanoTime(); System.out.println("Taken taken in simpleForLoop process: " + (end - start)); } public static void forEachLoop() { start = System.nanoTime(); for (String str : arrayList) { System.out.println(str); } end = System.nanoTime(); System.out.println("Taken taken in forEachLoop process: " + (end - start)); } public static void enumerator() { start = System.nanoTime(); // get the Enumeration object Enumeration&lt;String&gt; en = Collections.enumeration(arrayList); // enumerate through the ArrayList elements System.out.println("Enumerating through Java ArrayList"); while (en.hasMoreElements()) { System.out.println(en.nextElement()); /* * String name = (String) en.nextElement(); * System.out.println(name); */ } end = System.nanoTime(); System.out.println("Taken taken in enumeration process: " + (end - start)); } private static void useWhileLoop(Collection&lt;String&gt; myList) { start = System.nanoTime(); Iterator&lt;String&gt; itr = myList.iterator(); while (itr.hasNext()) { String str = itr.next(); // Returns the next element in the // iteration. System.out.println(str); // System.out.println(itr.next()); // in one line } end = System.nanoTime(); System.out.println("Taken taken in useWhileLoop process: " + (end - start)); } /** * Note that this for-loop does not use an inte…
has answer: http://stackoverflow.com/a/26455081
answer count: 4
has answer: http://stackoverflow.com/a/26455225
type: UnansweredQuestion
tagged with: loops
tagged with: collections
type: Question
tagged with: java
upvote count: 4

http://stackoverflow.com/a/27251693
type: Answer
answers question: http://stackoverflow.com/q/26365558
score: 0
has body: Use this : DefaultComboBoxModel model = (DefaultComboBoxModel) ComboBox.getModel(); model.removeAllElements();

http://stackoverflow.com/comment/41491600
has text: Does your text only ever contains non accentuated letters?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26423072

http://stackoverflow.com/comment/41483178
has text: This is the output i am expecting 0xd19f261efa71440103519930f483de39c4deffb333c35b89c88d505ad4203e98b0d1f34233dad82a4b9ba0a3531ede93203691a2b96fb45a But i am getting different output 87168739A1D8972742F476D48F139348B06EDF38545BC3C00434DD5C464B2FDF8512EF75D05D897EA5523F8C1589AB5106A5CC986C859CBB
score: 0
comment on: http://stackoverflow.com/q/26417876
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26475321
score: 1
has comment: http://stackoverflow.com/comment/91688432
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26445897
answers question: http://stackoverflow.com/q/26445897
type: AcceptedAnswer
has body: I was able to get the "mybatis-generator-core-1.3.2-sources.jar". Then, after debugging into the mybatis generator code, I was able to see that the "targetProject" values of "\Infinity\src" were not being read despite the fact that this appears to be exactly how the example is shown on the mybatis page: http://mybatis.github.io/generator/configreference/xmlconfig.html So, when I changed the targetProject values to be the full path on my C: drive, it worked: targetProject="C:\Users\Ryan\InfinityWorkspace\Infinity\src\"&gt;
downvote count: 0

http://stackoverflow.com/comment/41710132
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26483184
type: AnswerComment
has text: If you add the -verbose flag when starting your local server jvm, do you see any printouts like this?: [Loaded sun.management.jdp.JdpController from c:\java\8u20-b26\jre\lib\rt.jar]

http://stackoverflow.com/comment/41409621
comment on: http://stackoverflow.com/a/26366380
score: 0
has text: I have tried if i press on button1,button2 remains disabled unless we close the application and vice versa.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41630959
score: 0
type: Comment
type: QuestionComment
has text: Depending on what you are trying to achieve, you could use `Path2D#getBounds#contains`
comment on: http://stackoverflow.com/q/26499201

http://stackoverflow.com/comment/41380571
has text: In that case, can you add some more details of the exception that you're getting?
comment on: http://stackoverflow.com/a/26361271
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26452063
answers question: http://stackoverflow.com/q/26387774
type: Answer
has body: I'm done, I made two Layouts, and at first one I fill with image, and second one I put all other stuff, so now the first half of screen is with picture, and second half is with other stuff,... Thanks alot guys...
accepted answer of: http://stackoverflow.com/q/26387774
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26424687
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26424766
tagged with: pecs
downvote count: 1
has title: How to remove 'unchecked' warning from my method?
has comment: http://stackoverflow.com/comment/41494411
tagged with: bounded-wildcard
upvote count: 0
has comment: http://stackoverflow.com/comment/41494385
has body: I have following code private static class ParcelableParser&lt;T&gt; { private ArrayList&lt;T&gt; parse(List&lt;Parcelable&gt; parcelables) { ArrayList&lt;T&gt; parsedData = new ArrayList&lt;T&gt;(); for(Parcelable parcelable : parcelables) { parsedData.add((T) parcelable); } return parsedData; } } It is called as follows ParcelableParser&lt;SomeClass&gt; cellParser = new ParcelableParser&lt;SomeClass&gt;(); cellParser.parse(bundle.getParcelableArrayList("some String")); It gives warning Type safety: Unchecked cast from Parcelable to T. No matter what I do, I always have some nasty compilation error. I have read about PECS rule, but I am not able to apply it here. sample solution (does not compile) private static class ParcelableParser&lt;T extends Parcelable&gt; { private ArrayList&lt;T&gt; parse(List&lt;T&gt; parcelables) { ArrayList&lt;T&gt; parsedData = new ArrayList&lt;T&gt;(); for(T parcelable : parcelables) { parsedData.add((T) parcelable); } return parsedData; } } Using it as return new ParcelableParser&lt;SomeClass&gt;() .parse(bundle.getParcelableArrayList("SomeString")); prodces The method parse(List&lt;SomeClass&gt;) in the type MyClass.ParcelableParser&lt;SomeClass&gt; is not applicable for the arguments (ArrayList&lt;Parcelable&gt;)
accepted answer: http://stackoverflow.com/a/26424766
type: AnsweredQuestion
tagged with: generics
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/41494391

http://stackoverflow.com/comment/41598319
type: AnswerComment
has text: hmm, I think this ok. Try to put your intent after mHandler.removeCallbacks(mTimer1)... (like my update answer) then run for test. I am waiting for your answer
type: Comment
comment on: http://stackoverflow.com/a/26480419
score: 0

http://stackoverflow.com/q/26508380
has comment: http://stackoverflow.com/comment/41647250
has answer: http://stackoverflow.com/a/26508708
has answer: http://stackoverflow.com/a/26508543
type: UnansweredQuestion
has title: JAVA HashMap duplicates
tagged with: java
type: Question
has body: I'm trying to find the duplicates of files in the directory. I have a problem with this block, that has file's address as an argument: public void findFiles(ArrayList&lt;File&gt; list){ HashMap&lt;String, File&gt; hmap = new HashMap&lt;String, File&gt;(); hmap.put(list.get(0).getName(), list.get(0)); //System.out.println(hmap); for(Entry&lt;String, File&gt; entry : hmap.entrySet()){ String key = entry.getKey(); File value = entry.getValue(); // i don't understand what I need to write below if (hmap.containsKey(key)) { System.out.println("Duplicate: " + key + " in "+ value.getAbsolutePath()); } } } How should I rewrite my if statement? System.out.println(hmap); And have next examlpes: {File 2.txt=D:\Folder1\Folder1-2\Folder1-2-1\File 2.txt} {DFolder1.txt=D:\Folder1\Folder1-2\Folder1-3-1\DFolder1.txt} {File 1.txt=D:\Folder1\Folder1-2\File 1.txt} {File 1.txt=D:\Folder1\Folder1-3\File 1.txt, File 3.txt=D:\Folder1\Folder1-3\File 3.txt} {File 3.txt=D:\Folder1\File 3.txt} I have two "File 1.txt"
tagged with: hashmap
tagged with: if-statement
tagged with: duplicates
score: 0
linked to: http://stackoverflow.com/q/20537898
answer count: 3
has answer: http://stackoverflow.com/a/26508442
tagged with: arrays
has comment: http://stackoverflow.com/comment/41647679

http://stackoverflow.com/comment/41432305
type: AnswerComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63124/discussion-between-user4087819-and-rafi-abro).
score: 0
comment on: http://stackoverflow.com/a/26389036
type: Comment

http://stackoverflow.com/comment/75468177
has text: WakefulBroadcastReceiver is deprecated for Android "O" and above. The replacement is JobScheduler.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26380534

http://stackoverflow.com/q/26463228
tagged with: android
possible better answer: http://stackoverflow.com/a/26464100
has answer: http://stackoverflow.com/a/26464100
has body: I want to put the image in the center of the button.I want to use only linear layout.Any help will be great.Here is my layout.
type: AnsweredQuestion
has title: how to put image in the center of the button
tagged with: java
has comment: http://stackoverflow.com/comment/41588094
has comment: http://stackoverflow.com/comment/41566236
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41565887
has answer: http://stackoverflow.com/a/26463354
accepted answer: http://stackoverflow.com/a/26463354

http://stackoverflow.com/a/26371460
upvote count: 0
answers question: http://stackoverflow.com/q/26371395
has body: Try to use FragmentActivity instead of Activity. Does it help?
score: -2
downvote count: 2
type: Answer

http://stackoverflow.com/comment/41532040
score: 1
comment on: http://stackoverflow.com/q/26441130
type: Comment
has text: Hmm, Other than the [java] tag it seems perfectly on-topic for me.
type: QuestionComment

http://stackoverflow.com/q/26366446
tagged with: stack
tagged with: java
downvote count: 1
type: Question
has body: everyone. I am currently having issue on doing the evaluation of postfix expression in Java and I think everything is alright except the output is not really correct. But never mind, please let me to post all the codes so that all of you can have a look on them. By the way, please be noted that all of you just need to concentrate on TestPalindrome class is enough because I never change the codes for the other classes except the class that I specified just now. StackInterface defines all the methods that are available to ArrayStack class. //There is no need to check this. public interface StackInterface&lt;T&gt; { /** Task: Adds a new entry to the top of the stack. * @param newEntry an object to be added to the stack */ public void push(T newEntry); /** Task: Removes and returns the stack誷 top entry. * @return either the object at the top of the stack or, if the * stack is empty before the operation, null */ public T pop(); /** Task: Retrieves the stack誷 top entry. * @return either the object at the top of the stack or null if * the stack is empty */ public T peek(); /** Task: Detects whether the stack is empty. * @return true if the stack is empty */ public boolean isEmpty(); /** Task: Removes all entries from the stack */ public void clear(); } // end StackInterface ArrayStack class that is nothing special. //There is no need to check this. public class ArrayStack&lt;T&gt; implements StackInterface&lt;T&gt; { private T[] stack; // array of stack entries private int topIndex; // index of top entry private static final int DEFAULT_INITIAL_CAPACITY = 50; public ArrayStack() { this(DEFAULT_INITIAL_CAPACITY); } // end default constructor public ArrayStack(int initialCapacity) { stack = (T[]) new Object[initialCapacity]; topIndex = -1; } // end constructor public void push(T newEntry) { topIndex++; if (topIndex &gt;= stack.length) // if array is full, doubleArray(); // expand array stack[topIndex] = newEntry; } // end push public T peek() { T top = null; if (!isEmpty()) …
score: 0
upvote count: 1
answer count: 1
favorite count: 0
has title: Strange output(square symbol) in the Java code
has answer: http://stackoverflow.com/a/26366509
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26366509

http://stackoverflow.com/q/26487770
type: Question
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26488620
answer count: 2
has title: Hibernate: mapping column substring to a field
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26488186
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26488620
possible better answer: http://stackoverflow.com/a/26488186
has body: I want to know if it is possible to map a table column "substring" to a field, here is a sample. Initially --> column named 'description' contains this string '123456789' After mapping --> java class field named 'descSummary' contains '123'. Thanks in advance.
score: 1
upvote count: 1

http://stackoverflow.com/comment/41594298
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26478818
type: AnswerComment
has text: Yeah. I just don't care ... :)

http://stackoverflow.com/comment/41494850
has text: Clientside != Serverside
comment on: http://stackoverflow.com/a/26424114
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41504578
score: 1
type: AnswerComment
has text: If there's a root hack, it should be possible to acquire the data from the asset in the android app process and pipe it into a native executable such as `dd` invoked with a single argument such as "of=/system/bin/this_is_a_bad_idea". Of course /system is usually mounted read-only, too.
type: Comment
comment on: http://stackoverflow.com/a/26429157

http://stackoverflow.com/q/26383926
has answer: http://stackoverflow.com/a/62095768
possible better answer: http://stackoverflow.com/a/28209491
has answer: http://stackoverflow.com/a/58138871
tagged with: luhn
upvote count: 7
has title: How do I implement the Luhn algorithm?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26384104
has answer: http://stackoverflow.com/a/55587612
has answer: http://stackoverflow.com/a/28209491
has answer: http://stackoverflow.com/a/26384206
has answer: http://stackoverflow.com/a/26384104
has answer: http://stackoverflow.com/a/26384128
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/54637676
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/109827077
tagged with: java
type: Question
answer count: 8
has body: I am trying to create a program to validate 10 to 12 digit long number sequences based on the luhn algorithm, but my program keeps on telling me that every number is invalid even though they're not. This number should be valid, but my code doesn't think so: 8112189876 This number should not be valid, which my program agrees with, as it thinks every number is invalid: 8112189875 Here is my code: static void luhn(){ System.out.print("Enter number to validate:\n"); String pnr = input.nextLine(); int length = pnr.length(); int sum = 0; for (int i = 1, pos = length - 1; i &lt; 10; i++, pos--){ char tmp = pnr.charAt(pos); int num = tmp - 0 int product; if (i % 2 != 0){ product = num * 1; } else{ product = num * 2; } if (product &gt; 9) product -= 9; sum+= product; boolean valid = (sum % 10 == 0); if (valid){ System.out.print("Valid!\r"); } else{ System.out.print("Invalid!"); } } }
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41422438
has comment: http://stackoverflow.com/comment/41422265

http://stackoverflow.com/a/26472167
has comment: http://stackoverflow.com/comment/41598208
answers question: http://stackoverflow.com/q/26472137
has body: a = 300; is executable statement which needs to be under executable block (method, constructor, internalizer block_
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41598232

http://stackoverflow.com/comment/41544992
comment on: http://stackoverflow.com/a/26449530
score: 0
type: Comment
type: AnswerComment
has text: i found that when the resultset of Spring Data REST is very big, this is happening leading to OutOfMemory. However, all my repositories are extending JPARepository. I don't understand how default pagination is not happening which should limit first page result to 20 only

http://stackoverflow.com/comment/41830815
has text: @Ayrad yes, but as far as I know nexus add it by default. If it did not appear in your public repository, you should add it by yourself by make it as proxy repository and also add it into public repo group.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26558898
score: 0

http://stackoverflow.com/q/26386276
type: Question
tagged with: java
has body: I've got a bunch of Excel files with references to another files on the server using formulas like this: 'http://192.168.1.2/[blank.xls]Sheet1'!$A$1 Ips in formulas are hardcoded. I want to change them to reference another host and path, for example: 'http://192.168.1.3/reports/[report.xls]Sheet1'!$A$1 Trying to use Apache POI for that like this: for (int s = 0; s &lt; workbook.getNumberOfSheets(); s++) { HSSFSheet sheet = workbook.getSheetAt(s); for (Row row : sheet) { for (Cell cell : row) { if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { cell.setCellFormula("'http://192.168.1.3/reports/[report.xls]Sheet1'!$A$1"); } } } } But when I try to get the value (with cell.getCellFormula())I got: #REF!$A$1 The same I got when I open the file with MS Excel. How to get this work properly? P.S. Using Apache POI 3.8.
score: 0
has comment: http://stackoverflow.com/comment/41447600
has comment: http://stackoverflow.com/comment/41429923
has title: Processing external references in the Excel files with Apache POI
has comment: http://stackoverflow.com/comment/41437597
has comment: http://stackoverflow.com/comment/41451348
has comment: http://stackoverflow.com/comment/41448202
tagged with: apache-poi
answer count: 0
type: UnansweredQuestion
tagged with: excel

http://stackoverflow.com/comment/41426785
comment on: http://stackoverflow.com/q/26386422
has text: Can you add your code please ?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26445483
tagged with: java
tagged with: hibernate
tagged with: jdbi
type: Question
has answer: http://stackoverflow.com/a/26471828
upvote count: 11
answer count: 3
has answer: http://stackoverflow.com/a/26447330
tagged with: dropwizard
tagged with: sql
favorite count: 0
has body: I am building a web service using the Dropwizard framework (version 0.7.0). It involves executing some read-only queries to the database, manipulating the result set and then returning that data set. I am using MySQL as a database engine. Since I am new to this framework, I want to know which option I should choose: Hibernate or JDBI.
possible better answer: http://stackoverflow.com/a/26447330
has title: Hibernate vs JDBI
score: 11
has answer: http://stackoverflow.com/a/26447268
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26471828
downvote count: 0

http://stackoverflow.com/comment/41638638
comment on: http://stackoverflow.com/a/26503292
type: Comment
has text: @user3491167: You can see my updated answer. Sorry but can't see the wordpress site now for confimation.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26463762
has body: I launched my application in debug mode (IDE: Eclipse 4.4) and noticed, that when I open Settings Activity (which extends PreferenceActivity) a new thread with name "PowerManagerThread" appears. Also, when I click on any CheckBoxPreference another thread appears: "pool-2-thread-1". These threads remains even after Settings Activity is destroyed. What are these threads doing and are they neccessary? Edit. I created a new project with MainActivity, containing a PreferenceFragment with single checkbox. Then i changed that to PreferenceActivity(as described above). Same threads appeared in both cases.
answer count: 1
tagged with: preferences
tagged with: android
has title: PreferenceActivity creates threads
type: UnansweredQuestion
tagged with: multithreading
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26463881
score: 0

http://stackoverflow.com/q/26506711
downvote count: 0
tagged with: java
has body: How can I Check upload and download data capacities using Java Code? (in internet or local area network)
has comment: http://stackoverflow.com/comment/41758673
type: Question
tagged with: network-programming
has title: Check Internet Usage using JAVA
upvote count: 2
answer count: 2
tagged with: getrusage
favorite count: 0
has answer: http://stackoverflow.com/a/55873957
has comment: http://stackoverflow.com/comment/41643993
has answer: http://stackoverflow.com/a/26506941
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/41465371
type: Comment
type: QuestionComment
has text: yes, i really need it
comment on: http://stackoverflow.com/q/26408242
score: 0

http://stackoverflow.com/comment/41621354
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26493815
has text: You want it to be Lazy, and then your problem is, that is Lazy?
score: 0

http://stackoverflow.com/q/26460047
tagged with: data-structures
has comment: http://stackoverflow.com/comment/41559711
accepted answer: http://stackoverflow.com/a/26460065
answer count: 3
favorite count: 0
has title: Null pointer with hashmap containing multiple keys
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26460065
possible better answer: http://stackoverflow.com/a/26460180
has answer: http://stackoverflow.com/a/26462149
score: 1
tagged with: java
has body: I'm getting a NullPointerException in my HashMap containing multiple keys. I was having issues with memory and tried to condense my code without creating unnecessary variables, so I've tried doing it this way: HashMap&lt;String,HashMap&lt;String, ArrayList&lt;HashMap&lt;String, String&gt;&gt;&gt;&gt; data = new HashMap&lt;&gt;(); data .put(user, new HashMap&lt;String, ArrayList&lt;HashMap&lt;String,String&gt;&gt;&gt;()) .put(info, new ArrayList&lt;HashMap&lt;String, String&gt;&gt;()); I'm getting the NullPointerException on: .put(info, new ArrayList&lt;HashMap&lt;String, String&gt;&gt;()); Any idea why? Do I have to create the variables first?
has answer: http://stackoverflow.com/a/26460180
type: Question
tagged with: hashmap
downvote count: 0

http://stackoverflow.com/q/26464757
tagged with: atg
has title: Timer in Java/ATG - Web Services call
tagged with: atg-dynamo
type: UnansweredQuestion
tagged with: web-services
type: Question
tagged with: jakarta-ee
tagged with: java
answer count: 1
has body: I have generated a request for web services. I need to do do a check on my call. If the response is not returned within 5 seconds, another request will be shooted. Pseudo Code : webServiceClass response = xyz.getData(); If the response is not obtained in 5 seconds - send another request CheckData() to web services.This should be done for a maximum of 5 times. I need to do this without using threads.
has answer: http://stackoverflow.com/a/26471954
has comment: http://stackoverflow.com/comment/41567632
has comment: http://stackoverflow.com/comment/41567503
score: 0

http://stackoverflow.com/comment/41389326
score: 0
type: Comment
has text: @zvdh I'm trying to implement the first option, but it doesnt work, the updated version [link] https://gist.github.com/anonymous/204dae30728aa2b555d5 and the calling method [link] https://gist.github.com/anonymous/6e8592bcab8b22b2398e
comment on: http://stackoverflow.com/a/26360978
type: AnswerComment

http://stackoverflow.com/a/26459095
score: 5
has comment: http://stackoverflow.com/comment/41558161
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26459054
answers question: http://stackoverflow.com/q/26459054
type: Answer
upvote count: 5
has body: public static void main(String args[]) throws IOException { String regex = "(?&lt;=[\\d])(,)(?=[\\d])"; Pattern p = Pattern.compile(regex); String str = "John loves cakes and he always orders them by dialing \"989,444 1234\". Johns credentials are as follows\" \"Name\":\"John\", \"Jr\", \"Mobile\":\"945,234,1110\""; Matcher m = p.matcher(str); str = m.replaceAll(""); System.out.println(str); } Output John loves cakes and he always orders them by dialing "989444 1234". Johns credentials are as follows" "Name":"John", "Jr", "Mobile":"9452341110"
downvote count: 0

http://stackoverflow.com/q/26412525
has title: JIRA development - creating a screen (FieldScreen) programmatically
answer count: 1
has answer: http://stackoverflow.com/a/26471757
type: AnsweredQuestion
tagged with: java
tagged with: jira
type: Question
accepted answer: http://stackoverflow.com/a/26471757
has body: I'm pretty new to JIRA and I'm currently working on integrating my JIRA plugin with the JIRA issue tracking system. My plan is to create a couple of custom fields and then create a custom screen (FieldScreen) that will contain these fields. I've created one custom field but I'm having trouble with creating the screen. // Create issue type: IssueType myIssueType = this.issueTypeManager.createIssueType("FOO", "FOOBAR", "/images/icons/issuetypes/genericissue.png"); // Create custom field: // Create a list of issue types for which the custom field needs to be available List&lt;GenericValue&gt; issueTypes = new ArrayList&lt;GenericValue&gt;(); issueTypes.add(myIssueType.getGenericValue()); // Create a list of project contexts for which the custom field needs to be available List&lt;JiraContextNode&gt; contexts = new ArrayList&lt;JiraContextNode&gt;(); contexts.add(GlobalIssueContext.getInstance()); CustomFieldType fieldType = this.customFieldManager.getCustomFieldType("com.atlassian.jira.plugin.system.customfieldtypes:textfield"); CustomFieldSearcher fieldSearcher = this.customFieldManager.getCustomFieldSearcher("com.atlassian.jira.plugin.system.customfieldtypes:textsearcher"); CustomField cField = this.customFieldManager.createCustomField("Basic Text Field", "This is a basic text field", fieldType, fieldSearcher, contexts, issueTypes); /* Change this next part, instead of adding to the default screen: 1) Create a new screen (FieldScreen) 2) Add the custom field (cField) to that screen */ // Add field to default Screen FieldScreen defaultScreen = fieldScreenManager.getFieldScreen(FieldScreen.DEFAULT_SCREEN_ID); if (!defaultScreen.containsField(cField.getId())) { FieldScreenTab firstTab = defaultScreen.getTab(0); firstTab.addFieldScreenLayoutItem(cField.getId()); }
score: 0

http://stackoverflow.com/q/26507132
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Uploading image and data in jsp form
score: 1
has body: I want to upload image along with data from jsp form. Then send these values to servlet. My code for jsp form is as following: &lt;form action="AddController" method="post" name="addform" id="addform" &gt; Name : &lt;input type="text" name="myname"&gt; Image : &lt;input type="file" accept="image/*" name="file"&gt; &lt;input type="submit" name="add" id="add" value="Save"/&gt; &lt;/form&gt; The code for servlet is as following. The code : protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String add=request.getParameter("add"); if(add!=null) { String name =request.getParameter("myname"); System.out.println(myname); String SAVE_DIR = "C:/uploadFiles"; // gets absolute path of the web application String appPath = request.getServletContext().getRealPath(""); // constructs path of the directory to save uploaded file String savePath = SAVE_DIR; // creates the save directory if it does not exists File fileSaveDir = new File(savePath); if (!fileSaveDir.exists()) { fileSaveDir.mkdir(); } for (Part part : request.getParts()) { String fileName = extractFileName(part); part.write(savePath + File.separator + fileName); } request.setAttribute("message", "Upload has been done successfully!"); getServletContext().getRequestDispatcher("/addsuccessful.jsp").forward( request, response); } } /** * Extracts file name from HTTP header content-disposition */ private String extractFileName(Part part) { String contentDisp = part.getHeader("content-disposition"); String[] items = contentDisp.split(";"); for (String s : items) { if (s.trim().startsWith("filename")) { return s.substring(s.indexOf("=") + 2, s.length()-1); } } return ""; } I get the name value from text box. But image is not uploaded. When I add enctype="multipart/form-data" in form then I am not getting name value. How to solve this issue????
tagged with: java
linked to: http://stackoverflow.com/q/2422468
tagged with: forms
type: Question
has comment: http://stackoverflow.com/comment/41644825
duplicate of: http://stackoverflow.com/q/2422468
tagged with: jsp
tagged with: servlets
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26363246
has title: Set event's time with iCal4j
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26366945
accepted answer: http://stackoverflow.com/a/26366945
tagged with: java
tagged with: icalendar
type: Question
has body: I trying to implement simple export function into ics file. Events exported fine, but there is an issue with times - they are missing in exported file but exists in original format. Here is the code: TimeZone timeZone = TimeZone.getTimeZone(e.getOrder().getTimeZone()); long timeZoneOffset = TimeUnit.MILLISECONDS.toMinutes(timeZone.getOffset(now.getTime())); startDate = new net.fortuna.ical4j.model.Date(DateUtils.addMinutes(e.getStartDateTime(), (int) timeZoneOffset).getTime()); endDate = new net.fortuna.ical4j.model.Date(DateUtils.addMinutes(e.getEndDateTime(), (int) timeZoneOffset).getTime()); event = new VEvent(startDate, endDate, e.getOrder().getDescription()); event.getProperties().add(TimeZoneRegistryFactory.getInstance().createRegistry().getTimeZone(e.getOrder().getTimeZone()).getVTimeZone().getTimeZoneId()); event.getProperties().add(new UidGenerator("CA").generateUid()); calendar.getComponents().add(event); What I missed? Thank you in advance!
answer count: 1
score: 0
tagged with: ical4j

http://stackoverflow.com/comment/41482938
score: 0
type: Comment
type: QuestionComment
has text: Alright, but that doesn't solve the issue at hand.
comment on: http://stackoverflow.com/q/26417963

http://stackoverflow.com/comment/41601769
score: 0
type: Comment
type: QuestionComment
has text: Start by setting the `container` as the frames `contentPane`, then set a layout manager to the frame, then add what ever you want to it
comment on: http://stackoverflow.com/q/26483178

http://stackoverflow.com/comment/41384151
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26359387
has text: Are you sure? in cmd i always write this command "-jar c:\apktool.exe d -f c:\bf.apk c:\decompiled"
score: 0

http://stackoverflow.com/comment/41406350
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html - read
comment on: http://stackoverflow.com/q/26354678
score: 0

http://stackoverflow.com/a/26486852
score: 0
answers question: http://stackoverflow.com/q/26468861
type: AcceptedAnswer
type: Answer
has body: There as an error in my pom.xml, so *-client.jar is not generated at package phase. org.apache.maven.plugins maven-ejb-plugin package true path/** ejb package
accepted answer of: http://stackoverflow.com/q/26468861

http://stackoverflow.com/comment/41444410
comment on: http://stackoverflow.com/q/26396469
score: 0
type: Comment
type: QuestionComment
has text: First of please know your client device os version and i think may some permission issue regards ITelephony may be happened.

http://stackoverflow.com/q/26451500
type: Question
score: 0
answer count: 1
has title: NullPointerException error in Cursor?
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26451556
tagged with: android
has body: Nullpointer exception on Cursor It retrieve the values from the database successfully in mainactivity. But it shows null pointer exception in DepartmentDesignation.class file. on HODcursor = mydb.get_dept_list() ; in DepartmentDesignation.java MainActivity.java import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.widget.SimpleCursorAdapter; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; public class MainActivity extends Activity { private MyDBHelper mydb; private SimpleCursorAdapter adapter; public static final String Row_ID = "row_id"; ListView dplist; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //********************************// //Begin of Database-Table1_Dept_List //********************************// dplist= (ListView) findViewById(R.id.list_view); //Instantiate table1_dept_list mydb =new MyDBHelper(this, null, null,4); SQLiteDatabase db =mydb.getReadableDatabase(); //Removing duplicate values from table1_dept_list mydb.delete_dep_list(); //Inserting into table1_dept_list mydb.add_dept_list("DLBIOCHEM","BioChemistry"); mydb.add_dept_list("DLBIOTECH","BioTechnology"); mydb.add_dept_list("DLBOT", "Botany"); mydb.add_dept_list("DLCHEM","Chemistry"); mydb.add_dept_list("DLCOM","Commerce"); mydb.add_dept_list("DLCS","Computer Science"); mydb.add_dept_list("DLECO","Economics"); mydb.add_dept_list("DLEDU","Education"); mydb.add_dept_list("DLENG","English"); mydb.add_dept_list("DLEVS","Environmental Science"); mydb.add_dept_list("DLFSN","Food Science and Nutrition"); mydb.add_dept_list("DLGEO","Geology"); mydb.add_dept_list("DLJMC", "Journalism and Massmedia Communication"); mydb.add_dept_list("DLLIS","Library and Information Science"); mydb.add_dept_list("DLMATH","Math…

http://stackoverflow.com/comment/41553361
comment on: http://stackoverflow.com/a/26456377
type: AnswerComment
type: Comment
has text: That won't help the case where `r=4`, which is also broken.
score: 1

http://stackoverflow.com/comment/41404305
type: Comment
has text: does the List class need to be imported? I'm making these two classes from scratch and I did not anticipate the need for importing. The error I'm getting is: Cannot find symbol - class List
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26373846

http://stackoverflow.com/q/26394622
tagged with: processing
tagged with: opengl
tagged with: java
has answer: http://stackoverflow.com/a/26394663
type: Question
has body: I have some Processing code where I need to create a new rectangular box when a certain key is pressed and I need to have multiples of these on screen. I have all the code setup so that when I press a key something can happen, but I've tried to create new objects infinitely and I can't get it to work. Code: public float translateX = 0; public float translateY = 260; public float translateZ = 10000; float bulletX, bulletY, bulletZ; public int rotationBlue = 1; public int rotationGreen = 1; public int rotationRed = 1; public boolean shootBool = false; public boolean shootBoolVal = true; void setup() { size(1280, 720, P3D); frameRate(60); } void draw() { background(0); translate(640, 360, -10000); fill(0); box(100000); ship(); control(); } void control() { if (keyPressed) { if (key == 'a' || key == 'A') { translateX = translateX - 5; } if (key == 'd' || key == 'D') { translateX = translateX + 5; } if ((key == 's' || key == 'S')) { translateZ = translateZ + 5; } if ((key == 'w' || key == 'W')) { translateZ = translateZ - 5; } if ((key == 'q' || key == 'Q')) { translateY = translateY - 5; } if ((key == 'e' || key == 'E')) { translateY = translateY + 5; } if (key == 'f' || key == 'F') { } } } public void ship() { fill(0, 0, 255); stroke(255); strokeWeight(3); translate(translateX, translateY, translateZ); //translate(mouseX, mouseY, 0); rotateX(radians(rotationBlue)); rotateY(radians(rotationBlue)); rotateZ(radians(rotationBlue)); rotationBlue++; box(100); fill(0, 255, 0); rotateX(radians(rotationGreen)); rotateY(radians(rotationGreen)); rotateZ(radians(rotationGreen)); rotationGreen--; box(100); fill(255, 0, 0); rotateX(radians(rotationRed)); rotateY(radians(rotationRed)); rotateZ(radians(rotationRed)); rotationRed = rotationRed + 2; box(100); //translateZ = translateZ - 5; } This is all the code that I have so far. I need to be able to have it so that when I press the "F" key (which is already defined in the function control), a new box is created at the coordinates of …
answer count: 1
favorite count: 0
score: 0
has title: Creation of Bullets using objects in a game
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41441455
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26449663
answers question: http://stackoverflow.com/q/26449662
has comment: http://stackoverflow.com/comment/41540885
downvote count: 0
type: Answer
has body: the problem is that there are multiple words in each line and those words shouldn't be sorted. If I understand you correctly, you could just read the file line by line (instead of word by word): List&lt;String&gt; names = new ArrayList&lt;&gt;(); BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { names.add(line); } br.close(); Collections.sort(names); // TODO write names to file If you're using Linux, you could also just use sort: sort fileName &gt; fileNameSorted
has comment: http://stackoverflow.com/comment/41540886
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41540887

http://stackoverflow.com/comment/41657495
score: 0
comment on: http://stackoverflow.com/q/26513513
type: Comment
has text: Okey, so drawing a shape as a hitbox would be a good idea! And if I draw it around the feet of the player I automatically solve this "logical collision" problem. :) But since the fridge is not an object but a tile on the map I can't use methods like "intersects".
type: QuestionComment

http://stackoverflow.com/q/26455850
has answer: http://stackoverflow.com/a/26455943
favorite count: 0
has answer: http://stackoverflow.com/a/26456171
accepted answer: http://stackoverflow.com/a/26456171
has answer: http://stackoverflow.com/a/26472540
answer count: 4
type: AnsweredQuestion
tagged with: java.util.scanner
score: 1
tagged with: java
has title: How to using Scanner to take out odd number lines and place them in order?
possible better answer: http://stackoverflow.com/a/26455943
type: Question
has answer: http://stackoverflow.com/a/26456648
upvote count: 2
downvote count: 1
has body: How to using Scanner to take out odd number lines and place them in order? The problem is that I have a text file and looks like this : case0: a1: 0 a2: 0 a3: 0 a4: 0 a5: 0 a6: 0 a7: 1 a8: 0 a9: 0 I need to let the output to be like : caseNumber :0 case content :000000100 How to do it ? Here is a version ive write so far , you may like to add some on that : import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class FileScanner { File f = new File("test.txt"); public static void main(String[] args) { FileScanner fs = new FileScanner(); fs.readfile(); } public void readfile() { try { // create a new scanner with the specified String Object Scanner scanner = new Scanner(f); int lineCount = 0; while (scanner.hasNextLine()) { lineCount++; String line = scanner.nextLine(); // System.out.println("Line :" + line); String line1 = line.trim(); // System.out.println(line1); for (lineCount = 0; lineCount&lt;19; lineCount++) { line1 = line1.substring(line1.lastIndexOf("e") + 1); // System.out.println("what is here :"+line1); line1 = line1.substring(0, line1.lastIndexOf(":")); int caseNum = Integer.parseInt(line1); System.out.println("caseNumber :" + caseNum); }; // System.out.println(""+line1); // int caseNumber = Integer.parseInt(line1); // System.out.println("caseNumber :" + caseNumber); } System.out.println("line count" + lineCount); } catch (FileNotFoundException e) { } // find the next token and print it // System.out.println("" + scanner.next()); // find the next token and print it // System.out.println("" + scanner.next()); // close the scanner } } Contious of last question .. RIght , i got the output like this : Case Number: -1 Case Contents: 000000100 Line Count: 4085 which i think got a little bit wrong on the case number . Then i got 215 sets of cases (in the same file and same format with the first set of data),and i need to make the output like : Case Number: 0 Case Contents: 000000100 Case Number: 1 Case Contents: 000000101 Ca…

http://stackoverflow.com/comment/41625875
type: Comment
type: QuestionComment
has text: Downvoters, please explain why!
comment on: http://stackoverflow.com/q/26495841
score: 0

http://stackoverflow.com/q/26462474
type: Question
has answer: http://stackoverflow.com/a/26480050
downvote count: 0
has title: How do I take a photo in the onCreate method in Android instead of onClick?
answer count: 1
has comment: http://stackoverflow.com/comment/41595974
favorite count: 0
tagged with: preview
has comment: http://stackoverflow.com/comment/41596096
has comment: http://stackoverflow.com/comment/41580273
tagged with: android
type: AnsweredQuestion
has body: I am working on a project that takes a photo. It is currently working fine when I leave it as is, but when I try to change it so that the picture is attempted to be taken in a different method (rather than being activated by an onClick() method), it errors out every time. Currently the WORKING code is as follows: public class Testing123 extends Activity { private SurfaceView preview=null; private SurfaceHolder previewHolder=null; private Camera camera=null; private boolean inPreview=false; private boolean cameraConfigured=false; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); preview = (SurfaceView)findViewById(R.id.preview); previewHolder = preview.getHolder(); previewHolder.addCallback(surfaceCallback); previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); testing(); //HERE is where I am testing, but cannot get it to work. [See part 2] } public void onResume() { super.onResume(); if (camera == null) { camera=Camera.open(); L.m("Camera open in onResume"); } startPreview(); } public void onPause() { if (inPreview) { camera.stopPreview(); } camera.release(); camera=null; inPreview=false; super.onPause(); } public boolean onCreateOptionsMenu(Menu menu) { new MenuInflater(this).inflate(R.menu.options, menu); return(super.onCreateOptionsMenu(menu)); } public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.camera) { if (inPreview) { camera.takePicture(null, null, photoCallback); //THIS IS WHERE THE PHOTO IS BEING TAKEN inPreview=false; } } return(super.onOptionsItemSelected(item)); } private void initPreview(int width, int height) { if (camera != null &amp;&amp; previewHolder.getSurface() != null) { try { camera.setPreviewDisplay(previewHolder); } catch (Throwable t) { Log.e("PreviewDemo-surfaceCallback", "Exception in setPreviewDisplay()", t); } if (!cameraConfigured) { Camera.Parameters parameters=camera.getParameters(); setCameraResolution(); //Leaving this metho…
has comment: http://stackoverflow.com/comment/41565191
accepted answer: http://stackoverflow.com/a/26480050
tagged with: camera
score: 1
tagged with: java
upvote count: 1
tagged with: surface

objectdb
tags question: http://stackoverflow.com/q/26454867
tags question: http://stackoverflow.com/q/26384420
tag name: objectdb
tags question: http://stackoverflow.com/q/26419194
tags question: http://stackoverflow.com/q/26429041
type: Tag

http://stackoverflow.com/a/26403687
answers question: http://stackoverflow.com/q/26403573
score: 0
has comment: http://stackoverflow.com/comment/41484685
has body: create an encrypted serial key with the information you need, i.e expiry date, type, etc program should decrypt at startup, and do necessary checks have a method call check if the client is using an expired licence, if so, disable certain features. However there are many ways to do this, and you should in no way rely on this being foolproof, if someone wants to break it, they will. rather focus on making your application as awesome as possible.
type: Answer
has comment: http://stackoverflow.com/comment/41606114
has comment: http://stackoverflow.com/comment/41458975
has comment: http://stackoverflow.com/comment/41456504

http://stackoverflow.com/q/26425664
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41497195
tagged with: java
upvote count: 1
downvote count: 1
tagged with: xquery
type: Question
score: 0
has body: I want to remove XML node from XML based on jQuery result. I have XML like this: <?xml version="1.0" encoding="UTF-8"?> 0001 0002 0003 0003 0002 0001 0001 0003 0004 I want to remove complete tag whose name is equal to 'james' so that XML should look like this <?xml version="1.0" encoding="UTF-8"?> 0003 0002 0001 0001 0003 0004 I am using following code to get node and delete it but getting same XML as an output. It is not deleting XML node instead giving same XML. So, how to use xQuery and remove XML node from XML?
answer count: 1
has answer: http://stackoverflow.com/a/26444949
favorite count: 0
has comment: http://stackoverflow.com/comment/41496795
has title: Removing XML node using Java
has comment: http://stackoverflow.com/comment/41497750
accepted answer: http://stackoverflow.com/a/26444949
has comment: http://stackoverflow.com/comment/41520194
has comment: http://stackoverflow.com/comment/41503791
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/41613938
type: QuestionComment
comment on: http://stackoverflow.com/q/26489376
has text: @Doomsknight - no, this is not a duplicate. And the target of your link is a horribly confused question anyway, where the poster says "internal" but actually means "external".
score: 0
type: Comment

http://stackoverflow.com/q/26414122
score: 1
tagged with: java
upvote count: 1
tagged with: jaxb
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41476343
tagged with: unmarshalling
has answer: http://stackoverflow.com/a/26414778
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/26414778
has body: I need some help with unmarshalling some XML. Especially with unmarshalling a list of elements. See the following example: @XmlRootElement(name="element") public class Element { private ArrayList&lt;Element&gt; children; public ArrayList&lt;Element&gt; getChildren() { return children; } @XmlElementWrapper(name = "children") @XmlElement(name = "element") public void setChildren(ArrayList&lt;Element&gt; children) { this.children = children; } } This will unmarshal the list perfectly, BUT what I need is an unmarshalling of all children element by element and adding them through some "addElement" method: public void addElement(Element element) { children.add(element) } Is this possible with some simple annotation magic? Of course I could loop through the elements and call "addElement".
has title: JAXB unmarshal list element by element
has comment: http://stackoverflow.com/comment/41476217
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41477238

http://stackoverflow.com/a/26413294
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26413245
type: AcceptedAnswer
downvote count: 0
has body: no. as long as no removes or adds are done the array won't be resized (and thus recreated) and each get(i) call will be safe
type: Answer
accepted answer of: http://stackoverflow.com/q/26413245

http://stackoverflow.com/comment/41453149
has text: it is possible http://stackoverflow.com/questions/271609/multiple-java-versions-running-concurrently-under-windows
comment on: http://stackoverflow.com/q/26399771
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/26436027
tagged with: java
has comment: http://stackoverflow.com/comment/41777805
type: Question
has comment: http://stackoverflow.com/comment/41752847
tagged with: stateless-session-bean
score: 0
has comment: http://stackoverflow.com/comment/41694436
has comment: http://stackoverflow.com/comment/41747814
tagged with: ejb-3.0
tagged with: jboss5.x
has comment: http://stackoverflow.com/comment/41738125
has title: EJB3: Stateless beans: How to timeout all at once
answer count: 0
has body: Is it possible to timeout all stateless beans at once? IF possible, how?
has comment: http://stackoverflow.com/comment/41697998
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41593700

http://stackoverflow.com/a/26397177
has body: One way: cpu.stream().mapToDouble(a -&gt; a).average().getAsDouble();
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26397022
has comment: http://stackoverflow.com/comment/41450501
answers question: http://stackoverflow.com/q/26397022
downvote count: 0
has comment: http://stackoverflow.com/comment/41446009
has comment: http://stackoverflow.com/comment/41445874

http://stackoverflow.com/comment/41617114
type: Comment
comment on: http://stackoverflow.com/q/26491616
score: 0
has text: Yes, that is the problem. How do I go about checking to see if args[0] is a directory? And if it is, create a new File object to list its contents like I do with the current directory.
type: QuestionComment

http://stackoverflow.com/q/26453295
tagged with: java
has comment: http://stackoverflow.com/comment/41548436
has title: How to make asynchroneous loader with LoadingCache<K,V>?
type: Question
tagged with: caching
score: 0
has answer: http://stackoverflow.com/a/26453538
answer count: 1
tagged with: asynchronous
type: UnansweredQuestion
has body: The Guava's APIs for AbstractLoadingCache and CacheLoader full of words "thread-safe" and "asynchronous". Unfortunately, I can't deduce from API, how is it possible to create asynchronous postponed loader with it. For example, they have a sample CacheLoader&lt;Key, Graph&gt; loader = new CacheLoader&lt;Key, Graph&gt;() { public Graph load(Key key) throws AnyException { return createExpensiveGraph(key); } }; LoadingCache&lt;Key, Graph&gt; cache = CacheBuilder.newBuilder().build(loader); Now I want to check, if value for some key is contained in cache and, if YES, then draw graph. But if NO, then draw stub, initiate loading and continue to work (GUI). Then, when loading will finish, draw graph. Is it possible?
tagged with: guava

http://stackoverflow.com/a/26450091
has comment: http://stackoverflow.com/comment/41548692
has comment: http://stackoverflow.com/comment/41791627
has comment: http://stackoverflow.com/comment/41855324
score: 10
has body: I haven't tried this, but I would simply add 1 (or 2, if you want both a header and footer) to the integer returned by getItemCount in your adapter. You can then override getItemViewType in your adapter to return a different integer when i==0: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#getItemViewType(int) createViewHolder is then passed the integer you returned from getItemViewType, allowing you to create or configure the view holder differently for the header view: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter.html#createViewHolder(android.view.ViewGroup, int) Don't forget to subtract one from the position integer passed to bindViewHolder.
has comment: http://stackoverflow.com/comment/41548998
has comment: http://stackoverflow.com/comment/41542497
has comment: http://stackoverflow.com/comment/41548463
has comment: http://stackoverflow.com/comment/41546760
has comment: http://stackoverflow.com/comment/41548389
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/41549579
has comment: http://stackoverflow.com/comment/41551238
has comment: http://stackoverflow.com/comment/41548472
downvote count: 0
answers question: http://stackoverflow.com/q/26448717

http://stackoverflow.com/comment/41615058
score: 0
comment on: http://stackoverflow.com/q/26489171
has text: Actually,the above query not working...I am getting all the rows
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/63288389
has text: @gaurav jain, If you check the WakefulBroadcastReceiver source you can see that the wake lock is acquired for no more than 60 seconds. If you did not finish your processing within this time frame the CPU may go to sleep.
type: Comment
comment on: http://stackoverflow.com/a/26380942
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41849114
comment on: http://stackoverflow.com/a/26446743
score: 0
type: Comment
type: AnswerComment
has text: Yes, I called the start method. It was set to run a very large number of times (200000 I think). Giving it a boolean flag to check each time it runs and setting the flag to false when I want to get rid of the object AND also removing it from the list worked.

http://stackoverflow.com/a/26478096
upvote count: 1
has body: Instead of painting directly to the Graphics context, you could generate a BufferedImage image of what you want painted and paint to that instead... private BufferedImage buffer; public BufferedImage generate() { if (buffer == null) { buffer = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_IMAGE_ARGB); Graphics2D g2d = buffer.createGraphics(); // Paint away... g2d.dispose(); } return buffer; } Then you would paint the result within the paintComponent method... public void paintComponent(Graphics g) { super.paintComponent(g); // Calls multiple times BufferedImage img = generate(); g.drawImage(img, 0, 0, this); } As an example...
score: 1
answers question: http://stackoverflow.com/q/26477800
downvote count: 0
type: Answer

http://stackoverflow.com/a/26469393
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26469200
answers question: http://stackoverflow.com/q/26469200
has comment: http://stackoverflow.com/comment/41581982
has body: Replace all \D (non digits) with blank: str = str.replaceAll("\\D", ""); Or use a date format, since a java.sql.Timestamp is a Date: SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSS"); String str = sdf.format(timestamp);
score: 4

http://stackoverflow.com/comment/41447257
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26397963
has text: @JBNizet I want to sort a single row of ints at a time. Not the whole thing.
score: 0

http://stackoverflow.com/comment/41378028
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26359840
has text: Very interesting. As pointed out by other replies, your working case falls into the case of common usage of the continue statement in java, which means to skip the remaining operations in a loop and start at once with the next iteration. The example in the JLS documentation use labels and "continue" the way you want to use them, namely as goto, but it does not go out of its current scope, as you do in your broken case. I will test some more in this direction. Thank you for this example!

http://stackoverflow.com/comment/41632327
comment on: http://stackoverflow.com/q/26470861
score: 0
type: Comment
type: QuestionComment
has text: @greenapps stackoverflow.com/a/8475135/1907445

http://stackoverflow.com/comment/41630117
type: AnswerComment
score: 0
type: Comment
has text: Thank you. Already obtained a value in the InputStream. Edited the question and followed your suggestion.
comment on: http://stackoverflow.com/a/26486822

http://stackoverflow.com/a/26494963
type: Answer
has comment: http://stackoverflow.com/comment/41623474
answers question: http://stackoverflow.com/q/26494775
has body: The ArrayList is empty as the the task is still running. Do what you need to do in the OnPostExecute method, it's safely executed in the UI thread and you could everything you need here.
accepted answer of: http://stackoverflow.com/q/26494775
has comment: http://stackoverflow.com/comment/41623402
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41753070
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26559889
has text: I messed something up. OK, I've downloaded two Eclipse on my Mac pro. So, the other one was previously working fine. I mistook it for the nonfunctioning one. Sorry for this. So now when I was trying to make this nonofunctioning one to work and followed your steps, it's not working, so when I tried to use the path, it always says "The home directory does not exist", as this pic shows: http://postimg.org/image/54hu8ngkx/, however, as you taught me, I did look for "/Home/", starting from /Library/, here's the path pic: http://postimg.org/image/cxu9xj4qf/, everything looks right.

http://stackoverflow.com/comment/41570279
score: 0
comment on: http://stackoverflow.com/q/26465913
type: Comment
type: QuestionComment
has text: just text your query hear and let me know your data type in db

http://stackoverflow.com/comment/41400781
comment on: http://stackoverflow.com/q/26371945
type: QuestionComment
has text: Will there only be integers or do you expect strings to be present randomly in between? Either way you might want to check out what the Scanner class in java http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
score: 0
type: Comment

http://stackoverflow.com/comment/61117303
score: 1
has text: @david Just wanted to say (even if this question is kind of old) that this answer is totally valid because it helped me out to solve this very same issue.
type: Comment
comment on: http://stackoverflow.com/a/26492478
type: AnswerComment

http://stackoverflow.com/comment/41661226
score: 0
type: Comment
type: QuestionComment
has text: because you create the iterator at init, and `add` is necessarily called after that. hence, concurrentmodification
comment on: http://stackoverflow.com/q/26512858

http://stackoverflow.com/a/26432152
downvote count: 0
answers question: http://stackoverflow.com/q/26366478
upvote count: 2
type: Answer
score: 2
has body: What is published -as of this writing - in Maven for Scala 2.11 is SecureSocial 3.0-M1. The published docs are for the 2.1.x version. Identity was removed and is not needed any more. The idea is that you can specify the type you want to represent users without being forced to inherit or implement any other type. You can read the online docs to understand some concepts and then use the samples which are updated to use the new API here: https://github.com/jaliss/securesocial/tree/3.0-M1/samples.

http://stackoverflow.com/q/26490633
tagged with: compare
has comment: http://stackoverflow.com/comment/41615341
has answer: http://stackoverflow.com/a/26490749
has answer: http://stackoverflow.com/a/26490709
has comment: http://stackoverflow.com/comment/41645476
has answer: http://stackoverflow.com/a/26491325
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26490722
linked to: http://stackoverflow.com/q/14897366
downvote count: 1
has comment: http://stackoverflow.com/comment/41615209
has body: Wasn't sure whether to make a new thread or not. but i'll post it here. I figured my explanation was not very good. i have a class below lets say int[] = 1204, 1205 public class Job { private int[] serviceCode =; public Job (int[] jobCode) { serviceCode = jobCode; } public int[] getJobCode() { return serviceCode; } and this is the main program public class MainProgram { public static void main { } } how do i put the values of the array into separate integers?
has title: java comparing values in arrays
tagged with: java
type: UnansweredQuestion
answer count: 4
tagged with: arrays
has comment: http://stackoverflow.com/comment/41615161
favorite count: 0
type: Question

http://stackoverflow.com/comment/41518150
comment on: http://stackoverflow.com/q/26436810
type: QuestionComment
type: Comment
has text: @mp_ Actually, I need to send this byte array in network byte order over the network to my c++ program as an input from Java so that's why.
score: 1

http://stackoverflow.com/comment/41525689
has text: @wrongAnswer, I had the (Line 1) in there so those of you who read my code know what I mean by Line 10. It was merely a reference.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26430630

http://stackoverflow.com/comment/41567309
type: Comment
comment on: http://stackoverflow.com/a/26464589
has text: I have a doubt here since the MY_VARIABLE is declared in the maven.properties file which is in another directory (src/test/resources) will it not throw an error if i do this directly .. How do i naviate to the directory first ?
type: AnswerComment
score: 0

http://stackoverflow.com/a/26479467
has comment: http://stackoverflow.com/comment/41595274
has comment: http://stackoverflow.com/comment/41595371
has body: java.awt.Frame does not have a method called setDefaultCloseOperation, I think you want to use javax.swing.JFrame Having said that, you shouldn't be extending directory from a top level container like JFrame, this is bad practice as you're not really adding any value to the class, reduces the re-usability of your class (as you can't add it to anything else) and locks you into a single presentation implementation...you can add it to anything else... Bad... class UseButton extends Frame{ Good... class UseButton extends JFrame{ Better... import java.awt.EventQueue; import java.awt.Frame; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class UseButton { public static void main(String... args) { new UseButton(); } public UseButton() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private JButton b; private JTextField text; public TestPane() { b = new JButton("OK"); add(b); } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/41595227
score: 8
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/26479429

http://stackoverflow.com/comment/41546491
type: QuestionComment
has text: will try that thanks... but y they are down-voting my question? do u know?
comment on: http://stackoverflow.com/q/26452710
score: 0
type: Comment

http://stackoverflow.com/q/26421113
has title: How to make 1,293.34 become 129.33 in textview on android?
has answer: http://stackoverflow.com/a/26421134
type: Question
possible better answer: http://stackoverflow.com/a/26421384
tagged with: android
has answer: http://stackoverflow.com/a/26421384
score: -2
accepted answer: http://stackoverflow.com/a/26421134
answer count: 4
favorite count: 0
has body: Is there a method that make the number that inside the textview like examples below? input &gt; output: 123.23 -&gt; 12.32 4,593.78 -&gt; 459.37 It is a backspace function like the calculator button the number is backwards ( delete the last digit and move the decimal forwards I juz try sample code like this // Get edit text characters String textInBox = atmdisplay.getText().toString(); if(textInBox.length() &gt; 0) { //Remove last character// String newText = textInBox.substring(0, textInBox.length()-1); // Update edit text atmdisplay.setText(newText); } } it only delete the whole digit starting at last digit one by one.
has answer: http://stackoverflow.com/a/26421263
upvote count: 1
has answer: http://stackoverflow.com/a/26421925
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41488090
tagged with: java
downvote count: 3

http://stackoverflow.com/q/26451027
has comment: http://stackoverflow.com/comment/41543481
tagged with: java
has comment: http://stackoverflow.com/comment/41543478
linked to: http://stackoverflow.com/q/5312334
has comment: http://stackoverflow.com/comment/41543603
type: Question
has body: The question is simple, How to ignore settings or other button function when android application is running ? We have an application, everything is fine, but when we press the button (hardware on our mobile phone) the application closes with error (Unfortunately, application has stopped) We just want to ignore the settings button and close the application when the "back" (&lt;-) button is pressed. Thank you for your answers.
tagged with: function
has comment: http://stackoverflow.com/comment/41543554
has comment: http://stackoverflow.com/comment/41543442
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/41543504
score: 0
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/26451149
type: UnansweredQuestion
has title: How to ignore settings or other button function when android application is running
has comment: http://stackoverflow.com/comment/41543515

http://stackoverflow.com/comment/41660742
has text: I thought about doing this, but it would be ridiculously inaccurate, what if the player disconnected one minute after the 10-minute check during a multiplayer raid, then he couldn't log back in for another 9 minutes, because his "Account is already logged in."? That doesn't sound very efficient. When the connection is forcefully closed there is an Exception that's thrown, but I can't figure out which exception it is, (I guess I'm not throwing it anymore, but I used to)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26500816
type: AnswerComment

http://stackoverflow.com/a/26500729
type: Answer
answers question: http://stackoverflow.com/q/26396677
score: 0
has body: To load data at start up override loadAllKeys method first or if you do not want it than use selected keys to load with oveloaded loadAll method

http://stackoverflow.com/comment/41523545
has text: What does your logcat say?
comment on: http://stackoverflow.com/q/26439898
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26375411
has title: Compile Error:variables strElement,StrRow, and strMatrix already defined in method toString(), Whats Wrong?
score: -3
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26375465
has answer: http://stackoverflow.com/a/26375441
possible better answer: http://stackoverflow.com/a/26375465
has answer: http://stackoverflow.com/a/26375468
answer count: 3
has body: I keep on getting a compile error thats saying strElement,strRow, and strMatrix are already defined. What am I doing wrong? public String toString() { String strMatrix; String strRow; String strElement; for(int i = 0; i &lt; matrix.length; i++) { for(int j = 0; j &lt; matrix[i].length; j++) { String strElement = String.valueOf(matrix[i][j]); String strRow = strRow + strElement + "\t"; } String strMatrix = strMatrix + strRow + "\n"; } return strMatrix; }
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/26375441
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/41423542
has text: It is look like you convert it wrong
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26384257

http://stackoverflow.com/comment/41392676
type: QuestionComment
comment on: http://stackoverflow.com/q/26367691
score: 0
has text: The file `R` will only be generated if there are no remaining compilation errors. Check the `error` view (commonly in tab above the console) for information about errors and warnings.
type: Comment

http://stackoverflow.com/q/26445037
tagged with: md5
downvote count: 1
type: Question
upvote count: 0
has body: I understand md5 is mostly used for file checksum and we can use following code in java to generate md5 digest. MessageDigest md = MessageDigest.getInstance("MD5"); try (InputStream is = Files.newInputStream(Paths.get("file.txt"))) { DigestInputStream dis = new DigestInputStream(is, md); /* Read stream to EOF as normal... */ } byte[] digest = md.digest(); But I'd like to know what exactly is the input of the md function? the meta data of file or the text in file?
has comment: http://stackoverflow.com/comment/41533036
score: -1
tagged with: security
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26445059
type: UnansweredQuestion
has title: input for md5 hashfunction in file checksum application
tagged with: java

http://stackoverflow.com/comment/61214602
type: Comment
comment on: http://stackoverflow.com/q/26482861
type: QuestionComment
has text: please be specific with test report, like what test report ?
score: 0

http://stackoverflow.com/a/26496314
has comment: http://stackoverflow.com/comment/41630606
has comment: http://stackoverflow.com/comment/41631437
has comment: http://stackoverflow.com/comment/41627863
has body: Have the beginning of your main method show: public static void main(String args[]) { double smallest = 0.0; double north = getNumAccidents(smallest); double south = getNumAccidents(smallest); double east = getNumAccidents(smallest); double west = getNumAccidents(smallest); double central = getNumAccidents(smallest); ... And in your getNumAccidents method, since it is declared as a double, you need to return a double value: ... smallest = input.nextDouble(); return smallest; } This won't fix the program entirely, but it'll help you figure things out as you go along.
type: Answer
answers question: http://stackoverflow.com/q/26495942
has comment: http://stackoverflow.com/comment/41631116
has comment: http://stackoverflow.com/comment/41627383
has comment: http://stackoverflow.com/comment/41631285
has comment: http://stackoverflow.com/comment/41631017
score: 0

http://stackoverflow.com/comment/41495040
has text: it doesn't work neither, doing this seems to be same as: byte[] data = android...decode(to_decode.getBytes(), DEFAULT);
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26424950

http://stackoverflow.com/a/26390834
has comment: http://stackoverflow.com/comment/41435174
upvote count: 7
type: Answer
has body: When you put something in a HashMap, the hashCode() method is called on the key, not the value. So in this case, it's the hashCode from String that gets called on s1.getName() and s2.getName().
answers question: http://stackoverflow.com/q/26390812
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/41435109

http://stackoverflow.com/a/26376933
has body: I think this will fix your problem. public static void additem(String type, java.util.List&lt;Integer&gt; list){ ... } I suspect you just use java.awt.List
has comment: http://stackoverflow.com/comment/41410872
score: 0
answers question: http://stackoverflow.com/q/26376635
type: Answer

http://stackoverflow.com/comment/41594754
type: AnswerComment
comment on: http://stackoverflow.com/a/26455288
has text: Thanks a lot! Big help; finding a pattern was my first approach but I couldn't expand on it. I think I was so used to just nesting for loops within each other but didn't realize that nesting two separate ones into one will do the trick. Thanks for the big help!
type: Comment
score: 0

http://stackoverflow.com/q/26511903
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/41654058
has title: Getting Java OutOfMemory Heap Space error while generating large arrays of type double (> 60 million obs)
favorite count: 0
tagged with: heap-memory
has answer: http://stackoverflow.com/a/26512919
score: 1
type: UnansweredQuestion
has body: I am trying to generate arrays of type double, which can reach sizes in excess of 60 million. Moreover, I need to iteratively generate larger and larger arrays (begin with say 20000, iterate through my code x no. of times successively inflating my array size by a factor of 10 or 2, depending on the output in an iteration). At the end of each iteration i, I am setting the reference of my array of size xi to null, then pointing it to a newly generated array of size x(i+1) which is > xi. However, I am eventually running out of memory in eclipse with the usual Java Heap space out of memory error. I tinkered with the Xmx, Xms values in the eclipse.ini but with no luck. I also tried the System.gc() to suggest garbage collection to java after setting the array reference to null, again with no luck. I need these large arrays because I am simulating a random process, collecting its output in these arrays (so I am using some additional objects to generate this array which also use up some memory). Then I feed this array to my main algorithm which performs a set of statistical computations on it. I get the out of memory error while generating the array with additional number of observations. Is there anyway that I can overcome this out of memory issue? Would setting individual elements of array to null instead of the array itself help in freeing up the memory? Thanks in advance for for any advice.
has answer: http://stackoverflow.com/a/26512771
upvote count: 1
has comment: http://stackoverflow.com/comment/41654738
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/26485650
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41630132
tagged with: multithreading
has body: I've learned that I have to attach the c-threads to the jvm with jvm-&gt;AttachCurrentThread everytime I use the JNIEnv. This should be quite similar to a mutex, I lock it with jvm-&gt;AttachCurrentThread at the beginning of the method and unlock it with jvm-&gt;DetachCurrentThread() at the end. So, now I have a method where I use the JNIEnv moreoften. Do I have to call AttachCurrentThread everytime? Here you have a code sample: std::unique_ptr&lt;IState&gt; JNIGame::createEmptyState() { JNIEnv* env; jvm-&gt;AttachCurrentThread((void**)&amp;env, NULL); if(!jGame_createEmptyState) jGame_createEmptyState = env-&gt;GetMethodID(jGameC, "createEmptyState", "()Ljni/JNIGames$IJNIState;"); JNIState *state = new JNIState(); //needed? jvm-&gt;AttachCurrentThread((void**)&amp;env, NULL); state-&gt;jStateO = env-&gt;CallObjectMethod(jGameO, jGame_createEmptyState); jvm-&gt;DetachCurrentThread(); return std::unique_ptr&lt;IState&gt;(state); } As you see, I attach the thread two times, because without the second one, the code crashes. But if they act like mutex, only the first one would be needed. Could you help me, why I need them every time? Is it save like the code is now?
type: Question
accepted answer: http://stackoverflow.com/a/26487083
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/41646301
tagged with: http://stackoverflow.com/tag/c
answer count: 2
has answer: http://stackoverflow.com/a/26487092
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26487092
upvote count: 2
has title: Multithreaded JNI-Calls
has answer: http://stackoverflow.com/a/26487083
has comment: http://stackoverflow.com/comment/41608566
has comment: http://stackoverflow.com/comment/41610254
has comment: http://stackoverflow.com/comment/41610490
tagged with: c++

http://stackoverflow.com/a/26427219
downvote count: 0
has body: you can control what import or not in the result manifest just adding this into the instructions tag: !DontWantThisPackage Btw, some of commons-validator dependencies are already bundle, so don't make sense to embed then in your bundle. In order to embed dependencies I suggest you to add them directly in your bundle dependencies (instead to use the transitive ones)
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26410292

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/26448923
tags question: http://stackoverflow.com/q/26512892

http://stackoverflow.com/q/26383069
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41452807
type: UnansweredQuestion
tagged with: android
has title: Java PrivateKey differs from Android
score: 2
has comment: http://stackoverflow.com/comment/41452265
has comment: http://stackoverflow.com/comment/41451492
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41450775
has answer: http://stackoverflow.com/a/26402029
tagged with: private-key
has body: I actually have a problem with encryption in Android. For testing I created a program which generates a signature using RSA and SHA. public static byte[] generateKey(String privKeyModulus, String privKeyD, String encryptCredentials) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, UnsupportedEncodingException, SignatureException { byte[] modulusBytes = Base64.getDecoder().decode(privKeyModulus.getBytes()); byte[] dBytes = Base64.getDecoder().decode(privKeyD.getBytes()); BigInteger modulusInt = new BigInteger(1, modulusBytes); BigInteger dInt = new BigInteger(1, dBytes); RSAPrivateKeySpec rsaPrivKey = new RSAPrivateKeySpec(modulusInt, dInt); KeyFactory factory = KeyFactory.getInstance("RSA"); PrivateKey privKey = factory.generatePrivate(rsaPrivKey); // Here is the problem: System.out.println(Arrays.toString(privKey.getEncoded())); Signature sig = Signature.getInstance("SHA1withRSA"); sig.initSign(privKey); sig.update((encryptCredentials).getBytes("UTF-16LE")); byte[] signature = sig.sign(); return signature; } Now the problem is that I get different values as PrivateKey in Java and Android. That confuses me because the method is exactly the same in both programs and it is java.security which should work in both Java and Android. I also checked all of the other values (like the byte[] etc) but they are all the same. Do you have any help?

http://stackoverflow.com/a/26434588
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26434557
has body: It is the expected result of downcasting to an int a large number that is too large to fit in the valid range of an int. You are getting Integer.MAX_VALUE as a double. Section 5.1.3 of the JLS states: A narrowing conversion of a floating-point number to an integral type T takes two steps: In the first step, the floating-point number is converted either to a long, if T is long, or to an int, if T is byte, short, char, or int, as follows: If the floating-point number is NaN (§4.2.3), the result of the first step of the conversion is an int or long 0. a. Otherwise, if the floating-point number is not an infinity, the floating-point value is rounded to an integer value V, rounding toward zero using IEEE 754 round-toward-zero mode (§4.2.3). Then there are two cases: b. If T is long, and this integer value can be represented as a long, then the result of the first step is the long value V. Otherwise, if this integer value can be represented as an int, then the result of the first step is the int value V. Otherwise, one of the following two cases must be true: a. The value must be too small (a negative value of large magnitude or negative infinity), and the result of the first step is the smallest representable value of type int or long. b. The value must be too large (a positive value of large magnitude or positive infinity), and the result of the first step is the largest representable value of type int or long. (emphasis mine) If you need that value preserved, then you can try casting to a long or using BigInteger. If this is supposed to represent money, then I would only use BigDecimal to avoid floating-point representation and calculation issues.
answers question: http://stackoverflow.com/q/26434557

http://stackoverflow.com/comment/41535249
score: 3
comment on: http://stackoverflow.com/q/26446348
type: QuestionComment
type: Comment
has text: Please refer this article. http://stackoverflow.com/questions/955110/similarity-string-comparison-in-java

http://stackoverflow.com/a/26487260
has body: I'm not quite sure if the mouse handler is supposed to be changing the icon on selection: if so remove it. Don't use mouse handlers for detecting selection (what if the user navigates through the tree using the keyboard, for example?). In your constructor, add a listener to the selectedProperty, and change the item accordingly: public AlertTreeCell() { FXMLLoader fxmlLoader = new FXMLLoader( MainController.class .getResource("/fxml/alert_list_item.fxml")); try { cell = (Node) fxmlLoader.load(); rectSeverity = (Rectangle) cell.lookup("#rectSeverity"); mIncedentname = (Label) cell.lookup("#lblIncidentName"); mAlertTitle = (Label) cell.lookup("#lblAlertTitle"); mSentTime = (Label) cell.lookup("#lblSentTime"); mSender = (Label) cell.lookup("#lblSender"); ivCategory = (ImageView) cell.lookup("#ivCategory"); this.selectedProperty().addListener((obs, wasSelected, isNowSelected) -&gt; { String col ; if (isNowSelected) { col = "_black.png" ; } else { col = "_white.png" ; } if (getItem() != null) { Image img = new Image("/images/ic_cat_" + item.getCategoryIcon().toLowerCase() + col); ivCategory.setImage(img); } }); } catch (IOException ex) { mLogger.error(ex.getLocalizedMessage(),ex); } } In the updateItem(...) method, just check isSelected() and set the image accordingly there, but without the listener.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41610264
has comment: http://stackoverflow.com/comment/41611317
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26485475
answers question: http://stackoverflow.com/q/26485475
type: Answer

http://stackoverflow.com/a/26847924
downvote count: 0
has body: I ended up implementing my own adapter to wrap any other adapter and provide methods to add header and footer views. Created a gist here: HeaderViewRecyclerAdapter.java The main feature I wanted was a similar interface to a ListView, so I wanted to be able to inflate the views in my Fragment and add them to the RecyclerView in onCreateView. This is done by creating a HeaderViewRecyclerAdapter passing the adapter to be wrapped, and calling addHeaderView and addFooterView passing your inflated views. Then set the HeaderViewRecyclerAdapter instance as the adapter on the RecyclerView. An extra requirement was that I needed to be able to easily swap out adapters while keeping the headers and footers, I didn't want to have multiple adapters with multiple instances of these headers and footers. So you can call setAdapter to change the wrapped adapter leaving the headers and footers intact, with the RecyclerView being notified of the change.
answers question: http://stackoverflow.com/q/26448717
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/comment/41392350
type: AnswerComment
type: Comment
has text: @NaufalYahaya Yes, I have an idea: use a debugger. Your code snippets are ok, so there is no other way to find the problem.
comment on: http://stackoverflow.com/a/26360973
score: 0

http://stackoverflow.com/comment/41459996
comment on: http://stackoverflow.com/q/26405563
type: Comment
type: QuestionComment
score: 0
has text: Does your person class share common interface?

http://stackoverflow.com/comment/41435278
type: Comment
type: QuestionComment
has text: You would be better by using a `Scanner` on your `String` with `/` as delimiter.
score: 1
comment on: http://stackoverflow.com/q/26391047

http://stackoverflow.com/q/26405691
has body: I have an application with one Spring @Controller annotated with @RequestMapping. Using Spring (core and webmvc) 4.1.0.RELEASE or higher I'm getting exception when starting the app server. java.lang.NoSuchMethodError: org.springframework.web.bind.annotation.RequestMapping.name()Ljava/lang/String; at method RequestMappingHandlerMapping.createRequestMappingInfo(RequestMapping annotation, RequestCondition&lt;?&gt; customCondition) Debugging, using Eclipse inspect, the method variable annotation does not contains name attribute and fails at action annotation.name(). All the other attributes values are correct (they have the values defined in the Controller method annotated with @RequestMapping). I'm using Tomcat 7 and Maven 2.3. mvn dependency:tree does not shows other Spring version than 4.1.0.RELEASE. The error does not occurs when using Spring 4.0.7.RELEASE or lower. Does anyone have any clue?
tagged with: java
has comment: http://stackoverflow.com/comment/41504620
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/26429990
type: Question
has comment: http://stackoverflow.com/comment/41463552
favorite count: 0
has title: Spring MVC. Not recognizing RequestMapping annotation name attribute when loading context
upvote count: 1
tagged with: spring-annotations
tagged with: spring
answer count: 1
has comment: http://stackoverflow.com/comment/41462381
has comment: http://stackoverflow.com/comment/41463420
has answer: http://stackoverflow.com/a/26429990
has comment: http://stackoverflow.com/comment/41463593
tagged with: spring-mvc

http://stackoverflow.com/q/26510382
tagged with: java
tagged with: image
has answer: http://stackoverflow.com/a/26512845
answer count: 1
has body: I'm trying to create this basic photo editing app via java swing. I have my code to work somewhat for when 1 picture is imported; I have 3 views - photo view which displays the photo only, thumbnail view which should display thumbnails of the pictures and split view which should be a combination of photo in BorderLayout.CENTER and thumbnail in BorderLayout.SOUTH. I've put in images and code excerpts as to why this isn't working the way it should. I can't upload any images but hopefully the excerpts provide much detail. Split View Related Excerpts: public void changeMode(boolean p, boolean b, boolean s){ /* * Photo View will display a single PhotoComponent2 in a large area. */ isPhoto = p; if (isPhoto){ //have a child JPanel set as CENTER component of BorderLayout of the JScrollPane (scroll) childPhoto = new JPanel(); childPhoto.add(displayPhotos.get(getCurrentPhoto()), BorderLayout.CENTER); System.out.println("in lc photo view class"); } /* * Browser View will hold all the images. */ isBrowse = b; if(isBrowse){ //have a child JPanel set as CENTER component of BorderLayout to hold grid of thumbnails within // JScrollPanel (scroll) this.removeAll(); childBrowse = new JPanel(); tc2 = new ThumbnailComponent(displayPhotos.get(getCurrentPhoto())); childBrowse.setLayout(new WrapLayout()); childBrowse.add(tc2); // for(int i = 0; i &lt; displayThumbs.size(); i++){ // childBrowse.add(displayThumbs.get(i)); // System.out.println(displayThumbs.get(i)); // } System.out.println("in lc browser view class"); } /* * Split View is a combination of Photo and Browser View in that the top half * is Photo View and the bottom half is Browser View. */ isSplit = s; if(isSplit){ //have a child JPanel in CENTER to hold PhotoComponent plus a child JPanel in SOUTH to hold thumbnails containsAll = new JPanel(); containsAll.setLayout(new BorderLayout()); containsAll.add(childPhoto, BorderLayout.CENTER); containsAll.add(childBrowse, BorderLayout.SOUTH); System.out.println("in lc split view class")…
score: 0
has title: Formatting JPanel to Include ArrayList<JComponent> and Split View depending on view mode clicked
type: UnansweredQuestion
tagged with: swing
type: Question

http://stackoverflow.com/q/26427161
has answer: http://stackoverflow.com/a/26428097
score: 4
has body: I have implement a simple JAAS module with realm configuration on Tomcat 7. It works properly when specifying the jaas.conf file in the catalina.sh like so JAVA_OPTS=$JAVA_OPTS "-Djava.security.auth.login.config==$CATALINA_BASE/conf/jaas.config" However, I wanted to simplify my application by adding this config file internally to the web application. Documentation states that you can use the configFile param "The name of a JAAS configuration file to use with this Realm. It will be searched for using ClassLoader#getResource(String) so it is possible for the configuration to be bundled within a web application. If not specified, the default JVM global JAAS configuration will be used." My context.xml in my web app: &lt;Realm appName="AppLogin" className="org.apache.catalina.realm.JAASRealm" configFile="WEB-INF/jaas.config" ...../&gt; The config file is located /WEB-INF/jaas.config Why is my jaas config file not being loaded? http://tomcat.apache.org/tomcat-7.0-doc/config/realm.html#JAAS_Realm_-_org.apache.catalina.realm.JAASRealm
upvote count: 4
has title: JAAS Realm load internal config file
answer count: 2
possible better answer: http://stackoverflow.com/a/29039851
tagged with: jaas
downvote count: 0
has answer: http://stackoverflow.com/a/29039851
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/26428097
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41605245
comment on: http://stackoverflow.com/q/26485413
has text: Unfortunately [this is how Oracle functions](http://stackoverflow.com/q/13278773/1134080). You may consider switching to PostgreSQL or MySQL which function differently.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/41531645
type: Comment
type: QuestionComment
has text: -1 for posting potentially dangerous code. Moderators have been flagged.
comment on: http://stackoverflow.com/q/26444175
score: 2

http://stackoverflow.com/q/26453937
answer count: 1
has answer: http://stackoverflow.com/a/26454030
has title: While loop ignoring try-catch
tagged with: exception
type: AnsweredQuestion
tagged with: java
tagged with: loops
type: Question
linked to: http://stackoverflow.com/q/6612806
has body: I have a while loop running in order to make sure the user enters proper information. However, it doesn't go through the loop to ask the user again. For example, if I enter "k" when it is looking for an integer, it will not go through any of the program, instead nothing will be output and the program is stuck. I found a question similar to this problem, however the solution offered still does not work. While before my program would skip the while loop and continue, now it is caught doing nothing for eternity. while (errorLoop) { try { if (kb.hasNextInt()) { Player.setBet(kb.nextInt()); } } catch (InputMismatchException e) { System.out.println("Please enter a positive number."); } if (Player.getBet() &gt; 0) { errorLoop = false; } }
accepted answer: http://stackoverflow.com/a/26454030
score: 0

http://stackoverflow.com/q/26389764
tagged with: declarative-services
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/3994251
score: 1
favorite count: 0
tagged with: osgi
has answer: http://stackoverflow.com/a/26391360
has title: How to configure OSGI Declarative Service scope?
tagged with: java
upvote count: 1
has body: Can someone please explain me how to configure OSGI DS to be a singleton? I use Equinox as OSGi container. SCR component &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Simple Dictionary"&gt; &lt;implementation class="foo.bar.services.DictionaryImpl"/&gt; &lt;service&gt; &lt;provide interface="foo.bar.services.Dictionary"/&gt; &lt;/service&gt; &lt;/scr:component&gt; OSGI console output osgi> services (objectClass=foo.bar.services*) {foo.bar.services.Dictionary}={ component.name=Simple Dictionary, component.id=0, service.id=51, service.bundleid=7, service.scope=bundle } "Registered by bundle:" foo.bar.services_1.0.0.qualifier [7] "No bundles using service."
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26391360

http://stackoverflow.com/comment/41442764
type: AnswerComment
type: Comment
has text: Maintain two separate WS calls.(make sure a relation exists between this two calls to form as one result).
comment on: http://stackoverflow.com/a/26389260
score: 0

http://stackoverflow.com/comment/41535168
comment on: http://stackoverflow.com/a/26446292
type: Comment
has text: Oh good Lord, I cannot believe I forgot about that. Thank you very kindly!
score: 0
type: AnswerComment

http://stackoverflow.com/q/26396100
answer count: 1
tagged with: onpaint
has title: Free hand Drawring on JFrame, Color + Point[] Storage and rendering failing
accepted answer: http://stackoverflow.com/a/26396269
tagged with: rendering
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/41443860
tagged with: arrays
has body: The following program is supposed to allow free hand drawing on the one frame and the other as a button to open the color selector. The code for the main class can be found: package clickTesting; import Desksnap.Utils.Line; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.LinkedList; import java.util.List; public class Main { public static Color currentColor = null; public static void main(String[] args) { Viewer gui = new Viewer(); button gui1 = new button(); gui.setVisible(true); gui1.setVisible(true); boolean lol = true; while (lol) { gui.repaint(500); } } static class Viewer extends JFrame implements MouseMotionListener, MouseListener { public List&lt;Line&gt; lines = new LinkedList&lt;Line&gt;(); private int index = 0; private Point[] arr = new Point[100000]; public Viewer() { addMouseListener(this); addMouseMotionListener(this); } private void initComponents() { PhotoWindow = new JFrame(); setUndecorated(true); { Container PhotoWindowContentPane = PhotoWindow.getContentPane(); PhotoWindowContentPane.setLayout(null); PhotoWindowContentPane.setPreferredSize(new Dimension(410, 539)); PhotoWindow.pack(); PhotoWindow.setLocationRelativeTo(PhotoWindow.getOwner()); addMouseListener(this); } } private JFrame PhotoWindow; @Override public void mousePressed(MouseEvent e) { arr[index] = new Point(e.getX(), e.getY()); index++; System.out.println(index); } @Override public void mouseReleased(MouseEvent e) { lines.add(new Line(Main.currentColor, arr)); arr = new Point[100000]; index = 0; System.out.println("Released"); } @Override public void mouseDragged(MouseEvent e) { arr[index] = new Point(e.getX(), e.getY()); index++; System.out.println(index); } @Override public void paint(Graphics g) { super.paintComponents(g); if (lines.size() &gt;= 0) { for (Line z : lines) { if (z != null) { Point[] lel = z.getLine(); g.setColor(z.getColor()); if (lel != null)…
has comment: http://stackoverflow.com/comment/41443834
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26396269
tagged with: repaint
type: Question
has comment: http://stackoverflow.com/comment/41443880

http://stackoverflow.com/q/26421406
has body: Is there any resource describing java: URL scheme? I went through JNDI tutorial, EE specs, googled... and all I could find is: "enterprise namespace is rooted in a URL context for the java URL scheme" - so it should follow URL convention, but no concrete example or rule turned up in my quest. Even IANA does not have definition of java: scheme - even though it has jdbc: and jar:
upvote count: 2
has answer: http://stackoverflow.com/a/45689665
type: Question
tagged with: java
has title: Is there any resource describing java: URL scheme?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/a/26463056
answers question: http://stackoverflow.com/q/26462912
downvote count: 0
type: Answer
has body: Factories are a whole group of techniques for making objects. An abstract factory is an interface to something which can create an object for you. You do not specify how it makes it, the instance of the factory has its own way of making that particular object or group of objects. A factory method is a method on a class to help you make an instance of that class. You don't generally use if/else statements in factories because: With an abstract factory the instance of factory you have determines how it will work With a factory method the particular method you call determines the sort of thing you're making. A good jumping on point is here - http://en.wikipedia.org/wiki/Creational_pattern
score: 2
upvote count: 2

http://stackoverflow.com/comment/41608382
score: 0
comment on: http://stackoverflow.com/q/26485936
has text: the abstract class should have implements Persistable<Long>
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26400538
has body: I have an application where I have implemented Oracle AQ. I noticed that there is a delay of few seconds in consumption of message by JMS Push consumer, after message has been produced to AQ. I ran this scenario where I produced a few messages in to AQ like 10 messages in an hour. I noticed that there was a few seconds delay in consumption of message. I calculated average delay time in such scenario and it came out to be 12 seconds and maximum delay time came out to be 13.5 seconds. But when I increased my rate of production to 1000 messages in an hour. I saw less delay in consumption. and I got an constant average of 5 seconds, with maximum delay of 5.2 seconds. I can assume that there might be some sleep time for JMS consumer thread But I'm bit confused as I'm using Push consumer instead of Poll consumers. Please help me to find out reason for such delay and how can I shorten this gap of time. ~Thanks
score: 0
answer count: 1
tagged with: oracle-aq
tagged with: jms
has answer: http://stackoverflow.com/a/26496502
type: AnsweredQuestion
tagged with: java
type: Question
has title: JMS Push Consumer delay in getting message from Oralce AQ
accepted answer: http://stackoverflow.com/a/26496502

http://stackoverflow.com/comment/82150599
score: 2
type: AnswerComment
has text: Hi, how to make this code work if the websocketServer is sending a continuous stream of messages and websocketClient needs to consume the messages one by one? I get the error "The decoded text message was too big for the output buffer and the endpoint does not support partial messages" after running the code for about a minute
type: Comment
comment on: http://stackoverflow.com/a/26454417

http://stackoverflow.com/q/26432913
possible better answer: http://stackoverflow.com/a/26433047
favorite count: 0
accepted answer: http://stackoverflow.com/a/26432950
type: AnsweredQuestion
tagged with: foreach
has body: Hello amazing people of stackoverflow. This is my first time posting so I apologize beforehand if I make any mistakes! The question for this assignment is: Write a static method method called longest, which is passed an ArrayList of strings, and which returns the length of the longest string in the array, an int. (Of course several may have the longest value). You MUST use a for-each loop in your solution. Here's my code: public static int longest(String[] data){ int longString = 0; for(String s : data) { if (s.length() &gt; longString) longString = s.length(); } return longString; } I keep getting the general compiler error in the hw submission box - no specifics. I've looked at my code for an hour and I can't find out what's wrong. Looks good to me :-( Any and all advice would be much appreciated! Thank you!
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26432950
has title: Writing a method with ArrayList parameter + for-each loop
has answer: http://stackoverflow.com/a/26433047
has comment: http://stackoverflow.com/comment/41510803
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41510545
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41510456
has comment: http://stackoverflow.com/comment/41510463

http://stackoverflow.com/comment/41623279
type: Comment
comment on: http://stackoverflow.com/a/26494936
has text: What can I provide you? This is my pom.xml - http://pastebin.com/pzRKv0Tb ; To add SQLj translator I use file from Oracle "11.2.0\dbhome_2\sqlj\lib" folder. There I found translator.jar file
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41550545
score: 0
has text: Tried `tree.setOpaque(true)`, but no difference.
type: QuestionComment
comment on: http://stackoverflow.com/q/26454845
type: Comment

http://stackoverflow.com/comment/41407151
has text: The dispatcher expects to be mapped to `/`. Anything else is for special cases. You should map the dispatcher to `/` and let it deal with _all_ requests. Also, stop using XML; if you are just learning Spring then there is no reason to learn obsolete information. With modern Java you can also do away with `web.xml`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26375573
score: 1

http://stackoverflow.com/comment/41592369
comment on: http://stackoverflow.com/a/26477579
has text: @YohanesKhosiawan许先汉 you mean my activity? or my fragment maintenance?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26401564
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26401369
has body: Your code and the error message does not match. You have to be using some other version of the code. You have: java.sql.Date requiredByDate1 = ... pstmt.setDate(1, requiredByDate1); but that code cannot result in java.lang.ClassCastException: java.util.Date as it's not java.util.Date.

http://stackoverflow.com/q/26508424
favorite count: 0
score: 6
tagged with: regex
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26508512
accepted answer: http://stackoverflow.com/a/26508512
tagged with: java
type: Question
has title: Need to extract filename from URL
upvote count: 6
possible better answer: http://stackoverflow.com/a/26508477
has body: I am trying to extract a file name with some specific extension from a URL. For example, I have a URL like "https://abc.xyz.com/path/somefilename.xy". I need to extract "somefilename.xy" from the above URL, and nothing else. basically I need to write that code in my java program I am not that good in regular expressions, so can somebody help me in that.
duplicate of: http://stackoverflow.com/q/17838786
has answer: http://stackoverflow.com/a/26508477
answer count: 2
linked to: http://stackoverflow.com/q/17838786

http://stackoverflow.com/comment/41450704
type: AnswerComment
comment on: http://stackoverflow.com/a/26400047
type: Comment
has text: They did (effectively) remove `Thread.stop(Throwable)` by changing its contract to always throw `UnsupportedOperationException` to the caller (not to the target thread!).
score: 17

http://stackoverflow.com/comment/41423341
has text: Where can I get the value for the key -> "java:autovendor"..If its in registry, where can I find it...
comment on: http://stackoverflow.com/q/26384256
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26501184
linked to: http://stackoverflow.com/q/7068873
type: AnsweredQuestion
has title: Android equivalent of iOS's beginIgnoringInteractionEvents
tagged with: java
has body: This SO answer suggest to iterate through the childviews and disable them. It doesn't smell right to me (performance wise) What's the best approach to disable ALL touch events in the application prevent the user from interacting with the application (during an animation, let's say)?
type: Question
tagged with: ios
answer count: 1
has answer: http://stackoverflow.com/a/26501437
accepted answer: http://stackoverflow.com/a/26501437
score: 0
tagged with: android
tagged with: objective-c

http://stackoverflow.com/comment/41458652
score: 0
has text: But that is fine, we want to include all of them (e.g. if we have multiple not connected subgraphs)?! Just first the ones that are connected to each other :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26404847

http://stackoverflow.com/comment/41581480
has text: @alannm37 The same (*no change required*) way.
score: 0
comment on: http://stackoverflow.com/a/26471840
type: Comment
type: AnswerComment

pattern-matching
tags question: http://stackoverflow.com/q/26359138
type: Tag
tags question: http://stackoverflow.com/q/26407040
tag name: pattern-matching
tags question: http://stackoverflow.com/q/26451008
tags question: http://stackoverflow.com/q/26439728

http://stackoverflow.com/comment/41524247
score: 0
has text: If I'm understanding the question correctly, you would need to add in a hidden field, with a value of ${item.id}.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26440385

http://stackoverflow.com/q/26438651
possible better answer: http://stackoverflow.com/a/26438715
has title: Java lock objects in one class
has answer: http://stackoverflow.com/a/26438715
answer count: 3
has comment: http://stackoverflow.com/comment/41525847
has body: I am trying to learn threading, and regarding the following example public class LockExample { private Lock lockone = new ReentrantLock(); public void method1() { lockone.lock(); try { // do something } finally { lockone.unlock(); } } public void method2() { lockone.lock(); try { // do something } finally { lockone.unlock(); } } } does it mean that if we lock method1 and method2 using the same lock, say thread A and B can not access method1 or method2at the same time. But if we lock method1 and method2using different locks lockone and locktwo, then threadA can access method1, at the same time thread Bcan access method2? why don't we lock each method separately instead of putting them in one lock? public class LockExample { private Lock lockone = new ReentrantLock(); public void method1() { lockone.lock(); try { // do something } // wrap the two methods in one lock? } public void method2() { try { // do something } finally { lockone.unlock(); } } } }
downvote count: 0
favorite count: 0
tagged with: synchronization
tagged with: multithreading
has answer: http://stackoverflow.com/a/26438932
has answer: http://stackoverflow.com/a/26441472
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/41521422
tagged with: locking
has comment: http://stackoverflow.com/comment/41521408
accepted answer: http://stackoverflow.com/a/26438932

http://stackoverflow.com/comment/41627492
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26497142
type: Comment
has text: @EJP, then in the loop, use obj.getId().equals(MY_STRING)

http://stackoverflow.com/q/26409236
has answer: http://stackoverflow.com/a/26409272
has answer: http://stackoverflow.com/a/26409275
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26409272
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26409275
type: Question
tagged with: variables
answer count: 2
has body: I've created this Class: class File { public String path; public int numberOfLines = 0; public String[] fileContent; public File (String file_path) { path = file_path; } public BufferedReader openFile () throws IOException { FileReader ReadFile = new FileReader(path); BufferedReader ReadFilePerLine = new BufferedReader(ReadFile); } public int countLines () { String line; while((line = ReadFilePerLine.readLine()) != null){ numberOfLines++; } return numberOfLines; } public String[] readLines () { String[] fileContent = new String[numberOfLines]; for (int i=0; i &lt; numberOfLines; i++){ fileContent[i] = ReadFilePerLine.readLine(); } } } How do I get the countLines() method to know of the existence of ReadFilePerLine and how do I get him to use it? (same for the numberOfLines variable)
has title: How do I pas instances, created in a class method, to another method in the same class?

http://stackoverflow.com/a/26470246
type: Answer
score: 2
downvote count: 0
has body: You can use InputStream.read(), or InputStream.read(byte[]). Both will block Here is an example
answers question: http://stackoverflow.com/q/26470140
upvote count: 2

http://stackoverflow.com/comment/41588611
has text: If you put jsp file under WEB-INF folder you can use like :req.getRequestDispatcher("/WEB-INF/sample.jsp").include(req,res);
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26475256

http://stackoverflow.com/q/26499470
score: 0
has answer: http://stackoverflow.com/a/26500002
has body: I have a bean use the "MongoTemplate" in construction,like this: public class BasicRepository&lt;T&gt; implements DAO&lt;T&gt;{ ... @Autowired private MongoTemplate mongoTemplate; public BasicRepository(Class&lt;?&gt; typeParameterClass,DBConvertor&lt;T&gt; convertor){ getLogger().info("create a Object of BasicRepository,type of "+typeParameterClass); this.typeParameterClass = typeParameterClass; mongoTemplate.getCollectionName(typeParameterClass); this.convertor = convertor; } ... } configuration： public class BeansConfiguration { @Bean DBConvertor&lt;Topic&gt; topicConvertor(){ return new DBConvertor&lt;&gt;(Topic.class); } @Bean BasicRepository&lt;Topic&gt; topicDao(){ return new BasicRepository&lt;Topic&gt;(Topic.class,topicConvertor()); } } As you see,when construct the BasicRepository，it will throw the exception,because “mongoTemplate” is null during constructing time.How can I do for this.
type: UnansweredQuestion
tagged with: spring
has title: How to use the @Autowired filed when construct in Spring
tagged with: java
has comment: http://stackoverflow.com/comment/41631425
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26499533
has comment: http://stackoverflow.com/comment/41631445

http://stackoverflow.com/comment/41598813
type: AnswerComment
comment on: http://stackoverflow.com/a/26476040
has text: Thank you for your responses! But when i use "final GlobalContext globalContext = (GlobalClass) getApplicationContext();" it says: Cannot resolve symbol "GlobalClass". What to do?
score: 0
type: Comment

http://stackoverflow.com/comment/41635909
comment on: http://stackoverflow.com/q/26502067
type: QuestionComment
type: Comment
has text: Still getting same error message.
score: 0

http://stackoverflow.com/a/26437662
has comment: http://stackoverflow.com/comment/41519641
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41519538
has body: I don't know where you get org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'helloBd1' is defined at There's nothing in your question referring to a helloBd1 bean. As for the output, you've declared your bean as &lt;bean id="helloBd2" class="HelloWorld" scope="singleton"&gt; That is, it has singleton scope. This means that both HelloWorld obj1=(HelloWorld) context.getBean("helloBd2"); HelloWorld obj2=(HelloWorld) context.getBean("helloBd2"); are the retrieving the same object on which you had originally called obj1.setMessage("fooo.."); presumably changing the message to fooo...
has comment: http://stackoverflow.com/comment/41519605
has comment: http://stackoverflow.com/comment/41519501
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41519583
type: Answer
accepted answer of: http://stackoverflow.com/q/26437605
answers question: http://stackoverflow.com/q/26437605

http://stackoverflow.com/a/26451939
has comment: http://stackoverflow.com/comment/41547419
has body: Retrofit uses GSON as its default Converter. @JsonIgnoreProperties is an annotation from Jackson. Looking at your RestAdapter you don't seem to be specifying a Jackson Converter. Square has implemented a JasksonConverter, you use it by including the dependency. compile 'com.squareup.retrofit:converter-jackson:X.X.X' Use the version that matches your Retrofit version. Then JacksonConverter converter = JacksonConverter(new ObjectMapper()); RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(Constant.URL_LOCALHOST) .setConverter(converter) .build();
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26436434
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26436434
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41547639
upvote count: 2

http://stackoverflow.com/comment/41419339
has text: Why don't you parse the entire string and store it as a Calendar object then you could access year month day etc... from the calendar object.
type: QuestionComment
comment on: http://stackoverflow.com/q/26382280
score: 0
type: Comment

http://stackoverflow.com/q/26461382
answer count: 2
has comment: http://stackoverflow.com/comment/41561964
has comment: http://stackoverflow.com/comment/41574784
has body: I'm actually working an a project and I have a problem : I have to generate a random Double value from range [a, b]. By searching on internet, some people say that the following formula works : b + (b - a) * random.nextDouble(); But if we do some calculus, we found that it's impossible for a to be included. How can I do such a thing ? Does anyone have any clue ? Thanks in advance for the help !
has comment: http://stackoverflow.com/comment/41562118
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42178200
has comment: http://stackoverflow.com/comment/41575874
has answer: http://stackoverflow.com/a/26461530
has comment: http://stackoverflow.com/comment/41575758
has answer: http://stackoverflow.com/a/26461585
has comment: http://stackoverflow.com/comment/41562125
possible better answer: http://stackoverflow.com/a/26461530
has title: How to randomly get a double from a range
accepted answer: http://stackoverflow.com/a/26461585
tagged with: random
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41562034
type: Question

attributes
tags question: http://stackoverflow.com/q/26456507
tag name: attributes
type: Tag

libcurl
tags question: http://stackoverflow.com/q/26412977
tag name: libcurl
type: Tag

http://stackoverflow.com/comment/41481081
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26412112
has text: What DB are you using? Can you confirm the DB table structure? For BLOBs, the usual case is that you need to insert the row, and then obtain a Stream to that column, and stream the data into it.
score: 0

http://stackoverflow.com/comment/41436084
has text: Here is useful link. http://stackoverflow.com/questions/8699620/how-to-validate-xml-with-dtd-using-java
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26391485

http://stackoverflow.com/a/26356386
has body: Using the Calendar class: public static boolean isWithinMonths(Date startDate, Date endDate, int months) { Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(startDate); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(endDate); startCalendar.add(Calendar.MONTH, months); return startCalendar.before(endCalendar); }
upvote count: 1
answers question: http://stackoverflow.com/q/26356104
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/26373260
tagged with: java
tagged with: file
type: Question
has body: I want to read a .txt file via a Java program. Say this is the text file input.txt abc, test, 1,2,3 abc abcd test, 1, 2, 3 Each line represents a row, each comma-separated value represents a column. Currently my code is: BufferedReader br = new BufferedReader(new FileReader("input.txt")); int num = readLines(); //this function just returns the number of lines for (int i = 0; i &lt; num; i++){ textData[i] = br.readLine(); } br.close(); This outputs the text file as it was shown above if I print the array. But I require to insert into the array split by comma(could be other character as well, just use comma for now). So this means the output will be such that [abc,test,1,2,3],[abc],[abcd],[test,1,2,3] in the array. How should I proceed? Thanks for the reply. Update: Since i got my txt file into a array list, [abc,test,1,2,3] [abc] [abcd] [test,1,2,3] How do i find the number of elements in each line?
has title: How to read a .txt into an array
score: -2
has comment: http://stackoverflow.com/comment/41403230
tagged with: arrays
downvote count: 2
accepted answer: http://stackoverflow.com/a/26373469
answer count: 1
has comment: http://stackoverflow.com/comment/41403345
favorite count: 0
has answer: http://stackoverflow.com/a/26373469
has comment: http://stackoverflow.com/comment/41403143
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/41607256
has text: @CyranLemoncito change it return type into the String if that wont affect the functionality.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26485614

http://stackoverflow.com/comment/139469266
type: Comment
type: QuestionComment
has text: Voting to re-open. Closed for an incorrect reason. No request here for "recommendations for software libraries, tutorials, tools, books, or other off-site resources".
comment on: http://stackoverflow.com/q/26382280
score: 0

http://stackoverflow.com/q/26453742
has title: JSON to Hold Course, Student, and Assignment Data
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41548732
has answer: http://stackoverflow.com/a/26454172
type: AnsweredQuestion
has body: I am trying to use JSON to contain data related to a class/course. The idea is that there are 40 classes/courses and that each class/course contains 50 students, and each student has 100 assignments. Below is what I've figured out so far. How can I modify it to hold all the gradebook data, as listed above? public void x(){ JSONObject courseJSONObject = new JSONObject(); JSONArray courseJSONArray = new JSONArray(); JSONObject studentJSONObject = new JSONObject(); JSONArray studentJSONArray = new JSONArray(); JSONObject assignmentJSONObject = new JSONObject(); JSONArray assignmentJSONArray = new JSONArray(); for(int i = 0; i &lt; 40; i++){ courseJSONObject.put("course name", course.getName()); courseJSONObject.put("course teacher", course.getTeacher()); courseJSONArray.put(courseJSONObject); courseJSONObject = new JSONObject(); for(int j = 0; j &lt; 50; j++){ studentJSONObject.put("student name", course.student.getName()); studentJSONObject.put("student id", course.student.getid()); studentJSONObject.put("student final grade", course.student.getfinalgrade()); studentJSONArray.put(studentJSONObject); studentJSONObject = new JSONObject(); for(int k = 0; k &lt; 100; k++){ assignmentJSONObject.put("assignment name", getAssignmentName()); assignmentJSONObject.put("category", getAssignmentCategory()); assignmentJSONObject.put("date", getAssignmentDate()); assignmentJSONObject.put("grade", course.student.getAssignmentGrade()); assignmentJSONArray.put(assignmentJSONArray); assignmentJSONObject = new JSONObject(); } } }
has comment: http://stackoverflow.com/comment/41548838
type: Question
accepted answer: http://stackoverflow.com/a/26454172
score: 0

tomcat
tags question: http://stackoverflow.com/q/26409177
tags question: http://stackoverflow.com/q/26473275
tags question: http://stackoverflow.com/q/26492239
tags question: http://stackoverflow.com/q/26391312
tags question: http://stackoverflow.com/q/26414767
tags question: http://stackoverflow.com/q/26404757
tags question: http://stackoverflow.com/q/26497210
tags question: http://stackoverflow.com/q/26403536
tags question: http://stackoverflow.com/q/26434320
tags question: http://stackoverflow.com/q/26358300
tags question: http://stackoverflow.com/q/26446660
tags question: http://stackoverflow.com/q/26369160
tags question: http://stackoverflow.com/q/26499161
tags question: http://stackoverflow.com/q/26386336
tags question: http://stackoverflow.com/q/26466197
tags question: http://stackoverflow.com/q/26464931
tags question: http://stackoverflow.com/q/26461130
tags question: http://stackoverflow.com/q/26497029
tags question: http://stackoverflow.com/q/26359778
tags question: http://stackoverflow.com/q/26427161
tags question: http://stackoverflow.com/q/26437581
tags question: http://stackoverflow.com/q/26506669
tags question: http://stackoverflow.com/q/26394350
tags question: http://stackoverflow.com/q/26505340
tags question: http://stackoverflow.com/q/26427042
tags question: http://stackoverflow.com/q/26365311
tag name: tomcat
tags question: http://stackoverflow.com/q/26483173
tags question: http://stackoverflow.com/q/26456460
tags question: http://stackoverflow.com/q/26494075
tags question: http://stackoverflow.com/q/26487627
tags question: http://stackoverflow.com/q/26469120
tags question: http://stackoverflow.com/q/26431093
tags question: http://stackoverflow.com/q/26441396
tags question: http://stackoverflow.com/q/26361205
tags question: http://stackoverflow.com/q/26360568
tags question: http://stackoverflow.com/q/26503074
tags question: http://stackoverflow.com/q/26465593
tags question: http://stackoverflow.com/q/26490079
tags question: http://stackoverflow.com/q/26431922
tags question: http://stackoverflow.com/q/26430298
type: Tag
tags question: http://stackoverflow.com/q/26374022
tags question: http://stackoverflow.com/q/26502339
tags question: http://stackoverflow.com/q/26394453
tags question: http://stackoverflow.com/q/26488667
tags question: http://stackoverflow.com/q/26406323
tags question: http://stackoverflow.com/q/26420450
tags question: http://stackoverflow.com/q/26391268
tags question: http://stackoverflow.com/q/26456778
tags question: http://stackoverflow.com/q/26356504
tags question: http://stackoverflow.com/q/26428487
tags question: http://stackoverflow.com/q/26498888
tags question: http://stackoverflow.com/q/26438248
tags question: http://stackoverflow.com/q/26513503
tags question: http://stackoverflow.com/q/26359894
tags question: http://stackoverflow.com/q/26356477
tags question: http://stackoverflow.com/q/26426557
tags question: http://stackoverflow.com/q/26421390

http://stackoverflow.com/comment/41377351
comment on: http://stackoverflow.com/q/26358684
score: 0
type: Comment
type: QuestionComment
has text: javaee librarys in a java se project? try using a proper library which fits your needs like the one ive written above

http://stackoverflow.com/q/26441759
has comment: http://stackoverflow.com/comment/41526786
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41526656
has comment: http://stackoverflow.com/comment/41526692
has answer: http://stackoverflow.com/a/26441860
tagged with: multithreading
tagged with: future
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26441860
has comment: http://stackoverflow.com/comment/41526730
has body: Today I discovered threads in java. Now I'm at a point where I want the thread to make a change to my gui. I have this two implementations. I don't know if there are any big differences between them. But the first one without futures kinda 'hangs' my program. My gui becomes very unresponsive etc. The second one seems better. Can anyone explain me which one is best and why? Runnable hasherRunnable = new Runnable() { public void run() { notifyObservers(getHasher().hash(input)); }}; this.getPool().submit(hasherRunnable,"hasherThread"); Callable&lt;String&gt; callableHasher=new Callable&lt;String&gt;(){ public String call(){ return getHasher().hash(input); } }; ============================================================ Future&lt;String&gt; future = this.getPool().submit(callableHasher); try { notifyObservers(future.get()); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); }
tagged with: java
has title: Difference between futures and setting inside thread
type: Question

http://stackoverflow.com/comment/41500118
has text: Post the Cointracker. This code seems to work fine. I threw System.out.println into each of your actionperformed, and they all work multiple times.
comment on: http://stackoverflow.com/q/26427002
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41386156
type: Comment
type: QuestionComment
has text: yes. I am sure) there are no spaces in your sample paths. if they existed (like in c:\program files\microsoft) the problem would appear
comment on: http://stackoverflow.com/q/26359387
score: 0

http://stackoverflow.com/comment/41584028
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26472867
has text: I do want to mention that I did a test run with the same values (instead of using the getters). That also took over 15 minutes.

http://stackoverflow.com/comment/41638450
score: 0
type: Comment
has text: I got a Custom handler who are extending GenericHandler, i added my handler to handler chain, handler are working on request,response,fault build some log msg what i need later store to DB, The problem is that i dont know how to get theese msg what was builded in handler....
type: QuestionComment
comment on: http://stackoverflow.com/q/26503102

http://stackoverflow.com/comment/56382660
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26423934
type: AnswerComment
has text: Nope! task keep in "Running"

http://stackoverflow.com/q/26414522
linked to: http://stackoverflow.com/q/9371686
has comment: http://stackoverflow.com/comment/41476937
favorite count: 0
tagged with: exception
has title: Java unreported Exception error
has comment: http://stackoverflow.com/comment/41476881
type: AnsweredQuestion
tagged with: compiler-errors
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41476886
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26414590
has comment: http://stackoverflow.com/comment/41508205
accepted answer: http://stackoverflow.com/a/26414590
linked to: http://stackoverflow.com/q/2416316
has comment: http://stackoverflow.com/comment/41476958
answer count: 1
downvote count: 0
has body: I have a method which adds two vectors together and I need to return an exception if the length of these vectors are not the same to start off with. I have written a code public static Vector vectorAdd(Vector v1, Vector v2) throws IllegalOperandException{ if(v1.getLength() == v2.getLength()) { double[] temp = new double[v1.getLength()]; for(int i = 0; i &lt; temp.length; i++) { temp[i] = v1.get(i) + v2.get(i); } Vector v3 = new Vector(temp); return v3; } else { throw new IllegalOperandException("Length of Vectors Differ"); } } But once I compile my main method else if (userInput == 2) { System.out.println("Please enter a vector!"); System.out.println("Separate vector components by " + "using a space."); Vector v1 = input.readVector(); System.out.println(); System.out.println("Please enter a vector!"); System.out.println("Separate vector components by " + "using a space."); Vector v2 = input.readVector(); System.out.println(); System.out.println(); System.out.println(LinearAlgebra.VectorAdd(v1, v2)); There is an error of error: unreported exception IllegalOperandException; must be caught or declared to be thrown System.out.println(LinearAlgebra.vectorAdd(v1, v2)); I have been googling for an hour now, but I do not get what is the problem. I'm pretty sure it's something related with try and catch, but I have no idea how to fix it. What should I do?

http://stackoverflow.com/comment/41420080
type: QuestionComment
comment on: http://stackoverflow.com/q/26382515
type: Comment
score: 0
has text: yes, if I modify a camp in a row of a table, this modify must to appear also in the other table (sure, if that row exist in the other table). This just works, but I don't know if is a good solution.

http://stackoverflow.com/comment/41486353
comment on: http://stackoverflow.com/q/26400359
has text: You don't have to do anything with java.library.path. .so files are installed in a specific directory on the device and System.loadLibrary will automatically look inside it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26373565
has body: Application? It's three lines: int odds = str.replaceAll("[^13579]", "").length(); int evens = str.replaceAll("[^2468]", "").length(); int zeroes = str.replaceAll("[^0]", "").length(); If the input is not a string, make it one: long number; String str = number + "";
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26373463

http://stackoverflow.com/a/33571972
upvote count: 13
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/136906700
has body: Since a AND (b OR c) is the same as (a AND b) or (a AND c) TestTableExample example = new TestTableExample(); example.createCriteria() .andField1GreaterThan(1) .andField2GreaterThan(0); example.or(example.createCriteria() .andField1GreaterThan(1) .andField3LessThan(0)); then sit back and let the SQL optimizer figure it out.
has comment: http://stackoverflow.com/comment/138177689
downvote count: 0
answers question: http://stackoverflow.com/q/26504185
has comment: http://stackoverflow.com/comment/137305126
has comment: http://stackoverflow.com/comment/139314279

http://stackoverflow.com/a/51057738
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26409937
type: Answer
has body: Store the active sessionList in another class SessionManager. List&lt;Session&gt; socketSessions = new ArrayList&lt;&gt;(); Add incoming session in @OnOpen to list. Remove session from list in @OnClose @OnClose public void close(Session session) { sessionManager.removeSession(session); } To send a message to everyone, public void broadcast(String message){ for(Session session: sessionList){ session.getBasicRemote().sendText(message); } } You can use the sessionManager.broadcast() method wherever the event triggers. Here is a complete example of how websocket can be used to make push with HTML5 websocket API. https://metamug.com/article/java-push-notification-with-websocket.php
upvote count: 1

http://stackoverflow.com/comment/41502323
type: Comment
comment on: http://stackoverflow.com/a/26419835
has text: Thanks for explanation. I am totally new to Protocol Buffers. If possible can you provide an example basis on my solution and by that I will be able to understand how to use protocol buffers on my example.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26393228
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26392639
answers question: http://stackoverflow.com/q/26392639
has body: Java 6 for Mac is provided by Apple rather than Oracle, and can be downloaded from http://support.apple.com/downloads/#Java - look for the latest "Java for OSX", which at the time of writing is 2014-001.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26473037
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/41584755
type: UnansweredQuestion
has body: I have seen a few postings related to this. However, I seem to be seeing something that I do not understand. Following is a section of my code: package com.mvctest; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DuplicateKeyException; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.dao.User; @Controller public class LoginController { @RequestMapping("/newAccount") public String createAccountScreen (Model model) { model.addAttribute("user", new User()); return "createaccountscreen"; } @RequestMapping(value="/createAccount", method=RequestMethod.POST) public String createAccount (@Valid User user, BindingResult result) { if (result.hasErrors()) { List&lt;ObjectError&gt; errors = result.getAllErrors(); for(ObjectError error : errors) { System.out.println(error.getDefaultMessage()); } return "createaccountscreen"; } return "accountcreated"; } Then in my jsp file createaccountscreen.jsp I have the following: &lt;sf:form method="post" action="${pageContext.request.contextPath}/createAccount" commandName="user"&gt; This works fine. However if I changed the addAttribute () call as following model.addAttribute("myuser", new User()); and changed the commandName in the jsp to &lt;sf:form method="post" action="${pageContext.request.contextPath}/createAccount" commandName="myuser"&gt; I get the following error java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'myuser' available as request attribute Essentially, I replace 'user' with 'myuser'. Bean class is 'User'. Does that mean the commandName needs to be 'user'?
has title: Neither BindingResult Nor Plain Target Object for bean name error - Does the bean class name matter?
tagged with: spring
has comment: http://stackoverflow.com/comment/41584635
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41596037
has comment: http://stackoverflow.com/comment/41585031
type: Question
has comment: http://stackoverflow.com/comment/41610347

http://stackoverflow.com/a/26379432
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26378610
has comment: http://stackoverflow.com/comment/41416712
answers question: http://stackoverflow.com/q/26378610
type: Answer
has comment: http://stackoverflow.com/comment/41421487
has body: class MYComparator implements Comparator&lt;Artwork&gt; { List&lt;Long&gt; artworkIds; MYComparator (List&lt;Long&gt; artworkIds) { this.artworkIds = artworkIds; } @Override public int compare(Artwork o1, Artwork o2) { int index1= artworkIds.indexOf(o1.getId()); int index2 = artworkIds.indexOf(o2.getId()); return (i1 &lt; i2) ? -1 : ((i1 &gt; i2) ? 1 : 0) ; }
has comment: http://stackoverflow.com/comment/41415648
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41416256

http://stackoverflow.com/a/26508144
score: 9
type: AcceptedAnswer
has body: In this answer I will refer to 1) your code, 2) better approach (IMHO:) and 3) playing of two notes in the same time. Your code First, the sample rate should not depend on note frequency. Therefore try: AudioFormat(44100,... Next, use 16 bit sampling (sounds better!). Here is your code that plays simple tone without noise - but I would use it bit differently (see later). Please look for the comments: Thread t = new Thread() { public void run() { try { int sound = (440 * 100); // play A AudioFormat af = new AudioFormat(44100, 16, 1, true, false); SourceDataLine sdl; sdl = AudioSystem.getSourceDataLine(af); sdl.open(af, 4096 * 2); sdl.start(); int maxi = (int) (1000 * (float) sound / 1000); // should not depend on notes frequency! byte[] buf = new byte[maxi * 2]; // try to find better len! int i = 0; while (i &lt; maxi * 2) { // formula is changed to be simple sine!! double val = Math.sin(Math.PI * i * 440 / 44100); short s = (short) (Short.MAX_VALUE * val); buf[i++] = (byte) s; buf[i++] = (byte) (s &gt;&gt; 8); // little endian } sdl.write(buf, 0, maxi); sdl.drain(); sdl.stop(); sdl.close(); } catch (LineUnavailableException e) { e.printStackTrace(); } } }; t.start(); Proposal for better code Here is a simplified version of your code that plays some note (frequency) without noise. I like it better as we first create array of doubles, which are universal values. These values can be combined together, or stored or further modified. Then we convert them to (8bit or 16bit) samples values. private static byte[] buffer = new byte[4096 * 2 / 3]; private static int bufferSize = 0; // plays a sample in range (-1, +1). public static void play(SourceDataLine line, double in) { if (in &lt; -1.0) in = -1.0; // just sanity checks if (in &gt; +1.0) in = +1.0; // convert to bytes - need 2 bytes for 16 bit sample short s = (short) (Short.MAX_VALUE * in); buffer[bufferSize++] = (byte) s; buffer[bufferSize++] = (byte) (s &gt;&gt; 8); // little Endian // send to line when buffer is full…
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/41648256
has comment: http://stackoverflow.com/comment/41647503
has comment: http://stackoverflow.com/comment/41648220
downvote count: 0
answers question: http://stackoverflow.com/q/26436994
accepted answer of: http://stackoverflow.com/q/26436994

http://stackoverflow.com/a/26490265
has body: Try using the flag for the devappserver to scan and reload : -Dappengine.fullscan.seconds=5 (or some number of your liking) If using gradle, as described in this issue on GitHub : https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/97 If launching directly from eclipse you might have to add it in the right place of the launch configuration.
answers question: http://stackoverflow.com/q/26489504
type: Answer
has comment: http://stackoverflow.com/comment/41617025
has comment: http://stackoverflow.com/comment/41800834
has comment: http://stackoverflow.com/comment/41793642
has comment: http://stackoverflow.com/comment/41800621
has comment: http://stackoverflow.com/comment/41619373
score: 0

http://stackoverflow.com/comment/41524604
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26440436
has text: Scala's type system features—among others—variance annotations, path-dependent types, higher-kinded types, proper existential types, structural types, abstract types and singleton types. Java doesn't have any of these.

http://stackoverflow.com/comment/41590521
has text: @MárcioSouzaJúnior you are right. I forgot to add `rewriteBatchedStatements=true` to the connection in the `persistence.xml` file I have it in my JDBC and mistakenly I thought I had it as well in the `persistence.xml`. That partly solved my problem. With Chris's answer it did solve my problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26416847

http://stackoverflow.com/q/26478807
upvote count: 1
has comment: http://stackoverflow.com/comment/41594200
has comment: http://stackoverflow.com/comment/41594222
type: Question
has comment: http://stackoverflow.com/comment/41594227
has comment: http://stackoverflow.com/comment/41594348
answer count: 1
downvote count: 0
favorite count: 0
has title: App force closes when trying to delete a line from .txt through a list
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26478880
accepted answer: http://stackoverflow.com/a/26478880
score: 1
tagged with: java
has body: im attempting to delete a line from a .txt file, when the user gets a button click and is prompted, but i am getting a force close. Here is the code for the deleting: package ibettergetagoodgradeforthisorillbepissed.sciencefair.beta.mmmeds.com.mmmeds; import android.app.ActionBar; import android.util.Log; import android.view.View.OnClickListener; import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; import android.app.FragmentManager; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.os.Environment; import android.support.v4.widget.DrawerLayout; import android.text.method.ScrollingMovementMethod; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class viewMeds extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { setTitle("View Medications"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_meds); String SDRoot = Environment.getExternalStorageDirectory().getPath(); final File output = new File(SDRoot,"output.txt"); //Get the text file //Read text from file StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(output)); String line; while ((line = br.readLine()) != null) { text.append("Medication: " + line); text.append("\n\n"); } } catch (IOException e) { //You'll need to add proper error handling here } //Find the view by its id TextView tv = (TextView)findViewById(R.id.…

http://stackoverflow.com/comment/41487118
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26420500
has text: That is the functionality of labels. You could declare your own tag, that would not use labels, but something else. Or remove label and add this text next to your checkbox.

http://stackoverflow.com/a/31426460
answers question: http://stackoverflow.com/q/26440729
downvote count: 0
has comment: http://stackoverflow.com/comment/67486098
type: Answer
has comment: http://stackoverflow.com/comment/53240438
has comment: http://stackoverflow.com/comment/53235918
has comment: http://stackoverflow.com/comment/53261289
score: 4
has body: Parse.com only support facebook and twitter yet but not google+, for that you have to implement your own using authentication at cloud (parse.com) side This is long process so be patient Follow this steps 1) get google profile information for that implement this necessary functions put in onCreate() mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .addConnectionCallbacks(this) //lets impement ConnectionCallbacks .addOnConnectionFailedListener(this).addApi(Plus.API) // lets implement OnConnectionFailedListener .addScope(Plus.SCOPE_PLUS_LOGIN).build(); mGoogleApiClient.connect(); 2) method of implemented OnConnectionFailedListener @Override public void onConnectionFailed(ConnectionResult result) { // TODO Auto-generated method stub if (!result.hasResolution()) { GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), getActivity(), 0).show(); return; } if (!mIntentInProgress) { // Store the ConnectionResult for later usage mConnectionResult = result; if (mSignInClicked) { // The user has already clicked 'sign-in' so we attempt to // resolve all // errors until the user is signed in, or they cancel. resolveSignInError(); } } } /** * Method to resolve any signin errors for google plus * */ private void resolveSignInError() { if (mConnectionResult.hasResolution()) { try { mIntentInProgress = true; mConnectionResult.startResolutionForResult(getActivity(), RC_SIGN_IN); } catch (SendIntentException e) { mIntentInProgress = false; mGoogleApiClient.connect(); } } } 3) call on google+ button click private void loginUsingGoolgePlus() { // TODO Auto-generated method stub if (!mGoogleApiClient.isConnecting()) { mSignInClicked = true; resolveSignInError(); } } 4) methods of implemented ConnectionCallbacks @Override public void onConnected(Bundle arg0) { // TODO Auto-generated method stub mSignInClicked = false; Toast.makeText(getActivity(), "User is connected!", Toast.LENGTH_LONG).show(); // Get user's information getProfileInformation(); } @Override public void …
upvote count: 4

http://stackoverflow.com/comment/41435575
comment on: http://stackoverflow.com/q/26391181
score: 0
type: Comment
type: QuestionComment
has text: try using t1.join() after t1.start();

http://stackoverflow.com/comment/41586199
comment on: http://stackoverflow.com/q/26474281
type: QuestionComment
has text: Are you using fragments?
score: 0
type: Comment

http://stackoverflow.com/q/26410060
has body: Iam new to spring.How can I throw the exception from my Hibernate DAO calss to service and then to my controller and how to inform UI about the exception.Plese help me with exception throwing to indicate the user. Service Class: @Service public class ServiceImpl implements Service { private static Logger LOGGER = Logger.getLogger(AccessServiceImpl.class); @Autowired private DAO DAO; @Override @Transactional public List&lt;PrinterVO&gt; getDetails() { List&lt;VO&gt; printerList = null; try { LOGGER.info("Inside getAllPrinters()"); printerList = DAO.getAllPrinters(); } catch(Exception e) { LOGGER.error("getAllPrinters() Error :", e); } return printerList; } DAO: public class DAOImpl implements DAO { @Autowired @Qualifier(value="ressessionFactory") private SessionFactory sessionFactory; @SuppressWarnings("unchecked") @Override public List&lt;VO&gt; getDetails() { List&lt;VO&gt; printerList = null; try { LOGGER.info("Inside getAllPrinters()"); printerList = sessionFactory.getCurrentSession().createQuery("from PrinterVO").list(); } catch(HibernateException e) { LOGGER.error("getAllPrinters() Error : ", e); } return printerList; }
score: 0
type: UnansweredQuestion
has title: How is exception thrown from Hibernate DAO to Spring MVC controller?
has answer: http://stackoverflow.com/a/26410395
tagged with: spring-mvc
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/q/26367540
tagged with: java
has comment: http://stackoverflow.com/comment/41426408
has body: I need to use CORS with Spring Security. I've succeeded in getting login and basic security working, using a OncePerRequestFilter that is configured in app-beans.xml as follows: &lt;bean id="corsAwareAuthenticationFilter"class="org.broadinstitute.portal.servlet.CorsAwareAuthenticationFilter"/&gt; &lt;security:http use-expressions="true"&gt; &lt;security:custom-filter ref="corsAwareAuthenticationFilter" after="PRE_AUTH_FILTER"/&gt; ... I basically followed the approach in this question: Cross-Origin Resource Sharing with Spring Security My configuration for logout in app-beans.xml is simply: &lt;security:logout delete-cookies="JSESSIONID"/&gt; This works fine without CORS. My problem is logging out. CORS is stopping access to j_spring_security_logout. Any idea why my OncePerRequestFilter is being called when logging in, but not when logging out? Edited to add: Thanks to alain.janinm, I solved the problem. I needed to set my filter to be called before the LOGOUT_FILTER. The following configuration addition solved the problem: &lt;security:custom-filter ref="corsAwareAuthenticationFilter" before="LOGOUT_FILTER"/&gt; Note, using position="LOGOUT_FILTER" didn't work, as that put my filter in the same position as the Spring LOGOUT_FILTER. My filter doesn't do the same thing as the LOGOUT_FILTER -- all mine does is to add the CORS headers. So I actually need the Spring LOGOUT_FILTER to still be called.
has answer: http://stackoverflow.com/a/26409162
type: Question
tagged with: cors
downvote count: 0
accepted answer: http://stackoverflow.com/a/26409162
has comment: http://stackoverflow.com/comment/41423684
has comment: http://stackoverflow.com/comment/41392741
answer count: 1
favorite count: 0
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has title: Spring, CORS, and j_spring_security_logout
linked to: http://stackoverflow.com/q/18264334
score: 1

http://stackoverflow.com/q/26402261
type: AnsweredQuestion
tagged with: java
has body: Im solving a question on java and im having some problems, im a beginner so plse help , my print statements(name and department) clash with each other when taking values from the user. public class payroll2 { public static void main(String args[]) { payroll2 payroll = new payroll2(); payroll.SetPayrollDetail(); payroll.SetBonus(); payroll.SetCommission(); payroll.SetNssf(); payroll.SetNetSalary(); payroll.GetPayroll(); } Scanner myScanner=new Scanner(System.in); int empID; String empName; String empDept; String designation; int basicSalary; double netSal; double bonus; double commission; double nssf; public void SetPayrollDetail() { System.out.println("Enter ID: "); empID = myScanner.nextInt(); System.out.println("Enter Name: "); empName = myScanner.nextLine(); System.out.println("Enter Department (Marketing or Other): "); empDept = myScanner.nextLine(); System.out.println("Enter Designation (Manager, Executive or Other):"); designation = myScanner.nextLine(); System.out.println("Enter Basic Salary: "); basicSalary = myScanner.nextInt(); } public void SetBonus() { if(basicSalary &lt; 1500){ bonus = 0.0; } else if(basicSalary&gt;=1500 &amp;&amp; basicSalary&lt;3000){ bonus = basicSalary * (12.0/100.0); } else if(basicSalary&gt;=3000 &amp;&amp; basicSalary&lt;5000){ bonus = basicSalary * (15.0/100.0); } else{ bonus = basicSalary * (25.0/100.0); } } public void SetCommission() { if( empDept.equalsIgnoreCase("other") ){ commission = 0.0; } else if( empDept.equalsIgnoreCase("marketing") &amp;&amp; designation.equalsIgnoreCase("manager") ){ commission = basicSalary * (30.0/100.0); } else if( empDept.equalsIgnoreCase("marketing") &amp;&amp; designation.equalsIgnoreCase("executive") ){ commission = basicSalary * (15.0/100.0); } else if( empDept.equalsIgnoreCase("marketing") &amp;&amp; designation.equalsIgnoreCase("other") ){ commission = basicSalary * (10.0/100.0); } else{ commission = 0.0; } } public void SetNssf() { if(basicSalary &lt; 1500){ nssf = basicSalary * (5.0/100…
accepted answer: http://stackoverflow.com/a/26402529
has comment: http://stackoverflow.com/comment/41454081
type: Question
has comment: http://stackoverflow.com/comment/41454000
has title: java print statements clashing when user enters values
score: 0
has comment: http://stackoverflow.com/comment/41453971
answer count: 1
has answer: http://stackoverflow.com/a/26402529

http://stackoverflow.com/q/26423496
has answer: http://stackoverflow.com/a/26425016
score: 0
tagged with: javafx-8
answer count: 1
accepted answer: http://stackoverflow.com/a/26425016
type: AnsweredQuestion
has body: I have a ListView as a content node of the JavaFX pagination control. My aim is to set the focus to the ListView after a new page is selected. The problem with my approach is sometimes the ListView has the focus but sometimes not. How can i ensure, that the ListView will have the focus, after a new page is selected? Platform: Windows 7 JDK 1.8.0.25 (64-Bit) code: package test.focus; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.ListView; import javafx.scene.control.Pagination; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import javafx.util.Callback; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { Pagination pagination = new Pagination(5); final ObservableList&lt;String&gt; texts = FXCollections.observableArrayList("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"); final ListView&lt;String&gt; textsListView = new ListView&lt;&gt;(); pagination.setPageFactory(new Callback&lt;Integer, Node&gt;() { @Override public Node call(Integer page) { textsListView.setItems(FXCollections.observableArrayList(texts.subList(page, page + 2))); textsListView.getSelectionModel().select(0); // Platform.runLater does not work, too textsListView.requestFocus(); return textsListView; } }); BorderPane root = new BorderPane(pagination); Scene scene = new Scene(root, 800, 600); stage.setTitle("Focus issue"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }
has title: focus content node of pagination control
tagged with: java
type: Question

http://stackoverflow.com/q/26431487
tagged with: java
downvote count: 1
type: Question
has body: I want to write IRC Twitch bot. I have never used Pirc library before, so i wrote this simple bot to get started. BasicBot class : public class BasicBot extends PircBot{ public BasicBot(String name){ super(); this.setName(name); } protected void onMessage(String channel, String sender, String login, String hostname, String message) { if(message == "2/10"){ sendMessage(channel,"YAYO"); } System.out.println(message + (message == "2/10")); } } but when message 2/10 appears on chat this is what i see in console : 2/10false I don't know why "2/10" == "2/10" is false. I tried also other strings like "banana" or "apple" and result was similar. Please help.
upvote count: 0
has title: Pirc bot "2/10" doesn't equals "2/10"
score: -1
linked to: http://stackoverflow.com/q/513832
tagged with: irc
tagged with: twitch
answer count: 1
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has answer: http://stackoverflow.com/a/26431518
type: UnansweredQuestion

http://stackoverflow.com/a/26359999
answers question: http://stackoverflow.com/q/26359806
has comment: http://stackoverflow.com/comment/41380388
has comment: http://stackoverflow.com/comment/41378319
has comment: http://stackoverflow.com/comment/41378898
has comment: http://stackoverflow.com/comment/41378252
has comment: http://stackoverflow.com/comment/41379837
has comment: http://stackoverflow.com/comment/41379092
has comment: http://stackoverflow.com/comment/41382462
score: 0
has comment: http://stackoverflow.com/comment/41378693
has comment: http://stackoverflow.com/comment/41380591
type: Answer
has body: ll alias usually be defined in ~/.bashrc file. when you login using a shell this .bashrc run and set the alias. one way is to run it after login by JSch: . ~/.bashrc if you can not find the ll definition in ~/.bashrc (either in etc/profile, ~/.bash_profile, ~/.bash_login and ~/.profile), use the alias command in PUTTY and write result to a script-file. then after JSch login run that script. $ alias alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto' $alias &gt; my-script $chmod +x my-script

http://stackoverflow.com/comment/115149191
type: AnswerComment
type: Comment
has text: I used STATELESS, but getting the error localhost redirected you too many times. I tried after clearing the cookies too. I used all these. But everything else is fine except for the sessionManagement thing. csrf().disable() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .formLogin().disable() .httpBasic().disable() .logout().disable()
score: 1
comment on: http://stackoverflow.com/a/42587808

http://stackoverflow.com/a/58169734
has comment: http://stackoverflow.com/comment/112178461
answers question: http://stackoverflow.com/q/26400459
has body: You can mock the string to entity conversion through WebConversionService. Check this answer for some code example and more details.
score: 0
type: Answer

http://stackoverflow.com/comment/41526892
type: Comment
comment on: http://stackoverflow.com/a/26441841
has text: I consider this as a direct way.
type: AnswerComment
score: 2

http://stackoverflow.com/comment/41483249
has text: If there's a firewall that prevents the source stream to reach your PC (at cs lab), you might see such an issue. If VLC client is running fine, it could be due to its support for NAT (Network address translation, I'm not sure on this) you should be able to verify it.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26418061
type: QuestionComment

http://stackoverflow.com/a/26386068
score: 0
type: Answer
has body: You could simply set time for the statement to sometime in the future. You could also use statement.iterate().
answers question: http://stackoverflow.com/q/26366088

http://stackoverflow.com/q/26497554
has title: java: Send method through socket
tagged with: java
has answer: http://stackoverflow.com/a/26521045
type: Question
score: 0
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/26497595
favorite count: 0
has answer: http://stackoverflow.com/a/26497595
possible better answer: http://stackoverflow.com/a/26521045
downvote count: 1
type: AnsweredQuestion
has body: I'm trying to write a program that would send a function to several nodes, those nodes will receive the function and execute it, replying a result (through serialization). I've searched around a bit, but found nothing of help. An alternative might be to send a .class file over the socket and load it on the node, but i'm interested if anyone has found a simpler way Edit: I'm trying to make a cluster with this client/server. And I want the client to always run on the nodes and accept any kind of work without having to recompile the client node code Solution: seems there's no way around not sending a .class file. Have to send it, then load it at runtime
tagged with: network-programming

http://stackoverflow.com/q/26490951
linked to: http://stackoverflow.com/q/15164742
linked to: http://stackoverflow.com/q/20268396
accepted answer: http://stackoverflow.com/a/26500365
tagged with: selenium
upvote count: 1
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41616410
tagged with: java
tagged with: webautomation
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26500365
has body: I'm new to Selenium and fairly new to Java. I'm a tester by trade, not a developer, so I'm trying to gradually convert my Selenium IDE scripts into something more robust and 'proper'. Unfortunately I'm struggling with a fairly basic task. As soon as the web page loads, I want to click a button. This works fine in Selenium IDE, but only if I set the speed to 'slow'. I can get it to work using the following code, but ONLY if I include the thread.sleep line. I've read that this is not a good idea, so I'm trying to implement something smarter using webDriverWait. public class mytestclass { private WebDriver driver; private String baseUrl; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = ""; driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); } @Test public void test1() throws Exception { driver.get(baseUrl + "file:///C:/_VM/testpage.html"); WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.elementToBeClickable(By.id("button_X"))); //Thread.sleep(2000); driver.findElement(By.id("button_X")).click(); } } So the fact that this is working when executing the thread.sleep line leads me to believe the wait.until line is returning true when the button is not actually ready. I've also tried to switch the ExpectedConditions to other identifiers such as visibilityOfElementLocated(By locator) and presenceOfElementLocated(By locator) but these act the same way too. Am I doing something wrong here? Is there something else I can try? I'm afraid I can't link to the website as it's work related. It does read in a lot of images and runs a lot of javascript on startup, so it does take a moment to get going, but that's why I want to add the wait logic in! Thanks for any advice.
favorite count: 0
has title: Element is not ready to be selected, but wait.until() still continues regardless?
answer count: 1
score: 1

http://stackoverflow.com/comment/59883138
comment on: http://stackoverflow.com/q/26506464
score: 0
type: QuestionComment
has text: this is still happening (Q1 - 2016)
type: Comment

http://stackoverflow.com/comment/41558474
comment on: http://stackoverflow.com/a/26459313
type: Comment
score: 0
has text: Yeah that's what I thought too. Thank you very much for your input. Really appreciated it. Will go ahead and read Skype URI first
type: AnswerComment

http://stackoverflow.com/a/26432241
upvote count: 1
type: Answer
has body: Consider this warning I had to add to Xstian's answer in the previous question: Warning This workaround does not use Hyperjaxb at all. This workaround uses the jaxb2-annotate-plugin to add the JPA annotations. This is a task which is normally performed by Hyperjaxb. That is, if you opt to use this workaround, you completely leave the Hyperjaxb track. Your do not need jaxb2-annotate-plugin if you use Hyperjaxb and vice versa, you do not need Hyperjaxb if you add your annotations using the jaxb2-annotate-plugin. Beware, however, that the jaxb2-annotate-plugin only does a very superficial task of adding the annotations which you explicitly configure in your binding files. Hyperjaxb, on the other side is does a very deep and thorough analysis of your schema model and generates reasonable JPA annotations automatically. In certain cases Hyperjaxb even has to augment the generated JAXB code to make it compatible with JPA. These are the features which are out of the scope of the jaxb2-annotate-plugin. So if the task is to generate JPA annotations in the schema-derived classes, you use EITHER Hyperjaxb OR jaxb2-annotate-plugin. It is a completely wrong track to do both in the same time. I have retagged this specific question to annox as it is the right tag. Annox is the library behind jaxb2-annotate-plugin and the annox tag is typically associated with jaxb2-annotate-plugin-related questions like yours.
answers question: http://stackoverflow.com/q/26430199
downvote count: 0
score: 1

http://stackoverflow.com/comment/41666958
type: Comment
has text: @kalgecin ...It's up to you whether you choose to send source over the wire, and compile it on the remote machine, or compile it first and then send the .class file over; but either way, you're going to need a .class file.
comment on: http://stackoverflow.com/a/26497595
score: 0
type: AnswerComment

http://stackoverflow.com/q/26482849
type: UnansweredQuestion
has body: My java application is slow only on customer platform ( has few data ). In Dev and Integration environment it's super fast ( with 10 times more data ). I used Yourkit profiler to figure out the reasons. IT turned out that the MySQL's driver spend each time about 250ms on opening prepared statement ( the same operation is immediate on our internal environments ) com.mysql.jdbc.ConnectionImpl.prepareStatement(String, int, int) ConnectionImpl.java com.mysql.jdbc.ConnectionImpl.prepareStatement(String) ConnectionImpl.java:4077 com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(String) NewProxyConnection.java:213 org.hibernate.search.jpa.impl.FullTextQueryImpl.getResultList() FullTextQueryImpl.java:123 In the following query, opening Prepared statement takes 321ms , 1ms for the query and 0ms for closing it. "Database.Prepared Statement.Open #19","17m 3 sec 234 ms - 17m 3 sec 555 ms","321","ajp-bio-11009-exec-3","NewProxyConnection.prepareStatement","SQL=""select courrier0_.ID as I...."" — Database=""jdbc:mysql://localhost:3306/parapheur_crfc_form?useUnicode=true&amp;characterEncoding=utf-8"" Class=""com.mchange.v2.c3p0.impl.NewProxyConnection""", "1" "Database.Prepared Statement.Query #19","17m 3 sec 555 ms - 17m 3 sec 556 ms","1","ajp-bio-11009-exec-3","NewProxyPreparedStatement.executeQuery","SQL=""....."" Class=""com.mchange.v2.c3p0.impl.NewProxyPreparedStatement"" — Database=""jdbc:mysql://localhost:3306/parapheur_crfc_form?useUnicode=true&amp;characterEncoding=utf-8"" Class=""com.mchange.v2.c3p0.impl.NewProxyConnection""", "1" "Database.Prepared Statement.Close #19","17m 3 sec 556 ms - 17m 3 sec 557 ms","0","ajp-bio-11009-exec-3","NewProxyPreparedStatement.close","SQL=""select cour..."" Class=""com.mchange.v2.c3p0.impl.NewProxyPreparedStatement"" — Database=""jdbc:mysql://localhost:3306/parapheur_crfc_form?useUnicode=true&amp;characterEncoding=utf-8"" Class=""com.mchange.v2.c3p0.impl.NewProxyConnection""", "1"
has title: Mysql prepareStatement is slow in a specific environment
tagged with: java
tagged with: mysql
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26483224

http://stackoverflow.com/a/26445791
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41534757
has comment: http://stackoverflow.com/comment/41534745
answers question: http://stackoverflow.com/q/26445705
downvote count: 0
score: 1
has body: Based on this one : How can I check if two ArrayList differ, I don't care what's changed If you have implemented your custom object equals correct (you actually override it and have your one) and the size of the arrayList is the same and each of the pair of the objects is equal then it will return equal. In other words what you are trying to do is totally correct but your arrayLists are not actually having exactly the equal objects in exact order. Make sure that your equal is called when you check for collection equality by doing a System.out.println() to investigate what is going on. If you don't mind please send the equals of your object. I run your code in an isolated example and works fine (outtputs true) - I improved the equals method so it doesn't do so many if checks as if only one of them is not equal it should return false. class stackoverflow { public static void main(String args[]){ ArrayList<Compra> array1 = new ArrayList<>(); ArrayList<Compra> array2 = new ArrayList<>(); array1.add(new Compra(1,2,"test")); array2.add(new Compra(1,2,"test")); System.out.println(array1.equals(array2)); } } class Compra { int id; int cantidad; String concepto; public Compra(int id, int cantidad, String concepto){ this.id = id; this.cantidad = cantidad; this.concepto = concepto; } public boolean equals(Object obj) { if (obj == null) { return false; }else{ Compra comprobada = (Compra) obj; if(!(this.id == comprobada.getId())){ return false; } if(!(this.cantidad == comprobada.getCantidad())){ return false; } if(!this.concepto.equals(comprobada.getConcepto())){ return false; } } return true; } public int getId() { return id; } public int getCantidad() { return cantidad; } public String getConcepto() { return concepto; } } Some things to check: Are you sure you don't change the order of the things in ArrayList??: Do you print to make sure that these equals checks happen and return true or false as expected? Are you sure that concepto Strings are exactly the same, with the same …

http://stackoverflow.com/comment/41372499
score: 9
type: Comment
type: QuestionComment
has text: @Juru: This is in no way a duplicate of that...
comment on: http://stackoverflow.com/q/26356777

http://stackoverflow.com/comment/41870268
type: QuestionComment
comment on: http://stackoverflow.com/q/26370121
type: Comment
score: 0
has text: Yes with 3 000 lines displayed by group of 50 thanks to a navigation menu.

http://stackoverflow.com/a/26395708
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26395671
score: 2
answers question: http://stackoverflow.com/q/26395671
has body: Although the strings look similar but there maybe trailing spaces. So use trim() with compareTo() method. Change this int compareResult = x.compareTo(t.info.getLastName()); to int compareResult = x.compareTo(t.info.getLastName().trim()); You may like to trim x also before calling compareTo
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41613834
type: Comment
comment on: http://stackoverflow.com/a/26487095
has text: If you're lucky, the hbm2ddl feature of hibernate MIGHT upgrade your customer's database, but it's a risk. http://stackoverflow.com/questions/438146/hibernate-hbm2ddl-auto-possible-values-and-what-they-do for more info. You would have to test this hugely. A better option is for you to use that feature to export the natural schema of your latest code to a fresh DB and then use a DB comparison tool (See Redgate software) to generate the script that needs to be run on the database to upgrade it to the structure your code now needs.
score: 0
type: AnswerComment

http://stackoverflow.com/a/53846525
answers question: http://stackoverflow.com/q/26377347
score: -1
has comment: http://stackoverflow.com/comment/105346176
upvote count: 0
type: Answer
has body: Add @Cacheable(value = "false") in entity class. This issue will be resolved. Above issue mainly due to the JDO cache. So if we disable the cache, JDO will read the data from datastore. Or you can disable L2 cache in jdoconfig.xml. Ref Link : http://www.datanucleus.org/products/accessplatform_3_0/jdo/cache.html
downvote count: 1

http://stackoverflow.com/q/26418152
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26418319
type: Question
has comment: http://stackoverflow.com/comment/41483216
downvote count: 0
answer count: 1
favorite count: 0
has title: Get All jcomponents and their location on a jframe
has body: I want a jframe on which i am adding jcomponents dynamically and on a button click i want to know about all the available components and their location(or sequence). I am using this method Component[] components=getContentPane().getComponents(); components.toString(); but i am getting a string which contain too much info about components I only need their names(not must variable name their class name means JLabel lbl; so I want JLabel ) and their sequence. It don't know how to extract this info from the string.
has answer: http://stackoverflow.com/a/26418319
has comment: http://stackoverflow.com/comment/41483226
has comment: http://stackoverflow.com/comment/41483173
tagged with: jcomponent

http://stackoverflow.com/comment/41371615
type: QuestionComment
comment on: http://stackoverflow.com/q/26354252
has text: Hi Jon..Yes I want the answer to be in boolean state whether the date is in daylight saving time or not.
score: 0
type: Comment

http://stackoverflow.com/a/26486098
has body: You should not use the DataInputStream unless you intentionally want to read primitive Java data types (see http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html). You could instantiate the BufferedReader reader either like this: BufferedReader br1 = Files.newBufferedReader(Paths.get("a.txt"), StandardCharsets.UTF_8); or traditionally like this: BufferedReader br1 = new BufferedReader(new FileReader("a.txt")); At the end you can close all the BufferedReaders. They will implicitly cascade close all their containing streams.
answers question: http://stackoverflow.com/q/26485866
type: Answer
has comment: http://stackoverflow.com/comment/41606759
score: 0

http://stackoverflow.com/q/26379850
has title: ImageMagick media conversion exceptions
tagged with: imagemagick
answer count: 1
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41696386
tagged with: imagemagick-convert
has answer: http://stackoverflow.com/a/26526936
has body: We are getting a few exceptions when we try to convert an image on a Linux box. When we try the same media conversion on a Windows 8 machine it works perfectly, without any exceptions. The same version is being used on both the Linux and Windows machines: ImageMagick 6.7.3-5 Please find the exceptions below: [MediaConversionJob] Failed to convert container 'MediaContainerModel (8797477011506)' for format '8796093382707'. INFO | jvm 1 | main | 2014/10/09 22:21:55.781 | [0;31mERROR [pool-1-thread-16] (xxTuProductMediaConversionCronjobMultiThreadUnscheduled) [DefaultImageMagickService] convert: no decode delegate for this image format `/NFS_DATA/hybris-media/sys_master/cache/products/h51/hab/c3lzLW1hc3Rlci9wcm9kdWN0cy9oMjYvaGIyLzg4MjEwMzk3NTkzOTAvMTI2NjU2MzgwX05hdnlfMDEuanBn__H__b7457ad8-4ad6-4777-824f-4a0d6ddb48fc.bin' @ error/constitute.c/ReadImage/533. INFO | jvm 1 | main | 2014/10/09 22:21:55.781 | [m[0;31mERROR [pool-1-thread-16] (xxTuProductMediaConversionCronjobMultiThreadUnscheduled) [DefaultImageMagickService] convert: missing an image filename `/opt/hybris_tu/temp/hybris/convert/tmp_3568635358706829874.jpg' @ error/convert.c/ConvertImageCommand/2940. Is it a version problem?
score: 0

http://stackoverflow.com/comment/41555348
score: 0
type: Comment
type: QuestionComment
has text: yeah, it sould be in `onPostExecute`. what did you try yet? what's your problem?
comment on: http://stackoverflow.com/q/26457535

scriptella
type: Tag
tag name: scriptella
tags question: http://stackoverflow.com/q/26377444

http://stackoverflow.com/a/26408127
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26399962
has body: You could just zip a known string and confirm that the number of bytes in the output is less than the number of bytes in the string, i.e. that it has done some compression. By checking the exact bytes produced by zipBytes, your unit test is 'leaning' towards unit testing the ZipOutputStream functionality rather than your usage of it. If you have an opposite method 'unzipBytes', you could confirm you are correctly using both by pushing a known string into zipBytes, pushing the result into unzipBytes and confirming that it is the same as the test string. If you don't then, in the unit test you could perform the manual steps of creating a ZipInputStream and confirming that there is an entry and it's size conforms to the original length of the bytes/string and when read from equals the same bytes used to test zipBytes. Otherwise, @Erwin's answer is what you need to do.

http://stackoverflow.com/comment/41610921
comment on: http://stackoverflow.com/q/26488398
score: 3
has text: @aruisdante One does not create a reference to a primitive value.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26457112
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26457231
type: Question
has title: Do I have to select all entity properties when use JPA native query?
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/41556045
linked to: http://stackoverflow.com/q/25930628
answer count: 1
accepted answer: http://stackoverflow.com/a/26457231
favorite count: 0
has comment: http://stackoverflow.com/comment/41555821
upvote count: 2
has comment: http://stackoverflow.com/comment/41554851
has body: I need to use JPA native query (Hibernate is used) for some complex business logics and I found that apparently all the entity properties need to be in the SELECT clause in my native query. Otherwise JPA always throws java.sql.SQLException: Column 'xxx' not found. so I wonder whether this is something necessary or I miss something in my code/configuration as I cannot find out any JPA specification regards this. My code is below: table schema CREATE TABLE `casaddress` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `addressLine1` varchar(255) DEFAULT NULL, `addressLine2` varchar(255) DEFAULT NULL, `companyId` bigint(20) DEFAULT NULL, `country` varchar(255) DEFAULT NULL, `effectiveDate` date DEFAULT NULL, `occupiedOfficer` varchar(255) DEFAULT NULL, `postcode` varchar(255) DEFAULT NULL, `suburb` varchar(255) DEFAULT NULL, `type` int(11) DEFAULT NULL, `version` bigint(20) DEFAULT NULL, PRIMARY KEY (`id`), KEY `FK616A8A7F1FD01BA8` (`companyId`), CONSTRAINT `FK616A8A7F1FD01BA8` FOREIGN KEY (`companyId`) REFERENCES `cascompany` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 JPA entity code (just a pojo) @Entity(name = "CASAddress") public class Address implements Serializable { private static final long serialVersionUID = -2903861598526729415L; public static final String TYPE = "type"; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Version private Long version; private String addressLine1; private String addressLine2; private String suburb; private String postcode; private String country; private String occupiedOfficer; @Temporal(value = TemporalType.DATE) private Date effectiveDate; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "companyId", nullable = false, updatable = false, insertable = false) private CASCompany company; private Long companyId; private AddressType type; public Address() { } /** * @return the addressLine1 */ public String getAddressLine1() { return addressLine1; } /** * @param addressLine1 the addressLine1 to …

http://stackoverflow.com/a/26376156
downvote count: 3
has comment: http://stackoverflow.com/comment/41408302
has comment: http://stackoverflow.com/comment/41413509
upvote count: 0
answers question: http://stackoverflow.com/q/26376073
has comment: http://stackoverflow.com/comment/41433090
score: -3
type: Answer
has body: I do not know NUnit. But if you want to fail the test, you can use Asset.fail Or is there any reason to use this method?
has comment: http://stackoverflow.com/comment/53580895

http://stackoverflow.com/comment/41516494
has text: If you're willing to stipulate what browser is used, you could use a browser add-on to talk to the USB hardware and have your web page talk to the browser add-on. Any solution will require some custom code installed on the computer though because you can't get to a USB port from a standard browser.
type: Comment
comment on: http://stackoverflow.com/q/26435557
type: QuestionComment
score: 0

http://stackoverflow.com/a/26455278
accepted answer of: http://stackoverflow.com/q/26455105
has body: you will need to periodically check the available HDD space, paired with a RAM check - i recommend checking the RAM much more often than the HDD. If you want to estimate space-usage, you could approximate the size of your objects, but beware : as the internal representation of objects may change at any time you might get incorrect results, this is implementation-specific, object-sizes cant be accurately measured in java, AFAIK Also note that the upper limit of available RAM always depends on your JVM-settings, the Oracle-JVM setting can be altered via -Xmx, possibles suffixes include m and g, example : -Xmx2g - dont fiddle with -Xms since it can seriously slow down everything if not produce weird crashes because you're effectively circumventing every JVM-optimization free filesystem space &amp; available RAM: /* Total number of processors or cores available to the JVM */ System.out.println("Available processors (cores): " + Runtime.getRuntime().availableProcessors()); /* Total amount of free memory available to the JVM */ System.out.println("Free memory (bytes): " + Runtime.getRuntime().freeMemory()); /* This will return Long.MAX_VALUE if there is no preset limit */ long maxMemory = Runtime.getRuntime().maxMemory(); /* Maximum amount of memory the JVM will attempt to use */ System.out.println("Maximum memory (bytes): " + (maxMemory == Long.MAX_VALUE ? "no limit" : maxMemory)); /* Total memory currently in use by the JVM */ System.out.println("Total memory (bytes): " + Runtime.getRuntime().totalMemory()); /* Get a list of all filesystem roots on this system */ File[] roots = File.listRoots(); /* For each filesystem root, print some info */ for (File root : roots) { System.out.println("File system root: " + root.getAbsolutePath()); System.out.println("Total space (bytes): " + root.getTotalSpace()); System.out.println("Free space (bytes): " + root.getFreeSpace()); System.out.println("Usable space (bytes): " + root.getUsableSpace()); } object size approximation : import…
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26455105
downvote count: 0

http://stackoverflow.com/a/26502715
accepted answer of: http://stackoverflow.com/q/26484440
has comment: http://stackoverflow.com/comment/65292511
upvote count: 9
type: Answer
has body: I found this solution, it seems to work. Extending SimpleUrlAuthenticationFailureHandler you can send the user to different pages, and print the message you want. My main goal wasn't to "override" SPRING_SECURITY_LAST_EXCEPTION.message but was customizing the error message according to the various kind of errors Spring security gives me. web.xml org.springframework.security.web.session.HttpSessionEventPublisher security-config.xml (just some code) session-management <concurrency-control max-sessions="1" expired-url="/login" error-if-maximum-exceeded="true"/> form-login where you call your own AuthenticationFailureHandler (customFailureHandler) <form-login login-page="/login" default-target-url="/index" always-use-default-target="true" authentication-failure-handler-ref="customFailureHandler" username-parameter="j_username" password-parameter="j_password" /> the bean of your own AuthenticationFailureHandler <beans:bean id="customFailureHandler" class="com.springgestioneerrori.controller.CustomAuthenticationFailureHandler"/> and this is the class implementing SimpleUrlAuthenticationFailureHandler import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.DisabledException; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; import org.springframework.security.web.authentication.session.SessionAuthenticationException; public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if(exception.getClass().isAssignableFrom(BadCredentia…
downvote count: 0
score: 9
answers question: http://stackoverflow.com/q/26484440
type: AcceptedAnswer

http://stackoverflow.com/comment/41499297
has text: Is this tag part of Struts? Or where I can get this library?
type: Comment
comment on: http://stackoverflow.com/a/26414141
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41371188
score: 0
type: AnswerComment
type: Comment
has text: No. But if `row4.Date` is not `null` and it has the correct format it should work. For critic you should write a comment.
comment on: http://stackoverflow.com/a/26355086

http://stackoverflow.com/q/26356560
favorite count: 0
type: Question
has body: guys can u help me answer this exercise using for loop without using string methods, just only integers Write a program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits. For example, the program should output the individual digits of 3456 as 3 4 5 6 and the sum as 18,and output the individual digits of -2345 as 2 3 4 5 and the sum as 14. import java.util.*; public class Integer { public static void main(String args[]) { Scanner console = new Scanner(System.in); int input; int sum = 0; int num1 = 0; int counter = 1; String num = ""; System.out.print("enter a number: "); input = console.nextInt(); if (input == (-input)) { input = input * (-1); num = String.valueOf(input); num1 = num.length(); System.out.print("the digits of " + input + " are: "); for (int i = 0; i &lt; num1; i++) { String var = num.substring(i, counter); int var1 = Character.getNumericValue(var.charAt(0)); System.out.print(var + " "); sum = sum + var1; counter++; } System.out.println(); System.out.println("the sum is: " + sum); } else { num = String.valueOf(input); num1 = num.length(); System.out.print("the digits of " + input + " are: "); for (int i = 0; i &lt; num1; i++) { String var = num.substring(i, counter); int var1 = Character.getNumericValue(var.charAt(0)); System.out.print(var + " "); sum = sum + var1; counter++; } System.err.println(); System.out.println("the sum is: " + sum); } } }
downvote count: 3
tagged with: loops
answer count: 1
has comment: http://stackoverflow.com/comment/41372156
tagged with: java
has title: Repitition loops, how to get the sum of the digits of a number
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/26356620
upvote count: 0

http://stackoverflow.com/comment/81170429
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/47110157
has text: All recursion must be coded with an exit condition. Otherwise you'll have an infinite loop, through infinite recursion, which will result in stack overflow, which is the name of this site, for good reason. ;->

http://stackoverflow.com/q/26376439
type: AnsweredQuestion
score: 7
tagged with: java
type: Question
has title: Locale.getDefault() returns unsuported / invalid Locale for Currency.getInstance
possible better answer: http://stackoverflow.com/a/45354577
answer count: 2
has answer: http://stackoverflow.com/a/45354577
tagged with: locale
downvote count: 0
has comment: http://stackoverflow.com/comment/41408612
has answer: http://stackoverflow.com/a/26376604
tagged with: exception
tagged with: android
has body: my app uses the following code to get the local currency: Locale locale = Locale.getDefault() java.util.Currency localCurrency = java.util.Currency.getInstance(locale); This workes fine in all my tests and was never a problem before. Today I saw a CrashLog in the Google Play Developer Console: The app crashes with: java.lang.IllegalArgumentException: Unsupported ISO 3166 country: es I can easy reproduce this error when using new Locale("es") instead of Locale.getDefault(): Locale locale = new Locale("es"); java.util.Currency localCurrency = java.util.Currency.getInstance(locale); Actually the same exception is thrown no matter was language code I use, e.g. "en", "de", "fr", etc. Only when also the country code is specified everthing workes fine, e.g. new Locale("es", "ES") I have two problems with Exception: 1. Why is "es" not a valid locale? As fas as I understand Locale names are formed by a language code (lowercase), and an optional country code. Thus es-ESwould be a valid locale but "es" should be as well, shouldn't it? 2. What can I do to avoid this problem? I use Locale.getDefault() all over the app to give the user locale currency, locale numberformat, etc. I would assume that the system always returns a valid Locale but this is obviously not the case. How can I make sure, that a valid locale is used?
favorite count: 0
has comment: http://stackoverflow.com/comment/41409264
upvote count: 7
accepted answer: http://stackoverflow.com/a/26376604

http://stackoverflow.com/a/26457748
answers question: http://stackoverflow.com/q/26457460
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26457460
type: Answer
has body: The wsdl2java maven plugin does not specify a default location for a WSDL file. However, if you're going to ship your jar file with an included WSDL the JAX-WS specs generally indicate that META-INF/wsdl/ is a good place for such files. In your case, this would be resources/META-INF/wsdl/.
score: 3
upvote count: 3

http://stackoverflow.com/q/26447429
type: UnansweredQuestion
has title: trouble assigning random numbers to 2d array
has answer: http://stackoverflow.com/a/26447495
tagged with: java
has answer: http://stackoverflow.com/a/26447460
has body: I am really new to java and having a bit of trouble with this. I have looked at other code on here and other places with similar problems but I do not understand the library files, etc. I'm trying to understand the basics now. Any help would be appreciated. My current code is: public static void main(String[] args) { double[][] father = new double[25][25]; for (int i = 0; i &lt; 25; i++){ father[i] = Math.random(); for (int j = 0; j &lt; 25; j++){ father[j] = Math.random(); } }
downvote count: 1
type: Question
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/41537285
score: -1
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26447465

http://stackoverflow.com/comment/80459474
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26481910
has text: VTC – this is a software recommendation question.

http://stackoverflow.com/a/31204491
score: 0
type: Answer
has body: I saw there are 80+ views of this question. The solution was to use a handler to send a message to the UI and to re-initialize the data[] array and the DatagramPacket before a new packet comes. The working code is: public static class UDPListener extends Thread{ private boolean running = true; Message msg; byte[] data; DatagramPacket packet; public void run() { try { while(running) { data = new byte[1500]; packet = new DatagramPacket(data, data.length); //Blocks and waits for a packet socket.receive(packet); //Send packet message to UI msg = UDPReceiveHandler.obtainMessage(); msg.obj = packet; UDPReceiveHandler.sendMessage(msg); } } catch (Throwable e) { e.printStackTrace(); } } }
answers question: http://stackoverflow.com/q/26442179

http://stackoverflow.com/comment/41586593
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26474028
type: QuestionComment
has text: Can you log your values before save, after save, before load, and after load? I suspect the issue is with how you are saving or how you are reading the load.

http://stackoverflow.com/comment/41542763
type: Comment
has text: You should use a ThreadLocal rather than using custom threads. http://docs.oracle.com/javase/7/docs/api/java/lang/ThreadLocal.html
score: 0
comment on: http://stackoverflow.com/q/26450712
type: QuestionComment

http://stackoverflow.com/comment/41423888
has text: I am trying to use exec plugin - i have no maven compiler plugin
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26384552
type: Comment

http://stackoverflow.com/q/26513365
has comment: http://stackoverflow.com/comment/41656752
score: 0
has title: Ignore super class field in derived class
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/41656670
has body: I have an abstract super class with the field "UserId" and a derived class that uses all the parent's classes but "UserId". will @JsonIgnore on a similarly named Derived field prevent the serialization of the superclass's "UserId"? Thanks in advance
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41656734

http://stackoverflow.com/a/26519659
has body: I don't think it is in Java spec, I would think of it as of some kind of optimization: re-using session id in general reduces number of generated ids and though possible collisions. However tomcat will do that only for sesionids stored in cookies (for security purposes See http://java.dzone.com/tips/turning-session-fixation for details). To actually locate a place where tomcat 7 does this see: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-catalina/7.0.55/org/apache/catalina/connector/Request.java#2942
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41676848
accepted answer of: http://stackoverflow.com/q/26503074
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26503074

http://stackoverflow.com/a/26368387
type: Answer
answers question: http://stackoverflow.com/q/26367452
has body: Try a single import? import static org.lwjgl.opengl.GL11.* I only have one import on mine, also try importing the packages you need separately. One thing you are likely doing wrong is importing multiple versions of OpenGL
score: 0

http://stackoverflow.com/a/26509875
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26509758
score: 2
upvote count: 2
has body: you declared twice char ch[]! one as global and another local inside the constructor! in the constructor you must have : Stack(int n) { ch = new char[n]; top = -1; }

http://stackoverflow.com/a/26407660
downvote count: 0
has body: It depends on what you want to do. A simple way to alternate the order of the print is to synchronize on the same object, in this case you can use the index or any other object. public class ManyThreadsAdd { public static AtomicInteger index = new AtomicInteger(0); public static void main(String[] args) { ManyThreadsAdd myClass = new ManyThreadsAdd(); Thread thread1 = new Thread(myClass.new RunnableClass()); Thread thread2 = new Thread(myClass.new RunnableClass()); thread1.start(); thread2.start(); } class RunnableClass implements Runnable { public void run(){ synchronized(index){ while(index.get() &lt; 49){ try { Thread.sleep(100); System.out.println(index.get()+"-" +Thread.currentThread()); index.incrementAndGet(); index.notify(); index.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } } }
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26406620
score: 2
answers question: http://stackoverflow.com/q/26406620
has comment: http://stackoverflow.com/comment/41470345
type: AcceptedAnswer

http://stackoverflow.com/comment/41403310
type: Comment
type: QuestionComment
has text: @chrylis - maybe. We have a reporting engine so it's there to do whatever the program calling it wants.
comment on: http://stackoverflow.com/q/26372036
score: 0

http://stackoverflow.com/comment/41417121
type: QuestionComment
score: 1
has text: How does `method` get the `OutputStream` does it open its own one?
comment on: http://stackoverflow.com/q/26381195
type: Comment

http://stackoverflow.com/q/26469902
downvote count: 0
has answer: http://stackoverflow.com/a/26470664
favorite count: 0
has title: Unable to start Chrome in Selenium Web-driver (Java)
accepted answer: http://stackoverflow.com/a/26470664
upvote count: 1
answer count: 4
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/36226559
tagged with: java
has comment: http://stackoverflow.com/comment/41579911
tagged with: selenium
has answer: http://stackoverflow.com/a/36226559
type: Question
has answer: http://stackoverflow.com/a/36574799
has answer: http://stackoverflow.com/a/54873880
has body: I am using selenium webdriver , via Java &amp; TestNG. I've just tried the following code: (for starting chrome browser), package testng1package; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.AssertJUnit; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import org.testng.annotations.AfterTest; public class TestNGFile { //using firefox //public WebDriver driver = new FirefoxDriver() ; //using Chrome System.setProperty("webdriver.chrome.driver", "C://Users//Roey//Desktop//chromedriver.exe"); public WebDriver driver = new ChromeDriver(); String baseurl = "http://newtours.demoaut.com/" ; @BeforeTest public void StartBrowser() { } @Test public void Test1() { driver.get(baseurl); String expectedTitle = "Welcome: Mercury Tours" ; String actualTitle = driver.getTitle(); AssertJUnit.assertEquals(actualTitle , expectedTitle) ; driver.quit(); } @AfterTest public void terminateBrowser() { driver.quit(); } } the test contain error on the system.setproperty, and says: Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error on tokens, delete these tokens If I am cutting and pasting this code line into the @test - it's ok, but I want to use it from the @BeforeTest or the beginning ( as it is it now).

http://stackoverflow.com/q/26467568
answer count: 2
score: 2
downvote count: 0
tagged with: hdfs
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to deploy a standalone version of hadoop 2.5.0. But the Datanode fails to start. Log prints: 2014-10-20 13:42:13,288 FATAL org.apache.hadoop.hdfs.server.datanode.DataNode: Exception in secureMain java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.SharedFileDescriptorFactory.createDescriptor0(Ljava/lang/String;Ljava/lang/String;I)Ljava/io/FileDescriptor; at org.apache.hadoop.io.nativeio.SharedFileDescriptorFactory.createDescriptor0(Native Method) at org.apache.hadoop.io.nativeio.SharedFileDescriptorFactory.create(SharedFileDescriptorFactory.java:87) at org.apache.hadoop.hdfs.server.datanode.ShortCircuitRegistry.<init>(ShortCircuitRegistry.java:165) at org.apache.hadoop.hdfs.server.datanode.DataNode.initDataXceiver(DataNode.java:586) at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:773) at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:292) at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1895) at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1782) at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1829) at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:2005) at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:2029) I googled for a while and couldn't find any useful help. Then I tried to compile hadoop-2.5.0 in my computer(X86-64 CentOS 6.5) since the error somehow related to the native lib, I got the same error. I also tried cdh version, still no good. My hdfs-site.xml: fs.checkpoint.dir /home/seg3/namesecondary dfs.datanode.data.dir /home/seg2/datanodedir dfs.datanode.hdfs-blocks-metadata.enabled true dfs.replication 1 dfs.support.append true dfs.block.local-path-access.user root dfs.client.read.shortcircuit true dfs.domain.socket.path /var/run/hadoop-hdfs/dn._PORT dfs.client.file-block-storage-locations.timeout 10000 And core-site.xml: fs.defaultFS hdfs://l…
tagged with: java-native-interface
tagged with: java
has title: hadoop 2.5.0 failed to start datanode
has answer: http://stackoverflow.com/a/55192778
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/26477859

http://stackoverflow.com/a/26390389
score: 1
answers question: http://stackoverflow.com/q/26390326
downvote count: 0
type: Answer
upvote count: 1
has body: A balanced tree can be used for both lookups by key and by index, both in O(log N) time, if you store a "size" field in each node which tracks how many key/value pairs are contained in the node and all its descendants. The code for looking up a value by index would look something like this (in pseudocode): def at(index) if index == this.left.size return this.value else if index &lt; this.left.size return this.left.at(index) else return this.right.at(index - this.left.size - 1)

http://stackoverflow.com/a/26443984
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41531783
has comment: http://stackoverflow.com/comment/41531466
answers question: http://stackoverflow.com/q/26443634
downvote count: 0
has body: The reason this works is that the recursive call always checks to see if the number at the current index is a 6 and subtracts that from the target. So the order of evaluation is: 1) if (start == nums.length) { if (target == 0) { return true; } return false; } Check to see if the passed index is the length of the array (so this would mean the index is BEYOND the bounds of the array - the last index of the array would be nums[nums.length - 1] ). If yes, AND if the target is 0, return true. Otherwise return false, because there are no more values to check 2) if (nums[start] == 6) { return groupSum6(start + 1, nums, target - nums[start]); } Check if the number at the index is 6. If it is, subtract 6 from the target, add one to the index, and check the remaining values. 3) Otherwise... if (groupSum6(start + 1, nums, target - nums[start])) { return true; } Evaluate if the rest of the array works to add up to the target. If it does return true. The key is to notice that this step will always happen AFTER we check if the value is a 6. Essentially here you are looking for a solution that COUNTS the number in the start index. If a solution is found we can end. If no solution is found using the number at num[start], then we go on to: 4) return groupSum6(start + 1, nums, target); Checking for a solution that exists when we DON'T use the number at num[start]. The key is that each time the recursive call is made the check for a 6 is done first ( assuming you aren't beyond the bounds of the array).
type: Answer

http://stackoverflow.com/q/26419401
score: 0
tagged with: smartcard
answer count: 1
has body: I have everything working just fine. The signing class is implemented as a SwingWorker(just for added info). Signing process is done via smart card and WINDOWS-MY keystore. My question is this: When a "sign" button is clicked, signing process starts and I get the insert PIN window. If for some reason I didn't choose the right file for signing or something like that and i want to go back I press CANCEL. How can I catch that event, that a cancel button was pressed in the insert PIN panel. thanks
tagged with: digital-signature
type: AnsweredQuestion
tagged with: java
tagged with: itext
accepted answer: http://stackoverflow.com/a/26435181
has title: digitial signature smart card wrong pin feedback
type: Question
has answer: http://stackoverflow.com/a/26435181

http://stackoverflow.com/a/26357967
downvote count: 0
has body: One way to approach your problem is to check index of "\n" specified amount of times until you find the line you need. I'm writing this off the top of my head so i'm sorry if syntax is not 100% accurate, but the logic is here: public String readSpecifiedLine(String str, int lineNumber){ int lineStartIndex = 0; //start by finding start of specified line for(int i=0;i&lt;lineNumber;i++){ lineStartIndex = str.IndexOf("\n",lineStartIndex); //find new line symbol from //specified index lineStartIndex++; //increase the index by 1 so the to skip newLine Symbol on //next search or substring method //Note, you might need to increase by 2 if "\n" counts as 2 characters in a string } int nextLine = str.IndexOf("\n",lineStartIndex); //end of line 7 retrun str.substring(lineStartIndex,nextline); } You might need to play around with indexes
upvote count: 1
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26357469

http://stackoverflow.com/a/70865534
downvote count: 0
answers question: http://stackoverflow.com/q/26460410
score: 21
type: Answer
upvote count: 21
has comment: http://stackoverflow.com/comment/136761423
has body: Start from IntelliJ IDEA 2021.2, there is a feature called Open an external profiling report. The UI for the viewer like below: You can view the heap dump by either: View &gt; Tool Windows &gt; Profiler from main menu and click Open Snapshot Run &gt; Open Profiler Snapshot &gt; Open from main menu Drag the heap dump file into IntelliJ window

http://stackoverflow.com/comment/41584378
has text: Added XML configuration for that `EmptyListRequestHandlerAdvice`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26466807

http://stackoverflow.com/q/26377063
has answer: http://stackoverflow.com/a/26377497
downvote count: 2
tagged with: multithreading
has title: java multithreading , creating object for each thread
has comment: http://stackoverflow.com/comment/41573280
has body: I have two class CallISPSubscriberDump (This class reads from Database total no of process id , for each process id it calls ISPSubscriberDump class to create a file) and ISPSubscriberDump (Used to create ISP subscriber dump file which is sent to network for provioning ). I am using Executor Service to create multiple threads and passing process id to ISPSubscriberDump in its constructor , But in this approach i have to create as many objects as many threads are running. This process is working fine. As i have to run a thread for each process Id , is there any other way in which i can create only single object and crate multiple objects? public class CallISPSubscriberDump { public void createFile() { List&lt;Integer&gt; totalId = new ArrayList&lt;Integer&gt;(); List&lt;String&gt; dataFlag = new ArrayList&lt;String&gt;(); //Reading process Id and dataFlag from database and populating in list try { if (totalId.size() == 0) { throw new Exception("No process id found for ISP Dump"); } else { // MAX_THRAED is max limit of threads int maxthred = totalId.size() &lt; Integer.parseInt(logGererator.getProperty("MAX_THRAED")) ? totalId.size() : Integer.parseInt(logGererator.getProperty("MAX_THRAED")); ExecutorService executor = Executors.newFixedThreadPool(maxthred); for (int cnt = 0; cnt &lt; totalId.size(); cnt++) { //For a particular thread assigning a particular process I create N object of ISPSubscriberDump for N thread and assign process Id in its constructor executor.execute(new ISPSubscriberDump(totalId.get(cnt),dataFlag.get(cnt))); } executor.shutdown(); while (!executor.isTerminated()) { } System.out.println("Finished all threads"); } } catch (Exception e) { e.printStackTrace(); } public class ISPSubscriberDump implements Runnable { private int processId; private String dataFlag; public ISPSubscriberDump(int processId,String dataFlag){ this.processId=processId; this.dataFlag=dataFlag; } public void run() { // File Creation createFile(); } createFile() { int currentPr…
tagged with: java
has comment: http://stackoverflow.com/comment/41411764
type: Question
upvote count: 0
score: -2
answer count: 1
tagged with: executorservice
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41586944
type: QuestionComment
has text: You can create a ContactInfo object (the one annotated with xml) just like any java class.. Create ContactInfo, and load its fields from your pojo
comment on: http://stackoverflow.com/q/26474469
score: 0
type: Comment

http://stackoverflow.com/a/26381082
has body: You need to change your while loop String str=""; while((str=data.readLine()) != null){ // read the line for(int i=0; i&lt;data1.length;i++){ data1[i]=str; // and reuse it if(data1[i] == null){ break; } } } What is the issue in your code? you are skipping first line. while(data.readLine() != null){ // already reads first line here for(int i=0; i&lt;data1.length;i++){ data1[i]=data.readLine(); // now you are reading from 2nd line if(data1[i] == null){ break; } } }
answers question: http://stackoverflow.com/q/26381048
score: 0
type: Answer

http://stackoverflow.com/q/26513492
has comment: http://stackoverflow.com/comment/41663829
downvote count: 0
has comment: http://stackoverflow.com/comment/41660966
answer count: 1
has title: Why are my null checks so slow?
has answer: http://stackoverflow.com/a/26518260
has comment: http://stackoverflow.com/comment/41659904
has comment: http://stackoverflow.com/comment/41662848
favorite count: 0
has comment: http://stackoverflow.com/comment/41663623
has comment: http://stackoverflow.com/comment/41659889
has body: So I have code that currently looks like this public boolean in(TransactionType... types) { if (types == null || types.length == 0) return false; for (int i = 0; i &lt; types.length; ++i) if (types[i] != null &amp;&amp; types[i] == this) return true; return false; } I changed it to this public boolean in(TransactionType... types) { if (types == null || types.length == 0) return false; for (int i = 0; i &lt; types.length; ++i) if (types[i] == this) return true; return false; } (TransactionType is an enum with roughly 30 values in it) The results shocked me. In all of my tests, the second was an order of magnitude faster. I expected maybe 2x faster, but not an order of magnitude. Why the difference? Is it the nullcheck that is that much slower or is something strange happening with the extra array access? My benchmark code looks like this public class App { public enum TransactionType { A(1, "A", "A"), B(3, "B", "B"), C(5, "C", "C"), D(6, "D", "D"), E(7, "E", "E"), F(8, "F", "F"), G(9, "G", "G"), H(10, "H", "H"), I(11, "I", "I"), J(12, "J", "J"), K(13, "K", "K"), L(14, "L", "L"), M(15, "M", "M"), N(16, "N", "N"), O(17, "O", "O"), P(18, "P", "P"), Q(19, "Q", "Q"), R(20, "R", "R"), S(21, "S", "S"), T(22, "T", "T"), U(25, "U", "U"), V(26, "V", "V"), W(27, "W", "W"), X(28, "X", "X"), Y(29, "Y", "Y"), Z(30, "Z", "Z"), AA(31, "AA", "AA"), AB(32, "AB", "AB"), AC(33, "AC", "AC"), AD(35, "AD", "AD"), AE(36, "AE", "AE"), AF(37, "AF", "AF"), AG(38, "AG", "AG"), AH(39, "AH", "AH"), AI(40, "AI", "AI"), AJ(41, "AJ", "AJ"), AK(42, "AK", "AK"), AL(43, "AL", "AL"), AM(44, "AM", "AM"), AN(45, "AN", "AN"), AO(46, "AO", "AO"), AP(47, "AP", "AP"); public final static TransactionType[] aArray = { O, Z, N, Y, AB }; public final static TransactionType[] bArray = { J, P, AA, L, Q, M, K, AE, AK, AF, AD, AG, AH }; public final static TransactionType[] cArray = { S, U, V }; public final static TransactionType[] dArray = { A, B, D, G, C, E, T, R, I, F, H, AC, AI, AJ, AL, AM, AN, AO }; private int…
has comment: http://stackoverflow.com/comment/41663335
has comment: http://stackoverflow.com/comment/41664862
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41661062
has comment: http://stackoverflow.com/comment/41661306
tagged with: java
has comment: http://stackoverflow.com/comment/41659034
accepted answer: http://stackoverflow.com/a/26518260
has comment: http://stackoverflow.com/comment/41657112
has comment: http://stackoverflow.com/comment/41657109
upvote count: 7
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/41656966
tagged with: null
has comment: http://stackoverflow.com/comment/41657388
score: 7
has comment: http://stackoverflow.com/comment/41663656
has comment: http://stackoverflow.com/comment/41661194
has comment: http://stackoverflow.com/comment/41660039
has comment: http://stackoverflow.com/comment/41657805
has comment: http://stackoverflow.com/comment/41657210

http://stackoverflow.com/comment/41605248
type: Comment
has text: It is permgen being dropped (graph top right of the image is permgen) - so not new generation. The question was more about how ~80mb of permgen was collected with no GC activity being logged (top left graph in image).
comment on: http://stackoverflow.com/a/26481586
score: 0
type: AnswerComment

http://stackoverflow.com/a/26495468
answers question: http://stackoverflow.com/q/26495327
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41640301
has body: I'm not sure if this will help you a lot, but you might be able to clean up some of your code by creating a method. You could create a method to declare the visibility of the 'Digi's. A method like this may look like the code below. Code: public void multipleVisibleSet(boolean 1Visible, boolean 2Visible, boolean 3Visible, boolean 4Visible, boolean 5Visible, boolean 6Visible, boolean 7Visible){ Digi1.setVisible(1Visible); //Add as many as you need Digi2.setVisible(2Visible); Digi3.setVisible(3Visible); Digi4.setVisible(4Visible); Digi5.setVisible(5Visible); Digi6.setVisible(6Visible); Digi7.setVisible(7isible); }

http://stackoverflow.com/comment/41554475
comment on: http://stackoverflow.com/a/26456948
score: 0
type: AnswerComment
has text: Thank you so much for the help! that function works now. now i can work on the other function of the code :D
type: Comment

http://stackoverflow.com/q/26373622
type: Question
tagged with: android-fragments
tagged with: actionbarsherlock
has comment: http://stackoverflow.com/comment/41421705
has body: My Android App crashes on restart after 12 hours' idle time. I have been trying to add empty constructors everywhere (as the crash log told me to do so), but still fail. Here is the crash log: E/AndroidRuntime(22225): FATAL EXCEPTION: main E/AndroidRuntime(22225): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abcde.com/com.abcde.com.HomeActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.abcde.com.BaseSlideActivity$12: make sure class name exists, is public, and has an empty constructor that is public E/AndroidRuntime(22225): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2080) E/AndroidRuntime(22225): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105) E/AndroidRuntime(22225): at android.app.ActivityThread.access$600(ActivityThread.java:136) E/AndroidRuntime(22225): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201) E/AndroidRuntime(22225): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(22225): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(22225): at android.app.ActivityThread.main(ActivityThread.java:4881) E/AndroidRuntime(22225): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(22225): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(22225): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:804) E/AndroidRuntime(22225): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:571) E/AndroidRuntime(22225): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(22225): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.abcde.com.BaseSlideActivity$12: make sure class name exists, is public, and has an empty constructor that is public E/AndroidRuntime(22225): at android.support.v4.app.Fragment.instantiate(Fragment.java:413) E/AndroidRuntime(22225): at …
score: 0
has comment: http://stackoverflow.com/comment/41551860
has comment: http://stackoverflow.com/comment/41403909
has answer: http://stackoverflow.com/a/26383620
has title: Android crash on restart app : java.lang.InstantiationException: can't instantiate class ; no empty constructor
has comment: http://stackoverflow.com/comment/41410331
answer count: 1
has comment: http://stackoverflow.com/comment/41442157
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java
upvote count: 1
tagged with: android-intent
has comment: http://stackoverflow.com/comment/41404331
downvote count: 1

http://stackoverflow.com/a/26373802
score: -1
has comment: http://stackoverflow.com/comment/41404152
has comment: http://stackoverflow.com/comment/41404458
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41404180
has comment: http://stackoverflow.com/comment/41404887
upvote count: 0
accepted answer of: http://stackoverflow.com/q/26373750
has body: You can change your for to this: for (int i = 0; i &lt; length - sub + 1; i++){ System.out.println(line.substring(i, i + sub)); } What this does is iterating from first character to third from last and always substring-ing from index to index + sub.
downvote count: 1
answers question: http://stackoverflow.com/q/26373750

http://stackoverflow.com/q/26418376
score: 4
accepted answer: http://stackoverflow.com/a/26418391
favorite count: 0
has body: Although the error is quite descriptive I could not get a hang of it. For lines: PowerMockito.when( mockStringMessageService.lookupString(Matchers.eq("XYZ"))) .thenReturn(Matchers.eq("XYZ")); Error is: [junit] Invalid use of argument matchers! [junit] 0 matchers expected, 1 recorded: [junit] -&gt; at com.amazon.kilvish.types.StatusTableTest.setUp(StatusTableTest.java:61) [junit] [junit] This exception may occur if matchers are combined with raw values: [junit] //incorrect: [junit] someMethod(anyObject(), "raw String"); [junit] When using matchers, all arguments have to be provided by matchers. [junit] For example: [junit] //correct: [junit] someMethod(anyObject(), eq("String by matcher")); [junit] [junit] For more info see javadoc for Matchers class. Why are 0 matchers expected?
tagged with: unit-testing
type: Question
has title: Invalid use of argument matchers! 0 matchers expected, 1 recorded
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26418391
tagged with: java
upvote count: 4
tagged with: mockito
tagged with: junit
downvote count: 0
answer count: 1

multidimensional-array
tags question: http://stackoverflow.com/q/26512064
tags question: http://stackoverflow.com/q/26484736
tags question: http://stackoverflow.com/q/26459271
type: Tag
tags question: http://stackoverflow.com/q/26444049
tags question: http://stackoverflow.com/q/26396384
tags question: http://stackoverflow.com/q/26510122
tags question: http://stackoverflow.com/q/26510318
tags question: http://stackoverflow.com/q/26427805
tags question: http://stackoverflow.com/q/26475775
tags question: http://stackoverflow.com/q/26437975
tags question: http://stackoverflow.com/q/26388638
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/26364459

http://stackoverflow.com/a/26367849
has comment: http://stackoverflow.com/comment/41396035
upvote count: 1
has body: Here is the code: private Random num = new Random(); private int answer = num.nextInt(10) +1; private int guess; private String playAgain; Scanner input = new Scanner(System.in); public void inputGuess(){ System.out.println("Enter a number between 1 and 10 as your first guess: "); guess = input.nextInt(); do{ if (guess &lt; 1 || guess &gt; 10){ System.out.println("That is not a valid entry. Please try again: "); guess = input.nextInt(); }else if (guess &gt; answer){ System.out.println("Too high, Try Again: "); guess = input.nextInt(); }else if (guess &lt; answer){ System.out.println("Too low, Try Again: "); guess = input.nextInt(); } if(guess == answer) { System.out.println("Congratulations, You guessed the number!"); System.out.println("Would you like to play again? Enter Y to play or any other key to quit: "); playAgain = input.nextLine(); } }while (!playAgain.equals("Y") &amp;&amp; !playAgain.equals("y")); } You just need to introduce the winning/losing logic inside the while, and the condition will be the ending/continue flag. Another thing is always remember when comparing strings to use the equals method, since the == will compare the object reference and not the String value, in some cases == will return true for equal string since how JVM stores the Strings, but to be sure always use equals.
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41393822
answers question: http://stackoverflow.com/q/26367626

java-8
tags question: http://stackoverflow.com/q/26475030
tags question: http://stackoverflow.com/q/26431882
tags question: http://stackoverflow.com/q/26440786
tags question: http://stackoverflow.com/q/26424759
tags question: http://stackoverflow.com/q/26499904
tags question: http://stackoverflow.com/q/26358486
tags question: http://stackoverflow.com/q/26511506
tags question: http://stackoverflow.com/q/26361559
tags question: http://stackoverflow.com/q/26354341
tags question: http://stackoverflow.com/q/26497932
tags question: http://stackoverflow.com/q/26483324
tags question: http://stackoverflow.com/q/26463771
tags question: http://stackoverflow.com/q/26478010
tags question: http://stackoverflow.com/q/26439163
tags question: http://stackoverflow.com/q/26457622
tags question: http://stackoverflow.com/q/26370994
tags question: http://stackoverflow.com/q/26381015
tags question: http://stackoverflow.com/q/26507332
tags question: http://stackoverflow.com/q/26493037
tags question: http://stackoverflow.com/q/26397022
tags question: http://stackoverflow.com/q/26403911
tags question: http://stackoverflow.com/q/26393594
tags question: http://stackoverflow.com/q/26398951
tags question: http://stackoverflow.com/q/26371055
tags question: http://stackoverflow.com/q/26504594
tags question: http://stackoverflow.com/q/26403319
tags question: http://stackoverflow.com/q/26482149
tags question: http://stackoverflow.com/q/26493414
tags question: http://stackoverflow.com/q/26491666
tags question: http://stackoverflow.com/q/26414820
tags question: http://stackoverflow.com/q/26392664
tags question: http://stackoverflow.com/q/26512518
tags question: http://stackoverflow.com/q/26462136
tags question: http://stackoverflow.com/q/26364330
tags question: http://stackoverflow.com/q/26355354
tag name: java-8
tags question: http://stackoverflow.com/q/26454129
tags question: http://stackoverflow.com/q/26455482
type: Tag
tags question: http://stackoverflow.com/q/26476605
tags question: http://stackoverflow.com/q/26385750
tags question: http://stackoverflow.com/q/26439431
tags question: http://stackoverflow.com/q/26451590
tags question: http://stackoverflow.com/q/26394204

http://stackoverflow.com/q/26403422
accepted answer: http://stackoverflow.com/a/26405313
has title: JSch interrupt command executing
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/59599087
has answer: http://stackoverflow.com/a/59599087
downvote count: 0
tagged with: jsch
favorite count: 0
has answer: http://stackoverflow.com/a/26405313
has body: I have swing application with two buttons for running and stopping executing of JSch command. So I have next method which invokes when we clicked on start button: public String executeSSHCommand(String pattern, String listFiles) { searchRez = new StringBuilder(); BufferedReader br = null; String line, cmd = null; // adding ' symbol to pattern pattern = "'"+pattern+"'"; // try { Channel channel = session.openChannel("exec"); cmd = "zgrep " + pattern + " " + listFiles; log.debug("Executing next ssh command: " + cmd); ((ChannelExec)channel).setCommand(cmd); channel.setInputStream(null); ((ChannelExec)channel).setErrStream(System.err); InputStream in=channel.getInputStream(); channel.connect(); // read server output br = new BufferedReader(new InputStreamReader(in)); while(true &amp;&amp; !isCancel){ while ((line = br.readLine()) != null &amp;&amp; !isCancel) { searchRez.append(line+"\n"); } if(channel.isClosed()){ log.debug("Exit status for execute ssh command is " + channel.getExitStatus()); break; } try{Thread.sleep(1000);}catch(Exception ee){log.error(ee);} } if (isCancel) { log.debug("Search was canceled by user... "); channel.setInputStream(null); if (in != null) { in.close(); in = null; } if (br != null) { br.close(); br = null; } try{Thread.sleep(1000);}catch(Exception ee){log.error(ee);} } // channel.disconnect(); session.disconnect(); log.debug("Search pattern in log file is complete."); } catch (Exception ex) { log.error(ex); } log.debug("Rezult string has next value: " + searchRez.toString()); return searchRez.toString(); } As you can see above we have isCancel variable, it's boolean volatile variable which we set to false when click on stop button. So my problem is when user click on stop button and channel with sessions become disconnected, zgrep expression continue works on server. I thought that channel.disconnect() should stop all my running commands on server, could someone please advise how to fix this. Thanks.
upvote count: 2
tagged with: swing

http://stackoverflow.com/a/26447283
has body: Language: C/C++: Create a structure like: int count = 0; //treat count,count1, count2 as global variable int count1 = 0; // so define these outside main () int count2 = 0; int count3 = 0; struct node{ int data; //data or value at that particular node struct node* left; //left pointer struct node* right; }Node; //Node is a type of node Node node1 = (Node)((malloc) sizeof(Node)) //to create a space in memory (if available) and 99.99% times it's available Now, you can use whatever function you want. Like if you want to find length: int findLength(Node* head){ node* temp = head; //initialize temp to head to use it further if(temp-&gt;left != NULL || temp-&gt;right!=NULL){ count1 += findLength(temp-&gt;left); count2 += findLength(temp-&gt;right); //next line: if(count1&gt;count2, make count3=count1 , else count3=count2) count3 = (count1&gt;count2)? count1 : count2; count += count3; //add count3 to previous value of count return count+1; } if(temp-&gt;left == NULL &amp;&amp; temp-&gt;right == NULL){ return 1; } else if(head == NULL) return 0; return count++; }
upvote count: 1
has comment: http://stackoverflow.com/comment/41536884
has comment: http://stackoverflow.com/comment/41714643
has comment: http://stackoverflow.com/comment/41536946
downvote count: 0
has comment: http://stackoverflow.com/comment/41537126
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26447137

http://stackoverflow.com/comment/41374280
score: 0
has text: I'm not sure how many times I can say the same thing. What would you want the answer to be for November 2nd 2014 at 1.30am? That local time occurs twice... once before the clocks go back, and once after they go back. (Because the time goes from 2am back to 1am.)
comment on: http://stackoverflow.com/q/26354252
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26425270
has answer: http://stackoverflow.com/a/26425483
has title: How would I let my main method access the paint method I created inside Applet?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26425483
type: Question
answer count: 1
score: 0
has body: The paint class with hello is what I'd like to use the main variables in. How would I do so? I would like to move the variables so I can make a conditional to draw strings when the correct or incorrect letter is guess. import static java.lang.System.*; import javax.swing.*; import java.util.*; import java.io.*; import java.awt.*; import java.applet.*; import static java.lang.System.*; public class testing extends Applet { public static void main(String[]args)throws IOException { JFrame jp1 = new JFrame(); testing a =new testing (); jp1.getContentPane().add(a, BorderLayout.CENTER); jp1.setSize(new Dimension(500,500)); jp1.setVisible(false); Random random = new Random(); Scanner scanner = new Scanner(new File("C:\\Users\\s612153\\Documents\\Java files\\words.data")); ArrayList &lt;String&gt; arraylist = new ArrayList&lt;String&gt;(); ArrayList &lt;String&gt; arrayinco = new ArrayList&lt;String&gt;(); ArrayList &lt;String&gt; arraycorr = new ArrayList&lt;String&gt;(); int c = scanner.nextInt(); int variable = random.nextInt(c) + 1; for(int x = 0; x &lt; c; x++) { String string = scanner.next(); arraylist.add(string); } String word = arraylist.get(variable); word = word.toUpperCase(); out.println(word); int length = word.length(); ArrayList &lt;String&gt; arrayundr = new ArrayList&lt;String&gt;(); for(int x = 0; x &lt; length; x++) { arrayundr.add("_ "); } out.println(arrayundr); int attempts = 7; int var = 0; for(int x = var; x &lt; attempts; x = x) { String guess = JOptionPane.showInputDialog("Enter a letter: "); char Char = guess.charAt(0); Char = Character.toUpperCase(Char); if(word.indexOf(Char) &gt;= 0) { String let = Character.toString(Char); int gerb = word.indexOf(Char); int kirby = word.indexOf(Char, gerb + 1); out.println("That is correct"); arraycorr.add(let); arrayundr.set(gerb, let); out.println("WORD: " + arrayundr); attempts = attempts + 1; } else if(word.indexOf(Char) != 0) { String bet = Character.toString(Char); out.println("incorrect!"); arrayinco.ad…

http://stackoverflow.com/a/26410027
has comment: http://stackoverflow.com/comment/41468281
answers question: http://stackoverflow.com/q/26409907
has body: int a = Integer.valueOf(args[0]); int b = Integer.valueOf(args[1]); Very simple. I found a lot just looking at Google. Or: Integer i = new Integer(args[x]);
score: 0
has comment: http://stackoverflow.com/comment/41468988
type: Answer

http://stackoverflow.com/comment/41423188
score: 3
comment on: http://stackoverflow.com/q/26384294
type: Comment
has text: `JComboBox` is "typeable" by default. If you focus it and start typing, it will jump to the element that starts with what you type, although what you type is not visible.
type: QuestionComment

http://stackoverflow.com/comment/41552337
score: 0
has text: Could you please confirm that my answer solved your issue by accepting it, otherwise please post more details so we can help you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26415550

http://stackoverflow.com/q/26420853
has comment: http://stackoverflow.com/comment/41487818
has body: I'm writing a code in Java which involves databases (SQLite), and I'm new at it, so I need help with this one. My code looks like this: Connection connection = null; try { connection = SQLiteConnector.getConnection(database Name); PreparedStatement prepStat = connection.prepareStatement("some SQL stuff"); ResultSet result= prepStat.executeQuery(); // Use of result if (condition1){ prepStat = connection.prepareStatement("some SQL stuff"); result = prepStat.executeQuery(); // Another use of result if (condition2){ prepStat = connection.prepareStatement("some SQL stuff"); } else{ prepStat = connection.prepareStatement("some SQL stuff"); } result = prepStat.executeQuery(); // Use of result result.close(); prepStat.close(); } } catch (Exception e) { // Exception management } finally{ SQLiteConnector.closeConnection(connection); } And I get an exception saying: "Resource leak: 'stat' is not closed at this location" in the else block. How should I refactor it? Thank you in advance
linked to: http://stackoverflow.com/q/22096398
type: UnansweredQuestion
tagged with: memory-leaks
has title: Java resource leak in PreparedStatement
has comment: http://stackoverflow.com/comment/41488776
tagged with: java
has comment: http://stackoverflow.com/comment/41487702
tagged with: prepared-statement
type: Question
has answer: http://stackoverflow.com/a/26421550
has answer: http://stackoverflow.com/a/26421890
score: 0
has comment: http://stackoverflow.com/comment/41487756
answer count: 3
has answer: http://stackoverflow.com/a/26422077
has comment: http://stackoverflow.com/comment/41487761
has comment: http://stackoverflow.com/comment/41487695
tagged with: sqlite

http://stackoverflow.com/q/26501791
tagged with: sql-server
has comment: http://stackoverflow.com/comment/41760930
has comment: http://stackoverflow.com/comment/41877963
accepted answer: http://stackoverflow.com/a/26553900
tagged with: jdbc
answer count: 4
favorite count: 0
tagged with: sql-server-2012
has title: Why does Microsoft SQL Server 2012 query take minutes over JDBC 4.0 but second(s) in Management Studio?
linked to: http://stackoverflow.com/q/15074037
score: 12
has comment: http://stackoverflow.com/comment/41790489
has answer: http://stackoverflow.com/a/39697179
has comment: http://stackoverflow.com/comment/41901991
has comment: http://stackoverflow.com/comment/41793936
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41718705
tagged with: java
possible better answer: http://stackoverflow.com/a/26553784
has answer: http://stackoverflow.com/a/26553784
has answer: http://stackoverflow.com/a/26551527
type: Question
linked to: http://stackoverflow.com/q/961078
has body: I am dealing with what is apparently a performance issue while retrieving a relatively large ResultSet from a remote Microsoft SQL Server 2012 to a Java client that uses Microsoft JDBC Driver 4.0. When I run the corresponding query on the remote server's Microsoft SQL Server Management Studio, it returns approx. 220k rows almost instantaneously. When I issue the same query from the client, it stalls. The same test has worked fine also on the client with an earlier version of the database where only approx. 400 rows qualified. I tried to tackle this by appending ;responseBuffering=adaptive" to the URL passed to DriverManager.getConnection(). After the connection is established, I see this property (among several others) in the result from connection.getMetaData().getURL(), but[ connection.getClientInfo(responseBuffering) returns null, and what is more the client is still stalling. What could be going wrong here and how can I instruct the a Microsoft SQL Server (not just suggest to it -- programmatically in Java) that it must return rows in smaller chunks rather than all at once or improve JDBC query times by some other measures. Two further observations that seem somewhat strange and that perhaps point to a different root cause entirely: When the client stalls it still shows only relatively light CPU load, unlike what I would expect from heavy garbage collection "responseBuffering=adaptive" should be the normal default by now UPDATE I've checked and found that switching from PreparedStatement to Statementdoes not improve things in my case (it apparently can help in other cases). UPDATE Here is my current query: select PARENT.IDENTIFIER as PARENT_IDENTIFIER, PARENT.CLASS as PARENT_CLASS, CHILD.TYPE as CHILD_TYPE, CHILD.IDENTIFIER as CHILD_IDENTIFIER, PROPERTY.IDENTIFIER as PROPERTY_IDENTIFIER, PROPERTY.DESCRIPTION as PROPERTY_DESCRIPTION, PROPERTY.TYPE as PROPERTY_TYPE, PROPERTY.PP as PROPERTY_PP, PROPERTY.STATUS as PROPERTY_STATUS, PROPERTY.TARGET as PROPERTY_TARGET …
upvote count: 12
has comment: http://stackoverflow.com/comment/41728039
has comment: http://stackoverflow.com/comment/41878026
has comment: http://stackoverflow.com/comment/41762671
has comment: http://stackoverflow.com/comment/41761189
downvote count: 0
has answer: http://stackoverflow.com/a/26553900
linked to: http://stackoverflow.com/q/26571488

http://stackoverflow.com/q/26472576
tagged with: java
linked to: http://stackoverflow.com/q/8306374
possible better answer: http://stackoverflow.com/a/26473224
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26473910
favorite count: 0
type: Question
tagged with: android
score: 1
tagged with: timer
answer count: 2
has title: onPause, onStop, onDestroy not stopping timer
upvote count: 1
has answer: http://stackoverflow.com/a/26473910
has answer: http://stackoverflow.com/a/26473224
has body: In my onCreate method in my activity i call a method from an object and pass the methods value as 1 which means to start a timer in the objects class. However I want to stop the timer whenever the app closes, loses focus or someone pressed the back button on their device and exited the app. I tried doing this below my onCreate method with an onPause, onStop, onDestroy and entered the methods value as 2 for the object which means to cancel the timer. However my problem is that whenever someone presses the back button on their device and then goes back in to the app the same timer is running twice because the app did not cancel the timer in the onStop, onPause or onDestroy. Why didn't the onStop, onPause and onDestroy stop the timer and how do i make it stop the timer so two arent running when the app is reopened? Activity below Ship mShip = new Ship(0,0,0); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); mShip.timerStart(1); } @Override public void onPause() { super.onPause(); mShip.timerStart(2); } @Override public void onStop() { super.onStop(); mShip.timerStart(2); } @Override public void onDestroy() { super.onDestroy(); mShip.timerStart(2); } Ship Class below public static int counter = 0; public static int counterPerSec = 5; TimerClass startTimer = (TimerClass) new TimerClass(2000,1000) { @Override public void onFinish() { counter += counterPerSec; this.start(); } }; public void timerStart(int x) { if(x == 1) { startTimer.start(); } if(x == 2) { startTimer.cancel(); } } Timer Class public class TimerClass extends CountDownTimer { public TimerClass(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); } @Override // when timer is finished public void onFinish() { this.start(); } @Override // on every tick of the timer public void onTick(long millisUntilFinished) { } }

http://stackoverflow.com/comment/41633446
type: Comment
comment on: http://stackoverflow.com/a/26500605
score: 0
type: AnswerComment
has text: I am trying to validate the user input of + - / or *. I wolud declare them in a println saying if the input of length [0], [1]the ones bunched in the split, and [2] the other number in the expression.

http://stackoverflow.com/comment/41434180
type: AnswerComment
type: Comment
has text: It would be better to override `toString` method and let the client consume it. Do not rely on `System.out.println` in your base code.
score: 2
comment on: http://stackoverflow.com/a/26390470

http://stackoverflow.com/comment/41641866
score: 0
type: QuestionComment
type: Comment
has text: @AshleyFrieze Unless I have misunderstood what you are saying, no `@Lazy` doesn't go on the user of the bean.. From the [@Lazy Javadoc](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/Lazy.html): _May be used on any class directly or indirectly annotated with @Component or on methods annotated with @Bean.... If present and set to true, the @Bean or @Component will not be initialized until referenced by another bean or explicitly retrieved from the enclosing BeanFactory._
comment on: http://stackoverflow.com/q/26504224

http://stackoverflow.com/q/26423862
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26425262
has body: I have class EditTextMonitor in Models package, example: public class EditTextMonitor extends EditText{ private final Context mcontext; // Just the constructors to create a new EditText... public EditTextMonitor(Context context) { super(context); this.mcontext = context; } public EditTextMonitor(Context context, AttributeSet attrs) { super(context, attrs); this.mcontext = context; } public EditTextMonitor(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.mcontext = context; } @Override public boolean onTextContextMenuItem(int id) { // Do your thing: boolean consumed = super.onTextContextMenuItem(id); // React: switch (id){ case android.R.id.copy: onTextCopy(); case android.R.id.paste: onTextCopy(); } return consumed; } public void onTextCopy(){ ((TextEditorActivity)mcontext).startAmode(); } } In my java class: EditTextMonitor editor = (EditTextMonitor) findViewById(R.id.texteditor); In xml view file it`s defined: &lt;Models.EditTextMonitor android:id="@+id/texteditor" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_horizontal" android:layout_margin="5dp" android:background="@color/white" android:ems="10" android:gravity="top" android:inputType="textMultiLine" android:padding="5dp" android:textAllCaps="false" /&gt; But i have error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.atompark.atompark_sms/com.atompark.atompark_sms.TextEditorActivity}: java.lang.ClassCastException: android.widget.EditText cannot be cast to Models.EditTextMonitor at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471) at android.app.ActivityThread.access$900(ActivityThread.java:175) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityT…
score: -1
has comment: http://stackoverflow.com/comment/41496070
upvote count: 0
has title: ClassCastException: android.widget.EditText cannot be cast to Models.EditTextMonitor
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41493531
type: UnansweredQuestion
tagged with: classcastexception
tagged with: android
has comment: http://stackoverflow.com/comment/41496872
has comment: http://stackoverflow.com/comment/41493987
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/41495571
tagged with: java

http://stackoverflow.com/q/26499782
type: Question
score: 0
answer count: 1
has body: Is there any way to mocking part of camel route? I build such a route: from("a").b().signReq().send().validateAns().c().to("d"); but when i run tests, i don't want add signReq().send().validateAns() into route. Any suggestions? Also, maybe there is a way to encapsulate such part of route into method? It will be great, because i have many routes and many same interaction parts. Best if it can be done without runtime choice/when switches, because i know all conditions in configure phase.
has comment: http://stackoverflow.com/comment/41645264
has comment: http://stackoverflow.com/comment/41632089
has answer: http://stackoverflow.com/a/26509095
type: UnansweredQuestion
has title: Mocking or encapsulate part of camel route
linked to: http://stackoverflow.com/q/14970516
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/41632875
tagged with: java
tagged with: apache-camel

http://stackoverflow.com/comment/41508201
type: AnswerComment
score: 0
type: Comment
has text: Sry, switched to `Integer.compare(int, int)` since age is a primitive `int`. Did not realize that in the first step ...
comment on: http://stackoverflow.com/a/26431389

http://stackoverflow.com/a/26512084
answers question: http://stackoverflow.com/q/26511185
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41660149
type: Answer
has comment: http://stackoverflow.com/comment/41654372
score: 0
has comment: http://stackoverflow.com/comment/41654691
has body: Use a BufferedReader Something like this: BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); string line = ""; while ((line = reader.readLine()) != null) System.out.println(line); reader.Close();
has comment: http://stackoverflow.com/comment/41654764
accepted answer of: http://stackoverflow.com/q/26511185

http://stackoverflow.com/q/26454390
tagged with: session
tagged with: jsp
has answer: http://stackoverflow.com/a/26454528
tagged with: javabeans
has body: i have a Bean stored in session, and three forms. I need save the submitted values to the bean, this is the sequence: Form1.jsp -> Form2.jsp -> Form3.jsp -> ViewValues.jsp. This is my bean: package bean; public class Cotizacion implements java.io.Serializable { private static final long serialVersionUID = 1L; // Some properties ... public Cotizacion(){ // Nothing ... } // Accessors &amp; toString ... } The first JSP have this action: &lt;jsp:useBean id="cotizacion" class="bean.Cotizacion" scope="session" /&gt; The second and third JSP have this action: &lt;jsp:useBean id="cotizacion" class="bean.Cotizacion" scope="session"&gt; &lt;jsp:setProperty name="cotizacion" property="*" /&gt; &lt;/jsp:useBean&gt; When i try &lt;% System.out.print("Cobertura.jsp: " + cotizacion); %&gt; in the third form, the console output is: Cobertura.jsp: Ford;T;1990;5000;null;null;null;null;null;null The bean is only populated after the first submit. The bean properties are same that the request params. Any ideas?
accepted answer: http://stackoverflow.com/a/26454528
answer count: 1
downvote count: 0
has title: Bind form values in session bean
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/26404091
linked to: http://stackoverflow.com/q/100107
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41472356
tagged with: jsp
has body: I have looked at the other problems with java.lang.VerifyError - but can't really relate the solutions directly to my problem - so here goes. I am migrating a java application to a new container. In the process I stumbled upon an error in regards to some of the custom jsp tag libraries. The tag libraries are located in a jar file (which i don't have the source code for). When i start the application i get this error: 14:05:05,392 ERROR FacesServlet Servlet.service() for servlet FacesServlet threw exception java.lang.VerifyError: (class: dk/aaa/bbb/jsf/taglibs/ButtonTag, method: setId signature: (Ljava/lang/String;)V) Illegal use of nonvirtual function call As far as i can see the tld file is only exists one time on the classpath so i'm a bit lost. I hope someone can give me a hint. Thanks
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41472247
has title: java.lang.VerifyError in jsp taglib

http://stackoverflow.com/a/26407838
has comment: http://stackoverflow.com/comment/41464506
has comment: http://stackoverflow.com/comment/41464625
has comment: http://stackoverflow.com/comment/41465152
has comment: http://stackoverflow.com/comment/41465393
score: 0
has comment: http://stackoverflow.com/comment/41464467
has comment: http://stackoverflow.com/comment/41465505
has comment: http://stackoverflow.com/comment/41464847
type: Answer
has comment: http://stackoverflow.com/comment/41465118
upvote count: 1
has comment: http://stackoverflow.com/comment/41465056
downvote count: 1
has comment: http://stackoverflow.com/comment/41464958
has body: where windows stores its passwords (which can still be 'cracked/hacked'): Windows stores its passwords in what is called the Security Accounts Manager database, or SAM database. This is a file that exists in the registry and access to it is tightly controlled whilst windows is running; however, local administrators who can run processes as NT AUTHORITY\SYSTEM can access it - see where does NT store the SAM database?. Could you not use something like this (even if it IS a database, which you seem so put off by)? Option Other than that, why wouldn't you just run this on a password protected database, in which requires authentication before you can edit/delete? - It's probably the most sensible option However, if you're still looking to 'store' your password, I'd like to quote this: Do not invent your own "clever" password storage scheme. I know, you're smart, and you grok this crypto stuff. But through this door lies madness-- and abominations like LMHash that have ongoing, worldwide security ramifications we're still dealing with today. Take advantage of whatever password storage tools your framework provides, as they're likely to be a heck of a lot better tested and more battle-proven than any crazy scheme you and your team can come up with on your own. Security vulnerabilities, unlike functionality bugs in your application, run deep and silent. They can lay dormant for years. ~Jeff Atwood ,Co-founder of Stack Exchange and Discourse
has comment: http://stackoverflow.com/comment/41464783
answers question: http://stackoverflow.com/q/26401050

http://stackoverflow.com/comment/41570124
type: Comment
score: 1
has text: Do you have a setter method?
type: QuestionComment
comment on: http://stackoverflow.com/q/26466148

http://stackoverflow.com/comment/41420675
type: Comment
type: QuestionComment
has text: What IDE are you using? Eclipse w/ m2e plugin?
score: 0
comment on: http://stackoverflow.com/q/26383157

http://stackoverflow.com/a/26357289
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26357117
downvote count: 0
has body: Try something like this: List&lt;Integer&gt; numbers = new ArrayList(); for (int i = 0; i &lt; 10; i++) { numbers.add(ran.nextInt(6)); }

http://stackoverflow.com/a/26486209
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41609800
accepted answer of: http://stackoverflow.com/q/26481935
answers question: http://stackoverflow.com/q/26481935
has body: I think that section was speaking more to the fact that they have a programmatic way to create rules. I was under the impression that the "fluent" part referred the their use of the builder pattern that allowed you to string methods together in the same way a rule would appear. But yes, you are able to change/edit/delete rules dynamically for a particular KnowledgeBase. An example can be found in their sample integration tests, or consult the KnowledgeBase docs - particularly the addKnowledgePackages(Collection&lt;KnowledgePackage&gt; kpackages) and removeRule(String packageName, String ruleName) functions. I suppose you can combine the DescrFactory with the rule addition/creation. I'm not really able to find a public API anywhere that will help you with how to use it, and it's in the drools-compiler dependency, so I'm not certain that there will be one published as much of that artifact is meant for drools internal use. There is also another related S/O discussion about this here.
type: AcceptedAnswer

http://stackoverflow.com/comment/41586887
type: Comment
score: 0
has text: The Game class creates a game for the user to play. They input information which is then used in the Die class to created two die. All I need to do is call the Die class, specifically the paint method(), from within my Game class so it can paint two die.
type: AnswerComment
comment on: http://stackoverflow.com/a/26472783

http://stackoverflow.com/q/26481934
answer count: 6
has comment: http://stackoverflow.com/comment/41599670
has comment: http://stackoverflow.com/comment/41599629
has answer: http://stackoverflow.com/a/26482283
favorite count: 0
has comment: http://stackoverflow.com/comment/41599613
has answer: http://stackoverflow.com/a/26482115
type: UnansweredQuestion
has title: Convert Minutes to Hours using JodaTime
downvote count: 2
has comment: http://stackoverflow.com/comment/41599565
has body: I'm having Minutes in java.lang.Long and want to convert this value to java.math.BigDecimal, ie. as Hours. BigDecimal hours = BigDecimal.valueOf(minutes) .divide(BigDecimal.valueOf(DateTimeConstants.MINUTES_PER_HOUR)) .setScale(2,RoundingMode.HALF_DOWN); Tried the above method. It return hours, but no the way actually i want it How i need is : 240 Minutes : 4 Hours 230 Minutes : 3.50 hours Any help?
has comment: http://stackoverflow.com/comment/50381643
has comment: http://stackoverflow.com/comment/41599911
tagged with: java
has answer: http://stackoverflow.com/a/26482093
has answer: http://stackoverflow.com/a/26482143
has answer: http://stackoverflow.com/a/26482106
type: Question
has answer: http://stackoverflow.com/a/26482069
upvote count: 0
score: -2

http://stackoverflow.com/a/26524195
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26494389
answers question: http://stackoverflow.com/q/26494389
type: AcceptedAnswer
downvote count: 0
has body: Ordinarilly, you'd simply add your JTextArea to a JScrollPane, which handles the resizing behavior for you. f.add(new JScrollPane(ta1), BorderLayout.CENTER); For demonstration purposes, you can override the getPreferredSize() method of the JScrollBar to see the effect. private JScrollBar sb1 = new JScrollBar(){ @Override public Dimension getPreferredSize() { return new Dimension( super.getPreferredSize().width, ta1.getPreferredSize().height); } }; In addition, Swing GUI objects should be constructed and manipulated only on the event dispatch thread. Use the appropriate constructor to establish the desired initial size of text components. Use an appropriate layout to get the desired resizing behavior. As tested: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JTextArea; import javax.swing.JTextField; public class Testing { //variables private JFrame f = new JFrame("GUI TEST"); private JPanel p = new JPanel(); private JPanel p2 = new JPanel(); private JPanel p3 = new JPanel(); private JPanel p4 = new JPanel(); private JPanel p5 = new JPanel(); private JPanel p6 = new JPanel(); private JPanel p9 = new JPanel(); private JPanel p10 = new JPanel(); private JPanel p11 = new JPanel(); private JButton b1 = new JButton("Button"); private JTextField tf1 = new JTextField(12); private JTextField tf2 = new JTextField(12); private JTextField tf3 = new JTextField(12); private JTextArea ta1 = new JTextArea(10, 45); private JLabel label1 = new JLabel("Label 1"); private JLabel label2 = new JLabel("Label 2"); private JLabel label3 = new JLabel("Label 3"); private JLabel label4 = new JLabel("Label 4"); private JScrollBar sb1 = new JScrollBar(){ @Override public Dimension getPreferredSize() { return new Dimension(super.getPreferredSize().width, ta1.getPreferredSize().heig…
type: Answer
score: 2

http://stackoverflow.com/comment/41598301
type: QuestionComment
score: 2
has text: On a related note, Java 9 will introduce a set of Money classes and methods.
comment on: http://stackoverflow.com/q/26478010
type: Comment

http://stackoverflow.com/comment/41552724
type: Comment
comment on: http://stackoverflow.com/a/26445810
has text: Try the Altlr4 tutorial. The first page that I linked to (above) is part of it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41620915
type: Comment
type: QuestionComment
score: 2
has text: @funny-funny Good job. Now consider posting it in a form you got it, which was most probably formatted in a way that it could be easily read, instead of being wall of text.
comment on: http://stackoverflow.com/q/26493414

http://stackoverflow.com/a/32983667
answers question: http://stackoverflow.com/q/26447360
has body: This is because of the Type arguments. Injects does not work when u have a type arguments. U need to do something like this, bind(new LoginPresenter&lt;LoginViewImpl&gt;(){});
score: 0
has comment: http://stackoverflow.com/comment/53806805
has comment: http://stackoverflow.com/comment/53792887
type: Answer
has comment: http://stackoverflow.com/comment/53812651

http://stackoverflow.com/a/26365552
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: Not experienced with the replacer plugin, however I've run into issues with other similar things when multiple sets of replacement identifiers are on the same line. Try changing the delimiters for one of them, e.g. @version@, and see if that works.
accepted answer of: http://stackoverflow.com/q/26362920
answers question: http://stackoverflow.com/q/26362920
type: AcceptedAnswer

http://stackoverflow.com/comment/41617469
score: 0
type: AnswerComment
has text: This works great! All of the red squigglies are gone from under the code. Good job. Thanks a billion!
type: Comment
comment on: http://stackoverflow.com/a/26478332

http://stackoverflow.com/q/26420428
has answer: http://stackoverflow.com/a/26426585
linked to: http://stackoverflow.com/q/7861724
answer count: 2
downvote count: 1
favorite count: 0
tagged with: jlabel
upvote count: 10
has comment: http://stackoverflow.com/comment/41487266
type: AnsweredQuestion
has body: How can text like "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" which exceeds the width of the JLabel be wrapped? I have tried enclosing the text into html tags but no luck. Please give your suggestions.
tagged with: swing
accepted answer: http://stackoverflow.com/a/26426585
type: Question
score: 9
has title: How to word wrap text in JLabel?
possible better answer: http://stackoverflow.com/a/60546490
tagged with: java
has answer: http://stackoverflow.com/a/60546490

http://stackoverflow.com/comment/41637863
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26502374
has text: This answer help to me http://stackoverflow.com/questions/15844338/custom-listview-shows-less-items-in-random-order You must to bind data in GetView Like this before "return row": `// Bind data to views, depending on data type if(type==0) { ItemRow itemdata = data.get(position); holder.itemName.setText(itemdata.getItemName()); holder.icon.setImageDrawable(itemdata.getIcon()); } else { holder.itemName = (TextView)row.findViewById(R.id.header); holder.itemName.setText("ТЫ ГДЕ?"); } return row;`
type: Comment

http://stackoverflow.com/a/26456955
score: 1
answers question: http://stackoverflow.com/q/26456854
has body: You need to get the index of the first occurrence of a letter. Try using the indexOf method. int myIndex = elephant.indexOf('a'); Once you have the index, use StringBuilder to replace the value. Something like: StringBuilder sb = new StringBuilder(elephant); sb[index] = myIndex; elephant = sb.ToString();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26456854
downvote count: 0
has comment: http://stackoverflow.com/comment/41748890
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41747084

http://stackoverflow.com/comment/41384036
score: 0
type: Comment
has text: Use JSON parser in JavaScript, use map.entry in Java
type: QuestionComment
comment on: http://stackoverflow.com/q/26363159

http://stackoverflow.com/a/26394126
upvote count: 2
has body: Just have them share the same Document, that's it. area1.setDocument(area2.getDocument());
has comment: http://stackoverflow.com/comment/41440550
score: 2
answers question: http://stackoverflow.com/q/26394121
has comment: http://stackoverflow.com/comment/41441191
downvote count: 0
has comment: http://stackoverflow.com/comment/41440555
has comment: http://stackoverflow.com/comment/41442312
type: Answer

http://stackoverflow.com/comment/41656645
comment on: http://stackoverflow.com/a/26500802
score: 0
type: Comment
has text: I'm still seeing the UPDATE statement setting all the properties instead of just the dirty ones. I tried Hibernate 4.1.4, 4.2.8, and 4.3.6 since I saw some logged issues about dynamicUpdate. I also made sure to use @ Transactional. Will keep looking.
type: AnswerComment

http://stackoverflow.com/comment/41431347
has text: Please clarify what this program is supposed to produce.
type: Comment
comment on: http://stackoverflow.com/q/26388812
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41453187
type: Comment
comment on: http://stackoverflow.com/q/26401727
score: 0
type: QuestionComment
has text: Make sure you clean your project to refresh the generated files.

http://stackoverflow.com/q/26409695
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41471208
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: run matlab function and a java thread in parallel
tagged with: matlab
has body: how can i run a Matlab function and a java thread in parallel. I want to run a camera acquisition function which acquires frames and saves them at location and a java thread which accesses the frames. Also, i need to know how to synchronize these threads.
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/41555605
score: 1
has text: `System.out.println(i);` will never produce `2 5 8`
comment on: http://stackoverflow.com/q/26457697
type: QuestionComment
type: Comment

timer
tag name: timer
tags question: http://stackoverflow.com/q/26445473
tags question: http://stackoverflow.com/q/26368493
tags question: http://stackoverflow.com/q/26476892
tags question: http://stackoverflow.com/q/26503109
tags question: http://stackoverflow.com/q/26440603
type: Tag
tags question: http://stackoverflow.com/q/26436769
tags question: http://stackoverflow.com/q/26430245
tags question: http://stackoverflow.com/q/26509766
tags question: http://stackoverflow.com/q/26429616
tags question: http://stackoverflow.com/q/26440776
tags question: http://stackoverflow.com/q/26480023
tags question: http://stackoverflow.com/q/26393116
tags question: http://stackoverflow.com/q/26356164
tags question: http://stackoverflow.com/q/26472576

http://stackoverflow.com/q/26486738
tagged with: java
has answer: http://stackoverflow.com/a/26486855
accepted answer: http://stackoverflow.com/a/26486855
has body: I have created a program that allows the user to input either a Dvd collection or a book collection. I am fairly happy with what I have managed to achieve (still fairly new to programming) but I have an annoyance with my search method. The search does work and returns what the user looks for but it then also prints out that nothing could be found afterwards. The reason being, I think, that the way I have written my code, means that each search parameter is read before ending and returning back to the menu. I think that I maybe need to use a boolean or similar to end the loop when the conditions of the search are met. I am sure that any experienced programmers will be shaking their head at my code... The search method: /** * Asks user to input Dvd title then compares * with Dvd titles in collection * @param none * @return none */ public void searchDvd() { String temp = ""; // Temporary variable to hold dvd title System.out.println ("\nPlease enter Dvd Title (full title) to search for: "); temp= Genio.getString(); if(temp.equals(dvd1.getTitle())) { clrscr(); System.out.println("\nDvd is present in collection at location 1 (Dvd 1 in collection):\n\nTitle: " + dvd1.getTitle() + " \n Director: " + dvd1.getDirector() + " \n Lead Act: " + dvd1.getLead() + " \n Run Time: " + dvd1.getRunTime() + " \n Price: " + dvd1.getDvdPrice()); pressKey(); } if(temp.equals(dvd2.getTitle())) { clrscr(); System.out.println("\nDvd is present in collection at location 2 (Dvd 2 in collection):\n\nTitle: " + dvd2.getTitle() + " \n Director: " + dvd2.getDirector() + " \n Lead Act: " + dvd2.getLead() + " \n Run Time: " + dvd2.getRunTime() + " \n Price: " + dvd2.getDvdPrice()); pressKey(); } if(temp.equals(dvd3.getTitle())) { clrscr(); System.out.println("\nDvd is present in collection at location 3 (Dvd 3 in collection):\n\nTitle: " + dvd3.getTitle() + " \n Director: " + dvd3.getDirector() + " \n Lead Act: " + dvd3.getLead() + " \n Run Time: " + dvd3.getRunTime() + " \n Price: " + dvd3.getDvdPri…
type: Question
possible better answer: http://stackoverflow.com/a/26486897
tagged with: bluej
upvote count: 1
favorite count: 0
has title: Improving my search method
has answer: http://stackoverflow.com/a/26486908
answer count: 4
has answer: http://stackoverflow.com/a/26486897
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26487044
score: 1

http://stackoverflow.com/q/26379853
has answer: http://stackoverflow.com/a/30243930
linked to: http://stackoverflow.com/q/14990869
type: Question
has answer: http://stackoverflow.com/a/30238174
tagged with: java
linked to: http://stackoverflow.com/q/14884956
score: 4
tagged with: sharepoint
has title: HTTP 403 Forbidden coming when using HttpClient authentication mechanism for Sharepoint using NTLM
upvote count: 4
answer count: 2
tagged with: ntlm
downvote count: 0
tagged with: httpclient
favorite count: 0
tagged with: proxy
has body: HTTP/1.1 403 FORBIDDEN Response content length: 729 Result: soap:ServerException of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.0x8102006d My concern is how to get authenticated by proxy and also at the same time, to NTLM configured sharepoint in same session? Please help me. Thanks in advance. AuthCache authCache = new BasicAuthCache(); HttpHost targetHost = new HttpHost(&lt;sharepointserverhostname&gt;); NTLMSchemeFactory f = new NTLMSchemeFactory(); HttpContext ctx = new BasicHttpContext(); AuthScheme ns = f.create(ctx); authCache.put(targetHost, ns); HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(&lt;proxyserverip&gt;, 8080), new UsernamePasswordCredentials ("testdomain\phanigandeed", "Jul@2014")); credsProvider.setCredentials( AuthScope.ANY, new NTCredentials("phanigandeed", "Jul@2014", "", "testdomain")); CloseableHttpClient httpclient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); String listName = "PhaniList"; String description = "TestDescription"; String templateID = "101"; // for safety reasons, I had to remove the actual server details. String endpointURL = &lt;serviceurl&gt;; String result = "Failed"; String username = "phanigandeed"; String psWord = "Jul@2014"; String domainName = "vsnl"; String XML_DATA = new String("&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;&lt;soap:Body&gt;&lt;AddList xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"&gt;&lt;listName&gt;" + listName + "&lt;/listName&gt;&lt;description&gt;" + descriptio…
type: UnansweredQuestion

http://stackoverflow.com/q/26421889
has answer: http://stackoverflow.com/a/26672247
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/26672247
tagged with: java
tagged with: hibernate
tagged with: date
answer count: 2
downvote count: 0
has body: I have table with timestamp column and want to create Hibernate criteria projection to group me results only by date from that timestamp column (the results in database are YYYY-MM-DD HH:mm:ss). I know that I have to use Projection.sqlGroupProjectionbut not quiet sure hot to do so. Also, is it possible to write same projection for both MySQL and Oracle ?
favorite count: 0
has title: Hibernate criteria group results by date from timestamp
tagged with: oracle-database
has answer: http://stackoverflow.com/a/26422768
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/26422768
tagged with: mysql

http://stackoverflow.com/comment/41511430
comment on: http://stackoverflow.com/q/26433338
has text: probably should validate if there's one item left, since temp = temp.next referencing itself gives me a headache thinking about it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26373530
type: Answer
answers question: http://stackoverflow.com/q/26372572
score: 0
has body: Could it be the jndi name? Try making the following changes in datasource and persistence files java:jboss/datasources/employeedb java:jboss/datasources/employeedb

http://stackoverflow.com/comment/41524690
score: 1
type: Comment
type: QuestionComment
has text: can you please post exception stack trace ?
comment on: http://stackoverflow.com/q/26440631

http://stackoverflow.com/q/26457611
answer count: 1
has body: I've been working with the new JavaFx 3D api. JavaFx 8 introduced the subscene node, which contains its own scene graph and can simultaneously be rendered as a node in a scene. This allows you to render 3D nodes with a perspective camera within the subscene while rendering the HUD nodes on top orthogonaly. This works fine until you try and move HUD components. If the nodes within the subscene have not moved, JavaFx will not redraw it. So it just leaves black artifacts where the HUD used to be. Is there some way to force the subscene to be redrawn? EDIT: One way I've managed to fix the problem is rendering a cube off screen that spins indefinitely. Because it is always spinning, the subscene is always being updated. This seems like a ridiculous way to fix it but it is the best I can do for now. Still looking for better solutions...
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/47343237
upvote count: 5
tagged with: java
tagged with: javafx
type: Question
tagged with: redraw
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/41580831
favorite count: 0
has title: Force Repaint of Node in JavaFx

http://stackoverflow.com/comment/41616895
has text: I push this code but there is an error because when i put a number abobe 100, the counter ends and i dont want this because i only want to finish when i push -1
type: Comment
comment on: http://stackoverflow.com/a/26491483
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41393704
comment on: http://stackoverflow.com/q/26364015
has text: You code does not compile, please remove the unnecessary part. Always copy-paste your code into your IDE before posting to verify that we can run it ourselves.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/90233566
type: Comment
has text: for XML layout = {@link R.layout#activity_main}, drawable {@link R.drawable#ic_television} and so on.
type: AnswerComment
comment on: http://stackoverflow.com/a/34501284
score: 0

http://stackoverflow.com/a/26357777
score: 0
has body: Not very clear for your situation but when user has to enter value then too the code will decide which one to call. public class Sample { void sum(int a, int b) { System.out.print(a+b); } void sum(float a, float b){System.out.print(a+b);} public static void main(String[] a) { int a,b; float c,d; // logic for setting abcd; sum(a,b) //sum with int args will be called sum(c,d) //sum with float will be called } } And this will be resolved at compile time only. Hope this will help
answers question: http://stackoverflow.com/q/26357649
type: Answer

http://stackoverflow.com/comment/41601903
has text: Sorry, I've edited my question and posted full `MainActivity`.
comment on: http://stackoverflow.com/q/26483303
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41648527
has text: Where you store that MSExcel formula? Do you hardcode if in Java or use some file to read it? Try with reading external property file that will store those formulas and read it as a "String".
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26466071
score: 0

http://stackoverflow.com/a/26425734
has comment: http://stackoverflow.com/comment/58621956
type: Answer
answers question: http://stackoverflow.com/q/26367922
accepted answer of: http://stackoverflow.com/q/26367922
has comment: http://stackoverflow.com/comment/41573948
has comment: http://stackoverflow.com/comment/58580914
score: 4
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/58573358
downvote count: 0
has body: If you want to do this using Spring then the ActorRef would have to be a spring bean. It's possible but imo not very elegant as there isn't a simple way to maintain the supervision hierarchy as well as expose ActorRef's as singleton beans. I played around with this at first but ended up with a lot of top-level actors created which is undesirable. I've found that the most appropriate way for me to combine Spring injection and ActorRef injection into other actors is via message passing as described in the Akka docs. My Spring service beans are injected via Spring, and my ActorRef's are injected via message passing where required. As ActorRef is quite ambiguous as to what it actually represents you could wrap the ActoRef in a class that also provides a type so the receiving actor can decide what to do with it, very important if they are epxetcing many different ActorRef's to be injected. Anyway, answering your question, to create a Spring managed ActorRef bean you could do something like the following in a Spring @Configuration class: @Autowired private ActorSystem actorSystem; @Bean(name = "handler") public ActorRef handler() { return actorSystem.actorOf(SpringExtProvider.get(system).props("Handler"), "handler"); } And then in your Spring annotated actor you would have something like: @Named("Reader") @Scope("prototype") public class Reader extends UntypedConsumerActor { @Autowired @Qualifier("handler") private ActorRef handler; // ... } The dependency injection of the "handler" ActorRef will happen when you create the Reader actor using the Spring extension. It's important to remember the ActorRef is a proxy to the Actor.

http://stackoverflow.com/q/26513720
has answer: http://stackoverflow.com/a/26513840
tagged with: fileinputstream
has title: Reusing FileInputStream
answer count: 1
has body: for a university project im supposed to program a database that saves a picture in a h2 database and shows it in an ImageView. FileInputStream fileStream = new FileInputStream(f); Horse h = getSelectedHorse(); h.setImage(fileStream); Connection c = H2ConnectionFactory.getConnection(); JdbcHorseDao horseDao = new JdbcHorseDao(c); horseDao.update(h); c.commit(); Image img = new Image(fileStream); horseImages.put(h, img); imageView.setImage(img); When I save the image to the database first i can't immediately show it in the imageviewer and vice versa (when I show it first I can't save it to the database) My thought's are that the stream is at the end of the file but I can't find out how to reposition the stream ( there is no seek() method)
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: h2
tagged with: javafx
tagged with: image
type: Question

http://stackoverflow.com/comment/41585746
type: QuestionComment
comment on: http://stackoverflow.com/q/26474097
has text: Have a look at Java's [`MessageFormat`](http://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html) class
score: 0
type: Comment

http://stackoverflow.com/comment/41631460
type: Comment
comment on: http://stackoverflow.com/a/26378605
has text: I'm a heavy proponent of Guava, and I like this one the best. Succinct, performant, and most importantly, communicates intent the best.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41561318
type: QuestionComment
has text: Okay, I can replicate your issue and am working on a workaround. I will post an answer if I can get it working :)
comment on: http://stackoverflow.com/q/26460870
score: 0
type: Comment

http://stackoverflow.com/q/26409461
has comment: http://stackoverflow.com/comment/41467456
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26410309
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41467280
type: Question
has title: String & StringBuffer classes in relation to append() method
tagged with: stringbuffer
upvote count: 1
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/26410309
has comment: http://stackoverflow.com/comment/41467518
has body: I qoute from Herbert Schildt book on Java, Chapter String Handling, The append( ) method is most often called when the + operator is used on String objects. Java automatically changes modifications to a String instance into similar operations on a StringBuffer instance. Thus, a concatenation invokes append( ) on a StringBuffer object. I know very well that a concatenation invokes append( ) on a StringBuffer instance. What does the author mean by saying "append( ) method is most often called when the + operator is used on String objects"? As per my understanding 'append()' cannot be used with strings. After the concatenation has been performed, the compiler inserts a call to toString( ) to turn the modifiable StringBuffer back into a constant String. All of this may seem unreasonably complicated. Why not just have one string class and have it behave more or less like StringBuffer? The answer is performance. There are many optimizations that the Java run time can make knowing that String objects are immutable. Thankfully, Java hides most of the complexity of conversion between Strings and StringBuffers. Actually, many programmers will never feel the need to use StringBuffer directly and will be able to express most operations in terms of the + operator on String variables. I wish to know what are the optimizations that the Java run time can make knowing that String objects are immutable? Elaborating with a code always yields for me a better understanding for the mentioned problem?
tagged with: append

http://stackoverflow.com/q/26417127
score: 3
tagged with: guid
upvote count: 3
tagged with: java
type: Question
tagged with: c#
downvote count: 0
has answer: http://stackoverflow.com/a/26424652
has comment: http://stackoverflow.com/comment/41505603
has body: So protobuf-net uses this proto content for a .NET guid: message Guid { optional fixed64 lo = 1; // the first 8 bytes of the guid optional fixed64 hi = 2; // the second 8 bytes of the guid } ...and when I compile that proto into Java classes and create this Java UUID instance: UUID uid = UUID.fromString("2ac9f438-f555-40b0-8880-02226b81285c"); ...then it doesn't matter whether I use uid.getMostSignificantBits() or uid.getLeastSignificantBits() as the argument to Guid.setHi() ( or Guid.setLo() ). No matter which combination I choose, when C# deserializes the type containing the Java-generated guid, and I test the value of the guid, I get what appears to be byte ordering problems: expected:&lt;2ac9f438-f555-40b0-8880-02226b81285c&gt; but was:&lt;f55540b0-f438-2ac9-5c28-816b22028088&gt; ...or: expected:&lt;2ac9f438-f555-40b0-8880-02226b81285c&gt; but was:&lt;6b81285c-0222-8880-b040-55f538f4c92a&gt; Is there a simple fix for this problem? Should point out that I'm new to protobuf, so a little hazy on possibilities here. EDIT: For what it's worth, I've also tried Long.reverseBytes() on the result of one or both uid.getLeast/MostSignificantBits() before providing the result to Guid.setLo/Hi, and swapping those orders as well, but alas... EDIT, the second: No wonder simple byte-order swapping on the two longs doesn't work (excerpted from here): The order of the beginning four-byte group and the next two two-byte groups is reversed, whereas the order of the last two-byte group and the closing six-byte group is the same. See my answer posted to this question for one possibility. Not sure there's really any other way, if both languages are to use their native binary guid/uuid types in application code. Any other suggestions (besides sending guid's as strings)?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41508521
tagged with: uuid
type: UnansweredQuestion
has title: Protobuf-net interop with Java UUID and C# Guid
tagged with: protobuf-net

http://stackoverflow.com/a/26535355
answers question: http://stackoverflow.com/q/26377928
score: 0
has body: Try this code: public Timestamp parseDateToTimestamp(java.util.Date inDate) { if (inDate == null) return null; return new java.sql.Timestamp(inDate.getTime()); }
type: Answer

http://stackoverflow.com/comment/41535144
type: QuestionComment
has text: Wrap the `(Word)w` in parentheses too: `((Word)w).getCount()`
comment on: http://stackoverflow.com/q/26446273
score: 0
type: Comment

http://stackoverflow.com/q/26464545
has comment: http://stackoverflow.com/comment/41567864
has comment: http://stackoverflow.com/comment/41567247
has comment: http://stackoverflow.com/comment/41567522
has comment: http://stackoverflow.com/comment/41569001
tagged with: java
has comment: http://stackoverflow.com/comment/41570112
tagged with: methods
has comment: http://stackoverflow.com/comment/41567159
has body: The error is solved and the app runs. The problem is how do i add a listener to the amound field in the app aswell? As the app is now it just sums up for ex "sek 1" + "usd 6.69" = "7.69". Any good ideas how to make this work? And here is my code: package com.example.currencyconverter; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.TextView; public class MainActivity extends Activity { private String [] currency_name; private ArrayAdapter&lt;String&gt; adapter; private Spinner spin1, spin2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setUpTheSpinners(); } @Override public boolean onCreateOptionsMenu(Menu menu) { return true; } private void setUpTheSpinners() { currency_name = getResources().getStringArray(R.array.currency_name); adapter= new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, currency_name); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); OnItemSelectedListener listener = new CurrencySelectedListener(); spin1 = (Spinner)findViewById(R.id.spinner1); spin1.setAdapter(adapter); spin1.setOnItemSelectedListener(listener); spin2 = (Spinner)findViewById(R.id.spinner2); spin2.setAdapter(adapter); spin2.setOnItemSelectedListener(listener); } private void calculateSum() { String [] rates = getResources().getStringArray(R.array.currency_rate); int index1 = spin1.getSelectedItemPosition(); int index2 = spin2.getSelectedItemPosition(); double rate1 = Double.parseDouble( rates[index1] ); double rate2 = Double.parseDouble( rates[index2] ); double totalRate = rate1 + rate2; TextView totalRateText = (TextView)findViewById(R.id.textView4); totalRateText.setText("" + totalRate); } private cl…
has title: Error "must implement the inherited abstract method"
linked to: http://stackoverflow.com/q/4736212
has comment: http://stackoverflow.com/comment/41567564
answer count: 0
has comment: http://stackoverflow.com/comment/41568010
type: UnansweredQuestion
tagged with: eclipse
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41568302
has comment: http://stackoverflow.com/comment/41569675
favorite count: 0
has comment: http://stackoverflow.com/comment/41567767
has comment: http://stackoverflow.com/comment/41568057
type: Question
upvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/41567828

http://stackoverflow.com/a/26369610
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26369521
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26369521
has body: You can detect that your query didn't return any rows before doing anything to cause the exception to be thrown. The API documentation for ResultSet.next says: When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. Currently your code is discarding the value returned by rs.next, have your code check the return value instead. If it's false then there are no rows returned and you can avoid calling rs.getString(1).

http://stackoverflow.com/a/26433978
type: Answer
answers question: http://stackoverflow.com/q/26425992
has body: With the current code, it is hard to tell what is going wrong. The following code works just fine for me import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.WindowConstants; import java.awt.BorderLayout; import java.awt.EventQueue; public class AutoCompleteCombobox { public static void main( String[] args ) { EventQueue.invokeLater( () -&gt; { JFrame frame = new JFrame( "TestFrame" ); JComboBox&lt;String&gt; comboBox = new JComboBox&lt;&gt;( ); DefaultComboBoxModel&lt;String&gt; model = new DefaultComboBoxModel&lt;&gt;( ); model.addElement( "First" ); model.addElement( "Second" ); comboBox.setModel( model ); comboBox.setEditable( true ); AutoCompleteDecorator.decorate( comboBox ); frame.getContentPane().add( comboBox ); JButton button = new JButton( "Add item" ); button.addActionListener( e -&gt; { String selectedItem = ( String ) comboBox.getSelectedItem(); if ( comboBox.getSelectedIndex() == -1 ){ model.addElement( selectedItem ); } } ); frame.getContentPane().add( button, BorderLayout.SOUTH ); frame.pack(); frame.setVisible( true ); frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE ); } ); } } Auto-complete works as expected I can input new items When using the add button, I can add the new item and the autocomplete behaves nicely In short, I cannot reproduce your issue. Please post a piece of code in your question which allows us to reproduce the problem.
score: 0

http://stackoverflow.com/comment/41595821
score: 0
has text: The connection might be closed by the DBMS so it's a bad idea to have a field for that, open it on object init., and assume it's ready to use
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26479773

http://stackoverflow.com/q/26473381
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/26473717
tagged with: restful-url
tagged with: controller
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has title: How to get query parameters in a rest controller in a GET request?
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26473717
has body: This should probably be a one-liner, but I am not used to Spring or SpringBoot, and so I'm having troubles. I am building a RESTful service, with query parameters. For example: http://myweatherapi.com:8080/foo?zip=14325&amp;prop=humidity. I am trying a SpringBoot's template within which I have this controller: @RestController public class ServiceController { private static Logger LOG = LoggerFactory.getLogger(ServiceController.class); @RequestMapping("/foo") public String foo(@QueryParam("foo") String foo) { requestContextDataService.addNamedParam("foo", foo); // how can I access the full URL/query params here? return "Service is alive!!"; } } My question is: how can I access the full URL/query parameters?
type: Question

http://stackoverflow.com/comment/41370913
has text: Of course it does, but when the classloader want to load that class it doesn't find it on the classpath. When you run it locally your ide adds the correct dependencies to the classpath, but on your server it does not have those dependencies on the classpath. Maybe read: http://stackoverflow.com/questions/2396493/what-is-a-classpath-confused-and-need-a-human-touch-to-understand/2396759#2396759
comment on: http://stackoverflow.com/q/26355918
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26453531
has answer: http://stackoverflow.com/a/26454057
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26454057
type: Question
tagged with: treetableview
answer count: 1
tagged with: javafx-8
has body: In a project of mine, I'm using a TreeTableView from JavaFX to display some objects of type BillingTableRow. I have implemented a cell editor, but when I try to set the onEditCommit event, I am unable to get the content types to match. Here is my code for one of the columns storing names of type String inside the object of type BillingTableRow: // Name column Callback&lt;TreeTableColumn&lt;BillingTableRow, String&gt;, TreeTableCell&lt;BillingTableRow, String&gt;&gt; nameCallback = new Callback&lt;TreeTableColumn&lt;BillingTableRow, String&gt;, TreeTableCell&lt;BillingTableRow, String&gt;&gt;() { @Override public TreeTableCell&lt;BillingTableRow, String&gt; call(TreeTableColumn&lt;BillingTableRow, String&gt; p) { return new TextFieldTreeTableCell&lt;BillingTableRow, String&gt;(); } }; nameColumn.setCellFactory(nameCallback); nameColumn.setOnEditCommit(new EventHandler&lt;CellEditEvent&lt;BillingTableRow, String&gt;&gt;() { @Override public void handle(CellEditEvent&lt;BillingTableRow, String&gt; t) { ((BillingTableRow) t.getTableView().getItems().get(t.getTablePosition().getRow())).setName(t.getNewValue()); } }); Can someone please tell me what is wrong? I get the following error in Eclipse: The method setOnEditCommit(EventHandler&lt; TreeTableColumn.CellEditEvent>) in the type TreeTableColumn is not applicable for the arguments (new EventHandler&lt; TableColumn.CellEditEvent&lt; BillingTableRow,String>>(){}) I appreciate any help with my problem.
has title: JavaFX TreeTableView column setOnEditCommit() refuses to accept handler to save edited cell

http://stackoverflow.com/comment/41600772
has text: http://stackoverflow.com/a/17355989/1031945
comment on: http://stackoverflow.com/q/26482635
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41658336
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26504919
type: Comment
has text: Yes you can have transaction management without JTA. You can commit/rollback with JDBC, JPA for JavaSE or any other ORM framework outside a container. It's quite easy when you run a single JVM with a single resource. It becomes harder to do this when you have an XA transaction that span multiple server instance and multiple db. Application servers (JTA/JTS for J2EE and the custom API for Spring) offer a convenient platform to handle such complex transactions.

http://stackoverflow.com/q/26363638
has body: I'm making an Android app that is web base social media sites all in one and I am having trouble with Twitter and Google plus won't allow me to upload a photo, it will let me choose one but will not let me upload it. Facebook is fine that will let me choose a photo and upload it without errors. Here is the code I'm using, maybe something I'm doing is wrong. @SuppressWarnings("unused") public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType, String capture){ mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); hello.mUploadMessage = uploadMsg; getActivity().startActivityForResult( Intent.createChooser( i, "File Chooser" ), 1 ); } MainActivity ValueCallback&lt;Uri&gt; mUploadMessage; private final static int FILECHOOSER_RESULTCODE=1; @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { if(requestCode==FILECHOOSER_RESULTCODE) { if (null == mUploadMessage) return; Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData(); mUploadMessage.onReceiveValue(result); mUploadMessage = null; } } I'm using Eclipse and testing it on Android 4.4.4 and 4.3, can anyone give me an idea? hope it something basic and an easy fix.
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: facebook
answer count: 0
score: 1
tagged with: java
tagged with: twitter
upvote count: 1
type: Question
has title: WebView File Chooser JAVA Android
linked to: http://stackoverflow.com/q/5907369
tagged with: eclipse
downvote count: 0

http://stackoverflow.com/comment/41622772
type: QuestionComment
has text: @EngineerDollery This is not just an issue of performance (which I wouldn't care about too much in this case), it is also an issue of clean code. It's a form of code duplication.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26494578

http://stackoverflow.com/a/26424114
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/41494850
has body: This is the javascript code &lt;script&gt; function checkEmail() { var feedback=""; var email=document.getElementById("email").value; var count=email.length; var atpos=email.indexOf('@'); var atdot=email.lastIndexOf('.'); var tld=email.substring(atdot); if(atpos&lt;1 || atdot&lt;1) { alert("Email is Not Valid"); } else if(atpos&gt;atdot) { alert("Email is Not Valid"); } else{ alert("Email is Valid"); } }
answers question: http://stackoverflow.com/q/26423690
has comment: http://stackoverflow.com/comment/41493240
type: Answer
downvote count: 1

http://stackoverflow.com/comment/41416773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26376770
has text: So it's impossible to add a log entry only in the Log View (http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Freference%2Fref-error_log_view.htm) and not in the console?
score: 0

http://stackoverflow.com/comment/41522386
score: 0
comment on: http://stackoverflow.com/q/26439059
type: QuestionComment
has text: Which color you are using now?
type: Comment

spring
tags question: http://stackoverflow.com/q/26355918
tags question: http://stackoverflow.com/q/26463055
tags question: http://stackoverflow.com/q/26368336
tags question: http://stackoverflow.com/q/26489071
tags question: http://stackoverflow.com/q/26402997
tags question: http://stackoverflow.com/q/26463728
tags question: http://stackoverflow.com/q/26408076
tags question: http://stackoverflow.com/q/26473037
tags question: http://stackoverflow.com/q/26375573
tags question: http://stackoverflow.com/q/26469679
tags question: http://stackoverflow.com/q/26512801
tags question: http://stackoverflow.com/q/26421357
tags question: http://stackoverflow.com/q/26404478
tags question: http://stackoverflow.com/q/26384930
tags question: http://stackoverflow.com/q/26367540
tags question: http://stackoverflow.com/q/26414771
tags question: http://stackoverflow.com/q/26431777
tags question: http://stackoverflow.com/q/26487836
tags question: http://stackoverflow.com/q/26374793
tags question: http://stackoverflow.com/q/26357014
tags question: http://stackoverflow.com/q/26428891
tags question: http://stackoverflow.com/q/26489318
tags question: http://stackoverflow.com/q/26407666
tags question: http://stackoverflow.com/q/26491406
tags question: http://stackoverflow.com/q/26497955
tags question: http://stackoverflow.com/q/26433013
tags question: http://stackoverflow.com/q/26461781
tags question: http://stackoverflow.com/q/26366192
tags question: http://stackoverflow.com/q/26501127
tags question: http://stackoverflow.com/q/26395511
tags question: http://stackoverflow.com/q/26447739
tags question: http://stackoverflow.com/q/26422511
tags question: http://stackoverflow.com/q/26434811
tags question: http://stackoverflow.com/q/26481513
tags question: http://stackoverflow.com/q/26420941
tags question: http://stackoverflow.com/q/26359786
tags question: http://stackoverflow.com/q/26367446
tags question: http://stackoverflow.com/q/26409130
tags question: http://stackoverflow.com/q/26425932
tags question: http://stackoverflow.com/q/26394533
tags question: http://stackoverflow.com/q/26427972
tags question: http://stackoverflow.com/q/26389519
tags question: http://stackoverflow.com/q/26475472
tags question: http://stackoverflow.com/q/26471047
tags question: http://stackoverflow.com/q/26420814
tags question: http://stackoverflow.com/q/26406982
tags question: http://stackoverflow.com/q/26424184
tags question: http://stackoverflow.com/q/26465355
tags question: http://stackoverflow.com/q/26393864
tags question: http://stackoverflow.com/q/26389143
tags question: http://stackoverflow.com/q/26373772
type: Tag
tags question: http://stackoverflow.com/q/26363478
tags question: http://stackoverflow.com/q/26505334
tags question: http://stackoverflow.com/q/26417126
tags question: http://stackoverflow.com/q/26463008
tags question: http://stackoverflow.com/q/26426694
tags question: http://stackoverflow.com/q/26369353
tags question: http://stackoverflow.com/q/26443859
tags question: http://stackoverflow.com/q/26358791
tags question: http://stackoverflow.com/q/26497522
tags question: http://stackoverflow.com/q/26373376
tags question: http://stackoverflow.com/q/26381672
tags question: http://stackoverflow.com/q/26424878
tags question: http://stackoverflow.com/q/26502958
tags question: http://stackoverflow.com/q/26398676
tags question: http://stackoverflow.com/q/26440362
tags question: http://stackoverflow.com/q/26433631
tags question: http://stackoverflow.com/q/26450400
tags question: http://stackoverflow.com/q/26464104
tags question: http://stackoverflow.com/q/26361689
tags question: http://stackoverflow.com/q/26422133
tags question: http://stackoverflow.com/q/26378907
tags question: http://stackoverflow.com/q/26427183
tags question: http://stackoverflow.com/q/26506370
tags question: http://stackoverflow.com/q/26504267
tags question: http://stackoverflow.com/q/26360160
tags question: http://stackoverflow.com/q/26379980
tags question: http://stackoverflow.com/q/26443144
tags question: http://stackoverflow.com/q/26357584

http://stackoverflow.com/q/26481029
score: 0
has answer: http://stackoverflow.com/a/26481103
accepted answer: http://stackoverflow.com/a/26481103
answer count: 1
tagged with: generics
tagged with: interface
has body: I have LoginCommandExecutor implements CommandExecutor&lt;LoginCommand&gt; LoginCommand implements Command Why this line throws compilation error: CommandExecutor&lt;Command&gt; a = new LoginCommandExecutor(commander, null); But it works for both of followings: CommandExecutor&lt;? extends Command&gt; a = new LoginCommandExecutor(commander, null); CommandExecutor b = new LoginCommandExecutor(commander, null); And if both are working, which one is preferable? Why? because I see a and b reveals same methods in the IDE
type: AnsweredQuestion
tagged with: java
type: Question
has title: Problematic declaration using inheritance in generics
tagged with: inheritance

encoding
tags question: http://stackoverflow.com/q/26357938
tags question: http://stackoverflow.com/q/26500574
type: Tag
tags question: http://stackoverflow.com/q/26488337
tags question: http://stackoverflow.com/q/26412977
tags question: http://stackoverflow.com/q/26501786
tags question: http://stackoverflow.com/q/26397061
tag name: encoding
tags question: http://stackoverflow.com/q/26487164

http://stackoverflow.com/a/26406974
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41464492
score: 1
upvote count: 1
has body: If you want to define an http GET method, then the only way to pass parameters to it is through the URI query string (ie. ?x=y&amp;...). This is because GET calls can not take in a message body. If you want to pass in more complicated information, you will need to use POST, PUT, or some other method. Though, if you are actually just getting information (semantically), then you shouldn't use anything but GET.
has comment: http://stackoverflow.com/comment/41464577
answers question: http://stackoverflow.com/q/26406878

http://stackoverflow.com/comment/41522457
has text: @Rustam red color is also not working.
score: 0
comment on: http://stackoverflow.com/q/26439059
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26449342
has comment: http://stackoverflow.com/comment/41555353
has comment: http://stackoverflow.com/comment/41544544
accepted answer: http://stackoverflow.com/a/26450754
score: 2
answer count: 1
has comment: http://stackoverflow.com/comment/41540849
favorite count: 0
has comment: http://stackoverflow.com/comment/41540289
upvote count: 2
tagged with: multithreading
tagged with: swing
has body: I want this code work with update JProgressBar and JTextArea while scanner is working, but I don't know how implement Threading. Is it possible? This is my code: UPDATED: It's a working version now, with "Stop" function. I added a "breakPoint" variable to break out from the for loop. package main; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; import javax.swing.JOptionPane; import javax.swing.SwingWorker; public class PortScanner extends javax.swing.JFrame { private doSomeStuff taskPortScanner; private boolean breakPoint; public PortScanner() { initComponents(); } private void portScan() { int currentPort = 1; try { String hostname = hostNameTextField.getText(); int timeOut = (Integer) timeOutSpinner.getValue(); int minPort = Integer.parseInt(portMinTextField.getText()); int maxPort = Integer.parseInt(portMaxTextField.getText()); //set min and max value of progress bar jProgressBar1.setMinimum(minPort); jProgressBar1.setMaximum(maxPort); //print out the address InetAddress theAddress = InetAddress.getByName(hostname); resultTextArea.append("IP adress: " + theAddress + "\n\n"); //check if port is open for (currentPort = minPort; currentPort &lt;= maxPort; currentPort++) { //stop for loop if (breakPoint == true) { System.out.println("Portscanning stopped."); break; } try { Socket socket = new Socket(); socket.connect(new InetSocketAddress(hostname, currentPort), timeOut); //update textarea resultTextArea.append("Service running on port " + currentPort + "\n"); socket.close(); } catch (Exception ex) { System.out.println(currentPort); } //update progressbar jProgressBar1.setValue(currentPort); jProgressBar1.repaint(); } } catch (UnknownHostException ex) { JOptionPane.showMessageDialog(PortScanner.this, "Unknown hostname: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(PortScanner.this, "Invalid format. " + ex.getMes…
type: AnsweredQuestion
has title: Java multithreading in JFrame
linked to: http://stackoverflow.com/q/17759287
has comment: http://stackoverflow.com/comment/41540479
tagged with: java
has answer: http://stackoverflow.com/a/26450754
has comment: http://stackoverflow.com/comment/41540734
linked to: http://stackoverflow.com/q/8083768
has comment: http://stackoverflow.com/comment/41540462
has comment: http://stackoverflow.com/comment/41545763
linked to: http://stackoverflow.com/q/26444175
has comment: http://stackoverflow.com/comment/41540698
type: Question
has comment: http://stackoverflow.com/comment/41540503
has comment: http://stackoverflow.com/comment/41545409
has comment: http://stackoverflow.com/comment/41545353
downvote count: 0
has comment: http://stackoverflow.com/comment/41540364

http://stackoverflow.com/a/26454790
answers question: http://stackoverflow.com/q/26453521
type: AcceptedAnswer
downvote count: 0
has body: Try to use &amp;nbsp; for adding spaces at the beginning with text/html content type. This link describe approachs how add spaces in html: http://webdesign.about.com/od/beginningtutorials/qt/spaces-in-html.htm You can use one of them.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26453521

http://stackoverflow.com/q/26478098
has title: eclipselink Persistence error and not well formed xml document
has comment: http://stackoverflow.com/comment/41842041
type: Question
tagged with: java
score: 0
tagged with: eclipselink
tagged with: jpa
has body: getting this error in eclipselink JPA example. I am trying to set up a simple JPA class. It complains about the xml document not being well formed, but I don't see any problems. please let me know of any pointers. thanks! Main class is: package de.vogella.jpa.simple.main; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query; import de.vogella.jpa.simple.model.Todo; public class Main { private static final String PERSISTENCE_UNIT_NAME = "todos"; private static EntityManagerFactory factory; public static void main(String[] args) { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); // read the existing entries and write to console Query q = em.createQuery("select t from Todo t"); List<Todo> todoList = q.getResultList(); for (Todo todo : todoList) { System.out.println(todo); } System.out.println("Size: " + todoList.size()); // create new todo em.getTransaction().begin(); Todo todo = new Todo(); todo.setSummary("This is a test"); todo.setDescription("This is a test"); em.persist(todo); em.getTransaction().commit(); em.close(); } } here is persistence.xml <?xml version="1.0" encoding="UTF-8" ?> de.vogella.jpa.simple.model.Todo <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" /> <property name="javax.persistence.jdbc.url" value="jdbc:derby:/home/vogella/databases/simpleDb;create=true" /> <property name="javax.persistence.jdbc.user" value="test" /> <property name="javax.persistence.jdbc.password" value="test" /> <property name="eclipselink.ddl-generation" value="create-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> The error is the following: Exception in thread "main" Local Exception Stack: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persiste…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41593082
answer count: 0

http://stackoverflow.com/comment/41554139
type: Comment
comment on: http://stackoverflow.com/a/26456300
score: 0
type: AnswerComment
has text: yeah just a comment that it's best practice :) drill them early :D

http://stackoverflow.com/comment/41636345
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26501965
has text: @dds not quite I think, since conditional breakpoints must be set at a particular line. What I want is the equivalent of setting a conditional breakpoint at all lines that cause modification to the particular variable.
score: 0

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26381013
tags question: http://stackoverflow.com/q/26448566
tags question: http://stackoverflow.com/q/26412183
tags question: http://stackoverflow.com/q/26478690
type: Tag

http://stackoverflow.com/a/26417114
accepted answer of: http://stackoverflow.com/q/26417106
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26417106
has body: This has nothing to do with generics. With this.value you're presumably referring to the GenericBox object you passed to the OrderedPair constructor. This class (GenericBox) must not have a declared toString() method. It therefore inherits and uses Object#toString(). It's up to the developer to write their own toString() implementation and return any String value they deem appropriate. Here's what the official tutorials have to say.

http://stackoverflow.com/q/26426187
tagged with: eclipse
score: 0
answer count: 1
tagged with: android
type: AnsweredQuestion
tagged with: buildpath
tagged with: java
accepted answer: http://stackoverflow.com/a/26485445
has body: After importing a project from GIT using clone it failed to run. The android library in the build path is missing. How do I get it back? I can't fix the problem with answers already given on other similar questions. Reinstalling eclipse doesn't help. Also, I can't find the project.properties, which had something to do with this problem. After trying to clean this project: Hope someone can help me with this problem. Thanks in advance!
tagged with: git
type: Question
has title: Eclipse build path android error
has answer: http://stackoverflow.com/a/26485445

http://stackoverflow.com/a/26421891
answers question: http://stackoverflow.com/q/26421017
has body: Typically you use some kind of third party software to provide SAML integration. Examples of this is OpenAM and Shibboleth. It is a good idea to use software like this becaouse SAML is a complex protocol and it is easy to make mistakes, leaving your solution vulnerable. I have a blog post on SAML and the work flow you can have a look at. This one about SAML and this one about the SAML Web profile flow that you want If you insist on doing the whole integration yourself in code. OpneSAML is one library you can use. This will require you to have a good understanding of SAML. My book, A Guide to OpenSAML, gives a good introduction to SAML and the OpenSAML library. I also have some blog posts on OpenSAML About your questions. The Assertion is something that is sent to you from the IDP, this is the proof of an authentication of a user. What you need to do is to send a AuthnRequest to the IDP to start and authentication. The registration on the IDP depends completely on what software is used to implment SAML in the IDP side. Usually it involves you sending a SAML Metadata XML to the IDP. This is a configuration file containing certificates, endpoint and more. Here is a post on SAML Metadata In return the IDP send you metadata the you use to communicate with it.
score: 0
type: Answer

http://stackoverflow.com/a/26407170
type: Answer
downvote count: 0
has body: matches() only returns true if the whole input matches the pattern, not if part of the input matches the pattern. The input automate@DAS101.LO1&gt; does not match the complete pattern das101.lo1&gt;. That explains the different result you get when you use find() instead of matches().
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26407040

http://stackoverflow.com/q/26418361
has body: I'm trying to assign the rows to the Capitalized alphabets and columns to the small alphabets, but the second while statement does not print anything for some reason I tried assigning the rows to numbers but couldn't assign int to Strings. The Txt File consists of (without spaces between the lines) ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ Is it possiable to change an element if given specific row and column? import java.io.*; import java.util.*; public class ReadFile { private Scanner Reader; Scanner Vari = new Scanner(System.in); public void openfile(){ try { System.out.print("Enter file location"); String y = Vari.nextLine(); Reader = new Scanner(new File(y)); }catch(Exception e){ System.out.println("Error!!"); } } public void readFile(){ while(Reader.hasNextLine()){ String a = Reader.nextLine(); String b = Reader.nextLine(); String c = Reader.nextLine(); String d = Reader.nextLine(); String e = Reader.nextLine(); System.out.printf("This is the LINE PRint\n"); System.out.printf("%s\n%s\n%s\n%s\n", a, b, c, d,e); break; } while(Reader.hasNext()){ String A = Reader.next(); String B = Reader.next(); String C = Reader.next(); String D = Reader.next(); String E = Reader.next(); System.out.printf("\nCharacter Print "); System.out.printf("%s\n%s\n%s\n%s\n", A, B, C, D,E); break; } } public void close(){ Reader.close(); } }
has comment: http://stackoverflow.com/comment/41483947
answer count: 1
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/41484355
has title: Reading file and defining lines and elements?
tagged with: java
has comment: http://stackoverflow.com/comment/41483904
type: Question
has comment: http://stackoverflow.com/comment/41484076
tagged with: arrays
has comment: http://stackoverflow.com/comment/41484145
has comment: http://stackoverflow.com/comment/41485496
has answer: http://stackoverflow.com/a/66385748
score: 0

http://stackoverflow.com/comment/41527196
type: Comment
type: QuestionComment
score: 1
has text: What @Seelenvirtuose said.
comment on: http://stackoverflow.com/q/26441826

http://stackoverflow.com/a/26491964
has body: It's very simple, just do this: data1List.addAll(mergeData(tabList,tabListAnother));
answers question: http://stackoverflow.com/q/26491819
score: 0
type: Answer

http://stackoverflow.com/comment/41457350
comment on: http://stackoverflow.com/a/26401150
type: AnswerComment
has text: @specializt You linked some very particular configurations, while OP was talking about a standard (Tomcat-MySQL), that's exactly my point: what he wants to do is impossible without major changes in his project. BTW I rollbacked my answer to first revision, where I mention that in most cases is impossible (just to avoid misconceptions like yours).
score: 0
type: Comment

http://stackoverflow.com/comment/41559917
comment on: http://stackoverflow.com/q/26460238
has text: And what is the question?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26417451
has body: I know how to get the external storage we use: String file = Enviroment.getExternalStorageDir(); Now I want to write my files on phone storage by using FileWriter and DataOutputStream. Is it possible? How?
accepted answer: http://stackoverflow.com/a/26417636
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26417636
tagged with: android
has title: How can i get internal storage and not sd card in android?
type: AnsweredQuestion

http://stackoverflow.com/comment/41580303
score: 1
comment on: http://stackoverflow.com/q/26470861
type: Comment
type: QuestionComment
has text: These things will not be literal file system or java.io.File objects on the device, but they can still be accessed via things like subclasses of InputStream

http://stackoverflow.com/comment/41582416
has text: Start by replacing the dense code with `System.arraycopy`.
comment on: http://stackoverflow.com/q/26472274
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41674306
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26489349
has text: Thanks, Holger, for pointing me to that thread (did not see it before).

http://stackoverflow.com/comment/41375495
score: 0
comment on: http://stackoverflow.com/q/26358380
type: Comment
type: QuestionComment
has text: You could read your doubles in java using c++ with jni interface, do some preprocessing and return to java frontend. If you are concerned about formatting problems - loosing precision, then maybe write to cout in binary format - for example uuencode binary double data. But I would do some heavy testing, to find examples of data with lost precision.

http://stackoverflow.com/comment/41508790
has text: @flyingseacows Well, welcome to SO xD Don't worry, but please listen to the comments on how to improve your question. Please do not put images when text is enough.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26431907

http://stackoverflow.com/comment/41548105
score: 0
type: Comment
type: QuestionComment
has text: Ok I am pretty sure which variable is being set to null, just not so sure why. I will post my main class code, I am not sure I have set it up properly. Could you take a look at that? :-) **edit** the accessoptions = new AccessOptions(); becomes null (I think)
comment on: http://stackoverflow.com/q/26453520

http://stackoverflow.com/q/26500377
has answer: http://stackoverflow.com/a/26512692
type: Question
has comment: http://stackoverflow.com/comment/41633402
has comment: http://stackoverflow.com/comment/41646016
has comment: http://stackoverflow.com/comment/41645707
has title: Calling a method for multiple values in a file
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41633239
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41632964
has body: I'm reading in this file from the command line on the program below: Student1 5 a Activities 0.05 q Quizzes 0.10 p Projects 0.25 e Exams 0.30 f Final 0.30 **a100 a95 a100 a100 a100 q90 q80 q100 q80 q80 r90 p100 p95 p100 p85 p100 e77.5 e88 f92** GradeBookApp.java public class GradeBookApp { public static void main(String[] args) throws IOException { String fileName = ""; String name = ""; char[] categoryCodes = new char[5]; String[] categories = new String[5]; double[] categoryWeights = new double[5]; double[][] gradeTable; if (args.length &gt; 0) { for (int i = 0; i &lt; args.length; i++) { System.out.println("Reading file \"" + args[i] + "\"." + "\n\tCreating GradeBook object." + "\n\tAdding grades to GradeBook object." + "\nProcessing of file complete."); fileName = args[i]; Scanner scanFile = new Scanner(new File(fileName)); name = scanFile.nextLine(); int catCodes = Integer.parseInt(scanFile.nextLine()); for (i = 0; i &lt; catCodes; i++) { String[] all = scanFile.nextLine().split(" "); if(all.length == 3 &amp;&amp; all[0].length() == 1 &amp;&amp; all[2].matches("(\\d+\\.\\d+)")){ categoryCodes[i] = all[0].charAt(0); categories[i] = all[1]; categoryWeights[i] = Double.parseDouble(all[2]); } } GradeBook myGB = new GradeBook (name, categoryCodes, categories, categoryWeights); } } I have another class containing the method "addGrade" that takes in a parameter "newGradeIn". This parameter is the grade from the file being read in i.e. a100 or e88. For each grade being added, I'm replacing the original 2D array with one that holds one more item. public boolean addGrade(String newGradeIn) { char row = newGradeIn.charAt(0); int grade = Integer.parseInt(newGradeIn.substring(1)); double[] oldArr = gradeTable[row]; double[] newArr = Arrays.copyOf(oldArr, oldArr.length + 1); newArr[newArr.length - 1] = grade; gradeTable[row] = newArr; return row != 0; } I'm completely blanking on how to do this. I know I should probably use a for-each loop, but I'm not sure how to go about t…
score: 2
tagged with: java

sorting
tags question: http://stackoverflow.com/q/26431238
tags question: http://stackoverflow.com/q/26407203
tags question: http://stackoverflow.com/q/26431063
tags question: http://stackoverflow.com/q/26492607
tags question: http://stackoverflow.com/q/26443219
tags question: http://stackoverflow.com/q/26404320
tags question: http://stackoverflow.com/q/26445264
tags question: http://stackoverflow.com/q/26467427
tags question: http://stackoverflow.com/q/26393995
tags question: http://stackoverflow.com/q/26486428
tags question: http://stackoverflow.com/q/26427821
tags question: http://stackoverflow.com/q/26356873
tags question: http://stackoverflow.com/q/26375025
tags question: http://stackoverflow.com/q/26488328
tags question: http://stackoverflow.com/q/26403936
tags question: http://stackoverflow.com/q/26414660
tags question: http://stackoverflow.com/q/26409914
tags question: http://stackoverflow.com/q/26443482
type: Tag
tags question: http://stackoverflow.com/q/26403105
tags question: http://stackoverflow.com/q/26440658
tags question: http://stackoverflow.com/q/26481823
tags question: http://stackoverflow.com/q/26503887
tag name: sorting
tags question: http://stackoverflow.com/q/26446465
tags question: http://stackoverflow.com/q/26375914
tags question: http://stackoverflow.com/q/26370762
tags question: http://stackoverflow.com/q/26452688
tags question: http://stackoverflow.com/q/26397963
tags question: http://stackoverflow.com/q/26448813
tags question: http://stackoverflow.com/q/26445116

http://stackoverflow.com/a/26458358
type: Answer
answers question: http://stackoverflow.com/q/26458350
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26458350
score: 3
upvote count: 3
has body: You can't access non-static members from a static class. System.out.println(swapPairs({5,4,2,6})); // swapPairs() is non-static allLess({5,4,3}, {4,7,5}); //allLess() is non-static Solution: Make a instance of ArrayMethods to access the swapPairs() method and allLess() method or make these method static. But there are more issues here. You can't use swapPairs({5,4,2,6}) you have to use swapPairs(new int[]{5,4,2,6}) One corrected way ArrayMethods arrayMethods = new ArrayMethods(); System.out.println(arrayMethods.swapPairs(new int[]{5, 4, 2, 6})); // * arrayMethods.allLess(new int[]{5, 4, 3},new int[]{4, 7, 5}); Pay attention to * line. You are calling toString() explicitly. This is not a good practice. More issues: for (int i = 0; i &lt; nums.length; i++) x[i] = nums[i + 1]; // you will get ArrayIndexOutOfBoundsException return x; When i=nums.length-1, nums[i + 1] will become num[nums.length]. Now there is no such index in the array. If the size of the array is 4, You have indexes from 0 to 3 only. You can take these points to your account and make these mistakes correct.
type: AcceptedAnswer

http://stackoverflow.com/a/26510463
downvote count: 0
score: 1
upvote count: 1
has body: There's no exact answer. It just depends. Depends on the design of your class and the business rules of your business. For example, if the valid state of an order only checks for a simple rule like checking the current state of the object reference, then have it as a method with a body. public class Order { public boolean isValid() { //validate current state of object reference //re using your same example return !orderDetail.isEmpty(); } } But in the case you have a business rule that demands the order should pass for a validation process before sending it to the client and this status (and a proper description) should be known at any moment of the application, then having a valid field in database is one way to solve it. In fact, if this was the case, it would be even better to store the valid field as a VARCHAR(X) and limit the values of this field by using an enum OrderStatus. But then again, this depends on the design for your class.
type: Answer
answers question: http://stackoverflow.com/q/26510191

http://stackoverflow.com/q/26397168
type: Question
has comment: http://stackoverflow.com/comment/41481977
tagged with: mustache
has title: How to use Spring Security with Mustache?
has answer: http://stackoverflow.com/a/53683061
has answer: http://stackoverflow.com/a/75276256
has comment: http://stackoverflow.com/comment/47449017
answer count: 3
tagged with: spring-mvc
has body: I'm following the Spring Security reference, and I've got redirection to a custom login page working as described in section 3.3. However, I'm not sure how to get the CSRF token in Mustache (all the examples use JSP). I've tried a few naïve things like this... {{#_csrf}} &lt;input type="hidden" name="{{parameterName}}" value="{{token}}"/&gt; {{/_csrf}} ...and this... {{#CsrfToken}} &lt;input type="hidden" name="{{parameterName}}" value="{{token}}"/&gt; {{/CsrfToken}} ...but they don't work (and I didn't really expect them to). How can I get the CSRF token in Mustache? I'm also wondering: Where could I set a breakpoint in my code to see what Spring Security is sending as the model to my custom login view?)
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20862299
has answer: http://stackoverflow.com/a/58714759
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/41445481
tagged with: spring-security
favorite count: 0
upvote count: 8

http://stackoverflow.com/comment/41532092
score: 1
comment on: http://stackoverflow.com/a/26444496
type: AnswerComment
type: Comment
has text: @MoshErsan, Using labels does not make code unclear. What makes code unclear is nesting statements so deeply that you _need_ a label to indicate which construct you want to break out of.

http://stackoverflow.com/q/26400651
score: 4
favorite count: 0
has body: PrinterJob job = PrinterJob.getPrinterJob(); job.setJobName("jPanel2"); job.setPrintable(new Printable() { public int print(Graphics pg, PageFormat pf, int pageNum) { if (pageNum &gt; 0) { return Printable.NO_SUCH_PAGE; } Graphics2D g2 = (Graphics2D) pg; g2.translate(pf.getImageableX(), pf.getImageableY()); jPanel2.paint(g2);`enter code here` return Printable.PAGE_EXISTS; } }); I have used the above code to print the jPanel content. But i want to print the data present in jTable. How can i do that?
answer count: 3
accepted answer: http://stackoverflow.com/a/26458509
has title: Printing jTable content to one note using java
has answer: http://stackoverflow.com/a/26401120
has answer: http://stackoverflow.com/a/26458509
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41451841
tagged with: java
has answer: http://stackoverflow.com/a/26601379
possible better answer: http://stackoverflow.com/a/26401120
type: Question
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/26447151
has comment: http://stackoverflow.com/comment/41571347
type: AnsweredQuestion
has title: Github accidental sync
upvote count: 0
has comment: http://stackoverflow.com/comment/41536739
linked to: http://stackoverflow.com/q/676450
tagged with: github
favorite count: 0
has body: I'm a newbie to programming, having just taken AP computer science, and not experienced with Github. I was asked to make a github, so I made one and synced all my changes there. I made a few changes, then tried to sync them. I opened github, and clicked sync, but it said I had uncommited changes, so it told me to delete them, so I did, then synced, and all my work was lost, as the old version was downloaded. I'm guessing I can't undo this, but I'm still optimistic, is there some way to recover it? This is kind of unrelated but: I have .jars of my newest work, but when I decompile them with jdgui, the for each loops get messed up. I'm also guessing its not possible for a compiler to read for each loops, but again I'm optimistic, is there some way to decomiple them cleanly with for each loops?
has comment: http://stackoverflow.com/comment/41536718
type: Question
score: -2
has comment: http://stackoverflow.com/comment/41536753
has answer: http://stackoverflow.com/a/26447411
tagged with: decompiler
downvote count: 2
linked to: http://stackoverflow.com/q/13116532
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41536860
accepted answer: http://stackoverflow.com/a/26447411

http://stackoverflow.com/q/26354674
downvote count: 0
tagged with: maven-3
tagged with: maven-2
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/71961212
has answer: http://stackoverflow.com/a/26395229
tagged with: maven
has comment: http://stackoverflow.com/comment/41372384
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41369290
has comment: http://stackoverflow.com/comment/41372328
has comment: http://stackoverflow.com/comment/41371109
has comment: http://stackoverflow.com/comment/41370785
has title: Missing JUNIT Jar Exception while building project using Maven
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41372428
score: 2
has body: I am in the beginning phase of Maven. I created a project and was trying to use the command. what is missing at my end? I am trying to compile and run a TestSuite File: mvn clean package POM.xml 4.0.0 com.test.myProject myTest jar 1.0-SNAPSHOT egdsvTest http://maven.apache.org junit junit 3.8.1 test but i get the below exception after using it. Exception D:\MVN_Shirish_Project\Test>mvn clean package [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea ded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Test 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Test --- [INFO] Deleting D:\MVN_Shirish_Project\Test\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\ main\resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ Test --- [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b uild is platform dependent! [INFO] Compiling 1 source file to D:\MVN_Shirish_Project\Test\target\classe s [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ eg dsvTest --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\MVN_Shirish_Project\Test\src\ test\resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ Test --- [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b uild is platform dependent! [INFO] Compiling 1 source file to …

http://stackoverflow.com/q/26380988
score: -3
has comment: http://stackoverflow.com/comment/41441977
has answer: http://stackoverflow.com/a/26381038
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41416986
downvote count: 3
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/26381038
has title: java keep looping if user input is not an integer
answer count: 2
has answer: http://stackoverflow.com/a/26381249
has body: I have tried similar codes in this site but nothing works for me. So I want the program to keep asking the user to input an integer if its not integer. If the credit card is integer then go to expiration date and if it is valid then print invoice. I tried if and while loop, also try and catch but I guess my logic is broken. Any help will be appreciated. Scanner s = new Scanner(System.in); System.out.println("Type 'quit' to exit payment"); System.out.println("Enter name: "); String name = s.next(); s.nextLine(); if (name.equals("quit")) { return; } System.out.println("Enter address: "); String address = s.nextLine(); if (address.equals("quit")) { return; } System.out.println("Type '000' to exit payment"); System.out.println("Enter card number: "); @override int cardNo = s.nextInt(); if (cardNo == 000) { return; } System.out.println("Enter card expiration date: (DDMMYY)"); int expirationDate = s.nextInt(); if (expirationDate == 000) { return; } //if input is ok then printing invoice }
accepted answer: http://stackoverflow.com/a/26381249
has comment: http://stackoverflow.com/comment/41416760
has comment: http://stackoverflow.com/comment/41416809
favorite count: 0

http://stackoverflow.com/a/26376878
score: 0
type: Answer
has body: A single request in ajax will get only a single response. You can either create more requests, excellent solution related to this provided here, OR Better way you can append the extra parameters into the json string itself and change logic in you JS to extract those two values separately from excel data, while parsing the json string.
answers question: http://stackoverflow.com/q/26376640

http://stackoverflow.com/comment/41405329
type: QuestionComment
has text: @chrylis: Derp. :) But yeah, premature optimisation. I believe (not 100% sure) that `java.net.Inet4Address` only stores a 32-bit number. Overhead might get you over the `short[]` size, but `short[]` would be harder to process (again, depending what processing you're doing). And besides, for certain types of processing, you don't need to have everything in memory at once.
score: 1
comment on: http://stackoverflow.com/q/26374322
type: Comment

http://stackoverflow.com/comment/41638465
comment on: http://stackoverflow.com/q/26503431
type: Comment
type: QuestionComment
score: 5
has text: You can import it, use full name.

http://stackoverflow.com/comment/41651690
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26502661
has text: Looking at the first few minutes of the video, I can see the full text search features they talk about belong to the Search Api, not the Datastore. They may be duplicating the entities in the Datastore in Documents for the Search Api, so that search results return the entities' keys on the Datastore.

http://stackoverflow.com/comment/41386862
has text: I think it's because KeyStore is a singleton [see](http://stackoverflow.com/questions/2302179/mocking-a-singleton-class)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26361029
type: AnswerComment

http://stackoverflow.com/comment/41470958
type: QuestionComment
comment on: http://stackoverflow.com/q/26411357
has text: Your regex already doesn't match `ice-cream`
score: 0
type: Comment

http://stackoverflow.com/comment/41549524
comment on: http://stackoverflow.com/q/26454311
score: 0
type: Comment
type: QuestionComment
has text: @andersschuller probably OP's implementing his/her own `LinkedList` class.

http://stackoverflow.com/q/26501306
has comment: http://stackoverflow.com/comment/41636047
has title: JTextField: Records inputs history like from Terminal
has answer: http://stackoverflow.com/a/26501831
has comment: http://stackoverflow.com/comment/41635970
type: AnsweredQuestion
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/26501831
has comment: http://stackoverflow.com/comment/41634512
tagged with: java
has comment: http://stackoverflow.com/comment/41634511
has comment: http://stackoverflow.com/comment/41636068
score: 0
has comment: http://stackoverflow.com/comment/41635269
has body: I would like to develop a Swing application that may contain text field which will act like Terminal (the console from Unix/Linux systems). Whenever a user entered a command, it will save into a container, then will be accessed thru up or down arrow (&#65514;/ &#65516;). I know it is possible but I still don't have the idea in implementing it right. My first implementation is to store the commands into a single text file, then accessed it in reverse order so that last input will be retrieve first. My problem is that how will I know if I'm in the specified index (e.g. 2 &#65514; arrows will go into length-2 index of file).
answer count: 1

http://stackoverflow.com/comment/41642801
has text: @JBNizet Well thats the requirement. MachineInPitImpl is an abstract class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26505699

http://stackoverflow.com/comment/41416538
has text: Something like that. (basicMainMenu.png) can you help me do it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26379194
score: 0

http://stackoverflow.com/comment/41456126
has text: You question made ma concept clear :) And i also get to learn something new :)
comment on: http://stackoverflow.com/q/26402829
type: Comment
type: QuestionComment
score: 1

thread-sleep
tags question: http://stackoverflow.com/q/26403445
type: Tag
tags question: http://stackoverflow.com/q/26366941
tag name: thread-sleep
tags question: http://stackoverflow.com/q/26486258

http://stackoverflow.com/comment/41531571
has text: Thanks for your advice. That did fix my problem. I'll look into the other things as well.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26443137

http://stackoverflow.com/comment/41608287
type: QuestionComment
comment on: http://stackoverflow.com/q/26486844
has text: iam using XML Mapping
score: 0
type: Comment

http://stackoverflow.com/comment/41460639
has text: That would be my recommendation, yes.
score: 1
comment on: http://stackoverflow.com/q/26405594
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41526473
type: QuestionComment
has text: Maybe you didn't understand it so well. [the source](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/ThreadLocal.java#142) to the rescue
comment on: http://stackoverflow.com/q/26441649
score: 0
type: Comment

http://stackoverflow.com/comment/41447640
has text: What type is t1 and does it override the equals method?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26398209

http://stackoverflow.com/q/26411051
tagged with: unit-testing
has answer: http://stackoverflow.com/a/26411597
has title: Testing functions in class which expects string in constructor using Mockito
tagged with: java
type: UnansweredQuestion
tagged with: mockito
has body: I have the following class and want to write unit test for it. Below is the class for full reference. X is POJO public class StatusTable { private P tableData; private Q tableDefinition; public StatusTable(final List&lt;X&gt; xList, final A a, final B b) throws URISyntaxException { setTableDefinition(a, b); setTableData(xList, b, a); } private void setTableDefinition(final A a, final B b) { //some code } public void setTableData(final List&lt;X&gt; xList, final B b, final A a) throws URISyntaxException { for (X sfm : xList) { //some code } } } Being new to unit testing, I have very minimal idea of how to test but here is a thought. Please correct me wherever incorrect. public class StatusTableTest { private StatusTable statusTable; @Mock private A mockA; @Mock private B mockB; @Mock private X mockX; public void setUp() { stub(mockX.getSomeValue()).toReturn(?); //want to return any string stub(mockX.getSomeAnotherValue()).toReturn(?); //want to return any integer //Similarly mock other functions retuning this.statusTable = new StatusTable(xList, mockA, mockB,); } public void setTableDefinitionTest() { //test the code } } I have a few doubts: a) Am I doing it correctly? Should the X be mocked? b) Is there anyString() kind of functionality in Mockito or should I use something else?
type: Question
has answer: http://stackoverflow.com/a/26411398
score: 0
answer count: 2

http://stackoverflow.com/a/26403389
answers question: http://stackoverflow.com/q/26403349
has comment: http://stackoverflow.com/comment/41456059
has comment: http://stackoverflow.com/comment/41456039
score: 2
has body: mm represents minutes, MM is used to match the months - swap the field patterns SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41455843
accepted answer of: http://stackoverflow.com/q/26403349

http://stackoverflow.com/comment/41553302
type: Comment
comment on: http://stackoverflow.com/a/26456390
has text: I spent like few hours solving this problem, and here is the answer, lowercase... Thank you very much, now i can sleep well.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41612295
has text: How can I reproduce this?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26481586
type: AnswerComment

http://stackoverflow.com/a/26367667
type: Answer
answers question: http://stackoverflow.com/q/26367322
has comment: http://stackoverflow.com/comment/41401433
has body: If you wish to create schema dynamically I guess this should help you. Hibernate: Automatically creating/updating the db tables based on entity classes You could issue ddl statments using jdbc to create tables on the fly. Keeping the queries in some xml file. So that it remains generic. Have a watcher service on the config file, the moment file gets updated with new query you can fire required jdbc calls
score: 0

object
tags question: http://stackoverflow.com/q/26420934
tags question: http://stackoverflow.com/q/26458476
tag name: object
tags question: http://stackoverflow.com/q/26482430
tags question: http://stackoverflow.com/q/26376823
tags question: http://stackoverflow.com/q/26512193
tags question: http://stackoverflow.com/q/26441071
tags question: http://stackoverflow.com/q/26495704
tags question: http://stackoverflow.com/q/26373647
tags question: http://stackoverflow.com/q/26436032
tags question: http://stackoverflow.com/q/26413310
tags question: http://stackoverflow.com/q/26395862
tags question: http://stackoverflow.com/q/26450113
tags question: http://stackoverflow.com/q/26389860
tags question: http://stackoverflow.com/q/26451548
tags question: http://stackoverflow.com/q/26500492
tags question: http://stackoverflow.com/q/26404435
tags question: http://stackoverflow.com/q/26486367
tags question: http://stackoverflow.com/q/26367619
tags question: http://stackoverflow.com/q/26494775
tags question: http://stackoverflow.com/q/26373962
tags question: http://stackoverflow.com/q/26413844
tags question: http://stackoverflow.com/q/26417069
tags question: http://stackoverflow.com/q/26391490
type: Tag
tags question: http://stackoverflow.com/q/26511851
tags question: http://stackoverflow.com/q/26403105
tags question: http://stackoverflow.com/q/26447871
tags question: http://stackoverflow.com/q/26455116
tags question: http://stackoverflow.com/q/26373764
tags question: http://stackoverflow.com/q/26453627
tags question: http://stackoverflow.com/q/26445384

http://stackoverflow.com/comment/41369310
comment on: http://stackoverflow.com/q/26355115
type: Comment
type: QuestionComment
has text: have you tried introducing sleep()s? have you tried from multiple threads?
score: 0

http://stackoverflow.com/q/26502043
tagged with: xml-configuration
upvote count: 1
has answer: http://stackoverflow.com/a/26504076
type: Question
has answer: http://stackoverflow.com/a/26503464
answer count: 2
has comment: http://stackoverflow.com/comment/41636705
tagged with: jsp
tagged with: struts2
has title: Struts2 action accessed by exactly one machine/browser combination
downvote count: 0
has comment: http://stackoverflow.com/comment/41636867
favorite count: 0
has body: I have a web application for taking audits. Everything works fine except for one action. The JSP form for entering the users and location for each audit assigned is not submitted It works without a flaw when executed from the Firefox browser in my Windows7 machine (in safe mode, too). When using the other machines or other browsers (Google Chrome) in my machine, the action doesn't execute instead just redirects. I put a breakpoint in eclipse for that specific method and found that it is not hit unless accessed from my Windows7/Firefox. Could there be any possible reason for this behaviour? How can I fix it? Source: audit.xml <?xml version="1.0" encoding="UTF-8"?> .... jspAudit /audit /audit/pages/template/Message.jsp .... AssignAudit.jsp <%@ taglib prefix="s" uri="/struts-tags"%> Instruction Details Users : <s:select id="user-multiselect" name="assignment.userList" cssClass="input-xlarge" multiple="multiple" list="userList" listKey="userID" listValue="userName"></s:select> Start Time : End Time Events <s:select id="event-drop-down" cssClass="input-xlarge" list="eventList" listKey="eventID" listValue="eventName"></s:select> Audit Type LIVE VIEW RECORDED Save Cancel Locations <s:hidden name="audit.id"></s:hidden>
has comment: http://stackoverflow.com/comment/41636511
type: UnansweredQuestion
tagged with: struts2-namespace
has comment: http://stackoverflow.com/comment/41636639
score: 1
tagged with: java

http://stackoverflow.com/a/26373814
type: Answer
has body: The loop won't keep running and it will end without any exception. But the result may not what you expect. Besides "ArrayList#clear()" or Iterator way to remove all elements from one array. You can also try below codes, just remove "x++" from your loop condition. ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); int listSize = list.size(); for(int x = 0; x&lt; listSize;){ list.remove(x); listSize = list.size(); }
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26373272

http://stackoverflow.com/q/26398217
answer count: 10
has answer: http://stackoverflow.com/a/26398362
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26398389
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26398567
has answer: http://stackoverflow.com/a/26398349
tagged with: java
has answer: http://stackoverflow.com/a/26398348
has answer: http://stackoverflow.com/a/26398423
has answer: http://stackoverflow.com/a/26398295
has body: This code does not run on Android Studio. I just want it to display a toast when the button is clicked. Please help. Code is attached below: I'm new to android development and is having a hard time figuring this out. I think the problem is a silly syntax error or variable not being defined. Also, how do I define "v" ? package com.shutter2000.www.shutter_2000_oms; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import android.view.View.OnClickListener; public class SiteVisitDetails extends Activity { public EditText mCusName; public EditText mOrderID; public EditText mProjectID; public EditText mHeightWidth; public EditText mNote; public Button mSubmitButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_site_visit_details); //initialize text fields mCusName = (EditText) findViewById(R.id.txtCusName); mOrderID = (EditText) findViewById(R.id.txtOrderID); mProjectID = (EditText) findViewById(R.id.txtProjectID); mHeightWidth = (EditText) findViewById(R.id.txtHeightWidth); mNote = (EditText) findViewById(R.id.txtNote); mSubmitButton = (Button) findViewById(R.id.btnSubmit); //listen to submit button click event mSubmitButton.OnClickListener(new View.OnClickListener()) { @Override public void onClick(View v){ if (v == mSubmitButton) { Context context = getApplicationContext(); CharSequence text = "Successfully Sent!"; int duration = Toast.LENGTH_LONG; final Toast tost = Toast.makeText(context, text, duration); tost.show(); } } } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.site_visit_details, men…
possible better answer: http://stackoverflow.com/a/26398277
downvote count: 0
has answer: http://stackoverflow.com/a/26398277
favorite count: 0
has answer: http://stackoverflow.com/a/26398650
has answer: http://stackoverflow.com/a/26398342
accepted answer: http://stackoverflow.com/a/26398348
tagged with: android
has title: Button click event error for toast on android studio

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/26439715
tag name: android-actionbar

http://stackoverflow.com/a/26430487
has comment: http://stackoverflow.com/comment/41505798
has comment: http://stackoverflow.com/comment/41535041
has comment: http://stackoverflow.com/comment/41506788
has comment: http://stackoverflow.com/comment/41511945
type: Answer
has comment: http://stackoverflow.com/comment/41506742
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26430465
has comment: http://stackoverflow.com/comment/41506177
has comment: http://stackoverflow.com/comment/41505899
has body: It's independent of both. As long as there is a JVM for that OS and CPU architecture, it can run java Bytecode.
downvote count: 0
has comment: http://stackoverflow.com/comment/41505842
has comment: http://stackoverflow.com/comment/41506646

http://stackoverflow.com/comment/41454500
comment on: http://stackoverflow.com/a/26401485
has text: @Karthick - Doesn't my solution help?.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26456230
answer count: 1
accepted answer: http://stackoverflow.com/a/26456300
type: AnsweredQuestion
tagged with: stack
tagged with: java
type: Question
has title: Stack variable and .contains(Object o)
has answer: http://stackoverflow.com/a/26456300
tagged with: contain
has body: Im having trouble keeping track of nodes in my stack. My nodes contain a 2d int array which contains numbers 0-20 as well as another integer measuring the cost to get to the current node state (2d int array). currently i cant figure out how to track if my stack contains a node that i wish to skip since it is already in the stack or has been popped before so i avoid repeating the same compares on nodes that have the exact same state + costs. if q is my stack and n1 is my current node i just popped, why wont q.contains(n1); ever return true? I also tried making an ArrayList which creates a string for every node Ex 1 2 4 5 3 6 0 7 8 Creates the string "1,2,4,5,3,6,0,7,8,". if i add this string to the array list and i use aList.contains(stringKey); never returns true? I think i have to do something with an object because the contains() requires an object to be passed, and im not 100% sure how to do this.
score: 0

http://stackoverflow.com/comment/41595502
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26479609
has text: You have change the inner class to separate class. No needs to do that. You can just use `Maths maths =new Calculator().new Maths();`

http://stackoverflow.com/q/26443634
has answer: http://stackoverflow.com/a/26443984
upvote count: 1
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/41530109
has title: Recursion confusion
has body: I am writing a function according to the following guidelines: Given an array of ints, is it possible to choose a group of some of the ints, beginning at the start index, such that the group sums to the given target? However, with the additional constraint that all 6's must be chosen. (No loops needed.) groupSum6(0, {5, 6, 2}, 8) → true groupSum6(0, {5, 6, 2}, 9) → false groupSum6(0, {5, 6, 2}, 7) → false This is the solution: public boolean groupSum6(int start, int[] nums, int target) { if (start == nums.length) { if (target == 0) { return true; } return false; } if (nums[start] == 6) { return groupSum6(start + 1, nums, target - nums[start]); } if (groupSum6(start + 1, nums, target - nums[start])) { return true; } return groupSum6(start + 1, nums, target); } I am a little confused about why this works. I understand how it adds 6s, but where are the other numbers tested to see if they will add up to the target after the 6s have been added? Where are other non-6 numbers added?
has answer: http://stackoverflow.com/a/26443793
has answer: http://stackoverflow.com/a/58891435
downvote count: 0
score: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/77400752
answer count: 4
has comment: http://stackoverflow.com/comment/41530178
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/26505001
tagged with: slidingpanelayout
tagged with: pane
tagged with: android
has answer: http://stackoverflow.com/a/26506085
score: 0
has body: Problem with my code below is that the Pane always gets opened by default, no idea why. Obviously, I dont want the Pane (child) to be opened by default. Only when user clicks on lv_schedule, the pane should open. So when the fragment loads, I have to actually slide out the pane first to see the lv_schedule. This is the XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scheduledblocks_sliding_pane_layout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:id="@+id/ll_left_pane_scheduled" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;ListView android:id="@+id/lv_schedule" android:layout_width="1000dp" android:layout_height="match_parent" android:layout_gravity="left" android:layout_marginRight="0dp" /&gt; &lt;/LinearLayout&gt; &lt;!-- Framelayout to display Fragments --&gt; &lt;FrameLayout android:id="@+id/frame_container_scheduledblocksslidingpanedetailview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="20dp" /&gt; This is the JAVA file: public class Fragment_allScheduledBlocks extends Fragment implements View.OnClickListener, OnItemClickListener { private Handler handler; private ActionBarHelper mActionBar; private Thread thread = new Thread(); public Fragment_allScheduledBlocks() { } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { mLogger.printToLog(Constants.LOG_ENTRY, " onCreateView of Fragment_scheduled_blocks.java", Constants.TAG_ALL); v = inflater.inflate(R.layout.fragment_scheduled_blocks, container, false); mSlidingLayout = (SlidingPaneLayout) v .findViewById(R.id.scheduledblocks_sliding_pane_layout); mSlidingLayout.setPanelSlideListener(new SliderListenerSchBlocks()); mSlidingLayout.op…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26506085
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/31801230
answer count: 2
has answer: http://stackoverflow.com/a/31801230
has title: Pane is always opening in SlidingPaneLayout implementation

http://stackoverflow.com/q/26419827
tagged with: powershell-remoting
has title: How to copy a script file to remote machine in Powershell through java?
type: Question
tagged with: jakarta-ee
tagged with: powershell
tagged with: powershell-2.0
score: 0
has comment: http://stackoverflow.com/comment/41486226
has body: Is there any way that we could copy our script files from local machine to remote machine in Powershell through Java? Thanks in advance.
has comment: http://stackoverflow.com/comment/41491612
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41486080
answer count: 0
tagged with: java

http://stackoverflow.com/comment/41561734
comment on: http://stackoverflow.com/q/26461312
type: Comment
score: 3
has text: Seems to be working for me. What's your JDK version?
type: QuestionComment

http://stackoverflow.com/q/26397947
answer count: 1
downvote count: 0
has title: MAC os x 10.8+ code signing certificate details
tagged with: macos
favorite count: 0
tagged with: code-signing-certificate
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26795122
upvote count: 2
tagged with: java
type: Question
has body: I want details of all code signing certificates installed on any macosx 10.8+ machines as well as details of the certificate like to see it's properties like certificateID, certificateDevID etc using java code. Currently i am using ProcessBuilder in java to get the output of the command "security find-identity -p codesigning -v" &amp; parsing it output. It is listing all installed code signing certificates but not much details about the certificate. Any other approach or hack ? Thanks
score: 2

http://stackoverflow.com/q/26367322
linked to: http://stackoverflow.com/q/306806
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26388052
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26380446
has title: Hibernate DDL table Dynamic creation
answer count: 4
score: 2
has answer: http://stackoverflow.com/a/26367667
upvote count: 2
tagged with: ddl
has comment: http://stackoverflow.com/comment/125038781
tagged with: spring-data
has body: I've a spring boot project, and I'm using hibernate to map my entities to DB, However now I have a new requirement: I need to be able to dynamically create tables in DB, without any mapping (so far). Does anyone know about some framework, to help me to deal with this: -I want to execute SQL or similar(ddl) to create my tables -I need to deal with connection management I've been told about spring-data, but I need some opinion about this. An example: Imagine I have a service available to client, for example: class DBHACKService { void executeSQL(String ddl). } The client invoke this like : new DBHackService.executeSQL ("create table mytable (name varchar)"); In this method I can do some manipulation to the sql. The question is: which is the best way to send it to DBEngine. Thanks again Thanks in advance. rui
type: Question
tagged with: spring-boot
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26377975

http://stackoverflow.com/a/26401479
answers question: http://stackoverflow.com/q/26399756
has comment: http://stackoverflow.com/comment/41457715
type: Answer
has body: Try this steps; 1.Change your Parent.hbm ... <generator class="native"/> <property column="description" name="description" type="string" unique="true" /> <column name="parent_id" not-null="true"/> <one-to-many class="Child"/> ... 2.Change your Child.hbm .... <generator class="native"/> <property column="address" name="address" type="string"/> <column name="parent_id" not-null="true"/> ... 3.And add child before parent as you want Parent parent = new Parent(); parent.setDescription("D1"); Child child = new Child(); child.setAddress("A1"); child.setParent(parent); session.save(child); Set<Child> childsSet = new HashSet<Child>(); childsSet.add(child); parent.setChildren(childsSet); session.save(parent);
score: 0

http://stackoverflow.com/a/26435621
answers question: http://stackoverflow.com/q/26435283
has comment: http://stackoverflow.com/comment/41515965
type: Answer
has comment: http://stackoverflow.com/comment/41516091
accepted answer of: http://stackoverflow.com/q/26435283
score: 1
has body: Let me guess what your code looks like. public class Test { public static void main(String[] args) { int LENGTH = 1000000; List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; LENGTH; i++) { list.add((int) (100 * Math.random())); } // start timing int sum = 0; for (int i = 0; i &lt; LENGTH; i++) { sum += list.get(i); } // stop timing and report } } That will be fast. The section that is being timed is likely to take less than 10th of a second. (And it will be faster still if the JVM has been properly "warmed up"). But if you just change new ArrayList&lt;&gt;() to new LinkedList&lt;&gt;() ... the timed section is likely to slow down by a factor of roughly 1 MILLION. (I can predict this with a high degree of confidence that I will be right ...) But why? It is because of the get(int) method call! For an ArrayList the time taken to call get(i) is a small constant. Maybe 10 to 20 hardware clock cycles, on a typical system where there are billions of clock cycles per second. A few nanoseconds. For a LinkedList a get(i) call entails starting at the beginning of the list and skipping over i links. One at a time. The time taken is clearly proportional to the value of i. In your test case, i ranges up to 1 million. So in the LinkedList version, you do 1 million iterations of a loop where each iteration does (on average) 0.5 million steps. (Actually, it may be 0.25 million because a LinkedList is doubly-linked, and according to @makoto the get(i) operation will traverse from the start or end of the list, whichever is nearer to i.) In technical terms, the Big-O time complexity of ArrayList version of the test program is O(N), and the LinkedList version is O(N^2) (i.e N squared ...) where N is the length of the list. Interestingly ... if you rewrote the summing like this, the performance problem goes away in the LinkedList case: // start timing int sum = 0; for (Integer v : list) { sum += v; } // stop timing and report ... because now you are using an itera…
upvote count: 1
has comment: http://stackoverflow.com/comment/41516201
has comment: http://stackoverflow.com/comment/41515994
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41516002

http://stackoverflow.com/comment/41646144
has text: That’s far away from detecting all class declarations, but the question leaves room for interpretation whether really all declarations ought to be matched. You know, there’s `enum` and `@interface` as well. Further, a class declaration doesn’t need to have any of `public`, `protected`, `private`, or `static`, e.g. `class Foo` is a valid class declaration, but a class also may have more than one modifier like in `private static final class Bar`, and we’re not talking about `private @Deprecated class ClassName` yet…
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26507436
type: Comment

http://stackoverflow.com/q/26379592
type: Question
has comment: http://stackoverflow.com/comment/41414766
has title: Avoiding XML escaped values (e.g. &gt;) in TransformerFactory
has body: I am writing the xml document into a file, using TransformerFactory. XML document has characters like '>', but while marshalling it back instead of ">" its printing "&amp;gt ;" For marshall and unmarshall I am using JAXB-Binder. private void writeIntoFile( Document document, File xmlPath ){ document.createProcessingInstruction( StreamResult.PI_DISABLE_OUTPUT_ESCAPING, ""); TransformerFactory tf = TransformerFactory.newInstance(); try{ Transformer t = tf.newTransformer(); t.setOutputProperty( OutputKeys.METHOD, "xml" ); t.setOutputProperty( OutputKeys.INDENT, "yes" ); t.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); t.transform( new DOMSource( document ), new StreamResult( System.out ) ); } catch( TransformerException e ){ logger.error( e, "Exception while marshalling the document in the xml file [", xmlPath.getAbsolutePath() ); } }
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: jaxb
tagged with: dom
tagged with: marshalling

http://stackoverflow.com/a/26384357
answers question: http://stackoverflow.com/q/26384304
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41422985
has comment: http://stackoverflow.com/comment/41426117
type: Answer
has body: Yes, the problem is that in increaseRow you're calling monitor.signal() without having locked lock first. From the documentation for Condition.signal(): An implementation may (and typically does) require that the current thread hold the lock associated with this Condition when this method is called. Implementations must document this precondition and any actions taken if the lock is not held. Typically, an exception such as IllegalMonitorStateException will be thrown. Both your increaseRow and increaseColumn methods should have a structure of lock.lock(); try { // code including monitor.signal() here } finally { lock.unlock(); } just as your sumRow, sumColumn and printMatrix methods do. Alternatively, you may want to have a separate monitor (and conditions) for each row and for each column. You basically need to consider all your concurrency constraints - it's hard to give more guidance without more idea of what you're trying to achieve.
has comment: http://stackoverflow.com/comment/41424435
has comment: http://stackoverflow.com/comment/41423439
has comment: http://stackoverflow.com/comment/41426004
accepted answer of: http://stackoverflow.com/q/26384304
upvote count: 7
has comment: http://stackoverflow.com/comment/41423194
has comment: http://stackoverflow.com/comment/41423474
score: 7
has comment: http://stackoverflow.com/comment/41422937
has comment: http://stackoverflow.com/comment/41425983

http://stackoverflow.com/q/26397963
has body: So I have a 2D array graph that represents an adjacency list: 0:2 1 0 1:0 2: In array format thats: [[2,1,0],[0],[]] What I want to do is sort a specific row (say graph[0]) by the length of the sub array (the edge list). In the example above the sorted graph would look like: 0:0 1 2 1:0 2: [[0,1,2],[0],[]] Since graph[0].length = 3 and graph[1].length = 1 and graph[2].length = 0. I've tried using: Arrays.sort(graph[v], new DegreeComparator(graph)); class DegreeComparator implements Comparator&lt;Integer&gt; { int[][] graph; public DegreeComparator(int[][] g) { graph = g; } public int compare(Integer c1, Integer c2) { return Integer.compare(graph[c1].length, graph[c2].length); } } But the sort method won't accept this format. Can someone explain what I'm doing wrong? Edit for clarity: Because the above example uses numbers it's a bit confusing so I'll add a second case: 0: 4 1 2 1: 1 2 3 2: 3: 4 1 4: 0 [[4,1,2],[1,2,3],[],[4,1],[0]] Would become (if all rows were sorted): 0: 1 4 2 // Row 1 has more numbers than row for which has more than row 2 1: 1 3 2 2: 3: 1 4 4: 0 [[1,4,2],[1,3,2],[],[1,4],[0]] However, I only need to sort one row at a time! Not the whole thing.
has answer: http://stackoverflow.com/a/26398487
has comment: http://stackoverflow.com/comment/41447257
has comment: http://stackoverflow.com/comment/41447574
tagged with: sorting
has comment: http://stackoverflow.com/comment/41447159
possible better answer: http://stackoverflow.com/a/26398487
tagged with: comparator
has answer: http://stackoverflow.com/a/26398228
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41447047
has comment: http://stackoverflow.com/comment/41447367
tagged with: adjacency-list
has comment: http://stackoverflow.com/comment/41447220
has comment: http://stackoverflow.com/comment/41446872
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41447074
answer count: 2
has title: Sort array by length of sub arrays
has comment: http://stackoverflow.com/comment/41446867
has comment: http://stackoverflow.com/comment/41447390
accepted answer: http://stackoverflow.com/a/26398228
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41447171
upvote count: 1
has comment: http://stackoverflow.com/comment/41447396
downvote count: 1
has comment: http://stackoverflow.com/comment/41447324

http://stackoverflow.com/a/26420821
has body: Let me refer you again to Polyglot (Clojure, Java) Projects With Leiningen, and particularly this part: Interleaving Compilation Steps. Be default, Leiningen is executing javac and then compile. What you can achieve also compile -> javac -> compile.
type: Answer
has comment: http://stackoverflow.com/comment/73371788
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41493957
score: 0
answers question: http://stackoverflow.com/q/26420172

http://stackoverflow.com/q/26355812
has title: Webrtc Aecm for Android
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27264939
downvote count: 0
tagged with: webrtc
answer count: 1
has body: I'm developing a Sip client for android and i want to implement the Aecm module from webrtc but i don't understand how to do properly. I've 2 runnable class, one for AndroidRecord (microphone) and one for AudioTrack (speaker), so i don't know how and where i've to call that api : int32_t WebRtcAec_BufferFarend(void *aecInst, const int16_t *farend, int16_t nrOfSamples); int32_t WebRtcAec_Process(void *aecInst, const int16_t *nearend, const int16_t *nearendH, int16_t *out, int16_t *outH, int16_t nrOfSamples, int16_t msInSndCardBuf, int32_t skew); BufferFarend is the AudioTrack buffer? and the buffer that will be written on AudioRecord have to pass into "WebRtcAec_Process" ?
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/27264939
type: AnsweredQuestion
upvote count: 1

http://stackoverflow.com/q/26354163
has body: I'm trying to use logback as my logger in my simple program but it does not work fine! I put logback/logback.xml and logback/Logback.java in the source directory logback and run through this command line \logback>java -cp .;%CLASSPATH% Logback which the %CLASSPATH% is an environment variable that has the path of .jar file that logback needs like: logback-access-1.1.2.jar logback-classic-1.1.2.jar logback-core-1.1.2.jar slf4j-api-1.7.6.jar This is my logback.xml file test.log tests.%i.log 1 2MB %date %level [%thread] %logger{10} [%file:%line] %msg%n <appender-ref ref="FILE" /> and there is my simple program import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Logback{ private final static Logger logger = LoggerFactory.getLogger(Logback.class); public static void main(String[] args){ for(int i=0;i<1000000;i++) logger.debug("hello"); } } but unfortunately i just receive log in the console instead of test.log files. it seems the logger object just use the default configuration!!! If i set the -Dlogback.configurationFile=logback.xml variable as below, it works properly. but how to run without this variable? \logback>java -cp .;%CLASSPATH% -Dlogback.configurationFile=logback.xml Logback
downvote count: 0
has answer: http://stackoverflow.com/a/26355069
accepted answer: http://stackoverflow.com/a/26355069
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/26360009
tagged with: java
has answer: http://stackoverflow.com/a/26360009
tagged with: logback
upvote count: 3
answer count: 2
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: unable to find logback.xml
type: AnsweredQuestion

http://stackoverflow.com/comment/41592090
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26477499
type: AnswerComment
has text: what is the problem that you are facing then?

http://stackoverflow.com/comment/41673465
type: Comment
has text: @KevinKrumwiede, yes I am aware of that, my point was to understand if code fails when : if 'n' members are used in equals() comparison and I use 'less than n' member for hashcode, will my code break or something. But it doesn't break, but reduces performance by increasing chances of mapping multiple objects to same bucket. Thanks.
comment on: http://stackoverflow.com/a/26459714
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41493775
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26424146
type: QuestionComment
has text: @y3zier unfortunately i can't share the webpage, privacy issues, when extracting the number of tables there are 3 one that i suspect is invisible and two visible, what should I look for in order to find if a table is visible or not and what can i do?

http://stackoverflow.com/q/26456623
has answer: http://stackoverflow.com/a/26457237
tagged with: java
tagged with: listview
has title: Android Extended ListView
has body: I created my own ListView class (extended with TouchEvent detection) public class MyListView extends ListView{ private ScaleGestureDetector myScaleDetector; private float myScaleFactor = 1.f; public MyListView(Context context) { super(context); myScaleDetector = new ScaleGestureDetector(context, new myScaleListener()); } @Override public boolean onTouchEvent(MotionEvent e) { myScaleDetector.onTouchEvent(e); return super.onTouchEvent(e); } private class myScaleListener extends ScaleGestureDetector. SimpleOnScaleGestureListener { @Override public void onScaleEnd(ScaleGestureDetector detector) { int a=3; //just for breakpoint } } } this is how i define it in layout contacts_activity.xml &lt;com.my.aclient.ui.MyListView android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/listView"/&gt; But application is getting RuntimeException on line where this contacts_activity.xml file is inflated this.setContentView(R.layout.contacts_activity); Error reported in Logcat stacktrace Binary XML file line #106: Error inflating class com.my.aclient.ui.MyListView When i use only ListView everything works perfectly. What could make this problem?
answer count: 1
accepted answer: http://stackoverflow.com/a/26457237
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 0
type: Question

http://stackoverflow.com/q/26403105
tagged with: sorting
has answer: http://stackoverflow.com/a/26403235
tagged with: arraylist
has comment: http://stackoverflow.com/comment/41455392
has comment: http://stackoverflow.com/comment/41455476
answer count: 3
possible better answer: http://stackoverflow.com/a/26403283
has comment: http://stackoverflow.com/comment/41455407
has comment: http://stackoverflow.com/comment/41462330
has comment: http://stackoverflow.com/comment/41455488
linked to: http://stackoverflow.com/q/11050874
has title: Sorting an Array of Objects throws long[] error
accepted answer: http://stackoverflow.com/a/26403235
has answer: http://stackoverflow.com/a/26403219
has comment: http://stackoverflow.com/comment/41455346
tagged with: object
type: AnsweredQuestion
score: 0
tagged with: java
has body: Im following the MKyong sort examples. I have the class AGRinformesActivos overriding compareTo() method to sort my class by riesgoTotal double. public class AGRinformesActivos extends EntidadBase implements Comparable&lt;AGRinformesActivos&gt;{ private static final long serialVersionUID = -4341418821044868087L; private String tipoActivo = ""; private String codigo = ""; private String denominacion = ""; private int idAmenaza = 0; private double impactoTotal = 0; private double riesgoTotal = 0; private int valorPendiente = 0; ArrayList&lt;Double&gt; impactoCuali = new ArrayList&lt;Double&gt;(); ArrayList&lt;String&gt; impactoCuanti = new ArrayList&lt;String&gt;(); ArrayList&lt;Double&gt; riesgoCuali = new ArrayList&lt;Double&gt;(); ArrayList&lt;String&gt; riesgoCuanti = new ArrayList&lt;String&gt;(); To order in asc Im using this compareTo() version: Sort array of object by particular member inside the object/class. public int compareTo(AGRinformesActivos o) { return new Double(this.riesgoTotal).compareTo(new Double(o.riesgoTotal)); } And this is my code: ArrayList &lt;AGRinformesActivos&gt; datosTotal = new ArrayList&lt;AGRinformesActivos&gt;(); List listadoActTotal = manager.dameListadoActivos( Integer.parseInt(info.getIdtipoActivo().trim()), info.getCodigo().trim()); for( Object o : listadoActTotal ) { fila = (List) o; String codigoActivo = fila.get( 0 ).toString(); // If exists we obtain, if not exists we create. if (activosDimension.containsKey( codigoActivo )){ // If exists, obtain from activosDimension informesActivo = activosDimension.get( codigoActivo ); }else{ informesActivo = new AGRinformesActivos(); activosDimension.put( codigoActivo, informesActivo ); // Al objeto le añado tipoActivo, idActivo y Denominación String tipoActivo = manager.dameNombreTipoActivo(info.getIdtipoActivo()); informesActivo.setTipoActivo( tipoActivo ); informesActivo.setCodigo( codigoActivo ); informesActivo.setDenominacion( fila.get( 1 ).toString() ); } // Add impactoTotal and ri…
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/26403283

http://stackoverflow.com/a/26366498
has body: You can install WebLogic Server adapter from Eclipse Marketplace. Look under Help menu in your Eclipse install. Then search for "WebLogic Server Tools". You will need to know which version of Eclipse STS is based on as there are separate toolsets for Kepler, Luna, etc.
has comment: http://stackoverflow.com/comment/41425836
has comment: http://stackoverflow.com/comment/44298152
score: 2
has comment: http://stackoverflow.com/comment/41390975
upvote count: 2
has comment: http://stackoverflow.com/comment/41425809
has comment: http://stackoverflow.com/comment/41433113
answers question: http://stackoverflow.com/q/26363478
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41420669
has text: I changed all the `User` back to `Object` and it works fine. Not sure what you are doing wrong.
comment on: http://stackoverflow.com/a/26382678
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41489519
has text: do you have some code or screenshots you could add to your question?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26421526

http://stackoverflow.com/comment/41555821
has text: how to use @SqlResultSetMapping to resolve my question? As I know the SqlResultSetMapping just helps map entity properties and columns in case their names are different
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26457112

http://stackoverflow.com/comment/41549109
comment on: http://stackoverflow.com/q/26453948
score: 0
type: Comment
type: QuestionComment
has text: Yes, you can. Just read more about `javac` usage

http://stackoverflow.com/q/26467754
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/41584360
downvote count: 0
has comment: http://stackoverflow.com/comment/41573623
has comment: http://stackoverflow.com/comment/41574474
tagged with: unix
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has body: I have next problem : I need execute some deployment stuff on server using Gradle, but for this Gradle should have 'root' access on target deployment server. I have password for 'sudo', but I don't know how to insert it in server. Is there any way to get 'sudo' rights from Gradle task? Thanks in advance.
tagged with: war
score: 2
has title: Gradle get 'sudo' rights
tagged with: java
has comment: http://stackoverflow.com/comment/41573373
has comment: http://stackoverflow.com/comment/41574650

http://stackoverflow.com/comment/41416844
has text: So what you're looking for is a way to show the times that other people have retweeted tweets originally tweeted by the authenticated account, rather than other people's tweets which the authenticated account has retweeted? It seems pretty obvious that that isn't what "retweeted_by_me" would return.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26373473
score: 0

http://stackoverflow.com/q/26354209
has answer: http://stackoverflow.com/a/26354407
has comment: http://stackoverflow.com/comment/41368032
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26354367
favorite count: 0
has body: Once we create maven project, it creates folder structure like following: I'm planning to put my Selenium tests in src/test/java folder and resources like test data, properties etc in src/test/resources. Whatever I'm following here is correct? If I follow above scenario, there is no use of src/main/java and src/main/resources, would be fine if I remove them from folder? Or let me know how can I use that folder structure in better way for Selenium tests. There is one more folder src in the project. What is that for? How can I make use of that folder?
type: UnansweredQuestion
has title: Understanding of usage of Maven folder structure
tagged with: selenium
has comment: http://stackoverflow.com/comment/41367877
upvote count: 1
tagged with: maven

http://stackoverflow.com/comment/41646744
type: QuestionComment
comment on: http://stackoverflow.com/q/26507376
has text: Could it be that your string has linefeeds like \n or \r and the representation is showing them as spaces?
score: 0
type: Comment

http://stackoverflow.com/comment/41587211
type: Comment
has text: Yes you will! But the important principle here is *arithmetic promotion*. `char + char` will be *promoted* to an `int`, which isn't implicitly compatible with `String`. By changing the `'` to an `"`, you've forced the compiler to promote it to a `String`, which is compatible!
comment on: http://stackoverflow.com/a/26474657
score: 0
type: AnswerComment

http://stackoverflow.com/q/26445120
tagged with: google-voice-search
upvote count: 1
type: UnansweredQuestion
has body: In order to pass additional Data I use @Override onQueryTextSubmitString query) and intent.putExtra(), which works fine when the user enters the text in the searchwidget. But it seems the function is not called when the users uses voiceSearch. Is there any way to pass Data to the Searchable Activity using voiceSearch? Thanks in Advance for any suggestions.
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
tagged with: parameter-passing
has title: Pass additional Data to Searchable using voiceSearch Android
tagged with: java

http://stackoverflow.com/a/26475252
has comment: http://stackoverflow.com/comment/41698780
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/41698871
accepted answer of: http://stackoverflow.com/q/26406982
answers question: http://stackoverflow.com/q/26406982
has body: You can solve it adding context:property-placeholder to you xml. That way you will tell Spring to load your specific properties file. However another more in line with Spring Boot solution is just using application.properties as the name for your properties file, having it in one of the expected locations, and use the @EnableAutoconfiguration annotation. Spring Boot expects the application.properties in the following location in order of preference. A /config subdir of the current directory. The current directory A classpath /config package The classpath root I have tried this and it works. pom.xml 4.0.0 sample sample 0.0.1-SNAPSHOT Sample Spring Boot sample org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-maven-plugin Sample.java package sample; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; @Configuration @EnableAutoConfiguration @ComponentScan @ImportResource("classpath:beans.xml") public class Sample implements CommandLineRunner { @Value("${sample}") private String sample; @Autowired SampleService service; public static void main(String[] args) { SpringApplication.run(Sample.class, args); } public void run(String... args) { System.out.println(service.greetings()); } } SampleService.java package sample; public class SampleService { private String field; public String greetings() { return field; } public String getField() { return field; } public void setField(String field) { this.field = field; } } beans.xml <?xml version="1.0" encoding="UTF-…
has comment: http://stackoverflow.com/comment/41684734
upvote count: 11
type: AcceptedAnswer

http://stackoverflow.com/comment/41535118
type: Comment
type: QuestionComment
has text: you need to give more details about your problem. plz, post all the Word class code and error you are getting stuck.
comment on: http://stackoverflow.com/q/26446273
score: 0

http://stackoverflow.com/comment/41461719
type: Comment
comment on: http://stackoverflow.com/a/26406340
score: 0
type: AnswerComment
has text: Can you print out `${selectedValue}` somewhere on the page, just to check if it is returned?

http://stackoverflow.com/a/26355409
upvote count: 1
downvote count: 0
has body: try{ f(); } catch(InterruptedException e){ System.out.println("1"); throw new RuntimeException(); // this RuntimeException will not catch by //following catch block } catch(RuntimeException e){ You needs to change your code as follows to catch it. try{ f(); } catch(InterruptedException e){ System.out.println("1"); try { throw new RuntimeException();// this RuntimeException will catch // by the following catch }catch (RuntimeException e1){ System.out.println("hello"); } } catch(RuntimeException e){ System.out.println("2"); return; } catch(Exception e){ System.out.println("3"); } finally{ System.out.println("4"); } System.out.println("5"); Then your out put" 1 hello // caught the RunTimeException 4 // will give you 2,but also going to finally block then top element of stack is 4 5 // last print element out side try-catch-finally
type: Answer
answers question: http://stackoverflow.com/q/26355336
score: 1

list
type: Tag
tags question: http://stackoverflow.com/q/26404859
tags question: http://stackoverflow.com/q/26509324
tags question: http://stackoverflow.com/q/26450019
tags question: http://stackoverflow.com/q/26488922
tags question: http://stackoverflow.com/q/26367619
tags question: http://stackoverflow.com/q/26404285
tags question: http://stackoverflow.com/q/26478385
tags question: http://stackoverflow.com/q/26492508
tags question: http://stackoverflow.com/q/26362472
tags question: http://stackoverflow.com/q/26431913
tags question: http://stackoverflow.com/q/26461428
tags question: http://stackoverflow.com/q/26496016
tags question: http://stackoverflow.com/q/26378610
tags question: http://stackoverflow.com/q/26498426
tag name: list
tags question: http://stackoverflow.com/q/26375799
tags question: http://stackoverflow.com/q/26505953
tags question: http://stackoverflow.com/q/26429104
tags question: http://stackoverflow.com/q/26390366
tags question: http://stackoverflow.com/q/26451293
tags question: http://stackoverflow.com/q/26359779
tags question: http://stackoverflow.com/q/26440752
tags question: http://stackoverflow.com/q/26427525
tags question: http://stackoverflow.com/q/26448288
tags question: http://stackoverflow.com/q/26491819
tags question: http://stackoverflow.com/q/26479261
tags question: http://stackoverflow.com/q/26361985
tags question: http://stackoverflow.com/q/26450015
tags question: http://stackoverflow.com/q/26417963
tags question: http://stackoverflow.com/q/26454651
tags question: http://stackoverflow.com/q/26365140
tags question: http://stackoverflow.com/q/26399505

http://stackoverflow.com/comment/41628074
type: QuestionComment
has text: I've already done that. I've implemented counters that keep track of the weapons that the user has chosen.
comment on: http://stackoverflow.com/q/26497549
score: 0
type: Comment

http://stackoverflow.com/comment/41378000
type: QuestionComment
comment on: http://stackoverflow.com/q/26355918
has text: Yes. Almost same. I'm also getting the error. o.s.boot.SpringApplication : Application startup failed java.lang.NullPointerException: null
score: 0
type: Comment

http://stackoverflow.com/a/26374888
type: Answer
has comment: http://stackoverflow.com/comment/41407410
score: 2
has comment: http://stackoverflow.com/comment/41407628
has comment: http://stackoverflow.com/comment/41406716
answers question: http://stackoverflow.com/q/26374716
downvote count: 0
has body: I think you need use method enableComplexMapKeySerialization(). Here you can see next documentation: public GsonBuilder enableComplexMapKeySerialization() Enabling this feature will only change the serialized form if the map key is a complex type (i.e. non-primitive) in its serialized JSON form. The default implementation of map serialization uses toString() on the key... And example: Gson gson = new GsonBuilder() .register(Point.class, new MyPointTypeAdapter()) .enableComplexMapKeySerialization() .create(); Map&lt;Point, String&gt; original = new LinkedHashMap&lt;Point, String&gt;(); original.put(new Point(5, 6), "a"); original.put(new Point(8, 8), "b"); System.out.println(gson.toJson(original, type)); Output will be: { "(5,6)": "a", "(8,8)": "b" } So, you can try like this: Gson gson = new GsonBuilder() .registerTypeAdapter(User.class, new MyTypeAdapter&lt;Expertise&gt;()) .registerTypeAdapter(User.class, new MyTypeAdapter&lt;Review&gt;()) .enableComplexMapKeySerialization() .create();
has comment: http://stackoverflow.com/comment/41406116
upvote count: 2

http://stackoverflow.com/comment/41409833
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26377108
has text: What I mean is, something running on the server is not going to be in a position to inspect client-side activity. That's a pretty major con...

http://stackoverflow.com/q/26492898
tagged with: jboss
tagged with: jakarta-ee
upvote count: 5
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41653536
has title: How to print and refer to system properties with JBoss CLI Wildfly?
has comment: http://stackoverflow.com/comment/41627896
favorite count: 0
type: Question
tagged with: wildfly
score: 5
has comment: http://stackoverflow.com/comment/41650894
has body: Isn't it possible to echo system variables in JBoss ClI? jboss.server.config.dir jboss.home.dir From https://docs.jboss.org/author/display/WFLY8/Command+line+parameters the table under the heading "Standalone".
tagged with: jboss-cli
tagged with: java

http://stackoverflow.com/comment/41529213
type: Comment
has text: @dfasfsd It is an issue indeed! Does it still crash?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26442629

http://stackoverflow.com/a/26503994
answers question: http://stackoverflow.com/q/26503942
has body: select u.id, max(u.number) from User u group by u.id This is the HQL query you need. I don't see any point of translating this to criteria, but if you really want to do it, it shouldn't be hard. You'll need to use projections from the Projections class.
upvote count: 2
has comment: http://stackoverflow.com/comment/41639419
downvote count: 0
has comment: http://stackoverflow.com/comment/41641291
type: Answer
score: 2

http://stackoverflow.com/q/26371931
tagged with: loops
downvote count: 1
tagged with: file-read
has comment: http://stackoverflow.com/comment/41400735
tagged with: java
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41400678
favorite count: 0
has title: Java Best way to extract words or (search for characters) from a text file that contains senteces
has body: I am trying to get words out of a text file. The file contains sentences because it is essentially a book. However I am having trouble reading all the characters, and fall into an endless loop. This is what I have to read the txt file. try { File myFile = new File(tale); Scanner inputFile = new Scanner(myFile); } catch(FileNotFoundException FNFE) { } I've been looking online but I am having trouble finding the best way to extract words from the text file. The text file is a book, so there are comas and quotations that should be ignored. However I seem to only get stuck in endless loops. I tried while(inputFile.hasnext()) but an endless loop occurs. I'm assuming it isn't checking through every character. I think this would be a good topic to cover for many new programmers bot used to reading from files.
has answer: http://stackoverflow.com/a/26372054
type: UnansweredQuestion
tagged with: file
upvote count: 1

http://stackoverflow.com/comment/41549847
comment on: http://stackoverflow.com/q/26446328
type: QuestionComment
score: 0
has text: With ` provided ` [you expect the JDK or a container to provide the dependency at runtime](https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope). Is the library in your container and is it configured properly so that it does?
type: Comment

http://stackoverflow.com/comment/41427953
type: Comment
comment on: http://stackoverflow.com/q/26385618
has text: There maybe better solutions, but one possible approach is to use something like the Rhino scripting engine to envoke methods in a .js file from within a java class. Your executor could just be a wrapper for calling into JS via Rhino or some other scripting engine.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26395055
has answer: http://stackoverflow.com/a/26395090
linked to: http://stackoverflow.com/q/1568091
tagged with: oop
has answer: http://stackoverflow.com/a/26395094
has body: In my CS class I am just learning about classes and OOP. So when you create a class you initialize a certain number of private variable. I know you make them private because if they were public they would be easily changeable and could lead to a lot of bugs. So we use get and set methods to change the variable. But that once again makes the variables very easy to change right? So whats the point of making them private in the first place?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26395103
has comment: http://stackoverflow.com/comment/41442123
has comment: http://stackoverflow.com/comment/41442133
downvote count: 1
linked to: http://stackoverflow.com/q/6638964
tagged with: encapsulation
type: UnansweredQuestion
tagged with: class
duplicate of: http://stackoverflow.com/q/6638964
answer count: 8
favorite count: 0
has answer: http://stackoverflow.com/a/26395123
has answer: http://stackoverflow.com/a/26395122
has answer: http://stackoverflow.com/a/26395164
has answer: http://stackoverflow.com/a/26395151
type: Question
has title: What's the point of get and set methods
has answer: http://stackoverflow.com/a/26395140
has comment: http://stackoverflow.com/comment/41442168
upvote count: 1

http://stackoverflow.com/q/26358590
tagged with: java
has comment: http://stackoverflow.com/comment/41375504
answer count: 6
has comment: http://stackoverflow.com/comment/41375627
score: 0
has body: I am just starting with Java Generics and the following code does not make any sense to me. List&lt;? extends Number&gt; lint = new ArrayList&lt;Integer&gt;(); // following throws error List&lt;Number&gt; lint2 = lint; [Extra Details] I know that List&lt;Interger&gt; != List&lt;Number&gt; but what's the use of '?' operator then? I created an arraylist of integers which I passed to some List which can accept lists containing doubles,floats or integers. Why can't I assign this to List. Can all of this be attributed to Strict type safety? I am using this as a reference: http://docs.oracle.com/javase/tutorial/java/generics/upperBounded.html
has answer: http://stackoverflow.com/a/26358751
tagged with: generics
has answer: http://stackoverflow.com/a/26360464
has title: What's wrong with the following assignment in Java Generics
has answer: http://stackoverflow.com/a/26358747
has answer: http://stackoverflow.com/a/26358922
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26358929
possible better answer: http://stackoverflow.com/a/26358747
accepted answer: http://stackoverflow.com/a/26360464
type: Question
has answer: http://stackoverflow.com/a/26358767

http://stackoverflow.com/q/26363787
has answer: http://stackoverflow.com/a/26365615
type: Question
answer count: 2
has body: i am Trying to Redirect a Url from a jsp using for Action. Code: &lt;jsp:useBean id="viewBean" type="com.app" scope="request" /&gt; &lt;form id="RedirectForm" name="RedirectForm" action="&lt;%=viewBean.getFormActionURI()%&gt;" method="post"&gt; However I am Getting Target Url as "Existing Url+ /viewBean.getFormActionURI()". How to remove `"Existing Url" part from the new url?
tagged with: jsp
has answer: http://stackoverflow.com/a/26365984
has title: How to Redirect to a Url from Jsp
score: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/41498365
comment on: http://stackoverflow.com/a/26425828
score: 0
type: AnswerComment
type: Comment
has text: @JavaNoob You are welcome. Please mark the answer that helped you the most as `Accepted`.

http://stackoverflow.com/comment/58159460
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26461176
type: Comment
has text: I extracted the Log4j zip from Apache and both were in the folder... of course that was bound to go wrong. ;) Thanks for saving me a ton of time and frustration.

http://stackoverflow.com/comment/41427901
type: QuestionComment
comment on: http://stackoverflow.com/q/26387004
has text: Can you point or quote to where it says they should be async?
score: 0
type: Comment

enums
tags question: http://stackoverflow.com/q/26357132
tags question: http://stackoverflow.com/q/26357851
tags question: http://stackoverflow.com/q/26400480
tags question: http://stackoverflow.com/q/26513492
tags question: http://stackoverflow.com/q/26456873
tags question: http://stackoverflow.com/q/26508133
tags question: http://stackoverflow.com/q/26355786
tags question: http://stackoverflow.com/q/26394240
tags question: http://stackoverflow.com/q/26391772
tags question: http://stackoverflow.com/q/26457227
tags question: http://stackoverflow.com/q/26418002
tag name: enums
tags question: http://stackoverflow.com/q/26456674
tags question: http://stackoverflow.com/q/26456034
tags question: http://stackoverflow.com/q/26488770
tags question: http://stackoverflow.com/q/26455226
tags question: http://stackoverflow.com/q/26458766
type: Tag
tags question: http://stackoverflow.com/q/26394075
tags question: http://stackoverflow.com/q/26433334
tags question: http://stackoverflow.com/q/26403823
tags question: http://stackoverflow.com/q/26400868
tags question: http://stackoverflow.com/q/26405930
tags question: http://stackoverflow.com/q/26396367
tags question: http://stackoverflow.com/q/26443921
tags question: http://stackoverflow.com/q/26488632
tags question: http://stackoverflow.com/q/26445729

http://stackoverflow.com/q/26475154
downvote count: 3
tagged with: exception
upvote count: 0
has body: 11 at FieldProva.merrTekstin(FieldProva.java:47) at FieldProva$2.actionPerformed(FieldProva.java:91) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilt…
type: UnansweredQuestion
tagged with: multithreading
score: -3
has comment: http://stackoverflow.com/comment/41587849
has title: Exception in thread "AWT-EventQueue-0" won't compile
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26475240
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41587715

http://stackoverflow.com/comment/41457274
has text: "the program won't work" is a bit vague, what exactly does happen?
comment on: http://stackoverflow.com/q/26403872
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26453191
accepted answer: http://stackoverflow.com/a/26525078
type: AnsweredQuestion
type: Question
tagged with: maven
tagged with: domain-driven-design
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26525078
tagged with: java
has title: Apache Isis SimpleApp archetype - clean run classpath error
tagged with: isis
has body: I am trying to run Apache Isis application generated from archetype using this mvn command: mvn archetype:generate \ -D archetypeGroupId=org.apache.isis.archetype \ -D archetypeArtifactId=simpleapp-archetype \ -D archetypeVersion=1.6.0 \ -D groupId=com.mycompany \ -D artifactId=myapp \ -D version=1.0-SNAPSHOT \ -B I have started the Jetty application server according to this screencast in my IntelliJ Idea but I keep getting error when I try to list all "SimpleObjects". Caused by: org.apache.isis.core.metamodel.exceptions.MetaModelException: java.lang.NoClassDefFoundError: org/datanucleus/store/rdbms/query/QueryToSQLMapper$SQLTableMapping at org.apache.isis.core.commons.lang.ThrowableExtensions.throwWithinIsisException(ThrowableExtensions.java:60) at org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.internalInvoke(ActionInvocationFacetForInteractionAbstract.java:376) at org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacetForInteractionAbstract.invoke(ActionInvocationFacetForInteractionAbstract.java:188) at org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:57) at org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction$1.execute(ActionInvocationFacetWrapTransaction.java:54) at org.apache.isis.core.runtime.system.transaction.IsisTransactionManager.executeWithinTransaction(IsisTransactionManager.java:201) at org.apache.isis.core.runtime.transaction.facets.ActionInvocationFacetWrapTransaction.invoke(ActionInvocationFacetWrapTransaction.java:54) at org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionImpl.execute(ObjectActionImpl.java:342) at org.apache.isis.viewer.wicket.model.models.ActionModel.executeAction(ActionModel.java:458) at org.apache.isis.viewer.wicket.model.models.ActionModel.load(ActionModel.java:445) at org.apache.isis.viewer.wicket.model.models.ActionModel…
tagged with: intellij-idea

http://stackoverflow.com/comment/41459466
has text: OP, how about some courtesy formatting? You make us scroll in both dimensions while trying to make sense of it.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26405229

http://stackoverflow.com/q/26483173
tagged with: maven
has comment: http://stackoverflow.com/comment/41606980
answer count: 1
has body: I am developing Spring mvc application. I am using eclipse. I was using Tomcat 7 and below pom entry for servlet javax.servlet javax.servlet-api 3.0.1 provided And facet version 3.0 <installed facet="jst.web" version="3.0"/> Due some reason, I have to use Tomcat 6. After some search, I found that Tomcat 6 uses javax-servlet 2.5 version. So, I changed my pom entry to javax.servlet servlet-api 2.5 provided And facet version to 2.5 <installed facet="jst.web" version="2.5"/> I resolved some compilation errors and found that @WebFilter is not supported by this. So, I removed @WebFilter and made entry of my filter in web.xml. My project got deployed on Tomcat 6. Out of curiosity to use @WebFilter with Tomcat 6, I changed my pom entry to use 3.0.1 javax.servlet with scope as provided and then tried to use @WebFilter and it worked. Can any one please help me to understand how it is happening. As scope of javax.servlet is provided and I am using Tomcat 6. From where it is getting this version of javax.servlet? Thanks
has comment: http://stackoverflow.com/comment/41616548
tagged with: java
type: UnansweredQuestion
tagged with: eclipse
has title: In eclipse, Tomcat 6 using javax.servlet-api 3.0.1 with 'provided' scope
tagged with: tomcat
type: Question
has comment: http://stackoverflow.com/comment/41633257
has comment: http://stackoverflow.com/comment/41603012
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26484381
score: 0

http://stackoverflow.com/a/26443954
has comment: http://stackoverflow.com/comment/41532488
accepted answer of: http://stackoverflow.com/q/26443921
has comment: http://stackoverflow.com/comment/41531115
has body: [...] I just need help with adding an additional enum Toppings The same way as you defined your other enums: public enum Topping { PINEAPPLE, BANANA } [...] and add a set named setOfToppings Then add a field: private Set&lt;Topping&gt; setOfToppings = EnumSet.noneOf(Topping.class); You can create access methods such as public void addTopping(Topping topping) { setOfToppings.add(topping); } public Set&lt;Topping&gt; getToppings() { return setOfToppings; } public void addManyToppings(Topping... toppings) { setOfToppings.addAll(Arrays.asList(toppings)); }
answers question: http://stackoverflow.com/q/26443921
upvote count: 1
has comment: http://stackoverflow.com/comment/41531049
has comment: http://stackoverflow.com/comment/41531255
has comment: http://stackoverflow.com/comment/41534019
has comment: http://stackoverflow.com/comment/41531285
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41531067
has comment: http://stackoverflow.com/comment/41534025
has comment: http://stackoverflow.com/comment/41531576
has comment: http://stackoverflow.com/comment/41531038
has comment: http://stackoverflow.com/comment/41531807
has comment: http://stackoverflow.com/comment/41530991
has comment: http://stackoverflow.com/comment/41531358
type: Answer
has comment: http://stackoverflow.com/comment/41531111
has comment: http://stackoverflow.com/comment/41531229

http://stackoverflow.com/a/26441788
type: Answer
has body: You misunderstood something here. In Collections.reverse(Arrays.asList(myArray)); you use Arrays.asList(myArray) that is returning a new List. Afterwards you reverse it, but you don't assign it to a variable and you just lose it. That's not how you need to do it. You need to think of another way of doing it. I'll give you a hint: use the hint in the question! and if you say you just need to reverse it, why do you need to sort it?!
has comment: http://stackoverflow.com/comment/41527638
has comment: http://stackoverflow.com/comment/41526980
answers question: http://stackoverflow.com/q/26441604
score: 4
has comment: http://stackoverflow.com/comment/41527357
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/41603573
score: 0
comment on: http://stackoverflow.com/q/26484232
type: QuestionComment
type: Comment
has text: @user3907211,not able understood your requirement can you please elaborate more?

http://stackoverflow.com/a/26506835
answers question: http://stackoverflow.com/q/26506559
type: Answer
has comment: http://stackoverflow.com/comment/41645281
has comment: http://stackoverflow.com/comment/41644861
has body: I would use the Calendar class for this. So basically: - set the time to a calendar and also set the date to today - compare that with a current timestamp - if it is before the current time then set it to a future date (next hour, next day, ...) - if it is after the current time you can use it as is So roughly: Calendar now = Calendar.getInstance(); now.setTime(new Date()); Calendar cal = Calendar.getInstance(); cal.setTime(timeOfFirstCollectionInMillis); cal.set(Calendar.YEAR, now.get(Calendar.YEAR)); Do the same for month and day...and then: if (cal.before(now)) { // increase } else { timeOfFirstCollectionInMillis = cal.getTime(); }
upvote count: 1
has comment: http://stackoverflow.com/comment/41646242
downvote count: 0
has comment: http://stackoverflow.com/comment/41644823
accepted answer of: http://stackoverflow.com/q/26506559
type: AcceptedAnswer
score: 1

http://stackoverflow.com/comment/41490443
score: 0
type: Comment
type: QuestionComment
has text: Are you sure the correct background color is set?
comment on: http://stackoverflow.com/q/26422424

http://stackoverflow.com/comment/41525431
has text: You need to give the code for moonbuggy
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26441071

http://stackoverflow.com/q/26384741
downvote count: 1
type: Question
tagged with: android-wallpaper
has comment: http://stackoverflow.com/comment/41423732
has title: Is there a way to put a running android app as the android device wallpaper?
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41423891
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26386347
tagged with: android
has comment: http://stackoverflow.com/comment/41423623
has body: In detail, I want to know if it's possible to take the output from a running Android app and pipe it to the to the background of the display. In other words, have the background wallpaper update itself dynamically.
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26461426
has title: Using draggables to trigger an if statement that .shows() a perviously hidden class
has body: so I'm creating a game with jQuery where the user has to place four pictures (draggables) in the correct order to move on to the next level. The part is checking if the pictures are in the right order and if the check is true showing (.show()) a none displayed button (display: none;) with a link to the next game. I think the code will be a little easier to understand. HTML Way to Go! You beat the game! To play the next game click below Next Game CSS .completion { display: none; position: absolute; } javascript/jquery if ($("#game1drop1").hasClass("correct") && $("#game1drop2").hasClass("correct") && $("#game1drop3").hasClass("correct") && $("#game1drop4").hasClass("correct") ) { $(".completion").show; }; note all the droppables (#game1drop1) have the correct class I've checked using the console.The code will run a console.log statement as well. So I'm pretty sure the mistake is with my use of the .show() statement
has answer: http://stackoverflow.com/a/26461533
accepted answer: http://stackoverflow.com/a/26461533
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jquery-ui
tagged with: javascript
tagged with: jquery
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1

http://stackoverflow.com/comment/41429293
type: QuestionComment
comment on: http://stackoverflow.com/q/26387666
has text: @PedroOliveira *FACEPALM* Thank you so much! i've been searching for this problem for over an hour now.
score: 0
type: Comment

http://stackoverflow.com/comment/41569838
has text: if Nan is String then it should show error..
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26465913
type: Comment

http://stackoverflow.com/comment/41594377
comment on: http://stackoverflow.com/q/26478882
type: QuestionComment
type: Comment
has text: Yeah I understand what i coded so far, I know a little about while loops but i didnt know you could use one for this program. Sorry I have a horrible CS teacher
score: 0

http://stackoverflow.com/comment/41385116
type: AnswerComment
comment on: http://stackoverflow.com/a/26359617
score: 0
type: Comment
has text: Worked the same for me with a quick test. But are you sure java is enabled inside ie? Because in my case it wasn't.

http://stackoverflow.com/comment/41554988
type: AnswerComment
type: Comment
has text: @spyr03 It's good, but not as good as the optimization in Wikipedia. With it using a 2**16 table I could compute the result till `1e10` in 211 seconds. Some more improvements are still possible.
comment on: http://stackoverflow.com/a/26455396
score: 0

http://stackoverflow.com/q/26420614
tagged with: java
has comment: http://stackoverflow.com/comment/41487376
type: Question
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26420633
tagged with: arrays
has answer: http://stackoverflow.com/a/26420640
has title: Creating Array Objects in Java?
favorite count: 0
has comment: http://stackoverflow.com/comment/41487309
has answer: http://stackoverflow.com/a/26420644
has body: I'm quite new to Java and had a little problem concerning arrays. In an exercise given one had to create a class named "Exam" with a method "addExam". Now I tried to solve the problem but only got to the definition of the cass, the instance variables and the method heading. The rest I looked up in the solution and it looked like: public class Exam{ private int numberOfExams=15; private Exam[]exams = new Exam[numberOfExams]; public void addExam(Exam exam){ exams[numberOfExams] = exam; numberOfExams++; So now to my question: When I assign "exam" to the array exams in the method addExam, is a new object created here? And when yes, why aren't bracktes and the "new operator" used? This question leads to a more general one: I know that arrays are of a class type, do they now create array objects or variables of that array type? I really need some help!
has comment: http://stackoverflow.com/comment/41487548
has comment: http://stackoverflow.com/comment/41487485
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/26406268
answer count: 3
has title: Variable not initialized when checking for input error
has answer: http://stackoverflow.com/a/26406318
score: 0
has answer: http://stackoverflow.com/a/26406429
tagged with: initialization
has comment: http://stackoverflow.com/comment/41461149
accepted answer: http://stackoverflow.com/a/26406318
type: Question
linked to: http://stackoverflow.com/q/1560685
type: AnsweredQuestion
has body: New to the site and plan to use it a lot since I am in school for computer science. Im trying to do an error check in java on making sure a hex is enter however im being told that the string input isnt intialized. Scanner keyboard = new Scanner(System.in); String input; Pattern legalInput = Pattern.compile("a-fA-F0-9"); Matcher match = legalInput.matcher(input); boolean answer = match.find(); int counterA = 0; while (counterA &lt; 1) { System.out.print("Please enter a hex number:"); input = keyboard.nextLine(); int counter = 0; while (counter &lt; 1) { if (answer == true ) counter++; else System.out.println("Error"); } counterA++; } Since this is my first programming language im learning in so lost any and all help is apperciated!
tagged with: java
possible better answer: http://stackoverflow.com/a/26406344
has answer: http://stackoverflow.com/a/26406344

http://stackoverflow.com/q/26434826
downvote count: 0
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/26434844
has answer: http://stackoverflow.com/a/26434844
has answer: http://stackoverflow.com/a/26434840
score: 2
has body: Code: import java.util.Scanner; public class testqu { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.println("Enter the length of the first side of the triangle"); double a = console.nextInt(); System.out.println("Enter the length of the second side of the triangle"); double b = console.nextInt(); System.out.println("Enter the length of the third side of the triangle"); double c = console.nextInt(); if ((a*a) + (b*b) = (c*c)) System.out.println("The triangle is a right triangle!"); } } Assignment: In a right triangle, the square of the length of the longest side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle, and then outputs a message indicating whether the triangle is a right triangle or not. The program is to work correctly regardless to the order in which the lengths of the 3 sides are input. My problems: code doesn't compile, found: variable, required: value Also: I have no idea how to make it so the program would know if the triangle was right even if the sides were not given in order. Please help, I am a beginner having a lot of trouble with this assignment.
type: AnsweredQuestion
tagged with: java
has title: Mathematics trouble in if statement
type: Question
answer count: 2
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/26434840
tagged with: compilation

http://stackoverflow.com/q/26385750
type: UnansweredQuestion
tagged with: swing
tagged with: java-8
score: 2
has body: I'm wondering if someone know why sun.swing.AccessibleMethod is gone from JDK 8 and if there is some alternative to this class in JDK 8? I can't find any information about that anywhere. I use this class in my own implementation DropHandler. Code snippet where I use sun.swing.AccessibleMethod looks like this: private DropLocation getDropLocation(DropTargetEvent e) { DropLocation dropLocation = null; if (this.component != null) { try { Point p = e instanceof DropTargetDragEvent ? ((DropTargetDragEvent)e).getLocation() : ((DropTargetDropEvent) e).getLocation(); AccessibleMethod method = new AccessibleMethod(JComponent.class, "dropLocationForPoint", Point.class); dropLocation = (DropLocation) method.invokeNoChecked(this.component, p); } catch (NoSuchMethodException ex) { LOGGER.info(ex.getMessage()); } } return dropLocation; }
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41426171
linked to: http://stackoverflow.com/q/1834826
has comment: http://stackoverflow.com/comment/41426254
type: Question
has comment: http://stackoverflow.com/comment/41425530
upvote count: 2
has title: Why sun.swing.AccessibleMethod is gone from JDK 8?
answer count: 2
has answer: http://stackoverflow.com/a/26388165
has answer: http://stackoverflow.com/a/26386321
favorite count: 0
tagged with: netbeans-platform

http://stackoverflow.com/q/26435429
has title: How to get around recursive stack overflow?
has comment: http://stackoverflow.com/comment/41515565
has comment: http://stackoverflow.com/comment/41515636
has comment: http://stackoverflow.com/comment/41515554
has body: EDIT: Just to clarify, the recursion is required as part of an assignment, so it must be recursive even though I know that's not the best way to do this problem I made a program that, in part, will search through an extremely large dictionary and compare a given list of words with each word in the dictionary and return a list of words that begin with the same two letters of the user-given word. This works for small dictionaries but I just discovered that for dictionaries over a certain amount there is a stack limit for the recursions, so I get a stack overflow error. My idea is to limit each recursion to 1000 recursions, then increment a counter for another 1000 and start again where the recursive method last left off and then end again at 2000, then so on until the end of the dictionary. Is this the best way to do it? And if so, does anyone have any ideas how? I'm having a really hard time implementing this idea! (edit: If it's not the best way, does anyone have any ideas of how to do it more effectively?) Here is the code I have so far, the 1000 recursions idea is barely implemented here because I've deleted some of the code I tried in the past already but honestly it was about as helpful as what I have here. the call: for(int i = 0; i &lt; givenWords.size(); i++){ int thousand = 1000; Dictionary.prefix(givenWords.get(i), theDictionary, 0, thousand); thousand = thousand + 1000; } and the prefix method: public static void prefix (String origWord, List&lt;String&gt; theDictionary, int wordCounter, int thousand){ if(wordCounter &lt; thousand){ // if the words don't match recurse through this same method in order to move on to the next word if (wordCounter &lt; theDictionary.size()){ if ( origWord.charAt(0) != theDictionary.get(wordCounter).charAt(0) || origWord.length() != theDictionary.get(wordCounter).length()){ prefix(origWord, theDictionary, wordCounter+1, thousand+1); } // if the words first letter and size match, send the word to prefixLetterChecker to check fo…
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41515589
has comment: http://stackoverflow.com/comment/41515595
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/26435514
favorite count: 0
has comment: http://stackoverflow.com/comment/41515597
has comment: http://stackoverflow.com/comment/41515692
score: -1
tagged with: recursion
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26435514
downvote count: 1
has comment: http://stackoverflow.com/comment/41515666
linked to: http://stackoverflow.com/q/3391285
type: Question

http://stackoverflow.com/q/26511303
has title: JNA UnsatisfiedLinkError exception
tagged with: jna
type: Question
possible better answer: http://stackoverflow.com/a/26511707
has answer: http://stackoverflow.com/a/26511707
has answer: http://stackoverflow.com/a/26618998
score: 0
has body: I am trying to deploy my application that invokes native calls using JNA library, but I get the following exception. Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'myCustomDLL': Native library (win32-x86-64/myCustomDLL.dll) not found in resource path ([myproject/target/classes/, ...some jars...]) What do I need to do in order to invoke the function correctly? Any help much appreciated
has answer: http://stackoverflow.com/a/26528685
answer count: 3
tagged with: java-native-interface
tagged with: java
has comment: http://stackoverflow.com/comment/41714777
accepted answer: http://stackoverflow.com/a/26618998
type: AnsweredQuestion

http://stackoverflow.com/q/26454185
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26454354
accepted answer: http://stackoverflow.com/a/26454354
score: 0
answer count: 1
has title: Extract an image from an object JSON in JAVA
has body: i'm trying to send an image that i took from a database and i would like to send that image, using a WebApi written in PHP with JSON to a Java program; the following lines are an extract from PHP program: $img = file_get_contents($stringPath); $array = ["immagine" =&gt; base64_encode($img)]; echo json_encode($array); in the following JAVA program i use restlet framework: ClientResource resource = new ClientResource("link to the webApi");`` String retur = resource.get().getText(); JSONObject obj = new JSONObject(retur); How can i extract from the JSON object the image that i sent from the PHP progra
tagged with: php
type: AnsweredQuestion

http://stackoverflow.com/q/26445099
has title: Integer comparison, 10 and 128
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26445129
tagged with: integer
linked to: http://stackoverflow.com/q/20897020
has comment: http://stackoverflow.com/comment/41532828
has body: I found an interesting fact, but I don't know how it happened. Integer x = 10; Integer y = 10; System.out.print(x==y); // true Integer x = 128; Integer y = 128; System.out.print(x==y); // false
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/20897020
tagged with: java
linked to: http://stackoverflow.com/q/15052216
linked to: http://stackoverflow.com/q/2772763
has answer: http://stackoverflow.com/a/26445129
type: Question

http://stackoverflow.com/comment/41459529
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26405333
has text: use equals rather than ==

http://stackoverflow.com/a/26383042
type: Answer
has body: Change the method as below to avoid complications: public static boolean scan_bulkList(bulkBean[] bulkList, int i) { int[] arr = new int[bulkList.length]; for(int x=0;x&lt;bulkList.length;x++){ arr[x] = bulkList[x].getInstallmentNo(); if (bulkList[x].getInstallmentNo()==i) { return true; } } return false; }
answers question: http://stackoverflow.com/q/26382217
score: 0

http://stackoverflow.com/comment/41611425
score: 0
comment on: http://stackoverflow.com/q/26488707
type: Comment
type: QuestionComment
has text: I'm not really convinced this is a java question per-se, but more a Microsoft / Windows / JVM question. I think you should at least mention the brand and version of JVM you are using. Adding tags.

http://stackoverflow.com/q/26393803
has comment: http://stackoverflow.com/comment/41440145
has body: I'm new to java. I'm required to read The input data(csv)(large number of records) I receive in the given below format: A,1 A,2 B,3 B,4 C,5 C,6 A,7 A,8 B,9 B,10 ... I'm using PrintWriter to write the data into the new CSV file. Is there a.ny way I can write into the new csv file this way from the above data? Here the condition is based on values A, B,C. A,B,C 1,3,5 2,4,6 7,9 8,10...
has comment: http://stackoverflow.com/comment/41440130
has comment: http://stackoverflow.com/comment/41440159
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41440289
favorite count: 0
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/41440193
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26394021
accepted answer: http://stackoverflow.com/a/26394021
has title: Read CSV file and write back CSV File based on condition
has comment: http://stackoverflow.com/comment/41440546
score: -1
has comment: http://stackoverflow.com/comment/41440432

http://stackoverflow.com/comment/41640582
comment on: http://stackoverflow.com/a/26471293
score: 0
type: AnswerComment
has text: I think you've misunderstood my question here :) Specifying greater than X but less than Y as above works fine for the package being built, but the issue is managing a dependency of a build dependency (in this case the ant package), which has java-devel > 1.5.0, and so as a dependent of that it will pull in the latest package that provides java-devel. From doing more research into the subject I think that this functionality could be provided by a filter: http://rpm.org/wiki/PackagerDocs/DependencyGenerator Haven't yet managed to get it working yet though :(
type: Comment

jackson
tags question: http://stackoverflow.com/q/26437047
tags question: http://stackoverflow.com/q/26474514
tags question: http://stackoverflow.com/q/26381320
tags question: http://stackoverflow.com/q/26468946
tags question: http://stackoverflow.com/q/26375658
tags question: http://stackoverflow.com/q/26466444
tags question: http://stackoverflow.com/q/26366167
tags question: http://stackoverflow.com/q/26510169
type: Tag
tags question: http://stackoverflow.com/q/26497856
tags question: http://stackoverflow.com/q/26404538
tags question: http://stackoverflow.com/q/26510904
tags question: http://stackoverflow.com/q/26410238
tag name: jackson
tags question: http://stackoverflow.com/q/26491406
tags question: http://stackoverflow.com/q/26475887
tags question: http://stackoverflow.com/q/26503733
tags question: http://stackoverflow.com/q/26473423
tags question: http://stackoverflow.com/q/26468406
tags question: http://stackoverflow.com/q/26379518
tags question: http://stackoverflow.com/q/26383704
tags question: http://stackoverflow.com/q/26490300
tags question: http://stackoverflow.com/q/26449333

http://stackoverflow.com/q/26426085
has title: How avoids SonarQube major issues, while using LinkedList method?
has comment: http://stackoverflow.com/comment/41529636
tagged with: java
tagged with: sonarqube
type: Question
has comment: http://stackoverflow.com/comment/41501314
has body: I wonder how can I avoid SonarQube issue: Declarations should use Java collection interfaces such as "List" rather than specific implementation classes such as "LinkedList" when I want to use specific method of LinkedList in code like this: LinkedList&lt;String&gt; items = new LinkedList&lt;String&gt;(); //add someitems String elem = items.removeFirst(); The only solution which I found is to change for Queue, but then I need also use methods of interface: Queue&lt;String&gt; items = new LinkedList&lt;String&gt;(); //add someitems String elem = items.poll(); I can also cast object before using this method. Are there any other solutions?
has comment: http://stackoverflow.com/comment/41500606
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26441565
has comment: http://stackoverflow.com/comment/41529620
has comment: http://stackoverflow.com/comment/41497206
type: UnansweredQuestion

http://stackoverflow.com/comment/41514110
score: 0
type: Comment
type: QuestionComment
has text: Okay good idea I will use as the worst case solution as it kills any other java programs I have running... But it does prevent me playing minecraft when I am supposed to be working :P But hopefully a solution that only kills these specific servers comes. :)
comment on: http://stackoverflow.com/q/26434595

http://stackoverflow.com/comment/41631122
score: 0
type: AnswerComment
has text: But the purpose of the code above was to demonstrate readable and maintainable code. not how I would actually put your app into production.
type: Comment
comment on: http://stackoverflow.com/a/26480060

jersey
tags question: http://stackoverflow.com/q/26435517
tags question: http://stackoverflow.com/q/26367976
tags question: http://stackoverflow.com/q/26470114
tags question: http://stackoverflow.com/q/26427042
tags question: http://stackoverflow.com/q/26376172
tags question: http://stackoverflow.com/q/26360161
tags question: http://stackoverflow.com/q/26424878
tags question: http://stackoverflow.com/q/26394505
tags question: http://stackoverflow.com/q/26451873
tags question: http://stackoverflow.com/q/26458184
tags question: http://stackoverflow.com/q/26394350
tags question: http://stackoverflow.com/q/26410673
tags question: http://stackoverflow.com/q/26444790
tag name: jersey
tags question: http://stackoverflow.com/q/26361136
tags question: http://stackoverflow.com/q/26500926
tags question: http://stackoverflow.com/q/26468946
tags question: http://stackoverflow.com/q/26377710
tags question: http://stackoverflow.com/q/26475076
tags question: http://stackoverflow.com/q/26426056
tags question: http://stackoverflow.com/q/26386155
type: Tag

http://stackoverflow.com/a/26385134
downvote count: 0
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26385028
has body: The first URL does not correspond to a pdf file. When you actually go to the page you are simply given the choice to sign-in or purchase, in the form of a button. Now if, by chance, you have bought the pdf and therefore the page re-directs you to the online version of it; you are going to have to take a look at authenticating on the web-page through Java. Such a question has been Discussed before.
score: 4

http://stackoverflow.com/q/26401769
has comment: http://stackoverflow.com/comment/41453627
type: UnansweredQuestion
has body: I simply trying to change my fragment on post execute. There are case : case 4: try { String code = this.result.getString("code"); if (code.equals("200")) { final String stepString = "step"; setValue(stepString, "3"); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, new HomeFragment()).commit(); } else if (code.equals("400")) { Toast.makeText(getApplicationContext(), this.result.getString("text"), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } break; } And also i have class that named HomeFragment public class HomeFragment extends Fragment { public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.home_fragment, container, false); myImage = (ImageView) RootView.findViewById(R.id.home_logo); WifiManager wifiManager = (WifiManager) getSystemService (Context.WIFI_SERVICE); String wifiName = wifiManager.getConnectionInfo ().getSSID (); wifiName = wifiName.replace("\"" ,""); return rootView; } } And i have NUll Pointer error. But why? I have class HomeFragment.. There are Log.cat 10-16 12:09:10.744 4700-4700/com.example.android.navigationdrawerexample E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.example.android.navigationdrawerexample.MainActivity$PlanetFragment$JSONAsyncTask.onPostExecute(MainActivity.java:545) at com.example.android.navigationdrawerexample.MainActivity$PlanetFragment$JSONAsyncTask.onPostExecute(MainActivity.java:404) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5319) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflec…
has title: Android issue with change fragment into onPostExecute
answer count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/41453764
has comment: http://stackoverflow.com/comment/41453444
has comment: http://stackoverflow.com/comment/41453689
score: 0
has comment: http://stackoverflow.com/comment/41453277
has comment: http://stackoverflow.com/comment/41453536
has comment: http://stackoverflow.com/comment/41453572
has comment: http://stackoverflow.com/comment/41453457
tagged with: java

http://stackoverflow.com/a/26493777
score: 1
has body: How could this (simulating User pressing Enter key) be accomplished? Combobox has an "enterPressed" Action. So you should be able to access the Action from the ActionMap of the combobox and then manually invoke the actionPerformed(...) method of the Action. Check out Key Bindings for a program to list all the bindings for all Swing components.
answers question: http://stackoverflow.com/q/26493650
upvote count: 1
has comment: http://stackoverflow.com/comment/41623577
type: Answer
downvote count: 0

http://stackoverflow.com/q/26461736
type: UnansweredQuestion
has title: LDAP over SSL in Java - Exception: simple bind failed
has comment: http://stackoverflow.com/comment/41899219
linked to: http://stackoverflow.com/q/24389689
answer count: 0
duplicate of: http://stackoverflow.com/q/24389689
type: Question
has comment: http://stackoverflow.com/comment/41562533
tagged with: java
tagged with: ssl
score: 0
has body: Disclaimer: This post is similar to these - 1, 2. HOWEVER, it is not the exactly the same. The stack trace is different. I followed the answers in those posts and they do not help solve my issue, or else I don't understand them completely. Since I cannot comment on these posts, I ask my question here. OK, so we want to enable LDAP over SSL (aka LDAPS) support for one of our products that is currently working with standard LDAP. I haven't been able to get it to work so if anyone can see what I'm doing wrong, please advise. I followed the procedure here to issue and install the SSL certificate. That procedure includes the installation of the certificate on the Java key store, as specified by 1. This the command I used to install the certificate: keytool -import -keystore .\jre\lib\security\cacerts -file path\to\client.crt Note that the key store specified is 'cacerts', perhaps this is wrong (?). The code I used to initialize the context: ... env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldaps://" + serverAddress); env.put(Context.SECURITY_PROTOCOL, "ssl"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, administratorName); env.put(Context.SECURITY_CREDENTIALS, password); env.put(Context.REFERRAL, "follow"); LdapContext ldapContext = null; try { ldapContext = new InitialLdapContext(env, null); ... Here I get an exception - "simple bind failed..", with the following stack trace: javax.naming.CommunicationException: simple bind failed: 172.23.30.104:636 [Root exception is javax.net.ssl.SSLException: java.net.SocketException: Connection reset] at com.sun.jndi.ldap.LdapClient.authenticate(Unknown Source) at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source) at com.sun.jndi.ldap.LdapCtx.&lt;init&gt;(Unknown Source) at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source) at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source) at com.sun.jndi.ldap.LdapCtxFact…
tagged with: ldap

http://stackoverflow.com/comment/41512926
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26434081
type: AnswerComment
has text: Thanks, it worked! I had forgotten to make the new node, instead changed the head.

http://stackoverflow.com/comment/41643945
has text: thank you much for your response. I still seem to have the same issue. I have updated my code and provide an update under my initial post. Unfortunatetly setFocusable seems to have no effect
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26501942

http://stackoverflow.com/q/26458524
type: Question
tagged with: arrays
downvote count: 0
answer count: 1
has body: I know how to count the number of element in the array without for each loop, but I have to use for each loop for this. This is what I've got so far. I couldn't figure out how I can use for each loop to count the number of elements in the array. Outcome should be 6. I would appreciate any help. Thank you so much. public class Count{ public Count(){ int a[] = {7, 8, 9, 9, 8, 7}; System.out.println(count(a)); } public int count(int count[]){ for (int c : count) return c; } }
has comment: http://stackoverflow.com/comment/41556925
favorite count: 0
has answer: http://stackoverflow.com/a/26458534
has title: Use count method and for each loop to count the number of element in the array
type: UnansweredQuestion
tagged with: count
upvote count: 1
tagged with: foreach
has comment: http://stackoverflow.com/comment/41556928
score: 1
tagged with: java
tagged with: methods

http://stackoverflow.com/a/26480501
has comment: http://stackoverflow.com/comment/41597893
downvote count: 1
has comment: http://stackoverflow.com/comment/41597176
score: 0
has comment: http://stackoverflow.com/comment/41600387
has comment: http://stackoverflow.com/comment/41598896
has body: You can call a servlet on the button click. And in the servlet the you can use PDF Renderer. It converts HTML to PDF directly. although it has certain Restrictions like all tags should be closed like doing this wont work . You would have to do . But the output is amazing and fast and since it HTML you can change it easily. It internally uses iText. If you use iText directly then it would be a tedious process. And your question should be HTML to PDF not JSP to PDf cause the JSP will get execute to produce some HTML in the end anyways You entire HTML should be in the StringBuffer or String format. Download from here Update Code: // First create a temporry file File file = File.createTempFile("temp","pdf"); String html= "<HMTL> Hello "; // HTML content /* in your case it would be File f = new File("URL OF PAGE"); * */ // Write the contents intot he file. PrintWriter printWriter = new PrintWriter(file); printWriter.print(html); // Write String in Temp file printWriter.close(); String s ="YourFile.pdf"; // Name of Actual PDf file PDFRenderer.renderToPDF(file,s);// Second parameter is the actual PDF file // The PDF is now created in the default location of you web application // Now just read it and send it in the response. File finalPDf = new File(s); // Reference to the newly created PDF file PrintWriter out = response.getWriter(); response.setContentType("application/pdf"); IOUtils.copy(new InputStreamReader(new FileInputStream(s)), out); // The above method just reads from the PDF file and puts the data in the response object // IOUtils fully qualified name: org.apache.commons.io.IOUtils // PDF Renderer fully qualified name: org.xhtmlrenderer.simple.PDFRenderer
answers question: http://stackoverflow.com/q/26480153
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41534171
score: 0
has text: @StephenCI updated the question to include some code. That is my equals method, I try to compare two arraylists composed by those objects but the result is false when it shouldn't be.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26445705

http://stackoverflow.com/comment/41593807
type: Comment
type: QuestionComment
has text: I believe you would need to do a bit more then solve the [halting problem](http://en.wikipedia.org/wiki/Halting_problem). I wish you luck! You might be able to *cheat* can you manually tag the literals with something like `"text:"`
score: 1
comment on: http://stackoverflow.com/q/26478445

http://stackoverflow.com/comment/41481740
score: 0
type: QuestionComment
type: Comment
has text: I failed this question on an exam and i would just like to see the solution to make more sense of it
comment on: http://stackoverflow.com/q/26417331

http://stackoverflow.com/q/26405594
type: Question
has title: Dynamodb new item notification/trigger
answer count: 1
has comment: http://stackoverflow.com/comment/41460639
has answer: http://stackoverflow.com/a/42669594
score: 0
has comment: http://stackoverflow.com/comment/41460412
has body: Is there a function in Amazon Java SDK that notifies when a new item is added to a table? I believe it should be a synchronous function that hold program execution, until there is a new item. Latency should be low, like less than a second.
has comment: http://stackoverflow.com/comment/41460359
type: UnansweredQuestion
tagged with: amazon-dynamodb
has comment: http://stackoverflow.com/comment/41460444
has comment: http://stackoverflow.com/comment/41460270
has comment: http://stackoverflow.com/comment/41460545
tagged with: java
has comment: http://stackoverflow.com/comment/41460566

http://stackoverflow.com/q/26492055
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41617922
has title: I am borrowing a method that catches 10 kinds of exceptions but does nothing with them. Can I replace them with just (Exception e)
has comment: http://stackoverflow.com/comment/41617908
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: Im borrowing this method I found on the internet: private static int getExifOrientation(String src) throws IOException { int orientation = 1; try { /* * if you are targeting only api level &gt;= 5 ExifInterface exif = new ExifInterface(src); orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 1); */ if (Build.VERSION.SDK_INT &gt;= 5) { Class&lt;?&gt; exifClass = Class.forName("android.media.ExifInterface"); Constructor&lt;?&gt; exifConstructor = exifClass.getConstructor(new Class[] { String.class }); Object exifInstance = exifConstructor.newInstance(new Object[] { src }); Method getAttributeInt = exifClass.getMethod("getAttributeInt", new Class[] { String.class, int.class }); Field tagOrientationField = exifClass.getField("TAG_ORIENTATION"); String tagOrientation = (String) tagOrientationField.get(null); orientation = (Integer) getAttributeInt.invoke(exifInstance, new Object[] { tagOrientation, 1 }); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } return orientation; } // End of getExifOrientation Can I replace these multiple CATCH statements with just } catch (Exception e) { or is there a chance that if I dont mention each exception by its name, it might slip by the catch Exception e check ? To sum up: does "catch Exception e" catch all kinds of exceptions or should each one be named individually (all this in cases where we do not want to react differently in each case)
possible better answer: http://stackoverflow.com/a/26492106
type: Question
has comment: http://stackoverflow.com/comment/41617879
has answer: http://stackoverflow.com/a/26492106
has answer: http://stackoverflow.com/a/26492116
has answer: http://stackoverflow.com/a/26492122
has answer: http://stackoverflow.com/a/26492097
linked to: http://stackoverflow.com/q/1075895
accepted answer: http://stackoverflow.com/a/26492122

http://stackoverflow.com/q/26391334
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: http://stackoverflow.com/tag/jpeg
tagged with: java
has body: I'm trying to invert a JPEG image in Java, and I want to know if there's a way to modify the color palette instead of changing the image one pixel at a time. I want an efficient solution and the most efficient solution I can think of is inverting the color palette itself. Ideas, anyone?
downvote count: 1
has comment: http://stackoverflow.com/comment/41436062
has comment: http://stackoverflow.com/comment/41435804
type: Question
score: 0
has title: Java JPEG Palette Swap
has comment: http://stackoverflow.com/comment/41443424

http://stackoverflow.com/comment/41620563
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26492620
has text: @KickButtowski It's in [JLS 4.2.4](http://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.2.4). Basically, numbers that are too big or too small ("overflow") become positive or negative infinity, and numbers that are too close to 0 ("underflow") become positive or negative 0. But they never wrap around, like ints do.
score: 0

http://stackoverflow.com/comment/41383568
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26362896
has text: `cars[0].getYear()`?

http://stackoverflow.com/comment/41419578
score: 0
type: Comment
type: QuestionComment
has text: +1 I think that I'm see that somewhere, there is an issue with SecondaryLoop compiled in JDK8 without back compability to Java7, idea is correct but for Java7, somewhere I'm see that, now without, no idea where, as aside I have an issue with SecondaryLoop and (java.bean.)EventHandler, output from SecondaryLoop by default doesn't required invokeLater, but ....
comment on: http://stackoverflow.com/q/26380008

http://stackoverflow.com/comment/41434112
type: Comment
type: QuestionComment
has text: @rossstudtman I'm still not 100% convinced this code works correctly when used with bytes >127. Shouldn't `(int)((byte)255)` evaluate to -1 instead of 255?
score: 0
comment on: http://stackoverflow.com/q/26390105

http://stackoverflow.com/q/26356503
has title: Deleting an item in an array by moving the next into its place
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26356621
type: Question
tagged with: vector
has answer: http://stackoverflow.com/a/26356583
tagged with: arrays
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26356583
accepted answer: http://stackoverflow.com/a/26356621
answer count: 3
has comment: http://stackoverflow.com/comment/52436244
has comment: http://stackoverflow.com/comment/41372051
upvote count: 1
has answer: http://stackoverflow.com/a/26356710
has body: I'm having problems with this method. This method is in a file called vectorOfDogs and as it says, it's suppose to delete the specific dog by the tag number passed into it and push everything up one. after the push, it's suppose to decrease size. This method gives me an arrayIndexOutOfBoundsException on the commented line below. Any help will be appreciated. Dog[] theDogs = new theDogs[capacity] public void deleteDog(int tgNm) { for (int i=0; i&lt;size; i++) { if (theDogs[i].getTagNumber() == tgNm) { for (int j=i; j&lt;size; j++) { theDogs[j] = theDogs[i+1]; //this line gives an exception i--; } } } System.out.println("the dog has been deleted"); }
type: AnsweredQuestion

http://stackoverflow.com/q/26373135
has title: Rotated rect changes location
has body: I am trying to rotate a rect and i have to rotate the canvas to do so but the rect changes its location for example, if the rect is in the middle of the screen after the rotation it will go to the side and i cannot figure out how to get it back to the middle. Here is the code i used: canvas.save(); canvas.rotate(45); canvas.drawRect(width/2,height/2, width/2+200, height/2+200, paint); canvas.restore(); Is there a way to rotate the rect without rotating the canvas so its location will stay the same?
upvote count: 1
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/26373288
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26373290
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
tagged with: rotation
tagged with: canvas

http://stackoverflow.com/a/26373230
has body: Take a look at this : System.out.println("Math.round(5/3) " + Math.round(5 / 3)); System.out.println("Math.round(5.0/3.0) " + Math.round(5.0 / 3.0)); output : 1 2 EDIT : so yes you need to cast at least one
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26373171

http://stackoverflow.com/comment/41499097
has text: anyway your comment is the solution, i would upvote you if i could but i still dont have enough reputation points
comment on: http://stackoverflow.com/a/26424950
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26382642
answer count: 1
downvote count: 1
favorite count: 0
tagged with: binary-tree
has body: I am implementing a lexicographical binary tree and I need the output to be curent node data ; left child data ; right child data For example, if I have this input: banana apple curtain pumpkin egg Going through the binary tree I need the output to be: banana ; apple ; curtain apple ; -1 ; -1 curtain ; -1 ; pumpkin pumpkin ; egg ; -1 egg ; -1 ; -1 "-1" will be output if the left or right or both left and right child is null. Here is my attempt to do this: public void insert(String newData){ root = insert2(newData, root); } public BTNode insert2(String s, BTNode n){ if(n == null){ return new BTNode(s); } if(s.compareTo(n.data) &lt; 0){ n.left = insert2(s, n.left); if(n.right!=null) System.out.println(n.data+" "+n.left.data+" "+n.right.data); else System.out.println(n.data+" "+n.left.data +" "+ -1); }else if(s.compareTo(n.data) &gt; 0){ n.right = insert2(s, n.right); if(n.left!=null) System.out.println(n.data+" "+n.left.data+" "+n.right.data); else System.out.println(n.data+" "+ -1 +" "+n.right.data); } return n; } The output of my attempt is: banana apple -1 banana apple curtain curtain -1 pumpkin banana apple curtain pumpkin egg -1 curtain -1 pumpkin banana apple curtain Thank you.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26382769
type: Question
has comment: http://stackoverflow.com/comment/41419895
has answer: http://stackoverflow.com/a/26382769
score: 0
has title: Output node ,left and right child at once in Java
upvote count: 1

http://stackoverflow.com/q/26509672
has answer: http://stackoverflow.com/a/26509951
has body: I have 2 columns (product name and description) and try create search. For example: Table "products": id name description --------------------------------- 1 Inspiron 7720 Intel i7 2 Inspiron 7720 Intel i5 3 Inspiron 5720 Intel i7 4 Asus Zenbook Intel i5 and in search bar - "Inspiron 5720 i7". How can I get result: 1) id=3 Inspiron 5720 (full coincidence) 2) id=1 Inspiron 7720 (partial coincidence) 3) id=2 Inspiron 7720 (partial coincidence) I may use something like this: "SELECT * FROM product WHERE LOWER( product.product_name ) LIKE '%" + searchString + "%'" + " OR LOWER( product.product_description ) LIKE '%" + searchString + "%'" But I belive, that is most clear solution.
upvote count: 0
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41649701
tagged with: java
score: -1
answer count: 2
has title: Search full string or substrings in two columns
tagged with: sql
has comment: http://stackoverflow.com/comment/41649720
tagged with: ormlite
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/26510090
type: UnansweredQuestion

http://stackoverflow.com/q/26361672
accepted answer: http://stackoverflow.com/a/26362690
type: AnsweredQuestion
tagged with: java
type: Question
has body: i tried to figure out a problem since this morning and just 30 Minutes ago i got it work. My problem was the viewport beeing ignored on android KitKat. I changed my CordovaActivity.java to the new one directly from GitHub and after that my ViewPort worked the right way. If i set the values: initial-scale=2.5, maximum-scale=2.5, minimum-scale=2.5 i can zoom in or zoom out my app to make it fit the screen. So...next step: How do i realise, that the viewport automaticaly changes to fit the screen? If i set it the scales to 1 and set width=device-width, height=device-height nothing changes. I would like to have a solution, which makes the app fit on every screen/device till Android 4.1. So, Devices with lower target-lvl get ignored. This is what my Viewport looks like: &lt;meta name="viewport" content="user-scalable=no, initial-scale=2.5, maximum-scale=2.5, width=device-width, target-densitydpi=device-dpi" /&gt; and this is my CordovaActivity.java -> http://pastebin.com/fYPwsMJN I hope someone can help me and figure out, how to make it fit to every screen.
has title: How to set the correct viewport for every device - android phonegap
has answer: http://stackoverflow.com/a/26362690
tagged with: viewport
score: 2
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cordova
linked to: http://stackoverflow.com/q/2909080
upvote count: 2
tagged with: android
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/41536374
type: QuestionComment
has text: its probably because draw is never being called. There are all sorts of complicated inner workings of how things are drawn on the screen. Put a System.out.println() in the first line of the draw function...I bet you its not being called at all. EDIT: your Building isn't extending anything...so it will never be called unless you explicitly call it. You probably meant to extend something
score: 0
comment on: http://stackoverflow.com/q/26446865
type: Comment

http://stackoverflow.com/comment/41629938
type: Comment
has text: public class MyException extends Exception { public String getMessage() { return " the number is out of ring"; } }
comment on: http://stackoverflow.com/a/26498504
score: 0
type: AnswerComment

http://stackoverflow.com/q/26370270
linked to: http://stackoverflow.com/q/25208239
favorite count: 0
has comment: http://stackoverflow.com/comment/41575497
accepted answer: http://stackoverflow.com/a/26475178
has comment: http://stackoverflow.com/comment/41509567
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41505528
has comment: http://stackoverflow.com/comment/41573963
tagged with: stored-procedures
score: 1
tagged with: java
upvote count: 1
tagged with: jboss
has body: Referring to this SO thread - Java: Returning XMLType Data from StoredProcedure, Usage of ojdbc6.jar xdb6.jar xmlparserv2.jar for Java to PLSQL interaction [ojdbc6.jar, xdb6.jar, xmlparserv2-11.1.1.jar] The application works perfectly[able to retrieve the data without any exceptions] when it is deployed in my local tomcat server on my PC with JDK1.6 installed, but when deployed in JBOSS EAP 6.2 server running with JDK 1.7, it throws exception when trying to retrieve the XML through the OJDBC bridge. java.lang.NullPointerException 13:53:51,265 ERROR [stderr] (http-/0.0.0.0:8080-1) at oracle.jdbc.driver.NamedTypeAccessor.getOracleObject(NamedTypeAccessor.java:320) 13:53:51,268 ERROR [stderr] (http-/0.0.0.0:8080-1) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:217) 13:53:51,270 ERROR [stderr] (http-/0.0.0.0:8080-1) at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:123) 13:53:51,273 ERROR [stderr] (http-/0.0.0.0:8080-1) at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:2049) 13:53:51,275 ERROR [stderr] (http-/0.0.0.0:8080-1) at oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:818) I tried changing my local compiler settings and installed JRE from 1.6 to 1.7, still the local runs good. Please throw your inputs on this error I am getting on the JBOSS server in remote PC. Is JBOSS trying to override the ojdbc jar that I already put in the application war file? updates: Downgraded the JDK version from 1.7 to 1.6 in the remote server where JBoss is installed. Still getting this error while running in JBoss server. Looking for someone who might have came across this problem or knows what is the reason for this issue. Please share your inputs
type: Question
has comment: http://stackoverflow.com/comment/41576619
has title: Xmlparserv2 error while application deployed in jboss, Installing Oracle ojdbc module in JBoss for Java web application
has comment: http://stackoverflow.com/comment/41575589
possible better answer: http://stackoverflow.com/a/26470731
has answer: http://stackoverflow.com/a/26470731
has answer: http://stackoverflow.com/a/26475178
tagged with: xmltype
answer count: 2
tagged with: oracle-database
downvote count: 0

http://stackoverflow.com/comment/41423550
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26384294
has text: @Marco7757 it certainly works for me when using the Windows LnF.
score: 0

http://stackoverflow.com/comment/41635025
has text: What you are trying to do is not very clear to me, can you elaborate please?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26501523
score: 2

http://stackoverflow.com/a/26478392
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26478161
downvote count: 0
has body: Assuming that your pattern is something like current state of: "nameYouWantToExtract". You can use a regular expression to extract what matches your pattern: Pattern p = Pattern.compile("^current state of: \"([a-zA-Z]+)\"$"); Matcher m = p.matcher("current state of: \"nameYouWantToExtract\""); if (m.find()) { System.out.println(m.group(1)); } Parenthesis around [a-zA-Z]+ are creating a group, that's why you can extract the value being matched by [a-zA-Z]+. You may change it to [a-zA-Z0-9]+ to be able to extract out numbers too, if applicable. Know more about regular expressions

http://stackoverflow.com/q/26447534
type: Question
has title: Asynctask and passing an arraylist to it giving me error
has answer: http://stackoverflow.com/a/26447567
score: 0
has comment: http://stackoverflow.com/comment/41537249
tagged with: nullpointerexception
answer count: 2
has body: I have simple program that gets JSON data from the Google Images API. It stores all the URLs in that JSON in an ArrayList. I created an AsyncTask to handle this. When I run the program, I am getting the following errors: java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:299) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) at java.util.concurrent.FutureTask.setException(FutureTask.java:124) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) Caused by: java.lang.NullPointerException at com.example.bab.googleimagesapi.MainActivity$myTask.doInBackground(MainActivity.java:84) at com.example.bab.googleimagesapi.MainActivity$myTask.doInBackground(MainActivity.java:58) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) It says there is a NullPointerException at lines 58 and 84. This is my code for the Asynctask, I have commented lines 58 and 84 so you can find them. private class myTask extends AsyncTask&lt;Void, Void, ArrayList&lt;String&gt; &gt; { **//LINE 58** @Override protected ArrayList&lt;String&gt; doInBackground(Void... params) { String imageUrl = "x"; String query = editText.getText().toString(); //get users search query q…
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/26447549
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41537322
tagged with: java

http://stackoverflow.com/q/26425082
has comment: http://stackoverflow.com/comment/41495176
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/26425245
has title: method not printing all values in java
has comment: http://stackoverflow.com/comment/96608636
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26425245
type: Question
has body: i have 2 java programs , the first one takes all information about the employee(id , name , department etc)from the user and prints it , the second program lets the user choose how many number of employees are there then it takes the values like(employ id, name etc), this program uses an array to store the values , it should print all values of different employees , but when i run the program the second set of values overrides the first set of values and prints the second set of values twice , im a beginner so plse help This is the first program import java.util.Scanner; public class payroll2 { public static void main(String args[]) { payroll2 payroll = new payroll2(); payroll.SetPayrollDetail(); payroll.SetBonus(); payroll.SetCommission(); payroll.SetNssf(); payroll.SetNetSalary(); payroll.GetPayroll(); } Scanner myScanner=new Scanner(System.in); int empID; String empName; String empDept; String designation; int basicSalary; double bonus; double commission; double nssf; double netSalary; public void SetPayrollDetail() { System.out.println("Enter ID: "); empID = myScanner.nextInt(); System.out.println("Enter Name: "); empName = myScanner.next(); System.out.println("Enter Department (Marketing or Other): "); empDept = myScanner.next(); System.out.println("Enter Designation (Manager, Executive or Other): "); designation = myScanner.next(); System.out.println("Enter Basic Salary: "); basicSalary = myScanner.nextInt(); } public void SetBonus() { if(basicSalary &lt; 1500){ bonus = 0.0; } else if(basicSalary&gt;=1500 &amp;&amp; basicSalary&lt;3000){ bonus = basicSalary * (12.0/100.0); } else if(basicSalary&gt;=3000 &amp;&amp; basicSalary&lt;5000){ bonus = basicSalary * (15.0/100.0); } else{ bonus = basicSalary * (25.0/100.0); } } public void SetCommission() { if( empDept.equalsIgnoreCase("other") ){ commission = 0.0; } else if( empDept.equalsIgnoreCase("marketing") &amp;&amp; designation.equalsIgnoreCase("manager") ){ commission = basicSalary * (30.0/100.0); } else if( em…
tagged with: arrays
answer count: 1

http://stackoverflow.com/comment/41451739
comment on: http://stackoverflow.com/q/26400868
type: Comment
has text: Shouldn't this be on Code Review? Oh sorry still kinda tired...
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41375564
type: QuestionComment
comment on: http://stackoverflow.com/q/26358564
has text: "Google Maps API Android V2 is enabled." Yes.
score: 0
type: Comment

http://stackoverflow.com/q/26396582
has comment: http://stackoverflow.com/comment/41444663
score: 0
has comment: http://stackoverflow.com/comment/41444699
has title: Specify table to be use for native id generator
type: Question
has answer: http://stackoverflow.com/a/26397019
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: we are using native id generator of hibernate and in-turn for one of the database hibernate selects to use TableHiLoGenerator. &lt;id name="id" column="ID_"&gt; &lt;generator class="native" /&gt; &lt;/id&gt; Is there any way, where we can use other than default table i.e. "hibernate_unique_key"? How to configure table name when one is using native generator? We have to use native as for Oracle we have to use sequences and for MySQL we have to use identity generator.
has comment: http://stackoverflow.com/comment/41444751
answer count: 1
accepted answer: http://stackoverflow.com/a/26397019

http://stackoverflow.com/comment/41588072
comment on: http://stackoverflow.com/a/26475216
type: Comment
has text: Thank you very much, this worked perfectly. I didn't know why i was using double, and im guessing when it was double it was an absolute value?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26916740
score: 1
accepted answer of: http://stackoverflow.com/q/26425632
type: AcceptedAnswer
downvote count: 0
has body: Remove &lt;inherits name='com.google.gwt.user.theme.clean.Clean'/&gt; it's not supported by GXT, see Getting Started
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26425632

http://stackoverflow.com/comment/46107476
comment on: http://stackoverflow.com/a/27815241
type: Comment
has text: I had the same issue and this worked for me. My question is: Is there any way that we do not need to lower the security in gmail?
type: AnswerComment
score: 2

http://stackoverflow.com/comment/117089147
has text: did go to a map, my smelly put is nodes.put(newNode, newNode);"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26430996
type: AnswerComment

http://stackoverflow.com/q/26357720
downvote count: 0
favorite count: 0
has body: I'm trying to create a simple Dialog with a custom progress bar. But for some reason, I can only get the background fully translucent (by adding Theme_Translucent_NoTitle) or fully darkned (by removing Translucent from theme). What I want to do though, is to be able to play with the dim amount. Here's the code: public class ProgressWheelDialog extends Dialog{ private ProgressWheel pw; public ProgressWheelDialog(final Context ctx) { // to make transparent background, add Translucent after Theme_ super(ctx, android.R.style.Theme_NoTitleBar); setContentView(R.layout.dialog_progresswheel); // dim background getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.dimAmount = .5f; getWindow().setAttributes(layoutParams); // get and spin progress wheel pw = (ProgressWheel) findViewById(R.id.pw_spinner); pw.setVisibility(ProgressWheel.VISIBLE); pw.spin(); } What am I doing wrong? Code above darkens the screen completely (except the progress bar of course)
tagged with: android
has comment: http://stackoverflow.com/comment/41374198
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Android dim Dialog background doesn't work as expected
type: Question
has comment: http://stackoverflow.com/comment/41374581
has answer: http://stackoverflow.com/a/26358002
tagged with: dialog
tagged with: themes
answer count: 1

http://stackoverflow.com/a/26432693
has comment: http://stackoverflow.com/comment/41531420
score: 1
accepted answer of: http://stackoverflow.com/q/26432458
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26432458
has body: There's really no value in declaring ListenerT to be a generic type parameter if you're going to have to reflect on it anyway to get the methods you need. I would remove the type parameter entirely and just use Object. Important note: Doing it this way only makes sense for learning the reflection API, not for doing this in production. I realize you said that, but I wanted to reemphasize the point.
type: Answer
has comment: http://stackoverflow.com/comment/41571366

http://stackoverflow.com/a/26449561
type: AcceptedAnswer
downvote count: 0
has body: Compare String using StringUtils class (org.apache.commons.lang.StringUtils). isEmpty() method of StringUtils class internally checks that given String is null or is Empty or not. String postId = rs.getString("post_id") String liker = rs.getString("people_who_like"); if(StringUtils.isEmpty(postId) &amp;&amp; StringUtils.isEmpty(postId)) { liked = true; } else { liked = false; } EDIT : You can make things simple like below if (postId!= null &amp;&amp; liker!= null &amp;&amp; !postId.equals("") &amp;&amp; !liker.equals("")) { liked = true; } else { liked = false; }
has comment: http://stackoverflow.com/comment/41541004
type: Answer
has comment: http://stackoverflow.com/comment/41540733
accepted answer of: http://stackoverflow.com/q/26449520
answers question: http://stackoverflow.com/q/26449520
has comment: http://stackoverflow.com/comment/41540933
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41541155
has comment: http://stackoverflow.com/comment/41540744

http://stackoverflow.com/a/26453587
has comment: http://stackoverflow.com/comment/41548082
has comment: http://stackoverflow.com/comment/41548058
has comment: http://stackoverflow.com/comment/41553409
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26452905
has body: You're not going to like my answer, but I feel that we should be compelled to give you the best answer, which is not always what you want to hear. And that is this: use layout managers to do your component layouts. Yes while it might seem to newbies that null layouts are the easiest to use, as you gain more experience you will find that exactly the opposite is true. Null layout use makes for very inflexible GUI's that while they might look good on one platform look terrible on most other platforms or screen resolutions and that are very difficult to update and maintain. Instead you will want to study and learn the layout managers and then nest JPanels, each using its own layout manager to create pleasing and complex GUI's that look good on all OS's. As for ease of use, I invite you to create a complex GUI with your null layout, and then later try to add a component in the middle of this GUI. This will require you to manually re-calculate all the positions and sizes of components added to the left or below the new component, which is prone to many errors. The layout managers will all do this automatically for you. Specifically use of valid layout managers will update your JPanel's preferredSize automatically increase as more components are added and as the JPanel is revalidated (the layouts are told to re-layout their components). Your null JPanel will not do this, and so the JScrollPane will not work. Yes, a work around is for you to manually calculate and set your JPanel's preferredSize, but this is dangerous and not recommended for the same reasons noted above.
type: Answer
answers question: http://stackoverflow.com/q/26452905
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41687994
upvote count: 2
has comment: http://stackoverflow.com/comment/41548212
has comment: http://stackoverflow.com/comment/41548952

http://stackoverflow.com/q/26392602
has body: Java calling code: import jdk.nashorn.api.scripting.*; .... myCustomHashMap dataStore = new myCustomHashMap(); ScriptEngineManager sem = new ScriptEngineManager(); ScriptEngine engine = sem.getEngineByName("nashorn"); engine.put("dataStore",dataStore); engine.eval(new java.io.FileReader("test.js")); ((Invocable)engine).invokeFunction("jsTestFunc", "testStr" ); Javascript: function jsTestFunc (testParam) { dataStore.a = [1,2,3]; dataStore.b = {First:"John",Last:"Doe",age:37}; } Goal: I need to JSONify the dataStore after the script execution with no dependence on the script for assistance dataStore.a -&gt; jdk.nashorn.internal.objects.NativeArray dataStore.b -&gt; jdk.nashorn.internal.scripts.JO4 For each Map value, I've tried and failed with: Casting to ScriptObject or ScriptObjectMirror Casting to Map or List Accessing JO4/NativeArray methods directly ScriptUtils.wrap() / ScriptUtils.unwrap() I've tried overriding the HashMap.put() method, but it appears not to be converted to a ScriptObjectMirror on assignments, only on explicit function calls: dataStore.x = [1,2,3] ; -&gt; jdk.nashorn.internal.objects.NativeArray javaHost.javaFunc( [1,2,3] ); -&gt; ScriptObjectMirror I really need to use myCustomHashMap (it timestamps changes and maintains a change list, etc), so I can't radically alter this arrangement. What can I do to get this data back out?
downvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: Reading Nashorn JO4 and NativeArray
has answer: http://stackoverflow.com/a/28447943
tagged with: java
type: Question
tagged with: nashorn
upvote count: 5
tagged with: javascript
accepted answer: http://stackoverflow.com/a/28447943
score: 5

http://stackoverflow.com/q/26412385
tagged with: java
has answer: http://stackoverflow.com/a/26413124
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/26413124
upvote count: 5
tagged with: compilation
answer count: 2
has answer: http://stackoverflow.com/a/26413029
has title: Which information from imported class is stored inside compiled class after compilation?
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26413029
has comment: http://stackoverflow.com/comment/41472911
type: AnsweredQuestion
has body: Imagine we have some class A.java. It uses B.java in some way, i.e. imports it, calls its methods, uses its attributes etc. We compile the files. Now I would like to get a deeper understanding of what we have got. Does A.class stores some information about B inside itself? What information - just name, method which is called, final variables which are used? If there is not that much information about B in A.class after compilation - why cant we compile A without B.class at all? If we replace B.class in our bundle with B.class which is another one - when it works and when not? If A.class runs ok with new B.class, may A.class use some information from OLD B.class which was incorporated into A.class during its compilation? I.e. may we finally have a mixed logic of B.class in our project? Basing on the answers on questions above: can we somehow compile class which depends on other classes without knowing their exact implementation at compile time, and provide the dependency only in runtime?

http://stackoverflow.com/comment/70413934
type: Comment
type: QuestionComment
has text: See also: [Why is clone() not in the Cloneable interface?](http://stackoverflow.com/questions/13670152/why-is-clone-not-in-the-cloneable-interface)
comment on: http://stackoverflow.com/q/26398951
score: 0

http://stackoverflow.com/comment/41846119
type: Comment
score: 1
has text: @Gaurav This is *exactly* what I said in my answer and in my comment about the `hideAccelerator` property :)
comment on: http://stackoverflow.com/a/26439325
type: AnswerComment

http://stackoverflow.com/comment/41500622
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26427805
type: Comment
has text: If you could rewrite your `"what I want to achieve"` section to use the indices, it would make it much more clear.

http://stackoverflow.com/comment/41539996
comment on: http://stackoverflow.com/q/26448821
score: 0
has text: Sorry this is java forgot to say that, and thank you very much everybody for all the help
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41372209
type: QuestionComment
has text: did you add your library to your *.gwt.xml file?
comment on: http://stackoverflow.com/q/26356576
score: 0
type: Comment

http://stackoverflow.com/comment/41616643
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26491389
has text: You should include the stack trace of such failures in your question. However, your comment that it works as a normal Java app but not on Android strongly suggests that you are trying to read a file which simply doesn't exist on your Android device. While Android supports a file system, there isn't a very clear or direct way to get things there along with your app. Typically the android-unique resources or assets mechanism are used instead (but these do not result in a java.io.File)
type: Comment

http://stackoverflow.com/q/26466120
answer count: 1
type: UnansweredQuestion
tagged with: android-intent
has body: I'm trying to open a WhatsApp chatbox of a specified number programatically, and send a message (also, desired to be done programatically.) Si far, I've only been successful in opening up the chatbox, but not sending a message. Here's the code I'm using to do so. void openWhatsappContact(String number, Context context) { Uri uri = Uri.parse("smsto:" + number); Intent i = new Intent(Intent.ACTION_SENDTO, uri); i.setPackage("com.whatsapp"); i.putExtra(Intent.EXTRA_TEXT, "test"); Intent mStart = Intent.createChooser(i, ""); mStart.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(mStart); } Is there a way I can send a WhatsApp message to the opened chatbox programatically?
has title: Successfully managed to open up WhatsApp chatbox of specified number programatically. How to send a message to the same chat programatically?
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/26466519
tagged with: android

http://stackoverflow.com/q/26502096
tagged with: java
has title: log4j - one file per run
has comment: http://stackoverflow.com/comment/41647322
has answer: http://stackoverflow.com/a/26505103
possible better answer: http://stackoverflow.com/a/26504917
has body: I have found a similar question for log4net(log4net one file per run), but i am struggling to convert this to log4j.properties file format. The patters just don't get applied: log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File = logs/log-%d{yy/MM/dd HH:mm:ss}.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n ... I see what is wrong here, but I don't know how to fix it.
has comment: http://stackoverflow.com/comment/41638089
linked to: http://stackoverflow.com/q/3048844
score: 0
linked to: http://stackoverflow.com/q/1444520
answer count: 3
accepted answer: http://stackoverflow.com/a/26505103
has comment: http://stackoverflow.com/comment/41639427
tagged with: log4j
type: AnsweredQuestion
tagged with: scala
type: Question
has answer: http://stackoverflow.com/a/26503178
has answer: http://stackoverflow.com/a/26504917

http://stackoverflow.com/comment/41471299
score: 0
type: Comment
type: QuestionComment
has text: Add some code snippet to get better help. Add error/stacktrace, if any.
comment on: http://stackoverflow.com/q/26402997

http://stackoverflow.com/comment/41655778
has text: Please mark it as Answer if that was the expected answer to the above question,may help others.
comment on: http://stackoverflow.com/a/26512318
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41422562
type: QuestionComment
comment on: http://stackoverflow.com/q/26384193
score: 2
type: Comment
has text: The problem is in `Column[8]`. It's got nothing to do with your `createIntData` method, really. The argument is evaluated before the method gets called - so if evaluating the argument fails (as it is doing here), there's nothing the method can do about it.

http://stackoverflow.com/q/26443679
tagged with: benchmarking
has answer: http://stackoverflow.com/a/26444093
answer count: 1
has title: Specify additional dimensions for benchmarks to Google Caliper
score: 0
accepted answer: http://stackoverflow.com/a/26444093
type: AnsweredQuestion
tagged with: java
has body: I am using Google Caliper (latest master code) to benchmark four pieces of code across two dimensions. For example, the following benchmark methods: @Benchmark mechanismOneBreadth(...) @Benchmark mechanismOneDepth(...) @Benchmark mechanismTwoBreadth(...) @Benchmark mechanismTwoDepth(...) What I would like to do is annotate each benchmark with some additional dimensions for display/manipulation on the results app, so that I can compare one-depth with one-breadth, but also compare one-depth with two-depth and one-breadth with two-breadth. For example: @Benchmark @Dimensions({"one", "breadth"}) mechanismOneBreadth(...) @Benchmark @Dimensions({"one", "depth"}) mechanismOneDepth(...) @Benchmark @Dimensions({"two", "breadth"}) mechanismTwoBreadth(...) @Benchmark @Dimensions({"two", "depth"}) mechanismTwoDepth(...) The dimensions specified would act very much like parameters for display on the UI, but I can't use parameters because the called code is different in each case. Is there a way to do this with the current version of Caliper?
type: Question
tagged with: caliper

http://stackoverflow.com/comment/41623669
type: QuestionComment
comment on: http://stackoverflow.com/q/26494578
has text: Well, my example didn't show much in the way of chaining, did it? But this is the sort of strategy that results in, in my opinion, run-away chaining.
score: 0
type: Comment

http://stackoverflow.com/comment/41445242
comment on: http://stackoverflow.com/q/26397022
score: 0
type: Comment
type: QuestionComment
has text: How do streams enter into this?

http://stackoverflow.com/a/26381087
has body: Place the cursor on the method and from the top menu choose Refactor -&gt; Extract -&gt; Parameter Object. In the dialog that's opened, choose the class' name, package etc. and press "Refactor".
answers question: http://stackoverflow.com/q/26381013
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26381013

http://stackoverflow.com/comment/41393733
score: 0
has text: As @Arkanon said, the error is in your `do/while`
comment on: http://stackoverflow.com/q/26368120
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26473655
score: 1
has comment: http://stackoverflow.com/comment/41584747
upvote count: 1
answers question: http://stackoverflow.com/q/26473548
type: Answer
has body: Simply create an count value and increment it. public int Loop4(int val){ int count = 0; for(int i = 0; i&lt; 10; i++){ if ((int)(Math.random()*10) == val) { count++; } } System.out.println(count); return count; }
downvote count: 0

http://stackoverflow.com/q/26458290
has comment: http://stackoverflow.com/comment/41556610
answer count: 1
has body: I'm trying to run my simple program, i added spring framework jar files and common-logging jar files too into my reference library. Here is my first program says HelloWorld.java: package com.rajendra.lesson01; public class HelloWorld { private String message; public void setMessage(String message){ this.message=message; } public void getMessage(){ System.out.println("Messge: "+message); } } Here is my another program says MainProgram.java: package com.rajendra.lesson01; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainProgram { public static void main(String[] args){ ApplicationContext ac=new ClassPathXmlApplicationContext("bean.xml"); HelloWorld hw=(HelloWorld) ac.getBean("helloWorld"); hw.getMessage(); } } and here is my last one bean.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;bean id="helloWorld" class="com.rajendra.lesson01.HelloWorld"&gt; &lt;property name="message" value="My name is foo.." /&gt; &lt;/bean&gt; &lt;/beans&gt; Everything goes fine according to tutorial but my Output says: Oct 20, 2014 9:12:19 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1c12fb0: startup date [Mon Oct 20 09:12:19 IST 2014]; root of context hierarchy Oct 20, 2014 9:12:19 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [bean.xml] Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [bean.xml]; nested exception is java.io.Fi…
has answer: http://stackoverflow.com/a/26458419
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: My simple "Hello World" program is not running into Spring
has comment: http://stackoverflow.com/comment/41556551
accepted answer: http://stackoverflow.com/a/26458419
type: Question
score: 0

http://stackoverflow.com/a/26468556
answers question: http://stackoverflow.com/q/26468409
downvote count: 0
score: 1
type: Answer
has body: how are you calling this class object. if you calling like this then you should not get that exception. new HttpGetter().excute(new URL("http://www.urlstring.com")); Alternatively you can run your code with below code without exception but NOT RECOMMENDED StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); ADD this permission in android manifest.xml file: &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
upvote count: 1

http://stackoverflow.com/a/26513991
has comment: http://stackoverflow.com/comment/41675963
type: Answer
answers question: http://stackoverflow.com/q/26513442
has body: Consider the following: Thread1: Enters method Thread2: Enters method Thread1: Enters sync block, token not null and not expired Thread1: Exits sync block Thread2: Enters sync block, token not null but expired Thread2: Assigns new token Thread1: Returns token (might be new value assigned by thread 2, might be old value) Thread2: Exits sync block Thread2: Returns (new) token If you want to do what you are doing, then token might need to be volatile (but this might not be a sufficient guarantee!), or you should always return the value from the synchronized block, or assign the value of token to a local variable inside the synchronized block and return that local variable from outside. This doesn't even consider what other methods might be doing to token in the meantime. If another (synchronized or unsynchronized) method modifies token as well (eg assigns null), then you might be in worse shape because you assume that token is not null (as you just checked that), while in reality it might be null now.
has comment: http://stackoverflow.com/comment/41658667
accepted answer of: http://stackoverflow.com/q/26513442
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/41658686
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41680538

http://stackoverflow.com/comment/41482006
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26416866
has text: It is possible without an array but it is sort of more confusing. You would place the printf("Number") statement directly below the first for loop. Then place a printf() statement in your if statement in the second for loop to print each divisor.
score: 0

http://stackoverflow.com/comment/41493604
type: QuestionComment
comment on: http://stackoverflow.com/q/26423072
has text: I fail to understand your input vs desired output here. Are you trying to match text that only contains alphabetic characters? Are you trying to only match alphabetic characters - or words containing only alphabetic characters - in an input? Not very clear to me.
score: 0
type: Comment

http://stackoverflow.com/a/26384715
type: AcceptedAnswer
downvote count: 0
upvote count: 13
type: Answer
has body: I had to disable SSLv3 in an application where we integrate Jetty source code. Based on what I changed in code, I would guess you add the following: SSLv3 Give it a shot and let me know if it works for you.
has comment: http://stackoverflow.com/comment/41430428
score: 13
accepted answer of: http://stackoverflow.com/q/26382540
answers question: http://stackoverflow.com/q/26382540

http://stackoverflow.com/q/26460870
upvote count: 2
tagged with: jtextpane
tagged with: swing
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41561134
has comment: http://stackoverflow.com/comment/41561318
type: Question
tagged with: html-table
has answer: http://stackoverflow.com/a/26461384
has title: HTML Table top border on JTextpane
tagged with: http://stackoverflow.com/tag/html
answer count: 1
downvote count: 0
has body: I want to show only top borders of a html table in JTextPane. Below code works fine in Java 1.7 but in Java 1.6 border does not appear. Is there a way to do it in Java 1.6? import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JTextPane; public class textpanedemo{ public static void main(String[] args) { String html = " asd "; JTextPane jPane = new JTextPane(); jPane.setContentType("text/html"); jPane.setText(html); JFrame frame = new JFrame("HtmlDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(jPane); frame.pack(); frame.setVisible(true); } }
has comment: http://stackoverflow.com/comment/41561004
favorite count: 0
accepted answer: http://stackoverflow.com/a/26461384

http://stackoverflow.com/a/26391664
has body: The problem is that you have firstName and lastName patientID and phoneNumber defined as static variables. Every time you add a new object you are setting the those variables but all other objects of that class share the variables because they are static. Only the last patient you enter in will show up for all print outs because static variables are shared by all objects of that class. I fixed your code so it will do what you are trying to do but there are still somethings wrong with the code. For one all patients will have same id = 1. public class Hospital { public String firstName; public String lastName; public static int patientID = 1; public int phoneNum; private static int i = 0; private static Hospital[] hosArray = new Hospital[100]; public Hospital() { firstName = ""; lastName = ""; patientID = 0; phoneNum = 0; } public Hospital(String fName, String lName, int pID, int pNum) { firstName = fName; lastName = lName; patientID = patientID++; phoneNum = pNum; } public static void scanner() { Scanner user = new Scanner(System.in); System.out.print("Enter 1 to add patient: "); int input = user.nextInt(); if (input == 1) { System.out.print("Enter first name: "); String fName = user.next(); System.out.print("Enter last name: "); String lName = user.next(); System.out.print("Enter phone number: "); int pNum = user.nextInt(); if (hosArray[i] == null) { hosArray[i] = new Hospital(); hosArray[i] = new Hospital(fName, lName, Hospital.patientID, pNum); i++; } scanner(); } } public int getpID() { return patientID; } public static void main(String[] args) { scanner(); for (int j = 0; j &lt; hosArray.length; j++) { if (hosArray[j] != null) { System.out.println(hosArray[j].firstName); } } } }
type: Answer
accepted answer of: http://stackoverflow.com/q/26391490
answers question: http://stackoverflow.com/q/26391490
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41495987
comment on: http://stackoverflow.com/q/26398371
score: 0
type: QuestionComment
type: Comment
has text: As I see you found a workaround by drawing something similar to the stamp you are given on every page using a `PdfStamper`. If the stamp won't change (at least not often), that is the easiest way to implement this.

http://stackoverflow.com/q/26411701
type: AnsweredQuestion
tagged with: versioning
tagged with: java
type: Question
tagged with: endpoint
has answer: http://stackoverflow.com/a/26453314
has title: Fixed Rest Endpoints
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41547088
accepted answer: http://stackoverflow.com/a/26453314
has comment: http://stackoverflow.com/comment/41471438
has body: I have a war file deployed on tomcat ( /var/lib/tomcat7/webapps folder ), say, rest-api-webapp-0.0.1.war To access the rest endpoint check, exposed in this war, I use curl in the format curl -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "remarks=Tester" https://localhost:8080/rest-api-webapp-0.0.1/check The problem I face is, whenever I up the patch/major/minor versions of my webapp, I need to change the curl appropriately (say the version is now 0.1.4, then the curl must change as curl -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "remarks=Tester" https://localhost:8080/rest-api-webapp-0.1.4/check. I donot wish to change the way the client calls the endpoint (because it requires the client to upgrade their app, which they resent and see as high maintenance) Can this be avoided by doing something like this Create a symbolic link as below ln -s rest-api-webapp-0.0.1.war rest-api inside the /var/log/tomcat7/webapps folder so that whennever I up the version, I just change the symlink to point to the new version and the client need not do anything to use the new version of the api. In effect, I need the api endpoint to be fixed and not change as and when I up the versions on the server. For Ex: I need the endpoint to be fixed as https:gva.atr.in/colouring-api/check and whenever I have a major change in the controllers and all that I need to do is just update the symlink and not change the endpoint. If you find that this approach is flawed, please show me the right direction as I have been trying to read about this from the past 2 days, but found very less articles that address my problem.
tagged with: tomcat7
tagged with: war

jenkins
tags question: http://stackoverflow.com/q/26380231
tag name: jenkins
tags question: http://stackoverflow.com/q/26465435
tags question: http://stackoverflow.com/q/26424621
tags question: http://stackoverflow.com/q/26356477
tags question: http://stackoverflow.com/q/26390784
tags question: http://stackoverflow.com/q/26369139
tags question: http://stackoverflow.com/q/26423606
tags question: http://stackoverflow.com/q/26458675
tags question: http://stackoverflow.com/q/26384925
tags question: http://stackoverflow.com/q/26504491
type: Tag

http://stackoverflow.com/comment/41654939
type: QuestionComment
comment on: http://stackoverflow.com/q/26499897
has text: Ok. Just to clarify things: I don't say NB does it that way, but it has a wizard to create projects from Maven archetypes. Also, check the existing archetypes, maybe you can find a way to create a NB project from the command line.
score: 0
type: Comment

http://stackoverflow.com/q/26413260
has title: JButtons, ActionListener, and JOptionPane
tagged with: joptionpane
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26413744
accepted answer: http://stackoverflow.com/a/26413744
downvote count: 0
score: 1
tagged with: swing
tagged with: jbutton
type: Question
tagged with: actionlistener
has body: I'm trying to give a popup JOptionPane MessageDialog if the required items are ticked or not ticked but I don't get anything. Basically I'm checking which button is pressed using the action listener and then check which user was selected in the previous window. If the user is not allowed then it should show a popup message dialog telling them so, otherwise it should check whether the required items are ticked in the JCheckBox and if the correct items are ticked it should show a message dialog "welcoming" them into the room. The classes were made quite a while ago and I know that I should be better in naming them as well as my variables. This is quite an old project that I never finished so there are many flaws in the way I programmed, so please don't call me out on that, although tips are welcome. Even though I say this is an old project I am still not great at Java and I'm still learning so my code is not perfect, obviously. Some of the names and messages are in Afrikaans so if there's anything you don't understand just ask and I'll change it for you. I couldn't quite figure out how to use the site's code highlighting, I hope I did it right, sorry. Main class: import javax.swing.JFrame; public class main { public static void main(String args[]){ window1 w1Ob = new window1(); w1Ob.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w1Ob.setSize(250,250); w1Ob.setVisible(true); w1Ob.setLocationRelativeTo(null); w1Ob.setResizable(true); } } First window class: import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; //has to extend JFrame to use content from JFrame, cannot import to here but can to main class, not sure how it //works public class window1 extends JFrame{ //creating window2 object to run window2 if inserted password is correct window2 wO2 = new window2(); //adds needed variables //adds jlist which is the used list private JList list; //names used in the jlist, jlist uses string array private static String[] usernames = {…
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41380933
type: QuestionComment
type: Comment
has text: @OO7 I'm pretty sure OP is trying to test how synchronization works, by setting up two synchronized methods and checking that execution of one will block execution of the other; and he's finding that actually both methods can be executed simultaneously. The problem is the `wait()` calls, which release the lock.
comment on: http://stackoverflow.com/q/26361367
score: 0

http://stackoverflow.com/q/26464229
tagged with: rmi
tagged with: java
type: Question
has title: RMI cllient reconnect gives java.rmi.NoSuchObjectException: no such object in table
accepted answer: http://stackoverflow.com/a/26464559
score: 0
has body: ill try to explain my setting. Setting: i run 1 "server"(note: not rmi server) who is always up. When i run 1 client, the client creates an rmi host like so: String bindLocation = "//localhost/ntn"; try { registry = LocateRegistry.createRegistry(1099); Naming.bind(bindLocation, ntn); } catch (MalformedURLException | AlreadyBoundException e) {} And the server starts acting as a RMI client like so: try { name = "//localhost/ntn"; ntnI = null; ntnI = (NodeToNodeInterface) Naming.lookup(name); ntnI.serverAnswer(k); k++; } catch(Exception e) { System.err.println("FileServer exception: "+ e.getMessage()); e.printStackTrace(); } This all works. But after that the client has received the "server answer" it unbinds like so: try { Naming.unbind(bindLocation); UnicastRemoteObject.unexportObject(registry,true); } catch (NotBoundException e) {} Now if i Open a seccond client(same code as client 1) it again start to act as a RMI server on the same name and port. if this is set up de same function runs on the server and gives the following error: java.rmi.NoSuchObjectException: no such object in table wich points to the line: ntnI = (NodeToNodeInterface) Naming.lookup(name); How do i reinitialise it? or how to fix this? Normally the RMI server is perfectly setup before the server(RMIclient) uses the serverAnswer function.(and it works teh first time)
answer count: 1
has answer: http://stackoverflow.com/a/26464559
type: AnsweredQuestion

http://stackoverflow.com/a/26492344
answers question: http://stackoverflow.com/q/26492210
has body: This way you have fewer superfluous print statements and you don't need to declare you variable multiple times. public int inputNumber() { Scanner input = new Scanner (System.in); int number = 0; do { System.out.print("Enter the number of cookies you'd like to make "); number = input.nextInt(); } while(number &lt;= 0); input.close(); return number; }
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/41480868
type: Comment
type: QuestionComment
has text: @5gon12eder isnt "Character" a wrapper class? I searched it up and most sources said it was a wrapper indeed, unless I am wrong and looking at the wrong info.
comment on: http://stackoverflow.com/q/26416770
score: 0

http://stackoverflow.com/q/26460992
has body: please help me understand why:) My program reach the "try" line, but seems to skip the "catch", Although its printing the stacktrace... I'm using JOptionPane in my catch, but also System.out.println() not working. Code: import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; import javax.imageio.ImageIO; import javax.swing.JOptionPane; public class main { public static void main(String[] args) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); Calendar cal = Calendar.getInstance(); String fileName = dateFormat.format(cal.getTime()); Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); BufferedImage bufferedImage; try { bufferedImage = new Robot().createScreenCapture(rectangle); try { ImageIO.write(bufferedImage, "jpg", new File("c:/temp/ScrenShots/"+fileName+".jpg")); } catch (IOException e) { JOptionPane frame = null; JOptionPane.showMessageDialog(frame,"Failed to take screen-shot", "ScreenShots", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } catch (AWTException e) { JOptionPane frame = null; JOptionPane.showMessageDialog(frame,"AWT Error", "ScreenShots", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } } Exception: java.io.FileNotFoundException: c:\temp\ScrenShots\20.10.2014.jpg (The system cannot find the path specified) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.&lt;init&gt;(Unknown Source) at javax.imageio.stream.FileImageOutputStream.&lt;init&gt;(Unknown Source) at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(Unknown Source) at javax.imageio.ImageIO.createImageOutputStream(Unknown Source) at javax.imageio.ImageIO.write(Unknown Source) at main.main(main.java:26) Exception in thread "main" java.lang.NullPointerException at javax.imageio.ImageIO.write(Unk…
has title: Code in "catch" block not executing
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/44691450
tagged with: exception
tagged with: catch-block
tagged with: io
answer count: 1
accepted answer: http://stackoverflow.com/a/26461065
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44691418
has comment: http://stackoverflow.com/comment/41561258
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26461065

http://stackoverflow.com/q/26405386
type: Question
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41461885
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/41462048
has answer: http://stackoverflow.com/a/26405676
tagged with: oracle-database
answer count: 1
type: UnansweredQuestion
has body: Long ago I was consuming web service from Oracle DB with procedure that was generated with JPublisher. Simply providied URL of WS WSDL and JPublisher utility did the rest of procedure generation. Now I need to make a call to REST service but with java code from Oracle DB. I googled for a while with no results. Is it possible or is it so trivial?
has comment: http://stackoverflow.com/comment/41461775
has title: Can I make a HTTP callout from Oracle DB via java code
score: 1
tagged with: java

http://stackoverflow.com/comment/41486056
type: AnswerComment
score: 0
type: Comment
has text: If you have many different nested tags (``), filtering this out is a real pain with regexp. In this situation you should choose another approach, as the others said.
comment on: http://stackoverflow.com/a/26403471

http://stackoverflow.com/comment/41380378
type: AnswerComment
score: 0
type: Comment
has text: Do you realize, that this assignment won't take effect for initial array?
comment on: http://stackoverflow.com/a/26360978

http://stackoverflow.com/a/26403380
accepted answer of: http://stackoverflow.com/q/26402466
upvote count: 5
score: 4
answers question: http://stackoverflow.com/q/26402466
has comment: http://stackoverflow.com/comment/55069995
type: AcceptedAnswer
has body: Here it is: The (almost) perfect answer Good to know that someone else was struggling the exact same problem like me. To make it simple I'll post here the XML drawable: window_background.xml: <?xml version="1.0" encoding="utf-8"?> <item android:id="@+id/status_bar_background" android:drawable="@color/main_app_color"/> <item android:id="@+id/content_window_background" android:drawable="@color/white" android:top="25dp"/> And now in my theme I assign this drawable as the windowBackground: <?xml version="1.0" encoding="utf-8"?>
has comment: http://stackoverflow.com/comment/54944033
type: Answer
downvote count: 1

http://stackoverflow.com/comment/41591113
has text: @ScaryWombat Even so, using SQL would be a home-brewed solution to some extent--I saw this title, and immediately thought of using grep. :P
comment on: http://stackoverflow.com/q/26476982
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41653954
type: AnswerComment
comment on: http://stackoverflow.com/a/26510002
type: Comment
has text: thanks for your time. I thought there was a solution like the same way that an application behaves when click the "Home button" and from "Task Manager" choose my application, she goes to Foreground, keeping the state it was before going to background. In this case in this case the onDestoy is not called.
score: 0

http://stackoverflow.com/q/26445800
has comment: http://stackoverflow.com/comment/41534376
score: 0
has title: How do I add a Github library to my Android Project as a JAR in Eclipse?
tagged with: android
has comment: http://stackoverflow.com/comment/41534715
has answer: http://stackoverflow.com/a/26446914
type: UnansweredQuestion
has body: I'm trying to add https://github.com/astuetz/PagerSlidingTabStrip to my project. Looking at it, I notice that it has files in res and depends on its own R.java file. When I make it a JAR I continue to get errors because the dependencies aren't all there. I'm not sure how to get this to work. I keep getting errors like import android.support cannot be resolved and everything else too. I tried referencing different answers on StackOverflow but none of them yielded a working solution.
tagged with: java
has answer: http://stackoverflow.com/a/26445822
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41534410
type: Question
answer count: 2
tagged with: jar

http://stackoverflow.com/comment/41441150
type: Comment
has text: No. I wrote it in eclipse and the package is set to default when creating the class.
type: AnswerComment
comment on: http://stackoverflow.com/a/26392515
score: 0

http://stackoverflow.com/a/26372720
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26372689
type: Answer
answers question: http://stackoverflow.com/q/26372689
score: 1
upvote count: 1
has body: You need to create "setters" for class members you want to write values to. In your case, you can add this to the class Personne: public void setSexe(char sexe) { this.sexe = sexe; } Then instead of pers[i].getSexe()=sexe, use pers[i].setSexe(sexe).
downvote count: 0

http://stackoverflow.com/q/26491780
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: connectedCheck/connectedInstrumentTest am instrument parameter
score: 2
answer count: 0
downvote count: 0
tagged with: java
tagged with: gradle
type: Question
has body: Is it possible to configure connectedInstrumentTest to include/exclude tests with/without an annotation? Something similar to adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.test.InstrumentationTestRunner Similarly, is it possible to specify a list of tests to be executed? Equivalent to adb shell am instrument -w -e class com.android.foo.FooTest,com.android.foo.TooTest com.android.foo/android.test.InstrumentationTestRunner
upvote count: 2
tagged with: instrumentation

http://stackoverflow.com/q/26474963
accepted answer: http://stackoverflow.com/a/26475784
has title: System.Windows.Media.Color to Java int
has comment: http://stackoverflow.com/comment/41587424
score: -1
has comment: http://stackoverflow.com/comment/41587386
tagged with: colors
answer count: 1
has body: I'm need some way to convert a System.Windows.Media.Color to a Java int with the following format: 0x00RRGGBB in C#. Any ideas? Thanks!
favorite count: 0
downvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26475784
upvote count: 1
type: Question
tagged with: c#

http://stackoverflow.com/comment/41525976
type: Comment
type: QuestionComment
has text: For fun, try `Box<String>` in your second example. Or `Box<Anything>`.
score: 0
comment on: http://stackoverflow.com/q/26441409

http://stackoverflow.com/comment/41923396
comment on: http://stackoverflow.com/a/26495452
has text: I'd even go as far as to use bit masks with it, like 0b001_0010 - it makes it possible to express entire mask as 8 bytes, arguably making it a bit more readable (though it requires a bit shift to access then) and unarguably making it more easily editable.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26498448
answers question: http://stackoverflow.com/q/26498264
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26498264
upvote count: 2
has comment: http://stackoverflow.com/comment/41667098
type: AcceptedAnswer
downvote count: 0
has body: You need a little more context to track the value the JVM stores for foo. Assuming foo is a local variable new Foo(1,2); is invoked The result, the value of the reference to the instance, is copied and stored in the local variable foo ...stuff... The anonymous class constructor is invoked to create a new instance As part of its constructor, a copy of the value of the local variable foo is retrieved and pushed on the stack That value is popped from the stack and assigned to this val$foo field of the anonymous class (this is closing over that variable) ...stuff... When foo.something() is invoked, the JVM retrieves the value of the field val$foo of the anonymous class instance The JVM dereferences that value to get the object and invokes the method on it

http://stackoverflow.com/q/26416075
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/41514848
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26419129
tagged with: java
type: Question
has title: Samples for the azure management sdk for java
accepted answer: http://stackoverflow.com/a/26419129
has comment: http://stackoverflow.com/comment/41480240
score: 0
tagged with: sdk
tagged with: azure
answer count: 1
favorite count: 0
has body: I am looking to use this SDK - https://github.com/Azure/azure-sdk-for-java. However it seems completely devoid of even simple samples. I searched around on the web and the only examples are of using the REST API directly. Is this SDK even supported?

http://stackoverflow.com/q/26488816
linked to: http://stackoverflow.com/q/10490344
favorite count: 0
answer count: 5
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26490047
has title: Incorrect example of Scanner in Java book?
score: 3
has answer: http://stackoverflow.com/a/26488930
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26488935
downvote count: 0
has body: I'm practicing HashSet from Java book by Cay S. Horstmann and Gary Cornell and I think there's a mistake in example code on page 687. We have a Scanner importing words to HashSet and it looks like this (I removed some unneeded code to make a problem more visible): Set&lt;String&gt; words = new HashSet&lt;String&gt;(); Scanner in = new Scanner(System.in); while (in.hasNext()) { String word = in.next(); words.add(word); } The problem is there's no way stop this loop. Or maybe there's something I'm missing? To stop the loop I've added another static helper method: public static boolean isStop(Scanner in) { if (in.next().equals("stop")) { return true; } return false; } And now the main code looks like this: Set&lt;String&gt; words = new HashSet&lt;String&gt;(); Scanner in = new Scanner(System.in); while (!isStop(in)) { String word = in.next(); words.add(word); } Is there any other way to stop scanner loop? I can't believe that book's author has made a mistake ?
has answer: http://stackoverflow.com/a/26488877
linked to: http://stackoverflow.com/q/12806672
has answer: http://stackoverflow.com/a/26488914

http://stackoverflow.com/q/26511221
has body: I have a simple application that take a picture and store it in a folder called CameraSample on the sd card. to do that I use MediaStore.EXTRA_OUTPUT option as extra: private void dispatchTakePictureIntent(int actionCode) { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File f = null; try { f = setUpPhotoFile(); mCurrentPhotoPath = f.getAbsolutePath(); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f)); } catch (IOException e) { e.printStackTrace(); f = null; mCurrentPhotoPath = null; } if (takePictureIntent.resolveActivity(getPackageManager()) != null){ startActivityForResult(takePictureIntent, actionCode); } } The immage is taken and stored correctly. Now I would like to show thumbnails of the images I took, so I look for all the images, I take into account just the ones that are under CameraSample album and I want to retrieve the thumbnails, but the result is that there are no thumbnails for the images I take this way, is that because I use the MediaStore.EXTRA_OUTPUT? Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; String[] projection = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA, MediaStore.Images.Media.BUCKET_ID, MediaStore.Images.Media.BUCKET_DISPLAY_NAME, MediaStore.Images.Media.MINI_THUMB_MAGIC}; Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null); ArrayList&lt;PhotoItem&gt; result = new ArrayList&lt;PhotoItem&gt;(); Uri fullImageUri; String album_id; String album_name; if (cursor != null) { while (cursor.moveToNext()) { int column_idx = cursor.getColumnIndex(MediaStore.Images.Media._ID); album_id = cursor.getString(column_idx); column_idx = cursor.getColumnIndex(MediaStore.Images.Media.BUCKET_DISPLAY_NAME); album_name = cursor.getString(column_idx); if(album_name.equalsIgnoreCase("CameraSample")){ column_idx = cursor.getColumnIndex(projection[1]); String filePath = cursor.getString(column_idx); fullImageUri = Uri.parse(filePath); Uri thumbnailUri = uriToThu…
tagged with: android
has answer: http://stackoverflow.com/a/26514799
score: 0
tagged with: java
type: Question
answer count: 1
tagged with: photo-gallery
has title: Taking a picture, store it in a folder on the SD card and retrieve the thumbnail
type: UnansweredQuestion

http://stackoverflow.com/comment/41563602
type: Comment
comment on: http://stackoverflow.com/a/26461783
score: 0
type: AnswerComment
has text: You mean remove *org.codehaus.jackson* dependency and add *com.fasterxml.jackson.core*? This not working on my machine. It throws model class not found exception.

http://stackoverflow.com/comment/41503948
has text: @Dylan Added all the classes as in their original state.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26427002
score: 0

http://stackoverflow.com/comment/41578171
has text: See my answer, hopefully that's it?
score: 0
comment on: http://stackoverflow.com/q/26455608
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26462853
score: 1
tagged with: java
upvote count: 1
tagged with: unit-testing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26463276
has title: Mockito - throws nullpointerException when mocking a service
accepted answer: http://stackoverflow.com/a/26463276
has body: I'm new to Mockito and testclasses in general. I'm trying to write a test class for my controller. When I run my test I want to mock my service to return a list of Dto objects. But when I do this I get the error. my code: Controller class @Controller public class CalendarController { @Resource private CalendarService calendarService; @RequestMapping(method = RequestMethod.GET,value = RequestMappings.CALENDAR, produces = ContentType.APPLICATION_JSON) public ResponseEntity&lt;List&lt;CalendarDto&gt;&gt; getCalendarMonthInfo(@PathVariable final String userId, @PathVariable final String year) { List&lt;CalendarDto&gt; result = new ArrayList&lt;CalendarDto&gt;(); result = calendarService.getMonthInfo(userId,Integer.parseInt(year)); return new ResponseEntity&lt;&gt;(result, HttpStatus.OK); } Test class public class CalendarControllerTest extends BaseControllerIT { List&lt;CalendarDto&gt; calendarDto; CalendarDto test1 , test2; String userId = "20"; String year = "2014"; @Mock public CalendarService calendarService; @Before public void setUp() throws Exception { calendarDto = new ArrayList&lt;CalendarDto&gt;(); test1 = new CalendarDto(); test1.setStatus(TimesheetStatusEnum.APPROVED); test1.setMonth(1); test2 = new CalendarDto(); test2.setMonth(2); test2.setStatus(TimesheetStatusEnum.REJECTED); calendarDto.add(test1); calendarDto.add(test2); } @Test public void testGet_success() throws Exception { when(calendarService.getMonthInfo(userId,Integer.parseInt(year))).thenReturn(calendarDto); performGet(UrlHelper.getGetCalendarMonthInfo(userId,year)).andExpect(MockMvcResultMatchers.status().isOk()); } } I get a nullPointerException in the test (When I call the "when" part). Looking further into it I saw that all the variables are oke but the service that I mock remains null. Am i forgetting to instantiate something or am I just completely wrong in how I'm doing this. Any help or pointers you can give are welcome.
tagged with: mockito
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-mvc

http://stackoverflow.com/a/26447688
has comment: http://stackoverflow.com/comment/41537490
has comment: http://stackoverflow.com/comment/41537559
type: Answer
has comment: http://stackoverflow.com/comment/41537438
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26447608
has comment: http://stackoverflow.com/comment/41537671
has comment: http://stackoverflow.com/comment/41537608
has comment: http://stackoverflow.com/comment/41537639
answers question: http://stackoverflow.com/q/26447608
has comment: http://stackoverflow.com/comment/41537542
has comment: http://stackoverflow.com/comment/56638246
has comment: http://stackoverflow.com/comment/41537488
has comment: http://stackoverflow.com/comment/41537654
has comment: http://stackoverflow.com/comment/41537465
has comment: http://stackoverflow.com/comment/41537476
has comment: http://stackoverflow.com/comment/41537496
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41537710
has body: You can do it like given below: For example public class DrawView extends View { // here you define hashmap for user touch points Paint paint = new Paint(); public DrawView(Context context) { super(context); } @Override public void onDraw(Canvas canvas) { yourRandomFunction(-99,-99); } public void yourRandomFunction(float x , float y ){ //for first time user touch // if -99 &amp;&amp; -99 { //Calculate random points here. paint.setColor(Color.BLACK); paint.setStrokeWidth(3); canvas.drawRect(30, 30, 80, 80, paint); paint.setStrokeWidth(0); paint.setColor(Color.CYAN); canvas.drawRect(33, 60, 77, 77, paint ); paint.setColor(Color.YELLOW); canvas.drawRect(33, 33, 77, 60, paint ); // add points to hashmap } //else check in hashmap if exist then { //Calculate random points here. paint.setColor(Color.BLACK); paint.setStrokeWidth(3); canvas.drawRect(30, 30, 80, 80, paint); paint.setStrokeWidth(0); paint.setColor(Color.CYAN); canvas.drawRect(33, 60, 77, 77, paint ); paint.setColor(Color.YELLOW); canvas.drawRect(33, 33, 77, 60, paint ); // add point to hashmap } } @Override public boolean onTouchEvent(MotionEvent event) { float eventX = event.getX(); float eventY = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: //check points in hashmap return true; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: // nothing to do yourRandomFuncntion(eventX,eventY); break; default: return false; } // Schedules a repaint. invalidate(); return true; } }

http://stackoverflow.com/comment/41632288
type: QuestionComment
has text: You are adding the file even before checking if the `totalAttachmentSize` will exceed `maxAttachmentSize` or not !!
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26499917

http://stackoverflow.com/comment/41432948
comment on: http://stackoverflow.com/a/26389816
type: AnswerComment
has text: not only backwards, but totally wrong. "If remainder is non-zero, then number must be prime", on every iteration of the loop?
score: 0
type: Comment

http://stackoverflow.com/comment/41425574
has text: If it crashed, you should have a stack trace. You should include that in your question.
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26385813

http://stackoverflow.com/a/26498504
has comment: http://stackoverflow.com/comment/41629985
has comment: http://stackoverflow.com/comment/41629892
type: Answer
has comment: http://stackoverflow.com/comment/41629938
answers question: http://stackoverflow.com/q/26498333
has comment: http://stackoverflow.com/comment/41629929
has body: It looks like you haven't quite posted your entire class, but based on the error message it looks like MyException occurs inside your class, something like: public class TheClass { public static void main(String[] args) { .... } public class MyException extends Exception { .... } } This makes MyException an inner class. Every instance of MyException must therefore "belong" to an instance of TheClass. That's why you get the "non-static variable this" error message. When you say new MyException, you're inside the static main method, so it has no way of knowing what instance of TheClass the new MyException object will belong to. I don't think you want this to be an inner class. Either move MyException outside of TheClass, or make it static: public static class MyException extends Exception { Making it static would make it a "nested" rather than an "inner" class, so that it doesn't belong to an instance of TheClass. You probably want to move it outside, though. I don't see a good reason for it to be in your other class.
score: 0
has comment: http://stackoverflow.com/comment/41629931
has comment: http://stackoverflow.com/comment/41629821
has comment: http://stackoverflow.com/comment/41629927

http://stackoverflow.com/comment/48481196
has text: Worked in Windows 7, windows 8 and OS X mountain lion using eclipse, server was Ubuntu.
type: AnswerComment
score: 4
type: Comment
comment on: http://stackoverflow.com/a/26467775

http://stackoverflow.com/a/26437565
accepted answer of: http://stackoverflow.com/q/26437544
has comment: http://stackoverflow.com/comment/41519401
answers question: http://stackoverflow.com/q/26437544
type: AcceptedAnswer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/41519460
has body: JOptionPane.showInputDialog()returns a Object (credits to @SeleenVirtuose) which cannot be cast to a double, use Double.parseDouble() to parse a String as a double. costprice = Double.parseDouble(JOptionPane.showInputDialog( alphaPOS, "Cost Price:", "Enter Values", JOptionPane.PLAIN_MESSAGE, null, possibilities, "")); Also, you can all of this on one line As you are declaring the double variable and then setting straight away, you might as well declare it and assign the new value in one line double costprice = Double.parseDouble(JOptionPane.showInputDialog( alphaPOS, "Cost Price:", "Enter Values", JOptionPane.PLAIN_MESSAGE, null, possibilities, "")); Also, as the possibilities variable is null, just pass null as the parameter (unless you have changed the variable somewhere else) double costprice = Double.parseDouble(JOptionPane.showInputDialog( alphaPOS, "Cost Price:", "Enter Values", JOptionPane.PLAIN_MESSAGE, null, nulll, ""));
has comment: http://stackoverflow.com/comment/41519474
has comment: http://stackoverflow.com/comment/41519428
type: Answer
has comment: http://stackoverflow.com/comment/41519332
upvote count: 6
has comment: http://stackoverflow.com/comment/41519407

http://stackoverflow.com/a/26471075
has comment: http://stackoverflow.com/comment/41586229
has comment: http://stackoverflow.com/comment/41582821
has comment: http://stackoverflow.com/comment/41585490
has comment: http://stackoverflow.com/comment/41580688
downvote count: 0
has comment: http://stackoverflow.com/comment/41586247
has comment: http://stackoverflow.com/comment/41585581
has comment: http://stackoverflow.com/comment/41581287
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26469578
has body: It would be better to use Intent to search the image type files available in your device. Intent imageIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT); imageIntent.addCategory(Intent.CATEGORY_OPENABLE); imageIntent.setType("image/*"); imageIntent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(imageIntent , READ_REQUEST_CODE); // set READ_REQUEST_CODE to 42 in your class Now, process your results in the onActivityResult() method. protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == READ_REQUEST_CODE &amp;&amp; resultCode == Activity.RESULT_OK) { Uri uri = null; if (data != null) { uri = data.getData(); Log.i(TAG, "Uri: " + uri.toString()); showImage(uri); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/41581062

dependency-injection
tags question: http://stackoverflow.com/q/26407666
tags question: http://stackoverflow.com/q/26481513
tags question: http://stackoverflow.com/q/26495852
type: Tag
tags question: http://stackoverflow.com/q/26443144
tags question: http://stackoverflow.com/q/26486082
tags question: http://stackoverflow.com/q/26386006
tags question: http://stackoverflow.com/q/26431015
tags question: http://stackoverflow.com/q/26441113
tags question: http://stackoverflow.com/q/26447360
tags question: http://stackoverflow.com/q/26367699
tags question: http://stackoverflow.com/q/26445893
tags question: http://stackoverflow.com/q/26365077
tag name: dependency-injection
tags question: http://stackoverflow.com/q/26489071
tags question: http://stackoverflow.com/q/26469679

http://stackoverflow.com/q/26419943
has body: We use Oracle JDBC Driver 9.2.0 with Oracle 11g and we have problems like hotspot errors etc. Do you think JDBC drivers are upward compatible? Unfortunately I could not find any compatibility matrix for these versions Thanks Zoltan
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/41493167
favorite count: 0
linked to: http://stackoverflow.com/q/756208
has comment: http://stackoverflow.com/comment/41487260
has comment: http://stackoverflow.com/comment/41487250
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc
answer count: 0
tagged with: java
has title: Oracle JDBC driver upward compatibility
downvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/756208
has comment: http://stackoverflow.com/comment/41487184
has comment: http://stackoverflow.com/comment/41486768

http://stackoverflow.com/a/26478721
type: Answer
has comment: http://stackoverflow.com/comment/41594073
answers question: http://stackoverflow.com/q/26478705
upvote count: 3
score: 3
has body: This is a very bad use of recursion public static int multiple(int n){ // once come into this method will never exit return multiple(n); // again and again call multiple } There is no exit condition from this recursion method. You need to think about an exit condition to terminate this recursive call. Edit: for your edit: public static int multiple(int n) { // inside this method n is never change if (n == 0) return 1; else return multiple(n);// still no termination for the recursion call }
downvote count: 0

http://stackoverflow.com/comment/41629500
comment on: http://stackoverflow.com/a/26476309
type: Comment
has text: see Aaron C's comment below!
score: 0
type: AnswerComment

http://stackoverflow.com/a/26476965
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26461251
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26461251
has body: I have just exported some data from postgres database (asking it to create insert statements) The dump looks like INSERT INTO scenario_collection (id, date_collected, file_name, scenarioid) VALUES (137, '2014-10-16 14:47:00', '20141016134500-eland.log', 11); So try using single quotes

http://stackoverflow.com/a/26438158
type: Answer
score: 2
has body: I believe you can achieve much of what you want using Tyler Rinker's very useful qdap package. More specifically, the synonyms function. require(qdap) synonyms(c("size", "quality")) $size.def_1 [1] "amount" "bigness" "bulk" "dimensions" "extent" "greatness" "hugeness" [8] "immensity" "largeness" "magnitude" "mass" "measurement (s)" "proportions" "range" [15] "vastness" "volume" $size.def_2 [1] "diminutive" "little" "midget" "miniature" "pocket" "pygmy or pigmy" "small" [8] "teensy-weensy" "teeny-weeny" "tiny" "wee" $size.def_3 [1] "appraise" "assess" "evaluate" "eye up" "get (something) taped" $quality.def_1 [1] "aspect" "attribute" "characteristic" "condition" "feature" "mark" "peculiarity" [8] "property" "trait" $quality.def_2 [1] "character" "constitution" "description" "essence" "kind" "make" "nature" "sort" $quality.def_3 [1] "calibre" "distinction" "excellence" "grade" "merit" "position" "pre-eminence" "rank" [9] "standing" "status" "superiority" "value" "worth" $quality.def_4 [1] "aristocracy" "gentry" "nobility" "ruling class" "upper class" Assign the synonyms to a list object and extract what you want. attributes &lt;- synonyms(c("size", "quality")) Also, here is a related Stack Overflow question: Identifying near duplicate entries using synonyms in R
has comment: http://stackoverflow.com/comment/41521523
has comment: http://stackoverflow.com/comment/41521324
answers question: http://stackoverflow.com/q/26437041
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41653551
type: Comment
comment on: http://stackoverflow.com/a/26509746
has text: I'll check if I can find a way to do it. Thank you for your help.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41562139
score: 0
comment on: http://stackoverflow.com/q/26461404
type: Comment
type: QuestionComment
has text: The NullPointerException is thrown at: String out = output.getText(); I added the Input class in my question.

http://stackoverflow.com/a/26369755
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26369543
has comment: http://stackoverflow.com/comment/41397006
type: Answer
upvote count: 2
has body: Create a bash script to invoke the method . and add an cron entry to execute at specific time.

http://stackoverflow.com/q/26450786
has comment: http://stackoverflow.com/comment/41543039
tagged with: android-radiogroup
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41543335
type: UnansweredQuestion
tagged with: android
answer count: 0
score: 1
tagged with: java
has body: Aim Every X seconds the assignment and possible answers need to be updated. Attempt Possible answers were added to the Android app using ll.addView(radioGroupPossibleAnswers(params3));. The idea was that calling radioGroupPossibleAnswers(params3); within the update thread would update the possible answers within the radio group like this works for the assignment by calling textView2.setText("" + assignment.getAssignment() + "");. UpdateThread assignment.setRandomIntegerOneAndTwo(10); assignmentTextView.setText("" + assignment.getAssignment() + ""); RelativeLayout relativeLayout = new RelativeLayout(this); relativeLayout.addView(assignmentTextView); relativeLayout.addView(radioGroupPossibleAnswers(radioGroupLayoutParams)); setContentView(relativeLayout); Thread t = new Thread() { @Override public void run() { try { while (!isInterrupted()) { Thread.sleep(10000); runOnUiThread(new Runnable() { @Override public void run() { tenSecondCountDown(countDownTextView); assignment.setRandomIntegerOneAndTwo(10); assignmentTextView.setText("" + assignment.getAssignment() + ""); RelativeLayout.LayoutParams params3 = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); radioGroupPossibleAnswers(params3); } }); } } catch (InterruptedException e) { } } }; t.start(); RadioGroup private RadioGroup radioGroupPossibleAnswers( android.widget.RelativeLayout.LayoutParams p) { RadioGroup rg = new RadioGroup(this); rg.setOrientation(RadioGroup.VERTICAL); rg.setLayoutParams(p); ArrayList&lt;Integer&gt; a = assignment.getPossibleAnswers(); final RadioButton[] rb = new RadioButton[5]; for (int i = 0; i &lt; assignment.getPossibleAnswers().size(); i++) { int possibleAnswer = a.get(i); System.out.println("Possible answer: " + a.get(i)); rb[i] = new RadioButton(this); rb[i].setText(a + " " + assignment.getPossibleAnswers().size() + " " + i + " " + possibleAnswer); rb[i].setId(i); rb[i].setTextSize(30); rg.addView(rb[i]); } return rg; } Result Although the assignm…
upvote count: 1
has comment: http://stackoverflow.com/comment/41548014
has comment: http://stackoverflow.com/comment/41543511
type: Question
has comment: http://stackoverflow.com/comment/41543409
has comment: http://stackoverflow.com/comment/41593878
has comment: http://stackoverflow.com/comment/41543859
has comment: http://stackoverflow.com/comment/41545798
has comment: http://stackoverflow.com/comment/41580284
has title: How to update a RadioGroup in Android?
has comment: http://stackoverflow.com/comment/41543446

http://stackoverflow.com/a/26457787
has body: As shown here, you can render an Icon and display it in your implementation of paintComponent(). As your animation surface will not need a layout, extend JComponent. Each Icon may be an embedded-resource or a runtime- construct such as ColorIcon. Complete examples are seen in the KineticModel, cited here, and SimpleBalls, cited here.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26456658

http://stackoverflow.com/q/26424841
has comment: http://stackoverflow.com/comment/41495061
tagged with: swing
type: AnsweredQuestion
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/41495005
has comment: http://stackoverflow.com/comment/41494958
tagged with: java
has comment: http://stackoverflow.com/comment/41494839
type: Question
has title: ActionListener in java performs action on the second click
has answer: http://stackoverflow.com/a/26425062
answer count: 2
accepted answer: http://stackoverflow.com/a/26425012
score: 2
has comment: http://stackoverflow.com/comment/41495583
downvote count: 0
has comment: http://stackoverflow.com/comment/41494641
favorite count: 0
possible better answer: http://stackoverflow.com/a/26425062
has body: I am programming my first complex application in Java, Swing. When I have added ActionListener to my JButton. ActionListener changeButton = new ActionListener() { @Override public void actionPerformed(ActionEvent e){ if(startButton.getText() == "Spustit") { startButton.setText("STOP"); } else { startButton.setText("Spustit"); } } } I am adding ActionListener to the button itself private void startButtonActionPerformed(java.awt.event.ActionEvent evt) { startButton.addActionListener(changeButton); } Can you tell me where I coded ActionListener badly? Thanks to all!
has comment: http://stackoverflow.com/comment/41494854
upvote count: 2
has answer: http://stackoverflow.com/a/26425012

integer
tags question: http://stackoverflow.com/q/26445099
tags question: http://stackoverflow.com/q/26442082
tag name: integer
tags question: http://stackoverflow.com/q/26375932
tags question: http://stackoverflow.com/q/26437767
tags question: http://stackoverflow.com/q/26433929
tags question: http://stackoverflow.com/q/26459729
tags question: http://stackoverflow.com/q/26412344
type: Tag

windows
tags question: http://stackoverflow.com/q/26512513
tags question: http://stackoverflow.com/q/26415101
tags question: http://stackoverflow.com/q/26429178
tags question: http://stackoverflow.com/q/26485492
tags question: http://stackoverflow.com/q/26447183
tags question: http://stackoverflow.com/q/26414290
tags question: http://stackoverflow.com/q/26383220
tags question: http://stackoverflow.com/q/26502564
tags question: http://stackoverflow.com/q/26481345
tags question: http://stackoverflow.com/q/26370353
tags question: http://stackoverflow.com/q/26378874
tags question: http://stackoverflow.com/q/26407746
tags question: http://stackoverflow.com/q/26510926
tags question: http://stackoverflow.com/q/26455330
tags question: http://stackoverflow.com/q/26488707
tags question: http://stackoverflow.com/q/26449047
tags question: http://stackoverflow.com/q/26428812
tags question: http://stackoverflow.com/q/26510841
tags question: http://stackoverflow.com/q/26504826
tags question: http://stackoverflow.com/q/26412324
tags question: http://stackoverflow.com/q/26490079
tags question: http://stackoverflow.com/q/26430298
type: Tag
tags question: http://stackoverflow.com/q/26470811
tags question: http://stackoverflow.com/q/26401287
tags question: http://stackoverflow.com/q/26406323
tags question: http://stackoverflow.com/q/26354559
tags question: http://stackoverflow.com/q/26364853
tags question: http://stackoverflow.com/q/26478926
tag name: windows

http://stackoverflow.com/comment/41399574
comment on: http://stackoverflow.com/q/26371195
score: 0
type: Comment
type: QuestionComment
has text: BTW I have exactly the same version and even older Luna (4.4.0).

http://stackoverflow.com/q/26374743
score: 0
answer count: 3
has body: I'm trying to work on my homework for class, and I'm using a switch case to make a command line interface, but I'm having a problem with the part I'm using. When I execute the addCard command, it goes through fine, but then afterwards goes to the default section. When I try using any of the other sections, or use it without the try segment, it works and doesn't go to default. Any thoughts on how to repair this? Code below public static void cmdLine(String Cmd) { switch(Cmd) { case "Help": case "?": System.out.println("Available Commands:\naddCard = Add a card!\ndeleteCard = Delete a Card!\nfindCard = Locate Card Number by Name!\nCard (Card Number) = Work with your card"); break; case "addCard" : System.out.println ("Enter Account Name:"); String cName = scan.nextLine(); try { System.out.println ("Enter Account Start Balance:"); int cBal = scan.nextInt(); System.out.println ("Enter Account Number:"); int cNum = scan.nextInt(); PPArray.addCard(cName, cBal,cNum); } catch (InputMismatchException nfe) { System.out.println("InputMismatchException: Please try again with only the card number. (Ex. 12345"); break; } break; case "deleteCard" : System.out.println("here we will have a command to remove the card from the array"); break; case "Card" : System.out.println("This will lead to a new function to operate with said card"); break; case "Exit": case "exit": case "Quit": case "quit": return; default : System.out.println("Invalid Command ('?' or 'Help' for commands)"); System.out.println(PPArray.cardArray[1].name); } cmdLine(scan.nextLine()); }
has answer: http://stackoverflow.com/a/26374808
has answer: http://stackoverflow.com/a/26374817
accepted answer: http://stackoverflow.com/a/26374817
has comment: http://stackoverflow.com/comment/41405744
duplicate of: http://stackoverflow.com/q/13102045
possible better answer: http://stackoverflow.com/a/26374773
tagged with: case
type: AnsweredQuestion
tagged with: java
tagged with: switch-statement
type: Question
linked to: http://stackoverflow.com/q/13102045
has comment: http://stackoverflow.com/comment/41405806
has title: Java switch/case going to default after case
has answer: http://stackoverflow.com/a/26374773

http://stackoverflow.com/comment/41596227
type: QuestionComment
has text: And what are your doubts with such a solution? It is AOP catching exceptions and retrying in certain situations. Although 300 retries might be a bit steep. Spring also has a small project, [Spring Retry](https://github.com/spring-projects/spring-retry) (also used by Spring Integration and Spring Batch for just this kind of logic).
score: 1
comment on: http://stackoverflow.com/q/26424184
type: Comment

hive
tags question: http://stackoverflow.com/q/26483604
tags question: http://stackoverflow.com/q/26418069
type: Tag
tag name: hive
tags question: http://stackoverflow.com/q/26494987

encryption
tags question: http://stackoverflow.com/q/26486120
tags question: http://stackoverflow.com/q/26450335
tags question: http://stackoverflow.com/q/26367225
tags question: http://stackoverflow.com/q/26454004
tags question: http://stackoverflow.com/q/26412089
tags question: http://stackoverflow.com/q/26387112
tags question: http://stackoverflow.com/q/26421155
tags question: http://stackoverflow.com/q/26369350
tags question: http://stackoverflow.com/q/26485715
tag name: encryption
tags question: http://stackoverflow.com/q/26440622
tags question: http://stackoverflow.com/q/26512745
tags question: http://stackoverflow.com/q/26379484
tags question: http://stackoverflow.com/q/26440208
tags question: http://stackoverflow.com/q/26426151
tags question: http://stackoverflow.com/q/26461209
tags question: http://stackoverflow.com/q/26386808
tags question: http://stackoverflow.com/q/26495841
tags question: http://stackoverflow.com/q/26371108
tags question: http://stackoverflow.com/q/26457381
tags question: http://stackoverflow.com/q/26417876
tags question: http://stackoverflow.com/q/26400446
tags question: http://stackoverflow.com/q/26417778
type: Tag
tags question: http://stackoverflow.com/q/26392123

http://stackoverflow.com/q/26439821
has title: Sorting an arraylist of jsonobjects on a particular json element
has answer: http://stackoverflow.com/a/26445467
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
upvote count: 1
has answer: http://stackoverflow.com/a/26439892
has body: I have written some code that creates an array list of json data using the Gson library which looks something like this. { "filename": "somefile.mp3" "artist": "artist1" "title": "title1" "genre": "rock" } { "filename": "anotherfile.mp3" "artist": "artist2" "title": "title2" "genre": "electro" } Im trying to figure out how I can sort this array list by the artist element. Currently its just ordering it in the way it is created originally via the filename. Reading on stackoverflow suggests I should be trying to use a custom comparator. Ive been looking at this answer (How to sort GSON Array based on a key?) but its not working for me. I have a custom class called Tracks.class which has all the getters and setters set up holding title,artist,genre etc TrackFileManager.class is the serializer and where all the JsonObject.addProperty code is and returns a jsonObject back to MainActivity. this jsonObject then gets added to an ArrayList called values as below in MainActivity. (listOfFiles is another array list that holds all the filenames of my mp3s) final GsonBuilder gsonBuilder = new GsonBuilder(); gsonBuilder.registerTypeAdapter(Track.class, new TrackFileManager()); gsonBuilder.setPrettyPrinting(); //diasableHtmlEscaping stops &amp; turning into \u0026 final Gson gson = gsonBuilder.disableHtmlEscaping().create(); values = new ArrayList&lt;String&gt;(); for (String file : listOfFiles){ t = new Track(path,file); values.add(gson.toJson(t)); } Collections.sort(values, new MyJSONComparator()); The other code i have is a MyJSONComparator.class which is below public class MyJSONComparator implements Comparator&lt;String&gt; { @Override public int compare(String s1, String s2) { return s1.compareTo(s2); } } This produces no errors but it doesnt sort it which I know it wont but its the only way for it not hint errors in Android Studio. If I change the code to implements Comparator&lt;Track&gt; the Collections.sort produces an error. And unless I have comparator I can't access t…
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/18575757
tagged with: arraylist
tagged with: android
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26415898
answers question: http://stackoverflow.com/q/26415843
score: 0
type: Answer
has body: If you're following naming conventions, you could use the Java search in Eclipse to search your project for declarations of types that match the pattern *Activity.

http://stackoverflow.com/comment/41494309
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26390789
type: AnswerComment
has text: @MadProgrammer true, the whole case is pretty vague and might require different approaches depending on the application specifics, but still thanks for the useful tips - I will surely be using those to improve my apps :)

http://stackoverflow.com/comment/41572363
score: 0
comment on: http://stackoverflow.com/q/26466866
type: QuestionComment
type: Comment
has text: Can provide more info regarding the cluster spec (e.g. 2x100GB server) as well as a more verbose Exception stack trace. Also, from what you describe you are launching 40x16GB executors. Is the memory available?

http://stackoverflow.com/comment/41586478
type: Comment
type: QuestionComment
has text: Your for-loop has no backets.
comment on: http://stackoverflow.com/q/26474468
score: 0

http://stackoverflow.com/q/26455330
has answer: http://stackoverflow.com/a/26455367
tagged with: windows
accepted answer: http://stackoverflow.com/a/26455367
has title: addional gradle tasks not appearing
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
score: 0
answer count: 1
tagged with: build.gradle
has body: Please excuse me if this question has been asked before. I am installing Gradle on my Windows laptop. I placed my installation in Program Files and chagned the PATH envionment variable as required. When I type gradle in the command prompt everything is OK. Now I am starting to create the build.gradle file and the first thing I have placed in there is apply plugin:'java' which is supposed to bring up additional tasks when I type the gradle tasks command but no additional tasks are appearing. I am concerned that I am not placing the file in the right place so I have tried placing it in the bin directory and the top level Gradle directory. If it helps this is what I see when I type gradle tasks: I tried adding the --all option but this did not yield any further tasks. The steps I am following can be found here: http://spring.io/guides/gs/gradle/ (I'm using this site as I eventually want to install the Spring framework too)

http://stackoverflow.com/q/26381672
upvote count: 9
tagged with: java
has body: My query is this. Say, i have a custom annotation as follows: //rest of the code left out for the sake of brevity interface @Name{ String myName(); } Now, in the class where am using this annotation on say, a field or a method, i want to pass a value to "myName" from a property file, something like this: @Name(myName="${read.my.name}") public void something(){} Could anyone please suggest how can i read the value passed to 'myName' in my annotation-processor from the property file? I have read a bit about the use of placeholders and then using @Value but am not sure i can/should use this approach in say, a service class where i just want to have an annotated field or method marked with this annotation? Any guidance would be much appreciated. Thanks and regards!
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26382399
has title: How to pass value to a custom-annotation?
type: Question
favorite count: 0
score: 9
tagged with: annotations
tagged with: spring
answer count: 1

http://stackoverflow.com/q/26372126
tagged with: jgrasp
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/35332454
has body: An email address contains the @ character. Write a program that takes a word from the keyboard and outputs whether it is an email address based on the presence of the @ character. Do not worry about what else is in the word.
has answer: http://stackoverflow.com/a/35332735
has answer: http://stackoverflow.com/a/53344829
has comment: http://stackoverflow.com/comment/41401239
has comment: http://stackoverflow.com/comment/41401104
has comment: http://stackoverflow.com/comment/41401146
has title: jgrasp. need assistance. cannot figure out how to code this
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/41510803
has text: I agree, you should compile this locally with javac first and then see what errors you get.One hint is that there is no class declaration here.
score: 0
comment on: http://stackoverflow.com/q/26432913
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26503292
has comment: http://stackoverflow.com/comment/41639898
answers question: http://stackoverflow.com/q/26502955
has comment: http://stackoverflow.com/comment/41638388
type: Answer
has comment: http://stackoverflow.com/comment/41638638
has comment: http://stackoverflow.com/comment/41640853
accepted answer of: http://stackoverflow.com/q/26502955
score: 2
upvote count: 2
has body: Try using this @RequestMapping(value="/user", method = POST) public String addFromForm(@Valid @ModelAttribute("box") Man man, BindingResult bindingResult){ if (bindingResult.hasErrors()) { return "param"; } manService.saveMan(man); return "redirect:../list"; } as suggested by @M. Deinum While making POST request, you have to encode the data and reques. HTML forms provide three methods of encoding. If your form has a file with it, then you have to use multipart/form-data. I don't think for the normal forms you should be using it. Rather use application/x-www-form-urlencoded (it is in by default).
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26398836
type: Answer
has body: You should look here : http://cxf.apache.org/docs/dynamic-clients.html This is exactly that. here an example: ClientImpl client = (ClientImpl)doc.getClientFromWsdl("http://myurl:8080/DataCentersWS?wsdl"); String operationName = "getVirtualisationManagerUuid"; BindingOperationInfo op = doc.getOperation(client, operationName); List&lt;MessagePartInfo&gt; messagesParts = op.getInput().getMessageParts(); Object[] params = new Object[messagesParts.size()]; /* feed yours params here (this feeding was heavy in my code */ Object[] res = client.invoke(op, params); There is many other examples in the source distribution of cxf.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26354639
downvote count: 0

semaphore
type: Tag
tags question: http://stackoverflow.com/q/26466637
tags question: http://stackoverflow.com/q/26392015
tags question: http://stackoverflow.com/q/26455578
tag name: semaphore

http://stackoverflow.com/comment/41558183
type: QuestionComment
has text: Why is [tag:java] tagged?
comment on: http://stackoverflow.com/q/26458341
score: 0
type: Comment

http://stackoverflow.com/q/26468484
has title: Flume: org.apache.avro.ipc.NettyServer: Unexpected exception from downstream. java.nio.channels.ClosedChannelException
tagged with: flume
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/26479281
answer count: 2
tagged with: avro
has answer: http://stackoverflow.com/a/28773166
has body: How to solve the problem? When I config the flume server, it had the below questiosns. 2014-10-20 22:24:01,480 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /ip:57063 =&gt; /ip:34001] OPEN 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /ip:57063 =&gt; /ip:34001] BOUND: /ip:34001 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /10.182.4.70:57063 =&gt; /ip:34001] CONNECTED: /ip:57063 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /ip:57063 :&gt; /ip:34001] DISCONNECTED 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /ip:57063 :&gt; /10.182.4.79:34001] UNBOUND 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: [id: 0x2fe09f1a, /10.182.4.70:57063 :&gt; /10.182.4.79:34001] CLOSED 2014-10-20 22:24:01,481 INFO org.apache.avro.ipc.NettyServer: Connection to /10.182.4.70:57063 disconnected. 2014-10-20 22:24:01,481 WARN org.apache.avro.ipc.NettyServer: Unexpected exception from downstream. java.nio.channels.ClosedChannelException at org.jboss.netty.channel.socket.nio.AbstractNioWorker.cleanUpWriteBuffer(AbstractNioWorker.java:673) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:400) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:120) at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:59) at org.jboss.netty.channel.Channels.write(Channels.java:733) at org.jboss.netty.channel.Channels.write(Channels.java:694) at org.jboss.netty.handler.codec.compression.ZlibEncoder.finishEncode(ZlibEncoder.java:380) at org.jboss.netty.handler.codec.compression.ZlibEncoder.handleDownstream(ZlibEncoder.java:316) at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:55) at org.jboss.netty.channel.Channels.close(Channels.java:821) And the …
has answer: http://stackoverflow.com/a/26479281
score: 0
possible better answer: http://stackoverflow.com/a/28773166

http://stackoverflow.com/a/26476040
has comment: http://stackoverflow.com/comment/41618386
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26475889
has body: There are a number of ways to do this, SharedPreferences is one but I think the best mechanism would be to use a global context. You do this by overriding Application with a custom class. public class GlobalContext extends Application{ private String mSomething; public String getSomething() { return mSomething; } public void setSomething(String value) { mSomething = value; } That is then used in your manifest &lt;application android:name="com.example.GlobalContext" ... Then in all of your activities a call to getApplicationContext will return the instance of that class. final GlobalContext globalContext = (GlobalContext) getApplicationContext();
type: Answer
has comment: http://stackoverflow.com/comment/41598813

http://stackoverflow.com/a/26396128
has body: An alternative to using break is using a boolean variable : boolean codeExists = false; for(r = 0; r &lt; items.length &amp;&amp; !codeExists; r++){ for(int q=0; q&lt;r &amp;&amp; !codeExists; q++){ if(z==items[q].getCode()) { System.out.println("Item's code exists"); codeExists = true; } } } Both loops would be exited once codeExists becomes true.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26395403

http://stackoverflow.com/comment/41529180
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26443148
type: AnswerComment
has text: There's no need to add `break` for the `default` case

http://stackoverflow.com/comment/41492825
score: 0
has text: everytime onCreateView is called, is the id you setting changed atleast?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26423383

http://stackoverflow.com/a/26445047
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41533038
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41533000
accepted answer of: http://stackoverflow.com/q/26445028
answers question: http://stackoverflow.com/q/26445028
has body: Do the work inside the run method; and call whatever methods you wish to call. However, run and only run is called "within" the thread. In the posted code both post and get are not executed within the context of the xy thread; but instead in the context of the current thread. It is also possible to supply a Runnable to a thread, which once again has its run method invoked, such that the Thread does not need to be sub-classed. And yes, at some level this means creating different classes or otherwise embedding logic.
has comment: http://stackoverflow.com/comment/41532982

http://stackoverflow.com/comment/41442297
type: AnswerComment
has text: BTW, lots of good answers are being submitted.
type: Comment
comment on: http://stackoverflow.com/a/26395094
score: 0

http://stackoverflow.com/comment/42334797
type: AnswerComment
type: Comment
has text: @OvidiuLatcu see post
score: 1
comment on: http://stackoverflow.com/a/26813208

http://stackoverflow.com/comment/41536275
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26446909
has text: That worked perfectly! Again, thank you so much. I was struggling for the past hour or so with this program.
score: 0

http://stackoverflow.com/q/26482753
has body: I'm using some regex to validate an EditText and am trying to ensure that a user won't enter a space/whitespace. My current regex is: "^[A-Za-z0-9][\\w.-]+$"; Does anyone have any idea? I did a little research and discovered adding in \\s detects spaces but it didn't help. Thanks for any help!
has comment: http://stackoverflow.com/comment/41601239
type: UnansweredQuestion
tagged with: android
tagged with: regex
tagged with: android-edittext
has title: Ensuring a user doesn't enter a space in an EditText
has comment: http://stackoverflow.com/comment/41600877
tagged with: java
linked to: http://stackoverflow.com/q/3349121
has comment: http://stackoverflow.com/comment/41600891
type: Question
has comment: http://stackoverflow.com/comment/41600955
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26483081
has answer: http://stackoverflow.com/a/26483112
has answer: http://stackoverflow.com/a/26483530

http://stackoverflow.com/q/26372772
answer count: 1
has answer: http://stackoverflow.com/a/26372815
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26372815
upvote count: 1
has comment: http://stackoverflow.com/comment/41402244
downvote count: 1
type: Question
has title: Error calling a submit: java.io.NotSerializableException
tagged with: java
has body: There is a Web Panel from where a Call is made to a Procedure as a Submit. The Submit is sent an empty String and a collection SDT as parameter. When it is called, it fails with this error: java.io.NotSerializableException.How can I solve this?
score: 0

http://stackoverflow.com/q/26457823
type: Question
answer count: 1
tagged with: database
has title: String arrays to Database using Java?
tagged with: insert
has answer: http://stackoverflow.com/a/26457888
type: UnansweredQuestion
score: 0
tagged with: java
has body: I need to insert info on a database using Java. It's about Information Retrieval, I have a collection of 1400 documents each of them containing: ID, Title, Author, Area, Abstract. I have already organized the collection into 5 separate String arrays eliminating unnecesary characters and multiple spaces. What can I do to store this data into a table called Documents within my collection database? I'm thinking about something like... for(int i=0; i&lt;=1400; i++){ user.execute("INSERT INTO Documents (idDoc, title, author, area,abstract)") VALUES("+ID[i]+","+Title[i]+","+Author[i]+","+Area[i]+","+Abstract[i]"); } Is this the correct syntax? Is there an easier way to do it? Any help would be very appreciated. PS: I'm adding this before that loop: String url = "jdbc:mysql//localhost:3306/database"; Class.forName("com.mysql.jdbc.Driver").newInstance(); // register driver. Connection con = DriverManager.getConnection(url, "root", "root"); Statement user = con.createStatement();

http://stackoverflow.com/comment/41421100
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26379194
has text: You can create a main JPanel, which is visible when you launch the game. On this panel you can place JButtons for each menu options. For exmple a "[Start]", this button will set the main panel invisible and the your board panel visible. I do not know if it is a nice solution but I can imagine that it works.

http://stackoverflow.com/a/26391075
upvote count: 2
has body: /09 cannot be parsed as an integer, since it has a character which is not a digit - /. You should lose the leading slash : int ay = Integer.parseInt(tarih.substring(tarih.indexOf("/")+1,tarih.lastIndexOf("/")));
answers question: http://stackoverflow.com/q/26391047
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26358624
score: 1
favorite count: 0
type: Question
tagged with: hadoop-yarn
tagged with: java
upvote count: 1
has body: I'm having the following exception when running a simple YARN application, how I could get more information to debug the problem? Oct 14, 2014 12:29:19 PM dz.lab.yarn.simple.handler.RMCallbackHandler onContainersCompleted INFO: container 'container_1410790353365_0036_02_000002' status is ContainerStatus: [ContainerId: container_1410790353365_0036_02_000002, State: COMPLETE, Diagnostics: Exception from container-launch: ExitCodeException exitCode=1: ExitCodeException exitCode=1: at org.apache.hadoop.util.Shell.runCommand(Shell.java:538) at org.apache.hadoop.util.Shell.run(Shell.java:455) at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:702) at org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor.launchContainer(DefaultContainerExecutor.java:195) at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:300) at org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainerLaunch.call(ContainerLaunch.java:81) at java.util.concurrent.FutureTask.run(FutureTask.java:262) 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:745) What's
answer count: 1
tagged with: hadoop
has comment: http://stackoverflow.com/comment/41449958
has comment: http://stackoverflow.com/comment/41432915
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43374569
has title: ExitCodeException on Yarn containers
downvote count: 0

http://stackoverflow.com/comment/41548098
has text: I added my code, im not sure if its right but i should be getting a system.out.print
comment on: http://stackoverflow.com/a/26453441
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41508578
score: 0
has text: I don't see how the question is wrong. It has small code and the question is legit, it also includes the compilation errors now.
type: Comment
comment on: http://stackoverflow.com/a/26431907
type: AnswerComment

http://stackoverflow.com/q/26387743
tagged with: php
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/41429338
has comment: http://stackoverflow.com/comment/41430009
tagged with: javascript
type: UnansweredQuestion
tagged with: servlets
has answer: http://stackoverflow.com/a/26388066
has body: I am trying to upload images via a drag and drop interface, I got the JavaScript code here but the server side code is implemented in PHP as shown below (I modified it to insert the image to database): &lt;?php //Connect to database mysql_connect("localhost", "root", "something-strange") or die(mysql_error()); mysql_select_db("business_clax") or die(mysql_error()); // The posted data, for reference $file = $_POST['value']; $name = $_POST['name']; if(!isset($file)) { echo "Please select an image."; } //This is the line of code I really want in Java $image = addslashes(file_get_contents($file)); //SQL Injection defence! $image_name = addslashes($name); $sql = "UPDATE `adverts` SET `photos` = '{$image}' WHERE `id` = '1'"; if (!mysql_query($sql)) { // Error handling echo "Something went wrong! :("; } ?&gt; The code above is working very well but I need to implement this in Java. I tried to implement the code above in a Java Servlet but I have no idea how to do the file_get_contents($file) and the addslashes(file_get_contents($file)); functions in Java, I think there must be an equivalent method. Please I need help. Thanks.
has title: How can I implement this PHP code in Java Servlet
type: Question

http://stackoverflow.com/comment/41527223
has text: your code is perfect. I don't even need t use replaceall function
type: AnswerComment
comment on: http://stackoverflow.com/a/26441938
type: Comment
score: 0

http://stackoverflow.com/a/26449039
accepted answer of: http://stackoverflow.com/q/26444591
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: Integer.getInteger does not convert a string to an integer. The easiest way to get a single number from a query is to use DatabaseUtils: long count = DatabaseUtils.longForQuery(db, "SELECT COUNT(*) FROM " + TABLE_TEAM, null); But to get the number of rows in the table, there's an even simpler function: long count = DatabaseUtils.queryNumEntries(db, TABLE_TEAM); Furthermore, when you give an integer to TextView.setText, it expects a resource ID. You have to convert your count into a string manually: tvText.setText(Integer.toString(teams));
upvote count: 1
answers question: http://stackoverflow.com/q/26444591

http://stackoverflow.com/a/26408121
has body: The problem is that you fail to account for the process' standard output/error (as mentioned by @Yazan in the comments). You need to .get{Output,Error}Stream() from the created process and read from them (even if it is only to discard it). The real problem however is that you use an external shell script for something which is entirely doable in Java itself. See this page which gives an example of how to extract a zip file entirely with Java code; to delete a file, use Files.delete().
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26403272

http://stackoverflow.com/comment/41464467
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26407838
has text: I appreciate your perspective. I have indeed not tried to invent my own password hashing scheme. My application basically encrypts files with a password using AES system. The per-file password is hashed with BCrypt and stored inside the file. The second level of security is a password for the application itself. This I need to store in a secure manner.
score: 0

http://stackoverflow.com/q/26413834
has answer: http://stackoverflow.com/a/26415828
type: Question
accepted answer: http://stackoverflow.com/a/26415828
upvote count: 2
answer count: 1
tagged with: email
favorite count: 0
has body: I've setup a mail Resource definition in my context.xml &lt;Resource name="MyMailSession" auth="Container" type="javax.mail.Session" mail.smtp.sendpartial="true" mail.debug="true" mail.smtp.host="myhost.hosting.com" /&gt; And a mail utility which looks up the mail session's JNDI: public int send() throws Exception { int msgCount = 0; //number of recipients Context ctx = new InitialContext(); Session session = (Session) ctx.lookup("java:comp/env/mail/MyMailSession"); MimeMessage message = new MimeMessage(session); But am getting the following exception: javax.naming.NameNotFoundException: Name [mail/MyMailSession] is not bound in this Context. Unable to find [mail]. at org.apache.naming.NamingContext.lookup(NamingContext.java:820) at org.apache.naming.NamingContext.lookup(NamingContext.java:168) ... Is the mail tag necessary as a prefix to the Resource name when it comes to mail or is it more of a convention? (i.e., looking up a User Transaction would be set as java:comp/UserTransaction)
has title: javax.naming.NameNotFoundException: Unable to find mail
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/41599417
type: Comment
has text: But does that explain the out of bounds exceptions ?
comment on: http://stackoverflow.com/a/26481878
score: 1
type: AnswerComment

http://stackoverflow.com/q/26361092
has comment: http://stackoverflow.com/comment/41380738
has comment: http://stackoverflow.com/comment/41381549
type: Question
has title: XMLpullparser is not showing listview items
score: 0
has comment: http://stackoverflow.com/comment/41380794
tagged with: android
tagged with: sqlite
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41380951
has comment: http://stackoverflow.com/comment/41380649
answer count: 0
type: UnansweredQuestion
tagged with: xmlpullparser
has comment: http://stackoverflow.com/comment/41381376
has comment: http://stackoverflow.com/comment/41380874
has body: I am working on a hotel application in which each hotel will be shown on a listview of the city calling each hotel through xmlpullparser but my db return 0 rows i don't know why i think this class has a problem please check it package com.hamza.khihotel.db; import java.util.ArrayList; import java.util.List; import com.hamza.khihotel.model.Hotel; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class HotelDataSource { private static final String LOGTAG = "khiHotel"; HoteldbOpenHelper dbHelper; SQLiteDatabase database; private static final String allAttributes[] = { HoteldbOpenHelper.HOTEL_ID, HoteldbOpenHelper.HOTEL_TITLE, HoteldbOpenHelper.HOTEL_DESC, HoteldbOpenHelper.HOTEL_IMAGE, HoteldbOpenHelper.HOTEL_PRICE, HoteldbOpenHelper.HOTEL_LINK }; public HotelDataSource(Context context) { dbHelper = new HoteldbOpenHelper(context); } public void open() { database = dbHelper.getWritableDatabase(); } public void close() { dbHelper.close(); } public Hotel create(Hotel hotel) { ContentValues keyValues = new ContentValues(); keyValues.put(HoteldbOpenHelper.HOTEL_TITLE, hotel.getTitle()); keyValues.put(HoteldbOpenHelper.HOTEL_DESC, hotel.getDescription()); keyValues.put(HoteldbOpenHelper.HOTEL_IMAGE, hotel.getImage()); keyValues.put(HoteldbOpenHelper.HOTEL_PRICE, hotel.getPrice()); keyValues.put(HoteldbOpenHelper.HOTEL_LINK, hotel.getLink()); long insertId = database.insert(HoteldbOpenHelper.TABLE_NAME, null, keyValues); hotel.setId(insertId); return hotel; } public List&lt;Hotel&gt; allData() { Cursor cursor = database.query(HoteldbOpenHelper.TABLE_NAME, allAttributes, null, null, null, null, null); //**check this logtag this shows i am not getting the rows** Log.i(LOGTAG, "Returned" + cursor.getCount() + "rows"); List&lt;Hotel&gt; hotels = cursorToList(cursor); return hotels; } /* public List&lt;Hotel&gt; findFiltered(String selection, String or…
tagged with: java

http://stackoverflow.com/comment/41536279
score: 1
comment on: http://stackoverflow.com/q/26446865
type: Comment
type: QuestionComment
has text: you are trying to be a programmer, so you need to be more specific about your condition. what do you mean by it does not work?!!!1

http://stackoverflow.com/a/26377515
has body: Smart pointers are often concerned with allocation/deallocation and shared_ptr is no exception. When you want references to objects without caring about allocations, use a reference or a pointer. Is there a specific reason you can't use an ordinary pointer for your task?
answers question: http://stackoverflow.com/q/26375215
has comment: http://stackoverflow.com/comment/41414484
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/125786632

http://stackoverflow.com/q/26471225
has answer: http://stackoverflow.com/a/28783223
has title: Spring 3.1 or Later @RequestMapping Consumes/Produces
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26472310
tagged with: java
has body: I have a question in regards to the consumes and produces part of the @RequestMapping. I have an endpoint that I want to accept both JSON and XML and return JSON when JSON is passed in and return XML when XML is passed in. Is there anything special that I have to do to make this work? Sample code is listed below. @RequestMapping(value = "/something", method = PUT, consumes = {APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE}, produces = {APPLICATION_JSON_VALUE, APPLICATION_XML_VALUE}) public SomeObject updateSomeObject(SomeObject acct) { return doStuff(acct); } Will this work the way I'm expecting or do I need two endpoints updateSomeObjectXML and updateSomeObjectJson to handle both cases? Thanks, Mike
tagged with: media-type
upvote count: 24
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/26471619
has answer: http://stackoverflow.com/a/26472310
downvote count: 0
score: 24
favorite count: 0
tagged with: rest
possible better answer: http://stackoverflow.com/a/28783223

http://stackoverflow.com/a/26407864
score: 2
has comment: http://stackoverflow.com/comment/41466069
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26407453
answers question: http://stackoverflow.com/q/26407453
has body: you can use DefaultListModel to implement this. DefaultListModel has method setElementAt("value " ,index).using this method you can change value of double clicked item. adding this line d.setElementAt("MY NEW VALUE", index); will give the result you expected. DefaultListModel d = new DefaultListModel(); d.addElement("first value"); d.addElement("second value"); final JList list = new JList(d); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); //??????? CHANGEVALUE(index,"MY NEW VALUE); ???????? d.setElementAt("MY NEW VALUE", index); } } }); JOptionPane jpane = new JOptionPane(); jpane.showMessageDialog(null, list, "MYTITLE", JOptionPane.PLAIN_MESSAGE);
upvote count: 2
type: Answer

http://stackoverflow.com/q/26408277
tagged with: java
type: Question
tagged with: admob
answer count: 2
possible better answer: http://stackoverflow.com/a/26410273
has answer: http://stackoverflow.com/a/26410273
has answer: http://stackoverflow.com/a/26416371
accepted answer: http://stackoverflow.com/a/26416371
upvote count: 1
tagged with: android
has title: libGDX: Trying to implement AdMob but can't get it to work
favorite count: 0
has comment: http://stackoverflow.com/comment/41473671
has body: I've been busy going through a bunch of documentation and tutorials to figure out how to implement AdMob into my game, but no luck so far. The LibGDX wiki documentation is a bit outdated and some of the code is simply not working -> link f.e. initializeForView doesn't take in boolean values anymore , or the adView method can't be used like this anymore: View gameView = initializeForView(new HelloWorld(this), false); .... or // Create and setup the AdMob view adView = new AdView(this, AdSize.BANNER, "xxxxxxxx"); // Put in your secret key here adView.loadAd(new AdRequest()); I also worked through the Google AdMob documentation enter link description here, but it isn't very good aplicable to a LibGDX project. I even tried just getting it running with AndroidStudio without using libgdx, but even that I didn't get to work accordingly. I tried to work around it, but after a full days of tryingI still haven't been able to get any test ads on my android device when debugging on my device &amp; any help would be more than welcome. Can someone help me with this? Does anyone know some more up to date info on how to set up AdMob in your libgdx project? Here's what my AndroidManifest.xml looks like: [url=http://www.java-gaming.org/index.php?action=pastebin&amp;hex=f9d35261d1111[/url] And here's a version of my AndroidLauncher.java that I was hoping to show me some adds but it isn't:[url=http://www.java-gaming.org/?action=pastebin&amp;id=1113[/url]
has comment: http://stackoverflow.com/comment/41490660
type: AnsweredQuestion
downvote count: 0
tagged with: libgdx
score: 1

http://stackoverflow.com/a/26378473
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26378407
has body: First, you're not calculating MD5 but SHA-1: MessageDigest md = MessageDigest.getInstance("SHA-1"); Change it to: MessageDigest md = MessageDigest.getInstance("MD5"); Second, to convert a byte array to String, you have 2 options: either convert it to a hex string (preferred) or to a base64 string. Here is how you can convert byte[] to String: Convert from byte array to hex string in java
has comment: http://stackoverflow.com/comment/41412442
accepted answer of: http://stackoverflow.com/q/26378407
type: AcceptedAnswer

http://stackoverflow.com/q/26511190
tagged with: eclipse
type: Question
has title: MainActivity.java errors
has comment: http://stackoverflow.com/comment/41653040
has comment: http://stackoverflow.com/comment/41652560
has comment: http://stackoverflow.com/comment/41652611
has comment: http://stackoverflow.com/comment/41652738
has comment: http://stackoverflow.com/comment/41652764
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41652698
has body: Im getting trouble compiling a simple hello world app. I am getting errors in my mainActivity.java file and not sure whats wrong. This was created by Eclipse. R. is coming up as an error when trying to compile/Run. Here are the errors shown in the compiler: package com.example.myfirstapp; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @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); } }
has comment: http://stackoverflow.com/comment/41652428
has answer: http://stackoverflow.com/a/26511658
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41652820
linked to: http://stackoverflow.com/q/26519059
has comment: http://stackoverflow.com/comment/41653029
tagged with: java

http://stackoverflow.com/q/26395561
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/4118670
has answer: http://stackoverflow.com/a/26395787
type: Question
has comment: http://stackoverflow.com/comment/41808344
has body: I am trying to run a simple controller with a method that will receive A String with a value A file (MultipartFile object) After some investigation (Sending Multipart File as POST parameters with RestTemplate requests) I ended up adding into my web.xml multipartFilter org.springframework.web.multipart.support.MultipartFilter multipartFilter /REST/* My application context file 104857600 4096 The controller looks like @Controller @RequestMapping("/image") public class ImageController extends RestApiController { private static final Logger log = LoggerFactory.getLogger(ImageController.class); @RequestMapping(value="/simple", method = RequestMethod.POST, consumes="multipart/form-data") public @ResponseBody boolean save( @RequestParam(value = "file", required = false) MultipartFile file, @RequestParam(value = "name", required = false) String name) { //Some code here return true; } So far I have been able to run unit tests against the controller with no problem, but I seem to be stuck when it comes to create a real http request. I have tried with POSTMAN, but after some investigation seems that it does not set the multipart/form-data header properly, I have tried removing it, and the problem persists. I have also tried with CURL curl http://127.0.0.1:8080/content/REST/image/simple -F "file=@/home/jmoriano/Pictures/simple.jpeg" -F "name=someName" -v I have also tried with a RestTemplate object public Boolean update() { RestTemplate restTemplate = new RestTemplate(); try { FormHttpMessageConverter formConverter = new FormHttpMessageConverter(); formConverter.setCharset(Charset.forName("UTF8")); restTemplate.getMessageConverters().add(formConverter); restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory()); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setAccept(Collections.singletonList(MediaType.parseMediaType("application/json"))); MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>(); parts.add("file", new FileSyst…
has title: Spring MVC MultipartFile problems
upvote count: 1
tagged with: multipartform-data
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26395787
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/41560821
has text: Which LAFs give you the problem and which don't (I need fully qualified names)? `SystemLookAndFeel` doesn't help because it's not a name.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26454845

http://stackoverflow.com/comment/41639664
type: Comment
comment on: http://stackoverflow.com/a/26504133
score: 1
has text: Better use a text editor that is not limited to `\r\n` linebreaks.
type: AnswerComment

http://stackoverflow.com/comment/41433895
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26388551
has text: Sorry, seeing overuse/misuse of Holders a lot lately. It's like I went away for ~8-9 months and this weird antipattern is now in every new plugin, SO answers, etc. Using Holders is the opposite of IoC and DI - you're pulling instead of injecting. There are a few cases where it seems impractical to do anything else, but here, it's easy - add a DI for `grailsApplication` and instead of `Holders.config` use `grailsApplicaton.config`. Most fixes are like that or slightly more. E.g. what to do in src/groovy? It's not isolated - it's called by controller/service/etc. Pass beans & config in. Simple.

http://stackoverflow.com/comment/41592260
comment on: http://stackoverflow.com/a/26477579
score: 0
type: Comment
has text: could you show us the code which instantiated this `FragmentScan`?
type: AnswerComment

http://stackoverflow.com/q/26357684
answer count: 2
upvote count: 1
has title: get matched elements indexes from string object
downvote count: 1
type: UnansweredQuestion
has body: Lets say, search string is "Hellothisissanjayhelloiamjavadeveloperhello" And Search pattern is * Hello* I want to get starting and ending indexes of each matched strings like first Hello--- start index=0, end = 4, second Hello-- start index=22, end = 26, like this
has answer: http://stackoverflow.com/a/26358410
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26357855
has comment: http://stackoverflow.com/comment/41373906
tagged with: regex
tagged with: java
score: 0

http://stackoverflow.com/comment/41397076
type: QuestionComment
comment on: http://stackoverflow.com/q/26369907
has text: Post the rest of your code you probably need to change userInput.charAt(index) to theString.charAt(index);
score: 0
type: Comment

http://stackoverflow.com/a/64320782
type: Answer
has body: We recently had this exact same issue because we had mis-configured the javamelody.storage-directory. JavaMelody logs someting like: exception while collecting data: java.io.IOException: JavaMelody directory can't be created: /path/to/storage/dir/_4814f02a7626 in the logs section of the web-interface. It appears that Java Melody keeps all request data in memory when it is unable to write its data to the storage location causing this massive memory leak. This memory leak turns up in the heap dump as an huge instance of class net.bull.javamelody.internal.model.Counter.
score: 2
accepted answer of: http://stackoverflow.com/q/26431093
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26431093
upvote count: 2

http://stackoverflow.com/q/26453824
has answer: http://stackoverflow.com/a/26453898
has title: Using instanceof operator
tagged with: instanceof
score: 0
type: UnansweredQuestion
has body: I have a listener class which listens to message objects. The messages objects are checked for instance types and appropriate action is taken once instance type is determined. Below is the sample code public void onMessage(IMessage message){ if(message instanceof MoPn) { doThis(); } else if(message instanceof MoAn) { doThat(); } else if(message instanceof MoBn) { doSomethingElse(); } } I know this is not the best possible way of doing this, but for legacy reasons, I cant change it. The point now is I wanted to make the message handling asynchronous. All I would like to do is check if the message falls in the category I am interested in. If yes, put it in the Queue for async processing. Below is the sample class. public class SampleClass { List&lt;Class&lt;? extends IMessage&gt;&gt; messageClasses = new ArrayList&lt;Class&lt;? extends IMessage&gt;&gt;(); SampleClass() { messageClasses.add(moAn.class); messageClasses.add(moBn.class); messageClasses.add(moPn.class); } public void onMessage(IMessage message) { for(IMessage messageClass : messageClasses) { if(message instanceof messageClass) { putItInTheQueue(message); } } } } When I code like the above, I cant cast my message class properly. Can somebody help me writing syntactically correct code for the below statement? if(message instanceof messageClass )
has answer: http://stackoverflow.com/a/26453974
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41548704
has answer: http://stackoverflow.com/a/26453896
answer count: 3
has comment: http://stackoverflow.com/comment/41548797

highest
tag name: highest
tags question: http://stackoverflow.com/q/26496752
type: Tag

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/26369286

http://stackoverflow.com/a/26394898
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In order to have these icons displayed in the action bar for this activity as well, do I need to add those methods and update onOptionsItemSelected method in DisplayMessageActivity.java as well as in MainActivity.java? Is this the only way to carry the action bar icons/actions over? To retype the same methods in each activity that you want them in? Or is there a better way to do it? That is certainly one solution, but as you obviously know, it's not a very good one. There are at least two alternative solutions: Create a MenuActivity class which implements all the logic for common menu items and then extend this class from all of your activities, rather than extending the standard Activity class. Use fragments to implement your UI. Fragments are similar to activities in that they create UI elements from an XML layout. One difference is that they live inside a "host activity". In this particular case, the host activity will provide the common menu functionality and each fragment can customize it further depending on your needs. How is it that settings and the vertical dots are carried over? Most likely your DisplayMessageActivity overrides onCreateOptionsMenu() and inflates a menu XML layout which was created by Android Studio (or Eclipse?) when you created the activity class.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26394799
answers question: http://stackoverflow.com/q/26394799

http://stackoverflow.com/a/26475703
has comment: http://stackoverflow.com/comment/41588861
answers question: http://stackoverflow.com/q/26475570
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You should put numberOfTries += 1 inside if ( guess == answer ), this way it counts the correct answer as well if ( guess == answer) { numberOfTries += 1; // &lt;--- This adds the final guess System.out.println ("YOU WIN!"); System.out.println("It took you " + numberOfTries + " tries!") ; System.out.println(); System.out.print( "Do you want to play again(Y/N)?"); }
score: 1
accepted answer of: http://stackoverflow.com/q/26475570
upvote count: 1
has comment: http://stackoverflow.com/comment/41588764

http://stackoverflow.com/q/26464989
favorite count: 0
has comment: http://stackoverflow.com/comment/41568028
tagged with: android
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26465013
tagged with: java
has title: how to display html content in listview in android?
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/26465013
has body: I am developing the android application in whch i need to display html content of webpages into my list view. I have used simple adapter to display web content. I am able to retriveing the contents of webpage but problem is it is showing html tag along with content. If you have any solution please reply. Thanks in advance
upvote count: 4
answer count: 1

http://stackoverflow.com/q/26473494
has title: In JAVA, can we use predefined class name as a variable name?
has comment: http://stackoverflow.com/comment/41584445
type: Question
possible better answer: http://stackoverflow.com/a/26473831
has comment: http://stackoverflow.com/comment/41584409
downvote count: 9
has comment: http://stackoverflow.com/comment/41584472
has comment: http://stackoverflow.com/comment/41585252
has comment: http://stackoverflow.com/comment/41584463
score: -7
has comment: http://stackoverflow.com/comment/41584435
tagged with: class
has answer: http://stackoverflow.com/a/26473831
answer count: 3
accepted answer: http://stackoverflow.com/a/26473612
has comment: http://stackoverflow.com/comment/41584410
favorite count: 0
has answer: http://stackoverflow.com/a/26473571
upvote count: 2
has body: An interviwer asked this question. I answered False. Am I correct?
has comment: http://stackoverflow.com/comment/41584405
has answer: http://stackoverflow.com/a/26473612
has comment: http://stackoverflow.com/comment/41584832
has comment: http://stackoverflow.com/comment/41584693
has comment: http://stackoverflow.com/comment/41584750
has comment: http://stackoverflow.com/comment/41584566
has comment: http://stackoverflow.com/comment/41584471
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41584401
tagged with: java
has comment: http://stackoverflow.com/comment/41585063

http://stackoverflow.com/comment/41553252
comment on: http://stackoverflow.com/q/26456340
type: QuestionComment
has text: yes, it reduce the size when you call `remove(...)` method. And your program will end unexpectedly, but actually it is the expected result.
score: 0
type: Comment

http://stackoverflow.com/a/26413234
accepted answer of: http://stackoverflow.com/q/26413024
answers question: http://stackoverflow.com/q/26413024
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41474525
has comment: http://stackoverflow.com/comment/41475029
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/41474765
score: 1
has body: The following error indicates that you probably have a conflict with jar versions: java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z The orphanRemoval attributes requires JPA 2.x. My guess is that you did not include the JPA 2.x jar in your deployment, or you included it along with an older, conflicting version. Try adding the JPA 2.x jar to the classpath of your deployed app. For Hibernate, the jar should be called something like hibernate-jpa-2.x-api-1.0.x.Final.jar. Also make sure that no older version is included.

http://stackoverflow.com/comment/41639768
has text: @TimB the first option may be, for a large n. I don't think you can easily beat the second version performance wise.
type: Comment
comment on: http://stackoverflow.com/a/26504252
score: 0
type: AnswerComment

http://stackoverflow.com/q/26497024
tagged with: instance
has answer: http://stackoverflow.com/a/26497239
possible better answer: http://stackoverflow.com/a/26497104
type: Question
has body: I want to write a generic method (either with generics or with param) that will replace these two calls: private ServerEvent filterEvents() { return argThat(new ArgumentMatcher&lt;ServerEvent&gt;() { @Override public boolean matches(Object argument) { return argument instanceof Type1; } }); private ServerEvent filterEvents() { return argThat(new ArgumentMatcher&lt;ServerEvent&gt;() { @Override public boolean matches(Object argument) { return argument instanceof Type2; } }); I have tried this, but got compilation errors: private &lt;T&gt; ServerEvent filterEvents() { return argThat(new ArgumentMatcher&lt;ServerEvent&gt;() { @Override public boolean matches(Object argument) { return argument instanceof T; } }); update: I have tried this also, but still got compiliation error: verify(loggerUtilsWrapper).writeEvent(filterEvents(MatchNotFoundEvent.class)); private ServerEvent filterEvents(final Class&lt;MatcherEvent&gt; eventType) { return argThat(new ArgumentMatcher&lt;ServerEvent&gt;() { @Override public boolean matches(Object argument) { return argument instanceof eventType; } }); }
tagged with: java
score: 4
upvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/26497239
tagged with: types
downvote count: 0
linked to: http://stackoverflow.com/q/12766233
tagged with: generics
favorite count: 0
has title: how to write a java method with generic class type?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26497104

http://stackoverflow.com/comment/41396464
type: Comment
has text: I've tried to ignore that for the moment and simply read an array of objects, however I get the following error: Type mismatch: cannot convert from Rational to Rational[]
type: AnswerComment
comment on: http://stackoverflow.com/a/26367898
score: 0

http://stackoverflow.com/a/26431656
score: 1
has body: Just pass the name, not the type. int x = arraysAndMethods.main(arr); EDIT: Besides that, your code shows a few other problems. main(...) is the entry point to your application. It doesn't make sense to call main(...) from the other method. It should be the other way around. main(...) HAS TO have the following signature: public static void main(String[] args). You cannot declare it to return an array of double.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26431566
downvote count: 0

http://stackoverflow.com/comment/41543576
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26451021
has text: create your custom scope http://javapapers.com/spring/custom-scope-for-spring-bean/ in your implementation if your scope is not defined then change it to singleton as name instead of your undefinedScope (Assuming you know what would be the string value of your scope tag that you are going to use)
score: 0

http://stackoverflow.com/q/26497159
has body: I am using GWT FlexTable to show numeric values. If I use a Label label and setWidget(row,col, label) I can use gwtquery to fade the colors like this: $(label).css("backgroundColor",color_from); $(label).animate("backgroundColor:'" + color_to + "'", 5000, new Function() { public void f(Element e) { } }); The effect is a nice fade from "color_from" to "color_to". I would like to know how I can do this directly on the Tables cell, without having to create a Label for each cell where I want to use this effect. Is that possible?
tagged with: css
tagged with: flextable
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
has title: Howto fade color of cell in GWT FlexTable
answer count: 1
tagged with: jquery
has answer: http://stackoverflow.com/a/26497615
accepted answer: http://stackoverflow.com/a/26497615
score: 0

http://stackoverflow.com/q/26504826
has title: Error java executing: Couldn't find or load the main class
has comment: http://stackoverflow.com/comment/41640751
type: UnansweredQuestion
has body: I'm trying to execute a simple java code (I have already compiled it with no problems) but it gives me the next error: c:\Users\alejandro\Desktop> java HelloWorld.java Error: Couldn't find or load the main class. The code is the next: public class HelloWorld{ public static void main(String[] args){ System.out.println("Hello world!"); } } I have set the PATH variable correctly. I have deleted CLASSPATH variable. I have both files (.java and .class) in my Desktop.
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26504876
has answer: http://stackoverflow.com/a/26504910
tagged with: java
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/41640788
favorite count: 0
tagged with: windows
has comment: http://stackoverflow.com/comment/41640701
upvote count: 0

http://stackoverflow.com/a/26372815
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26372772
has body: The thrown exception is telling you what is the problem. You need to make the required object to be serializable. It can be done by implementing java.io.Serializable interface : class MySerializableClass implements Serializable {} Now MySerializableClass is serializable and can be used as bean etc.
accepted answer of: http://stackoverflow.com/q/26372772

http://stackoverflow.com/q/26385147
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: bitmap
tagged with: java
has answer: http://stackoverflow.com/a/26385330
has title: Convert downloaded image to png/jpeg from bitmap, and display in imageView - Android
type: Question
has body: I currently have the below code, which goes to a specified URL, pulls down whatever image is there, converts it to a bitmap and then display's it in an imageView. However, I have noticed that when I am scrolling through my listView which contains these bitmaps; the scrolling has gone jerky (as multiple bitmap's are being renderd). My question is. How would I, given the below code, convert the downloaded bitmap into a png/jpeg format and display that in an imageView? So that the listView's scrolling will no longer be jerky. I do not want to save it to a file and then load that file from the phone, as there could potentially be 100+ images being downloaded at one time. The bitmap code: //This downloads the image from thr url passed, and converts into a bitmap format; so that android compilers can read it and then display it. private Bitmap GetImageBitmapFromUrl(string url) { Bitmap imageBitmap = null; // bmp.compress(Bitmap.CompressFormat.PNG, 100, out); //100-best quality using (var webClient = new WebClient()) { var imageBytes = webClient.DownloadData(url); if (imageBytes != null &amp;&amp; imageBytes.Length &gt; 0) { imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); } } return imageBitmap; } How I am binding it to the imageView: var imageBitmap = GetImageBitmapFromUrl(item.imgURL); view.FindViewById&lt;ImageView&gt;(Resource.Id.Image).SetImageBitmap((Bitmap.CreateScaledBitmap(imageBitmap, 100, 100, false)));
answer count: 2
has answer: http://stackoverflow.com/a/26385418

http://stackoverflow.com/a/26374396
answers question: http://stackoverflow.com/q/26374023
has body: Put This Code in onPreExecute() like shown Below @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); // product with this pid found // Edit Text txtName = (TextView) findViewById(R.id.app_name); txtVersion = (TextView) findViewById(R.id.app_version); txtDesc = (TextView) findViewById(R.id.desc_app); pDialog.show(); }
type: Answer
score: 0

http://stackoverflow.com/comment/41452040
has text: @TheLostMind http://stackoverflow.com/questions/1961146/memory-address-of-variables-in-java http://stackoverflow.com/questions/580984/how-do-you-get-the-object-reference-of-an-object-in-java-when-tostring-and-h
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26400923

http://stackoverflow.com/q/26477610
answer count: 1
accepted answer: http://stackoverflow.com/a/26477654
has title: Java Program throws NullPointerException
has comment: http://stackoverflow.com/comment/41592085
upvote count: 2
linked to: http://stackoverflow.com/q/4166966
has comment: http://stackoverflow.com/comment/41592131
linked to: http://stackoverflow.com/q/1922677
score: 2
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/1922677
has body: I'm trying to write a program to create a media object, I created the Cassette class which inherits from Audio which inherits from Media. I'm getting a null pointer exception and I have been trying for hours to fix it but I have no idea why it's being thrown. I appreciate your help in advance, thank you. In my application class I initiate the following: static Media[] collection = new Media[100]; And later on in the code I try to create a new Cassette object but it gives me the said null pointer exception. The code I have is: collection[collection[0].getNumItems()] = new Cassette(cTitle, cMajorArtist, cPlayingTime, cNumPlays, cNumGroupMembers, cGroupMembers, pArtist, cNumSongs, cSongs); All of the items being passed into the Cassette are all user input data. It compiles fine but it's just when I run it that I get an error. EDIT Here is the numItems value in my media class. static int numItems = 0; And the method to return the number of items: public int getNumItems() { return numItems; } Thanks.
type: Question
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/41592106
has comment: http://stackoverflow.com/comment/41592113
has answer: http://stackoverflow.com/a/26477654
favorite count: 0
tagged with: nullpointerexception

http://stackoverflow.com/q/26416847
has comment: http://stackoverflow.com/comment/41571758
tagged with: eclipselink
has answer: http://stackoverflow.com/a/48120001
has title: EclipseLink batch insert very very slow
tagged with: jpa
downvote count: 0
possible better answer: http://stackoverflow.com/a/38791288
favorite count: 0
has answer: http://stackoverflow.com/a/26427887
accepted answer: http://stackoverflow.com/a/26427887
has body: I'm trying to optimize my JPA implementation, using EclipseLink. I've added batch operations to it. But it is still taking A LOT of time to do 50 000 inserts. It takes more than 10 times the amount of time it takes to do the exact same insert using raw SQL with JDBC. To make sure batch operations were in fact working I used Wireshark to check my packets and it is not using batch inserts. Here's one of the insert packets: It is not doing: INSERT INTO ENTITYCLASSTEST (LASTNAME, NAME) VALUES ('sfirosijfhgdoi 0', 'dsufius0'), ('sfirosijfhgdoi 0', 'dsufius0'), ('sfirosijfhgdoi 0', 'dsufius0'), ('sfirosijfhgdoi 0', 'dsufius0')... and so on I was expecting it to do as above but it is inserting one line per packet and not multiple lines per packet. Here's is my Entity Class: @Entity public class EntityClassTest implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String lastname; public EntityClassTest() { } public EntityClassTest(Long id, String name, String lastname) { this.id = id; this.name = name; this.lastname = lastname; } public EntityClassTest(String name, String lastname) { this.name = name; this.lastname = lastname; } public Long getId() { return id; } public String getName() { return name; } public String getLastName() { return lastname; } public void setId(Long id) { this.id = id; } public void setName(String name) { this.name = name; } public void setLastName(String lastname) { this.lastname = lastname; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof EntityClassTest)) { return false; } EntityClassTest other = (EntityClassTest) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { re…
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/41537140
type: AnsweredQuestion
tagged with: java
score: 6
tagged with: mysql
has answer: http://stackoverflow.com/a/38791288
type: Question
has comment: http://stackoverflow.com/comment/41590521
has answer: http://stackoverflow.com/a/26447620
linked to: http://stackoverflow.com/q/18474046

http://stackoverflow.com/q/26369950
type: Question
has title: What is the reason behind this Eclipse behavior due to changing an Environment Variable?
answer count: 1
has body: I have two versions of Eclipse that I use (Indigo for C++ and Helios for Java). I've used both for years without problems. Last week I needed to view Java Bytecode, so in my Environment Variables I added "C:\Program Files\Java\jdk1.6.0_26\bin;" to the Path variable (this let me use javap 'class' -c to view bytecode in a command prompt). I continued to use Helios just fine. Today I tried booting up Indigo to work on some C++ code, but I got the "Failed to load JNI shared library etc." error for it, causing it to force close. Eventually I tried removing that path I placed in environment variables, and Indigo boots up correctly again. Any idea why this happened? I don't fully understand paths, but I don't see why adding the path I did would cause my other Eclipse to break. I don't really need javap anymore so I removed the path, but I'm still curious as to why this happened. Thanks for any insight!
tagged with: c++
has answer: http://stackoverflow.com/a/26370045
score: 0
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26370045

method-hiding
tag name: method-hiding
type: Tag
tags question: http://stackoverflow.com/q/26407300

http://stackoverflow.com/q/26446684
has answer: http://stackoverflow.com/a/26446805
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41535807
has comment: http://stackoverflow.com/comment/41535935
tagged with: memory
downvote count: 1
type: Question
has title: Delete an object that was created in an arraylist in a loop Java
has answer: http://stackoverflow.com/a/26446697
has answer: http://stackoverflow.com/a/26446807
has answer: http://stackoverflow.com/a/26446743
has answer: http://stackoverflow.com/a/26446694
upvote count: 4
has answer: http://stackoverflow.com/a/26446729
score: 3
answer count: 7
possible better answer: http://stackoverflow.com/a/26446694
favorite count: 0
has body: I'm trying to delete an object that I created in an ArrayList: turtles.add(new Turtle()); I want to get rid of the last turtle in the ArrayList, something like this: turtles.get(turtles.size() - 1) = null; Any ideas? Simply removing from the list doesn't work, and Java won't let me nullify in the above way. I'm pretty sure there is only be a single reference to a given Turtle object, as they are only ever created in this way. P.S: The Turtle class is a thread, in case that matters.
accepted answer: http://stackoverflow.com/a/26446743
tagged with: multithreading
has answer: http://stackoverflow.com/a/26446836
has comment: http://stackoverflow.com/comment/41536030

http://stackoverflow.com/q/26381015
tagged with: unsigned
tagged with: java
upvote count: 10
linked to: http://stackoverflow.com/q/9854166
has title: How to output the absolute value of an Unsigned integer in java
has body: I want to assign 4294967295 to a variable (2^32-1) It is obvious that I can't do that with Integer, and can do it with Long. However, I noted that Java 8 offers Unsigned Integers (at least some methods). Does any one know what the method, Integer.parseUnsignedInt() does? When I input "4294967295" to that, and print the variable, it gives the output as -1 (-2 for 4294967294, -3 for 4294967293 and so on...) Is there a way that I can still have 4294967295 in a variable? Am I missing something here? a=Integer.parseUnsignedInt("4294967295"); System.out.println(a); This gives the output as -1 but I expected 4294967295.
possible better answer: http://stackoverflow.com/a/26381137
downvote count: 0
duplicate of: http://stackoverflow.com/q/9854166
has answer: http://stackoverflow.com/a/26381137
accepted answer: http://stackoverflow.com/a/26381114
has comment: http://stackoverflow.com/comment/41416798
tagged with: int
type: AnsweredQuestion
score: 10
favorite count: 0
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/41417041
tagged with: java-8
has answer: http://stackoverflow.com/a/26381114
has answer: http://stackoverflow.com/a/26381134

http://stackoverflow.com/comment/41587027
comment on: http://stackoverflow.com/q/26474741
has text: You are aware that Integer.valueOf("1001100101", 2) will do this for you?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26354414
accepted answer of: http://stackoverflow.com/q/26353774
type: Answer
has comment: http://stackoverflow.com/comment/41445740
answers question: http://stackoverflow.com/q/26353774
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41445249
has comment: http://stackoverflow.com/comment/41448136
upvote count: 2
has body: If you want to use a single table for Activity and ActivityLink then you have to use Table Per Class hierarchy strategy. Follow below link for details: 10.1.1. Table per class hierarchy So your mapping should look something like this: <discriminator column="ACTIVITY_TYPE" type="string"/> ... Update: If you want to create a table for the sub-class ActivityLink then you need to use the below strategy: 10.1.2. Table per subclass For example: <key column="Activity_ID"/> ...
type: AcceptedAnswer

hadoop
tags question: http://stackoverflow.com/q/26355311
tags question: http://stackoverflow.com/q/26441011
tags question: http://stackoverflow.com/q/26355676
tags question: http://stackoverflow.com/q/26460177
tag name: hadoop
tags question: http://stackoverflow.com/q/26426228
tags question: http://stackoverflow.com/q/26464607
tags question: http://stackoverflow.com/q/26494987
tags question: http://stackoverflow.com/q/26448325
tags question: http://stackoverflow.com/q/26467568
type: Tag
tags question: http://stackoverflow.com/q/26502339
tags question: http://stackoverflow.com/q/26382989
tags question: http://stackoverflow.com/q/26446903
tags question: http://stackoverflow.com/q/26398438
tags question: http://stackoverflow.com/q/26390988
tags question: http://stackoverflow.com/q/26507382
tags question: http://stackoverflow.com/q/26468484
tags question: http://stackoverflow.com/q/26361236
tags question: http://stackoverflow.com/q/26483604
tags question: http://stackoverflow.com/q/26484873
tags question: http://stackoverflow.com/q/26360322
tags question: http://stackoverflow.com/q/26423361
tags question: http://stackoverflow.com/q/26473297
tags question: http://stackoverflow.com/q/26375269
tags question: http://stackoverflow.com/q/26361470
tags question: http://stackoverflow.com/q/26484582
tags question: http://stackoverflow.com/q/26358624
tags question: http://stackoverflow.com/q/26382936
tags question: http://stackoverflow.com/q/26392406
tags question: http://stackoverflow.com/q/26469256
tags question: http://stackoverflow.com/q/26511436
tags question: http://stackoverflow.com/q/26452565
tags question: http://stackoverflow.com/q/26418768
tags question: http://stackoverflow.com/q/26364057
tags question: http://stackoverflow.com/q/26442342
tags question: http://stackoverflow.com/q/26420512
tags question: http://stackoverflow.com/q/26357204
tags question: http://stackoverflow.com/q/26361722
tags question: http://stackoverflow.com/q/26418069
tags question: http://stackoverflow.com/q/26410094
tags question: http://stackoverflow.com/q/26430087
tags question: http://stackoverflow.com/q/26398680
tags question: http://stackoverflow.com/q/26378230

http://stackoverflow.com/comment/41456217
score: 0
has text: I have no idea what you are trying to do in `isNonDescending` You are supposed to check if there are any instances in which the next element is bigger than the current element, and if yes, then return true, else if no such was found then return false
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26403574

http://stackoverflow.com/comment/64581309
type: QuestionComment
comment on: http://stackoverflow.com/q/26429967
score: 0
has text: I opened an issue referencing this question. https://github.com/spring-projects/spring-security/issues/3995
type: Comment

http://stackoverflow.com/comment/41644012
type: Comment
score: 0
has text: @Sebastian That will throw an error too. `String str1` is a string, not an Integer. And a `(int)` cast it's safe in this case.
type: AnswerComment
comment on: http://stackoverflow.com/a/26505708

http://stackoverflow.com/q/26503857
answer count: 1
has answer: http://stackoverflow.com/a/26524962
type: UnansweredQuestion
tagged with: java
tagged with: sshj
has body: I want to read from stdout of long-running command. There is a program, which sends me some output and I have to send some response. The problem is that nothing is arriving to inputstream. What am I doing, is exec'ing command, take InputStream from command and trying to read from there. SSHClient client = new SSHClient(); client.addHostKeyVerifier(new IgnoreHostKeyVerifier()); client.connect(getHostname(), getSshPort()); client.authPassword(getUsername(), getPassword()); Session sess = client.startSession(); Command cmd = sess.exec("/root/av_run/alarms"); InputStream is = cmd.getInputStream(); os = cmd.getOutputStream(); int piece; while (true) { if (is.available() &gt; 0) { piece = is.read(); } else { Thread.sleep(500); continue; } } Here, is.available() is always zero. If I read without that condition, reading is blocked forever. How do I read stdout of a running program?
type: Question
score: 0
has title: sshj, read InputStream from long-running command

http://stackoverflow.com/comment/41532312
score: 0
type: Comment
type: QuestionComment
has text: @jameslarge http://stackoverflow.com/questions/2674174 , http://stackoverflow.com/questions/4830302 , http://stackoverflow.com/questions/15841301/ , http://stackoverflow.com/questions/25094229 , http://stackoverflow.com/questions/25586271 , http://stackoverflow.com/questions/23907118
comment on: http://stackoverflow.com/q/26443831

http://stackoverflow.com/a/26496153
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26496016
has body: The problem is that you are creating a new ArrayList in every recursion. And you are not returning it anywhere. What you should do is, in the helper method, also pass the target ArrayList as a parameter, and add to it rather than a new one. (And of course, don't forget to return when you're done).
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41628108
type: QuestionComment
score: 1
has text: So just pick the counter that is the largest and go from there
comment on: http://stackoverflow.com/q/26497549
type: Comment

http://stackoverflow.com/q/26359806
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41377770
tagged with: java
tagged with: bash
answer count: 2
possible better answer: http://stackoverflow.com/a/26359999
has comment: http://stackoverflow.com/comment/41377657
tagged with: alias
has answer: http://stackoverflow.com/a/26359999
tagged with: jsch
score: 0
tagged with: linux
has body: I want to use an alias in my JSch-connection. I successfully built a connection to the Linux-Server. In the Linux-Server there's an alias for ls -l called ll. When I type the alias in PuTTY I have no problems, but through JSch I get the following Error: bash: ll: command not found What the hell is wrong here? Here's a preview of my code: package test; import java.io.InputStream; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelExec; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import com.jcraft.jsch.UIKeyboardInteractive; import com.jcraft.jsch.UserInfo; public class SSHConnection { private static String host = "", username = "", password = ""; private static int port = 22; private static String[] commands = {"ll /", "df -h"}; public static void main(String[] arg) { try { JSch jsch = new JSch(); Session session = jsch.getSession(username, host, port); session.setPassword(password); UserInfo ui = new MyUserInfo() { public void showMessage(String message) {} public boolean promptYesNo(String message) { return true; } }; session.setUserInfo(ui); session.connect(); for (String command : commands) { Channel channel = session.openChannel("exec"); // runs commands ((ChannelExec) channel).setCommand(command); // setting command channel.setInputStream(null); ((ChannelExec) channel).setErrStream(System.err); // Error input InputStream in = channel.getInputStream(); channel.connect(); byte[] temp = new byte[1024]; //temporary savings System.out.println("Hostname:\t" + host + "\nCommand:\t" + command + "\n\nResult:\n----------"); while (true) { // reads while the inputStream contains strings while (in.available() &gt; 0) { int i = in.read(temp, 0, temp.length); if (i &lt; 0) break; System.out.print(new String(temp, 0, i)); } if (channel.isClosed()) { if (in.available() &gt; 0) continue; if (channel.getExitStatus() != 0) { // Error-Check System.out.println("----------\nExit-status: " + channel.getExitStatus() + "\n\n"); } else { System.out.println("\…
has title: How to use an alias on server with JSch?
has answer: http://stackoverflow.com/a/26367281
accepted answer: http://stackoverflow.com/a/26367281

http://stackoverflow.com/comment/41460647
has text: its showing connection error while in command line typing Telnet fdb12.biz.nf 3306
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26389011
score: 0

http://stackoverflow.com/comment/41367742
comment on: http://stackoverflow.com/q/26354088
has text: How are you running it via Visual Studio at all? How is your .NET code calling Java code? Please give a *lot* more context - this is an unusual situation.
score: 0
type: Comment
type: QuestionComment

uibinder
tags question: http://stackoverflow.com/q/26480214
type: Tag
tag name: uibinder

http://stackoverflow.com/comment/41644360
type: Comment
score: 0
type: AnswerComment
has text: actually in windows 8 when u right click on some application icon present in the task bar there are options such as close all and standard close option but for some application such as the Eclipse.there are more option such as "new task" , "activate task". thats what i want to add in my application.but thank you for ur response. for more eg. when google chrome icon is right clicked the pop up contains Most visited pages.
comment on: http://stackoverflow.com/a/26506033

http://stackoverflow.com/q/26467672
has body: I'm writing a program where I have to write back out the numbers I am given until I get the number 42. For example: Input: 5 6 4 42 1 0 Output 5 6 4 So far, I have tried this: package com.logical01; import java.util.Scanner; public class MainProgram { public static void main(String[] args) { int[] array = new int[100]; Scanner in = new Scanner(System.in); System.out.println("Enter the number of elements: "); int n_Elements = in.nextInt(); System.out.println("Enter the values now: "); for (int i = 0; i &lt; n_Elements; i++) { array[i] = in.nextInt(); } for (int i = 0; i &lt; n_Elements; i++) { if (i == 42) { break; } System.out.println("\n"+array[i]); } } } However, this program does not work; it writes back the same values out (rather than stopping when there's a 42).
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41573106
has title: Why is my code not executing the break statement?
has comment: http://stackoverflow.com/comment/41573030
has comment: http://stackoverflow.com/comment/41572988
has answer: http://stackoverflow.com/a/26467880
upvote count: 1
tagged with: break
downvote count: 7
score: -6
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26467750
tagged with: java
has comment: http://stackoverflow.com/comment/41573075

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/26371195
tags question: http://stackoverflow.com/q/26468635

http://stackoverflow.com/comment/41498865
score: 0
type: Comment
type: QuestionComment
has text: Of course it is one and it has nothing to do with Hibernate. Add it fifty times and it will still be one: From the Java API, "A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction."
comment on: http://stackoverflow.com/q/26425932

http://stackoverflow.com/a/26434840
upvote count: 3
has comment: http://stackoverflow.com/comment/41514493
type: AcceptedAnswer
has body: Use the comparison operator == to compare values, not the assignment operator =, which can't assign a value to a value, only to a variable. Change if ((a*a) + (b*b) = (c*c)) to if ((a*a) + (b*b) == (c*c))
has comment: http://stackoverflow.com/comment/41514508
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26434826
answers question: http://stackoverflow.com/q/26434826

http://stackoverflow.com/comment/41652738
type: Comment
type: QuestionComment
has text: try to add compile 'com.android.support:appcompat-v7:21.0.0' dependency
comment on: http://stackoverflow.com/q/26511190
score: 0

http://stackoverflow.com/q/26413910
has title: Time Complexity of a Binary Search Tree Insert method
downvote count: 0
tagged with: algorithm
has comment: http://stackoverflow.com/comment/41475924
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/45390989
type: Question
score: 5
has comment: http://stackoverflow.com/comment/41475916
linked to: http://stackoverflow.com/q/15322386
has comment: http://stackoverflow.com/comment/41475898
has body: Good day! I have a question regarding the time complexity of a binary search tree insertion method. I read some of the answers regarding this but some were different from each other. Is the time complexity for a binary search tree insertion method O(log n) at average case and O(n) at worst case? Or is it O(n log n) for the average case and O(n^2) for the worst case? When does it become O(n log n) at average case and O(n^2) at worst case?
answer count: 1
tagged with: insert
tagged with: binary-search-tree
upvote count: 5
has comment: http://stackoverflow.com/comment/41481809
type: UnansweredQuestion

http://stackoverflow.com/comment/41414985
type: QuestionComment
comment on: http://stackoverflow.com/q/26379889
score: 0
has text: you can use PostMan in chrome, or use HTTP analyzer
type: Comment

http://stackoverflow.com/q/26485992
has title: Android: A PendingIntent is a form of an Intent, then why isn't PendingIntent a subclass of Intent?
upvote count: 1
answer count: 1
downvote count: 0
tagged with: inheritance
favorite count: 0
has body: They say that Generally, when there exists an "is-a" relationship between two entities, there is an inheritance relationship in terms of OOP. For example "A mountain bike is a bicycle." So MountainBike is a subclass of Bicycle as well, as a MountainBike inherits the properties of Bicycle, and has some of its own as well. Now, generally speaking a PendingIntent is an Intent, isn't it? So why is a PendingIntent a subclass of Intent? Reference: Developer docs
tagged with: android
has answer: http://stackoverflow.com/a/26486089
accepted answer: http://stackoverflow.com/a/26486089
tagged with: android-pendingintent
tagged with: android-intent
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/41421443
comment on: http://stackoverflow.com/q/26380923
has text: The Java program needs to read in a file produced by the CPP_CL which will then be root owned will it not?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26444805
accepted answer of: http://stackoverflow.com/q/26443352
has body: jTsearch.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { //whatever you want } public void removeUpdate(DocumentEvent e) { //whatever you want } public void insertUpdate(DocumentEvent e) { //whatever you want } } });
downvote count: 0
score: 5
type: AcceptedAnswer
upvote count: 5
answers question: http://stackoverflow.com/q/26443352
type: Answer

http://stackoverflow.com/q/26363834
has title: Error on basic Java program - cannot find symbol ActionListener()
has comment: http://stackoverflow.com/comment/41385617
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41385418
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41385299
upvote count: 1
has answer: http://stackoverflow.com/a/26363889
type: Question
has comment: http://stackoverflow.com/comment/41385287
has body: I have pieced together the following HelloWorld type of program that opens a window, displays a button and then handles the button click by closing the window. I am getting an error when compiling on the part where I am adding the ActionListener to handle the click event. Looking at other samples and tutorials around the net, this looks like it should work. Any ideas? import java.util.*; import javax.swing.*; import java.awt.*; public class MyTest{ public static void main(String args[]) throws Exception { JFrame guiFrame = new JFrame("Test Frame"); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setTitle("Example GUI"); guiFrame.setSize(300,250); guiFrame.setLocationRelativeTo(null); JButton btn = new JButton("Hit Me"); btn.addActionListener( new ActionListener(){ @Override public void actionPerformed(ActionEvent event) { guiFrame.close(); } }); guiFrame.add(btn, BorderLayout.SOUTH); guiFrame.setVisible(true); } } Error: javac MyTest.java MyTest.java:17: error: cannot find symbol btn.addActionListener( new actionListener(){ ^ symbol: class actionListener location: class MyTest 1 error
possible better answer: http://stackoverflow.com/a/26363889
has answer: http://stackoverflow.com/a/26364061
has answer: http://stackoverflow.com/a/26363966
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41386033
accepted answer: http://stackoverflow.com/a/26363966
favorite count: 0
linked to: http://stackoverflow.com/q/18674797

http://stackoverflow.com/q/26478228
type: Question
has title: Java array of size 0
has answer: http://stackoverflow.com/a/26478576
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41593217
tagged with: arrays
has comment: http://stackoverflow.com/comment/41593268
has comment: http://stackoverflow.com/comment/41593187
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41593165
type: UnansweredQuestion
has body: So I just discovered that Java allows us to create arrays of size 0. Does that mean that the array is both empty and full at the same time? I figured this out while working on an array based implementation of a priority queue. Would it be right to say that it is empty and full at the same time when calling methods checking for this? Or should I not allow the creation of an array of size 0? Thanks.
upvote count: 0
has comment: http://stackoverflow.com/comment/41593252

http://stackoverflow.com/a/26470481
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26470429
score: 6
has comment: http://stackoverflow.com/comment/41578562
has comment: http://stackoverflow.com/comment/41579526
has body: First get the position of the string that you want to get the space before, then use that position to get the closest previous position of space int idx1 = str.indexOf("min"); int lastSpace = str.lastIndexOf(" ", idx1);
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26470429

http://stackoverflow.com/a/26432255
answers question: http://stackoverflow.com/q/26432197
has comment: http://stackoverflow.com/comment/41516213
score: 2
downvote count: 0
has body: If it is always two lettes, a space, a T, and a number then you could do : String id = "CA T 4443" String result = id.substring(0, 2) + id.substring(5, id.length); Or you could just do : String result = id.replace(" T ", "");
has comment: http://stackoverflow.com/comment/41516337
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41563453
type: Comment
comment on: http://stackoverflow.com/a/26461649
type: AnswerComment
has text: I understand. Check my answer once again. You have tried the wrong URI, try `http://awis.amazonaws.com/doc/2005-07-11`. And be careful with `/` at the end. One of the namespaces has it, the other one has not.
score: 0

http://stackoverflow.com/comment/42378883
type: AnswerComment
has text: Normally jt400.jar is preinstalled on the system (with native optimizations) somewhere under ...ProdData... You can refer directly to that in your classpath.
type: Comment
comment on: http://stackoverflow.com/a/26461706
score: 0

http://stackoverflow.com/comment/41543305
type: Comment
has text: Did that and there is another error: FATAL EXCEPTION: main java.lang.IllegalArgumentException: No view found for id 0x7f07003c (com.example.gasper.test:id/pager) for fragment GamesFragment{426229d0 #1 id=0x7f07003c android:switcher:2131165244:1}
type: AnswerComment
comment on: http://stackoverflow.com/a/26450969
score: 0

http://stackoverflow.com/a/26419359
upvote count: 6
has comment: http://stackoverflow.com/comment/41485354
downvote count: 0
score: 6
has body: You can use Calender for this. Calendar calendar=Calendar.getInstance(); // current time System.out.println(calendar.getTime()); calendar.add(Calendar.MINUTE,3); // add 3 minutes to current time System.out.println(calendar.getTime()); Out put: Fri Oct 17 12:17:13 IST 2014 Fri Oct 17 12:20:13 IST 2014
answers question: http://stackoverflow.com/q/26419339
type: Answer

http://stackoverflow.com/comment/41536372
has text: Generics don't work with primitives.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26447035

http://stackoverflow.com/comment/41602006
type: QuestionComment
has text: What is on the r.menu.main file? Can you post it?
comment on: http://stackoverflow.com/q/26483303
score: 1
type: Comment

http://stackoverflow.com/q/26424878
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 2
has title: Jersey REST service as Mule pooled component doesn't work as expected
answer count: 0
downvote count: 0
tagged with: java
type: Question
tagged with: jersey
tagged with: mule
upvote count: 2
tagged with: rest
has comment: http://stackoverflow.com/comment/48784526
has body: I am trying to get a Jersey resource working as a pooled component in Mule ESB 3.4.0. The Mule flow configuration looks like this (the Jersey resource is managed by Spring): &lt;jersey:resources doc:name="REST"&gt; &lt;pooled-component&gt; &lt;spring-object bean="myRestResource"/&gt; &lt;pooling-profile maxActive="3"/&gt; &lt;/pooled-component&gt; &lt;/jersey:resources&gt; This is defined inside the &lt;flow/&gt; tag. I assumed that this will produce 3 instances of the service which will be reused. When running 100 calls to the service (each call in its own thread), I see that only one instance of the service (Jersey resource) is called if annotaed with @Singleton, and 100 different instances are called without @Singleton. How can I ensure that only 3 instances are created and reused?

http://stackoverflow.com/comment/41555017
type: QuestionComment
score: 1
has text: This might help: http://stackoverflow.com/q/11588916/535275
comment on: http://stackoverflow.com/q/26457381
type: Comment

http://stackoverflow.com/comment/41380223
score: 0
type: Comment
type: AnswerComment
has text: can u tell me why it is happening?
comment on: http://stackoverflow.com/a/26360466

http://stackoverflow.com/a/26392565
upvote count: 2
has body: First, you have an Object[] and you're making it pass as E[] by using E[] elements = (E[]) new Object[10]; This is the culprit of all the problems. Why is this a problem? You cannot even create such array. It will compile with no problems, but theorically (and at runtime) this is invalid. Here's an example with Integer[]: Integer[] stringArray = (Integer[])new Object[10]; This line throws an error at runtime: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer; But generics hides this problems until you have to use the data directly. Let's try this piece of code: public class Array&lt;E&gt; { public E[] elements = (E[]) new Object[10]; } public class Client { public static void main(String[] args) { Array&lt;Integer&gt; array = new Array&lt;&gt;(); array.elements[0] = 5; } } The whole code compiles with no problems, and the initialization of array works as expected. But now we get a new exception: array.elements[0] = 5; //java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer; Which means that internally we're still working with an Object[] but trying to make it work as Integer[], or more formally, as E[] (which is wrong as stated in 1.). Let's add an append method (adapted from code posted by OP): public class Array&lt;E&gt; { public E[] elements = (E[]) new Object[10]; private int size = 0; public void append(E element) { elements[size++] = element; } } public class Client { public static void main(String[] args) { Array&lt;Integer&gt; array = new Array&lt;&gt;(); array.append(5); System.out.println(array.elements[0]); } } Here, we will obtain the runtime error here: System.out.println(array.elements[0]); //java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Integer; Due to the same reasons explained above. Note that this will be the case for your three examples in your post. In short: You should not use E[] array directly. Instead, use Object[] array as described in A…
answers question: http://stackoverflow.com/q/26391600
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26457883
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Getting dependency artifacts in a Maven plugin
has body: I'm trying to write a Maven plugin somewhat similar to the well-known exec:java mojo. It creates a class loader, loads the project's artifacts into Maven's JVM, and does something with them. Here's my code to create the class loader: Set&lt;URL&gt; urls = new HashSet&lt;URL&gt;(); try { for (Object artifactObject : project.getCompileArtifacts()) { Artifact artifact = (Artifact) artifactObject; urls.add(artifact.getFile().toURI().toURL()); } urls.add(project.getArtifact().getFile().toURI().toURL()); } catch (MalformedURLException ex) { throw new RuntimeException(ex); // this really shouldn't happen } ClassLoader loader = new URLClassLoader(urls.toArray(new URL[urls.size()])); According to the scant documentation I could find, and the source code for exec:java, project.getCompileArtifacts() should return the direct and indirect dependencies with compile scope. But it is returning an empty list. What's up?
upvote count: 1
tagged with: maven-plugin
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/a/41020436
answers question: http://stackoverflow.com/q/26435836
score: 0
has body: Example I use with automatic table generation Apart from DATABASE_URL, which is always there, Heroku creates 3 environment variables at Runtime. They are: JDBC_DATABASE_URL JDBC_DATABASE_USERNAME JDBC_DATABASE_PASSWORD As you may be aware, Spring Boot will automatically configure your database if it finds spring.datasource.* properties in your application.properties file. Here is an example of my application.properties spring.datasource.url=${JDBC_DATABASE_URL} spring.datasource.username=${JDBC_DATABASE_USERNAME} spring.datasource.password=${JDBC_DATABASE_PASSWORD} spring.jpa.show-sql=false spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=update Hibernate / Postgres Dependencies In my case I'm using Hibernate (bundled in spring-boot-starter-jpa with PostgreSQL, so I needed the right dependencies in my build.gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-data-jpa") compile('org.postgresql:postgresql:9.4.1212') }
type: Answer

http://stackoverflow.com/q/26507083
has answer: http://stackoverflow.com/a/26507124
has answer: http://stackoverflow.com/a/26507122
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26507243
upvote count: 1
downvote count: 1
type: Question
has title: Java program output strange result
has body: I am having an output problem with my java code. I am trying to implement this multiply matrix method and it compiles just fine. The only problem is my output. I seem to be getting the following: ---- Test Multiply Matrix ---- [[D@7f31245a Should return C={{ 3, 2},{ 1, 1}} Can someone please help me understand where I am going wrong here. Thanks! Here is my source code: public class Recommendation { public static double[][] multiplyMatrix(double[][] A, double[][] B) { int aRows = A.length; int bRows = B.length; int aColumns = A[0].length; int bColumns = B[0].length; if((aColumns != bRows)) { return null; } else { double[][] C = new double[aRows][bColumns]; for (int i = 0; i &lt; 2; i++) { for (int j = 0; j &lt; 2; j++) { C[i][j] = 0; } } for (int i = 0; i &lt; aRows; i++) { for (int j = 0; j &lt; bColumns; j++) { for (int k = 0; k &lt; aColumns; k++) { C[i][j] += A[i][k] * B[k][j]; } } } return C; } } static double [][] A = {{ 1, 0, 2}, { 0, 1, 1}}; static double [][] B = {{1, 2}, { 0, 1}, { 1, 0}}; public static void main(String[] argss) { // TEST multiplyMatrix System.out.println(" ---- Test Multiply Matrix ---- "); System.out.println(multiplyMatrix(A,B)); // should return C={{ 3, 2},{ 1, 1}} System.out.println("Should return C={{ 3, 2},{ 1, 1}}"); System.out.println(" "); } }
has answer: http://stackoverflow.com/a/26507165
has answer: http://stackoverflow.com/a/26507108
answer count: 6
has answer: http://stackoverflow.com/a/26507232
score: 0
possible better answer: http://stackoverflow.com/a/26507232
favorite count: 0
accepted answer: http://stackoverflow.com/a/26507108

http://stackoverflow.com/comment/55472012
has text: @noti as indicated by the code, it is indeed jus the read method that generates this "garbage". I did however not find a solution and I'm not sure it is possible to avoid having the method generate these bytes.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26366941
type: Comment

http://stackoverflow.com/q/26378810
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26379272
has title: How to call default error pages in dev mode but not production (Play Framework 2.3.4 - Java)
has body: Following the docs I was able to implement custom error handlers in my application by overriding methods in the GlobalSettings class: @Override public Promise&lt;Result&gt; onBadRequest(RequestHeader request, String error) { return Promise.&lt;Result&gt; pure(Results.notFound(com.me.project.views.html.pages.ErrorPage .render(Constants.HTTP_400))); } @Override public Promise&lt;Result&gt; onHandlerNotFound(RequestHeader request) { return Promise.&lt;Result&gt; pure(Results.notFound(com.me.project.views.html.pages.ErrorPage .render(Constants.HTTP_404))); } @Override public Promise&lt;Result&gt; onError(RequestHeader request, Throwable t) { return Promise.&lt;Result&gt; pure(Results.notFound(com.me.project.views.html.pages.ErrorPage .render(Constants.HTTP_500))); } However I only want these to be used in production and not in development, as the errors being displayed in the browser are quite useful. I am able to detect whether the application is in dev mode using: boolen isDev = play.api.Play.isDev(play.api.Play.current()); However I cannot call the default error pages as I do not know how. How do you call the default error pages? I have looked at the code here, but my Scala is poor and I cannot seem to get it working. The parts that I though I should port to java in my global object were: private def defaultErrorHandler: HttpErrorHandler = { Play.maybeApplication.fold[HttpErrorHandler](DefaultHttpErrorHandler) { app =&gt; app.injector.instanceOf[DefaultHttpErrorHandler] } } and def onError(request: RequestHeader, ex: Throwable): Future[Result] = defaultErrorHandler.onServerError(request, ex) def onHandlerNotFound(request: RequestHeader): Future[Result] = defaultErrorHandler.onClientError(request, play.api.http.Status.NOT_FOUND) def onBadRequest(request: RequestHeader, error: String): Future[Result] = defaultErrorHandler.onClientError(request, play.api.http.Status.BAD_REQUEST, error) But I cannot port this as things like Play.maybeApplication cannot be resoled (are th…
tagged with: playframework
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26379272

http://stackoverflow.com/a/26419147
answers question: http://stackoverflow.com/q/26413063
has body: You XML, you need to add two textview in a row, one for the Nasi elements and another for the price elements. Try something like this, <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/textView1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView3" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView4" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView5" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView6" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textAppearance="?android:attr/textAppearanceMedium" /> And change your java code to match the names of the widgets set in the XML. Something like below, just watch-out and make necessary changes wherever required. if(nsPutih==true) { tvOutput1.setText("Nasi Putih"); tvOutput2.setText("RM 1.00"); tvOutput1.setVisibility(View.VISIBLE); tvOutput2.setVisibility(View.VISIBLE); price+=1; } else { tvOutput1.setVisibility(View.GONE); tvOutput2.setVisibility(View.GONE); } if (nsTomato==true) { tvOutput3.setText("Nasi Tomato"); tvOutput3.setVisibility(View.VISIBLE); tvOutput4.setText("RM 1.20"); tvOutput4.setVisibility(View.VISIBLE); price+=1.2; } else { tvOutput3.setVisibility(View.GONE); tvOutput4.setVisibility(View.GONE); } if(nsHja…
score: 0
type: Answer

http://stackoverflow.com/comment/41512766
has text: I'm not sure that it's an honorable thing to avoid the utilities. They are often optimized beyond what a single mere programming team would bother with. In addition they likely have over a decade of debugging in them, with a much larger audience trying to find the bugs.
comment on: http://stackoverflow.com/q/26433861
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26452873
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/37876919
tagged with: eclipse
has body: I recently upgraded my CPU from core2duo E4600 to E6550. E6550 is supports virtualization. Then i install HAXM intel hardware acceleration manager.Installation was successful. People on youtube and many other sites says it fast the emulator but in my case my emulator is not even starting.. I have this configuration of device AVD doesn't even show that "A valid android virtual device" in the bottom... it shows two options only Please suggest me... how to run my emulator.. i have searched a lot.
accepted answer: http://stackoverflow.com/a/26455620
downvote count: 0
has answer: http://stackoverflow.com/a/26455218
has answer: http://stackoverflow.com/a/67116541
has title: HAXM is installed but emulator not running
tagged with: android
tagged with: haxm
possible better answer: http://stackoverflow.com/a/26455218
favorite count: 0
score: 2
has answer: http://stackoverflow.com/a/31285673
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/26455620
tagged with: emulation

http://stackoverflow.com/q/26401673
tagged with: java
has answer: http://stackoverflow.com/a/26402586
tagged with: unit-testing
type: Question
tagged with: matcher
has body: I want to return 4 when instance of Person class by [name = "Mohammad", age = 26] where called. I want to return 5 when instance of Person class by [name = "Ali", age = 20] where called. So I have these classes: public class Person { private String name; private int age; My DAO class: public class DAO { public int getA(Person person) { return 1; } public int getB(Person person) { return 2; } } Here is calculator class public class Calculator { private DAO dao; public int add() { dao = new DAO(); return dao.getA(new Person("Mohammad", 26)) + dao.getB(new Person("Ali", 20)); } } and this is my test: @Test public void testAdd() throws Exception { when(mydao.getA(new Person("Mohammad", 26))).thenReturn(4); when(mydao.getB(new Person("Ali", 20))).thenReturn(5); whenNew(DAO.class).withNoArguments().thenReturn(mydao); assertEquals(9, cal.add()); } So why my test will failed?
has title: How to stub a method when instance of specific object specific fields passed?
answer count: 2
accepted answer: http://stackoverflow.com/a/26402586
tagged with: hamcrest
downvote count: 0
has answer: http://stackoverflow.com/a/26402068
favorite count: 0
possible better answer: http://stackoverflow.com/a/26402068
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/41630527
type: Comment
type: QuestionComment
has text: Avoid using `null` layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify
score: 1
comment on: http://stackoverflow.com/q/26498950

http://stackoverflow.com/comment/41549993
has text: Happy to help, if you have any specific questions on those feel free to ask and I'll do my best to answer anything particular you might not understand.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26454408

for-loop
tags question: http://stackoverflow.com/q/26436856
tags question: http://stackoverflow.com/q/26363381
tags question: http://stackoverflow.com/q/26454407
tags question: http://stackoverflow.com/q/26492545
tags question: http://stackoverflow.com/q/26368464
tags question: http://stackoverflow.com/q/26455210
tags question: http://stackoverflow.com/q/26392558
tags question: http://stackoverflow.com/q/26453542
tags question: http://stackoverflow.com/q/26375128
tags question: http://stackoverflow.com/q/26397820
tags question: http://stackoverflow.com/q/26457697
tags question: http://stackoverflow.com/q/26475985
tags question: http://stackoverflow.com/q/26456879
tags question: http://stackoverflow.com/q/26422897
tags question: http://stackoverflow.com/q/26488340
tags question: http://stackoverflow.com/q/26396730
tags question: http://stackoverflow.com/q/26459514
tags question: http://stackoverflow.com/q/26354678
tags question: http://stackoverflow.com/q/26372920
tags question: http://stackoverflow.com/q/26432498
tags question: http://stackoverflow.com/q/26473973
tags question: http://stackoverflow.com/q/26447951
tag name: for-loop
tags question: http://stackoverflow.com/q/26446865
tags question: http://stackoverflow.com/q/26410622
tags question: http://stackoverflow.com/q/26497985
tags question: http://stackoverflow.com/q/26506223
tags question: http://stackoverflow.com/q/26393034
tags question: http://stackoverflow.com/q/26503978
tags question: http://stackoverflow.com/q/26509568
tags question: http://stackoverflow.com/q/26412175
tags question: http://stackoverflow.com/q/26454766
tags question: http://stackoverflow.com/q/26478743
tags question: http://stackoverflow.com/q/26396129
tags question: http://stackoverflow.com/q/26404435
tags question: http://stackoverflow.com/q/26362425
tags question: http://stackoverflow.com/q/26413395
tags question: http://stackoverflow.com/q/26447578
type: Tag
tags question: http://stackoverflow.com/q/26450813
tags question: http://stackoverflow.com/q/26374449
tags question: http://stackoverflow.com/q/26414370
tags question: http://stackoverflow.com/q/26373272
tags question: http://stackoverflow.com/q/26419513
tags question: http://stackoverflow.com/q/26363908

http://stackoverflow.com/comment/41507587
type: Comment
has text: Does only appz have this problem or is it everything from appz and later? It looks like the last else condition should execute if none of the previous conditions execute. So anyway you look at it, it should print out one number - correct?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26431238

http://stackoverflow.com/q/26355918
favorite count: 0
has comment: http://stackoverflow.com/comment/41370913
has comment: http://stackoverflow.com/comment/41374802
has title: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication when calling from a servlet
has comment: http://stackoverflow.com/comment/41381131
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/41372799
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41411982
type: Question
has comment: http://stackoverflow.com/comment/41378000
tagged with: java
has comment: http://stackoverflow.com/comment/41370811
tagged with: servlets
has body: I'm using Spring Social to retrieve data from twitter. This is my main class. @Configuration @EnableAutoConfiguration @ComponentScan public class Application { /* * SPRING BOOTSTRAP MAIN */ public static void main(String[] args) { System.out.println("here"); SpringApplication.run(Application.class, args); } } It runs fine when right click and run as-> java application. But when I call this main function from a GET function of servlet, it shows the following exception. SEVERE: Servlet.service() for servlet [com.servlets.TwitterImport] in context with path [/ImportContacts] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at com.twitter.Application.main(Application.java:18) at com.servlets.TwitterImport.doGet(TwitterImport.java:35) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invok…
upvote count: 2
tagged with: spring-social
has comment: http://stackoverflow.com/comment/41370857
linked to: http://stackoverflow.com/q/2396493

http://stackoverflow.com/q/26455898
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/26455984
score: 0
answer count: 1
type: UnansweredQuestion
has body: I am a first time Java student and I have a project where I ask the user for a file path to a text file. The text file loads and in this case it imports information about tenants (renters) that includes first name, last name, unit #, amount of rent, etc. After it is imported I am supposed to add up the rent for all the tenants and display the average amount of rent paid. I have everything working but I am unable to add up the rent from the text file and display the average. Help Please! Here is my main class that does all the work import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Program { public Program(){ Tenants t = new Tenants(); System.out.print("What is the path of the address file?"); Scanner s = new Scanner(System.in); String fileName = s.next(); HashMap&lt;String, AddressEntry&gt; addressMap = new HashMap&lt;String, AddressEntry&gt;(); File addressData = new File(fileName); try{ FileReader fr = new FileReader(addressData); BufferedReader br = new BufferedReader(fr); //Call the constructor inside of Tenants class and displays average t.Average(); String line = null; while((line = br.readLine()) != null){ String [] entryData = line.split(","); AddressEntry a = new AddressEntry(); a.firstName = entryData[0]; a.lastName = entryData[1]; a.unitNumber = entryData[2]; a.bedRoomQty = Integer.parseInt(entryData[3]); a.bathRoomQty = Integer.parseInt(entryData[4]); a.rent = Integer.parseInt(entryData[5]); addressMap.put(a.firstName, a); } br.close(); }catch(FileNotFoundException fnfe){ System.out.println("There was an error in loading the addresses"); fnfe.printStackTrace(); }catch(IOException ioe){ System.out.println("There was an error in loading the addresses"); ioe.printStackTrace(); } boolean askQuestion = true; while(askQuestion){ System.out.println("Who would you like information abo…
has title: Adding integers that are imported from a text file
tagged with: java

http://stackoverflow.com/comment/41433763
score: 1
type: QuestionComment
type: Comment
has text: Than make the listener on the parent element and detect if the touch.getX is > view.x and < view.x + view.getWidth() .. lol really simple :D
comment on: http://stackoverflow.com/q/26389893

http://stackoverflow.com/comment/41563083
type: QuestionComment
has text: I want to change an ad-user-account password via java. If I get the exception: "Password has expired - change password to reset (23)" it must be possible to change this password.
comment on: http://stackoverflow.com/q/26460974
score: 0
type: Comment

http://stackoverflow.com/comment/41378959
type: Comment
has text: @Moradiya Akash: Now the app is not getting close, but its not showing calendar in the fragment.
comment on: http://stackoverflow.com/a/26360466
score: 0
type: AnswerComment

http://stackoverflow.com/a/66509563
answers question: http://stackoverflow.com/q/26508166
has body: I get this kind of error without having done copy/paste, only adding dependencies via the Dependencies tab. Select All/Cut/Paste changes the error to "Content is not allowed in trailing section" or ... something I can't seem to reproduce any more. Meanwhile the "Effective POM" tab shows no issues at all.
score: 0
type: Answer

http://stackoverflow.com/comment/41374581
comment on: http://stackoverflow.com/q/26357720
score: 0
has text: @kozaxinan it is still not working
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41401483
score: 10
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26372385
has text: Why do you need to compare `Exception`s? I've never needed to compare `Exception`s.

http://stackoverflow.com/comment/41440395
type: QuestionComment
comment on: http://stackoverflow.com/q/26388913
has text: It sounds like a database error, not an issue with your username/password. If it can't connect to the DB, Weblogic will fail to start. See similar questions like: https://community.oracle.com/thread/2296545?start=0 You can attempt to hand edit the <domain>/config/config.xml and <domain>/config/jdbc/*.xml files to see if one of them is wrong
score: 0
type: Comment

http://stackoverflow.com/q/26394390
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26394416
has body: I initialized Set&lt;String&gt; j;. How come when I do this for loop { if (case1) { j.add(val); if (j.size() &gt; 1) { return false; } else { continue; } } } return true; I get a NullPointerException? Shouldn't the loop continue because if nothing is added Set is size 0?
has comment: http://stackoverflow.com/comment/41441059
type: Question
has comment: http://stackoverflow.com/comment/41441045
tagged with: java
accepted answer: http://stackoverflow.com/a/26394416
answer count: 2
has title: NullPointerException with Set<String> size() == 0
has comment: http://stackoverflow.com/comment/41441034
score: 0
has comment: http://stackoverflow.com/comment/41441111
possible better answer: http://stackoverflow.com/a/26394439
has answer: http://stackoverflow.com/a/26394439

http://stackoverflow.com/a/26465398
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41598593
upvote count: 2
has comment: http://stackoverflow.com/comment/41575142
answers question: http://stackoverflow.com/q/26463771
has body: Here is a solution which can be used for converting a Stream&lt;String&gt;, each element representing a line, to a Stream&lt;List&lt;String&gt;&gt;, each element representing a chunk found using a specified delimiter: public class ChunkSpliterator implements Spliterator&lt;List&lt;String&gt;&gt; { private final Spliterator&lt;String&gt; source; private final Predicate&lt;String&gt; start, end; private final Consumer&lt;String&gt; getChunk; private List&lt;String&gt; current; ChunkSpliterator(Spliterator&lt;String&gt; lineSpliterator, Predicate&lt;String&gt; chunkStart, Predicate&lt;String&gt; chunkEnd) { source=lineSpliterator; start=chunkStart; end=chunkEnd; getChunk=s -&gt; { if(current!=null) current.add(s); else if(start.test(s)) current=new ArrayList&lt;&gt;(); }; } public boolean tryAdvance(Consumer&lt;? super List&lt;String&gt;&gt; action) { while(current==null || current.isEmpty() || !end.test(current.get(current.size()-1))) if(!source.tryAdvance(getChunk)) return false; current.remove(current.size()-1); action.accept(current); current=null; return true; } public Spliterator&lt;List&lt;String&gt;&gt; trySplit() { return null; } public long estimateSize() { return Long.MAX_VALUE; } public int characteristics() { return ORDERED|NONNULL; } public static Stream&lt;List&lt;String&gt;&gt; toChunks(Stream&lt;String&gt; lines, Predicate&lt;String&gt; chunkStart, Predicate&lt;String&gt; chunkEnd, boolean parallel) { return StreamSupport.stream( new ChunkSpliterator(lines.spliterator(), chunkStart, chunkEnd), parallel); } } The lines matching the predicates are not included in the chunk; it would be easy to change this behavior, if desired. It can be used like this: ChunkSpliterator.toChunks( Files.lines(Paths.get(myFile)), Pattern.compile("^&lt;start&gt;$").asPredicate(), Pattern.compile("^&lt;stop&gt;$").asPredicate(), true ) .collect(new MyProcessOneBucketCollector&lt;&gt;()) The patterns are specifying as ^word$ to require the entire line to consist of the word on…
has comment: http://stackoverflow.com/comment/41575656
type: Answer

http://stackoverflow.com/q/26473275
possible better answer: http://stackoverflow.com/a/26473372
has body: I'm currently using Java when a user needs to interact with the database. It checks for the appropriate log information from the authenticator. But now I'm serving a PDF file that is on the server. Not all users should have access to this file -or this directory for that matter. How can I restrict access to it? In my naïve understanding, I thought about restricting access using Java/JSP, but when the user actually gets the URL with the full path on the server to the file, anyone can access it.
has answer: http://stackoverflow.com/a/26473372
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41583998
has answer: http://stackoverflow.com/a/26473365
accepted answer: http://stackoverflow.com/a/26473365
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41583985
type: Question
has title: How do I restrict access to files with a Tomcat server?
has comment: http://stackoverflow.com/comment/41584104
answer count: 2
has comment: http://stackoverflow.com/comment/41584162
tagged with: jsp
tagged with: tomcat

http://stackoverflow.com/a/26405012
score: 1
has body: In Java, File.separator field is set to the system-specific String that represents the proper slash on your file system. If you know that the incoming string always has backslashes, and you need a system-specific slash, then you can use replaceAll("\\", File.separator) On Windows, this would produce the original string, while on Mac and Unix it would produce a string with forward slashes instead of backslashes.
downvote count: 0
answers question: http://stackoverflow.com/q/26404882
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41508793
has text: I need to write a Text file without using semicolons, and I can't find a way to do it without ;, because every class i found that writes a file has a .write function that is void..
score: 0
comment on: http://stackoverflow.com/q/26432043
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26386997
accepted answer of: http://stackoverflow.com/q/26384420
has comment: http://stackoverflow.com/comment/41443687
answers question: http://stackoverflow.com/q/26384420
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41473607
has body: See this forum thread on ObjectDB website regarding indexing map keys, and this forum thread about indexing map values. You can set an index on keys using the @Key(index="true") annotation, and on values using the @Value(index="true") annotation, but as explained above, an index on keys will not be useful in queries in the current ObjectDB version (2.5.7).
type: Answer

http://stackoverflow.com/q/26444219
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/41531841
has answer: http://stackoverflow.com/a/26444586
accepted answer: http://stackoverflow.com/a/26444586
tagged with: palette
upvote count: 1
has comment: http://stackoverflow.com/comment/41531853
type: AnsweredQuestion
has body: I am using Eclipse for Java EE developers (Luna). And I am trying to get a palette with the JSP/HTML controls to work for .jsp pages. However, in the Palette tab it says: A palette is not available. Even though I have a .jsp html page opened. Here is the screenshot: How can I get it to work? Is there a palette for jsp in Eclipse Luna, for Java EE developers, or do I need a plugin for it?
score: 1
tagged with: java
has title: Eclipse EE Palette is not available
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/41393959
comment on: http://stackoverflow.com/a/26367937
has text: @user2494817 Using recursion should be avoided as much as possible. But in OP's case I think there is no issue. The OP's code will change too much if not done that. And speed is not an issue here. It is just a simple program.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/26517048
has body: Kotlin requires that call takes something of interface something. () -&gt; Kotlin.Unit Does not satisfy the type requirement. You can do this call (object : Something { override fun doSomething() { println("Passing an interface to call in kotlin!") } })
score: 10
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/26507099
downvote count: 0

http://stackoverflow.com/comment/41428702
has text: The Hex Representation is what helped me get my head around what was happening here. Thanks for clarifying!
comment on: http://stackoverflow.com/a/26378663
type: Comment
score: 15
type: AnswerComment

http://stackoverflow.com/a/26494594
has body: Several issues with your demo code: Make sure your portlet actually implements Liferay's MVCPortlet if you want to use the renderparameter jspPage. Also, jspPage is deprecated, you should rather use mvcPath, but the semantics is the same. Try for yourself if it's actually deprecated or already removed (this might then be the reason for your problems) And finally: Portlets are not supposed to have &lt;html&gt;, &lt;head&gt; or &lt;body&gt; elements. These are generated by the theme, not by the individual portlets. If this doesn't help, you might want to specify what "href wasn't working" means: e.g. what does the link point to, what gets shown when you click the link.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26488528

http://stackoverflow.com/q/26371483
has body: Got this error while trying to run https://github.com/ParsePlatform/AnyWall in Eclipse Description Resource Path Location Type error: No resource identifier found for attribute 'layout_alignParentEnd' in package 'android' activity_post.xml /DispatchActivity/res/layout line 23 Android AAPT Problem
has comment: http://stackoverflow.com/comment/41400244
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26372750
tagged with: java
type: Question
tagged with: eclipse
has title: No resource identifier found for attribute 'layout_alignParentEnd' in package 'android' activity_post.xml /DispatchActivity/res/layout line 23
accepted answer: http://stackoverflow.com/a/26372750
score: 0
answer count: 1

http://stackoverflow.com/q/26483327
favorite count: 0
has body: With my team, we would like to prevent hibernate from creating proxies. We don't want to use eager fetching type (lazy for all relations) but we want that hibernate returns only attributes fetch with the hql/jpql query. (null for others attributes) Why ? Because for performance issue we prefer avoid all "hiding sql request" on "get" and force the developer to write the good jpql/hql query. is it a good choice ? Do you know a way to do this ? Thank you
has answer: http://stackoverflow.com/a/26484889
has comment: http://stackoverflow.com/comment/41602508
has title: Prevent hibernate/jpa to create proxies
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/41604577
type: Comment
score: 0
has text: please check my updated answer and run your project and let me know
comment on: http://stackoverflow.com/a/26484503
type: AnswerComment

http://stackoverflow.com/comment/41445148
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26396131
has text: I think he doesn't need to share `lib` between workspaces :(

http://stackoverflow.com/comment/41642388
comment on: http://stackoverflow.com/q/26505687
type: Comment
type: QuestionComment
has text: Arrays or ArrayLists? They are different things
score: 0

http://stackoverflow.com/comment/41522325
type: Comment
comment on: http://stackoverflow.com/a/26439239
score: 0
type: AnswerComment
has text: I don't want to disable DTD validation. What do you mean by "as long as your entity resolver is thread-safe and reusable you definitely don't need to create new instances every time"

http://stackoverflow.com/comment/41573623
type: QuestionComment
has text: Hi! Thanks for a comment. Yeh, I'm need invoke this command from comandline. Is there any way without server machine file modification? It would be match more better. Thanks in advance.
comment on: http://stackoverflow.com/q/26467754
score: 0
type: Comment

http://stackoverflow.com/comment/41567581
comment on: http://stackoverflow.com/a/26462943
type: AnswerComment
has text: @Disco 3 and what the reason to call same thing by different names?
score: 0
type: Comment

http://stackoverflow.com/a/26457182
accepted answer of: http://stackoverflow.com/q/26457142
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26457142
type: Answer
has comment: http://stackoverflow.com/comment/41558547
downvote count: 0
score: 1
has body: You cannot insert a new element in arrays in java. size of array in java are static. You will have to create new array or you can use Collection framework (no need to create new array) or Arrays class (new array will be created). Using Collection framework : ArrayList&lt;Integer&gt; list = new ArrayList&lt;&gt;(); list.add(20); list.add(30); Using Arrays class : int[] list = {20} list = Arrays.copyOf(list, list.length + 1); list[list.length - 1] = 30;
has comment: http://stackoverflow.com/comment/41558494

http://stackoverflow.com/a/26425138
has body: If I understand your question, one option is to use File.getCanonicalPath() like, try { File f = new File("C:/aaa/bbb/ccc/ddd/excelFiles/test.xls"); System.out.println(f.getCanonicalPath()); } catch (IOException e) { e.printStackTrace(); }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26425002
score: 1
downvote count: 0

http://stackoverflow.com/comment/41693121
comment on: http://stackoverflow.com/q/26477218
has text: @Scary Wombat: I'm pretty sure this is a different type of problem than the referenced one, because I'm not attempting to connect to the HSQL database from an external process.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26452218
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41546128
tagged with: listview
score: 0
answer count: 1
tagged with: web
tagged with: string
has comment: http://stackoverflow.com/comment/41545931
favorite count: 0
has title: How to put a code block inside a String and use it in switch (position)
has answer: http://stackoverflow.com/a/34321602
has body: I have the following code in my app that defines what happens when I click on an item in ListView: protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); switch (position) { } } I have a String called data that contains some cases: String data = "case 0:\nLog.i('switchcase','case0');\nreturn;\ncase 1:\nLog.i('switchcase','case1');\nreturn;\ndefault:\nreturn;" My app receives data from The Internet and stores it in the String... How can I use the code inside the String so that my switch (position) can use the cases in the String?
has comment: http://stackoverflow.com/comment/41545780
type: UnansweredQuestion
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/41546007

http://stackoverflow.com/q/26467313
has answer: http://stackoverflow.com/a/26467352
upvote count: 0
type: UnansweredQuestion
has title: Date conversion issue in java datatype
has answer: http://stackoverflow.com/a/26467344
has comment: http://stackoverflow.com/comment/41581419
tagged with: java
linked to: http://stackoverflow.com/q/11337557
score: -1
type: Question
answer count: 2
favorite count: 0
has body: I have a string type date. I want to change it firstly into date datatype. But it is not formating date properly as I want.Here is my code String a="12/11/2010"; Date d=new Date(); SimpleDateFormat as=new SimpleDateFormat("dd/MM/yy"); d=as.parse(a); System.out.println(a); Output is like this :Sun Jan 01 00:00:00 IST 2012 But I want output like this 12-10-2014 in Date data type, not in String data type.
downvote count: 1

http://stackoverflow.com/a/26507243
upvote count: 1
has body: #deepToString Returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents and so on. This method is designed for converting multidimensional arrays to strings. You should use java.util.Arrays.deepToString(array) for multi-dimensional array.Currently you are printing Object reference's String representation. You can use #replace method to replace[] with {} //... public static void main(String[] argss){ // TEST multiplyMatrix System.out.println(" ---- Test Multiply Matrix ---- "); double array[][] = multiplyMatrix(A,B); String finalString = Arrays.deepToString(array) .replace("[", "{") .replace("]", "}"); System.out.println(finalString); }//...
has comment: http://stackoverflow.com/comment/41645622
answers question: http://stackoverflow.com/q/26507083
has comment: http://stackoverflow.com/comment/41645431
downvote count: 0
has comment: http://stackoverflow.com/comment/41647305
type: Answer
has comment: http://stackoverflow.com/comment/41646288
has comment: http://stackoverflow.com/comment/41645909
score: 1

http://stackoverflow.com/comment/41586736
score: 1
has text: Use two " instead of the '
type: Comment
comment on: http://stackoverflow.com/q/26474582
type: QuestionComment

http://stackoverflow.com/comment/41404084
has text: Because it was just easier for me to post it from the syntax highlighter.
type: Comment
comment on: http://stackoverflow.com/q/26373750
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41480391
score: 0
comment on: http://stackoverflow.com/q/26416586
has text: [Be careful.](http://stackoverflow.com/questions/18138397/calling-method-from-constructor)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41618165
type: QuestionComment
has text: @codeMagic last `}` was not in your code section.
type: Comment
comment on: http://stackoverflow.com/q/26491187
score: 0

http://stackoverflow.com/comment/41402781
type: QuestionComment
comment on: http://stackoverflow.com/q/26373052
has text: Why not use `File#exists`?
score: 0
type: Comment

http://stackoverflow.com/q/26418417
type: Question
tagged with: libgdx
tagged with: ios
has title: Doing an event while a finger is on the same spot of the screen? Libgdx
score: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: How can I poll an event for a single finger all at once? To be more specific basically I need to find out when a person is touching the screen but they need to stay in the same spot the whole time and this needs to be implemented with multitouch so if they keep any of there fingers in the same spot for lets say 500ms then I can have an action happen. All code that I have tried hasn't work and I am mostly annoyed.
tagged with: java
has answer: http://stackoverflow.com/a/26418451
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/41630569
comment on: http://stackoverflow.com/q/26498988
score: 0
type: Comment
type: QuestionComment
has text: Sorry about that. Maybe this is better.

http://stackoverflow.com/q/26498264
type: Question
tagged with: javap
upvote count: 1
answer count: 1
tagged with: opcode
favorite count: 0
has body: I am looking through the output of Javap. For example: This code final Foo foo = new Foo(1,2); ... new Callable&lt;Integer&gt;() { @Override public Integer call() throws Exception { return foo.doSomething(); } Generates: jvmOperations": [{ "byteOffset": 0, "constantPoolIndex": null, "opCode": 42, "opCodeName": "aload_0", "type": null, "tagName": null, "tagValue": null }, { "byteOffset": 1, "constantPoolIndex": null, "opCode": 180, "opCodeName": "getfield", "type": null, "tagName": "Field", "tagValue": "val$foo:Lcom/example/graph/demo/Foo;" }, { "byteOffset": 4, "constantPoolIndex": null, "opCode": 182, "opCodeName": "invokevirtual", "type": null, "tagName": "Method", "tagValue": "com/example/graph/demo/Foo.doSomething:()Ljava/lang/Integer;" }, { "byteOffset": 7, "constantPoolIndex": null, "opCode": 176, "opCodeName": "areturn", "type": null, "tagName": null, "tagValue": null }] So I see that the object is identified in this case by val$foo. And in the class metadata "classMetaData": { "classId": "com/example/Main$1.class", "sourceName": "Main.java", "isInterface": false, "isClass": true, "accessModifiers": ["final"], "superClassName": "java/lang/Object", "implementedInterfaces": ["java/util/concurrent/Callable"], "jreTargetVersion": "51.0", "fields": ["val$foo"], "fieldModifiers": { "val$foo": ["final"] }, "methodInformationMap": {}, "interface": false, "class": true }, But now I want to find out more about the original object foo. For example, I know it has this data in one of its fields: { "byteOffset": 37, "constantPoolIndex": null, "opCode": 18, "opCodeName": "ldc", "type": null, "tagName": "String", "tagValue": "NODE-1" }, How does the JVM know what val$foo points to?
has title: Java & Javap: How to Determine Which Object Receives Invokevirtual
has comment: http://stackoverflow.com/comment/41629880
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26498448
accepted answer: http://stackoverflow.com/a/26498448

http://stackoverflow.com/a/26416866
has comment: http://stackoverflow.com/comment/41481939
upvote count: 1
has comment: http://stackoverflow.com/comment/41481636
has comment: http://stackoverflow.com/comment/41481613
answers question: http://stackoverflow.com/q/26416706
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26416706
has comment: http://stackoverflow.com/comment/41482006
has body: import java.util.*; /** * * @author Tyler Weaver */ public class Test { public static void main(String[] args) { System.out.print("Enter A Number: "); Scanner sc = new Scanner(System.in); int input = sc.nextInt(); int sumOfDivisors = 0; Collection&lt;Integer&gt; col = new ArrayList&lt;&gt;(); for (int number = 1; number &lt;= input; number++) { for (int divisor = 1; divisor &lt; number; divisor++) { if (number % divisor == 0) { sumOfDivisors += divisor; col.add(divisor); } } if (sumOfDivisors == number) { System.out.printf("Perfect Number: %,d%n[", number); for (Integer i : col) { System.out.printf("%,d, ", i); } System.out.printf("\b\b]%n"); } sumOfDivisors = 0; col.clear(); } sc.close(); } } Just added a collection to keep track of the divisors, then added a printf() statement to properly format. EDIT: Code without using a collection. import java.util.*; /** * * @author Tyler Weaver */ public class Test { public static void main(String[] args) { System.out.print("Enter A Number: "); Scanner sc = new Scanner(System.in); int input = sc.nextInt(); int sumOfDivisors = 0; for (int number = 2; number &lt;= input; number++) { System.out.printf("Number: %,d%n[", number); for (int divisor = 1; divisor &lt; number; divisor++) { if (number % divisor == 0) { sumOfDivisors += divisor; System.out.printf("%,d, ", divisor); } } System.out.printf("\b\b]%n"); if (sumOfDivisors == number) { System.out.printf("Therefore %,d is a perfect number.%n%n", number); } else { System.out.printf("%n"); } sumOfDivisors = 0; } sc.close(); } }
has comment: http://stackoverflow.com/comment/41481512
type: Answer
has comment: http://stackoverflow.com/comment/41482063
score: 1

http://stackoverflow.com/a/26427142
upvote count: 2
has body: UPDATE: on second thought, what I originally proposed below could never work since DomainClassConverter requires that your Spring Data Repositories be present in the ApplicationContext, and in your example you are using StandaloneMockMvcBuilder which will never create an ApplicationContext that contains your Spring Data Repositories. The way I see it, you have two options. Convert your test to an integration test using a real ApplicationContext (loaded via @ContextConfiguration as demonstrated in the reference manual) and pass that to MockMvcBuilders.webAppContextSetup(WebApplicationContext). If the configured ApplicationContext includes your Spring Data web configuration, you should be good to go. Forgo the use of DomainClassConverter in your unit test, and instead set a custom HandlerMethodArgumentResolver (e.g., a stub or a mock) via StandaloneMockMvcBuilder.setCustomArgumentResolvers(HandlerMethodArgumentResolver...). Your custom resolver could then return whatever Product instance you desire. You'll have to register an instance of the DomainClassConverter with the ConversionService in the StandaloneMockMvcBuilder that is created when you invoke MockMvcBuilders.standaloneSetup(Object...). In SpringDataWebConfiguration.registerDomainClassConverterFor(), you can see that the DomainClassConverter is instantiated (and indirectly registered) like this: DomainClassConverter&lt;FormattingConversionService&gt; converter = new DomainClassConverter&lt;FormattingConversionService&gt;(conversionService); converter.setApplicationContext(context); And you can set your own FormattingConversionService via StandaloneMockMvcBuilder.setConversionService(). See WebMvcConfigurationSupport.mvcConversionService() for an example of how to configure the ConversionService for a web environment. The challenge then is how to obtain a reference to the ApplicationContext. Internally, StandaloneMockMvcBuilder uses a StubWebApplicationContext, but as far as I can see (prior to Spring 4.1) ther…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26400459
has comment: http://stackoverflow.com/comment/41504028
answers question: http://stackoverflow.com/q/26400459
type: Answer
has comment: http://stackoverflow.com/comment/41502188
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41502222

http://stackoverflow.com/q/26356104
has comment: http://stackoverflow.com/comment/41371033
linked to: http://stackoverflow.com/q/1086396
downvote count: 4
linked to: http://stackoverflow.com/q/23493196
has comment: http://stackoverflow.com/comment/41371042
upvote count: 0
has comment: http://stackoverflow.com/comment/41371256
has title: Java : Given date is within 12 months or not
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26356410
has comment: http://stackoverflow.com/comment/41371175
tagged with: datetime
has body: I have a date string of the form "07-AUG-13". I want to know whether the given date is within a certain period from the current date or not. bool isItWithin(int period){ //check if "07-AUG-13" is within a "period" months from now }
has comment: http://stackoverflow.com/comment/41371174
has comment: http://stackoverflow.com/comment/41371080
has answer: http://stackoverflow.com/a/26356162
has comment: http://stackoverflow.com/comment/41371156
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/26356386
linked to: http://stackoverflow.com/q/10828398
has comment: http://stackoverflow.com/comment/41371543
type: UnansweredQuestion
tagged with: date
score: -4

http://stackoverflow.com/comment/41568134
type: Comment
comment on: http://stackoverflow.com/a/26465035
type: AnswerComment
has text: I tried this with no success. For RootContextConfiguration i have provided WebServiceConfig class - like one from tutorial but without ServletRegistrationBean. For servletConfigClasses i have set CountryEndpoint - im guessing this is wrong ?
score: 0

http://stackoverflow.com/comment/41576405
type: AnswerComment
type: Comment
has text: Then just parse the string `url.split("&")[0]`
comment on: http://stackoverflow.com/a/26468864
score: 0

http://stackoverflow.com/a/26407189
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26407040
answers question: http://stackoverflow.com/q/26407040
score: 6
type: Answer
downvote count: 0
upvote count: 6
has body: String.matches requires the entire string to match the pattern. As if the pattern has an implied "^...$". Pattern ignore = Pattern.compile(".*" + Pattern.quote(prompt) + ".*", Pattern.CASE_INSENSITIVE); is for a find like match. This could have been done with the original pattern as: if (mIgn.find()) { System.out.println("Found at position " + mIgn.start()); }

http://stackoverflow.com/comment/41879339
comment on: http://stackoverflow.com/q/26445729
type: Comment
type: QuestionComment
has text: Did you resolve the issue?
score: 0

http://stackoverflow.com/a/26438016
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26432985
type: Answer
has comment: http://stackoverflow.com/comment/41591056
has body: Use ToolTipManager.sharedInstance().setEnabled( false ) to disable all tool tips in your Swing application. Benefits compared to your approach It works :-) You do not clear the tooltips, so it is easy to re-enable them again. For example if you want to offer UI to your user to activate/de-activate the tooltips this approach will work. In your approach, you would have to restore all the tooltips you previously cleared, which would be difficult to do in a generic way.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41590038
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26432985
has comment: http://stackoverflow.com/comment/41589595

titanium
type: Tag
tag name: titanium
tags question: http://stackoverflow.com/q/26439737

http://stackoverflow.com/comment/41549791
type: QuestionComment
has text: Everyone sees that it wont delete, only cover the number with the next number in array..., and surely wont work for last element @arynaq
score: 0
comment on: http://stackoverflow.com/q/26454434
type: Comment

http://stackoverflow.com/comment/61521018
score: 0
type: Comment
has text: see here: http://stackoverflow.com/questions/26512230/recursion-infinite-loop-in-java
type: QuestionComment
comment on: http://stackoverflow.com/q/26512230

http://stackoverflow.com/q/26433694
answer count: 1
has comment: http://stackoverflow.com/comment/41512717
favorite count: 0
has body: I am building an android app in eclipse, and I decided to rename the package of the app under "src", by right-clicking the package and choosing "Refactor" and then "Rename". I did the same for the package under "gen". I then renamed the package in the AndroidManifest.xml. However I now have a "R cannot be resolved to a variable" error. In my package under "gen" there is no R.java file, only a "BuildConfig.java". I have tried cleaning the project and re-building after deleting the "gen" folder. I have no "import android.R" statements in any of my classes, and eclipse is saying there are no errors in my xml files. All of my xml and image files are named in all lowercase with no special characters. I have tried restarting eclipse a number of times. How can I fix this problem and get R.java back to get my code working again? Thank you.
has comment: http://stackoverflow.com/comment/41512265
type: UnansweredQuestion
tagged with: android
score: -3
has title: Why has my R.java vanished, and how can I get it back
linked to: http://stackoverflow.com/q/17870881
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41512833
type: Question
has answer: http://stackoverflow.com/a/26433726
upvote count: 0

http://stackoverflow.com/comment/41494443
has text: ok cool,1 more question ,how do i match the response to my document "Leads" ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26406453
score: 0
type: Comment

http://stackoverflow.com/a/26427172
has comment: http://stackoverflow.com/comment/41518797
score: 0
has body: probably a bug in hibernate. Such as: https://hibernate.atlassian.net/browse/HHH-8286 try a newer version.
answers question: http://stackoverflow.com/q/26426557
type: Answer

http://stackoverflow.com/q/26460161
has answer: http://stackoverflow.com/a/26460423
accepted answer: http://stackoverflow.com/a/26460423
has body: i use jsoup to crawl content from specific website´s. Example, meta-tags: String meta_description = doc.select("meta[name=description]").first().attr("content"); What i need to crawl as well is the language, what i do: String meta_language = doc.select("http-equiv").first().attr("content"); But what is thrown: java.lang.NullPointerException Anybody could help with with this? Greetings!
has comment: http://stackoverflow.com/comment/41560125
has comment: http://stackoverflow.com/comment/41560404
upvote count: 0
tagged with: return
has title: java / jsoup - retrieve language
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/41560044
answer count: 1
downvote count: 1
tagged with: string
favorite count: 0

http://stackoverflow.com/q/26488849
has comment: http://stackoverflow.com/comment/41611679
has comment: http://stackoverflow.com/comment/41611764
has body: I really like the mechanism and style of this code, but Im kinda unaware if this coding style is appropriate or a bad practice. public class Test { private static int counter; private final static ArrayList&lt;Object&gt; _objects = new ArrayList&lt;&gt;(); public static void main(String[] args) { //iterate till you find a valid object randomly while (!doStuffIfValid(_objects.get(Rnd.get(_objects.size())))); } public static boolean doStuffIfValid(Object obj) { if (++counter &gt; 30) return true; //dont try more than 30 times // if condition // { // //do stuff then exit the caller loop // return true; // } return false; } }
score: 0
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41611883
has answer: http://stackoverflow.com/a/26488962
has answer: http://stackoverflow.com/a/26489021
has comment: http://stackoverflow.com/comment/41611719
has comment: http://stackoverflow.com/comment/41611635
tagged with: java
type: Question
has title: Is while(boolean method); a bad practice? (Example)

http://stackoverflow.com/a/26415828
answers question: http://stackoverflow.com/q/26413834
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41479943
accepted answer of: http://stackoverflow.com/q/26413834
has body: Try with &lt;Resource name="mail/MyMailSession" auth="Container" type="javax.mail.Session" mail.smtp.sendpartial="true" mail.debug="true" mail.smtp.host="myhost.hosting.com" /&gt; instead of &lt;Resource name="MyMailSession" auth="Container" type="javax.mail.Session" mail.smtp.sendpartial="true" mail.debug="true" mail.smtp.host="myhost.hosting.com" /&gt; Edit : In that case it is necessary because your refer to the context as mail/MyMailSession in this line : Session session = (Session) ctx.lookup("java:comp/env/mail/MyMailSession"); What follow java:comp/env/ must be your Resource name.

http://stackoverflow.com/q/26430922
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26441778
has body: Are Conditional Permission Admin and User Admin services in OSGi complementary or exclusive? I am developing a home automation project based on OSGi and I am not sure if I should implement both security services or not. The application will eventually be accessible through the internet but there would not be a group of user with accounts. From my understanding 'User Admin' service is more ideal for a website or an application that will have dedicated users that need to be authenticated. In my case, the application might communicate with another application residing in different location so it might also need some form of authentication. But wouldn't the security gain by implementing 'Conditional Permission Admin' user be enough? My plan is to use the 'Conditional Permission Admin' and create custom conditions to control special actions such us sharing resources with other bundles. Is it enough or shall I implement both. Also will having both services running affect the performance of the system significantly? I would really appreciate if someone share their view on this. Thanks!
has title: OSGi: Conditional Permission Admin OR User Admin
tagged with: security
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26441778
tagged with: osgi
upvote count: 1
tagged with: permissions

http://stackoverflow.com/comment/41628006
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63443/discussion-between-petesh-and-nicholas).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26480551

http://stackoverflow.com/comment/41493054
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26423934
has text: but mt.getStatus() is "Running" - it means that the task has not executed.
score: 0

http://stackoverflow.com/a/26451883
has comment: http://stackoverflow.com/comment/44505863
downvote count: 0
has body: The source for the v21 versions of the support libraries will be released alongside the source of Android 5.0 coinciding with the start of OTAs to Nexus devices (i.e., early November).
has comment: http://stackoverflow.com/comment/45510334
type: Answer
has comment: http://stackoverflow.com/comment/45512196
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26451847
has comment: http://stackoverflow.com/comment/42078461

http://stackoverflow.com/comment/41486023
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26419841
has text: You need to keep trying to `read` until you have read all the bytes. Calling it once may or may not read the entire file, this is why it returns an `int`.

http://stackoverflow.com/comment/41579746
comment on: http://stackoverflow.com/a/26470236
type: AnswerComment
score: 0
type: Comment
has text: A couple of things: First, the parent directories of the `new File(e.name)` file may not exist. Second, why `withWriter` instead of `withInputStream`? Isn't that presuming character data?

http://stackoverflow.com/a/26414520
downvote count: 0
has comment: http://stackoverflow.com/comment/41476921
has body: A single Gradle project can produce any number of JARs. You could simply add another Jar task and give it a unique classifier to distinguish it from the "standard" library. task jarLite(type: Jar) { classifier = 'lite' exclude '**/SomeProprietaryCode.class' with jar }
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26413017
answers question: http://stackoverflow.com/q/26413017
has comment: http://stackoverflow.com/comment/41511568
type: AcceptedAnswer

http://stackoverflow.com/a/26428574
downvote count: 0
type: Answer
has body: You can use .matches("[^A-Z\\s]+") It will return true if your string does not contain any upper case characters or white space characters. Explanation the bit between [...] is called a character class, it matches all characters provided ^ makes it negative, so it matches everything not provided A-Z is the range of upper case characters \\s is short hand for any white space character + ensures that your string is at least 1 character or more.
has comment: http://stackoverflow.com/comment/41502215
accepted answer of: http://stackoverflow.com/q/26428538
answers question: http://stackoverflow.com/q/26428538
upvote count: 4
has comment: http://stackoverflow.com/comment/41502399
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/41502468
has comment: http://stackoverflow.com/comment/41502285

random
tags question: http://stackoverflow.com/q/26511023
tags question: http://stackoverflow.com/q/26477076
tags question: http://stackoverflow.com/q/26510629
tags question: http://stackoverflow.com/q/26475182
tags question: http://stackoverflow.com/q/26459729
tags question: http://stackoverflow.com/q/26455051
tags question: http://stackoverflow.com/q/26415533
tags question: http://stackoverflow.com/q/26457267
tags question: http://stackoverflow.com/q/26461382
tags question: http://stackoverflow.com/q/26393647
tags question: http://stackoverflow.com/q/26382104
tag name: random
tags question: http://stackoverflow.com/q/26439045
tags question: http://stackoverflow.com/q/26370088
tags question: http://stackoverflow.com/q/26358990
tags question: http://stackoverflow.com/q/26473400
type: Tag
tags question: http://stackoverflow.com/q/26492690
tags question: http://stackoverflow.com/q/26499619
tags question: http://stackoverflow.com/q/26501911
tags question: http://stackoverflow.com/q/26372451

http://stackoverflow.com/comment/41468650
type: Comment
comment on: http://stackoverflow.com/a/26402818
type: AnswerComment
has text: Yes, Eclipse seems to have this problem while using User libraries and that's why I asked you about that. Anyway, good to see you through the problem you're facing. Cheers !
score: 0

http://stackoverflow.com/q/26375678
has body: I need to take in command prompt arguments, and use them to construct an object. I am taking a number of people and the boat size. public RiverCrossingPuzzle(int numEach, int boatSize) Creates a RiverCrossingPuzzle with numEach number of cannibals and numEach number of missionaries with a boat that can carry up to boatSize number of missionaries/cannibals. For example, the input can be "-n", "4", "-b", "3" Should I do it like this: this.numEach = Integer.parseInt(args[2]); this.boatSize = Integer.parseInt(args[4]); Or like this: int numEach = Integer.parseInt(args[2]); int boatSize = Integer.parseInt(args[4]); this.boatSize = boatSize; this.numEach = numEach;
type: Question
possible better answer: http://stackoverflow.com/a/26375811
has answer: http://stackoverflow.com/a/26375811
has answer: http://stackoverflow.com/a/26375729
answer count: 3
has comment: http://stackoverflow.com/comment/41407302
has comment: http://stackoverflow.com/comment/41407347
has title: taking in command prompt arguments and constructing objects
accepted answer: http://stackoverflow.com/a/26375729
has answer: http://stackoverflow.com/a/26375852
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/41476343
has text: nice guess, but no :P There is no crazy use case behind this. Simply wondered if this is possible and I couldn't find anything on the web.
comment on: http://stackoverflow.com/q/26414122
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41403945
has text: So, do that. What don't you know how to do?
score: 0
comment on: http://stackoverflow.com/q/26373160
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41489807
type: AnswerComment
score: 3
type: Comment
has text: @Kao it's not. Your asking for random peoples' opinions about something that's not controlled by them. Read the documentation, the release notes, send a complaint to the responsible people at Oracle.
comment on: http://stackoverflow.com/a/26400047

http://stackoverflow.com/comment/41464030
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26407536
type: Comment
has text: Thanks for the answer. I did some research and found out that my issue can be solved by 'pooling JDBC connection'. Is this possible? Can you provide any references or example for the same? Thank you.

http://stackoverflow.com/comment/41533863
has text: Your mistake is probably the `keyboard.next()` call; try changing it to `keyboard.nextLine();`.
comment on: http://stackoverflow.com/q/26445633
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26514604
has comment: http://stackoverflow.com/comment/61600048
upvote count: 4
downvote count: 0
score: 4
has body: I received an answer from Amazon Support that it is not actually possible to accomplish this with a single call. They did suggest to reduce the number of calls when adding the attribute for a new primary key from 3 to 2, by using the desired JSON map in the put-if-absent request rather than an empty map.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26494372
has comment: http://stackoverflow.com/comment/54630614
answers question: http://stackoverflow.com/q/26494372
type: Answer

http://stackoverflow.com/q/26420958
tagged with: java
has comment: http://stackoverflow.com/comment/41488059
type: Question
answer count: 2
tagged with: google-maps
has title: Getting NullPointerException on setting google MAP in Android
has comment: http://stackoverflow.com/comment/41488161
score: 0
has comment: http://stackoverflow.com/comment/41487995
tagged with: android
linked to: http://stackoverflow.com/q/16978190
has comment: http://stackoverflow.com/comment/41488105
type: UnansweredQuestion
has body: i'm trying to set Google Map on android so i have set all things on, but when i try to get the fragment that contain the map the error log display a NullPointerException error. the error is due to it's not recognize the map My XML Layout : &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.unchainedappli.SpotFragement"&gt; &lt;fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/FrameLayout&gt; The onCreate method @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get a handle to the Map Fragment GoogleMap map = ((SupportMapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); LatLng sydney = new LatLng(-33.867, 151.206); map.setMyLocationEnabled(true); map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13)); map.addMarker(new MarkerOptions() .title("Sydney") .snippet("The most populous city in Australia.") .position(sydney)); } The error log : 0-17 08:12:32.884 2373-2373/com.example.user.unchainedappli E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.user.unchainedappli, PID: 2373 java.lang.NullPointerException at com.example.unchainedappli.SpotFragement.onCreate(SpotFragement.java:69) at android.support.v4.app.Fragment.performCreate(Fragment.java:1481) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:908) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:450) at android.os.Handler.handleCallback(Ha…
has answer: http://stackoverflow.com/a/26421108
has answer: http://stackoverflow.com/a/26421248

http://stackoverflow.com/a/26465936
has comment: http://stackoverflow.com/comment/41572585
has body: You're probably missing some DLL required by your add.dll. Try to check in the Event viewer -> Windows Logs -> Application to see if there is more info in here.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41570540
type: Answer
answers question: http://stackoverflow.com/q/26465624
has comment: http://stackoverflow.com/comment/41570808
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41571832
accepted answer of: http://stackoverflow.com/q/26465624
has comment: http://stackoverflow.com/comment/41572078

http://stackoverflow.com/q/26443144
tagged with: java
tagged with: hibernate
tagged with: autowired
type: Question
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/26443177
accepted answer: http://stackoverflow.com/a/26443177
upvote count: 2
answer count: 1
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has body: On a Spring/Hibernate project I'm working on, I noticed that to persist a new object in the database, an autowired entity was used. Simplified, it was doing something like this: @Service public class SomeArbitraryManager { @Autowired private SomeArbitraryItem item; // The Hibernate entity. @Autowired private SomeArbitraryDao dao; // The corresponding DAO. public void arbitraryMethodThatNeedsToStoreAnItem(long someId, String someValue) { item.setPropertyA(someId); item.setPropertyB(someValue); item.setPropertyC(new Date()); dao.save(item); } } As mentioned, this is the simplified idea, in practice there were more properties, different methods doing the insertion and error handling. Now, a bug occurred where Hibernate would actually just overwrite the last inserted row. I believe this was caused by the SomeArbitraryItem receiving an id (for the primary key) after Hibernate inserted it, and Hibernate assuming an update when the same item was saved. On another occasion, the inserted object's properties were not all updated, so a SomeArbitraryItem was inserted with some fields containing last insertion's values. I asked why there wasn't just a new SomeArbitraryItem used for each insertion, like so: SomeArbitraryItem item = new SomeArbitraryItem(); ... // Set properties. dao.save(item); This is what would make sense to me, since if it's a new (database) object, shouldn't it also be a new regular, java, object? The answer given to me when I asked though was, that when using DI, you shouldn't be creating objects. I've Googled to see what the policy on this is, but I can't find anything. There are tons of Spring/Hibernate tutorials though, and I'm not seeing the Hibernate entities being autowired in those. However, they could be simplified since they are just tutorials. So: How should this be done? Should Hibernate entities be autowired? Should they just be instantiated? Or, in order to not tie us down to a specific class, should we fetch a new one from the Spring applicatio…
score: 2
downvote count: 0
has title: Should Hibernate entities be autowired or 'manually' instantiated?

http://stackoverflow.com/comment/41691250
comment on: http://stackoverflow.com/a/26511658
type: Comment
has text: its all here http://stackoverflow.com/questions/26519059/first-time-android-application-errors
score: 0
type: AnswerComment

jakarta-ee
tags question: http://stackoverflow.com/q/26450519
tags question: http://stackoverflow.com/q/26381512
tags question: http://stackoverflow.com/q/26465364
tags question: http://stackoverflow.com/q/26492898
tags question: http://stackoverflow.com/q/26372572
tags question: http://stackoverflow.com/q/26489966
tags question: http://stackoverflow.com/q/26419827
tags question: http://stackoverflow.com/q/26464757
type: Tag
tags question: http://stackoverflow.com/q/26415648
tags question: http://stackoverflow.com/q/26384192
tags question: http://stackoverflow.com/q/26507722
tags question: http://stackoverflow.com/q/26478010
tags question: http://stackoverflow.com/q/26476655
tags question: http://stackoverflow.com/q/26404223
tags question: http://stackoverflow.com/q/26394204
tags question: http://stackoverflow.com/q/26403719
tags question: http://stackoverflow.com/q/26355535
tags question: http://stackoverflow.com/q/26377444
tags question: http://stackoverflow.com/q/26495587
tags question: http://stackoverflow.com/q/26385937
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/26491364
tags question: http://stackoverflow.com/q/26401802
tags question: http://stackoverflow.com/q/26409937
tags question: http://stackoverflow.com/q/26476324
tags question: http://stackoverflow.com/q/26422447
tags question: http://stackoverflow.com/q/26499064
tags question: http://stackoverflow.com/q/26513398
tags question: http://stackoverflow.com/q/26378324
tags question: http://stackoverflow.com/q/26451119
tags question: http://stackoverflow.com/q/26502958
tags question: http://stackoverflow.com/q/26501527
tags question: http://stackoverflow.com/q/26404069
tags question: http://stackoverflow.com/q/26464104
tags question: http://stackoverflow.com/q/26380923
tags question: http://stackoverflow.com/q/26489763
tags question: http://stackoverflow.com/q/26402665
tags question: http://stackoverflow.com/q/26420166
tags question: http://stackoverflow.com/q/26471964
tags question: http://stackoverflow.com/q/26383157
tags question: http://stackoverflow.com/q/26513633
tags question: http://stackoverflow.com/q/26439141
tags question: http://stackoverflow.com/q/26465355
tags question: http://stackoverflow.com/q/26361957
tags question: http://stackoverflow.com/q/26387302
tags question: http://stackoverflow.com/q/26408994
tags question: http://stackoverflow.com/q/26397064
tags question: http://stackoverflow.com/q/26492183
tags question: http://stackoverflow.com/q/26461701
tags question: http://stackoverflow.com/q/26507494

http://stackoverflow.com/a/26479264
has comment: http://stackoverflow.com/comment/41595069
score: 0
has comment: http://stackoverflow.com/comment/41594842
has comment: http://stackoverflow.com/comment/41595024
upvote count: 1
type: Answer
has body: just remove the attribute from session, and check if it exists..... request.getSession.removeAttribute("name") and check like: if(request.getSession.getAttribute("name")==null){ }
downvote count: 1
answers question: http://stackoverflow.com/q/26479217

http://stackoverflow.com/comment/41529872
comment on: http://stackoverflow.com/q/26443487
score: 0
type: Comment
type: QuestionComment
has text: @Makoto-I think `what-accomplishments` don't matter here, there doesn't seem a possible shortcut,though,one may always come with some magical technique... You should only care about the question and question title!

http://stackoverflow.com/a/26450414
score: 0
has body: I recommend to use list because it's good in some parameter then array. public Book (String titl, int page) { title = titl; pages = page; Arraylist.add(this); // add new Book in the list } For not giving more then 20 public Book (String titl, int page) { title = titl; pages = page; if (Arraylist.size() &lt; 20) { Arraylist.add(this); // add new Book into the list } } Try to apply first your own logic.
type: Answer
answers question: http://stackoverflow.com/q/26450282

http://stackoverflow.com/a/26389627
upvote count: 1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26389413
has body: You should typically use only a minimal subset of threads based on your needs. You should typically only use AsyncTasks for components that will operate for short periods of time and need to interact with the UI components separately from a different task. By default, the ThreadPoolExecutor will decide how serialized multiple AsyncTasks would be if you called upon them. Try to do small tasks in a single AsyncTask, and if you need longer running threads, then consider doing a service that runs in the background.
score: 0

http://stackoverflow.com/comment/41560155
type: Comment
has text: MAVEN_HOME= which path ? I am using apache maven 3.0.4
comment on: http://stackoverflow.com/a/26460175
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41630960
comment on: http://stackoverflow.com/q/26492178
has text: Did you look and make sure it did keep the old install of Java?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26470639
has comment: http://stackoverflow.com/comment/41600527
tagged with: apache-storm
has answer: http://stackoverflow.com/a/26664773
type: Question
tagged with: avro
answer count: 2
has body: I'm desparately trying to configure serializer instances to use in my storm topology. The storm documentation states, there are 2 ways to register serializers : 1. The name of a class to register. In this case, Storm will use Kryo’s FieldsSerializer to serialize the class. This may or may not be optimal for the class – see the Kryo docs for more details. 2. A map from the name of a class to register to an implementation of com.esotericsoftware.kryo.Serializer. I want to use 2. -> Map&lt;String, Object&gt; serializerConfig = new HashMap&lt;String, Object&gt;(); serializerConfig.put(Record.class.getName(), new AvroSerializer(params)); conf.put(Config.TOPOLOGY_KRYO_REGISTER, serializerConfig); Unfortunately, this results in Exception in thread "main" java.lang.IllegalArgumentException: Storm conf is not valid. Must be json-serializable on topology submission. Does anyone know how to do this (register serializer instances) ? Thank you very much
downvote count: 0
has comment: http://stackoverflow.com/comment/41599405
has comment: http://stackoverflow.com/comment/41599870
tagged with: kryo
favorite count: 0
has answer: http://stackoverflow.com/a/28283493
type: UnansweredQuestion
score: 3
has title: how to register kryo serializer instances in storm?
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/41486407
has text: @WesOng Correct. I have update the code to use your URI.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26419003

http://stackoverflow.com/q/26491767
type: Question
has comment: http://stackoverflow.com/comment/41617792
has comment: http://stackoverflow.com/comment/41617575
score: 0
tagged with: java
answer count: 1
tagged with: arrays
type: UnansweredQuestion
has title: Java put matrix element in array
has comment: http://stackoverflow.com/comment/41617521
has comment: http://stackoverflow.com/comment/41617862
has body: i was trying to compare 2 variables in java but it gives me error and i cant figure it out. I am reading matrix element then put it in temp then put that temp variable in an array. but it gives error when I try to put matrix element in temp and when I compare elements. error: array required, but float found. Anyone knows how to correct this ? public float[] toSortedArray() { float b[]; float temp; int index=0; for(int i=1; i&lt;=m; i++) { for(int j=1; j&lt;=n; j++) { temp=a[m][n]; b[index++]=temp; } } Arrays.sort(b); System.out.print("["); for(int z=0; z&lt;(m*n)-1; z++) { System.out.print(b[z]+", "); } System.out.print(b[(m*n)-1]+"]\n"); }
has answer: http://stackoverflow.com/a/26491933

http://stackoverflow.com/comment/41681397
has text: I'm not exactly sure that it was an issue with time, but it seems like the only reasonable assumption to make, given that sleep() resolved the problem.
comment on: http://stackoverflow.com/a/26527107
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26454030
has comment: http://stackoverflow.com/comment/41549053
has comment: http://stackoverflow.com/comment/41549200
has comment: http://stackoverflow.com/comment/41549301
has comment: http://stackoverflow.com/comment/41549202
upvote count: 1
has comment: http://stackoverflow.com/comment/41548966
score: 1
has comment: http://stackoverflow.com/comment/41549437
has body: Your code is not ignoring the try-catch, it simply can't throw InputMismatchException, since before calling kb.nextInt() you make sure that the next input can be parsed as int (by checking that kb.hasNextInt() is true). You can remove the try-catch : while (errorLoop) { if (kb.hasNextInt()) { Player.setBet(kb.nextInt()); if (Player.getBet() &gt; 0) { errorLoop = false; } else { kb.nextLine(); System.out.println("Please enter a positive number."); } } else { kb.nextLine(); System.out.println("Please enter a positive number."); } }
answers question: http://stackoverflow.com/q/26453937
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26453937
type: Answer

http://stackoverflow.com/comment/41441167
score: 0
type: Comment
type: AnswerComment
has text: Jerry, thank you - the problem was that I was instantiating the buttons outside of the onCreate method. This is a modification of the tutorial's text, but I did that so that I could call them in the buttonClicked method also. I moved the instantiation into both methods and it works fine (until the next error, of course, but so it goes). I'm guessing it doesn't work before onCreate because Java can't use R until onCreate is called, but that is totally a guess. If you know the reason and could pass it along, that'd be great. Thanks again!
comment on: http://stackoverflow.com/a/26371034

http://stackoverflow.com/a/26453853
accepted answer of: http://stackoverflow.com/q/26453698
answers question: http://stackoverflow.com/q/26453698
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In the constructor you have: public class aBug { aBug theBug = new aBug(); ... } So while creating an instance of aBug (for example in your main) you call new aBug(), which calls the constructor again recurrently with out end overflowing the stack. I am not sure why do you think you need to create an instance of the object within itself. So it's hard to give any hints. If I guess correctly, you merged the idea of aBug and "main program" in one class. You should split it and put aBug internal stuff in its own class.
upvote count: 1
score: 1

http://stackoverflow.com/comment/41523090
comment on: http://stackoverflow.com/a/26437823
has text: small mistake from my side, i was giving wrong column name, its corrected now thanks a lot..
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41539718
has text: 1 interesting thing, using `param[0]` at `appendQueryParameter(QUERY_PARAM, params[0])`, but you are not sending any params at `execute()`this could be NPE!? +++ did you add internet permission? otherwise you have to provide more details, logs ...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26446707

http://stackoverflow.com/a/26505708
has comment: http://stackoverflow.com/comment/41643810
has comment: http://stackoverflow.com/comment/41644012
has comment: http://stackoverflow.com/comment/41644544
has comment: http://stackoverflow.com/comment/41643954
type: Answer
has comment: http://stackoverflow.com/comment/41643253
has comment: http://stackoverflow.com/comment/41643902
has comment: http://stackoverflow.com/comment/41644866
has comment: http://stackoverflow.com/comment/41644278
has comment: http://stackoverflow.com/comment/41644106
answers question: http://stackoverflow.com/q/26505603
has body: Transform it to string and get the chat at the position you want. int index = 2; int value = 1234; int digitAt=Integer.parseInt(String.valueOf(String.valueOf(value).charAt(index))); so for example : String str1 = String.valueOf(value).charAt(0); String str2 = String.valueOf(value).charAt(1); String str3 = String.valueOf(value).charAt(2); String str4 = String.valueOf(value).charAt(3);
has comment: http://stackoverflow.com/comment/41643236
score: 0

http://stackoverflow.com/a/26520348
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/57207720
has comment: http://stackoverflow.com/comment/84970288
accepted answer of: http://stackoverflow.com/q/26507099
has comment: http://stackoverflow.com/comment/53374534
has comment: http://stackoverflow.com/comment/53351121
has body: Kotlin only supports SAM conversions for Java methods, because Kotlin itself has function types. Normally, Kotlin functions should be taking () -&gt; Unit rather than Something. If you really need it to take Something, you can use a SAM constructor: call(Something { /* do something */ }) Any SAM type (Java interface with one abstract method) automatically gets such a constructor function that converts a lambda to its instance.
score: 27
upvote count: 27
answers question: http://stackoverflow.com/q/26507099

http://stackoverflow.com/comment/41647274
comment on: http://stackoverflow.com/q/26507900
has text: I added '@XmlSeeAlso(ParameterValueStruct.class)' but it complained about **@XmlRootElement** so I also added `@XmlRootElement(name = "ParameterValueStruct")` at ParameterValueStruct class and it seems to work. The thing is that in the Value element I get: ` 5 `. Is there a way to only get ` 5 ` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41418012
type: Comment
has text: I am sorry, but its giving me a syntax error. At inner.
comment on: http://stackoverflow.com/a/26381261
score: 0
type: AnswerComment

http://stackoverflow.com/q/26420355
answer count: 1
has comment: http://stackoverflow.com/comment/41487243
score: 0
type: UnansweredQuestion
has body: I have following structure in mongo collection [{ "_id" : ObjectId("543fa67e9672ec37ebe3d028"), "customerId" : "5429aed703646b52def71736", "tagName" : "abc", "tagMembers" : [ "111", "112", "123" ] }, { "_id" : ObjectId("543fa67e9672ec37ebe3d029"), "customerId" : "5429aed703646b52def71736", "tagName" : "pqr", "tagMembers" : [ "111", "112", "123" ] }] I want to calculate count of each tagMember. How do I calculate it using mongo ?? Is it possible to get count without using aggregate??
has comment: http://stackoverflow.com/comment/41487141
has answer: http://stackoverflow.com/a/26427925
tagged with: java
type: Question
tagged with: mongodb
has title: How to calculate length of an array in mongo collection?

http://stackoverflow.com/comment/41451131
has text: What about null values?
type: AnswerComment
comment on: http://stackoverflow.com/a/26400565
score: 0
type: Comment

http://stackoverflow.com/comment/41523528
comment on: http://stackoverflow.com/q/26439728
score: 0
has text: Also see http://stackoverflow.com/q/13732047/1076463
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26355115
type: Question
has answer: http://stackoverflow.com/a/26355317
linked to: http://stackoverflow.com/q/706668
has comment: http://stackoverflow.com/comment/41369310
has title: opening multiple sites in IE using java program
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41369429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41369542
has comment: http://stackoverflow.com/comment/41369306
has comment: http://stackoverflow.com/comment/41369446
tagged with: java
has body: i want to open multiple websites in IE using java program. here is the code the websites are fetched from txt file while((line = br.readLine()) != null) { StringTokenizer webLink = new StringTokenizer(line,";"); while(webLink.hasMoreTokens()) { String webPathString = webLink.nextToken(); System.out.println(webPathString); Desktop desktop = Desktop.getDesktop(); desktop.browse(new URI(webPathString)); } } problem is only last site is getting opened in a browser insted of all.
tagged with: eclipse

http://stackoverflow.com/comment/41450948
score: 2
comment on: http://stackoverflow.com/q/26398951
has text: More to the point, the Oracle team themselves have proclaimed it broken. Therefore they must have a specific reason why they have not also deprecated it.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/75918456
score: 0
has body: Need to parse each character of a Strings to calculate the sum as below: private static String calcSum(String a, String b) { StringBuilder res = new StringBuilder(); int carry = 0; int sum = 0; for(int i=a.length()-1, j=b.length()-1; i&gt;=0 || j&gt;=0; i--,j--) { char charA = (i&gt;=0)? a.charAt(i) : '0'; char charB = (j&gt;=0)? b.charAt(j) : '0'; sum = charA-'0' + charB-'0' + carry; carry = (sum&gt;=10)? 1 : 0; res.append(sum%10); } if(sum&gt;=10) { res.append(1); } return res.reverse().toString(); }
type: Answer
answers question: http://stackoverflow.com/q/26409907

http://stackoverflow.com/q/26359664
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26702383
score: 0
has answer: http://stackoverflow.com/a/26359900
possible better answer: http://stackoverflow.com/a/26359900
accepted answer: http://stackoverflow.com/a/26702383
tagged with: spring
has body: I am doing integration tests of my Spring web app and need to verify generated HTML pages. I am testing withing full Web Application Context but there is a problem with custom view resolver (JTwig). Here is my code: Test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {Config.class}) @WebAppConfiguration public class FrontControllerIntegrationTest { private MockMvc mockMvc; @Autowired WebApplicationContext wac; @InjectMocks private FrontController frontController = new FrontController(); @Before public void setup() throws JAXBException, XMLStreamException { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); } @Test public void mainSearchPage() throws Exception { mockMvc.perform(get("/search/ww/en/altivar")) .andExpect(status().isOk()) .andExpect(view().name("searchResults")) .andExpect(model().attribute("idolResponse", isA(SearchResults.class))) .andExpect(model().attribute("numberOfPages", is(188))) .andExpect(model().attribute("stateId", isNull())); } } Custom view resolver: public class Config extends WebMvcConfigurerAdapter implements WebApplicationInitializer { ... @Bean public ViewResolver viewResolver() { JtwigViewResolver view = new JtwigViewResolver(); view.setPrefix("/WEB-INF/templates/"); view.setSuffix(".twig"); return view; } Test fails with error: Caused by: com.lyncode.jtwig.exception.ResourceException: Resource /WEB-INF/templates/searchResults.twig not found at com.lyncode.jtwig.resource.WebJtwigResource.retrieve(WebJtwigResource.java:36) at com.lyncode.jtwig.parser.parboiled.JtwigContentParser.parse(JtwigContentParser.java:62) ... 54 more After more digging I know where the exception is thrown: @Override public InputStream retrieve() throws ResourceException { InputStream resourceAsStream = servletContext.getResourceAsStream(url); if (resourceAsStream == null) throw new ResourceException("Resource "+url+" not found"); return resourceAsStream; } Where servletContext is org.springframework.mock.web.Mock…
tagged with: unit-testing
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has title: Custom view resolver missing in Spring test
tagged with: integration-testing

http://stackoverflow.com/comment/41586842
score: 0
comment on: http://stackoverflow.com/q/26474469
type: Comment
type: QuestionComment
has text: What is a Java XML object? Do you mean the string representation of your ContactInfo object?

http://stackoverflow.com/comment/41612962
comment on: http://stackoverflow.com/q/26469705
score: 0
has text: @JoopEggen Okay I'll do that next time. Thank you for the help.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26418712
has comment: http://stackoverflow.com/comment/62985407
score: 47
type: Answer
accepted answer of: http://stackoverflow.com/q/26404381
answers question: http://stackoverflow.com/q/26404381
has body: I feel odd to post answer for my own question. But i finally achieved it through the following... } catch (HttpClientErrorException e) { System.out.println(e.getStatusCode()); System.out.println(e.getResponseBodyAsString()); } I was incorrectly searching for errors in response entity. But it is available in the exception.
upvote count: 47
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/59436012
has text: This library add view properly on header in LinearLayoutManager but I want to set view as header in GridLayoutManager, which take place entire width of screen. Can it is possible with this library.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/35482745
type: Comment

http://stackoverflow.com/comment/41617507
type: AnswerComment
comment on: http://stackoverflow.com/a/26488470
type: Comment
has text: This works great for a regular Image, but do you know how I could get this to work with a BufferedImage?
score: 0

http://stackoverflow.com/a/26478069
has comment: http://stackoverflow.com/comment/41593042
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26478022
has body: Have a look at the BlockingQueue interface and the classes that implement it. Partway down on this link, the have some code showing how to setup a producers and a few multithreads consumers. Just what you want I thinks.
accepted answer of: http://stackoverflow.com/q/26478022
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41375379
has text: @mohamad-mohsen-taheri I put all the files from your question into one directory and run the commands above. The file named "test.log" was created
type: AnswerComment
comment on: http://stackoverflow.com/a/26355069
score: 0
type: Comment

http://stackoverflow.com/a/26413432
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/90749416
has comment: http://stackoverflow.com/comment/52357622
answers question: http://stackoverflow.com/q/26413431
has comment: http://stackoverflow.com/comment/89936365
score: 83
has comment: http://stackoverflow.com/comment/89939211
accepted answer of: http://stackoverflow.com/q/26413431
has body: After clarification with Oracle, the following artifacts should be used: Runtime If you want to unmarshal XML to Java objects or marshal Java objects as XML: org.glassfish.jaxb jaxb-runtime ... Schema compiler (XJC) If you have an XML Schema and want to generate the Java code out of it: org.glassfish.jaxb jaxb-xjc ... Schema generator (JXC/schemagen) If you have Java classes with JAXB annotations and want to generate a XML Schema based on them: org.glassfish.jaxb jaxb-jxc ... The two latter artifacts (org.glassfish.jaxb:jaxb-xjc and org.glassfish.jaxb:jaxb-jxc) are wrapped by Maven plugins so you normally would not need them in the runtime. Eclipse usage If your Maven projects somehow don't get the full classpath, turn on debug output and check the Maven console. You might be seeing the following error message there: [ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${tools.jar} @ This is due to the following problem: Maven not picking JAVA_HOME correctly The solution by @rustyx is to add -vm option to the eclipse.ini: -vm <PATH_TO_JDK>\jre\bin\javaw.exe
has comment: http://stackoverflow.com/comment/89935610
type: AcceptedAnswer
upvote count: 83

http://stackoverflow.com/q/26390406
has body: I have a 4x4 gridlayout and I'm trying to add 2 title bars above the tables I've created. I'm creating panels for title bars but because of the gridlayout it fills up all the space. Here's the code: private WebScrollPane createPosRiskPanelWindow(int w, int h) { //Content area posRiskPanel = new WebPanel((new GridLayout(2,2))); posRiskPanel.setBackground(Color.WHITE); //Add title bars WebPanel posTitle = new WebPanel(new WebLabel("Current Positions")); posRiskPanel.add(posTitle); WebPanel riskTitle = new WebPanel(new WebLabel("Risk Exposure")); posRiskPanel.add(riskTitle); //Panels CreatePositionPanel(posRiskPanel); CreateRiskParamsPanel(posRiskPanel); //Scroll content posRiskScroll = new WebScrollPane (posRiskPanel, false); posRiskScroll.setPreferredSize (new Dimension (w, h)); return posRiskScroll; } And here's what it looks like: Is there a way I can resize those top 2 boxes?
tagged with: java
has title: Resizing GridLayout area
tagged with: swing
type: Question
score: 0
answer count: 2
tagged with: grid-layout
tagged with: layout-manager
has answer: http://stackoverflow.com/a/26405588
has answer: http://stackoverflow.com/a/26390482
type: UnansweredQuestion

http://stackoverflow.com/comment/41597655
comment on: http://stackoverflow.com/q/26480711
type: Comment
type: QuestionComment
has text: You should replace the while loop with executor.awaitTermination(...). The while loop (called busy-wait) will occupy the CPU, might starve the other threads, drain your battery and eat your lunch.
score: 0

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/26382515
tag name: tablemodel
tags question: http://stackoverflow.com/q/26496985

http://stackoverflow.com/q/26406014
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41461148
linked to: http://stackoverflow.com/q/9989414
has title: Java \n line separator not working
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26406515
possible better answer: http://stackoverflow.com/a/26406257
tagged with: syntax
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26406257
upvote count: 1
type: Question
tagged with: performance
has body: I am creating an application that has a data log. I build up this data with a string that I add to everytime the application receives data and then display it in an edittext box. The problem I am having is that it will display the data but without the new lines. A basic example of the code: String logText; EditText etLog; logText = data + "\n" + logText; etLog.setText(logText); I know that I can use nl = System.getProperty("line.separator"); to get a new line but I'm puzzled as to why "\n" is not working when I've used it in different apps I've created before.
tagged with: newline
accepted answer: http://stackoverflow.com/a/26406515
answer count: 2

http://stackoverflow.com/comment/41608494
has text: There is in fact time to be gained with this approach, but only in certain scenarios: if you have occasional long waits until the next line is available, with your approach you wouldn't be blocked on the processing side. However, the processing time should be substantial (compared to average I/O latency for single line) for this effect to manifest.
comment on: http://stackoverflow.com/q/26485102
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26456130
tagged with: java
has title: Using JMF to get a frame from a video
upvote count: 1
downvote count: 0
favorite count: 0
tagged with: frame
tagged with: video
tagged with: jmf
answer count: 0
type: UnansweredQuestion
has body: I have to take in a video file (.mpg or .avi or .mov ect...) using JMF and where the user stops the video (or pauses) I need to get that frame. If I can get it into a frame buffer then I'm golden (or even save the frame as a image file like jpg). As once I have the frame I just need to get RGB values from the pixels in the frame.(which I already have made a method for) My issue here is I have not got any experience in JMF, but I have a source file that opens a window and then I can browse for a video file which seems to only work half the time. I gather this is a bit of a tall order as I am pretty much in the dark on how to do this, and everything I try looking up is not of any real help, if someone knows a link that has some example code that would be wonderful. Thanks.
type: Question
score: 1

http://stackoverflow.com/a/26443357
has comment: http://stackoverflow.com/comment/41597624
has comment: http://stackoverflow.com/comment/41586159
has body: This is totally unrelated to the issue you linked which is about addressing faulty static analyzers and was correctly rejected. The issue you're experiencing is common in Java when mixing primitive types. To avoid typing that L you'd have to provide overloaded versions of all the matchers--not just is. Consider these examples: assertThat(longValue, greaterThan(1)); assertThat(longList, contains(1, 2, 3)); Update You can easily add your own overloaded versions to perform the conversion: public static Matcher&lt;Long&gt; is(Integer value) { return org.hamcrest.core.Is.is(value.longValue()); } Of course, now that you have one to convert from int to long you'll want ones for float and double: public static Matcher&lt;Long&gt; is(Float value) { return org.hamcrest.core.Is.is(value.longValue()); } public static Matcher&lt;Long&gt; is(Double value) { return org.hamcrest.core.Is.is(value.longValue()); } Since Java won't automatically convert from byte to Integer*, you also needs versions for byte and short. That's ugly enough, but what about casting to the other types, e.g., from int to double? public static Matcher&lt;Double&gt; is(Integer value) { return org.hamcrest.core.Is.is(value.doubleValue()); } Compile Error: Duplicate method is(Integer) Uh oh! These won't work because Java doesn't allow you to overload methods based on the return type. You'll have to declare these methods in separate classes which I leave to you. Given the giant mess this would create, I doubt the Hamcrest authors would be open to such an addition given the low payoff. Honestly, you're much better off being explicit by using 1L and 1.0 as needed. * Though the compiler will convert from byte to int which could be boxed to Integer.
upvote count: 7
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/41548566
has comment: http://stackoverflow.com/comment/41538309
accepted answer of: http://stackoverflow.com/q/26437839
type: Answer
has comment: http://stackoverflow.com/comment/41538257
has comment: http://stackoverflow.com/comment/41544551
answers question: http://stackoverflow.com/q/26437839
score: 6

http://stackoverflow.com/comment/41641155
type: Comment
comment on: http://stackoverflow.com/a/26504555
has text: When I look at the file nothing has been changed, no lines were added. There are not continuous lines, I just have to add a blank line and a test line.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26408386
type: Answer
answers question: http://stackoverflow.com/q/26408160
accepted answer of: http://stackoverflow.com/q/26408160
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41465321
has body: java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to org.json.JSONObject " I'll look into that... seems like your imports are wrong. parser.parse seems to return another kind of jsonobject
score: 0

http://stackoverflow.com/comment/41927744
comment on: http://stackoverflow.com/a/26478900
type: Comment
has text: I'll come up with some basic sample code and send it to you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41371156
type: Comment
has text: I have so many approach on net but confused. People have used joda, util.calender etc. Can you help me using util.Calender
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26356104

http://stackoverflow.com/comment/41450701
type: QuestionComment
comment on: http://stackoverflow.com/q/26398951
has text: @Narmer, Oh, right. But this is still just one answer.
score: 0
type: Comment

http://stackoverflow.com/q/26508193
possible better answer: http://stackoverflow.com/a/26512613
upvote count: 2
has answer: http://stackoverflow.com/a/26512613
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27281191
downvote count: 1
type: Question
has body: I have already a framework. So by which steps I can add selenide methods and code in selenium webdriver code?
answer count: 2
has title: How can i Integrate Selenide with existing selenium webdriver code?
tagged with: selenide
favorite count: 0
accepted answer: http://stackoverflow.com/a/27281191
tagged with: testng

http://stackoverflow.com/q/26387399
answer count: 4
has answer: http://stackoverflow.com/a/30980614
type: AnsweredQuestion
score: 265
tagged with: transactions
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26394757
has answer: http://stackoverflow.com/a/26387927
type: Question
upvote count: 265
has body: I don't understand what is the actual difference between annotations javax.transaction.Transactional and org.springframework.transaction.annotation.Transactional? Is org.springframework.transaction.annotation.Transactional an extension of javax.transaction.Transactional or they have totally different meaning? When should each of them be used? Spring @Transactional in service layer and javax in DAO? Thanks for answering.
tagged with: jta
has answer: http://stackoverflow.com/a/62702146
accepted answer: http://stackoverflow.com/a/26387927
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/62702146
has title: javax.transaction.Transactional vs org.springframework.transaction.annotation.Transactional
tagged with: spring

http://stackoverflow.com/q/26507376
upvote count: 0
has title: How to remove space from the xml which is now made as a String?
score: -3
has comment: http://stackoverflow.com/comment/41645526
type: Question
has comment: http://stackoverflow.com/comment/41647011
has comment: http://stackoverflow.com/comment/41646744
tagged with: java
has comment: http://stackoverflow.com/comment/41647597
has comment: http://stackoverflow.com/comment/41645740
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/41647222
has comment: http://stackoverflow.com/comment/41645439
has comment: http://stackoverflow.com/comment/41647556
favorite count: 0
has comment: http://stackoverflow.com/comment/41645518
has comment: http://stackoverflow.com/comment/41645766
has comment: http://stackoverflow.com/comment/41645333
has comment: http://stackoverflow.com/comment/41647752
has comment: http://stackoverflow.com/comment/41646774
has comment: http://stackoverflow.com/comment/41645320
has answer: http://stackoverflow.com/a/26507892
accepted answer: http://stackoverflow.com/a/26507892
has body: Sample.xml: <?xml version="1.0" encoding="UTF-8" ?> Tove Jani Reminder Don't forget me this weekend! Method:xmlToStringStreamExample() public String xmlToStringStreamExample () { StringBuilder x = new StringBuilder(); InputStream is = new ByteArrayInputStream(ClassName.Class().getClassLoader(). getResource("Sample.xml")); // read it with BufferedReader BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; try { while ((line = br.readLine()) != null) { x.append(line); } } catch(IOException e) { e.printStackTrace(); } return x.toString(); } This method and xml are correct. However while printing the value of x I'm getting spaces. And I want to remove these spaces. I tried x.repalceAll("\\\s", ""); but this did not work - the spaces were still there. I also tried x.replace(" ", ""); but this too did not remove the spaces. Could someone help me on this? Spaces are included when the next line includes tags.
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/41586738
score: 0
has text: Please indicate what the input String is and what output you expect. Note - your c1/c2 vars are 'char' type so the '+' operator is mathematical addition.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26474582

http://stackoverflow.com/comment/41456120
comment on: http://stackoverflow.com/q/26371934
score: 0
type: QuestionComment
has text: The `javax.imageio` API is good for those tasks. `BufferedImage` just represents pixel data. There's a class `IIOImage` that contains metadata (`IIOMetadata`), like file format details and DPI, along with the pixel data (in the form of a `BufferedImage`, or its superclass `RenderedImage`).
type: Comment

http://stackoverflow.com/comment/75793034
type: AnswerComment
comment on: http://stackoverflow.com/a/26427609
type: Comment
has text: @AndreiVolgin will look into it, much appreciated!
score: 0

http://stackoverflow.com/comment/41615252
type: Comment
comment on: http://stackoverflow.com/a/26490662
score: 0
type: AnswerComment
has text: i can't syncronize on the same row, because for example, if a take the lock for row1 with thread1, another thread that want row1 can't so, this is not the problem.

http://stackoverflow.com/comment/41383797
comment on: http://stackoverflow.com/a/26362979
type: AnswerComment
type: Comment
score: 0
has text: thank you for your answere, but is creating a jar at the beginning the only way? when i was told what the task is, it sounded like i should do it without using a jar except the already existing one i have to include :§

http://stackoverflow.com/comment/41633924
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26467413
has text: @JusticeBauer: Please do not use comments to draw attention to completely unrelated other questions.
type: Comment

kml
tags question: http://stackoverflow.com/q/26460798
tag name: kml
type: Tag

http://stackoverflow.com/q/26433278
has comment: http://stackoverflow.com/comment/41511346
has comment: http://stackoverflow.com/comment/41511883
accepted answer: http://stackoverflow.com/a/26437116
type: AnsweredQuestion
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/41516340
has comment: http://stackoverflow.com/comment/41511727
has comment: http://stackoverflow.com/comment/41520735
type: Question
has comment: http://stackoverflow.com/comment/41520709
has body: The first "foo" is normal, but the second one is so huge I can only see the base of the "f". The font-size is the default. BufferedImage image = new BufferedImage(500, 500, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); Shape ellipse = new Ellipse2D.Double(0, 0, 1.0, 1.0); g2.setPaint(Color.RED); g2.drawString("foo", 100, 100); g2.scale(500.0f / length, 500.0f / length); g2.drawString("foo", 1, 1); Changing the font size will not help because it only allows int sizes and the size that would make sense for the scale is something like 0.02. The reason I need to draw the text while in scaled space is because I am drawing a grid of nodes and I want to scale the coordinates to the number of nodes in each dimension. That way I do not have to do complicated calculations. I need the text to label the edges. Update: I am able to get the text by doing the following sequence each time I want to draw the text: saving the transform, translating to the desired location in scaled space, unscaling, drawing the text at (0, 0), and restoring the transform.
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/41511604
has title: Graphics2D - Text is HUGE in scaled coordinate space
has answer: http://stackoverflow.com/a/26437116
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41511684
has comment: http://stackoverflow.com/comment/41515762
has comment: http://stackoverflow.com/comment/41511465
tagged with: graphics

http://stackoverflow.com/comment/41392079
type: Comment
type: QuestionComment
has text: but there is error when i try mvn help:help! seems it can't download but I don't know why?1
score: 0
comment on: http://stackoverflow.com/q/26367035

http://stackoverflow.com/a/26466233
score: 1
has body: okay, lets say you have an Apartment class with an contructor like this: public class Apartment{ public Apartment(int price, int numberOfBaths, int numberOfBedrooms, int squarefeet){ this.price = prive; ... } } this is how you create a new Instance of Apartment: Apartment newApartment = new Apartment(price, numberOfBaths, numberOfBedrooms, squarefeet); knowing that, your addApartment method looks probably like that: public void addApartment(int price, int numberOfBaths, int numberOfBedrooms, int squarefeet) { House ApartmentEntry = new Apartment(price, numberOfBaths, numberOfBedrooms, squarefeet); ... } I dont know what you wanted to do with that ArrayList, but for sure you have to declare it first: ArrayList&lt;Apartment&gt; list = new ArrayList&lt;Apartment&gt;(); list.add(newApartment);
answers question: http://stackoverflow.com/q/26465974
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41636153
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26486014
has text: Thank you! I didn't know about the issues with boot and JSP so I switched to thymeleaf, using a starter project.
score: 0

http://stackoverflow.com/q/26392001
has body: I'm trying to implement a custom sorted binary tree in java, and I've had some problems with comparisons. I'm trying to implement a generic tree, so I would like to do something like: public boolean contains(int i){ if(i == currentNode.value) return true; else if (i &gt; currentNode.value) // Go right else if (i &lt; currentNode.value) // Go left ... } But I'm using objects (and I'm assuming they are objects that can be compared), so I wanted to do something like: public boolean contains(Object o){ if(o == currentNode.value) // value is of Object class return true; else if (o &gt; currentNode.value) // Problem // Go right ... } So my problem right now is that it's not possible to use the operators > and &lt; with objects, and so far I've been unable to think of another way to go about this.
possible better answer: http://stackoverflow.com/a/26392041
downvote count: 1
answer count: 4
has answer: http://stackoverflow.com/a/26392041
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26392109
tagged with: java
has answer: http://stackoverflow.com/a/26392197
score: -1
has answer: http://stackoverflow.com/a/26392230
type: Question
upvote count: 0
tagged with: data-structures
has title: Comparing variables of class Object
accepted answer: http://stackoverflow.com/a/26392230
has comment: http://stackoverflow.com/comment/41437571
favorite count: 0

http://stackoverflow.com/q/26453542
type: UnansweredQuestion
has title: ArrayList for-loop is only working for the first element
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26453577
score: 0
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41547910
answer count: 3
has answer: http://stackoverflow.com/a/26453621
tagged with: arraylist
has body: I'm working on a project in Javascript that requires me to write a class with a method that prints the information for a Tree object in a certain format. This is my toString method so far (the t.toString() inside the method is a reference to a different toString method in a different class). It's supposed to display the information for one Tree object, then go to a new line and display the information for the next Tree object. public String toString() { for (Tree t : db) { return t.toString() + "\n"; } return null; } I tested the method using this code. TreeDB trees = new TreeDB(); Tree oak = new Tree("Oak", 24, 27); Tree maple = new Tree("Maple", 8, 38); Tree spruce = new Tree("Spruce", 11, 32); trees.add(oak); trees.add(maple); trees.add(spruce); System.out.println(trees.toString()); It prints the information for Oak, but not for Maple or Spruce. I'm assuming something is wrong with the header for my for-loop. Can someone help me figure out how to make it print the information for all of the Tree objects?
has comment: http://stackoverflow.com/comment/41547970
has answer: http://stackoverflow.com/a/26453682

http://stackoverflow.com/a/26461026
answers question: http://stackoverflow.com/q/26451119
has body: You can modify the Wildfly JNDi names and strip the undesired prefixes from the respective JNDI names to find the least common denominator in both app servers. The following works for me with Glassfish and JBoss AS 7.1. Since I expect Wildfly to be backwards-compatible to JBoss in this regard, I guess it'll work for Wildfly as well. Persistence Inject as: @PersistenceContext(unitName="TestPU") private EntityManager entityManager; or via ejb-jar.xml: <persistence-context-ref> <persistence-context-ref-name>entityManager</persistence-context-ref-name> TestPU ... </persistence-context-ref> The corresponding persistence.xml: datasources/TestDS org.jeeventstore.persistence.jpa.EventStoreEntry <property name="hibernate.show_sql" value="false"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.connection.charSet" value="UTF-8"/> <property name="eclipselink.logging.level" value="FINE"/> <property name="eclipselink.logging.level.sql" value="FINE"/> <property name="eclipselink.logging.parameters" value="true"/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> (note the simple jta-data-source JNDI name) Here's a glassfish-resources.xml file used to specify a Derby database on deployment, a similar setup can be used for MySQL or Postgres. <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool" jndi-name="datasources/TestDS"/> <property name="databaseName" value="target/databases/derby"/> <property name="createDatabase" value="create"/> And the settings from the JBoss standalone.xml: jdbc:postgresql://localhost/test_db ... Resources I have not injected a JavaMail component on Glassfish, but similar to the datasoruce settings, it might be worth a try to strip the "java:" part from the @Resource annotation as well. @Resource(name = "mail/myMailSession") and then configure Wildfly such that that the mail resource is available at the "java:mail/myMailSession" JNDI lo…
type: Answer
accepted answer of: http://stackoverflow.com/q/26451119
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26438598
tagged with: java
has body: I am facing issue in displaying a struts action for result of json type. In the similar there is LoginJson.action which works fine. I do not understand where is the mistake. The error I could see is Error 404 There is no Action mapped for namespace [/] and action name [RegisterJson] associated with context path []. Here is my code : !
accepted answer: http://stackoverflow.com/a/26442410
tagged with: struts2
has title: Facing issue in adding mutiple Struts actions
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41521463
favorite count: 0
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/26442410
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41523893
score: 1
tagged with: xml-configuration
upvote count: 1
type: Question
tagged with: action-mapping

http://stackoverflow.com/comment/41516681
type: Comment
has text: hey! That sounds great and thank you for finding my error. I am having another problem. It is weird that when I copy and paste your suggestion, it won't compile! Here is the error that I am getting: " Project3.java:45: error: reached end of file while parsing } "
comment on: http://stackoverflow.com/a/26435935
type: AnswerComment
score: 0

http://stackoverflow.com/a/26462958
type: AcceptedAnswer
downvote count: 0
has body: Dear AnkitNeo you have given the answer yourself. By setting the variable to null and calling System.gc(); you will free up the memory. However, it is not guaranteed that System.gc() will actually garbage collect. According to this post: When does System.gc() do anything most of the time the system will garbage collect. I believe it will just not GC if there is currently a very high CPU load.
type: Answer
has comment: http://stackoverflow.com/comment/41564718
upvote count: 3
answers question: http://stackoverflow.com/q/26462821
has comment: http://stackoverflow.com/comment/41571569
has comment: http://stackoverflow.com/comment/41564865
accepted answer of: http://stackoverflow.com/q/26462821
score: 3

http://stackoverflow.com/comment/41535406
score: 0
has text: I was mainly thinking of providing a verification level, a integer from 1-10 or something, the lower it is, the more strict the verification, and the higher it is, the more lenient.
comment on: http://stackoverflow.com/q/26446348
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/55147394
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26666965
has text: Retrofit is a REST api for android, basically you need to have a server side application, like php where you will need also to build your api. If you havent tried to create a simple mobile application with REST in android, you might start with this tutorial,http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/. And if you already have experience in REST, Retrofit will be a good library to use.
score: 2

http://stackoverflow.com/comment/41565895
type: AnswerComment
type: Comment
score: 0
has text: Changing the contentType to JSON doesn't automatically change your content to JSON. First get familiar with Ajax and HTML then start with JSON.
comment on: http://stackoverflow.com/a/26462175

http://stackoverflow.com/a/26449530
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41549770
has body: GC overhead limit exceeded means you run out of memory when using the CMS garbage collector. This can either be due to a memory leak or your application simply having a larger live dataset than your VM options allow. To figure out the issue use -XX:+HeapDumpOnOutOfMemoryError and possibly -XX:HeapDumpPath (check Java HotSpot VM Options for more information). Then run a tool like Eclipse MAT to figure out what the issue is. There are also several commercial tools available like Plumbr.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41544992
accepted answer of: http://stackoverflow.com/q/26447834
has comment: http://stackoverflow.com/comment/41555933
answers question: http://stackoverflow.com/q/26447834

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/26396423
tags question: http://stackoverflow.com/q/26436027
type: Tag

http://stackoverflow.com/comment/41554866
has text: possible [duplicate](http://stackoverflow.com/a/26132743/2587435)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26456658

http://stackoverflow.com/q/26481653
tagged with: eclipse
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41630135
has answer: http://stackoverflow.com/a/26493335
has comment: http://stackoverflow.com/comment/41602346
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41630091
has comment: http://stackoverflow.com/comment/41602689
tagged with: osgi
accepted answer: http://stackoverflow.com/a/26493335
tagged with: maven
upvote count: 1
has title: Error: type org.osgi.util.tracker.ServiceTracker does not take parameters
type: AnsweredQuestion
tagged with: osgi-bundle
score: 1
tagged with: java
has body: I have a OSGi project and I am using Maven. In a bundle I need to import org.osgi.util.tracker.ServiceTracker, and create a property: ... import org.osgi.util.tracker.ServiceTracker; ... private ServiceTracker<Object, Object> serviceTracker; I clearly have org.eclipse.osgi in my dependencies as denoted in below (part of my pom.xml). org.eclipse org.eclipse.osgi 3.8.0.v20120529-1548 provided Within Eclipse, I can find the definition of the class. public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> { ... } However, when I compile my project by maven command: mvn clean install I got the error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project <my project name>: Compilation failure: Compilation failure: [ERROR] /Activator.java:[75,27] type org.osgi.util.tracker.ServiceTracker does not take parameters What the hell is happening?

akka
type: Tag
tags question: http://stackoverflow.com/q/26406054
tags question: http://stackoverflow.com/q/26490235
tags question: http://stackoverflow.com/q/26422364
tags question: http://stackoverflow.com/q/26367922
tag name: akka
tags question: http://stackoverflow.com/q/26380940

http://stackoverflow.com/q/26389115
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26389510
downvote count: 0
score: 1
tagged with: java
tagged with: dom
tagged with: html-parsing
type: Question
tagged with: jsoup
answer count: 2
has title: Get all text content between tags from a URL?
has body: By having a URL link. For example: http://www.engineersireland.ie/home.aspx I can read them in by using java built in java.net.URL or Jsoup. Then, I need to extract all text content between tags after tag. There will be tags within tags. What all I need is the text in the middle. for example: Engineers Ireland - Home Members can login for access to exclusive content, event booking, shop discounts and more... Your Login Details Your Membership Number Enter your membership number Password Enter your password Remember Me Forgot your password? Haven't registered yet? From this html code, all I need are just: Your Membership Number Enter your membership number Password Enter your password Remember Me Other thing is that, Keep in mind, the tag names and the number of tag are always random depend on the web page iteself. Any help? By using Jsoup or java? Thx
has answer: http://stackoverflow.com/a/26389510
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/41432520
favorite count: 0
has comment: http://stackoverflow.com/comment/41432053
has answer: http://stackoverflow.com/a/26390083
accepted answer: http://stackoverflow.com/a/26390083
has comment: http://stackoverflow.com/comment/41436914

http://stackoverflow.com/comment/42329994
has text: I think your problem was the server config in your tomcat maven configuration. It conflicted with the username/password settings. In the pom.xml file you should either remove the tomcat7 part, and keep the username and password, or remove the username and password and keep tomcat7 .
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26751995
type: Comment

http://stackoverflow.com/comment/41625822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26488667
score: 0
has text: @ChristopherSchultz, I am aware of that wrapper. That gave me personally always grief and a false sense of security. I would avoid that altogether. TLS is available everywhere now.

http://stackoverflow.com/comment/41637937
type: Comment
type: QuestionComment
has text: T1 holds lock on row 1, T2 holds lock on row 2. Not synchronized.. T1 holds lock on row 1, T2 tries to get lock on row 1. Synchronized...
comment on: http://stackoverflow.com/q/26502528
score: 0

http://stackoverflow.com/comment/41516091
has text: @Makoto - The big-O is right. The performance for N calls to get(i) where i is 0 to N-1 is `O(N^2)` for a linked list. Even if you pick the shorter traversal (fwd versus bwd)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26435621
type: Comment

http://stackoverflow.com/a/26657206
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41926696
answers question: http://stackoverflow.com/q/26455240
has body: What is happening is that the JustFLAC code is saying that the audio format of the FLAC file is 'PCM_SIGNED 192000.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian' (which looks correct). The player code will then be asking the output device for a SourceDataLine which matches this format so that it can write the decoded data to the line. However the output device is throwing an exception saying that it does not support this format. This may be because the actual device does not support this format or it may be that the Java Sound API does not support it. Certainly on the Mac version of Java 6 the Java Sound API did not support 24 bit output, this was changed in Java 7 (and 8). Testing on my Mac with Java 8 a 24 bit 192Khz file plays OK.
has comment: http://stackoverflow.com/comment/41926280
downvote count: 0

http://stackoverflow.com/comment/41395501
has text: Related: [http://stackoverflow.com/questions/8237193/java-convert-milliseconds-to-date](http://stackoverflow.com/questions/8237193/java-convert-milliseconds-to-date)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26369111

http://stackoverflow.com/a/26461923
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26461860
has comment: http://stackoverflow.com/comment/41569051
answers question: http://stackoverflow.com/q/26461860
has body: The recommended method to create a new SQLite database is to create a subclass of SQLiteOpenHelper and override the onCreate() method, in which you can execute a SQLite command to create tables in the database. For example: public class DictionaryOpenHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 2; private static final String DICTIONARY_TABLE_NAME = "dictionary"; private static final String DICTIONARY_TABLE_CREATE = "CREATE TABLE " + DICTIONARY_TABLE_NAME + " (" + KEY_WORD + " TEXT, " + KEY_DEFINITION + " TEXT);"; DictionaryOpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DICTIONARY_TABLE_CREATE); } } Here are instructions. http://developer.android.com/guide/topics/data/data-storage.html#db
has comment: http://stackoverflow.com/comment/41566440

css
tags question: http://stackoverflow.com/q/26497159
tags question: http://stackoverflow.com/q/26390634
tags question: http://stackoverflow.com/q/26450400
tags question: http://stackoverflow.com/q/26482047
tags question: http://stackoverflow.com/q/26458572
tags question: http://stackoverflow.com/q/26509420
tags question: http://stackoverflow.com/q/26414158
type: Tag
tags question: http://stackoverflow.com/q/26463168
tags question: http://stackoverflow.com/q/26353839
tags question: http://stackoverflow.com/q/26446808
tag name: css
tags question: http://stackoverflow.com/q/26471141

http://stackoverflow.com/q/26510391
has body: I'm getting a parse error with my shaders only in GLSL-ES 2.0 (android), they compile and run well in the desktop. The error is the following: SGR(12584): Vertex shader compilation failed. SGR(12584): ERROR: 0:397: '(' : Syntax error: syntax error SGR(12584): ERROR: 1 compilation errors. No code generated. SGR(12584): Fragment shader compilation failed. SGR(12584): ERROR: 0:211: '(' : Syntax error: syntax error SGR(12584): ERROR: 1 compilation errors. No code generated. The line where it crashes (in both vertex and fragment) is the line after the main() method. Here is the fragment shader: //////////////////////////////////////////////////////////////////////////////////// ////////// POSITION ATTRIBUTE - FRAGMENT //////////////////////////////////////////////////////////////////////////////////// #define nop() {} varying vec4 v_position; vec4 g_position = vec4(0.0, 0.0, 0.0, 1.0); #define pullPosition() (g_position = v_position) //////////////////////////////////////////////////////////////////////////////////// ////////// COLOR ATTRIBUTE - FRAGMENT /////////////////////////////////////////////////////////////////////////////////// varying vec4 v_color; vec4 g_color = vec4(1.0, 1.0, 1.0, 1.0); #define pullColor() (g_color = v_color) //////////////////////////////////////////////////////////////////////////////////// ////////// NORMAL ATTRIBUTE - FRAGMENT /////////////////////////////////////////////////////////////////////////////////// varying vec3 v_normal; vec3 g_normal = vec3(0.0, 0.0, 1.0); #define pullNormal() (g_normal = v_normal) //////////////////////////////////////////////////////////////////////////////////// ////////// BINORMAL ATTRIBUTE - FRAGMENT /////////////////////////////////////////////////////////////////////////////////// varying vec3 v_binormal; vec3 g_binormal = vec3(0.0, 0.0, 1.0); #define pullBinormal() (g_binormal = v_binormal) //////////////////////////////////////////////////////////////////////////////////// ////////// TANGENT ATTRIBUTE…
has title: GLSL ES syntax error: '(' parse error after main()
upvote count: 1
downvote count: 1
answer count: 1
tagged with: opengl-es
favorite count: 0
tagged with: opengl-es-2.0
type: AnsweredQuestion
tagged with: shader
tagged with: java
type: Question
tagged with: libgdx
has answer: http://stackoverflow.com/a/26511925
accepted answer: http://stackoverflow.com/a/26511925
score: 0

http://stackoverflow.com/comment/41570920
has text: Are you using spring in your application?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26466515

http://stackoverflow.com/comment/41491196
score: 1
comment on: http://stackoverflow.com/q/26422320
type: Comment
type: QuestionComment
has text: Try to do all together inside a `@Transactional` annotated method on a service instance. (example in `userService.createUserAndRole(...)`

http://stackoverflow.com/comment/41521032
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26436801
score: 1
has text: See linked duplicate. In short: it doesn't fit in the "lifetime long running" nature of a Java EE application. E.g. if an exception is thrown within a timer thread, the timer is effectively dead. It basically won't run anymore until you restart the whole server. This just doesn't make sense.

http://stackoverflow.com/comment/41624371
type: Comment
score: 2
has text: Looks like the AOSP Issue Tracker has already caught wind of this bug, so I left a comment and starred it. The suggested fix (to replace `aapt.exe` in android-sdk\build-tools\21.0.1) worked for me without having to make any other modifications. https://code.google.com/p/android/issues/detail?id=77813
type: AnswerComment
comment on: http://stackoverflow.com/a/26493179

http://stackoverflow.com/comment/41411325
type: Comment
has text: if i do this byte [] encodeByte=Base64.decode(output.toString(),Base64.DEFAULT); i get bad base 64 as error
comment on: http://stackoverflow.com/q/26378017
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41548704
has text: The elements of your `messageClasses` list would be `Class` objects, not `IMessage` objects.
score: 1
comment on: http://stackoverflow.com/q/26453824
type: Comment
type: QuestionComment

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26434419
type: Tag

http://stackoverflow.com/comment/41559127
has text: @Avacay If you enter 67, the first condition (as in my answer) should give you an error message.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26459388
type: Comment

http://stackoverflow.com/q/26426694
has answer: http://stackoverflow.com/a/26775786
tagged with: autowired
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/39616296
accepted answer: http://stackoverflow.com/a/26426931
has body: I have classes, xml configuration file and error stack trace like this. I have no idea why @Qualifier doesn't work. I see on errors that he don't even do anything. DOG public class SimpleDog implements Dog { @Autowired @Qualifier("small") private Size size; private String name; public Size getSize() { return size; } public void setSize(Size size) { this.size = size; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public void giveSound() { System.out.println("dog size is : width : (" + size.getWidth() + ") , height : (" + size.getHeight() + ")"); System.out.println("dog's name : " + name); } } TEST CLASS public class Test2 { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring-test2.xml"); SimpleDog dog = (SimpleDog) context.getBean("dog"); dog.giveSound(); } } spring.xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;bean id="dog" class="com.tests.test2.SimpleDog"&gt; &lt;property name="name" value="Puppy" /&gt; &lt;/bean&gt; &lt;bean id="size1" class="com.tests.test2.Size"&gt; &lt;qualifier value="small"/&gt; &lt;property name="height" value="2"/&gt; &lt;property name="width" value="1"/&gt; &lt;/bean&gt; &lt;bean id="size2" class="com.tests.test2.Size"&gt; &lt;qualifier value="large"/&gt; &lt;property name="height" value="20"/&gt; &lt;property name="width" value="10"/&gt; &lt;/bean&gt; &lt;bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/&gt; &lt;/beans&gt; Error Stack Trace WARNING: Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dog': Inj…
has answer: http://stackoverflow.com/a/32512064
has answer: http://stackoverflow.com/a/26427004
has answer: http://stackoverflow.com/a/26430029
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/30080888
tagged with: spring
upvote count: 6
has title: Spring 4.1 @Qualifier doesnt'work
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26426931
has answer: http://stackoverflow.com/a/26428230
tagged with: java
possible better answer: http://stackoverflow.com/a/26775786
score: 6

http://stackoverflow.com/comment/41403291
type: Comment
type: QuestionComment
has text: @Matin so shall I go for latest version of xalan , i am using jdk 1.5 and if yes tan which version of xalan please advise
comment on: http://stackoverflow.com/q/26365391
score: 0

http://stackoverflow.com/comment/41616610
comment on: http://stackoverflow.com/a/26491428
type: AnswerComment
score: 0
type: Comment
has text: This requires an instance of both `ReportGroup` and `ReportInfo`.

http://stackoverflow.com/comment/41492827
type: QuestionComment
has text: I've updated the question with a link to the Wikipedia article on US time zones.
comment on: http://stackoverflow.com/q/26402074
score: 0
type: Comment

http://stackoverflow.com/a/26609204
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26503404
answers question: http://stackoverflow.com/q/26503404
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Just to formalize an answer so it can be useful to others searching this: Using DataSnapshot.getValue(YourModel.Class) you can get a parsed object with the same structure that is defined in Firebase. Just make sure YourModel.class has that structure. When serializing the returned object to a POJO, it must contain exactly the same properties as the Firebase object.

http://stackoverflow.com/comment/41596620
type: QuestionComment
has text: That is one of the problems im facing. Is there a way to do that?
type: Comment
comment on: http://stackoverflow.com/q/26480153
score: 0

http://stackoverflow.com/q/26500461
downvote count: 3
has comment: http://stackoverflow.com/comment/41633123
tagged with: user-interface
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26500499
accepted answer: http://stackoverflow.com/a/26500499
score: -3
has comment: http://stackoverflow.com/comment/41633250
has comment: http://stackoverflow.com/comment/41633071
has title: How to access ArrayList from another class
has body: OK i have multiple Java files but only looking at 2 at the moment and i am doing a GUI program. I have an arraylist of Landlords in one file with a getLandlords method that returns the array and it won't work eclipse just gives an error no matter what i try File 1 package assignment2; import java.awt.event.*; import java.awt.*; import java.util.*; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class RealEstateManage extends JFrame implements ActionListener, ListSelectionListener{ public static void main(String[] args) { RealEstateManage theGUI = new RealEstateManage(); } //Initial setup for base of GUI private JFrame jfFrame; private JButton jbAddLandlord, jbAddProperty, jbAddLease, jbRecord, jbMaintenance, jbDisplayproperty; private JTextArea jtaResults; private JTextField jtfinput1, jtfinput2, jtfinput3, jtfinput4; private JList &lt;Landlord&gt; jlLandlord; private Vector&lt;Landlord&gt; vlist = new Vector&lt;Landlord&gt;(); private JPanel jpButtons = setupButtons(), jpResults = setupResults(); public RealEstateAgency R = new RealEstateAgency(); public RealEstateManage() { jfFrame = new JFrame (); jfFrame.add(jpButtons, "North"); jfFrame.add(jpResults,"West"); jfFrame.setSize(900, 400); jfFrame.setLocation(400, 300); jfFrame.setTitle("Real Estate Management"); jfFrame.setVisible(true); } //Setup the buttons at the top of the GUI public JPanel setupButtons() { JPanel jp = new JPanel (); jbAddLandlord = new JButton("Add New Landlord"); jbAddProperty = new JButton("Add New Property"); jbAddLease = new JButton("Add New Lease"); jbRecord = new JButton("Record Payment"); jbMaintenance = new JButton("Maintenance"); jbDisplayproperty = new JButton("Display Properties"); jp.add(jbAddLandlord); jp.add(jbAddProperty); jp.add(jbAddLease); jp.add(jbRecord); jp.add(jbMaintenance); jp.add(jbDisplayproperty); jbAddLandlord.addActionListener(this); jbAddProperty.addActionListener(this); jbAddLease.addAction…
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/41633214
has comment: http://stackoverflow.com/comment/41633283
tagged with: java
has comment: http://stackoverflow.com/comment/41633279
has comment: http://stackoverflow.com/comment/41633656
has comment: http://stackoverflow.com/comment/41633175
has comment: http://stackoverflow.com/comment/41633110
has comment: http://stackoverflow.com/comment/41633481
type: Question
has comment: http://stackoverflow.com/comment/41633445
has comment: http://stackoverflow.com/comment/41633417
has comment: http://stackoverflow.com/comment/41633372
tagged with: class
has comment: http://stackoverflow.com/comment/41633190
has comment: http://stackoverflow.com/comment/41633266
tagged with: arraylist

http://stackoverflow.com/comment/41621450
has text: Please check this question, it might help you: http://stackoverflow.com/questions/14617/java-what-is-the-best-way-to-sftp-a-file-from-a-server.
score: 0
comment on: http://stackoverflow.com/q/26493896
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26467919
has body: Replacing /*get the path here*/ with Paths.get(".") should get you what you want. If your argument is a filename in the same directory you don't have to provide a path to it to create the File object. So in your case, File textfile = new File(fileName); should work as well.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26467644

http://stackoverflow.com/comment/41558052
has text: Careful... a _negative lookahead for a letter_ is not the same as a _positive lookahead for a digit_. Depending on your input string, this solution may not work as expected...
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26459091
score: 1

ignore-case
type: Tag
tags question: http://stackoverflow.com/q/26445209
tags question: http://stackoverflow.com/q/26453627
tag name: ignore-case

http://stackoverflow.com/a/26420525
has body: Though you are adding Checkboxes, there are many other Objects aka Widgets(probably inbuilt labels for heading purpose) present in the Grid which you are not aware. Posting a screenshot of grid can demonstrate much better. Coming again to actual problem, all widgets are not magically Checkboxes. There are other widgets too. When you are <a href="http://widget3.linkwithin.com/redirect?url=http%3A//codeinventions.blogspot.com/2014/07/getting-widgets-added-to-gwt-panels.html&amp;rtype=&amp;vars=%5B%22http%3A//codeinventions.blogspot.in/2014/09/why-to-use-uibinder-in-gwt.html%22%2C%202218871%2C%200%2C%20%22http%3A//codeinventions.blogspot.com/2014/09/why-to-use-uibinder-in-gwt.html%22%2C%20383364705%2C%200%2C%20383364753%5D&amp;ts=1413533067397" rel="nofollow">using iterator to get all the child widgets, inbuilt widgets also get's into iterator. Check your instance is if Checkbox and then try to caste it. for (Widget widgetBox : checkBoxGrid) { if(widgetBox instanceof CheckBox){ CheckBox box = (CheckBox) widgetBox; // No problem now System.out.println(box.getValue()); } }
score: 1
has comment: http://stackoverflow.com/comment/41487454
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26420475

http://stackoverflow.com/comment/41490920
score: 0
comment on: http://stackoverflow.com/q/26422589
type: Comment
type: QuestionComment
has text: Please specify why you are calling another app ...so that i can answer according to purpose

http://stackoverflow.com/q/26380982
downvote count: 1
tagged with: replaceall
tagged with: string
favorite count: 0
has title: Improve code to replaceAll String
has comment: http://stackoverflow.com/comment/44287644
has comment: http://stackoverflow.com/comment/41416695
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41425289
tagged with: java
accepted answer: http://stackoverflow.com/a/26425112
type: Question
has comment: http://stackoverflow.com/comment/41428065
tagged with: performance
has answer: http://stackoverflow.com/a/26383337
has answer: http://stackoverflow.com/a/26425112
possible better answer: http://stackoverflow.com/a/26381782
has comment: http://stackoverflow.com/comment/41416941
has answer: http://stackoverflow.com/a/26381782
has body: Is there another way to do a lot of 'replaceAll' more efficiently, using as less memory as possible? public static String cleanWordTags(String source) { String copy = source; copy = copy.replaceAll("&lt;P style=\"M[^&gt;]*&gt;", "&lt;P&gt;"); copy = copy.replaceAll("&lt;p style=\"M[^&gt;]*&gt;", "&lt;p&gt;"); copy = copy.replaceAll("&lt;p style=\"T[^&gt;]*&gt;", "&lt;p&gt;"); copy = copy.replaceAll("&lt;b style=[^&gt;]*&gt;", "&lt;b&gt;"); copy = copy.replaceAll("&lt;span class=\"M[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style='m[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"f[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span lang[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"color[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"m[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"line[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"L[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"T[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;span style=\"t[^&gt;]*&gt;", "&lt;span&gt;"); copy = copy.replaceAll("&lt;br [^&gt;]*&gt;", "&lt;br/&gt;"); copy = copy.replaceAll("&lt;i style=[^&gt;]*&gt;", ""); copy = copy.replaceAll("&lt;/i&gt;", ""); copy = copy.replaceAll("&lt;st1:personname[^&gt;]*&gt;", ""); copy = copy.replaceAll("&lt;/st1:personname&gt;", ""); copy = copy.replaceAll("&lt;st1:metricconverter[^&gt;]*&gt;", ""); copy = copy.replaceAll("&lt;/st1:metricconverter&gt;", ""); copy = copy.replaceAll("&lt;br[^&gt;]*&gt;", "&lt;br/&gt;"); copy = copy.replaceAll("&lt;\\W\\Wendif\\W\\W\\W&gt;", ""); copy = copy.replaceAll("&lt;![^&gt;]*&gt;", ""); copy = copy.replaceAll("&lt;[vowm]:[^&gt;]*&gt;", ""); copy = copy.replaceAll("&lt;/[vowm]:[^&gt;]*&gt;", ""); //&amp; copy = copy.replaceAll("&amp;(amp|lt|gt);", ""); copy = copy.replaceAll("&amp;nbsp;", ""); copy = copy.replaceAll("&lt;img…
tagged with: replace
linked to: http://stackoverflow.com/q/1732348
score: 0
answer count: 3
upvote count: 1

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/26433296
type: Tag
tags question: http://stackoverflow.com/q/26435339
tags question: http://stackoverflow.com/q/26411053
tags question: http://stackoverflow.com/q/26382642
tags question: http://stackoverflow.com/q/26392862
tags question: http://stackoverflow.com/q/26402905
tags question: http://stackoverflow.com/q/26441752
tags question: http://stackoverflow.com/q/26447137

http://stackoverflow.com/a/34372099
upvote count: 1
score: 1
has body: I think in 99% of the cases you want to update a String as the user types. This totally works fine: String string; mObjectOfEditText.addTextChangedListener(new TextWatcher() { public void onTextChanged(...) {} public void beforeTextChanged(...) {} public void afterTextChanged(Editable e) { string = e.toString(); } }); But instead of writing empty onTextChangeds and beforeTextChangeds over and over again you could create an abstract class: abstract class LightTextWatcher implements TextWatcher { @Override public final void beforeTextChanged(...) {} @Override public final void onTextChanged(...) {} } ... mObjectOfEditText.addTextChangedListener(new LightTextWatcher() { public void afterTextChanged(Editable e) { string = e.toString(); } }); Now if you have many TextViews (or EditTexts which are TextViews) you have a lot less verbose code with the second variant.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26361953

http://stackoverflow.com/q/26452209
has answer: http://stackoverflow.com/a/41495160
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/71091309
linked to: http://stackoverflow.com/q/9981907
tagged with: java
has answer: http://stackoverflow.com/a/71091309
upvote count: 18
has title: How to iterate over map using mustache in java
type: Question
has comment: http://stackoverflow.com/comment/59642642
has comment: http://stackoverflow.com/comment/59965631
score: 18
downvote count: 0
has answer: http://stackoverflow.com/a/26452450
has comment: http://stackoverflow.com/comment/59641878
answer count: 3
favorite count: 0
tagged with: mustache
accepted answer: http://stackoverflow.com/a/26452450
has body: I'm newbie to mustache and was wondering how to iterate over HashMap using mustache given this Map Map mapA = new HashMap(); mapA.put("key1", "element 1"); mapA.put("key2", "element 2"); mapA.put("key3", "element 3"); The map key names vary. Ideally, I want mustache to iterate over both its key and values. So in java it will look like this: for (Map.Entry&lt;String, Object&gt; entry : mapA.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); // ... } So can someone tell me how to achieve above in mustache. I mean how would the template looks like? I tried this template but had no luck so far :( {{#mapA}} &lt;li&gt;{{key}}&lt;/li&gt; &lt;li&gt;{{value}}&lt;/li&gt; {{/mapA&gt; So when I run this template, the output &lt;li&gt; tags comes out empty, why? Thanks.

http://stackoverflow.com/q/26450519
answer count: 1
has title: How to use Java Socket with Runnable
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26591546
tagged with: jakarta-ee
has body: I want to call a function cycle() that do something for every some x second. At this time i can call it only when it has a request from client. public class ChatServer implements Runnable { private static final int PORT = 9001; private static HashSet&lt;String&gt; names = new HashSet&lt;String&gt;(); private static HashSet&lt;PrintWriter&gt; writers = new HashSet&lt;PrintWriter&gt;(); public static void main(String[] args) throws Exception { System.out.println("The chat server is running."); ServerSocket listener = new ServerSocket(PORT); try { while (true) { new Handler(listener.accept()).start(); } } finally { listener.close(); } } private static class Handler extends Thread { private String name; private Socket socket; private BufferedReader in; private PrintWriter out; public Handler(Socket socket) { this.socket = socket; } public void run() { cycle(); try { in = new BufferedReader(new InputStreamReader( socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); while (true) { out.println("SUBMITNAME"); name = in.readLine(); if (name == null) { return; } synchronized (names) { if (!names.contains(name)) { names.add(name); break; } } } out.println("NAMEACCEPTED"); writers.add(out); while (true) { String input = in.readLine(); if (input == null) { return; } for (PrintWriter writer : writers) { writer.println("MESSAGE " + name + ": " + input); } } } catch (IOException e) { System.out.println(e); } finally { if (name != null) { names.remove(name); } if (out != null) { writers.remove(out); } try { socket.close(); } catch (IOException e) { } } } } } Yeah, code below is work when i remove Handle class from my code. My problem is i can't combine them together, please help or suggest. Many thanks. private void cycle() { //do something } @Override public void run() { long beforeTime, timeDiff, sleep; beforeTime = System.currentTimeMillis(); while (true) { cycle(); timeDiff = System.currentTimeMillis() - beforeTime; sleep = DELAY - timeDiff; if (slee…
type: UnansweredQuestion
type: Question
tagged with: sockets
tagged with: multithreading
tagged with: android

http://stackoverflow.com/comment/41622797
score: 0
type: AnswerComment
has text: If it still does not work you can try https instead http. I looked at the documentation and below the link there is note to add https.Reference http://developer.android.com/sdk/installing/installing-adt.html
type: Comment
comment on: http://stackoverflow.com/a/26494700

http://stackoverflow.com/q/26399026
has answer: http://stackoverflow.com/a/26408350
has answer: http://stackoverflow.com/a/26399265
has title: JSP file doesn't retrieve data from table with Many-To-Many (Hibernate)
possible better answer: http://stackoverflow.com/a/26399265
type: AnsweredQuestion
has body: I have two objects Article and Category. There is a many to many relation. In database I use intermediate table for this - article_category like in the picture. https://i.sstatic.net/Qji5u.jpg When I use OneToMany relation between another objects in my project, it works. I have trouble just with ManyToMany. I would like to retrieve name of category of relevant article when I try to in jsp file at the end of the guestion. What do I do wrong? There is my code: Article.class @Entity public class Article { @Id @GeneratedValue private Integer id; private String title; private String content; private Date publishDate; @ManyToOne @JoinColumn(name = "user_id") private User user; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "article_category", joinColumns={@JoinColumn(name="article_id")}, inverseJoinColumns={@JoinColumn(name="category_id")}) private List<Category> categories; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Date getPublishDate() { return publishDate; } public void setPublishDate(Date publishDate) { this.publishDate = publishDate; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public List<Category> getCategories() { return categories; } public void setCategories(List<Category> categories) { this.categories = categories; } } Category.class @Entity public class Category { @Id @GeneratedValue private Integer id; private String name; @ManyToMany(mappedBy = "categories") private List<Article> articles; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Article> getArticles() { return articles; } public void set…
accepted answer: http://stackoverflow.com/a/26408350
type: Question
tagged with: java
tagged with: hibernate
score: 0
answer count: 2
tagged with: jsp

http://stackoverflow.com/comment/41681792
score: 0
type: AnswerComment
has text: what happens if you remove the `while`-loop and close the cursor immediately?
type: Comment
comment on: http://stackoverflow.com/a/26527201

http://stackoverflow.com/comment/41522819
score: 0
type: AnswerComment
type: Comment
has text: it worked but getting error at the run time (when fetching the column), "Unknown column 'listb_.a_id' in 'field list'", I am not sure how hiberante constructs the column names, why is it appending with "a" to "id"..
comment on: http://stackoverflow.com/a/26437823

http://stackoverflow.com/q/26441071
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/41525431
has answer: http://stackoverflow.com/a/26442244
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: object
tagged with: java
has body: My problem is that for the getTime(); command, you need all of the speed, handling, xcord, ycord, and the terrainDifficultry variables to have an answer, yet I can only call getTime(); from the mb1 class. Basically, I keep getting 0.0 when i get to System.out getTime() and I don't know how to fix it. import java.util.Scanner; public class Main_MoonRace { public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); System.out.println("Enter the speed of the moonbuggy as an integer."); int s = keyboard.nextInt(); System.out.println("Enter the handling of the moonbuggy (between 0-0.9)"); double h = keyboard.nextDouble(); moonbuggy mb1 = new moonbuggy(s,h); System.out.println("Enter the x-coordinate of where the moonbuggy will be headed to as an integer."); int xcord = keyboard.nextInt(); System.out.println("Enter the y-coordinate of where the moonbuggy will be headed to as an integer."); int ycord = keyboard.nextInt(); System.out.println("Enter the difficulty of the terrain that the moonbuggy will be experiencing (integer from 1-10)."); int terrainDifficulty = keyboard.nextInt(); MoonLocation mL1 = new MoonLocation(xcord,ycord,terrainDifficulty); System.out.println(mb1.getTime()); } } moonbuggy.java public class moonbuggy { private int speed = 1; private double handling = 0; moonbuggy(){ return; } moonbuggy(int s, double h){ speed = s; handling = h; return; } public void setSpeed (int s){ speed = s; } public void setHandling (double h){ handling = h; } public int getSpeed(){ return speed; } public double getHandling(){ return handling; } MoonLocation obj1 = new MoonLocation(); public double getTime(){ double time = (((obj1.getdistance())/(getSpeed()))*(obj1.getTerrain())*(1-(getHandling()))); return time; } } MoonLocation.java public class MoonLocation { private int x = 0; private int y = 0; private int terrain = 1; MoonLocation(){ return; } MoonLocation(int xcord, int ycord, int terrainDifficulty){ x= xcord; y = ycord; terrain = terrainDifficul…
has comment: http://stackoverflow.com/comment/41525388
tagged with: methods
has title: Java- Involving objects and multiple classes
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26442301

http://stackoverflow.com/comment/41594498
score: 0
type: Comment
type: QuestionComment
has text: @ScaryWombat i am running JUnit tests for mobile automation.
comment on: http://stackoverflow.com/q/26478926

http://stackoverflow.com/comment/41434876
score: 0
type: Comment
type: QuestionComment
has text: I think so, I've edited question and added build.gradle
comment on: http://stackoverflow.com/q/26389679

http://stackoverflow.com/comment/41478589
has text: use a thumbnail or scale down your profile pic. Your bitmap and reqmts for memory are too large so reduce the memory impact of your process on profile photo.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26411710

http://stackoverflow.com/comment/41489062
has text: Your .bashrc looks OK. Are you sure that you are reloaded env variables? Are JAVA_HOME points to /usr/lib/jvm/java-7-openjdk-amd64/ ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26421446
type: Comment

http://stackoverflow.com/q/26376172
has title: What is the correct pom dependency for using jersey webservice?
has comment: http://stackoverflow.com/comment/41419340
has answer: http://stackoverflow.com/a/43303833
tagged with: java
upvote count: 1
type: Question
tagged with: jersey
has body: I am using Jersey version 2.12 and I am able to build my project but when I deploy and try to access I get java.lang.AbstractMethodError. When I remove javax.ws.rs-api-2.0.1.jar jar from my webapp/war lib directory I am able to access the rest end points. Please help me with a correct configuration that I can use with Jersey 2.12 and Jersey multipart together. Below is the full stacktrace SEVERE: Servlet.service() for servlet [WebAgent] in context with path [/webagent] threw exception [Servlet execution threw an exception] with root cause java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder; at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:651) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408…
has answer: http://stackoverflow.com/a/26383729
answer count: 2
has comment: http://stackoverflow.com/comment/41408802
downvote count: 0
tagged with: jersey-2.0
tagged with: pom.xml
score: 1
has comment: http://stackoverflow.com/comment/41538675
favorite count: 0
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/41445627
comment on: http://stackoverflow.com/q/26397061
score: 0
type: Comment
has text: "append to a REST URL" -- which part of the URL? Path? Query string? Fragment?
type: QuestionComment

http://stackoverflow.com/a/26419905
has comment: http://stackoverflow.com/comment/41486878
score: 0
has body: These are word vectors, not topics. Topic modeling is a different domain than clustering. K-means clustering (which you probably are using) will give you average word counts, not what one would intutively accept as "topics". No k-means ever will give you the result "american football" as a topic. It cannot. Use supervised techniques for that. You probably truncated the word vectors somehow, and it gives you only the alphabetically first words. Since every value is close to 0.02, your results may have degenerated to a near-random mess.
type: Answer
answers question: http://stackoverflow.com/q/26398680

http://stackoverflow.com/comment/41615150
type: QuestionComment
has text: SELECT DISTINCT MONTH(DATE_FIELD),ID_PK_FIELD,AMOUNT_FIELD,DATE_FIELD FROM TBL_MONTH WHERE MON__STRE__FK= ? ORDER BY DATE_FIELD DESC ; also not working
comment on: http://stackoverflow.com/q/26489171
score: 0
type: Comment

http://stackoverflow.com/q/26502958
has comment: http://stackoverflow.com/comment/41638067
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41637991
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/26503549
has body: I've been studying java and Spring for a while, during my spare time so I neither master java nor Spring yet. For the web project I created to study java and Spring I had to extends the SimpleUrlAuthenticationFailureHandlerm. What it's not clear to it's why after extending SimpleUrlAuthenticationFailureHandler and overriding onAuthenticationFailure, in my own onAuthenticationFailure()... method I had to call the super.onAuthenticationFailure(...) method. Probably I didn't get one of the main rule of java. Here is the class i was talking about public class CustomAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler { @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if(exception.getClass().isAssignableFrom(BadCredentialsException.class)) { setDefaultFailureUrl("/url1"); } else if (exception.getClass().isAssignableFrom(DisabledException.class)) { setDefaultFailureUrl("/url2"); } else if (exception.getClass().isAssignableFrom(SessionAuthenticationException.class)) { setDefaultFailureUrl("/url3"); } super.onAuthenticationFailure(request, response, exception); //why this??? } }
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/41639537
has comment: http://stackoverflow.com/comment/41638669
has title: An explanation about overriding SimpleUrlAuthenticationFailureHandler
has comment: http://stackoverflow.com/comment/41638716
has comment: http://stackoverflow.com/comment/41638269
score: 2
has comment: http://stackoverflow.com/comment/41639067
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/26503549
has comment: http://stackoverflow.com/comment/41638122
tagged with: spring
has comment: http://stackoverflow.com/comment/41639006

http://stackoverflow.com/a/26391196
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26387225
type: Answer
answers question: http://stackoverflow.com/q/26387225
has body: Use combo.deselectAll() to reset the selection. Alternatively you could use: combo.deselect(combo.getSelectionIndex()); In both cases getSelectionIndex() will return -1 afterwards. These methods appear as if the Combo supports multi-selection, which it doesn't. However strange they may appear, they do reset the selection.

http://stackoverflow.com/comment/41636845
comment on: http://stackoverflow.com/q/26502235
type: Comment
type: QuestionComment
score: 2
has text: @m.souvik you can't. Since there are answers here. Next time before hurry to ask an question. Please take some time to figure out the issue by yourself.

http://stackoverflow.com/q/26387342
accepted answer: http://stackoverflow.com/a/26406065
has title: Installing and using HDF5 for Eclipse on Mac OSx
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: I am trying to install and use the HDF5 libraires in eclipse in order to read and manipulate a dataset for my Big Data class. I followed the instructions from the following website : http://www.hdfgroup.org/products/java/release/downloadsrc.html At the end of the installation, after the command ctest -S HDFJAVAMacCMake.cmake -C Release -V -O hdf-java.log I get the following message : 100% tests passed, 0 tests failed out of 313 Total Test time (real) = 39.85 sec [ERROR_MESSAGE] Error in read script: /Users/fg/Downloads/build/HDFJAVAMacCMake.cmake I don't understand why I get the Error in read script after every test passed. Was the installation successful or not ? If yes, how do I manage to link the hdf5 libraries into my eclipse project ? Thanks a lot for your time!
answer count: 1
tagged with: hdfs
has answer: http://stackoverflow.com/a/26406065
score: 0
tagged with: macos
tagged with: hdf5

http://stackoverflow.com/q/26372451
tagged with: arrays
has answer: http://stackoverflow.com/a/26372567
has body: I am trying to implement a randomized selection algorithm where an array is filled with random numbers and the user selects a location and the program returns the value coinciding with the location in the sorted version of the array without actually sorting the array. The problem is that the program is giving the value of the element at the given location but in the unsorted array. import java.util.*; public class RandomizedSelection { public static void main(String[] args) { int maxSize = 10; // max size of the array int[] arr = new int[maxSize]; // fill array with random numbers between the range of 0-200 for (int i = 0; i &lt; maxSize; i++) { int n = (int)(java.lang.Math.random()*199); arr[i] = n; } System.out.println("There is an array of 100 elements in the range" + " of 0 - 200. Select a location to view" + " the value."); Scanner in = new Scanner(System.in); int userChoice = in.nextInt(); // get user's choice of i int loc = randomizedSelect(arr, 0, arr.length-1, userChoice); System.out.println(loc); System.out.println("The array was:\n" + Arrays.toString(arr)); } public static int randomizedSelect(int[] array, int p, int r, int i) { if (p == r) return array[p]; if (i == 0) return -1; int mid = randomizedPartition(array, p, r); int k = mid - p + 1; if (k == i) return array[mid]; else if (i &lt; k) return randomizedSelect(array, p, mid-1, i); else return randomizedSelect(array, mid+1, r, i-k); } public static int randomizedPartition(int[] array, int start, int end) { Random rand = new Random(); int pivotIdx = rand.nextInt((end - start) + 1) + start; int pivot = array[pivotIdx]; swap(array[pivotIdx], array[end]); pivotIdx = end; int i = start - 1; for (int j = start; j &lt;= end-1; j++) { if (array[j] &lt;= pivot) { i++; swap(array[i], array[j]); } } swap(array[i+1], array[pivotIdx]); return i+1; } public static void swap(int i, int j) { int temp = i; i = j; j = temp; } } The output of this program if the user selects a location choice 4 is: 50 The array was: [1…
score: 0
tagged with: random
answer count: 1
has title: Randomized Selection Algorithm
accepted answer: http://stackoverflow.com/a/26372567
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: algorithm

http://stackoverflow.com/comment/41491126
comment on: http://stackoverflow.com/q/26422802
has text: You didn't specify which kind of database system you use. Usually a stored procedure is inside a database instance, so you need to create a connection to the target instance an call the stored procedure there. If you don't have the stored procedure there, you need to create it first.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41537428
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26447673
has text: I never could understand regex, i haven't got the slightest idea on how do make it grab the numbers

http://stackoverflow.com/q/26501800
accepted answer: http://stackoverflow.com/a/26501924
has body: I am using a gwt application. The server in which my application is deployed and the database it is using is all in paris (france). In the application I have a provision to enter any date which will be saved to db. When my application is launched from paris, everything is working fine. But when the same application is launched from India, date entered on the screen is stored as 1 day less than what was entered. For example, in India I enter 16/07/2014 theb the date is stored as 15/07/2014. I suspect some geographical problem. Is there any code changes I need to do to save the date accommodation to the timezone? Or any to do with the system date on the computer the user is using the application?
type: Question
tagged with: gwt
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26501983
answer count: 2
has title: issue with timezone while saving date through screen in gwt
linked to: http://stackoverflow.com/q/2532729
score: 0
possible better answer: http://stackoverflow.com/a/26501983
has answer: http://stackoverflow.com/a/26501924

http://stackoverflow.com/a/26406598
answers question: http://stackoverflow.com/q/26406303
has comment: http://stackoverflow.com/comment/41462224
upvote count: 41
has comment: http://stackoverflow.com/comment/81297057
has body: You can do it with the pub-sub model only Start Redis Server Change the notify-keyspace-events in redis.conf to KEA (this depends on your requirement).Details given in redis documentation http://redis.io/topics/notifications. Redis Java Client (Jedis) ,Try the following: Notification Listener: public class KeyExpiredListener extends JedisPubSub { @Override public void onPSubscribe(String pattern, int subscribedChannels) { System.out.println("onPSubscribe " + pattern + " " + subscribedChannels); } @Override public void onPMessage(String pattern, String channel, String message) { System.out .println("onPMessage pattern " + pattern + " " + channel + " " + message); } //add other Unimplemented methods } Subscriber: ****Note** jedis.psubscribe(new KeyExpiredListener(), "__key*__:*"); -- This methods support regex pattern based channel whereas jedis.subscribe(new KeyExpiredListener(), ""__keyspace@0__:notify"); --This method takes full/exact channel name public class Subscriber { public static void main(String[] args) { JedisPool pool = new JedisPool(new JedisPoolConfig(), "localhost"); Jedis jedis = pool.getResource(); jedis.psubscribe(new KeyExpiredListener(), "__key*__:*"); } } Test Class: public class TestJedis { public static void main(String[] args) { JedisPool pool = new JedisPool(new JedisPoolConfig(), "localhost"); Jedis jedis = pool.getResource(); jedis.set("notify", "umq"); jedis.expire("notify", 10); } } Now first start your Subscriber and then Run the TestJedis.You wil see the following output: onPSubscribe __key*__:* 1 onPMessage pattern __key*__:* __keyspace@0__:notify set onPMessage pattern __key*__:* __keyevent@0__:set notify onPMessage pattern __key*__:* __keyspace@0__:notify expire onPMessage pattern __key*__:* __keyevent@0__:expire notify onPMessage pattern __key*__:* __keyspace@0__:notify expired onPMessage pattern __key*__:* __keyevent@0__:expired notify Now one use-case where you are interested in the value of the expired key as well. Note: Redis on…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/68380361
has comment: http://stackoverflow.com/comment/68791907
type: Answer
accepted answer of: http://stackoverflow.com/q/26406303
score: 41

http://stackoverflow.com/a/26477425
answers question: http://stackoverflow.com/q/26477350
has comment: http://stackoverflow.com/comment/41591854
score: 0
has body: try while(answer != 'N' &amp;&amp; answer != 'n'); You want the case where the character is NOT EQUAL to 'N' AND is also NOT EQUAL to 'n'
type: Answer

http://stackoverflow.com/a/26357784
has comment: http://stackoverflow.com/comment/41377191
type: Answer
has comment: http://stackoverflow.com/comment/41377383
answers question: http://stackoverflow.com/q/26356718
has body: There's an example in the docs. I wonder how you didn't find that... See https://developers.facebook.com/docs/android/scrumptious/show-friends
score: 0

http://stackoverflow.com/a/26460460
has comment: http://stackoverflow.com/comment/41563595
type: Answer
answers question: http://stackoverflow.com/q/26459934
has body: This might be related to this or this, which were solutions to common problems in the rev. 22 update.\ UPDATE: It seem this code is used to get IMEI. String deviceId=Util.getDeviceId(getApplicationContext()); Use it instead: TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); String deviceId = telephonyManager.getDeviceId(); I think this problem is this page you refer is not show all code, may be there still remain one class Util: public static class Util { public static String getDeviceId(Context context) { TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); return telephonyManager.getDeviceId(); } } Then it explain why they use : Util.getDeviceId(getApplicationContext()) normally. Just copy this code to your class InstalledAppData. The compiler will clean.
score: 0

http://stackoverflow.com/comment/41582665
comment on: http://stackoverflow.com/q/26470861
type: Comment
type: QuestionComment
score: 0
has text: What do you mean by 'get unzipped'?

http://stackoverflow.com/comment/41397874
comment on: http://stackoverflow.com/a/26367052
type: AnswerComment
score: 0
type: Comment
has text: Alan, I've read the aticle and I agree with the author when claims the anemic model bring to procedural style design, but this is not the point of my question: Assume you put all the logics you can in the Domain Objects and use services only for transactions that you could not easily reconduce to a specific one, I'm still not sure is a good Idea to put into DO the logic to assemble itself form DAOs (or DTO by the way), at least when you have more than one. Question is: MUST I have separated DTO and DO also when they are in a one to one relation vs. could/should I extend DTO to add logics?

http://stackoverflow.com/a/26452808
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41554574
answers question: http://stackoverflow.com/q/26452570
type: Answer
has body: You simply have a race. The call to NOTIFY in the main method might happen before the wait in the new thread. There would then be nothing left to wake it up.
accepted answer of: http://stackoverflow.com/q/26452570
downvote count: 0

http://stackoverflow.com/q/26403581
has body: I am using java and cxf SOAP webservices. I have enabled schema validation as below but it is not working. I dont have any external xsds. All xsd elements are part of WSDL. Will schemavlaidation= true property does not work if it has no external xsd and all xsd elements are part of WSDL? I placed minOccur and maxOccur attributes. &lt;jaxws:endpoint id="serviceEndpoint" implementor="#serviceEndpoint" address="/CreateService" wsdlLocation="classpath:wsdl/Service.wsdl"&gt; &lt;jaxws:properties&gt; &lt;entry key="schema-validation-enabled" value="true" /&gt; &lt;/jaxws:properties&gt; &lt;/jaxws:endpoint&gt;
tagged with: wsdl
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/41497680
tagged with: xsd
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41480028
has title: Schema validation is not working?
type: Question
upvote count: 1

http://stackoverflow.com/comment/41771125
comment on: http://stackoverflow.com/a/26457512
has text: I meant to say change the second "e" to an "a". No worries though, I already got my answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26443968
type: Answer
has comment: http://stackoverflow.com/comment/41530961
answers question: http://stackoverflow.com/q/26443859
has comment: http://stackoverflow.com/comment/41531550
score: 0
has body: It seems you are persist() method on the Item object rather than merge() method. I hope it will resolve your query.

http://stackoverflow.com/comment/44454408
has text: Thanks. I am using JDK8 and instead of .../urandom I had .../random. I did change the random to urandom as well.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26432537
type: AnswerComment

http://stackoverflow.com/a/26510783
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41656201
type: Answer
has comment: http://stackoverflow.com/comment/111668168
answers question: http://stackoverflow.com/q/26509777
has comment: http://stackoverflow.com/comment/41654247
has body: The error message is clearly describing the problem: Unable to add listener of type: br.com.hrtech.atendimento.listener.ContadorSessao, because it does not implement any of the required ServletContextListener, ServletContextAttributeListener, ServletRequestListener, ServletRequestAttributeListener, HttpSessionListener, or HttpSessionAttributeListener interfaces. The message says you have registered a class named br.com.hrtech.atendimento.listener.ContadorSessao as a listener (probably in web.xml), which doesn't implement any of the required interfaces. You have to implement one of these interfaces in your class if you want to register it as a listener. So either you can do something like this: public class ContadorSessao implements ServletContextListener { // implement all required methods } or, if this really shouldn't be a listener, there seems to be an entry in your web.xml looking like this: br.com.hrtech.atendimento.listener.ContadorSessao Remove this entry and it should work. If the problem doesn't get fixed by one of these solutions, make sure that you Clean & Build your project before redeploying it with the new settings. By the way, the part of the your web.xml you posted, indicates that you are using obsolete and deprecated technologies (namely JSP) which doesn't make any sense in 2014 if you develop a new web app which should run on Glassfish (I guess at least version 3). For a standard JSF 2.x web application you shouldn't need something like com.sun.faces.config.ConfigureListener. You should consider switching to a more recent "software stack" (JSF 2, EJB 3.1, JPA 2).

http://stackoverflow.com/a/52926567
downvote count: 2
has body: @Test public void removeLastElement() { String[] lastElementRemoved = { "one", "two", "three" }; String[] removedElement = Arrays.copyOf(lastElementRemoved, 2); System.out.println(Arrays.toString(removedElement)); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26357805
upvote count: 2

http://stackoverflow.com/comment/48442356
comment on: http://stackoverflow.com/a/26390820
score: 0
type: AnswerComment
has text: Although this works it appears that "continuation indent" is too dumb to realize your method chaining so I find myself having to press "shift tab" or "reformat code" when chaining methods. For now I just set continuation indent to 0 which is annoying also. I'm curious if others have this problem.
type: Comment

http://stackoverflow.com/comment/41586608
has text: Thank you, but this actually doesn't work. .+ still eats up !
comment on: http://stackoverflow.com/a/26474335
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26484431
upvote count: 1
has answer: http://stackoverflow.com/a/26485275
has title: What is the best way to loop over an array in JsonValue in libgdx?
type: Question
has comment: http://stackoverflow.com/comment/41603830
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/26485275
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41604310
has body: I am porting an Android-only Game to libgdx. The world and level info is stored in a json file. I used to do access the array with getJSONArray(id) like this: public static WorldVO create(JSONObject worldObject) { WorldVO worldVO = new WorldVO(); worldVO.id = worldObject.getInt("id"); worldVO.unlock = worldObject.getInt("stars_to_unlock"); worldObject.getChild("levels"); JSONArray levelJsonArray = worldObject.getJSONArray("levels"); int len = levelJsonArray.length(); worldVO.levelVOs = new LevelVO[len]; for (int i = 0; i &lt; len; i++) { worldVO.levelVOs[i] = LevelVO.create(levelJsonArray.getJSONObject(i)); } ... which worked fine but I cannot find the correct way to loop through the "levels" child of the "worldObect" Json in libgdx when i use JsonValue instead of JSONObject. Accessing the integer fields is not a problem but JsonValue does not have a getJSONArray. Any idea what to use? Thanks!
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41603991
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41603952

http://stackoverflow.com/q/26409232
has comment: http://stackoverflow.com/comment/41518537
tagged with: java
tagged with: eclipse
has body: I have a TableViewer in Eclipse/jFace, that listen to Double Click Event. It work fine, until I add a TableViewer.refresh() method. Because on double click I change a flag in a database,and I want to show the change. The problem is that the event occurs twice, This is all the code for the listener. If I remove : tableCombinadoViewer.refresh(false); I don't get the Table refreshed, but the event occurs one time only.:( table_cuadro.addListener(SWT.MouseDoubleClick, new Listener() { public void handleEvent(Event event) { //modifier.setEnabled(true); TableItem[] selection = table_cuadro.getSelection(); System.out.println("addListener MouseDoubleClick ... Evento MouseDoubleClick"); if (selection.length != 1) { return; } //Cursor cursor = new Cursor(window.getShell().getDisplay(), SWT.CURSOR_WAIT); window.getShell().setCursor(new Cursor(window.getShell().getDisplay(), SWT.CURSOR_WAIT)); TableItem item = table_cuadro.getSelection()[0]; for (int i = 0; i &lt; table_cuadro.getColumnCount(); i++) { if (item.getBounds(i).contains(event.x, event.y)) { // Grilla fila = (Grilla) item.getData(); BloqueCruzamiento bc_mama = (BloqueCruzamiento) fila.bc_x; BloqueCruzamiento bc_papa = (BloqueCruzamiento) fila.bc_list_y.get(i- ColFijas); //Tener en cuenta el Subindice si se agregann nuevas columnas fijas. if (bc_mama.getNroParcela().equals(bc_papa.getNroParcela()) ) { MessageDialog.openError(window.getShell(), "Marcar Cruzas", "No se pueden seleccionar las mismas Parcelas."); window.getShell().setCursor(new Cursor(window.getShell().getDisplay(), SWT.CURSOR_ARROW)); return ; } Cruza c = cruzaController.obtenerCruza(anio, bc_mama, bc_papa); if (c==null) { c = new Cruza(anio, bc_mama, bc_papa, 0 , 0 ); c.setPrioridad(1); try { cruzaController.agregar(c); } catch (AgrologicException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Grabando Cruza:" + bc_mama.toString() + ":x:" + bc_papa.toString() + " con prioridad 1"); } else { if (c.getPrioridad()&lt;2) …
has comment: http://stackoverflow.com/comment/41468547
has comment: http://stackoverflow.com/comment/41468503
has comment: http://stackoverflow.com/comment/41511403
score: 0
tagged with: jface
answer count: 0
type: UnansweredQuestion
tagged with: swt
type: Question
has title: Why DoubleClickEvent fires twice with TableViewer.refresh()?

http://stackoverflow.com/q/26359894
upvote count: 7
has answer: http://stackoverflow.com/a/26360100
downvote count: 1
has answer: http://stackoverflow.com/a/26360057
type: UnansweredQuestion
tagged with: tomcat
score: 6
has answer: http://stackoverflow.com/a/44635248
tagged with: securitymanager
has title: Tomcat console log to a file
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/41378043
has body: Im using Apache Tomcat 7. When I'm running Tomcat with security manager and with the -Djava.security.debug parameter I'm getting so much of text in console. I can't read the text in console. So I need the console log into some file. How can I achieve this?
tagged with: logging
tagged with: java
answer count: 3

http://stackoverflow.com/comment/41541130
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26449788
has text: That's a MainActivity context, which I'm also using for a different SharedPreferences object.
type: AnswerComment

http://stackoverflow.com/a/26472783
has comment: http://stackoverflow.com/comment/41586887
has comment: http://stackoverflow.com/comment/41587809
has comment: http://stackoverflow.com/comment/41586287
downvote count: 0
has comment: http://stackoverflow.com/comment/41586801
has body: If I understand your question you could pass the Die instance into the Game constructor with something like public class Game extends Frame { private Die die; public Game(Die die) { this.die = die; } public void window() { setTitle("Roll"); // Title of the window setLocation(100, 100); // Location of the window setSize(900, 600); // Size of the window setBackground(Color.lightGray); // Color of the window setVisible(true); // Make it appear and call paint die.setVisible(true); // The same } } Then, wherever you call new Game() you add the Die instance argument. This is a fairly common way to implement a callback in Java (and other OOP languages).
has comment: http://stackoverflow.com/comment/41588722
type: Answer
has comment: http://stackoverflow.com/comment/41588763
answers question: http://stackoverflow.com/q/26472497
has comment: http://stackoverflow.com/comment/41587771
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41586052
has comment: http://stackoverflow.com/comment/41586940
has comment: http://stackoverflow.com/comment/41585682
has comment: http://stackoverflow.com/comment/41585732
has comment: http://stackoverflow.com/comment/41586771

http://stackoverflow.com/a/26422805
accepted answer of: http://stackoverflow.com/q/26421825
has body: On the maths side of this question, not the java side: If I understand the problem, there is no solution (no value of i). For any finite set P_i of primes {p_1, p_2,...p_i} let N_i be the set of all integers up to p_i, {1,2,3,...,p_i}. The sum 1/p^2 (for all p_n in P_i) will be less than the sum of all 1/x^2 for x in N_i. The sum of 1/x^2 tends to ~1.65 but since 1 will never be in the set of primes, the sum is limited by ~0.65
answers question: http://stackoverflow.com/q/26421825
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41491660
upvote count: 7
score: 7

http://stackoverflow.com/q/26374716
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41405773
has comment: http://stackoverflow.com/comment/41405784
has comment: http://stackoverflow.com/comment/41405760
has comment: http://stackoverflow.com/comment/41405831
has comment: http://stackoverflow.com/comment/41406072
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41405844
has comment: http://stackoverflow.com/comment/41406015
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41405807
has comment: http://stackoverflow.com/comment/41405961
has answer: http://stackoverflow.com/a/26374888
has comment: http://stackoverflow.com/comment/41405856
has body: I'm trying to transform this class below using the Gson.ToJson(Object) method, but it is returing me the object hash code of the class, eg: br.com.helpradar.entity.User@475fdaaa However, I can retrieve the user.expertise without any problems and with all the relationships: Gson.ToJson(user.getExpertise) @Entity @SequenceGenerator(name="seqUser", sequenceName="SEQ_USER", allocationSize=1) public class User { @Id private Long id; @Column(nullable=false) private String name; @OneToOne private Contact contact; //enum private TypeUser typeUser; @ManyToMany(cascade = { CascadeType.ALL }) @JoinTable(name = "USER_REVIEW", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "REVIEW_ID") }) @Column(name="REVIEW") private Set&lt;Review&gt; review= new HashSet&lt;Review&gt;(); @ManyToMany(cascade = { CascadeType.ALL }) @JoinTable(name = "USER_EXPERTISE", joinColumns = { @JoinColumn(name = "USER_ID") }, inverseJoinColumns = { @JoinColumn(name = "EXPERTISE_ID") }) @Column(name="EXPERTISE") private Set&lt;Expertise&gt; expertise = new HashSet&lt;Expertise&gt;(); } This is my Gson method: Gson gson = new GsonBuilder() .registerTypeAdapter(User.class, new MyTypeAdapter&lt;Expertise&gt;()) .registerTypeAdapter(User.class, new MyTypeAdapter&lt;Review&gt;()) .create(); return gson.toJson(user); This is my MyTypeAdapter: class MyTypeAdapter&lt;T&gt; extends TypeAdapter&lt;T&gt; { public T read(JsonReader reader) throws IOException { return null; } public void write(JsonWriter writer, T obj) throws IOException { if (obj == null) { writer.nullValue(); return; } writer.value(obj.toString()); } } So, how do I get the Gson.ToJson(user) to actually return a Json string so that I can use Gson.FromJson on my other end? Thanks in advance.
linked to: http://stackoverflow.com/q/3615721
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41405704
has title: Gson.toJson(Object) returning object hash code
tagged with: gson

http://stackoverflow.com/a/26477427
has body: It should be while(answer != 'N' &amp;&amp; answer != 'n');. With while(answer != 'N' || answer != 'n');, if somebody inputs N then it will continue because answer is equal to N but it is not equal to n.
score: 1
answers question: http://stackoverflow.com/q/26477350
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26372897
has comment: http://stackoverflow.com/comment/41402531
downvote count: 0
answers question: http://stackoverflow.com/q/26372876
has body: You can run the server using an ssh session with the command: ssh user@server 'java -jar server.jar' If clients should establish a connection with the server, the IP adress is indeed the IP adress over the server. The port is in many cases "hardcoded" in the Java application (you need to inspect the source code), or it is given as a parameter with the jar (for instance java -jar server.jar -port 8080, other programs (like Apache use a set of config files where the port must be specified). (Mind this depends on the actual java program. Flags not interpreted by the program are in many cases simply ignored).
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/41402595
has comment: http://stackoverflow.com/comment/41402830
has comment: http://stackoverflow.com/comment/41402662
has comment: http://stackoverflow.com/comment/41402613
has comment: http://stackoverflow.com/comment/41402641

http://stackoverflow.com/comment/41579302
type: AnswerComment
comment on: http://stackoverflow.com/a/26470231
score: 0
type: Comment
has text: For shared memory, everything needs to run in the same JVM. As I said, that means threads for parallelism, not processes.

http://stackoverflow.com/comment/41443586
type: AnswerComment
has text: Solved my problem with ease, and is a clean solution. Thanks! +1
type: Comment
comment on: http://stackoverflow.com/a/26388759
score: 0

http://stackoverflow.com/comment/41468402
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26409773
has text: By definition a Readable must be able to create a CharBuffer. CharBuffers are pretty useful. (It's also a good idea to check on how useful a class will be *before* you implement it.)
score: 0

http://stackoverflow.com/comment/41407374
score: 0
type: Comment
type: QuestionComment
has text: how hard did you look? Googling your error message the first hit is to this web site, and specifically this question which is exactly your problem: http://stackoverflow.com/q/10519558/1570834.
comment on: http://stackoverflow.com/q/26373376

http://stackoverflow.com/a/54535709
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26390634
has body: driver.findElement(By.xpath("//*[@role='button' and text()='Compose']")).click();

http://stackoverflow.com/comment/41593041
comment on: http://stackoverflow.com/q/26478043
has text: Don't use values which are calculated when another method relies on the result, for example , `getAngleC` relies on the calculations from `getAngleA` and `getAngleB`, but it has no means to know if these methods have been called. These methods should return `double`, it's not there responsibility to format the result...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/53896244
comment on: http://stackoverflow.com/a/31154402
has text: Works well. This should be marked as correct answer.
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41397819
type: AnswerComment
type: Comment
score: 1
has text: Not sure I entirely understand your diagram, but definitely +1 for NOT leaving a bad answer untouched.
comment on: http://stackoverflow.com/a/26370002

http://stackoverflow.com/comment/41478656
comment on: http://stackoverflow.com/q/26415533
type: Comment
type: QuestionComment
has text: What is going wrong for you?
score: 0

http://stackoverflow.com/a/26393660
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26393129
type: Answer
accepted answer of: http://stackoverflow.com/q/26393129
upvote count: 4
has body: Lombok @NonNull generates those boilerplate for you. Instead of annotating method with @NotNull, you annotate the parameter @NonNull instead. import lombok.NonNull; public class NonNullExample extends Something { private String name; public NonNullExample(@NonNull Person person) { super("Hello"); //// if (person == null) { //// throw new NullPointerException("person"); //// } this.name = person.getName(); } } See the many questions tagged lombok to learn more.

http://stackoverflow.com/comment/41586894
type: Comment
has text: the problem with this method is that it will detect if you are connected to Wifi. But it will fail to detect if the Wifi has an internet connection or not ...hence this wont work
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26474565

http://stackoverflow.com/a/26483271
has body: Composition over inheritance is an important programming approach. So I preffer following construction of GUI. public class Application { private JFrame mainFrame; private MainPanel mainPanel; private void installFrame() { // initialize main frame mainFrame = new JFrame("Title"); } private void installComponents() { // install all components mainPanel = new MainPanel(); } private void layout() { // provide layouting mainFrame.add(mainPanel.getComponent()); } private void show() { mainFrame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Application app = new Application(); app.installFrame(); app.installComponents(); app.layout(); app.show(); } }); } } Main panel has no inheritance from JPanel, but use an instance of it. public class MainPanel { private JPanel mainPanel; public MainPanel() { mainPanel = new JPanel(new GridBagLayout()); // or another layout initComponents(); layout(); } private void initComponents() { // init all components here } private void layout() { // layout panel here } public Component getComponent() { return mainPanel; } } The same pattern I use for each complex component (for example for trees, tables, lists, tabbed panes etc.). But this approach has one disadvantage: there is no GUI builder that support it. About actions: you can provide a combined action. Something like this public class CombinedAction extends AbstractAction { private Action[] delegates; public CombinedAction(String name, Icon icon, Action... someDelegates) { super(name, icon); delegates = someDelegates; } public void actionPerformed(ActionEvent ae) { for (Action delegate : delegates) { delegate.actionPerfromed(ae); } } }
score: 5
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26482182
downvote count: 0

http://stackoverflow.com/comment/41421024
score: 0
type: Comment
type: QuestionComment
has text: You're doing many things wrong -- not using a layout manager, expecting `BorderLayout.CENTER` constant to work if the container doesn't yet use BorderLayout, getting your Graphics object via `getGraphics()`... time to start reading the tutorials as it beats guessing every time.
comment on: http://stackoverflow.com/q/26383301

http://stackoverflow.com/a/26446633
answers question: http://stackoverflow.com/q/26446597
score: 0
has body: You can use split(String regex) for this. Consider this simple example : String mystr = "232131231, random name, 23.3232"; List&lt;String&gt; list = Arrays.asList(mystr.split(", ")); for(String str : list){ System.out.println(str); } Output : 232131231 random name 23.3232 If you wanted to get list as ArrayList particularly, you can use ArrayList(Collection list) version of ArrayList. ArrayList list = new ArrayList(Arrays.asList(mystr.split(", ")));
type: Answer

http://stackoverflow.com/comment/41654075
has text: @Siva I added some more explanation look at the new code and see if you understand how the CSVWriter is working.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26511696

http://stackoverflow.com/comment/41820723
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26420462
score: 1
has text: Could you paste an excerpt of the redirecting code?

http://stackoverflow.com/comment/41549511
has text: do not use Label for grouping elements, use JPanel instead
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26454324
score: 1

http://stackoverflow.com/comment/41522935
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26439593
type: Comment
has text: All the code you would need to add is a constructor call around the list : `Set<String> validModes = new HashSet<>(Arrays.asList(...))`

http://stackoverflow.com/a/26403119
has comment: http://stackoverflow.com/comment/41459427
has comment: http://stackoverflow.com/comment/41456299
answers question: http://stackoverflow.com/q/26402829
downvote count: 0
has comment: http://stackoverflow.com/comment/41456582
has comment: http://stackoverflow.com/comment/41456244
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41455774
upvote count: 2
has body: HashSet does not preserve the element addition order. First it computes the object hash code that should stay constant but is difficult to predict, and then uses it to select a bucket that is a list of objects that have had the same bucket selected. As an Iterator just iterates over all buckets, the iteration order is largely unpredictable. Use LinkedHashSet instead if you need to preserve the order. However LinkedHashSet maintains an additional linked list so needs more resources.

http://stackoverflow.com/q/26419339
duplicate of: http://stackoverflow.com/q/428918
answer count: 4
score: 3
has comment: http://stackoverflow.com/comment/41485183
has answer: http://stackoverflow.com/a/26419424
tagged with: java
has comment: http://stackoverflow.com/comment/41503199
has comment: http://stackoverflow.com/comment/41489498
downvote count: 1
type: Question
has body: Sorry im new to java, may i know how can i add extra time in here? SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); String currTimestamp = timestampFormat.format(new Date()); System.err.println("currTimestamp=="+currTimestamp); // 2014/10/17 14:31:33
has title: JAVA : how to add extra time for timestamp
has answer: http://stackoverflow.com/a/26419392
upvote count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/428918
has answer: http://stackoverflow.com/a/26419359
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41485186
has answer: http://stackoverflow.com/a/26419432

http://stackoverflow.com/comment/41470983
score: 0
type: Comment
type: QuestionComment
has text: What is brother and child? use common names (left and right)
comment on: http://stackoverflow.com/q/26411053

http://stackoverflow.com/q/26479468
answer count: 1
favorite count: 0
tagged with: bluetooth-lowenergy
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: java
downvote count: 3
type: Question
has title: Notifications with BLE Android and iOS
score: -2
tagged with: ios
has body: I would like to create a BLE device that connects to the phone and receive all notifications (Text message, incoming calls, emails) It should be cross plateform and stay connected all the time. How can I do ?
has answer: http://stackoverflow.com/a/26479469

http://stackoverflow.com/comment/41566312
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26463806
has text: Sorry, you said there's an exception, how do you know that?
score: 0

http://stackoverflow.com/q/26445747
linked to: http://stackoverflow.com/q/34297676
has comment: http://stackoverflow.com/comment/41534372
has answer: http://stackoverflow.com/a/77729732
has body: After reading endless documents and trying to understand the examples about opencv/javacv for extracting keypoints, computing features with some DescriptorExtractors to match an input image against bunch of images to see if the input image is one of them or part of one of those images, I think, we should be storing the Mat objects after computing them. I will use Emily Webb's code as an example: String smallUrl = "rsz_our-mobile-planet-us-infographic_infographics_lg_unberela.jpg"; String largeUrl = "our-mobile-planet-us-infographic_infographics_lg.jpg"; IplImage image = cvLoadImage(largeUrl,CV_LOAD_IMAGE_UNCHANGED ); IplImage image2 = cvLoadImage(smallUrl,CV_LOAD_IMAGE_UNCHANGED ); CvMat descriptorsA = new CvMat(null); CvMat descriptorsB = new CvMat(null); final FastFeatureDetector ffd = new FastFeatureDetector(40, true); final KeyPoint keyPoints = new KeyPoint(); final KeyPoint keyPoints2 = new KeyPoint(); ffd.detect(image, keyPoints, null); ffd.detect(image2, keyPoints2, null); System.out.println("keyPoints.size() : "+keyPoints.size()); System.out.println("keyPoints2.size() : "+keyPoints2.size()); // BRISK extractor = new BRISK(); //BriefDescriptorExtractor extractor = new BriefDescriptorExtractor(); FREAK extractor = new FREAK(); extractor.compute(image, keyPoints, descriptorsA); extractor.compute(image2, keyPoints2, descriptorsB); System.out.println("descriptorsA.size() : "+descriptorsA.size()); System.out.println("descriptorsB.size() : "+descriptorsB.size()); DMatch dmatch = new DMatch(); //FlannBasedMatcher matcher = new FlannBasedMatcher(); //DescriptorMatcher matcher = new DescriptorMatcher(); BFMatcher matcher = new BFMatcher(); matcher.match(descriptorsA, descriptorsB, dmatch, null); System.out.println(dmatch.capacity()); My question is : How can I store descriptorsA (or descriptorsB) in a DB --in java implementation of opencv- ? (They are Mat objects obtained after extractor.compute(image, keyPoints, descriptorsA); ) I am aware of the fact that Mat object…
has answer: http://stackoverflow.com/a/35960305
favorite count: 0
has answer: http://stackoverflow.com/a/41141081
has comment: http://stackoverflow.com/comment/41535061
tagged with: serialization
has answer: http://stackoverflow.com/a/26479745
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41537591
has comment: http://stackoverflow.com/comment/41540208
answer count: 4
score: 1
tagged with: java
downvote count: 1
type: Question
has title: Is there a way of storing Opencv/javacv Mat objects in a database?
tagged with: javacv
linked to: http://stackoverflow.com/q/15271411

http://stackoverflow.com/q/26478815
answer count: 0
type: UnansweredQuestion
score: 0
has body: Morning, I am very new to Java and have previously only used HTML/Javascript when creating Android Apps. Updating my Android app using Eclipse and phonegap. Trying to create a menu following this tutorial. I get an error in my mainActivity class: the method startactivity(intent) in the type Activity is not applicable for the arguments (intent) Here is my code: package co.uk.xxxxxx.xxxxxxxx import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.MenuItem; import co.uk.xxxxx.xxxxx.R; import org.apache.cordova.DroidGap; public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); super.loadUrl("file:///android_asset/www/start.html"); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.settings: this.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)); return true; case R.id.help: this.appView.sendJavascript("navigator.notification.alert('No help')"); return true; default: return super.onOptionsItemSelected(item); } } } I do have strings.xml and menu.xml The error is at the line this.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
has title: Error when trying to create Android Menu in Eclipse
has comment: http://stackoverflow.com/comment/41594513
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/41594459
has comment: http://stackoverflow.com/comment/41594151
has comment: http://stackoverflow.com/comment/41594179
tagged with: android
has comment: http://stackoverflow.com/comment/41594245
has comment: http://stackoverflow.com/comment/41594255
has comment: http://stackoverflow.com/comment/41594582
tagged with: cordova

cookie-httponly
tags question: http://stackoverflow.com/q/26359701
tag name: cookie-httponly
type: Tag

http://stackoverflow.com/q/26408642
score: -3
has comment: http://stackoverflow.com/comment/41465745
has comment: http://stackoverflow.com/comment/41466418
has comment: http://stackoverflow.com/comment/41466608
has comment: http://stackoverflow.com/comment/41465705
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41465720
has answer: http://stackoverflow.com/a/26408696
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41466165
favorite count: 0
has body: I'm having a bit of trouble understanding an Eclipse error. I've got an if statement. I get an error on val.getVal(). Cannot invoke getVal() on the primitive type double What does that mean? public Double calculateShare() { if (val.getVal() &gt; PublicStock) { return 0; } }
has title: Using values from getters error
type: UnansweredQuestion

http://stackoverflow.com/comment/41585137
has text: Nope, it's part of the 2D Graphics API
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26454730
type: Comment

http://stackoverflow.com/comment/41449495
has text: Use telnet and check you can able to connect to the server.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26399450
type: QuestionComment

http://stackoverflow.com/comment/41747157
type: AnswerComment
has text: Thanks! A slightly more detailed tutorial on jboss-cli is at: https://github.com/arun-gupta/wildfly-lab/blob/master/docs/chapters/jboss-cli.adoc
type: Comment
comment on: http://stackoverflow.com/a/26452029
score: 1

http://stackoverflow.com/comment/41557999
has text: @MadProgrammer so what you mean is the getter part i will not need to return anything?
comment on: http://stackoverflow.com/q/26459021
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41432520
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26389115
has text: Yeah. I looked up the Jsoup's docs. Studying it now. For the example above, it's just a random one. I need all the text between any tags after . The tags may contain tags, but I need the text in the very middle of all these tag layers. Thx
score: 0

http://stackoverflow.com/q/26496892
upvote count: 1
has title: Java is not printing in a different class that doesn't contain main
downvote count: 1
has comment: http://stackoverflow.com/comment/41627300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41640629
tagged with: java
has comment: http://stackoverflow.com/comment/41626893
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26497148
has comment: http://stackoverflow.com/comment/41627918
has answer: http://stackoverflow.com/a/26497148
favorite count: 0
has answer: http://stackoverflow.com/a/26497092
has comment: http://stackoverflow.com/comment/41627008
score: 0
accepted answer: http://stackoverflow.com/a/26497092
has body: I've been experimenting with OOP with this code. I just started taking Stanford's CS106A, and since it uses the ACM library, the syntax might be a little off. So, here is the javadoc, http://cs.stanford.edu/people/eroberts/jtf/javadoc/student/acm/program/ConsoleProgram.html I'm using two classes named "itunes" and "test". "test" is the class that contains the "main", but here it uses the "run" method which is kind of analogous to the "main" method. first class, "test" import acm.program.ConsoleProgram; public class test extends ConsoleProgram{ public void run(){ itunes song1=new itunes("acdc",1991); song1.displaySong(); } } Second class, "itunes" import acm.program.ConsoleProgram; public class itunes extends ConsoleProgram { private static String name; private static int year; public itunes(String name1,int year1){ name = name1; year = year1; } public void displaySong(){ println(name); println(year); } } It compiles without errors but nothing appears on the console. Blank. But if I return those values to run and then display them within run, it works.Any idea why this is happening? Also if I wanted to return both the string name and int year from a single function, can I do that? In that case what will be the return type?
has comment: http://stackoverflow.com/comment/41627044
has comment: http://stackoverflow.com/comment/41627057

hql
tag name: hql
tags question: http://stackoverflow.com/q/26471534
tags question: http://stackoverflow.com/q/26487660
tags question: http://stackoverflow.com/q/26484172
tags question: http://stackoverflow.com/q/26359857
tags question: http://stackoverflow.com/q/26380245
type: Tag
tags question: http://stackoverflow.com/q/26377514
tags question: http://stackoverflow.com/q/26492070
tags question: http://stackoverflow.com/q/26502577

http://stackoverflow.com/q/26405901
has answer: http://stackoverflow.com/a/26405967
has body: 2 / 4 = 0; // it should be 0.5, but the result is 0 2 % 4 = 2 // its should be 0, cuz there are no remainders, but somehow the result is 2 Why it gives this results, what I'am doing wrong?
type: UnansweredQuestion
downvote count: 2
has title: Java modulos and division difference
has comment: http://stackoverflow.com/comment/41460593
has comment: http://stackoverflow.com/comment/41460623
has comment: http://stackoverflow.com/comment/41460486
score: 2
has comment: http://stackoverflow.com/comment/41460522
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41460596
has comment: http://stackoverflow.com/comment/41460460
has answer: http://stackoverflow.com/a/26405960
has comment: http://stackoverflow.com/comment/41460753
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/41460498
favorite count: 0

http://stackoverflow.com/a/26387669
answers question: http://stackoverflow.com/q/26386220
has comment: http://stackoverflow.com/comment/41430846
has comment: http://stackoverflow.com/comment/41430308
has comment: http://stackoverflow.com/comment/41430392
accepted answer of: http://stackoverflow.com/q/26386220
has comment: http://stackoverflow.com/comment/41430643
type: AcceptedAnswer
has body: Register your class with kryo.register(MyMessage.class) both on client and server sides. Create a test for your serialization/deserialization code, but instead of sockets use ByteArrayOutputStream/ByteArrayInputStream. Flush! After you write complete message to stream, flush written bytes to network: _output.flush()
score: 0
type: Answer

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/26407437

http://stackoverflow.com/a/26513017
answers question: http://stackoverflow.com/q/26512721
score: 0
type: Answer
has body: I think that your dburl may be malformed. Try this url instead. String dburl= "jdbc:sqlserver://localhost\\SQL2008:1433;" + "databaseName=Java;user=sa;password=123456";

http://stackoverflow.com/q/26447059
type: Question
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/26447085
has body: I'm so out of my depth in this class. It's supposed to be a basic currency converter. I highlighted where I'm having trouble in both the example &amp; my own code. I need advice on collecting the input &amp; outputting the input depending on what my input is (if that makes sense). My code is below, it's still in the beginning stages. The output of the program should look like this below: (Example) Welcome to the Currency Converter Program (Example) Use the following codes to input your currency choices: 1 – US Dollars 2 – Euros 3 – British Pounds 4 – Japanese Yen Please choose the input currency: 2 Now choose the output currency: 1 Now enter the input in *Euros*: €10.00 &lt;--- *This is where I am stuck at right now. How can I get the output to say Euro's, dollars, yen, etc. depending on what my input currency is?* €10.00 Euros at a conversion rate of 1.5 Euros to Dollars = $15.00 US Dollars. Thank you for using the Currency Converter Program! =========================================================== public class currency { public currency() { char us_dollar_sym = 36; char pound_sym = 163; char yen_sym = 165; char euro_sym = 8364; double us_dollar = 0; double pound = 0; double yen = 0; double euro =0; // Interface System.out.println("Welcome to the Currency Converter Program \n"); System.out.println("Use the following codes to input your currency choices: \n 1 - US dollars \n 2 - Euros \n 3 - British Pounds \n 4 - Japanese Yen \n"); // Collect user input System.out.println("Please choose the input currency:"); Scanner in = new Scanner(System.in); String choice = in.next(); System.out.println("Please choose the output currency"); String output = in.next(); System.out.printf("Now enter the input in"); &lt;-- Stuck here double input = in.nextInt(); } }
answer count: 1
favorite count: 0
tagged with: currency
tagged with: input
has title: Intro to Java Programming Currency Converter input
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26447085
downvote count: 3
tagged with: output
upvote count: 1

http://stackoverflow.com/comment/41369446
comment on: http://stackoverflow.com/q/26355115
has text: Have you confirmed that this code is actually run more than once (i.e. that while loop happens the expected amount of times)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41536264
type: QuestionComment
type: Comment
score: 2
has text: Then this doesn't seem to have anything to do with `String`, but rather everything to do with your output device.
comment on: http://stackoverflow.com/q/26446822

http://stackoverflow.com/comment/41643477
type: Comment
comment on: http://stackoverflow.com/q/26505936
type: QuestionComment
has text: @guido My code is very standard, the only non-java code I'm using is my extended DefaultTreeCellRenderer, and then the modifications only relate to the custom Icons
score: 0

http://stackoverflow.com/a/26359358
has comment: http://stackoverflow.com/comment/41377662
has comment: http://stackoverflow.com/comment/41377754
has comment: http://stackoverflow.com/comment/41377795
score: 0
has comment: http://stackoverflow.com/comment/41377363
has body: You can check whether your triangle satisfy the pythagoras theorem or not here. Same thing you are doing here. You should be able to create different points(3 sets of coordinates). Then you can use this logic. In your case all all three points are same (1,1). This is not a triangle. You can try as following Now you have to be smart. boolean result = hypo1 || hypo2 || hypo3; // by pythagoras theorem only one // should true can't all are true Change boolean result = hypo1 || hypo2 || hypo3; To boolean result=false; boolean[] all = { hypo1, hypo2,hypo3 }; boolean result=false; for (boolean a : all) { for (boolean b: all) { for(boolean c:all){ result =(a^b^c) &amp;&amp; !(a&amp;&amp;b&amp;&amp;c); } } } Why? boolean result = hypo1 || hypo2 || hypo3;// this will give you true // for all 3 variables are true That is incorrect. you have to drop that case as false.
has comment: http://stackoverflow.com/comment/41377585
type: Answer
has comment: http://stackoverflow.com/comment/41377349
has comment: http://stackoverflow.com/comment/41377906
has comment: http://stackoverflow.com/comment/41377744
answers question: http://stackoverflow.com/q/26359264
has comment: http://stackoverflow.com/comment/41378157

http://stackoverflow.com/q/26419859
tagged with: multithreading
has body: I'm working on a project where quick responsivness is very important, and basicly what it does is getting current location of the user, gets a bunch (can be few hundrends at most) of locally stored LatLng objects and requests the google web api for directions. My question is - What would be the 1) right way to do it and 2) not take ages to finish (assuming a decent net connection) Right now I took the path of - create a thread for each of the requests and update some data structure, when all threads finish , continue evaluation this is basicly my code: private class RetrieveTracks extends AsyncTask&lt;Void, Void, Data&gt; { private Data data; @Override protected Data doInBackground(Void... params) { data = new Data(); List&lt;Thread&gt; threads = new ArrayList&lt;Thread&gt;(); for (LatLng lat : lats) { //lats is some collection with the LatLng objects I got Thread thread = new Thread(new DirectionsFinder(lat, data, currentLocation)); threads.add(thread); thread.start(); } for (Thread thread : threads) { try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } return data; } @Override protected void onPostExecute(Data data) { //update map with Data } } public class DirectionsFinder implements Runnable { private LatLng lat; private Data data; private LatLng curLoc; public DirectionsFinder(Latlng lat, Data data, LatLng curLoc) { this.lat = lat; this.data = data; this.curLoc = curLoc; } @Override public void run() { //send GET request to google web api and get the directions synchronized (data) { //update data } } } also a side question I got - in some occasions I might get in the mid of the execution enough data such that I no longer need to get information, is there a way to 'break' out of the resst of the running threads? At first I tried to use Callable and FutureTask for what I'm trying to do but coulnd't find a convinient way to to the joining phase which is very important so I gave up on it
type: Question
has title: Android - The right way to send many requests
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26420976
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 0

http://stackoverflow.com/q/26356195
downvote count: 0
has body: I have C application that has to generate elliptic curve private key and export it for Java application that uses Spongycastle. I need that my application produces completely the same keys as Spongycastle, so I use in OpenSSL the same format as Spongycastle is supposed to use for private key export, but for any reason resulted key bytes are different. Spongycastle ECPrivateKey.getEncoded method is supposed to return PKCS8 PrivateKeyInfo in DER encoding. I really can import it in OpenSSL. However, when I export it back, the key file size becames 2 times less. Example key file is http://www.fileconvoy.com/dfl.php?id=g90dd3019881e526c999568884712f1e3c7d48d7cc I use following command line: openssl pkcs8 -topk8 -inform DER -in "ec.key" -nocrypt -outform DER -out "ec.p8" This command line is supposed to import PKCS8 elliptic curve private key and export it in the same format. However, ec.key file is 591 bytes, and ec.p8 file is 295 bytes, so imported and exported key or its format is obviously different. Why?
favorite count: 0
tagged with: bouncycastle
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: OpenSSL and Java elliptic curve keys compatibility
type: Question
tagged with: spongycastle
tagged with: openssl

http://stackoverflow.com/comment/49940432
score: 1
type: AnswerComment
has text: @cpu2007 what is the error that you see? have you tried autoAck=false in addition to prefetchCount=1? This way broker won't give more messages until you send an ack for the one you're processing
type: Comment
comment on: http://stackoverflow.com/a/26509746

http://stackoverflow.com/comment/41617483
type: Comment
comment on: http://stackoverflow.com/a/26490662
type: AnswerComment
has text: @ChrisKannon You have to block for print to avoid garbling the text unless print is synchronized internally, which then would just have the same effect (other row updates are blocked). Note that as many row updates as you have threads still can take place in parallel before they are blocked. Multi-threading an operation which uses the same IO resource may just not make that much sense in the first place.
score: 0

http://stackoverflow.com/q/26387666
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41429183
has comment: http://stackoverflow.com/comment/41429218
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/26350158
has comment: http://stackoverflow.com/comment/41429293
has comment: http://stackoverflow.com/comment/41429337
answer count: 0
has comment: http://stackoverflow.com/comment/41429405
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/41430624
has body: When im trying to get the json data with an api request. Ill get a NullPointerException. public CouchPotatoMovie(JSONObject json) throws JSONException { this.title = json.getString("title"); this.status = json.getString("status"); this.id = json.getString("_id"); this.info = new CouchPotatoMovieInfo(json.getJSONObject("info")); if(json.getJSONArray("releases").length() != 0) { JSONArray array = json.getJSONArray("releases"); for(int i = 0; i &lt; array.length(); i++) { releases.add(new Release(array.getJSONObject(i))); } } } This is my constructor. Im gettin an null pointer at releases.add(new Release(array.getJSONObject(i))) 10-15 18:10:49.233: E/AndroidRuntime(9609): Caused by: java.lang.NullPointerException 10-15 18:10:49.233: E/AndroidRuntime(9609): at nl.somename.model.couchpotato.CouchPotatoMovie.&lt;init&gt;(CouchPotatoMovie.java:31) 10-15 18:10:49.233: E/AndroidRuntime(9609): at nl.somename.model.CouchPotato.parse(CouchPotato.java:229) 10-15 18:10:49.233: E/AndroidRuntime(9609): at nl.somename.model.CouchPotato.available(CouchPotato.java:106) The JSON im getting is (Sorry I don't know how to put breaks in it): {"status": "active", "info": {"rating": {"imdb": [6.4000000000000004, 29064]}, "actor_roles": {"Rebecca Ferguson": "Ergenia", "Rufus Sewell": "Autolycus", "John Hurt": "Cotys", "Irina Shayk": "Megara", "Tobias Santelmann": "Rhesus", "Ian McShane": "Amphiarus", "Reece Ritchie": "Iolaus", "Ingrid Bols\u00f8 Berdal": "Atalanta", "Aksel Hennie": "Tydeus", "Dwayne Johnson": "Hercules"}, "tmdb_id": 184315, "plot": "Fourteen hundred years ago, a tormented soul walked the earth that was neither man nor god. Hercules was the powerful son of the god king Zeus, for this he received nothing but suffering his entire life. After twelve arduous labors and the loss of his family, this dark, world-weary soul turned his back on the gods finding his only solace in bloody battle. Over the years he warmed to the company of six similar souls, their only bond being their lov…
has comment: http://stackoverflow.com/comment/41430579
type: Question
has title: Getting NullpointerException when to get JSON data

http://stackoverflow.com/q/26386808
accepted answer: http://stackoverflow.com/a/26388551
tagged with: java
tagged with: hibernate
tagged with: grails
has title: Where i can store the encrypted key using jasypt
type: AnsweredQuestion
has body: I Have a grails application and i want to secure data before store it in the database. Hibernate grails and jasypt offer this possibility using EncryptedStringType. but this will need a key. where i can store this key ??. please refer to this sample: encryptor.setPassword("some password here"); encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); String myText = "358904051493345"; System.out.println(myText); String encryptedText = encryptor.encrypt(myText); System.out.println(encryptedText); String decriptedText = encryptor.decrypt(encryptedText); System.out.println(decriptedText);
type: Question
has answer: http://stackoverflow.com/a/26388551
tagged with: jasypt
score: 0
tagged with: encryption
answer count: 1

http://stackoverflow.com/q/26382269
favorite count: 0
linked to: http://stackoverflow.com/q/23250299
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26383270
accepted answer: http://stackoverflow.com/a/26383270
tagged with: ognl
answer count: 1
tagged with: jsp
score: 4
tagged with: struts2
has body: I am working on a project where I have to send data from JSP page to action class in the form of List, I am setting List&lt;Object&gt; from action class first time when it mapped with JSP page, when I am doing action for saving the details, In action I get a values of List&lt;Object&gt; like as Cartesian Product for each value. e.g. If there are List of 3 Objects(having 4 member fields) passing to JSP, when returning to action it generates 12 objects with different values of JSP. The Image shows the Demo UI, it is not a table, but each Row represents an object of list In The action class List&lt;Pojo&gt; PojoList = new ArrayList&lt;Pojo&gt;(); Can anyone suggest me what approach should I use, this is new scenario for me, I also tried some example from internet but not succeed, I also iterate the list in JSP but It was giving me an error.(not exactly error but it does not give fields on JSP); In JSP: &lt;c:forEach var="pojo" items="${pojoList}"&gt; &lt;s:textarea name="pojo.field1"&gt; &lt;s:textarea name="pojo.field2"&gt; &lt;s:textarea name="pojo.field3"&gt; &lt;s:textarea name="pojo.field4"&gt; &lt;/c:forEach&gt; Return In Action Class method(It prints 12 objects) try { System.out.println("List : "+pojoList); for (Iterator&lt;Pojo&gt; iterator = pojoList.iterator(); iterator.hasNext();) { Pojo pojo = (Pojo) iterator.next(); System.out.println("\n MB : "+pojo); } } catch (Exception e) { e.printStackTrace(); } Please suggest me whats going wrong.
tagged with: arraylist
has title: Mapping a list with JSP page and getting values in Action class. It gives the result list as a cartesian product in Action class

http://stackoverflow.com/comment/41581287
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26471075
score: 1
has text: ImageView.setImageUri(Uri.parse(new File("path_to_your_image".toString()));

http://stackoverflow.com/comment/41482627
score: 1
comment on: http://stackoverflow.com/a/26383323
type: AnswerComment
has text: This hadoop with webhdfs and kerberos enabled. I am able Knint using different keytabs and different realms.But java code mentioned above isn't working.Java apis always takes the default_realms mentioned in krb5.conf as default and doesn't recognize other realms....
type: Comment

http://stackoverflow.com/comment/41422680
type: Comment
score: 0
has text: The only caveat I would add is there are some things such as JUnit Rules that must be on public fields. But I guess that is covered by the "good reasons"
type: AnswerComment
comment on: http://stackoverflow.com/a/26381443

http://stackoverflow.com/q/26465633
has answer: http://stackoverflow.com/a/26466013
tagged with: casting
tagged with: types
accepted answer: http://stackoverflow.com/a/26465733
has comment: http://stackoverflow.com/comment/41569210
favorite count: 0
has answer: http://stackoverflow.com/a/26465914
upvote count: 8
has answer: http://stackoverflow.com/a/26465678
tagged with: java
linked to: http://stackoverflow.com/q/842817
downvote count: 1
has title: Type casting into byte in Java
type: Question
has answer: http://stackoverflow.com/a/26465733
has answer: http://stackoverflow.com/a/26465865
type: AnsweredQuestion
score: 7
answer count: 6
possible better answer: http://stackoverflow.com/a/26466013
has body: I am a beginner in Java. I came across a concept called Type Casting. I have the following snippet- class Demo { byte b; int a=257; double d= 323.142 b=(byte)a; System.out.println(b); b=(byte)d; System.out.println(b); } The output for the code is 1 67 Can anybody explain me the outputs. Thanks in Advance!
has answer: http://stackoverflow.com/a/26465687

http://stackoverflow.com/a/26488499
has body: Hard to say anything without some code. First thing I would try - as you are already testing your app outside - is using another, similar app and see, if there is a problem with your app or a hardware issue with your inbuilt GPS. The values of MIN_DISTANCE_FOR_UPDATES and MIN_TIME_BW_UPDATES are reasonable? Energy saving mode enabled in your phone can also lead to a less frequent GPS position updates. I think, for more suggestions, some code is required.
has comment: http://stackoverflow.com/comment/41647311
has comment: http://stackoverflow.com/comment/41611506
has comment: http://stackoverflow.com/comment/41612401
answers question: http://stackoverflow.com/q/26488232
score: 0
has comment: http://stackoverflow.com/comment/41618535
type: Answer

http://stackoverflow.com/comment/41464189
comment on: http://stackoverflow.com/a/26407506
has text: I don't really follow. To do any more you have to draw everything yourself using `OwnerDrawLabelProvider` (JFace) or SWT.MeasureItem, SWT.EraseItem and SWT.PaintItem (SWT).
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26375147
score: 1
has body: First of All, You cannot assign int values to Long variables directly. To do so, then you need to type cast to Long type or need to add 'L' symbol to int literal. Find the modified code below serRole = (long) 8; or serRole = 8L; Your question is " if the userRole is not equal to 8 and 7". We have to write the "userRole is not equal to 8 and 7" in java as (userRole != 8 &amp;&amp; userRole != 7). '&amp;&amp;' represents "And" '||' represents "Or". So, working functionality of your code is as follows, Long userRole = new Long(-1); userRole = 8L; boolean showSave=true; if (userRole != 8&amp;&amp;userRole!=7) { showSave = false; }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26374838
downvote count: 0

http://stackoverflow.com/comment/41594703
score: 0
has text: @ScaryWombat well, I don't read any other prev question, so I lack of this context.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26479099

http://stackoverflow.com/q/26446750
has answer: http://stackoverflow.com/a/26446773
duplicate of: http://stackoverflow.com/q/7380626
favorite count: 0
accepted answer: http://stackoverflow.com/a/26446795
answer count: 4
has answer: http://stackoverflow.com/a/26446795
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7380626
upvote count: 2
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26446773
has body: I am reading in java inputs in format below 2499.873639 32.374242 0.610059 ... Now i want to get rid of the decimal place and have them in this format 2499873639 32374242 610059 ... I have this code which does it for smaller number for not for larger numbers. The Larger numbers become negative (i think this overflowing) and giving it junk values. BigDecimal b = new BigDecimal(a).multiply(new BigDecimal("1000000.") If i increase the 0's by another two BigDecimal b = new BigDecimal(a).multiply(new BigDecimal("100000000.") It works for larger numbers but not smaller numbers. In short of having a bunch of if's is there anyway to fix this issue?
has answer: http://stackoverflow.com/a/26446792
downvote count: 1
has answer: http://stackoverflow.com/a/26446786
type: Question
tagged with: bigdecimal
has title: Getting Rid of Decimal place in Java?
tagged with: decimal

http://stackoverflow.com/comment/41513527
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26434353
has text: Write a new program that does nothing but make 2 threads where each prints something in a loop and then build from there.
score: 0

http://stackoverflow.com/q/26446512
has body: Why doesn't the following code compile int n = 5; char c = n; but the following does compile char c = 5; Aren't I just assigning an integer value to char in both cases?
possible better answer: http://stackoverflow.com/a/26446543
downvote count: 2
tagged with: char
answer count: 2
has answer: http://stackoverflow.com/a/26446545
accepted answer: http://stackoverflow.com/a/26446545
has comment: http://stackoverflow.com/comment/41535509
has comment: http://stackoverflow.com/comment/41535521
favorite count: 0
has comment: http://stackoverflow.com/comment/41535495
has comment: http://stackoverflow.com/comment/41535481
linked to: http://stackoverflow.com/q/21317631
upvote count: 10
has title: Can assign integer value to char but can't assign integer variable to char
score: 8
has comment: http://stackoverflow.com/comment/41535603
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26446543
linked to: http://stackoverflow.com/q/17984975
type: Question
has comment: http://stackoverflow.com/comment/41535573
tagged with: java
has comment: http://stackoverflow.com/comment/41535497
tagged with: int

http://stackoverflow.com/comment/41586918
type: QuestionComment
has text: You need to add the missing jars into the "WEB-INF/lib" directory inside your WAR/EAR file. This will automatically add them to the application's classpath at run-time.
comment on: http://stackoverflow.com/q/26468024
score: 0
type: Comment

http://stackoverflow.com/a/26399309
answers question: http://stackoverflow.com/q/26375565
has comment: http://stackoverflow.com/comment/41506126
has body: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to YourDTO is thrown when the EclipseLink can't find the name of YourDTO passed to the em.createNativeQuery("SELECT...","YourDTO"); The exception thrown by Hibernate in similar situation is: org.hibernate.MappingException: Unknown SqlResultSetMapping [someNonExistingMappingName] You have to ensure that YourDTO is registered by your persistence provider. How? Observe your logs: Hibernate: DEBUG annotations.ResultsetMappingSecondPass - Binding result set mapping: YourDTO EclipseLink: I didn't find any logs for that. One additional remark to your mapping: Use @ColumnResult with type for ambiguous types: @ColumnResult(name = "article_publish_date", type=Calendar.class) @ColumnResult(name = "article_id", type=BigInteger.class)
score: 0
has comment: http://stackoverflow.com/comment/41469094
has comment: http://stackoverflow.com/comment/41479036
type: Answer

http://stackoverflow.com/comment/41482654
comment on: http://stackoverflow.com/q/26400323
score: 0
type: Comment
type: QuestionComment
has text: @A4L am using mysql workbench in my system so i dont want to install mysql workbench in every third party system

http://stackoverflow.com/comment/41964759
type: Comment
has text: *I need to add the stamp at 0, -1, 94, 140* - if you need to stamp there, why do you check at all? Or asked the other way around, where do you need to stamp if stamping at that position would cover text? What are your requirements then?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26503289

http://stackoverflow.com/a/26462029
has body: There is nothing that will give you all the preferences, you have to look at individual preference pages. Many preference pages use the Eclipse preferences API to store values in a 'preference node'. These can be accessed using two APIs: IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode("preference node id"); IPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "preference node id"); Both these APIs require you to know the 'preference node id' of the page, looking up individual preference values requires you to know the id of the individual preference. To find these you either need to look at the source code of the preference page or examine the 'xxx.prefs' file the Workspace '.metadata/plugins/org.eclipse.core.runtime/.settings' folder. Not all preference pages uses these APIs, the 'Network Connection' page you mention uses an internal API.
score: 0
answers question: http://stackoverflow.com/q/26461503
type: Answer

http://stackoverflow.com/comment/41548514
comment on: http://stackoverflow.com/a/26453544
type: Comment
score: 0
type: AnswerComment
has text: @vks same result. Pshemo is probably right. regex101 must have completely different syntax for some or none at all. Bottom line is that it works for my program and I'm happy :D woohoo!

http://stackoverflow.com/comment/41568643
type: Comment
score: 0
has text: It's strange. The matrix has all of its elements created by default (null). The matrix exists...
comment on: http://stackoverflow.com/a/26465104
type: AnswerComment

http://stackoverflow.com/comment/41524101
score: 0
comment on: http://stackoverflow.com/q/26439907
type: Comment
type: QuestionComment
has text: I'm not sure if I should use an Applet or a Jar execution. I know for now that I need to sign my Application to not get blocked. My application includes socket connections, remote control and voip.

http://stackoverflow.com/comment/41727975
score: 0
has text: Thx, but this document was already linked to in the question, so unfortunately no apparent help there.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26551527

http://stackoverflow.com/q/26464926
has comment: http://stackoverflow.com/comment/41567966
score: 0
has comment: http://stackoverflow.com/comment/41567810
tagged with: sql
answer count: 0
type: UnansweredQuestion
has title: Error updating more than one Row in a Table:org.hibernate.HibernateException: More than one row with the given identifier was found
has comment: http://stackoverflow.com/comment/41569360
has comment: http://stackoverflow.com/comment/41568629
tagged with: java
tagged with: hibernate
has body: I am trying to update some rows (10) at the same time in a Table. These rows have been created with Hibernate with no problem, but when I try to update them based on the PK of the table it shows the following error: org.hibernate.HibernateException: More than one row with the given identifier was found: because there are 10 rows with that Id. This is the persistence of the class: @javax.persistence.Id @Column(name = "ID_PARENT", unique = false, nullable = false, precision = 15, scale = 0) public long getIdParent() { return this.idParent; } public void setIdParent (long idParent) { this.idParent = idParent; } In order to update the rows I use the following code: for (int i=0;i&lt;Dto.getDescription().size();i++){ insertI18N.setIdParent(entity1.getCodCustomerCptType()); insert.setDescription(Dto.getDescription().get(i)); insert.setLocale(Dto.getLocale().get(i)); insertList.add(insertI18N); gcomCustomerCptTypeI18NDao.update(insertList); } Kind Regards
type: Question
has comment: http://stackoverflow.com/comment/41571517

http://stackoverflow.com/a/26506985
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41645610
accepted answer of: http://stackoverflow.com/q/26506418
has comment: http://stackoverflow.com/comment/41645833
has body: Use JSONObject keys() to get the key and then iterate each key to get to the dynamic value. You can parse the JSON like this JSONObject responseDataObj = new JSONObject(responseData); JSONObject listMainObj = responseDataObj.getJSONObject("listmain"); Iterator keys = listMainObj.keys(); while(keys.hasNext()) { // loop to get the dynamic key String currentDynamicKey = (String)keys.next(); //store key in an arraylist which is 16,17,... // get the value of the dynamic key JSONArray currentDynamicValue = listMainObj.getJSONArray(currentDynamicKey); int jsonrraySize = currentDynamicValue.length(); if(jsonrraySize &gt; 0) { for (int i = 0; i &lt; jsonrraySize; i++) { JSONObject brandidObj = currentDynamicValue.getJSONObject(i); String brandid = brandidObj.getString("brandid"); System.out.print("Brandid = " + brandid); //store brandid in an arraylist } } } Source of this answer
has comment: http://stackoverflow.com/comment/41645179
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26506418
has comment: http://stackoverflow.com/comment/41646655

http://stackoverflow.com/q/26457227
has body: thank you so much for your help in adv.! I get an error when using scanner with enum type. However I was not allowed to use Buffer (InputStreamReader) in this task. What is the best work around it? I receive following error: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted at ui.Application.runCLI(Application.java:33) at ui.Application.main(Application.java:13) The code: package ui; import java.util.Scanner; public class Application { static String command; public enum Command { CONNECT, DISCONNECT, SEND, LOGLEVEL, HELP, QUIT, EXIT } private static void run(Scanner sc) { // String command; // ready for the input boolean done = false; // ready for the menu loop while (!done) { // keep on until done System.out .println("Milestone1: Connection and interation with TCP server"); System.out .println("-------------------Please select on of the commandso-------------------------------------"); System.out.println("connect"); System.out.println("disconnect"); System.out.println("send"); System.out.println("logLevel"); System.out.println("help"); System.out.println("quit"); System.out.println("exit"); command = sc.nextLine(); // take user input Command cmd=null; try{ cmd=Command.valueOf(command.toUpperCase()); } catch (IllegalArgumentException e){ System.out.println("Invalid input"); return; } switch (cmd) { case EXIT: // exit menu done = true;// condition for breaking the loop break; case CONNECT: System.out.print(" IP adress: "); try { String userInput = sc.toString(); // user Input System.out.println(" Port: "); int userInput1 = sc.nextInt();// user Input if (userInput1 &gt;= 0) { System.out.println(" EcoClient&gt;" + " " + command + " " + userInput + " " + userInput1); } else { System.out .println("Entered value for Port is negative number or IP adress length &lt; 7 || &gt; 15, not in n.n.n.n format "); } } catch (Except…
type: Question
has comment: http://stackoverflow.com/comment/41587543
tagged with: java.util.scanner
upvote count: 1
answer count: 1
tagged with: enums
tagged with: java
has title: How to use enum types with Scanner
has answer: http://stackoverflow.com/a/26457264
has comment: http://stackoverflow.com/comment/41555458
downvote count: 0
has comment: http://stackoverflow.com/comment/41587075
tagged with: bufferedreader
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/41586625
favorite count: 0

http://stackoverflow.com/q/26389075
answer count: 1
score: -2
has title: how to understand Perlin Noise and how to use it?
has answer: http://stackoverflow.com/a/26396420
downvote count: 2
has body: I'm desperate right now. Searched every corner and everything to figure out but i still cant.. I'm looking how to use noise to generate a tiled 2d map in java. This is the only thing i ever wanted in programming to know this. Best way to me to learn is to see the full simple code of something and analyse it by testing. Is there anyone who can show me a video or show me a simple little code of how it works? I just cant understand how to make it. Would be nice if it was in simple English because i cant really understand complex words.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26396420
type: Question
upvote count: 0
tagged with: perlin-noise
favorite count: 0
tagged with: noise
tagged with: tiles

http://stackoverflow.com/q/26370800
score: 1
has answer: http://stackoverflow.com/a/26371034
tagged with: java
accepted answer: http://stackoverflow.com/a/26371034
tagged with: eclipse
type: Question
answer count: 1
has body: I'm attempting to build a simple Android app using In-App Billing. I'm using a Nexus 7 2013 device to run and debug it. I just get the error message, "Unfortunately, your app has stopped." I've tried logging and inserting breakpoints, but it never even seems to get to the beginning of the code. I'm using this tutorial and this one, and have only started working with them. My code: package com.myknitcards.project; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import com.myknitcards.project.util.IabHelper; import com.myknitcards.project.util.IabResult; import com.myknitcards.project.util.Inventory; import com.myknitcards.project.util.Purchase; public class MainActivity extends Activity { private Button clickButton = (Button)findViewById(R.id.clickButton); private Button buyButton = (Button)findViewById(R.id.buyButton); private static final String TAG = "com.myknitcards.project"; IabHelper mHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); clickButton.setEnabled(false); String base64EncodedPublicKey = "mykeyhere"; mHelper = new IabHelper(this, base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d(TAG, "In-app Billing setup failed: " + result); } else { Log.d(TAG, "In-app Billing is set up OK"); } } }); } public void buttonClicked(View view) { clickButton.setEnabled(false); buyButton.setEnabled(true); } } My LogCat reads: 10-14 17:30:07.458: D/AndroidRuntime(10207): Shutting down VM 10-14 17:30:07.458: W/dalvikvm(10207): threadid=1: thr…
upvote count: 1
favorite count: 0
has title: Android In-App Billing app won't run
tagged with: android
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/26356655
has comment: http://stackoverflow.com/comment/41372642
type: Answer
accepted answer of: http://stackoverflow.com/q/26356303
answers question: http://stackoverflow.com/q/26356303
has comment: http://stackoverflow.com/comment/41384683
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41372523
type: AcceptedAnswer
downvote count: 0
has body: You could create a simple Jar file, run that, using just that Jar in the classpath. You could then have a class that extends URLClassLoader, pass this object your real classpath, load your real main class through your ClassLoader, and invoke the main method using reflection. Example main method public static void main (String... args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { URL[] classpath = new URL[0]; LoggingClassLoader loggingClassLoader = new LoggingClassLoader(classpath, Main.class.getClassLoader()); Class&lt;?&gt; aClass = loggingClassLoader.loadClass("com.company.project.RealMain"); Method main = aClass.getMethod("main", args.getClass()); main.invoke(null); } Example class loader object Edit I have slightly extended the example, with there now being one loader per jar/ URL, in case you need to keep track of which class was loaded from what jar: public static class LoggingClassLoader extends URLClassLoader { final List&lt;ChildLogger&gt; childLochildLoggersders = new ArrayList&lt;&gt;(); public LoggingClassLoader(URL[] urls, ClassLoader parent) { super(urls, parent); for(URL url : urls) { childLochildLoggersders.add(new ChildLogger(url, this)); } } @Override protected Class&lt;?&gt; findClass(String name) throws ClassNotFoundException { for(ChildLogger childLoader : childLochildLoggersders) { try { return childLoader.loadClass(name); } catch(ClassNotFoundException ignore) { } } throw new ClassNotFoundException(name); } private static class ChildLogger extends URLClassLoader { private final URL url; private ChildLogger(URL url, ClassLoader parent) { super(new URL[]{url}, parent); this.url = url; } @Override protected Class&lt;?&gt; findClass(String name) throws ClassNotFoundException { Class&lt;?&gt; aClass = super.findClass(name); System.out.println("Loaded from :" + url + " class: " + name); return aClass; } } }

http://stackoverflow.com/q/26428021
has answer: http://stackoverflow.com/a/26428146
has answer: http://stackoverflow.com/a/26432508
has answer: http://stackoverflow.com/a/26428312
tagged with: spring-mvc
has body: I have using Spring MVC... After dispatcher servlet loading, i am getting exception. I need to write that exception into log file... I getting error... The TCP/IP connection to the host 192.168.100.178, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall." I could not write into Log file… Can anyone help? Thanks
type: UnansweredQuestion
tagged with: java
type: Question
has title: How to Write exceptions into Log file...?
score: 0
answer count: 3

http://stackoverflow.com/q/26387602
type: Question
has body: In my eclipse plugin, I have a ITextViewer object and a line number. What I want to do is to color the whole line at the line number. How can I do that?
score: 0
has comment: http://stackoverflow.com/comment/41429625
has comment: http://stackoverflow.com/comment/41430499
tagged with: eclipse-plugin
type: UnansweredQuestion
has title: ITextViewer: How to highlight a whole line?
has comment: http://stackoverflow.com/comment/41430914
answer count: 0
tagged with: java

http://stackoverflow.com/q/26430630
has comment: http://stackoverflow.com/comment/41525689
favorite count: 0
tagged with: goto
has comment: http://stackoverflow.com/comment/41506379
has comment: http://stackoverflow.com/comment/41537453
has answer: http://stackoverflow.com/a/38407867
has answer: http://stackoverflow.com/a/26430740
has answer: http://stackoverflow.com/a/53805776
has comment: http://stackoverflow.com/comment/41506731
has comment: http://stackoverflow.com/comment/41506345
has body: I am taking my high school AP Computer Science class. I decided to throw a goto statement into a one of our labs just to play around, but I got this error. Exception in thread "main" java.lang.Error: Unresolved compilation problems: Syntax error on token "goto", assert expected restart cannot be resolved to a variable at Chapter_3.Lab03_Chapter3.Factorial.main(Factorial.java:28) I went to a goto question on Stackoverflow to find out how to do it properly, and I did exactly as was demonstrated in one of the answers. I really don't understand why the compiler wants an assert statement (at least that's what I assume it wants), nor do I have any idea how to use assert. It seems to want the restart part of goto restart; to be a variable, but restart is just a label that pulls the program back up to line 10 so that the user can enter a valid int. If it wants restart to be a variable, how do I do that? import java.util.*; public class Factorial { public static void main(String[] args) { int x = 1; int factValue = 1; Scanner userInput = new Scanner(System.in); restart: System.out.println("Please enter a nonzero, nonnegative value to be factorialized."); int factInput = userInput.nextInt(); while(factInput&lt;=0) { System.out.println("Enter a nonzero, nonnegative value to be factorialized."); factInput = userInput.nextInt(); } if(x&lt;1)//This is another way of doing what the above while loop does, I just wanted to have some fun. { System.out.println("The number you entered is not valid. Please try again."); goto restart; } while(x&lt;=factInput) { factValue*=x; x++; } System.out.println(factInput+"! = "+factValue); userInput.close(); } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26431031
has comment: http://stackoverflow.com/comment/41525845
has comment: http://stackoverflow.com/comment/41506250
has comment: http://stackoverflow.com/comment/41531329
has comment: http://stackoverflow.com/comment/41506069
tagged with: java
tagged with: loops
downvote count: 1
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/26430691
has answer: http://stackoverflow.com/a/46184041
has answer: http://stackoverflow.com/a/26430977
has comment: http://stackoverflow.com/comment/41532802
has answer: http://stackoverflow.com/a/26430672
possible better answer: http://stackoverflow.com/a/26430691
score: 34
has comment: http://stackoverflow.com/comment/41525772
has answer: http://stackoverflow.com/a/26431031
has comment: http://stackoverflow.com/comment/41525858
has title: How to use goto statement correctly
upvote count: 35
has comment: http://stackoverflow.com/comment/41531375

http://stackoverflow.com/q/26456325
tagged with: http-headers
has answer: http://stackoverflow.com/a/26466589
tagged with: struts2
answer count: 1
has comment: http://stackoverflow.com/comment/41561647
favorite count: 0
tagged with: struts2-rest-plugin
upvote count: 3
has comment: http://stackoverflow.com/comment/41563712
tagged with: rest
has comment: http://stackoverflow.com/comment/41563192
linked to: http://stackoverflow.com/q/7685555
has title: Struts2-Rest: Manual HTTP 5xx doesn't return content
downvote count: 0
has comment: http://stackoverflow.com/comment/41564506
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41564283
has body: I'm attempting to manually return a HTTP 4xx or 5xx with a custom error message. It works perfectly for GET but returns empty content for PUT and POST. Thank you in advance to anyone who can suggest how to get the PUT and POST working! These are the calls I'm making to the webservice: GET /webapp/orders/A.json - returns HTTP 500 and the error message as content PUT /webapp/orders/A.json - returns HTTP 500 and content-length=0 getModel() is called in both instances, the message just doesn't make it back to Chrome for PUT. Here's sample code that produces the error: OrdersController package com.test.controller; import org.apache.struts2.rest.DefaultHttpHeaders; import org.apache.struts2.rest.HttpHeaders; import org.apache.struts2.convention.annotation.Namespace; import com.opensymphony.xwork2.ModelDriven; @Namespace("/rest") public class OrdersController implements ModelDriven<Object> { // GET /orders/A public HttpHeaders show() { return new DefaultHttpHeaders().withStatus(500); } // PUT /orders/A public HttpHeaders update() { return new DefaultHttpHeaders().withStatus(500); } public void setId(String id) { // Nothing } public Object getModel() { return new String("{ \"message\": \"An error occurred.\"}"); } } Struts <?xml version="1.0" encoding="UTF-8" ?> <constant name="struts.convention.action.suffix" value="Controller"/> <constant name="struts.convention.action.mapAllMatches" value="true"/> <constant name="struts.convention.default.parent.package" value="rest-default"/> <constant name="struts.convention.package.locators" value="controller"/> Web <?xml version="1.0" encoding="UTF-8"?> Orders action2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter action2 /rest/* index.html AngularJS Test Harness var orderApp = angular.module('orderApp', []); orderApp.run(function($http) { $http.get("rest/orders/A.json"); $http.put("rest/orders/A.json", {"orderId":"A"} ); }); Environment: Struts2 (2.3.16.3), Rest-Plugin, Convention, Java7, Tomcat7, Maven
type: Question
has comment: http://stackoverflow.com/comment/41565689
score: 3
has comment: http://stackoverflow.com/comment/41565104
tagged with: java

http://stackoverflow.com/a/32485275
score: -1
has body: You need to set JAVA_HOME and PATH Variables , then it will work.
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/26492425

http://stackoverflow.com/a/26496315
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41626507
upvote count: 1
answers question: http://stackoverflow.com/q/26496034
has body: This method should do it. public int getNrPound(String[] arr) { int nrPound = 0; for (String string : arr) { if (string.equals("pound")) nrPound++; } return nrPound; } The answer is similar to previous ones but the for loop iterates through each element of the array instead of getting each element by index. The advantages are you do not need to know that an array in Java is zero based and it is shorter and easier to read. This coding style should make your code less error prone.
has comment: http://stackoverflow.com/comment/41641921
downvote count: 0

http://stackoverflow.com/comment/41503168
score: 0
type: Comment
has text: Joop Eggen did bring up something I missed. The HttpParams class has indeed been deprecated as of 4.3, if I'm reading this correctly. It says: _"use configuration classes provided 'org.apache.http.config' and 'org.apache.http.client.config'"._ You can read it for yourself [here](https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/params/HttpParams.html).
type: AnswerComment
comment on: http://stackoverflow.com/a/26429026

http://stackoverflow.com/comment/41551026
type: QuestionComment
score: 0
has text: I can't figure it out either. Strings are immutable anyway, so their internal state can not be changed.
comment on: http://stackoverflow.com/q/26455116
type: Comment

http://stackoverflow.com/q/26405606
has comment: http://stackoverflow.com/comment/41474541
tagged with: remote-connections
tagged with: java
tagged with: selenium
type: Question
has body: hi i am using selenium webdriver. i have to connect system and i phone for the testing when i connect its not opening the other system, i am using chrome 38 and ie 10 i am getting stuct, please provide me your answer. check the code if(browser.equalsIgnoreCase("Internet Explorer")){ caps = DesiredCapabilities.internetExplorer(); } if(browser.equalsIgnoreCase("chrome")){ //System.setProperty("webdriver.chrome.driver","/10.187.143.46/C:/chr/chromedriver.exe"); //driver=new RemoteWebDriver(new URL("http://10.187.143.46:6767/wd/hub"),caps); //ChromeDriver driver = new ChromeDriver(); // driver.get("http:\\www.google.com"); System.setProperty("webdriver.chrome.driver","\\10.187.143.46\\c$\\Users\\rr188182\\Desktop\\chromedriver.exe"); caps=DesiredCapabilities.chrome(); } //Version caps.setVersion(i); driver1=new RemoteWebDriver(new URL("http://10.187.143.89:6767/wd/hub"),caps); driver1.get("http://www.google.com"); driver2=new RemoteWebDriver(new URL("http://10.187.143.165:6767/wd/hub"),caps); driver2.get("http://www.google.com"); driver3=new RemoteWebDriver(new URL("http://10.187.143.25:6767/wd/hub"),caps); driver3.get("http://www.google.com"); driver4=new RemoteWebDriver(new URL("http://10.187.143.46:5555/wd/hub"),caps); driver4.get("http://www.google.com"); driver5=new RemoteWebDriver(new URL("http://10.187.143.163:6767/wd/hub"),caps); driver5.get("http://www.google.com"); public static void main(String[] args) throws MalformedURLException { GridConcept gr=new GridConcept(); //gr.setup("WINDOWS", "internet explorer", "11","http://www.google.com"); ... } if i provide ie and firefox the browser is opening but the next line is not excuting, if i use chrome it shows error as valid path. please provide your comments. Thanks in advance
score: 0
has title: selenium webdriver Grid
has comment: http://stackoverflow.com/comment/41566582
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41566704
has comment: http://stackoverflow.com/comment/41479184
tagged with: selenium-webdriver

http://stackoverflow.com/q/26421005
has comment: http://stackoverflow.com/comment/140019875
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26421050
upvote count: 4
has comment: http://stackoverflow.com/comment/41487953
tagged with: junit
downvote count: 0
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/1689242
has answer: http://stackoverflow.com/a/40226783
score: 4
has body: I am doing some Junit testing and I need to know how to run a Test class only if a specific test from another class was passed.
has answer: http://stackoverflow.com/a/26421188
tagged with: java
answer count: 3
tagged with: testing
has title: How can I run a test class only if another test was passed?
tagged with: test-suite

http://stackoverflow.com/a/26378323
score: 0
answers question: http://stackoverflow.com/q/26377954
has body: \\s+ or \\s* missing code: final String pattern = "\\[\\s*mytag\\s+attr1\\s*=\\s*\"(.*?)\"\\s+attr2\\s*=\\s*\"(.*?)\"\\s+attr3\\s*=\\s*\"(.*?)\"\\s*\\](.+?)\\[/mytag\\]"; final String input = "[mytag attr1=\"20258044753052856\" attr2=\"A security \" attr3=\"cvvc\" ]TagTitle[/mytag]"; final Pattern p = Pattern.compile( pattern ); final Matcher m = p.matcher( input ); if( m.matches()) { System.out.println( m.group(1) + '\t' + m.group(2) + '\t' + m.group(3) + '\t' + m.group(4)); } outpout: 20258044753052856 A security cvvc TagTitle
type: Answer

http://stackoverflow.com/a/26448726
type: Answer
has comment: http://stackoverflow.com/comment/58283917
downvote count: 0
has body: If you are using Java 8 you can use streams : long count = Files.lines(Paths.get(filename)).count(); This will have good performances and is really expressive. The downside (compared to Thusitha Thilina Dayaratn answer) is that you only have the line count. If you also want to have the lines in a List, you can do (still using Java 8 streams) : // First, read the lines List&lt;String&gt; lines = Files.lines(Paths.get(filename)).collect(Collectors.toList()); // Then get the line count long count = lines.size();
score: 7
has comment: http://stackoverflow.com/comment/76259110
has comment: http://stackoverflow.com/comment/58273925
answers question: http://stackoverflow.com/q/26448352
has comment: http://stackoverflow.com/comment/76489652
upvote count: 7

http://stackoverflow.com/comment/41499441
has text: Compiler complains because local variables should be declared and initialized at the same time but you have just declared it.
type: AnswerComment
comment on: http://stackoverflow.com/a/26426650
score: 0
type: Comment

http://stackoverflow.com/q/26404283
has body: I have a Java Hibernate project configuration which worked with SQL Server 2008 R2, now with a new OS 8.1 (from 7) and SQL Server 2012 (express), I'm unable to connect to SQL server. Relevant configuration which is/should be syntactically correct since it worked with 2008 R2: datasource.properties jdbc.driverClassName=net.sourceforge.jtds.jdbc.Driver jdbc.url=jdbc:jtds:sqlserver://localhost:1433/dbname;instance=SQLEXPRESS jdbc.username=auser jdbc.password=xyz I've tried two dialects org.hibernate.dialect.SQLServerDialect worked in 2008 R2. hibernate.hbm2ddl.auto=create-drop hibernate.dialect=org.hibernate.dialect.SQLServerDialect #hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect hibernate.show_sql=true springConfiguration.xml &lt;bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp2.BasicDataSource"&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}" /&gt; &lt;property name="url" value="${jdbc.url}" /&gt; &lt;property name="username" value="${jdbc.username}" /&gt; &lt;property name="password" value="${jdbc.password}" /&gt; &lt;/bean&gt; SQL Server 2012 was installed with mixed mode authentication and SQL Server Management Studio has no problem connecting (with or without the instance name). I've updated the SQL Server Network Configuration for SQLEXPRESS. Protocols for SQLEXPRESS: TCP/IP Enabled As well as all of the TCP/IP Properties - TCP Port's to 1433. I've tried disabling Windows Firewall just to test if it's in the way but it results in the same error. I ended up adding Firewall rules and following some of the steps in this excellent configure SQL Express 2012 to accept remote connections article. The error message: Caused by: java.lang.AbstractMethodError at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
linked to: http://stackoverflow.com/q/3585544
has answer: http://stackoverflow.com/a/27847317
answer count: 2
downvote count: 0
favorite count: 0
has title: Java Hibernate with SQL Server 2012 not working?
tagged with: sql-server
possible better answer: http://stackoverflow.com/a/26404284
has answer: http://stackoverflow.com/a/26404284
accepted answer: http://stackoverflow.com/a/27847317
tagged with: sql-server-2012
type: AnsweredQuestion
upvote count: 7
type: Question
score: 7
tagged with: java
tagged with: hibernate
tagged with: jtds

http://stackoverflow.com/q/26465310
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I am working on ASM framework for some time, where i successfully edited a .class file. I am in a situation where I need to replace a method call with another method call. I have achieved this by overriding super.visitMethodInsn() Am posting the coding here: Unmodified class: UserSampleClass.java package checking; public class UserSampleClass { public static void main(String[] args) { UserSampleClass usc= new UserSampleClass(); usc.display(); } public String display() { System.out.println("Hello Method: "+hello()); System.out.println("Bye Method: "+bye()); System.out.println("Hello Method: "+hello()); return "i'm display"; } private String bye() { return "Bye"; } private String hello() { return "Hello"; } } The output of the above program will be: Hello Method: Hello Bye Method: Bye Hello Method: Hello Now I have modified the original class file and changed the the three method calls (i.e., hello(), bye(), hello()) to other 3 method calls as mentioned below: to replace first hello method: replaceFirstHelloInvoke.java. package chekingDepend; public class replaceFirstHelloInvoke { public replaceFirstHelloInvoke() {} public static String replaceFirstHello() { return "one"; } } to replace the bye method: replaceByeInvoke.java package chekingDepend; public class replaceByeInvoke { public replaceByeInvoke() {} public static String replaceBye() { return "two"; } } to replace second hello: replaceSecondHelloInvoke.java package chekingDepend; public class replaceSecondHelloInvoke { public replaceSecondHelloInvoke() {} public static String replaceSecondHello() { return "three"; } } I have created all these methods as static because they can be directly referred through class name. I am able to successfully generate the modified class through ASM. Now the problem is that The modified class is not running. When I tried to run it am getting this error: Exception in thread "main" java.lang.VerifyError: (class: checking/UserSampleClass, method: display signature: ()Ljava/lang/Stri…
type: Question
tagged with: bytecode
has answer: http://stackoverflow.com/a/26465590
answer count: 1
downvote count: 0
has title: java.lang.VerifyError while running modified .class file
favorite count: 0
accepted answer: http://stackoverflow.com/a/26465590

http://stackoverflow.com/q/26377961
favorite count: 0
accepted answer: http://stackoverflow.com/a/26378291
has title: How to sort twitter tweets with java
has body: I have this code: for (Status tweet : tweets) { y++; users.add(new twitterTweets(tweet.getUser().getScreenName(), tweet.getText(), tweet.getCreatedAt())); System.out.println(y + ": - " + "@" + tweet.getUser().getScreenName() + " - " + tweet.getText() + " - " + tweet.getCreatedAt()); i++; } Collections.sort(users, String.CASE_INSENSITIVE_ORDER); int a= 0; for(String temp : users) { a++; System.out.println(temp); } I want to print out tweets, which are sorted by date (ascending, descending order and the sort is CASE_INSENSITIVE) and I also want to print out tweets sorted by screenname and text. I know that I can use Collections.sort, but this does not solve my problem, because when I add screennames in an ArrayList, I can only sort screennames and when I want to print out the tweets sorted by screenname, it will give me wrong answer, because the rest of the tweet (text and date) are not sorted with screenname. How do I sort tweets by ScreenName Date and Text (both ascending and descending) and print out sorted tweets with correct author, date and text is basically what I am asking?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26378291
possible better answer: http://stackoverflow.com/a/26494413
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41413065
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41411272
tagged with: twitter
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26494413

http://stackoverflow.com/q/26469408
has comment: http://stackoverflow.com/comment/41576387
has comment: http://stackoverflow.com/comment/41576444
tagged with: final
tagged with: java
linked to: http://stackoverflow.com/q/154314
has title: Why is the final keyword used profusely inside of methods even though it's completely fine to not define them final
type: Question
duplicate of: http://stackoverflow.com/q/154314
has comment: http://stackoverflow.com/comment/41576538
has comment: http://stackoverflow.com/comment/41576798
possible better answer: http://stackoverflow.com/a/26469481
has answer: http://stackoverflow.com/a/26469481
linked to: http://stackoverflow.com/q/1299837
has answer: http://stackoverflow.com/a/26469471
score: 0
has comment: http://stackoverflow.com/comment/41579027
answer count: 2
has comment: http://stackoverflow.com/comment/41576490
has body: I asked a collegue why he used final keyword for the assignment in this method and his response was, "Why not?". I don't see the benefit of putting final here. Or often times, I see it in class definitions as well. protected void sendIndexWorkflowRequest(Status status) { final long contextId = status.getAppContextId(); PrepareIndexPostData preparePostData = new PrepareIndexPostData.Builder(contextId).build(); searchIndexService.activateAggsIndex(preparePostData); }
has comment: http://stackoverflow.com/comment/41578946
has comment: http://stackoverflow.com/comment/41576583
accepted answer: http://stackoverflow.com/a/26469471
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41576488

http://stackoverflow.com/q/26401426
tagged with: java
has comment: http://stackoverflow.com/comment/41452707
type: Question
tagged with: jsp
downvote count: 5
has comment: http://stackoverflow.com/comment/41471836
linked to: http://stackoverflow.com/q/9799879
upvote count: 0
score: -5
answer count: 1
tagged with: user-interface
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41452679
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26401554
has body: I have a Java code and now I want to convert it into JSP. But I am facing problems and don't know how to use String methods in JSP function. I have a below Java code: public void rapidToStandard() { boolean flag = false; enteredPath = tbProjectName.getText(); final char[] chars=enteredPath.toCharArray(); for(int i = 0; i &lt; chars.length; i++) { if(chars[i] == '\\') { flag = true ; } else { tbProjectName.requestFocus(); } } if(flag == true) { JOptionPane.showMessageDialog(null, "Please enter single forward(/) slash", "Error",JOptionPane.ERROR_MESSAGE); tbProjectName.requestFocus(); } else if (tbProjectName.getText().equals("C:/Utility")) { JOptionPane.showMessageDialog(null, "Please enter another folder name", "Error" , JOptionPane.ERROR_MESSAGE); tbProjectName.requestFocus(); } }
has title: How to use String methods in JSP function?

http://stackoverflow.com/comment/41517938
comment on: http://stackoverflow.com/q/26436206
has text: Post the full stack trace of the exception. ALWAYS do when asking about an exception.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26393830
downvote count: 0
has comment: http://stackoverflow.com/comment/41440779
type: Answer
has comment: http://stackoverflow.com/comment/41440267
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41440174
accepted answer of: http://stackoverflow.com/q/26393792
has comment: http://stackoverflow.com/comment/41440269
has comment: http://stackoverflow.com/comment/41440094
answers question: http://stackoverflow.com/q/26393792
has comment: http://stackoverflow.com/comment/41442192
has comment: http://stackoverflow.com/comment/41440132
has comment: http://stackoverflow.com/comment/41440085
has comment: http://stackoverflow.com/comment/41440143
has comment: http://stackoverflow.com/comment/41440316
has comment: http://stackoverflow.com/comment/41440189
has comment: http://stackoverflow.com/comment/41440428
has comment: http://stackoverflow.com/comment/41440285
has body: Consider the 1-9, 10-29 and 30-31 cases separately like this. [1-9]|[12][0-9]|3[01]
type: AcceptedAnswer

http://stackoverflow.com/a/26394439
type: Answer
score: 2
has body: You need to initialize j: Set&lt;String&gt; j = new HashSet&lt;String&gt;(); Also, instead of what you're doing now, do this: for loop { if (case1) { j.add(val); if (!j.isEmpty()) { return false; } else { continue; } } } Just for clarity.
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26394390

http://stackoverflow.com/q/26500800
has body: It's been a while, that I did bit manipulations and I'm not sure if this can be done in a more effective way. What I want is to get bits of a specific range from a value. Let's say the binary of the value is: 0b1101101 Now I want to get a 4-bit range from the 2nd to the 5th bit of this value in it's two's complement. The range I wanna get: 0b1011 Value in Two's complement: -5 This is the code I have, with some thoughts what I'm doing: public int bitRange(int value, int from, int to) { // cut the least significant bits value = value &gt;&gt; from; // create the mask int mask = 0; for (int i = from; i &lt;= to; i++) { mask = (mask &lt;&lt; 1) + 1; } // extract the bits value = value &amp; mask; // needed to check the MSB of the range int msb = 1 &lt;&lt; (to - from); // if MSB is 1, XOR and inverse it if ((value &amp; msb) == msb ) { value = value ^ mask; value = ~value; } return value; } Now I would like to know if this can be done more effective? Especially the creation of the dynamic mask and the check of the MSB of the range, to be able to convert the bit range. Another point is, as user3344003 pointed out correctly, if the range would be 1 bit, the output would be -1. I'm sure there is a possible improvement.
accepted answer: http://stackoverflow.com/a/26501040
has title: Get bits of a given range more effective?
has comment: http://stackoverflow.com/comment/41633717
linked to: http://stackoverflow.com/q/2811319
has answer: http://stackoverflow.com/a/26501040
tagged with: bit-manipulation
has comment: http://stackoverflow.com/comment/41633699
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26500900
tagged with: twos-complement
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26532024
type: Question
upvote count: 1
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26500900
answer count: 3

http://stackoverflow.com/q/26369819
has answer: http://stackoverflow.com/a/33049790
has title: Unknown column in 'field list' MySQLSyntaxErrorException
answer count: 2
downvote count: 0
favorite count: 0
tagged with: jdbc
has body: I am trying to populate a remote database but I am currently getting this error and I'm not sure how to fix this. The error refers to the first value I am trying to put into my table. I handled the events where no eventID would not be passed into the eventID table. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0654fac7' in 'field list' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) This is my code: protected void loadToDatabase() { String dbURL = "jdbc:mysql://remotehost/database"; String usr = "username"; String password = ""; try { Connection Conn = DriverManager.getConnection(dbURL, usr, password); Statement stmt = Conn.createStatement(); for (String i : eventIDs) { String sql = "INSERT INTO eventID VALUES (" + i + ");"; stmt.executeUpdate(sql); } System.out.println("Insert complete"); } catch (Exception e ) { e.printStackTrace(); } } This is the data I am trying to pass into the database: Test Case 0: 0654fac7-7aa8-4c55-bdaf-77b39692aa3f-1413318357238 Test Case 1: f9914577-c60d-49ae-bec6-4db0463676fd-1413318358598 Test Case 2: 6f1b6e4e-9d51-411b-8248-2cd9e1ef2712-1413318360005 Test Case 3: 330860b3-f22b-4b84-9837-bb949c2659ca-1413318361411 Test Case 4: no eventID Test Case 5: e09f77f3-d816-49ab-90cd-4df56d8c8ef2-1413318366577 Test Case 6: f580e84e-7a3d-4693-bbea-454c5d699070-1413318367992 Test Case 7: no eventID My database simply consists of one column. mysql&gt; show tables in eventID; +-------------------+ | Tables_in_eventID | +-------------------+ | eventID | +-------------------+
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26370091
upvote count: 2
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/26370091
type: Question
possible better answer: http://stackoverflow.com/a/33049790

http://stackoverflow.com/a/26490669
has comment: http://stackoverflow.com/comment/41620596
has comment: http://stackoverflow.com/comment/41687842
has comment: http://stackoverflow.com/comment/41689661
has comment: http://stackoverflow.com/comment/41687958
type: Answer
has comment: http://stackoverflow.com/comment/41687537
has comment: http://stackoverflow.com/comment/41638022
score: 0
has comment: http://stackoverflow.com/comment/41687734
has body: http://www.tutorialspoint.com/log4j/log4j_sample_program.htm - Download the jar from here: https://logging.apache.org/log4j/1.2/download.html Add this file in your path: log4j.properties # Define the root logger with appender file log = /usr/home/log4j log4j.rootLogger = DEBUG, FILE # Define the file appender log4j.appender.FILE=org.apache.log4j.FileAppender # Here is the location output of the file! log4j.appender.FILE.File=${log}/log.out # Define the layout for file appender log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.conversionPattern=%m%n Then run this: log4jExample.java import org.apache.log4j.Logger; import java.io.*; import java.sql.SQLException; import java.util.*; public class log4jExample{ /* Get actual class name to be printed on */ static Logger log = Logger.getLogger( log4jExample.class.getName()); public static void main(String[] args) throws IOException,SQLException{ log.debug("Hello this is an debug message"); log.info("Hello this is an info message"); } }
answers question: http://stackoverflow.com/q/26490156

http://stackoverflow.com/a/26479374
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41595080
has body: You're shadowing you variables... You declare statesComboBox as an instance field in your class... private JComboBox statesComboBox; But when you initalise it within your constructor, you declare it as a local variable... JComboBox statesComboBox = new JComboBox(statesStrings); This means you ActionListener is trying to use a null references (the instance field)
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26479333
answers question: http://stackoverflow.com/q/26479333
has comment: http://stackoverflow.com/comment/41595100
has comment: http://stackoverflow.com/comment/41595063
type: Answer
has comment: http://stackoverflow.com/comment/41595143
has comment: http://stackoverflow.com/comment/41595129

http://stackoverflow.com/comment/41417051
comment on: http://stackoverflow.com/q/26380886
type: QuestionComment
type: Comment
has text: Your `users-by-username-query` is wrong, it must return 3 columns (username, password, enabled). Next to that you also have no security. Your `/**` is the first in your list of secured urls, which matches everything. The order of your `intercept-url` elements is important, the first one that matches is the one that gets applied. The order of consulting is the order in which they are defined.
score: 2

http://stackoverflow.com/comment/41584360
type: Comment
type: QuestionComment
has text: I don't think that this approach will be successful: The _script with sudo rights_ will launch gradle with sudo rights and any 'sub-command' might (I am not 100% sure) run with this privileges. So all of your files in the output folder are owned by root. This will lead to a pretty privilege mess in your working directory. If you don't care about this, give it a try ;)
comment on: http://stackoverflow.com/q/26467754
score: 0

http://stackoverflow.com/a/26419244
answers question: http://stackoverflow.com/q/26418920
has body: Try this one System.out.println("Please enter a number: "); Scanner userInput = new Scanner(System.in); while(!userInput.hasNextInt()) { System.out.println("Invalid input. Please enter again"); userInput = new Scanner(System.in); } System.out.println("Input is correct : " + userInput.nextInt());
type: Answer
score: 0

http://stackoverflow.com/q/26373809
has comment: http://stackoverflow.com/comment/41404047
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/41404242
tagged with: code-duplication
tagged with: swing
has comment: http://stackoverflow.com/comment/41404157
tagged with: model-view-controller
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41404103
has comment: http://stackoverflow.com/comment/41404363
linked to: http://stackoverflow.com/q/25502552
tagged with: java
has comment: http://stackoverflow.com/comment/41404168
has answer: http://stackoverflow.com/a/26683627
type: Question
has comment: http://stackoverflow.com/comment/41404144
answer count: 1
score: 0
has body: So, I have a Java application that uses Swing for building the GUI and implements the MVC design pattern, and because of that I am ending up with a lot of instances of SwingWorker being used in the view to make calls to the controller and a lot of calls to EventQueue.invokeLater() from the controller to the view. This seemed like the way to go because of the single-threaded nature of Swing and MVC best practices, but now I have code that duplicates the following pattern many, many times: public class MainController{ private final View someView; public void someMethod(Object data){ // Do stuff with the data; maybe change the model. EventQueue.invokeLater( new Runnable(){ @Override public void run() { someView.updateView(Object someObject); //This is the code that I actually need to execute } }); } } public class View extends JPanel{ // or whatever private final MainController controller; public class someListener implements ActionListener{ public void actionPerformed(ActionEvent e) { new SwingWorker&lt;Void,Void&gt;(){ public Void doInBackground(){ controller.someMethod(object); // This is the code I actually want to execute return null; } }.execute(); } } } I am aware that I can write a method that passes a runnable to a call to EventQueue.invokeLater(), but I would still have to duplicate all the code for implementing a runnable. Most of the pieces of code that I actually need to run, do not have much in common besides the fact that they need to run on the EDT or in a SwingWorker, so extending SwingWorker or implementing Runnable is not going to help. My question is, how do I avoid all this duplication? Is the problem with the design? Or is there a way to make my method calls without all this overhead code?
has comment: http://stackoverflow.com/comment/41404062
has title: Avoiding code duplication with multiple calls to EventQueue.invokeLater()
accepted answer: http://stackoverflow.com/a/26683627

http://stackoverflow.com/a/26380034
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26375629
downvote count: 1
score: -1
has body: It seems Spring Roo is what I need.
upvote count: 0
answers question: http://stackoverflow.com/q/26375629

http://stackoverflow.com/comment/41423540
type: Comment
comment on: http://stackoverflow.com/a/26384687
score: 0
type: AnswerComment
has text: `final` in java is the same as `const` in C++? Does it mean that I cannot change the values of `parameters` argument?

http://stackoverflow.com/comment/41501189
score: 2
comment on: http://stackoverflow.com/q/26427805
type: Comment
type: QuestionComment
has text: Easy, I am writing the code for u. hold a couple of minutes

http://stackoverflow.com/q/26490567
accepted answer: http://stackoverflow.com/a/26490726
type: Question
has comment: http://stackoverflow.com/comment/41615223
has comment: http://stackoverflow.com/comment/41615369
has comment: http://stackoverflow.com/comment/41615502
tagged with: java
has comment: http://stackoverflow.com/comment/41615305
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41615267
has comment: http://stackoverflow.com/comment/41615154
has comment: http://stackoverflow.com/comment/41615572
has comment: http://stackoverflow.com/comment/41615701
has title: syncronized block doens't block different objects
possible better answer: http://stackoverflow.com/a/26490662
has answer: http://stackoverflow.com/a/26490726
has comment: http://stackoverflow.com/comment/41615100
has answer: http://stackoverflow.com/a/26490662
has body: i inserted in an hashMap (for each row) this: rows.put(currentRow, new Object()); .... and after some threads will call this function: @Override public void run() { while (true) { increaseRow(new Random().nextInt(10)); try { sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void increaseRow(Integer row) { synchronized (rows.get(row)) { for (int j = 0; j &lt; column; j++) { matrix[row][j] += 1; } System.out.println("begin print"); for (int i = 0; i &lt; this.row; i++) { System.out.println(); for (int j = 0; j &lt; column; j++) System.out.print(matrix[i][j]); } System.out.println(); System.out.println("end print"); } } if i start 1 thread, it works ok, but there are some problems with more threads, like: begin print 00000 begin print 00 0000000000000000 00 000000000000000000000 00000000000 00000000000000 00000000000 00 000000000000 111111111111 000000000000 111000000000000 000000000000 111111111111 000000000000 111111111111 000000000000 0000000100000 end print the map as only 10 key-value , i' m syncronizing on the object value, so i don't understand what's wrong. thanks in advance.
has comment: http://stackoverflow.com/comment/41615052
has comment: http://stackoverflow.com/comment/41615095
type: AnsweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/41461707
comment on: http://stackoverflow.com/a/26406505
type: AnswerComment
score: 0
type: Comment
has text: also, I edited the orig post, the problem only exists if I entered a string with space on it on String "name"

http://stackoverflow.com/comment/41637031
comment on: http://stackoverflow.com/a/26502543
type: AnswerComment
score: 0
type: Comment
has text: Sorry, almost 4am here, must've not seen it. Sadly it's still blank. [http://i.imgur.com/adauoFE.png](http://i.imgur.com/adauoFE.png)

http://stackoverflow.com/a/26617666
has body: 1) You cannot avoid the use of "%" based placeholders in Formatter. So Formatter/Formattable is not the solution. 2) If you need an method, replacing the {} placeholders with parameter values, it is easy to implement yourself. public static String insertPlaceholders(String template, Object... args) { if (args.length == 0) { return template; } // best guess for capacity final StringBuilder sb = new StringBuilder(template.length() + args.length * 8); int index = 0; int offset = 0; while (index &lt; args.length) { final int p = template.indexOf("{}", offset); if (p &lt; 0) { break; } sb.append(template, offset, p); sb.append(args[index]); offset = p + 2; ++index; } sb.append(template, offset, template.length()); return sb.toString(); } Unit test: @Test public void testInsertPlaceholders() { assertSame("Test", StringUtils.insertPlaceholders("Test")); assertEquals("Test", StringUtils.insertPlaceholders("Test", 1)); assertEquals("Test 2", StringUtils.insertPlaceholders("Test {}", 2)); assertEquals("Test 3 {}", StringUtils.insertPlaceholders("Test {} {}", 3)); assertEquals("Hello World!", StringUtils.insertPlaceholders("Hello {}!", "World")); }
answers question: http://stackoverflow.com/q/26398981
type: Answer
score: 0

http://stackoverflow.com/a/26444434
score: 1
has body: You start with 0 5 0 9 0 5 0 3 1 9 4 6 7 0 0 9 You start traversing from the top left and simultaneously modifying the matrix. So after 2 rows have been modified, the intermediate matrix is 0 2 0 1 0 3 1 2 1 9 4 6 7 0 0 9 Now take into consideration the element at index [2][1]. In the original matrix, it had 3 zero neighbors, but this matrix only has 2, hence the difference in expected and obtained output. Make a separate matrix to store the modified values.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26444049
type: Answer
accepted answer of: http://stackoverflow.com/q/26444049
downvote count: 0

http://stackoverflow.com/a/26491210
has body: The MediaMuxer class will throw "unable to stop" exceptions if you have started it, but haven't yet fed it any data. This doesn't make much sense, but that's how it works. The root problem is that there's no data going in, which is usually due to the issue you identified (a quirk of SurfaceTexture described in some detail in this answer). You need to make sure that the thread doing the work doesn't have a Looper. You may be better off using Grafika as sample code. Activities like "continuous capture" demonstrate the camera-to-MPEG path in an app environment, rather than a CTS test environment.
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26487832
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/26487832
has comment: http://stackoverflow.com/comment/41710938

http://stackoverflow.com/q/26504185
has body: I want to create a query with MyBatis, which will produce something like: SELECT first_field, second_filed, third_field WHERE first_field &gt; 1 AND (second_field &gt; 0 OR third_field &lt; 0) How could I construct that with Criteria objects?
downvote count: 0
has title: MyBatis "or" criteria
tagged with: mybatis
favorite count: 0
possible better answer: http://stackoverflow.com/a/33571972
upvote count: 10
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26506347
type: Question
has answer: http://stackoverflow.com/a/33571972
score: 10
has answer: http://stackoverflow.com/a/26508181
answer count: 3
accepted answer: http://stackoverflow.com/a/26508181

http://stackoverflow.com/a/26461595
has body: The way you implemented it now, t1 and t2 will run sequentially and not parallel. Whichever one starts first, claims the lock, performs his entire loop, terminates and releases the lock for the other. The good thing is: there is no race condition. The bad thing is: there is no parallelism. In general, it's a bad idea to work directly with locks if you can avoid it. Java contains a load of collections specifically for concurrent use. See Java Concurrency Utils
answers question: http://stackoverflow.com/q/26461428
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41531229
type: AnswerComment
comment on: http://stackoverflow.com/a/26443954
score: 0
type: Comment
has text: I updated my original code if that helps you figure out what I am talking about.

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26455578
tags question: http://stackoverflow.com/q/26424030
tags question: http://stackoverflow.com/q/26451482
tags question: http://stackoverflow.com/q/26425400
tags question: http://stackoverflow.com/q/26474545
tags question: http://stackoverflow.com/q/26450712
tags question: http://stackoverflow.com/q/26432162
tags question: http://stackoverflow.com/q/26418325
tags question: http://stackoverflow.com/q/26479432
tags question: http://stackoverflow.com/q/26481306
tags question: http://stackoverflow.com/q/26457435
tags question: http://stackoverflow.com/q/26429672
tags question: http://stackoverflow.com/q/26505170
tags question: http://stackoverflow.com/q/26419059
tags question: http://stackoverflow.com/q/26502636
tags question: http://stackoverflow.com/q/26447450
tags question: http://stackoverflow.com/q/26486889
tags question: http://stackoverflow.com/q/26466637
tags question: http://stackoverflow.com/q/26481796
tags question: http://stackoverflow.com/q/26397959
type: Tag
tags question: http://stackoverflow.com/q/26365733
tags question: http://stackoverflow.com/q/26507130
tags question: http://stackoverflow.com/q/26483230
tags question: http://stackoverflow.com/q/26363585

http://stackoverflow.com/comment/41476323
comment on: http://stackoverflow.com/q/26414203
has text: Well what is `members`? You haven't declared it anywhere in the code you've provided... what do you expect it to be? And what is `Member`? You can't just start using variables without declaring them anywhere...
score: 5
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41641258
type: Comment
has text: The worst thing about the implementation, of course, is that it won't even compile (missing closing parenthesis).
type: QuestionComment
comment on: http://stackoverflow.com/q/26504803
score: 0

http://stackoverflow.com/a/26480928
downvote count: 0
answers question: http://stackoverflow.com/q/26480850
upvote count: 2
has body: There is no need of calling setSize() method if you are using proper layout manger and calling pack(). If you really need absolute size then override JComponent#getPreferredSize() method of JPanel. Read more Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing? Call setVisible() method in the end after adding all the component. Don't directly add components in top level container. Use other container such as JPanel then finally add it in JFrame. The order of calling setDefaultCloseOperation() method doesn't matter.
type: Answer
score: 2

http://stackoverflow.com/a/26487623
has body: apply the following code on your htmlEditor htmlEditor.lookup(".top-toolbar").setManaged(false); htmlEditor.lookup(".top-toolbar").setVisible(false); htmlEditor.lookup(".bottom-toolbar").setManaged(false); htmlEditor.lookup(".bottom-toolbar").setVisible(false);
upvote count: 8
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26446808
answers question: http://stackoverflow.com/q/26446808
type: Answer
score: 8
downvote count: 0

http://stackoverflow.com/q/26483322
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26483349
has answer: http://stackoverflow.com/a/26483500
has answer: http://stackoverflow.com/a/60652877
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/26483584
has body: Is there any function to convert 1.1760481E7 double value to String value. I tried Double.toString(value). I am getting above format. But I need 11760481 in this format.
has comment: http://stackoverflow.com/comment/41602055
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26483349
favorite count: 0
type: Question
has title: how to convert 1.1760481E7 to 11760481 in java
possible better answer: http://stackoverflow.com/a/26483500

http://stackoverflow.com/comment/41488941
comment on: http://stackoverflow.com/a/26421413
type: AnswerComment
score: 0
has text: Thanks, do you mean ReflectionTestUtils from the Spring framework?
type: Comment

http://stackoverflow.com/q/26409390
has answer: http://stackoverflow.com/a/26410439
has body: I am trying to create a Runnable Jar file for my java project. I am using Eclipse Kepler to do so but after creating the jar file i am getting some warning message from the Eclipse. I tried to find the answer on google but got nothing. I am not able to copy paste the error message which i received from the eclipse so i am attaching the screen shot of it. But i am able to use that jar file without any warning.
favorite count: 0
has title: Getting warning message when trying to create a runnable jar file using eclipse
upvote count: 1
has comment: http://stackoverflow.com/comment/41467251
has comment: http://stackoverflow.com/comment/41467252
downvote count: 1
has comment: http://stackoverflow.com/comment/41467296
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41467281
tagged with: java
accepted answer: http://stackoverflow.com/a/26410439
has comment: http://stackoverflow.com/comment/41467335
tagged with: eclipse
type: Question
answer count: 1
tagged with: jar
score: 0
tagged with: runnable

http://stackoverflow.com/comment/41511877
comment on: http://stackoverflow.com/q/26433338
has text: I have added my delete methods, one for delete any and another if it is the first in the list.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41642518
type: QuestionComment
score: 0
has text: change this properties value : android:stretchMode="none"
type: Comment
comment on: http://stackoverflow.com/q/26505765

http://stackoverflow.com/a/26494412
type: Answer
answers question: http://stackoverflow.com/q/26494167
has comment: http://stackoverflow.com/comment/41622882
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41622680
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41626072
has body: You are getting a ClassNotFoundException, looks like you did not copy your h2 jar correctly.. Make sure you place it in your lib folder of your war..
accepted answer of: http://stackoverflow.com/q/26494167

http://stackoverflow.com/comment/41571038
type: Comment
comment on: http://stackoverflow.com/a/26465590
has text: That confirms what I thought / said in my Answer. You are replacing a calls to private instance methods with calls to public static methods.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26421053
type: AnsweredQuestion
tagged with: java
tagged with: cyrillic
type: Question
accepted answer: http://stackoverflow.com/a/26421842
has body: I have a feedback page on my site that contains name, email and comments. Here is my code on JSP and I'm using Apache Tomcat 7.0 and Oracle DB String query = "Insert into t_comments(name, email, comments) values('" + realname + "','" + email + "','" + comments+"')"; This works great. But I decided to add DATEC column (data type DATE) to my table t_comments. So my query should look like String query = "Insert into t_comments(name, email, comments,datec) values('" + realname + "','" + email + "','" + comments + "'," + "TO_DATE('" + new java.util.Date() + "', 'dd/mm/yyyy hh24:mi:ss'))"; And this doesn't work. ORA-01858: a non-numeric character was found where a numeric was expected Maybe I insert wrongly type DATE into my table. Also I have another problem. The name and comments are in Cyrillic. And when they inserted in table, they are displayed incorrect with different encoding. I have this lines in my JSP page &lt;%@ page language='java' contentType='text/html; charset=UTF-8' pageEncoding='UTF-8'%&gt; So help me please solve my two problems insert DATE to my table insert Cyrillic words correct to my table Thanks
tagged with: jsp
tagged with: date
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26421398
possible better answer: http://stackoverflow.com/a/26421291
has answer: http://stackoverflow.com/a/26421291
has answer: http://stackoverflow.com/a/26421842
tagged with: oracle-database
has title: How to insert DATE using jsp

http://stackoverflow.com/comment/53641556
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26379698
type: AnswerComment
has text: What is the link with the "Pid process on Windows"?

http://stackoverflow.com/q/26510039
upvote count: 1
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41650884
has body: public class ReadConfig { private File configFile; public boolean testConfig(){ if(Utils.isWindows()){ File configFile = new File("C:/config.properties"); } else{ File configFile = new File("/config.properties"); } if(configFile.exists() &amp;&amp; !configFile.isDirectory()){ System.out.println(configFile + "found!"); return true; } else{ try { configFile.createNewFile(); System.out.println(configFile + "created!"); } catch (IOException e) { e.printStackTrace(); } return true; } } } This gives back a null point exception at the following line if(configFile.exists() &amp;&amp; !configFile.isDirectory()){ It seems to me that it should return false, why would it throw a NullPointerException?
has comment: http://stackoverflow.com/comment/41650852
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26510478
favorite count: 0
tagged with: nullpointerexception
type: Question
has comment: http://stackoverflow.com/comment/41650568
score: 1
has comment: http://stackoverflow.com/comment/41650956
has title: Testing if file exists but get nullpointexception
accepted answer: http://stackoverflow.com/a/26510478

http://stackoverflow.com/comment/41655383
type: AnswerComment
has text: And if you rename `repeatCheck` to `randomCheck` what happen?
type: Comment
comment on: http://stackoverflow.com/a/26510948
score: 0

http://stackoverflow.com/a/26391241
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26390911
score: 1
has comment: http://stackoverflow.com/comment/41437397
has body: Integer.compareTo throws a NullPointerException if you pass null into it. Given your code, it looks like root.getItem() returned null. "Unknown Source" in the stack trace means that information about the source code was not available. In any case you can be pretty sure the problem is not in the Integer standard class, so you should look at the first trace entry coming from your code. That would be AVLTree.java at line 110.
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26390911

http://stackoverflow.com/a/58138871
has body: If you use Java 10 or higher, you can use the following code: public static boolean luhn(String s) { IntUnaryOperator sumDigits = n -&gt; n / 10 + n % 10; var digits = s.chars() .map(Character::getNumericValue) .toArray(); return IntStream.rangeClosed(1, digits.length) .map(i -&gt; digits.length - i) .map(i -&gt; i % 2 == 0 ? digits[i] : sumDigits.applyAsInt(digits[i] * 2)) .sum() % 10 == 0; } It's the functional approach to this algorithm.
answers question: http://stackoverflow.com/q/26383926
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/26495125
tagged with: aop
possible better answer: http://stackoverflow.com/a/26518719
tagged with: aspectj
answer count: 2
has comment: http://stackoverflow.com/comment/41628267
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41626100
has answer: http://stackoverflow.com/a/26523832
accepted answer: http://stackoverflow.com/a/26523832
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26518719
has title: AspectJ - Child Classes Getting Lost
has body: I'm sure this amounts to Newbie question for AspectJ but reviewing books and web sites, I'm not seeing the answer in terms I recognize. Summary: In my Client Jar, I am getting compilation errors complaining that methods that were added as a part of "Aspect B" are not present. I have a setup similar to : +---------------------+ | | | Client Jar | | | +--+---------------+--+ | | | | +----------+----+ +-------v-------+ | JSON Serial / | | Other Aspect | | Deser Aspect | +---------------+ +-------------+-+ +-------v-------+ | | Potential | | | Other Jar | | +---------------+ | +----v-----------+ | Javabean | | Aspects | +----------------+ +----v-----------+ | Basic Data | | Objects | +----------------+ Essentially, I have two levels of aspects where behaviors are being extended in each layer. Assume the following class in "Basic Data Objects": BasicDataObjects SampleObject public class SampleObject { private String name; private int age; } and the following aspect in JavaBean Aspects: privileged aspect SampleObject_JavaBean { public String SampleObject.getName() { return this.name; } } And the following aspect in JSON Aspects: privileged aspect SampleObject_Json { public String SampleObject.getNameValue() { return this.name == null ? null : this.name.serialize(); } } Finally, in the actual client jar, I am getting the following as a compilation error: public void someMethod (SampleObject obj) { obj.getNameValue() // <-- This has a compilation error that the getNameValue() is unresolvable. } In my Client Jar, I am getting compilation errors that methods that were added as a part of "Aspect B" are not available. My expectation was that the "Aspect A" generated jar file should have all its own classes compiled as well as all the classes that were provided as a part of "Aspect B". Aspect B pom: aspect-b org.aspectj aspectjrt ${aspectj.version} com.example lib-data-objects 0.0.1-SNAPSHOT org.codehaus.mojo aspectj-maven-plugin 1.7 compile test-compile true ${java.version} ${j…
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41629792

http://stackoverflow.com/q/26379967
has body: I had an android application call Health with FacebookApp sharing feature. It's working right with FacebookApp_A (when I click to share, it shows sharedialog). I want replace FacebookApp_A by FacebookApp_B. Step 1: I create FacebookApp_B, define PackageName, ClassName, turn on (Yes) feature Single Sign On, make it to General public status. Step 2: I use this code to get HashKey and I got it. try { PackageInfo info = getPackageManager().getPackageInfo("&lt;--app Health package name --&gt;",PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (NameNotFoundException e) { } catch (NoSuchAlgorithmException e) { } Step 3: I change facebook_app_id in Manifest.xml to FacebookApp_B's Id. Step 4: I build my project to .apk file with file debug.keystore of Education App because I lost Health App's keystore. Step 5: I setup Health App and click to share a link to facebook. At this time, a confirm dialog is showed on the screen: AppName would like to access your public profile and friend list Step 6: I click OK but the ShareDialog is not showed. Everything works right with FacebookApp_A but not with FacebookApp_B and I don't know what I had missed. I want show the ShareDialog like using FacebookApp_A. Thank you very much,
type: UnansweredQuestion
tagged with: facebook
has answer: http://stackoverflow.com/a/26380529
tagged with: java
has answer: http://stackoverflow.com/a/26380548
type: Question
answer count: 2
tagged with: mobile
score: 0
tagged with: android
has title: ShareDialog isn't showed when sharing a link to facebook from android application

http://stackoverflow.com/a/26511565
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26511329
has body: Define ImageHolder class which has 2 fields shape and image. class ImageHolder { Shape shape; Image img; public void paint(Graphics2D g2) { if (img!=null) { g2.drawImage(img); } else { g2.fill(shape); } } } Your grid should be List. On init all the ImageHolders have squares and null images. On click image is assigned to the clicked holder. In the paintComponent() you just call the holder's paint() method

http://stackoverflow.com/comment/41519502
score: 0
has text: @Kirubakaran what is your problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26387186

http://stackoverflow.com/comment/41457514
comment on: http://stackoverflow.com/q/26404320
type: Comment
type: QuestionComment
score: 9
has text: No sorting will never be smaller than O(n), because you have to at least check if the array is already sorted or not.

http://stackoverflow.com/comment/41637188
has text: Thank you man. I have found another solution and i posted. Anyway yours was good!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26485221

http://stackoverflow.com/a/26506232
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41653808
has comment: http://stackoverflow.com/comment/41672420
answers question: http://stackoverflow.com/q/26503308
upvote count: 2
has body: First, add a selection listener. When selection event occurs, build up the data you want to pass to your view (you may want to cast event.getSeletion() to TreeSelection and iterate over tree paths). In the end, open your view (or you can lookup for a view, if it is already opened and just activate it) and pass your model. It could look something like this: treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); Object model = selection.getFirstElement(); try { YourView view = (YourView) getSite().getPage().showView("your_view_id"); view.setModel(model); } catch (PartInitException e) { // TODO Auto-generated catch block e.printStackTrace(); } } });
has comment: http://stackoverflow.com/comment/41644140
has comment: http://stackoverflow.com/comment/41668858

http://stackoverflow.com/comment/41648322
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26508461
has text: You can parse the name from the HttpServletRequest.getRequestedUrl() or HttpRequest.getServletPath(). I'm working on a similiar project where each entity has an UUID. I made a servlet which maps all UUIDs and fetch the data out of the database.

http://stackoverflow.com/q/26364018
tagged with: jsoup
has comment: http://stackoverflow.com/comment/41386607
has comment: http://stackoverflow.com/comment/41433441
score: 0
has answer: http://stackoverflow.com/a/26364104
has comment: http://stackoverflow.com/comment/41385924
accepted answer: http://stackoverflow.com/a/26364104
has comment: http://stackoverflow.com/comment/41392739
answer count: 1
has comment: http://stackoverflow.com/comment/41432943
tagged with: parsing
has comment: http://stackoverflow.com/comment/41461229
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41386541
has comment: http://stackoverflow.com/comment/41386201
tagged with: java
has body: I want to get text out of a div class, store it in a string and show the text in a TextView. This is the website: Datenvolumen mit voller Geschwindigkeit verbraucht And this is my code: @Override protected Void doInBackground(Void... params) { try { Document doc = Jsoup.connect(url).get(); title = doc.select("div[class=barTextBelow]").text(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { // Set title into TextView TextView txttitle = (TextView) findViewById(R.id.tvused); txttitle.setText(title); mProgressDialog.dismiss(); } But I get an empty TextView. Does anyone know why? Thanks!
has comment: http://stackoverflow.com/comment/41386289
has title: Get text from div class with jsoup and put it into a string
has comment: http://stackoverflow.com/comment/41385701
type: Question

http://stackoverflow.com/comment/41476859
type: Comment
comment on: http://stackoverflow.com/a/26413535
score: 0
type: AnswerComment
has text: Make sure the step that generates a Response is *immediately* before the Conditional Goto.

http://stackoverflow.com/a/26438350
answers question: http://stackoverflow.com/q/26438141
has comment: http://stackoverflow.com/comment/41520922
score: 0
has body: There are just a few things you have to implement to achieve your goal. Take a look on this Groovy script - https://gist.github.com/wololock/568b9cc402ea661de546 Now lets explain what we have here List&lt;Element&gt; rows = document.select('table[id=ABC Guide] &gt; tbody &gt; tr') Here we're specifying that we are interested in every row tr that is immediate child of tbody which is immediate child of table with id ABC Guide. In return you receive a list of Element objects that describes those tr rows. Map&lt;String, String&gt; data = new HashMap&lt;&gt;() We will store our result in a simple hash map for further evaluation e.g. putting those scraped data into the database. for (Element row : rows) { String dog = row.select('td:eq(0)').text() String race = row.select('td:eq(1)').text() data.put(dog, race) } Now we iterate over every Element and we select content as a text from the first cell: String dog = row.select('td:eq(0)').text() and we repeat this step to retrieve the content as a text from the second cell: String race = row.select('td:eq(1)').text(). Then we just simply put those data into the hash map. That's all. I hope this example with provided description will help you with developing your application. EDIT: Java code sample - https://gist.github.com/wololock/8ccbc6bbec56ef57fc9e
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41520861
accepted answer of: http://stackoverflow.com/q/26438141
has comment: http://stackoverflow.com/comment/41520962
type: Answer
has comment: http://stackoverflow.com/comment/41520952

http://stackoverflow.com/q/26444058
answer count: 3
has answer: http://stackoverflow.com/a/26444345
downvote count: 0
has title: NoSuchElementException while using Scanner to read input
favorite count: 0
has answer: http://stackoverflow.com/a/26444096
has answer: http://stackoverflow.com/a/26444130
tagged with: java.util.scanner
upvote count: 3
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7056749
has body: The following Java method is suppose to accept a string (name of a person) from the user via keyboard, search that name in an array called name[] and delete that person's name from the array (by assigning name[i] = "INVALID"). The code tries to accept the input string (the name of the person) using a Scanner class object del_name, but I am getting a NoSuchElementException in the statement s=del_name.next(); i.e the 4th statement from the top. I will be really grateful if someone can give a solution and also explain as to why this code is not working. (Thank You) void Deletee() { Scanner del_name=new Scanner(System.in); String s; System.out.println("Enter the name to be deleted"); s=del_name.next(); // causing NoSuchElementException int i=0; /* find position in which the name occurs using while-loop below */ while(!s.equalsIgnoreCase(name[i]) &amp;&amp; i&lt;count) i++ ; // increment i to search in next array index if(i&lt;count) { name[i]="INVALID"; count--; System.out.println("Deletion Successful"); } else { System.out.println("No such person exist"); } del_name.close(); }
score: 3
tagged with: java
duplicate of: http://stackoverflow.com/q/7056749
type: Question

http://stackoverflow.com/comment/41642970
score: 0
type: Comment
has text: sorry, i didn't notice the package declaration! My Bad!
comment on: http://stackoverflow.com/a/26504876
type: AnswerComment

rest
tags question: http://stackoverflow.com/q/26470114
tags question: http://stackoverflow.com/q/26418055
tags question: http://stackoverflow.com/q/26403051
tags question: http://stackoverflow.com/q/26477405
tags question: http://stackoverflow.com/q/26405139
tags question: http://stackoverflow.com/q/26384473
tags question: http://stackoverflow.com/q/26446660
tags question: http://stackoverflow.com/q/26360161
tags question: http://stackoverflow.com/q/26424878
tags question: http://stackoverflow.com/q/26501070
tags question: http://stackoverflow.com/q/26394505
tags question: http://stackoverflow.com/q/26420166
tags question: http://stackoverflow.com/q/26503325
tags question: http://stackoverflow.com/q/26451873
tags question: http://stackoverflow.com/q/26369491
tags question: http://stackoverflow.com/q/26432048
tags question: http://stackoverflow.com/q/26370898
tags question: http://stackoverflow.com/q/26471047
tags question: http://stackoverflow.com/q/26356605
tags question: http://stackoverflow.com/q/26405386
tags question: http://stackoverflow.com/q/26440682
tags question: http://stackoverflow.com/q/26384892
tags question: http://stackoverflow.com/q/26500926
tags question: http://stackoverflow.com/q/26507480
tags question: http://stackoverflow.com/q/26404381
tags question: http://stackoverflow.com/q/26483585
tags question: http://stackoverflow.com/q/26511364
tags question: http://stackoverflow.com/q/26381320
tags question: http://stackoverflow.com/q/26398477
tags question: http://stackoverflow.com/q/26442564
tags question: http://stackoverflow.com/q/26468946
tags question: http://stackoverflow.com/q/26381170
tags question: http://stackoverflow.com/q/26443547
tags question: http://stackoverflow.com/q/26437834
tags question: http://stackoverflow.com/q/26444790
tags question: http://stackoverflow.com/q/26412260
tags question: http://stackoverflow.com/q/26386155
tags question: http://stackoverflow.com/q/26471225
type: Tag
tags question: http://stackoverflow.com/q/26510089
tags question: http://stackoverflow.com/q/26474526
tags question: http://stackoverflow.com/q/26504170
tags question: http://stackoverflow.com/q/26435517
tags question: http://stackoverflow.com/q/26486811
tags question: http://stackoverflow.com/q/26470117
tag name: rest
tags question: http://stackoverflow.com/q/26364475
tags question: http://stackoverflow.com/q/26488252
tags question: http://stackoverflow.com/q/26456325
tags question: http://stackoverflow.com/q/26510712
tags question: http://stackoverflow.com/q/26478915
tags question: http://stackoverflow.com/q/26406878
tags question: http://stackoverflow.com/q/26375573
tags question: http://stackoverflow.com/q/26470653
tags question: http://stackoverflow.com/q/26449214

http://stackoverflow.com/q/26372725
downvote count: 1
type: Question
upvote count: 0
tagged with: null
accepted answer: http://stackoverflow.com/a/26372899
score: -1
tagged with: pointers
has title: Null Pointer Exception in LinkedList Hash Table
answer count: 1
favorite count: 0
tagged with: hash
has answer: http://stackoverflow.com/a/26372899
type: AnsweredQuestion
has body: So I'm creating a hash table with LinkedLists using the multiplication method. As an instance variable I define the LinkedList "T" that I'll be using, and in the constructor of the class I specify the size of T. However, every time I run my Driver testing class, I get NullPointerExceptions on everything I try to reference anything in T[]. Am I overlooking something? I've spent over an hour trying to figure it out. ChainedHashTable class: public class ChainedHashTable { private LinkedList&lt;Integer&gt;[] T; private int m; private double A; public ChainedHashTable(int n) { for (m = 1; m &lt; n; m *= 2); T = new LinkedList[m]; Random random = new Random(); int s = random.nextInt(Integer.MAX_VALUE); A = (s * 1.00) / Integer.MAX_VALUE; } public void insert(Integer key) { T[hash(key)].add(Integer.valueOf(key)); } public void delete(int key) { T[hash(key)].remove(Integer.valueOf(key)); } public Integer search(int key) { int n = T[hash(key)].indexOf(key); if (n == -1) return -1; else return T[hash(key)].get(n); } private int hash(int key) { System.out.println((int)(m * ((key * A) % 1))); return (int)(m * ((key * A) % 1)); } public void printTable() { for (int i = 0; i &lt; T.length; i++) { System.out.println("index: " + i + " " + T[i]); } } } Driver class: public class Driver { public static void main(String[] args) { ChainedHashTable test1 = new ChainedHashTable(20); test1.printTable(); test1.insert(4); test1.insert(54); test1.insert(6); test1.insert(3); test1.insert(26); test1.insert(54); test1.insert(11); test1.insert(10); test1.insert(76); test1.insert(42); test1.insert(41); test1.insert(32); test1.insert(87); test1.insert(76); test1.insert(72); test1.insert(57); test1.insert(29); test1.insert(16); test1.insert(92); test1.insert(64); test1.printTable(); } }
tagged with: linked-list
tagged with: java

http://stackoverflow.com/a/26476188
has comment: http://stackoverflow.com/comment/41660048
has comment: http://stackoverflow.com/comment/41646852
type: Answer
answers question: http://stackoverflow.com/q/26464074
has comment: http://stackoverflow.com/comment/41622710
downvote count: 0
has comment: http://stackoverflow.com/comment/41642228
score: 1
has body: You are trying to write raw data to a socket that is expecting to receive binary data using the OpenWire protocol that is the default in ActiveMQ. You need to use a real client, such as the ActiveMQ native java client, or one in C++, .NET. You could use the STOMP transport connector to provide a mechanism to write raw text based commands but you'd still need to adhere the semantics of the STOMP protocol there. I suggest you do some more reading on how JMS Brokers in general work.
has comment: http://stackoverflow.com/comment/41624663
has comment: http://stackoverflow.com/comment/41666817
upvote count: 1

http://stackoverflow.com/comment/41593082
type: Comment
type: QuestionComment
score: 0
has text: are you missing ` org.eclipse.persistence.jpa.PersistenceProvider `
comment on: http://stackoverflow.com/q/26478098

http://stackoverflow.com/comment/41585108
type: AnswerComment
comment on: http://stackoverflow.com/a/26454730
type: Comment
has text: AlphaComposite is external library?
score: 0

http://stackoverflow.com/a/26492024
score: 1
has comment: http://stackoverflow.com/comment/41620995
downvote count: 0
has body: I would call getClass().getName() on handler rather than on type. This should work no matter the handler implementation or Event Type. You will get back the Class object that represents the runtime class &lt;H&gt;. http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#getClass%28%29
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26491569

http://stackoverflow.com/comment/41558232
type: Comment
comment on: http://stackoverflow.com/a/26458964
type: AnswerComment
has text: In my other buttons like addition,subtraction I have written as `if(command=="-")` .Should these too need to be changes to `command.equals("-")` likewise. Even with `(command=="-")` the calculations do get performed.Why is that
score: 0

http://stackoverflow.com/a/26390507
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41434458
has comment: http://stackoverflow.com/comment/41434797
has comment: http://stackoverflow.com/comment/41434633
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26390105
downvote count: 0
has body: By casting the intByte to a byte, the value is narrowed from 32-bit to 8-bit. The write() method can accept a byte even though its signature asks for an int -- this is called widening (no cast required). That part is inconsequential. But the cast from int to byte is important since it could dramatically affect the value of the variable by trimming off the leading 24 bits. Try this, for example, and see what happens: int i = 13465878; byte b = (byte)i; System.out.println("i as a byte is " + b);
answers question: http://stackoverflow.com/q/26390105
has comment: http://stackoverflow.com/comment/41434711

http://stackoverflow.com/a/26465035
has comment: http://stackoverflow.com/comment/41568134
has comment: http://stackoverflow.com/comment/41575457
has body: Extend AbstractAnnotationConfigDispatcherServletInitializer and implement 3 remaining methods + add your own servlet inside onStartup import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected String[] getServletMappings() { return new String[] { "/*" }; } @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class&lt;?&gt;[] { RootContextConfiguration.class, SecurityConfiguration.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class&lt;?&gt;[] { WebConfiguration.class }; } @Override public void onStartup(final ServletContext servletContext) throws ServletException { super.onStartup(servletContext); final ServletRegistration.Dynamic dispatcher = servletContext.addServlet("someotherServlet", new DispatcherServlet(context)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/*"); } }
answers question: http://stackoverflow.com/q/26464931
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41576778

http://stackoverflow.com/q/26400521
has comment: http://stackoverflow.com/comment/41451200
score: 0
linked to: http://stackoverflow.com/q/7037974
has body: i have a DrawingView class, that class creates an drawing view for. Code of that class you can see below. But the problem occurs when i want to create an instance of that class in xml file. What im doing wrong? code of xml : <ImageButton android:id="@+id/new_btn" android:layout_width="wrap_content" android:layout_height="fill_parent" android:contentDescription="@string/start_new" android:src="@drawable/new_pic" /> <ImageButton android:id="@+id/draw_btn" android:layout_width="wrap_content" android:layout_height="fill_parent" android:contentDescription="@string/brush" android:src="@drawable/brush" /> <ImageButton android:id="@+id/erase_btn" android:layout_width="wrap_content" android:layout_height="fill_parent" android:contentDescription="@string/erase" android:src="@drawable/eraser" /> <ImageButton android:id="@+id/save_btn" android:layout_width="wrap_content" android:layout_height="fill_parent" android:contentDescription="@string/save" android:src="@drawable/save" /> <com.example.drawingapp.DrawingView android:id="@+id/drawing" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_marginBottom="3dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginTop="3dp" android:layout_weight="1" android:background="#FFFFFFFF" /> <ImageButton android:layout_width="@dimen/large_brush" android:layout_height="@dimen/large_brush" android:layout_margin="2dp" android:background="#FF660000" android:contentDescription="@string/paint" android:onClick="paintClicked" android:src="@drawable/paint" android:tag="#FF660000" /> <ImageButton android:layout_width="@dimen/large_brush" android:layout_height="@dimen/large_brush" android:layout_margin="2dp" android:background="#FFFF0000" android:contentDescription="@string/paint" android:onClick="paintClicked" android:src="@drawable/paint" android:tag="#FFFF0000" /> <ImageButton android:layout_width="@dimen/large_brush" android:layout_height="@dimen/large_brush" android:layout_margin="2dp" a…
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26400989
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41451165
tagged with: java
has title: Adding an instance of my created class to xml file
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41451672
has comment: http://stackoverflow.com/comment/41451362
has answer: http://stackoverflow.com/a/26400696

hibernate-mapping
tags question: http://stackoverflow.com/q/26501436
tag name: hibernate-mapping
tags question: http://stackoverflow.com/q/26415231
type: Tag
tags question: http://stackoverflow.com/q/26423724
tags question: http://stackoverflow.com/q/26416881
tags question: http://stackoverflow.com/q/26464997
tags question: http://stackoverflow.com/q/26374025
tags question: http://stackoverflow.com/q/26493815

http://stackoverflow.com/comment/41507015
type: AnswerComment
has text: and the code that set the onClickListener as well as the code inside the onClickListener :) too.
type: Comment
comment on: http://stackoverflow.com/a/26401590
score: 0

http://stackoverflow.com/comment/139630131
has text: @TheincredibleJan pretty sure. Can't remember though.
comment on: http://stackoverflow.com/a/32873662
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41500562
comment on: http://stackoverflow.com/a/26415208
has text: And I could use some voting, if you deem the question worth it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/36802536
has body: I tried editing the hadoop-env.sh file, but the changes mentioned here didn't work for me. What worked is this: export HADOOP_CLASSPATH="$HADOOP_CLASSPATH:$HBASE_HOME/lib/*" I just added that at the end of my hadoop-env.sh. Do not forget to set your HBASE_HOME variable. You can also replace the $HBASE_HOME with the actual path of your hbase installation.
type: Answer
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/26364057
downvote count: 0

http://stackoverflow.com/comment/41865708
type: Comment
has text: Check your manifest. The issue is obvious.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26431368

http://stackoverflow.com/comment/41540887
score: 0
type: Comment
has text: @user3933143 depends how you are writing the names to a file. I'm guessing you are iterating over them and adding them entry by entry? just append "\n" (newline) after each line
comment on: http://stackoverflow.com/a/26449663
type: AnswerComment

http://stackoverflow.com/a/26465628
score: 0
has body: No. If a field is marked as transient, then it is not serialized at all, it is completely missing from the class's serialized format. So the data is not there for you to retrieve.
type: Answer
answers question: http://stackoverflow.com/q/26465095

http://stackoverflow.com/comment/41552680
score: 0
has text: @SotiriosDelimanolis: good point! Answer edited, and thanks!! I missed that completely.
type: Comment
comment on: http://stackoverflow.com/a/26456047
type: AnswerComment

http://stackoverflow.com/a/26466013
downvote count: 0
has body: In both cases you are doing a narrowing conversion, which may result in loss of information. Conversion of int to byte you convert an int whose value is 257 (00000000 00000000 00000001 00000001 in binary) to a byte. Therefore, only the lowest (right) byte of the int is kept. Therefore the result is 00000001 in binary, which is 1. Conversion of double to byte This conversion is more complicated. In the first step 323.142 is converted from double to int, so it becomes 323. The second step is the same as the first conversion : 323 is 00000000 00000000 00000001 01000011 in binary. Converting 323 to byte keeps the lowest (right) byte, which gives you 67. Here's what the JLS says about this conversion : A narrowing conversion of a floating-point number to an integral type T takes two steps: In the first step, the floating-point number is converted either to a long, if T is long, or to an int, if T is byte, short, char, or int, as follows: If the floating-point number is NaN (§4.2.3), the result of the first step of the conversion is an int or long 0. Otherwise, if the floating-point number is not an infinity, the floating-point value is rounded to an integer value V, rounding toward zero using IEEE 754 round-toward-zero mode (§4.2.3). Then there are two cases: a. If T is long, and this integer value can be represented as a long, then the result of the first step is the long value V. b. Otherwise, if this integer value can be represented as an int, then the result of the first step is the int value V. Otherwise, one of the following two cases must be true: a. The value must be too small (a negative value of large magnitude or negative infinity), and the result of the first step is the smallest representable value of type int or long. b. The value must be too large (a positive value of large magnitude or positive infinity), and the result of the first step is the largest representable value of type int or long. In the second step: If T is int or long, the result of the conv…
score: 5
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/26465633

http://stackoverflow.com/q/26457807
has answer: http://stackoverflow.com/a/43932002
has answer: http://stackoverflow.com/a/26457846
type: Question
accepted answer: http://stackoverflow.com/a/26457819
tagged with: android
possible better answer: http://stackoverflow.com/a/26457846
score: 0
tagged with: java
has body: i am trying to work through a tutorial and have run across a bit of a snag. the tutorial implements a class SingleFragmentActivity to host a fragment (with the xml file to go along with it. My issue is in this SingleFragmentActivity.java class, there is a call to setContentView(int) that is throwing an error, its says it cannot find the method. Isn't setContentView(int) part of the Fragment Class? import android.app.Fragment; import android.app.FragmentManager; import android.os.Bundle; public abstract class SingleFragmentActivity extends Fragment { protected abstract Fragment createFragment(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fragment); FragmentManager manager = getFragmentManager(); Fragment fragment = manager.findFragmentById(R.id.fragmentContainer); if (fragment == null) { fragment = createFragment(); manager.beginTransaction() .add(R.id.fragmentContainer, fragment) .commit(); } } }
answer count: 4
has answer: http://stackoverflow.com/a/26457850
has answer: http://stackoverflow.com/a/26457819
type: AnsweredQuestion
has title: setContentView(int) not working

http://stackoverflow.com/a/26356855
score: 0
has body: How about this. public static void main(String[] args) { int lineNo = 2; // Sample line number System.out.println("content present in the given line no "+lineNo+" --&gt; "+getLineContents(lineNo)); } public static String getContents(int line_no) { String line = null; try(LineNumberReader lineNumberReader = new LineNumberReader(new FileReader("path\\to\\file"))) { while ((line = lineNumberReader.readLine()) != null) { if (lineNumberReader.getLineNumber() == line_no) { break; } } } catch(Exception exception){ System.out.println("Exception :: "+exception.getMessage()); } finally{ return line; } } With the help of try-with-resources statement you can avoid closing stream explicitly, everything takes care by them.
type: Answer
answers question: http://stackoverflow.com/q/26354774

http://stackoverflow.com/q/26386556
has answer: http://stackoverflow.com/a/34448160
has title: Using Sugar ORM with UUID or Joda-Time
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/49647920
type: Question
tagged with: jodatime
answer count: 2
score: 4
has answer: http://stackoverflow.com/a/39343565
tagged with: sugarorm
has body: I'm creating a mobile application that will have users as defined below: public class UserObject extends SugarRecord&lt;UserObject&gt; { public UUID Id; public String Name; public int DefaultSort; public String Username; public Date LastLogin; public UserObject() { } public UserObject(UUID id, String name, int defaultSort, String username, String password, Date lastLogin) { this.Id = id; this.Name = name; this.DefaultSort = defaultSort; this.Username = username; this.LastLogin = lastLogin; } } These users will be retrieved from an API - the IDs are stored in the Database as uniqueidentifiers (or GUIDs in C#). When I enter a new record into the users table, everything works just fine: DateTime dt = new DateTime(); UUID newUID = UUID.randomUUID(); UserObject newUser = new UserObject(newUID, "David", 1, "userOne", "password", dt.toDate()); newUser.save(); However, when I try and retrieve the value back out I get an error: Class cannot be read from Sqlite3 database. Please check the type of field Id(java.util.UUID) Does Sugar ORM (or SQLite) simply not support UUIDs? If I try with the Joda DateTime, replacing the "LastLogin", the table just won't build at all so it looks as if it can create the fields, just not retrieve/store them...
tagged with: android
tagged with: sqlite
upvote count: 4
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26497167
has comment: http://stackoverflow.com/comment/41627591
upvote count: 0
score: -2
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26497055
has body: You should be using a Map instead of a List.

http://stackoverflow.com/comment/41408405
score: 0
type: Comment
type: QuestionComment
has text: i don't know about jfreechart(i guess you can't) but in swing you can
comment on: http://stackoverflow.com/q/26376329

http://stackoverflow.com/q/26505692
tagged with: string
tagged with: int
score: 0
accepted answer: http://stackoverflow.com/a/26505947
has comment: http://stackoverflow.com/comment/41642329
has body: The text file look like this: name1 1 name2 2 The method prints: [name: name1 shirt number: 1] This is how I want it to print: [name: name1 shirt number: 1, name: name2 shirt number: 2, and so on] It only prints the first element. Feels like I tried everything but I can't get it to work. Someone got a possible solution? public void loadPlayerDatabase(String fileName) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) { String currentLine; int counter = 0; String name = null; while ((currentLine = reader.readLine()) != null) { int number = Integer.parseInt(reader.readLine()); if (counter % 2 == 0) { name = currentLine; counter++; } else { Player player = new Player(); player.setName(name); players.add(player); player.setNumber(number); counter++; } } counter++; } catch (NumberFormatException n) { System.out.println("That didn't work!" + n.getMessage()); } System.out.println(players); }
has comment: http://stackoverflow.com/comment/41642409
has answer: http://stackoverflow.com/a/26505947
type: AnsweredQuestion
has title: Read both String and int from text file with BufferedReader into HashSet Java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41642481
answer count: 1
tagged with: bufferedreader

http://stackoverflow.com/q/26383301
has title: Display JTable in JPanel
type: Question
tagged with: java
tagged with: jpanel
score: -1
tagged with: jtable
has answer: http://stackoverflow.com/a/26383566
has comment: http://stackoverflow.com/comment/41421024
answer count: 3
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41420986
accepted answer: http://stackoverflow.com/a/26383566
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26383580
tagged with: jlabel
has answer: http://stackoverflow.com/a/26385108
has answer: http://stackoverflow.com/a/26383580
has body: I've been trying to add JTable to my JPanel, yet it doesn't appear there. I've searched through other questions, but solutions proposed there didn't help me. The function below is a part of a class which extends JFrame. "repaint" is a BufferedImage, "imageLabel" is JLabel and "image" is ImageIcon. public void showTable() { try { repaint = ImageIO.read(new File("filename.jpg")); } catch (IOException e) { } Graphics g = repaint.createGraphics(); g.setFont(font); g.setColor(black); String[] columnsName = {"id","text"}; Object[][] data = {{new Integer(1),"text one"},{new Integer(2),"text two"}}; JTable table = new JTable(data, columnsName); JScrollPane tableContainer = new JScrollPane(table); image = new ImageIcon(repaint.getScaledInstance(sizeX,sizeY, Image.SCALE_SMOOTH)); imageLabel.setIcon(image); imageLabel.add(tableContainer,BorderLayout.CENTER); getContentPane().add(imageLabel); pack(); setVisible(true); repaint(); revalidate(); } What I want to achieve is to display table over loaded image. Thanks in advance for Your help :)
has comment: http://stackoverflow.com/comment/41420941
tagged with: swing
downvote count: 1

http://stackoverflow.com/comment/41463805
comment on: http://stackoverflow.com/q/26401050
has text: @PratanuMandal, and what about storing the database in the cloud? Have you considered that option? Also, if you make the database readonly, would that not make it more secure?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26407249
has body: I'm trying to get data from my custom list view cells , I have radio buttons and I'm trying to get the data from them how can I do that My Custom List code : private class customList extends ArrayAdapter&lt;String&gt; { public customList(Context context, int resource, List&lt;String&gt; objects) { super(context, resource, objects); } @Override public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); View row = layoutInflater.inflate(R.layout.custom_list , parent , false); //ParseObject parseObject = new ParseObject("Questions"); //getParseData = new GetParseData(parseObject ,strQuestion); // getParseData.getQuestion(position); TextView tv = (TextView)row.findViewById(R.id.tvNameC); tv.setText(nameList.get(position).toString()); final RadioGroup rg = (RadioGroup)row.findViewById(R.id.rg); ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("test"); query.whereExists("arr"); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt;List, ParseException e) { if (e == null) { strList = List.get(position).getList("arr"); Log.e("Array Is " , strList.toString()); final RadioButton[] radioButtons = new RadioButton[strList.size()]; for(int i = 0 ; i &lt; radioButtons.length ; i++) { radioButtons[i] = new RadioButton(getApplicationContext()); radioButtons[i].setText(strList.get(i).toString()); radioButtons[i].setTextColor(Color.BLACK); rg.addView(radioButtons[i]); } idForMethod = rg.getCheckedRadioButtonId(); } else { Log.d("score", "Error: " + e.getMessage()); } } }); return row ; }
has title: How can I get RadioButton value from custom listview cells
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26407508
linked to: http://stackoverflow.com/q/15444375
has answer: http://stackoverflow.com/a/26407556
has answer: http://stackoverflow.com/a/31780767
has comment: http://stackoverflow.com/comment/41463319
type: UnansweredQuestion
tagged with: android
tagged with: java
type: Question

http://stackoverflow.com/a/26455396
has comment: http://stackoverflow.com/comment/41752664
has body: You can do something like while (true) { int ntz = Long.numberOfTrailingZeros(n); count += ntz; n &gt;&gt;&gt;= ntz; // Using unsigned shift allows to work with bigger numbers. if (n==1) break; n = 3*n + 1; count++; } which should be faster as it does multiple steps at once and avoids unpredictable branches. numberOfTrailingZeros is JVM intrinsic taking just one cycle on modern desktop CPUs. However, it's not very efficient as the average number of zeros is only 2. The Wikipedia explains how to do multiple steps at once. This is based on the observation that knowing k least significant bits is sufficient to determine the future steps up to the point when the k-th halving happens. My best result based on this (with k=17) and filtering out some non-promising values is 57 seconds for the determination of the maximum in range 1 .. 1e10.
has comment: http://stackoverflow.com/comment/41552766
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41553170
has comment: http://stackoverflow.com/comment/43188228
type: Answer
has comment: http://stackoverflow.com/comment/41553076
has comment: http://stackoverflow.com/comment/41753536
has comment: http://stackoverflow.com/comment/41552907
has comment: http://stackoverflow.com/comment/41753106
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26454902
answers question: http://stackoverflow.com/q/26454902
has comment: http://stackoverflow.com/comment/41554988

http://stackoverflow.com/comment/41636782
comment on: http://stackoverflow.com/a/26502440
score: 0
type: AnswerComment
has text: first off thank you for your response. As you wrote in the second sentance, when I click on JavaSE-1.6, in "Ececution Environments", the "Compatible JRE's" is empty, how do I make Eclipse "know about the java 1.6"
type: Comment

http://stackoverflow.com/a/26492874
answers question: http://stackoverflow.com/q/26489171
type: Answer
has body: You can use the follwing; Get the highest date within a month/year combination; SELECT Max(dates.datefield) AS MaxOfdatefield, DatePart("m",[datefield]) AS [Month], DatePart("yyyy",[datefield]) AS [Year] FROM dates GROUP BY DatePart("m",[datefield]), DatePart("yyyy",[datefield]);
score: 0

http://stackoverflow.com/comment/41589971
comment on: http://stackoverflow.com/q/26476057
has text: I know them. REQUIRES_NEW does not works for me because I do not have nested transaction enabled. So I'm finding ways of configuration - I know how to write annotations. please see that: http://stackoverflow.com/questions/26467006/how-not-to-roll-back-previous-methods-persist-data/26469270?noredirect=1#comment41587733_26469270
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41571720
comment on: http://stackoverflow.com/a/26466869
type: AnswerComment
has text: Im so sorry but dont really understand. Can you please elaborate
score: 0
type: Comment

http://stackoverflow.com/comment/65733584
has text: Hello, have you solved this issue? I have the same problem and can not figure out why. Please update question if you found a solution. Thanks.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26439322

http://stackoverflow.com/a/26470387
answers question: http://stackoverflow.com/q/26470240
score: 0
type: Answer
has body: Normally, when you would use a "toString()" function, it would be used like this // replace "Person" with what your class is actually named String personString = Person.toString(); System.out.println(personString); So, instead of actually printing to the console in your application, you need to tell the toString() function, what value it needs to return. You use the return keyword to do that Try this public String toString() { String result = lastName + ", " + firstName; // feel free to change `result` more return result; } Take not of the method signature public String toString() that String in the signature is what's telling the compiler that the method is supposed to return a string.

http://stackoverflow.com/q/26375573
tagged with: servlets
score: 0
answer count: 2
tagged with: web.xml
tagged with: rest
has comment: http://stackoverflow.com/comment/41407246
has comment: http://stackoverflow.com/comment/41407145
type: UnansweredQuestion
has title: should I make two different servlet entry for rest and normal html in web.xml
has answer: http://stackoverflow.com/a/26375700
tagged with: spring
has answer: http://stackoverflow.com/a/26375649
has comment: http://stackoverflow.com/comment/41407151
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41408315
has body: I am writing spring mvc application. In my application I have web pages as well as rest web services to handle ajax call. I have done below entry in web.xml myapp org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring_myapp-servlet.xml 1 myapp *.html Should I map my rest url with same servlet like myapp /rest/* Or should I make new servlet entry for rest. I have done required entries in pom.xml for "org.codehaus.jackson" and also I have made required entries in my spring_myapp-servlet.xml. For html page I am using below code in my controller @RequestMapping(value = "/htmlUrl") public ModelAndView ModifyValiodation(HttpServletRequest request) { // my code } For rest service I am using @RequestMapping(value = "/restUrl") public @ResponseBody Map<String, String> restUrl(HttpServletRequest request) { // my code } If I am using only one servlet for two url mapping, then total 4 url will be made. myapp/htmlUrl.html myapp/restUrl.html myapp/rest/htmlUrl myapp/rest/restUrl If I am using two different servlet with individual dispacherServlet then will i have to make entry of every component and service of spring in both the servlet.xml? Please point out the solution for exposing rest web service. Thanks!
has comment: http://stackoverflow.com/comment/41409940

http://stackoverflow.com/a/26463276
has body: You should call MockitoAnnotations.initMocks(this) in your setup method: @Before public void setUp() throws Exception { calendarDto = new ArrayList&lt;CalendarDto&gt;(); test1 = new CalendarDto(); test1.setStatus(TimesheetStatusEnum.APPROVED); test1.setMonth(1); test2 = new CalendarDto(); test2.setMonth(2); test2.setStatus(TimesheetStatusEnum.REJECTED); calendarDto.add(test1); calendarDto.add(test2); MockitoAnnotations.initMocks(this) }
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26462853
has comment: http://stackoverflow.com/comment/41567833
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/26462853
downvote count: 0

http://stackoverflow.com/q/26410003
has comment: http://stackoverflow.com/comment/41468380
score: 0
answer count: 2
tagged with: concatenation
has answer: http://stackoverflow.com/a/26410080
has comment: http://stackoverflow.com/comment/41468276
has title: Can I combine multiple concat?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41468330
linked to: http://stackoverflow.com/q/47605
tagged with: java
possible better answer: http://stackoverflow.com/a/26410085
has comment: http://stackoverflow.com/comment/41468432
has comment: http://stackoverflow.com/comment/41468249
type: Question
has body: I want to short my coding as much as I can. I tried to use "concat" but facing a problem to combine in multiple way. Did concat allow to combine two concat only (per concat)? String concat1 = "Please Make A Choice :"; String concat2 = "(1) For Calculate Area Of Circle"; String concat3 = "(2) For Calculate Area Of Rectangle"; String concat4 = "(3) For Calculate Area Of Triangle"; String concat5 = concat1.concat(concat2,concat3,concat4);
has answer: http://stackoverflow.com/a/26410085
accepted answer: http://stackoverflow.com/a/26410080

http://stackoverflow.com/a/26503488
score: 1
has body: Try this @Override public View getView(int position, View convertView, ViewGroup parent) { NewsHolder holder = null; LayoutInflater inflater = ((Activity)context).getLayoutInflater(); int type = getItemViewType(position); switch (type) { case 1: { holder = new NewsHolder(); if (convertView == null || (((NewsHolder) convertView.getTag()).getType() == 0)) { convertView = inflater.inflate(R.layout.section_header, null); holder.itemName = (TextView) convertView.findViewById(R.id.header); holder.setType(1); convertView.setTag(holder); } else { holder = (NewsHolder) convertView.getTag(); } holder.itemName.setText("CUSTOM TEXT"); break; } case 0: { holder = new NewsHolder(); if (convertView == null || (((NewsHolder) convertView.getTag()).getType() == 1)) { convertView = inflater.inflate(R.layout.custom_row, null); holder.itemName = (TextView) convertView.findViewById(R.id.example_itemname); holder.icon = (ImageView) convertView.findViewById(R.id.example_image); holder.button3 = (Button) convertView.findViewById(R.id.swipe_button3); holder.setType(0); convertView.setTag(holder); } else { holder = (NewsHolder) convertView.getTag(); } ItemRow itemdata = data.get(position); holder.itemName.setText(itemdata.getItemName()); holder.icon.setImageDrawable(itemdata.getIcon()); break; } } return convertView; } Then add this to your NewsHolder class private class NewsHolder { private int holderType; public void setType(int holderType){ this.holderType=holderType; } public int getType(){ return this.holderType; } // YOUR VARIABLES (VIEWS) // -- // ВАШИ ПЕРЕМЕННЫЕ ВЬЮ }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26502374
answers question: http://stackoverflow.com/q/26502374
type: Answer
upvote count: 1

http://stackoverflow.com/a/26488522
answers question: http://stackoverflow.com/q/26488268
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26488268
type: Answer
has comment: http://stackoverflow.com/comment/41612417
has comment: http://stackoverflow.com/comment/41613796
score: 2
has comment: http://stackoverflow.com/comment/41613611
downvote count: 0
has body: Considering a structure like this: myjar.jar |__ assessmentrecordsystem |__ MyClass.class |__ reports |__ report1.jrxml You can load the resource with a relative path from your MyClass with getResourceAsStream() InputStream is = MyClass.class.getResourceAsStream("reports/report1.jrxml"); Otherwise, you need to add the following entry to the /META-INF/MANIFEST.MF file inside your jar: Class-Path: . Then you can load your file with an absolute path from the jar root with getClassLoader().getResourceAsStream() InputStream is = MyClass.class.getClassLoader().getResourceAsStream( "/assessmentrecordsystem/reports/report1.jrxml");
upvote count: 2

http://stackoverflow.com/q/26358148
tagged with: unit-testing
type: Question
accepted answer: http://stackoverflow.com/a/26359009
answer count: 1
has body: I am writing unit tests using selenium in Java. And the problem I am having is that certain tests take longer than usual. I'd like to make it better by adding some sort of timeout or technology that would skip the test if it is taking longer to finish. Can anyone suggest such technology? I have found @Timed annotation from Spring framework where it would fail the test if it takes longer than usual but it does not interrupt it or skip the test.
has title: Skip Selenium Tests after x amount of time
tagged with: spring
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26359009
score: 0
tagged with: java
tagged with: timeout

http://stackoverflow.com/q/26401354
has title: Android reuse layout with include issue
has answer: http://stackoverflow.com/a/26401590
score: 0
answer count: 1
tagged with: user-interface
has body: I have several layout : loading.xml reload.xml noresult.xml These are LinearLayout and RelativeLayout I use them in other layout as below : &lt;include android:id="@+id/loading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" layout="@layout/loading" android:visibility="gone" /&gt; &lt;include android:id="@+id/reload" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" layout="@layout/reload" android:visibility="gone" /&gt; &lt;include android:id="@+id/noresult" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" layout="@layout/noresult" android:visibility="gone" /&gt; The problem is when i create a generic layout that include these and use it in several fragments (like in a viewpager for example) When i click the reload button of the reload layout, on a list. It reload another list with the data of the first. Can there an issue with the views ids ? Can i reuse the same include in several layout with diferent include ids, but have the same reload button id in the include, can it create id conflicts ? (it's the same question i think) EDIT 1 : Code used to add fragments : getSherlockActivity().getSupportFragmentManager() .beginTransaction() .setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_top, R.anim.slide_in_top, R.anim.slide_out_bottom) .add(R.id.fragment_a, fragmentClassA1) .addToBackStack(TAG_A1) .commit();
type: UnansweredQuestion
tagged with: android
tagged with: android-fragments
tagged with: java
type: Question
tagged with: android-layout

http://stackoverflow.com/comment/68166119
score: 4
has text: This would mean annotating each getter/setter, so we could initially add a "suppress" annotation. It's not helpful.
type: Comment
comment on: http://stackoverflow.com/a/26356012
type: AnswerComment

http://stackoverflow.com/a/26585678
has body: Yes you can trick a a webpage to download on your locals by Java code. You can not Download HTMl Static content by Java Script. JavaScript is not providing you to create a files as Java Provides. import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class HttpDownloadUtility { private static final int BUFFER_SIZE = 4096; /** * Downloads a file from a URL * @param fileURL HTTP URL of the file to be downloaded * @param saveDir path of the directory to save the file * @throws IOException */ public static void downloadFile(String fileURL, String saveDir) throws IOException { URL url = new URL(fileURL); HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); int responseCode = httpConn.getResponseCode(); // always check HTTP response code first if (responseCode == HttpURLConnection.HTTP_OK) { String fileName = ""; String disposition = httpConn.getHeaderField("Content-Disposition"); String contentType = httpConn.getContentType(); int contentLength = httpConn.getContentLength(); if (disposition != null) { // extracts file name from header field int index = disposition.indexOf("filename="); if (index &gt; 0) { fileName = disposition.substring(index + 10, disposition.length() - 1); } } else { // extracts file name from URL fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1, fileURL.length()); } System.out.println("Content-Type = " + contentType); System.out.println("Content-Disposition = " + disposition); System.out.println("Content-Length = " + contentLength); System.out.println("fileName = " + fileName); // opens input stream from the HTTP connection InputStream inputStream = httpConn.getInputStream(); String saveFilePath = saveDir + File.separator + fileName; // opens an output stream to save into file FileOutputStream outputStream = new FileOutputStream(saveFilePath); int bytesRead = -1; byte[] buffer = new byte[BUFFER_SIZE]; while …
has comment: http://stackoverflow.com/comment/41807841
type: Answer
accepted answer of: http://stackoverflow.com/q/26454916
upvote count: 2
has comment: http://stackoverflow.com/comment/41791393
score: 2
has comment: http://stackoverflow.com/comment/41787010
has comment: http://stackoverflow.com/comment/41815588
answers question: http://stackoverflow.com/q/26454916
type: AcceptedAnswer
downvote count: 0

google-cloud-datastore
tags question: http://stackoverflow.com/q/26456058
tag name: google-cloud-datastore
tags question: http://stackoverflow.com/q/26357431
tags question: http://stackoverflow.com/q/26398032
type: Tag
tags question: http://stackoverflow.com/q/26377347
tags question: http://stackoverflow.com/q/26480528

http://stackoverflow.com/a/26416624
has comment: http://stackoverflow.com/comment/96758252
accepted answer of: http://stackoverflow.com/q/26372949
has body: This would be a problem since you will need to author your own MP3 decoder logic in order to do something like this. The current media API's are implemented deep in the native code and can't expose the decoded media stream to user code. Your other alternative is to write that portion of the code natively for each platform which shouldn't be very hard when using native interfaces: http://www.codenameone.com/how-do-i---access-native-device-functionality-invoke-native-interfaces.html
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26372949

vbscript
tags question: http://stackoverflow.com/q/26366046
type: Tag
tag name: vbscript
tags question: http://stackoverflow.com/q/26510926

appassembler
type: Tag
tag name: appassembler
tags question: http://stackoverflow.com/q/26470499

http://stackoverflow.com/comment/41594351
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26478818
type: AnswerComment
has text: Guava is a very fat library to include for only this one feature. I use this method

http://stackoverflow.com/comment/41383060
has text: in fact it's just a warning, did you run your code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26360954

http://stackoverflow.com/comment/41510562
has text: Either use : bean (struts-bean.tld) - uri: http://struts.apache.org/tags-bean or use <jsp:useBean id="sampleBean" class="com.javacodegeeks.snippets.enterprise.SampleBean" scope="session">...either of them should work
comment on: http://stackoverflow.com/a/26414141
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26368156
has comment: http://stackoverflow.com/comment/41393690
has comment: http://stackoverflow.com/comment/41393889
has comment: http://stackoverflow.com/comment/41472444
tagged with: class
has body: I am trying to set the value of a String in another class and then get it from a third class. Now I am trying to do with set and get methods but I can't get it to work! When the user starts the program a button appear. When the button is pressed the test String get the value "Hello". And then I call the set class and put in test in the parameter. Now in the set method it is a System.out.println and it prints Hello, but when I am trying to get the method from my second class it prints null. I do not know why!Here is my classes: public class Class1 { public static void main(String[] args) { Class3 c3 = new Class3(); c3.setFilename("Hello"); JFrame frame = new JFrame("Action Listener"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); JButton button = new JButton("Click me!"); frame.add(button); Class2 c2 = new Class2(); button.addActionListener(c2); frame.setSize(300, 100); frame.setVisible(true); } } Here is my second class, it is the filename String I want to have to the next class: public class Class2 implements ActionListener { String filename; public void actionPerformed(ActionEvent e) { Class3 c3 = new Class3(); filename = c3.getFilename(); System.out.println(filename); // Prints null } } Here is the third classs: public class Class3 { String filename; public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; System.out.println(filename); // Prints Hello } }
has comment: http://stackoverflow.com/comment/41394007
has comment: http://stackoverflow.com/comment/41393444
has comment: http://stackoverflow.com/comment/41472930
score: -5
answer count: 1
has comment: http://stackoverflow.com/comment/41395453
favorite count: 0
has title: String returns null when using a get method
has comment: http://stackoverflow.com/comment/41394259
upvote count: 2
has comment: http://stackoverflow.com/comment/41394154
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41394061
tagged with: swing
has comment: http://stackoverflow.com/comment/41393533
has comment: http://stackoverflow.com/comment/41393572
has comment: http://stackoverflow.com/comment/41395401
has answer: http://stackoverflow.com/a/26371023
linked to: http://stackoverflow.com/q/4690892
has comment: http://stackoverflow.com/comment/41393928
tagged with: java
has comment: http://stackoverflow.com/comment/41471875
downvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/41394029
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/41495200
has comment: http://stackoverflow.com/comment/41394325
has comment: http://stackoverflow.com/comment/41393479
has comment: http://stackoverflow.com/comment/41393874
has comment: http://stackoverflow.com/comment/41393846
has comment: http://stackoverflow.com/comment/41485383
tagged with: string

http://stackoverflow.com/q/26503074
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41638176
tagged with: session
has body: Environment - openjdk 1.7 - tomcat 7.0.55 with native connector - apache 2.4.10 with mod-jk 1.2.40 Tomcat start Client request -> JSESSIONID is null tomcat response -> JSESSIONID=C5EBF0AA96ADB34E0C28E4D9D2595D98 is create refresh page -> session attribute(name=count, value=count++) is correct. count is increasing. Tomcat stop -> start (restart) context setting is session is not persist Client refresh -> client request is send JSESSIONID=C5EBF0AA96ADB34E0C28E4D9D2595D98 session attribute(name=count, value=0) is reset. but keeping JSESSIONID question. why tomcat using JSESSIONID set by client request value? is not regenerate? is this java spec? thanks.
downvote count: 0
has answer: http://stackoverflow.com/a/26519659
tagged with: tomcat
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41639054
accepted answer: http://stackoverflow.com/a/26519659
has title: is normal keep value when tomcat restart after JSESSIONID was create
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/41566369
type: Comment
comment on: http://stackoverflow.com/a/26463531
has text: Yes toBeReplacedWith is coming from DB with slashes inside it. But then I want to preserve them, they are data, not mere escape symbols. Any ways I will be using this toBeReplacedWith to v=create Json which will be invalid without these slashes.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26477020
has comment: http://stackoverflow.com/comment/41593777
tagged with: mockito
has comment: http://stackoverflow.com/comment/41594855
has comment: http://stackoverflow.com/comment/41593578
upvote count: 3
has answer: http://stackoverflow.com/a/26478462
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41593322
score: 3
has body: My method returns an exception if the input String (StringBuilder in my case) is longer than 2048 characters. Since we cannot mock final classes using Mockito, can anyone tells me how do unit test this. One way is to actually pass a string that long which seems stupid. Is there an easy way to test this?
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26480010
has comment: http://stackoverflow.com/comment/41594889
tagged with: unit-testing
type: Question
has title: Mockito: Test a method that takes string of long length
linked to: http://stackoverflow.com/q/1079239
answer count: 2

http://stackoverflow.com/comment/41465828
comment on: http://stackoverflow.com/a/26408292
score: 0
type: Comment
has text: You can but from what I understood from your question you have to do it within another function. If you have to just assemble it in another function and do stuff in main it will work as well. Just be sure to pass the modified a, b, c to the other function and not the originals. You can do this by overwriting the originals or making new variables for the modified a, b, c.
type: AnswerComment

http://stackoverflow.com/a/26479552
type: Answer
answers question: http://stackoverflow.com/q/26479380
upvote count: 2
has comment: http://stackoverflow.com/comment/41596755
has comment: http://stackoverflow.com/comment/41596809
downvote count: 1
has comment: http://stackoverflow.com/comment/41595521
has comment: http://stackoverflow.com/comment/41595944
score: 1
has body: import java.awt.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.print.*; import java.io.BufferedReader; import java.io.FileReader; import java.text.*; public class PrintFileToPrinter implements Printable { static AttributedString myStyledText = null; public static void main(String args[]) { /**Location of a file to print**/ String fileName = "C:/Temp/abc.txt"; /**Read the text content from this location **/ String mText = readContentFromFileToPrint(fileName); /**Create an AttributedString object from the text read*/ myStyledText = new AttributedString(mText); printToPrinter(); } /** * &lt;span id="IL_AD8" class="IL_AD"&gt;This method&lt;/span&gt; reads the content of a text file. * The location of the file is provided in the parameter */ private static String readContentFromFileToPrint(String fileName) { String dataToPrint = ""; try { BufferedReader input = new BufferedReader(new FileReader(fileName)); String line = ""; /**Read the file and populate the data**/ while ((line = input.readLine()) != null) { dataToPrint += line + "\n"; } } catch (Exception e) { return dataToPrint; } return dataToPrint; } /** * Printing the data to a printer. * Initialization done in this method. */ public static void printToPrinter() { /** * Get a Printer Job */ PrinterJob printerJob = PrinterJob.getPrinterJob(); /** * Create a book. A book contains a pair of page painters * called printables. Also you have different pageformats. */ Book book = new Book(); /** * Append the Printable Object (this one itself, as it * implements a printable interface) and the page format. */ book.append(new PrintFileToPrinter(), new PageFormat()); /** * Set the object to be printed (the Book) into the PrinterJob. Doing this * before bringing up the print dialog allows the print dialog to correctly * display the page range to be printed and to dissallow any print &lt;span id="IL_AD6" class="IL_AD"&gt;settings&lt;/span&gt; not * appropriate for the pages to be printed. */ printerJob.setPag…
has comment: http://stackoverflow.com/comment/41595481

http://stackoverflow.com/comment/41592921
has text: Which of the suggestions in the error message did you try?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26434884

http://stackoverflow.com/a/26478908
has body: I'm assuming you want to do this recursively for learning purposes (there's really no point in doing it for any other reason; it's best to use an existing library routine, and next-best to use a for loop like you already did). The general approach to using recursion is that you're going to solve your problem by finding one or more smaller versions of the same problem within your problem. So, to compare arrays for equality, if the arrays are of length N, you can write a recursive method by comparing the first elements, and then (smaller problem) recursively comparing the 2nd through last elements of the two arrays, which will be arrays of length N - 1; or comparing the last elements, and then (smaller problem) recursively comparing the subarrays that are the first N - 1 elements of each array; or if you really want good practice, divide each array in half (two smaller problems) and then compare the left halves for equality, and the right halves for equality. To get the smaller arrays, you probably don't want to create new arrays by copying elements--too slow. Instead, you can write a method that takes just the first and last index of the subarray as parameters, and then your recursive method will assume that the portion of the larger array between those boundaries is the smaller subarray it's dealing with. (Or if the first index is the same every time, or the last index is the same every time, you only need to pass one parameter; that's what @alfasin's solution does. It assumes that the subarray it's working with has the bounds n and arrlist1.size()-1.) You also need to figure out when to stop. For the first two approaches, you can stop when your subarrays have length 0. (Or when the subarrays have length 1, you can compare the single elements and not call the method recursively. Your choice.) For the third approach, when you divide subarrays in half, you have to stop with a subarray of length 1--otherwise, if you tried to divide it in half, you'd have one array of l…
answers question: http://stackoverflow.com/q/26478385
score: 0
type: Answer

http://stackoverflow.com/comment/41557911
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26459059
score: 0
has text: @ScaryWombat Many obvious reasons. Main one being scrapers that just iterate over parm and grab all data on the site without loading any pages

file
type: Tag
tags question: http://stackoverflow.com/q/26485866
tags question: http://stackoverflow.com/q/26504146
tags question: http://stackoverflow.com/q/26391485
tags question: http://stackoverflow.com/q/26438213
tags question: http://stackoverflow.com/q/26476982
tags question: http://stackoverflow.com/q/26412344
tags question: http://stackoverflow.com/q/26371931
tags question: http://stackoverflow.com/q/26477744
tags question: http://stackoverflow.com/q/26421559
tags question: http://stackoverflow.com/q/26461312
tag name: file
tags question: http://stackoverflow.com/q/26489122
tags question: http://stackoverflow.com/q/26500275
tags question: http://stackoverflow.com/q/26499380
tags question: http://stackoverflow.com/q/26373260
tags question: http://stackoverflow.com/q/26470861
tags question: http://stackoverflow.com/q/26425002
tags question: http://stackoverflow.com/q/26432274
tags question: http://stackoverflow.com/q/26450113
tags question: http://stackoverflow.com/q/26365646
tags question: http://stackoverflow.com/q/26395098
tags question: http://stackoverflow.com/q/26362602
tags question: http://stackoverflow.com/q/26381075
tags question: http://stackoverflow.com/q/26509880
tags question: http://stackoverflow.com/q/26455340
tags question: http://stackoverflow.com/q/26458056
tags question: http://stackoverflow.com/q/26445271
tags question: http://stackoverflow.com/q/26429280
tags question: http://stackoverflow.com/q/26418361
tags question: http://stackoverflow.com/q/26472213
tags question: http://stackoverflow.com/q/26491389
tags question: http://stackoverflow.com/q/26445633
tags question: http://stackoverflow.com/q/26450095
tags question: http://stackoverflow.com/q/26419841
tags question: http://stackoverflow.com/q/26435106
tags question: http://stackoverflow.com/q/26370025
tags question: http://stackoverflow.com/q/26434905
tags question: http://stackoverflow.com/q/26384090
tags question: http://stackoverflow.com/q/26474527

http://stackoverflow.com/q/26430465
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26430487
has body: I am confused about the in-dependability of the java byte code,I see some where that is said the java byte code is independent of the cpu and the architecture of that, but some times I see that is said it is independent of the platform(Windows,Linux,etc). which one is true? I think they are not the same, because a system with one type of cpu can have different platforms,am I right? can we say that if we have the same attributes of (for exmaple) Linux(the same platform), but on different cpu architectures on different systems,should we use different JVM? please help me about this issue thanks in advance for your answers.
tagged with: java
type: Question
downvote count: 0
has title: Is the java byte code independent of CPU or independent of OS?
answer count: 1
score: 1

http://stackoverflow.com/a/26465161
has body: The 1st "calculation" method takes string as argument where the 2nd one takes integer. When you are passing character 'r', the second calculation method is called as ASCII value of 'r' is passed to the method. That is why it is compiling.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26464938

http://stackoverflow.com/q/26512319
has comment: http://stackoverflow.com/comment/41655176
has body: I have the following results after multiplying the 2d array with the array. 76,0,38,7,32,0,16,18,32,0,16,18,0,0,0,19,16,0,8,23,76,0,38,25 now I want to add the value 2 by 2 and store it in another array(results[]) so it goes like 76 + 0 = 76(results[0]) 38 + 7 = 45(results[1) 32 + 0 = 32(results[2]) 16 + 18 = 34(results[3]) 32 + 0 = 32(results[4]) 16 + 18 = 34(results[5]) 0 + 0 = 0(results[6]) 0 + 19 = 19(results[7]) 16 + 0 = 16(results[8]) 8 + 23 = 31(results[9]) 76 + 0 = 76(results[10]) 38 + 25 = 63(results[11]) but i got this result instead which is wrong 114 7 48 18 48 18 0 19 24 23 114 25 Please help. public static void main(String argv[]) { int matrix[][]= { {4,0}, {2,1}, }; int array[] = {19,7,8,18,8,18,0,19,4,23,19,25}; int result[] = new int[12]; for (int count = 0; count &lt; array.length; count+= matrix.length) { for (int r = 0; r &lt; matrix.length; r++) { for (int c = 0; c &lt; matrix.length; c++) { result[count] += matrix[r][c] * array[count++]; } count -= matrix.length; } } for(int i = 0; i &lt; result.length; i++) { System.out.println(result[i]); } }
type: AnsweredQuestion
has title: sum up values and store it into array
has answer: http://stackoverflow.com/a/26512617
type: Question
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26512963
upvote count: 2
answer count: 2
downvote count: 1
tagged with: arrays
possible better answer: http://stackoverflow.com/a/26512617
has answer: http://stackoverflow.com/a/26512963
has comment: http://stackoverflow.com/comment/41655165
favorite count: 0
has comment: http://stackoverflow.com/comment/41655222

http://stackoverflow.com/q/26361986
has title: @PreAuthorize not working when a secured method is called from another secured method in same class
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/50606153
has answer: http://stackoverflow.com/a/26367358
tagged with: java
downvote count: 0
tagged with: spring-security
favorite count: 0
accepted answer: http://stackoverflow.com/a/26367358
has answer: http://stackoverflow.com/a/67444084
answer count: 4
has answer: http://stackoverflow.com/a/66874897
upvote count: 3
has answer: http://stackoverflow.com/a/50606153
has body: @PreAuthorize public void methodA() { methodB(); } @PreAuthorize public void methodB() { } Here methodA() is interface method and methodB() is called by methodA().
type: Question

http://stackoverflow.com/a/26378959
score: -1
upvote count: 0
type: AcceptedAnswer
type: Answer
has body: I resolved using private Arraylist&lt;User&gt; users; and &lt;collection property="users" javaType="ArrayList"&gt;
accepted answer of: http://stackoverflow.com/q/26364558
answers question: http://stackoverflow.com/q/26364558
downvote count: 1

http://stackoverflow.com/a/26395520
score: 0
type: AcceptedAnswer
type: Answer
has body: Use String.indexOf(...) to get the next "https:// [...]" substring start. Repeat the find the start of the next substring you want. Get the text in between. Repeat until you get a -1, all that remains is your last URL.
accepted answer of: http://stackoverflow.com/q/26394786
answers question: http://stackoverflow.com/q/26394786

http://stackoverflow.com/comment/41573299
has text: one question - why are you setting `chrome.driver` if you are pointing to FireFox?
score: 2
comment on: http://stackoverflow.com/q/26467057
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41603345
type: Comment
comment on: http://stackoverflow.com/q/26484232
type: QuestionComment
has text: thanks for your response. I have added how the image is being selected
score: 0

http://stackoverflow.com/comment/41640732
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26504656
has text: curl_setopt($curl, CURLOPT_FORBID_REUSE, true); curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

http://stackoverflow.com/comment/41394031
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26368451
type: Comment
has text: the sum approach initially was from RC.

http://stackoverflow.com/a/26356490
score: 1
has body: Use an EnumMap - it was intended for just this case. enum Value { VALUE_ONE, ... , VALUE_LAKH } Map&lt;Value, Integer&gt; x = new EnumMap&lt;&gt;(); x.put(Value.VALUE_ONE, 13); Internally uses an array (Integer[]). The only disadvantage is using Integer instead of int. And assumedly java 9 or 10 will introduce primitive generic types (List&lt;int&gt; and such). BTW EnumSet exists too, and is as efficient as BitSet.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26355786

http://stackoverflow.com/comment/41576964
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26468864
has text: sorry but I'm still trying to learn the language :) how do I call on String variable. Thus String ad; But it shows me the same error (The method split (String) is undefined for the type ArrayList <String>)
type: AnswerComment

http://stackoverflow.com/q/26365942
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26366540
has title: Log4j2 - debug-level logging except for Spring
tagged with: java
has comment: http://stackoverflow.com/comment/41390295
tagged with: log4j2
type: Question
has comment: http://stackoverflow.com/comment/41389363
has body: I'd like my application to run at Debug level, except for Spring, which is producing a huge amount of logging statements, which makes it hard to read through the logs. I've currently configured my Log4j2 file like this: <PatternLayout pattern="%d{ISO8601} - %-5level [%t] %C %M %m%n" /> <TimeBasedTriggeringPolicy /> <SizeBasedTriggeringPolicy size="15 MB"/> <AppenderRef ref="systemLog" /> <AppenderRef ref="systemAsyncAppender" /> <AppenderRef ref="systemAsyncAppender" /> I thought that setting up the SpringLogger would set Spring to only run at ERROR level and, and write to the same log as everything else, but I'm still seeing full Spring DEBUG output. I have vague memories of being able to do this very easily with the old log4j.properties files (I think it was as simple as log4j.category.org.springframework=ERROR), but I'm not sure how to do this with Log4J2. (Using Log4J2 2.0.2, spring 3.2.11)
accepted answer: http://stackoverflow.com/a/26366540
downvote count: 0
answer count: 1
tagged with: log4j
favorite count: 0
upvote count: 2
tagged with: spring

http://stackoverflow.com/q/26364634
favorite count: 0
has answer: http://stackoverflow.com/a/26365001
type: AnsweredQuestion
has body: When debugging in IntelliJ Idea if I put a break point on a method signature it warns me about slow performance. However, what I do instead is just put it on the first executable line of code in the function and it works fine for my purposes. My understanding is that if I see the function I will for sure see right before the first line of executable code inside the function but IntelliJ disagrees. What differences would I expect to see in with these two different debug methods?
tagged with: java
has title: Difference between breakpoint on method signature vs breakpoint on first line in method
accepted answer: http://stackoverflow.com/a/26365001
type: Question
tagged with: debugging
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/26364977
has answer: http://stackoverflow.com/a/26364977
score: 4
upvote count: 4
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/41381068
type: QuestionComment
has text: Pack it as an executable jar?!
score: 2
comment on: http://stackoverflow.com/q/26361625
type: Comment

http://stackoverflow.com/comment/41487858
type: Comment
comment on: http://stackoverflow.com/a/26420752
score: 0
type: AnswerComment
has text: (Note that you can change from `Collections.sort` to `Arrays.sort` if you're working with arrays and not lists.)

http://stackoverflow.com/q/26461662
has comment: http://stackoverflow.com/comment/41563124
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/26464654
downvote count: 0
has answer: http://stackoverflow.com/a/26464654
favorite count: 0
has title: Generating a receipt dynamically
has answer: http://stackoverflow.com/a/26464021
has comment: http://stackoverflow.com/comment/41562266
has comment: http://stackoverflow.com/comment/41563435
tagged with: swing
type: AnsweredQuestion
tagged with: java
has body: final JFrame frame = new JFrame("Bill"); frame.getContentPane().setBackground(Color.WHITE); JLabel jlabel = new JLabel(""); jlabel.setFont(new Font("Serif", Font.PLAIN, 12)); frame.add(jlabel); frame.validate(); frame.repaint(); jlabel = new JLabel("-----------BILL-----------"); jlabel.setFont(new Font("Serif", Font.PLAIN, 20)); frame.add(jlabel); frame.validate(); frame.repaint(); jlabel = new JLabel(""); jlabel.setFont(new Font("Serif", Font.PLAIN, 12)); frame.add(jlabel); frame.validate(); frame.repaint(); frame.setLayout(new GridLayout(0, 3)); try { String sql = "SELECT * FROM order_detail"; rs = st.executeQuery(sql); frame.add(new JLabel("Item")); frame.validate(); frame.repaint(); frame.add(new JLabel("Quantity")); frame.validate(); frame.repaint(); frame.add(new JLabel("Amount")); frame.validate(); frame.repaint(); while (rs.next()) { String printLbl = rs.getString("Item"); frame.add(new JLabel(printLbl)); frame.validate(); frame.repaint(); printLbl =""+rs.getInt("Quantity"); frame.add(new JLabel(printLbl)); frame.validate(); frame.repaint(); printLbl = ""+rs.getInt("Cost"); frame.add(new JLabel(printLbl)); frame.validate(); frame.repaint(); } frame.add(new JLabel("")); frame.validate(); frame.repaint(); frame.add(new JLabel("Total")); frame.validate(); frame.repaint(); frame.add(new JLabel(jLabel82.getText())); frame.validate(); frame.repaint(); } catch (SQLException e) { System.out.println(e.getMessage()); } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(700, 400); frame.setVisible(true); PrinterJob job = PrinterJob.getPrinterJob(); job.setJobName("frame"); job.setPrintable(new Printable() { public int print(Graphics pg, PageFormat pf, int pageNum) { if (pageNum &gt; 0) { return Printable.NO_SUCH_PAGE; } Graphics2D g2 = (Graphics2D) pg; g2.translate(pf.getImageableX(), pf.getImageableY()); frame.paint(g2); return Printable.PAGE_EXISTS; } }); boolean ok = job.printDialog(); if (ok) { try { job.print(); } catch (PrinterException ex) { } i…
has comment: http://stackoverflow.com/comment/41563381
accepted answer: http://stackoverflow.com/a/26464021
type: Question
has comment: http://stackoverflow.com/comment/41565294
score: 4
tagged with: awt
has comment: http://stackoverflow.com/comment/41577670

http://stackoverflow.com/comment/58474849
has text: This information is so much needed by developers. Could you please add this piece of information into the JavaDoc API documentation (e.g. by just adding @ThreadSafe)?
comment on: http://stackoverflow.com/a/26381559
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/26400868
type: UnansweredQuestion
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/41451896
has answer: http://stackoverflow.com/a/26401081
type: Question
has body: The situation I'm doing some refactoring on some code I'm working on. I have a Collection of beans (retrieve from a database with Hibernate but it's not relevant here). These beans look like this (the model has been simplified for the sake of the demonstration) : public class MyBean() { private int id; private String key; private String label; // Getters and setters } They are stored in a Map&lt;Integer, MyBean&gt; where the key is the MyBean id. On the other side, I have an enum, coming from an outside lib, not editable. It looks like this : public enum ExternalEnum { FIRST_VALUE("FirstValue"), SECOND_VALUE("SecondValue"), THIRD_VALUE("ThirdValue"); // Constructor and getter } Currently, basically, the binding is done like this : Map&lt;Integer, MyBean&gt; myBeans = retrieveFromDBThroughDAO(); ExternalEnum eeValue = fetchValueFromSomewhere(); switch (eeValue) { case FIRST_VALUE: return myBeans.get(0); case SECOND_VALUE: return myBeans.get(1); case THIRD_VALUE: return myBeans.get(2); default: // In case of an unexpected modification of the enum return myBeans.get(0); // I know, case FIRST_VALUE is useless but it's for being clearer } Issues here The binding is hard coded, every modification implies a new build It's kind of ugly, redundant I know it could be done in a better way My thinking I was thinking about outsourcing the binding in a properties file like my.enum.binding.first_value=0 my.enum.binding.second_value=1 my.enum.binding.third_value=2 my.enum.binding.default=0 And read it in a generic way. My question What do you think of my solution ? Do you think it could be improve in an other way ? Thanks guys.
score: 0
tagged with: binding
answer count: 1
has title: Binding an enum with a Collection, in a generic way
has comment: http://stackoverflow.com/comment/41451739

http://stackoverflow.com/comment/41608265
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26486889
has text: What do you mean "pre-fetch"?
score: 0

http://stackoverflow.com/a/26487833
has comment: http://stackoverflow.com/comment/41611785
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41611192
score: 2
has body: With AffineTransformOp class: BufferedImage original; //Instatiate with desired image. BufferedImage transformed: //Used to store transformed image. AffineTransform at; //Transformations needed. AffineTransformOp affineTransformOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); affineTransformOp.filter(original, transformed );
answers question: http://stackoverflow.com/q/26487614
accepted answer of: http://stackoverflow.com/q/26487614
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26465841
has comment: http://stackoverflow.com/comment/41574059
score: 0
answers question: http://stackoverflow.com/q/26465804
type: Answer
has body: Use it without session: var min="${timLim}";
has comment: http://stackoverflow.com/comment/41569529

http://stackoverflow.com/a/26364583
type: Answer
has body: I think the position of the carat changes, but it doesn't actually scroll. Try this (ugly hack...) instead of the binding and the current listener you have: updateTextAreaTask.messageProperty().addListener(new ChangeListener&lt;String&gt;() { @Override public void changed(ObservableValue&lt;? extends String&gt; obs, String oldMessage, String newMessage) { taProgressText.setText(newMessage); ScrollBar scrollBar = (ScrollBar) taProgressText.lookup(".scroll-bar:vertical"); if (scrollBar != null) { scrollBar.setValue(scrollBar.getMax()); } } });
has comment: http://stackoverflow.com/comment/41462491
has comment: http://stackoverflow.com/comment/41461310
answers question: http://stackoverflow.com/q/26361683
score: 0

http://stackoverflow.com/comment/41649720
has text: I think this wont return the rows for the description since you searh query would look like select * from product where description like '%Inspiron 5720 i7%', this wont return any results for description because Inspiron 5720 does not exist in the description column.
score: 0
comment on: http://stackoverflow.com/q/26509672
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41635615
type: QuestionComment
comment on: http://stackoverflow.com/q/26501684
score: 0
has text: Please copy this entire code and run
type: Comment

http://stackoverflow.com/q/26456992
has comment: http://stackoverflow.com/comment/41554345
has answer: http://stackoverflow.com/a/26457086
downvote count: 1
has title: How can I access a variable in an inner class without being final in java?
tagged with: java
score: -1
type: Question
linked to: http://stackoverflow.com/q/5107158
answer count: 2
has comment: http://stackoverflow.com/comment/41554520
upvote count: 0
tagged with: variables
has comment: http://stackoverflow.com/comment/41554747
favorite count: 0
tagged with: class
has answer: http://stackoverflow.com/a/26457017
has comment: http://stackoverflow.com/comment/41554507
has body: I am trying to access in an inner class (actionListener) a variable that changes value in the main class. I can't make it final, because it changes values before the actionListener triggered. Have anyone met the same problem? Thank you public class MyClass{ private int counter = 0; public void myMethod(){ //read from file //counter = number of lines of the file read JButton button = new JButton ("My button"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("lines = " +counter); } }); } }
type: UnansweredQuestion

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/26373809
type: Tag

http://stackoverflow.com/q/26435380
linked to: http://stackoverflow.com/q/23026980
possible better answer: http://stackoverflow.com/a/26435662
accepted answer: http://stackoverflow.com/a/26435387
has title: How do I use a Scanner only once then get rid of it?
favorite count: 0
has answer: http://stackoverflow.com/a/26436046
has answer: http://stackoverflow.com/a/26435662
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
tagged with: resource-leak
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26435387
has body: I have a program in java, in which I have to get user input, however, I only need to get the user input once, after that, I do not need a scanner anymore. Doing the following: int userInput = new Scanner(System.in).nextInt(); Gives me a Resource Leak warning, saying that &lt;unassigned closeable value&gt; is never closed. Is there another way I can use a Scanner only once, and get rid of it afterwards so there's no Resource Leak? Maybe something similar to C#'s using statement.
score: 0
answer count: 3

http://stackoverflow.com/a/26485221
answers question: http://stackoverflow.com/q/26484440
score: 2
downvote count: 0
has body: Instead of the authentication-failure-url, you need to use authentication-failure-handler-ref and refer the failure handler bean which you need to create and map different urls (or different params to the same url) to different type of exceptions. &lt;form-login login-page="/login" default-target-url="/index" always-use-default-target="true" authentication-failure-handler-ref="customFailureHandler" username-parameter="j_username" password-parameter="j_password" /&gt; &lt;beans:bean id="customFailureHandler" class="org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler"&gt; &lt;beans:property name="exceptionMappings"&gt; &lt;beans:props&gt; &lt;beans:prop key="org.springframework.security.authentication.BadCredentialsException"&gt;/url1&lt;/beans:prop&gt; &lt;beans:prop key="org.springframework.security.authentication.AuthenticationServiceException"&gt;/url2&lt;/beans:prop&gt; &lt;beans:prop key="org.springframework.secuirty.authentication.DisabledException"&gt;/url3&lt;/beans:prop&gt; &lt;/beans:props&gt; &lt;/beans:property&gt; &lt;beans:property name="defaultFailureUrl" value="/url4" /&gt; &lt;/beans:bean&gt; There are bunch of other exceptions, mentioned in the docs. Please refer the doc EDIT: There is an exception for the same, SessionAuthenticationException is thrown typically because the same user has exceeded the number of sessions they are allowed to have concurrent. But this is at container level only and won't work if you have multiple containers. &lt;security:session-management session-authentication-strategy-ref="sas"/&gt; &lt;bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl" /&gt; &lt;bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy" &gt; &lt;constructor-arg name="sessionRegistry" ref="sessionRegistry" /&gt; &lt;property name="maximumSessions" value="2" /&gt; &lt;/bean&gt;
has comment: http://stackoverflow.com/comment/41637188
has comment: http://stackoverflow.com/comment/41612328
type: Answer
has comment: http://stackoverflow.com/comment/41608206
upvote count: 2

http://stackoverflow.com/q/26418355
score: 1
tagged with: xpath
tagged with: xjc
has comment: http://stackoverflow.com/comment/41483792
has comment: http://stackoverflow.com/comment/41484524
upvote count: 1
answer count: 1
has title: XJC [ERROR] XPath evaluation of "//*[local-name()='schema']" results in empty target node
accepted answer: http://stackoverflow.com/a/26419003
has comment: http://stackoverflow.com/comment/41484542
tagged with: java
has body: I am new to XJC. I'm attempting to consume a WSDL and generate binding classes with the XJC command and I got the following error: C:\jaxb&gt;xjc -verbose -b c:\jaxb\bindings-wsdl.xjb -wsdl c:\jaxb\BioMetScrnSvc.wsdl parsing a schema... [ERROR] XPath evaluation of "//*[local-name()='schema']" results in empty target node line 8 of file:/C:/jaxb/bindings-wsdl.xjb Failed to parse a schema. My binding file is as follows: &lt;jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:impl="http://www.openuri.org/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:intf="http://www.openuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;jaxb:bindings node="//*[local-name()='schema']"&gt; &lt;jaxb:globalBindings generateElementProperty="false"/&gt; &lt;/jaxb:bindings&gt; &lt;/jaxb:bindings&gt; The WSDL provided to me is something as follows: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions targetNamespace="http://www.openuri.org/" xmlns:impl="http://www.openuri.org/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:intf="http://www.openuri.org/"&gt; &lt;wsdl:types&gt; &lt;schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/" xmlns="http://www.w3.org/2001/XMLSchema"&gt; ... From all the suggestions I have read from this site, I have included the necessary namespaces into the binding file to no avail. I have tested the Xpath and it is correct. If I don't have a binding file, a JAXBElement is generated instead of a String. Understood it is because of minOccurs and nillable occurring together. Regards, Wes
tagged with: jaxb
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26419003
tagged with: wsdl

http://stackoverflow.com/comment/41488197
type: Comment
comment on: http://stackoverflow.com/a/26420938
score: 0
type: AnswerComment
has text: Yes, I can use this approach but I do not want to work with JDBC (`Connection`, `Statement`, `ResultSet`, ...) directly. It is useless to use `JdbcTemplate` this way. The thing is that I would like to use `JdbcTemplate`'s interface to access data.

http://stackoverflow.com/comment/41597634
type: AnswerComment
score: 0
has text: Concrete sense, gee.. Ok, they're often asking things like that at job interviews
type: Comment
comment on: http://stackoverflow.com/a/26479331

http://stackoverflow.com/comment/41639491
type: AnswerComment
type: Comment
has text: I've found this documentation also in Hibernate: https://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html#d5e2610 and, if I'm not wrong, it seems to support the insert into select even if it effectively does not work
comment on: http://stackoverflow.com/a/26428514
score: 1

http://stackoverflow.com/comment/41489938
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26421851
has text: As to 2, you should also worry if one thread modifies the number (the gui thread in this question), and other threads use the number. The numbers passed into doSum() are already subject to a race condition.

http://stackoverflow.com/comment/41576901
score: 0
type: AnswerComment
type: Comment
has text: yes it got saved in disk(D:) but my issue is same as http://stackoverflow.com/questions/16407156/why-does-generated-pdf-display-properly-in-internet-explorer-but-not-in-firefox
comment on: http://stackoverflow.com/a/26468848

http://stackoverflow.com/comment/41379798
has text: so when i added rows and coloums to new JTextArea(); (see code above) it looked like this: http://oi58.tinypic.com/21jx34h.jpg
score: 0
comment on: http://stackoverflow.com/q/26360314
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26445238
upvote count: 1
has comment: http://stackoverflow.com/comment/41533064
downvote count: 1
tagged with: string
has answer: http://stackoverflow.com/a/26445369
favorite count: 0
has body: So I just have a quick little issue int pickmeup = 0; while (true) { pickmeup = scanner.nextInt(); if (pickmeup == 1) {System.out.println ("you entered 1");} if(pickmeup == 2) {System.out.println ("you entered 2");} { break; } System.out.println ("Invalid code"); Now when I run this code it all works fine however in regards to the strings but it seems as though the loop doesn't work all that well when I enter '3', as it doesn't return the string 'Invalid code'. If I were to get rid of the strings after both if statements, then it works perfectly fine. What exactly am I doing wrong? Are there other ways to automatically have strings output?
has answer: http://stackoverflow.com/a/26445325
type: UnansweredQuestion
tagged with: java
has title: How to automatically output strings in loops
tagged with: loops
has comment: http://stackoverflow.com/comment/41533094
has comment: http://stackoverflow.com/comment/41533196
type: Question
has comment: http://stackoverflow.com/comment/41533077
has comment: http://stackoverflow.com/comment/41533138
has comment: http://stackoverflow.com/comment/41533070
has comment: http://stackoverflow.com/comment/41533270
score: 0
answer count: 2

http://stackoverflow.com/q/26364459
upvote count: 1
type: Question
has body: I have two separate 2D arrays. Each contains smaller arrays that are pairs of int values. The first 2D array is the input information, the other 2D array contains values that are to be matched or searched against. For example, I the input array is: {{0, 1}, {0, 2}, {2, 1}, {1, 0}, {0,1}} The second, reference array is all possible combinations of values from the first: {{0, 0}, {0,1}, {0,2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}} I want to take the input and determine if subarray i is equal to any of the reference subarrays. I want the results to be in a one-dimensional array the same size as the reference, with a count for the number of times each subarray was found in the input array. So the resulting array should look like this: {0, 2, 1, 1, 0, 0, 0, 1, 0} This is my attempt at the code: int[] ResultArray = new int[ReferenceArray.Length]; for (int i = 0; i &lt; ReferenceArray.Length; i++) { for (int j = 0; j &lt; InputArray.length; j++) { if (InputArray[j] == RefereenceArray[i]) ResultArray[i]++; } } For some reason, this compiles but nothing is added at all to ResultArray. When I tried to use Arrays.equal(InputArray[j], ReferenceArray[i]) instead, I get an error in compiling. Any idea what has gone wrong? I had a similar block of code that worked fine, and can't figure out what the problem is here.
tagged with: arrays
has comment: http://stackoverflow.com/comment/41386655
linked to: http://stackoverflow.com/q/18310198
has title: Comparing Two Arrays within separate 2D arrays
answer count: 1
downvote count: 0
favorite count: 0
tagged with: equals
tagged with: multidimensional-array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26364550
score: 1
tagged with: java

spring-boot
tags question: http://stackoverflow.com/q/26367322
tags question: http://stackoverflow.com/q/26406982
type: Tag
tags question: http://stackoverflow.com/q/26366806
tags question: http://stackoverflow.com/q/26385533
tags question: http://stackoverflow.com/q/26483585
tags question: http://stackoverflow.com/q/26465593
tags question: http://stackoverflow.com/q/26490967
tags question: http://stackoverflow.com/q/26414419
tags question: http://stackoverflow.com/q/26461697
tags question: http://stackoverflow.com/q/26370743
tags question: http://stackoverflow.com/q/26463393
tags question: http://stackoverflow.com/q/26393063
tags question: http://stackoverflow.com/q/26435836
tags question: http://stackoverflow.com/q/26473381
tags question: http://stackoverflow.com/q/26420214
tag name: spring-boot
tags question: http://stackoverflow.com/q/26369233
tags question: http://stackoverflow.com/q/26436434
tags question: http://stackoverflow.com/q/26509501
tags question: http://stackoverflow.com/q/26498278

http://stackoverflow.com/q/26510249
has body: import java.util.*; import java.applet.*; import java.util.Scanner; public class Game { public static void main(String[] args){ System.out.println("I am ready to play!"); Scanner input = new Scanner(System.in); System.out.println("What's your age?"); String userinput = input.nextLine(); if (userinput &lt; 13){ System.out.println("You are allowed to play at your own risk"); } else System.out.println("Play On!"); } System.out.println("You are at an Iggy concert, and you hear this lyric 'Are you ready?, start running.'"); System.out.println("Suddenly, Iggy stops and says, 'Who wants to race me at running?'"); Scanner input = new Scanner(System.in); System.out.println("Do you want to race Iggy on stage?"); String userinput = input.nextLine(); if (userinput == yes){ "You and Iggy start racing. It's neck and neck! You win by a shoelace!"); } else System.out.println("Oh no! Iggy shakes his head and sings 'I set a pace, so I can race without pacing.'"); var feedback = prompt("Rate your game out of 10"); if(feedback &gt; 8) { console.log("Thank you! You should race again at the next concert!"); } else { console.log("I'll keep practicing coding and racing."); } } } This is an assignment for a Java 1 class in high school and I have no idea how to fix all of this. I realize that there are a ton of errors and this is pretty irrelevant to anyone but me but I want to actually learn java and this class isn't teaching me anything, so any help would be greatly appreciated.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41650637
has comment: http://stackoverflow.com/comment/41650643
has title: Debug Exercise for Java 1
upvote count: 0
tagged with: java
type: Question
tagged with: debugging
score: -2
downvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26510409

http://stackoverflow.com/q/26427212
tagged with: java
has comment: http://stackoverflow.com/comment/84532455
type: Question
tagged with: actionlistener
has title: How to use ActionListener when the button function is in another class
has answer: http://stackoverflow.com/a/26427827
has answer: http://stackoverflow.com/a/26446890
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/48766053
type: UnansweredQuestion
has body: I have three different classes: Main, WindowFrameDimetnions, and ValidationOfNumbers. Main – Calls WindowFrameDimetnions. It is the main class WindowFrameDimetnions – Calls (well I am trying to call ) ValidationOfNumbers. This is the class that creates the frame for the program, the pane, the label for the box, and the button. ValidationOfNumbers – is the one that does all the calculations for number validations. Basically this class validates that the numbers typed by the use are within the range of 1..100,000. Goal: The goal is to connect WindowFrameDimetnions with ValidationOfNumbers by using an ActionListener. package BlueBlueMainFiles; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class WindowFrameDimentions extends JFrame{ final static int WINDOW_WITH = 950;//Window with in pixel final static int WINDOW_HEIGH = 650;//Window height in pixel static JPanel panel;//use to reference the panel static JLabel messageLabel;//use to reference the label static JTextField textField;//use to reference the text field static JButton calcButton;//use to reference the button public WindowFrameDimentions() { // TODO Auto-generated constructor stub } public static void windowFrameDimentions(){ //create a new window JFrame window = new JFrame(); //add a name to the window window.setTitle("BLUE BLUE"); //set the size of the window window.setSize(WINDOW_WITH, WINDOW_HEIGH); //specify what happens when the close button is pressed window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //BUILD THE PANEL AND ADD IT TO THE FRAME buildPanel(); //ADD THE PANEL TO THE FRAMES CONTENT PANE window.add(panel); //Display the window window.setVisible(true); } public static void buildPanel(){ //create a label to display instructions messageLabel = new JLabel("Enter a Number from 1..100,000"); //create a text field of 10 characters wide textField = new JTextField(10); //create panel calcButton = ne…
tagged with: swing

http://stackoverflow.com/a/26511849
type: Answer
upvote count: 3
score: 3
has body: To solve the question asked: you simply need to initialize x, which is currently uninitialized. To initialize a variable, you have to assign it a value. For example x = 0;. However, that still is not going to cause your program to print the correct result. One way to accomplish what you actually want to do is iterate the numbers between 98 and 266 print them when they are divisible by 7. for(int y = 98; y &lt;= 266; ++y) if (y % 7 == 0) System.out.println(y); alternately, you can start at 98 (14 * 7) and then increment it by 7, printing as you go. int y = 98; while(y &lt;= 266) { System.out.println(y); y+=7 }
downvote count: 0
answers question: http://stackoverflow.com/q/26511675

http://stackoverflow.com/comment/41593907
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26478482
has text: @ElliottFrisch thanks for the good catch: it was supposed to be `arrlist1.get(n) == arrlist2.get(n)`. Fixed.

http://stackoverflow.com/q/26422199
has comment: http://stackoverflow.com/comment/41490596
has comment: http://stackoverflow.com/comment/41490627
has comment: http://stackoverflow.com/comment/41490286
type: AnsweredQuestion
has body: I'm trying to create an android app that communicate with Bluetooth low energy module. I am able to connect to module, read data and so on. But the problem is i do not know how to update textview from class that extends Service (the one in which whole connection to BLE is going on). I know there is like BILLION or even more posts like these, but believe me i tried. Here is MainActivity: http://pastebin.com/6yaP0dYM and here is a class that extends Service: http://pastebin.com/cYuAUina If someone could provide me some tips to solve my issue that would be more than great!
possible better answer: http://stackoverflow.com/a/26423167
tagged with: java
has answer: http://stackoverflow.com/a/26423167
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/14695537
has title: Update textview of MainActivity from class that extends Service
tagged with: bluetooth
score: 0
tagged with: textview
has comment: http://stackoverflow.com/comment/41490475
has answer: http://stackoverflow.com/a/26423063
accepted answer: http://stackoverflow.com/a/26423063
has comment: http://stackoverflow.com/comment/41490730
tagged with: android

http://stackoverflow.com/q/26456674
has title: Java: New enum which is subset of an old enum
tagged with: enums
has comment: http://stackoverflow.com/comment/41553791
upvote count: 9
score: 9
has answer: http://stackoverflow.com/a/26456826
answer count: 3
has comment: http://stackoverflow.com/comment/41553828
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/65369010
has comment: http://stackoverflow.com/comment/41553853
has answer: http://stackoverflow.com/a/26457433
linked to: http://stackoverflow.com/q/34871889
tagged with: java
has answer: http://stackoverflow.com/a/26457040
has body: In Java, is there any way to define a new enum from an existing enum? I want the following capabilities. public enum A{1, 2, 3, 4, 5, 6, 7, 8, 9}; public enum B{1, 2, 3, 4}; public enum C{3, 4, 5, 6, 7}; 1, 2, 3 and all must be identical, i.e, A.1 == B.1 = true B.4 == C.4 = true A real life example would be DAYS, WEEKDAYS, WEEKENDDAYS, LECTUREDAYS, PARTYDAYS and etc.
type: Question

http://stackoverflow.com/a/27625234
score: 0
has body: What I wanted to do was to validate the login form (for special signs only that are not allowed) but I ended up just letting spring security handle it. Thanks for your suggestions though.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26443075
type: Answer
answers question: http://stackoverflow.com/q/26443075

http://stackoverflow.com/q/26383704
downvote count: 0
type: UnansweredQuestion
tagged with: jackson
has answer: http://stackoverflow.com/a/26412706
has comment: http://stackoverflow.com/comment/41423230
has comment: http://stackoverflow.com/comment/41452150
favorite count: 0
linked to: http://stackoverflow.com/q/4515676
type: Question
upvote count: 2
answer count: 1
has title: Spring MVC jackson and order
tagged with: spring-mvc
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I need to return a list of ordered String from an ajax Call my DTO has an attributes sizes which is a list of String values , eg : 36,38,40/46, 46, S, XS, M, L my comparator and sorting algorithm work well , the list of sizes is well sorted until its converted to json format, i found a totally different order . @ResponseBody @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/crossell", method = RequestMethod.GET) public ProductData cosselProductDetail(@PathVariable("productCode") final String productCode, final HttpServletResponse response) throws CMSItemNotFoundException, UnsupportedEncodingException { Collections.sort(sortedSizes,mycomparator); productData.setSizes(sortedSizes); return productData; } the spring config is the default configuration no thing added or modified . &lt;!-- activates annotation driven binding --&gt; &lt;mvc:annotation-driven ignoreDefaultModelOnRedirect="true" validator="validator"&gt; &lt;mvc:message-converters&gt; &lt;bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/&gt; &lt;bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/&gt; &lt;bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /&gt; &lt;/mvc:message-converters&gt; &lt;/mvc:annotation-driven&gt; after searching all around , all what i found is the serialisation key config : SORT_PROPERTIES_ALPHABETICALLY , which order the properties not the values. Thanks
has comment: http://stackoverflow.com/comment/41434506
score: 2
has comment: http://stackoverflow.com/comment/41422236

http://stackoverflow.com/q/26388031
answer count: 1
upvote count: 1
tagged with: java-7
tagged with: macos
has body: I am seeing this in OS X using Java 7 (update 67) when I type Command-equals (⌘=). Here is an example: public class Test implements KeyEventDispatcher { public Test() { JFrame frame = new JFrame(); frame.setSize(200, 200); frame.setVisible(true); } public static void main(String[] args) { KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new Test()); } @Override public boolean dispatchKeyEvent(KeyEvent ke) { System.out.println(ke); return false; } } The output I see for ⌘=. Note, the three KEY_PRESSED events, all for =, with no KEY_RELEASED event for =. Also note that the second one indicates a keyChar of + as well as the complete lack of KEY_TYPED events. java.awt.event.KeyEvent[KEY_PRESSED,keyCode=157,keyText=⌘,keyChar=Undefined keyChar,modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_RIGHT,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on frame0 java.awt.event.KeyEvent[KEY_PRESSED,keyCode=61,keyText==,keyChar='=',modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on frame0 java.awt.event.KeyEvent[KEY_PRESSED,keyCode=61,keyText==,keyChar='+',modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on frame0 java.awt.event.KeyEvent[KEY_PRESSED,keyCode=61,keyText==,keyChar='=',modifiers=⌘,extModifiers=⌘,keyLocation=KEY_LOCATION_STANDARD,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on frame0 java.awt.event.KeyEvent[KEY_RELEASED,keyCode=157,keyText=⌘,keyChar=Undefined keyChar,keyLocation=KEY_LOCATION_RIGHT,rawCode=0,primaryLevelUnicode=0,scancode=0,extendedKeyCode=0x0] on frame0 The multiple events do propagate to the listener or binding or menu accelerator, which is how I originally discovered the issue. For comparison, here's the output for ⌘-. No multiple events, but still no KEY_TYPED events either. java.awt.event.KeyEvent[KEY_PRESSED,keyCode=157,keyText=⌘,keyC…
favorite count: 0
downvote count: 0
has title: Multiple KEY_PRESSED events for single key press (equals '=' key)
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: keylistener
has answer: http://stackoverflow.com/a/26388691
accepted answer: http://stackoverflow.com/a/26388691
type: Question

http://stackoverflow.com/q/26393347
type: UnansweredQuestion
tagged with: compare
has comment: http://stackoverflow.com/comment/41507446
has body: So I need to make a program that functions as a mastermind game with a string of numbers. This particular method tells the guesser how many numbers, that they user guessed, are in the actual secret number. I have the code to pass a test involving a guess with only 5 unique numbers, but I cant determine how to count a guess with more than one of a number. For example, the secret number being 12345 and the guess being 11111 the method should return 1, however it's returning 5. Any suggestions? This is what I have so far: public int uniqueDigitsFound(String secretNumber, String guess) { int counter = 0; int i = 0; while(i&lt;=secretNumber.length()-1){ if(guess.charAt(i)==secretNumber.charAt(0)){ counter++; } if(guess.charAt(i)==secretNumber.charAt(1)){ counter++; } if(guess.charAt(i)==secretNumber.charAt(2)){ counter++; } if(guess.charAt(i)==secretNumber.charAt(3)){ counter++; } if(guess.charAt(i)==secretNumber.charAt(4)){ counter++; } i++; } return counter; }
answer count: 4
has title: Omitting Duplicates
has answer: http://stackoverflow.com/a/26393721
type: Question
has answer: http://stackoverflow.com/a/26393724
tagged with: java
has answer: http://stackoverflow.com/a/26393429
score: 0
tagged with: string
has answer: http://stackoverflow.com/a/26393681

http://stackoverflow.com/comment/41648698
type: Comment
has text: Then use the second solution. Concatenate your string and split it on the other part. It's easier than you think :)
type: AnswerComment
comment on: http://stackoverflow.com/a/26508987
score: 0

http://stackoverflow.com/q/26414762
linked to: http://stackoverflow.com/q/26413406
has comment: http://stackoverflow.com/comment/41477392
has comment: http://stackoverflow.com/comment/41478168
has comment: http://stackoverflow.com/comment/41477333
has answer: http://stackoverflow.com/a/26414955
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41477946
has comment: http://stackoverflow.com/comment/41477912
tagged with: java
has comment: http://stackoverflow.com/comment/41477334
has comment: http://stackoverflow.com/comment/41478525
type: Question
has answer: http://stackoverflow.com/a/26415066
has answer: http://stackoverflow.com/a/26415085
has comment: http://stackoverflow.com/comment/41477412
has comment: http://stackoverflow.com/comment/41477411
has comment: http://stackoverflow.com/comment/41478087
has comment: http://stackoverflow.com/comment/41478015
tagged with: variables
has comment: http://stackoverflow.com/comment/41477470
possible better answer: http://stackoverflow.com/a/26414955
score: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/41477633
has answer: http://stackoverflow.com/a/26414933
has title: Checking if a letter == a specified letter in Java
has body: I am trying to perform a check to make sure the letter typed by the user is between A and E. I have tried several different ways, but nothing seems to work. Any help would be appreciated. The main problem is, it only checks once. After it tells me I need to enter a letter between A and E, and I put g, it allows the program to continue running afterwards. System.out.println("Please enter a letter indicating your tax category: A is no tax deduction, B is 10% of gross pay, \nC is 20% of gross pay, D is 29% of gross pay, E is 35% of gross pay"); //use ASCII of letters to compare int A_ASCII = (int)'A'; int E_ASCII = (int)'E'; int ASCIIletter = 0; // ask user for letter letter = in.next().charAt(0); // convert letter to uppercase and find ASCII value if(Character.isLetter(letter)){ letter = Character.toUpperCase(letter); ASCIIletter = (int) letter; while (ASCIIletter&gt;=A_ASCII&amp;&amp;ASCIIletter&lt;=E_ASCII) { if(ASCIIletter&gt;=A_ASCII&amp;&amp;ASCIIletter&lt;=E_ASCII){ if (ASCIIletter=='A'||ASCIIletter=='a'){ letter = letter; gross = gross; } else if (ASCIIletter=='B'||ASCIIletter=='b'){ letter = letter; deduct = (gross*0.1); tax = gross - deduct; } else if (ASCIIletter=='C'||ASCIIletter=='c'){ letter = letter; deduct = (gross*0.2); tax = gross - deduct; } else if (ASCIIletter=='D'||ASCIIletter=='d'){ letter = letter; deduct = (gross*0.29); tax = gross - deduct; } else if (ASCIIletter=='E'||ASCIIletter=='e'){ letter = letter; deduct = (gross*0.35); tax = gross - deduct; } } else { System.out.println("You must enter a letter between A and E."); letter = in.next().charAt(0); } }
has comment: http://stackoverflow.com/comment/41478143
accepted answer: http://stackoverflow.com/a/26414933
has comment: http://stackoverflow.com/comment/41477394
answer count: 4
has comment: http://stackoverflow.com/comment/41477669
has comment: http://stackoverflow.com/comment/41477561

http://stackoverflow.com/a/26424624
has body: Independent of JAX-RS: Annotations in Java are compile time constants so they can't be changed at runtime. I don't know your use case but possible ways to change the values of the annotations are: Replacing variables before compilation, e.g. through a maven plugin. Adding the @Path annotations dynamically like described here. Using one generic ResourceClass mapped to /* which decides which subresource should be returned. No comment if one of these approaches makes sense as I don't know why you want to change them. As the URI names a resource I don't see any reason to change it. See also: Cool URIs don't change Update: JAX_RS_SPEC-60 requests "A Dynamic way to register JAX-RS resources (not based on annotations)".
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26403934

http://stackoverflow.com/comment/41481809
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26413910
has text: for `1` insert operation, avg case is `O(lgn)` and worst case is `O(n)`. For `n` insert operations, avg case is `O(nlgn)` and worst case is `O(n^2)`. But usually people refer to complexity of 1 insert operation.
score: 0

http://stackoverflow.com/comment/41559855
score: 1
comment on: http://stackoverflow.com/q/26453661
type: Comment
type: QuestionComment
has text: If you only have **1** element, you can only index **0**, since the array range is **0, ..., (n - 1)**

http://stackoverflow.com/comment/41377366
type: Comment
has text: @user1883212 as Anthony said this is exactly what you need, you will access "component_1" by calling `((MultipartFile)me.getValue()).getName()`. No more no less.
comment on: http://stackoverflow.com/a/26358892
score: 0
type: AnswerComment

http://stackoverflow.com/a/26468921
type: Answer
has comment: http://stackoverflow.com/comment/41579201
answers question: http://stackoverflow.com/q/26468348
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/41579069
accepted answer of: http://stackoverflow.com/q/26468348
has comment: http://stackoverflow.com/comment/41579013
type: AcceptedAnswer
downvote count: 0
has body: You can create a parse tree walker by implementing the ParseTreeVisitor interface. For ease of use, you can specify Antlr to generate a base visitor when compiling the grammar (in Antlrworks, Run-&gt;Generate Recognizer-&gt;Next-&gt;Generate Visitor-&gt;Next-&gt;Finish). The base visitor will be called MyGrammarBaseVisitor. Note that the visitor has a generic type T, which every single visit method should return. I recommend using Void for manual manipulation or String for ease of use during code generation. After you extend the base visitor (I'll assume here we're dealing with String), you need to override the visit methods. These methods are named after the grammar rules you have. Each of these methods will receive a ParserContext ctx parameter, which you use to visit child rules and/or get terminal values. For example, you could do this: class MyVisitor extends MyGrammarBaseVisitor&lt;String&gt; { @Override public String visitMultiplicative(MyGrammarParser.MultiplicativeContext ctx) { if (ctx.opMult().getText().equals("/")) return "\\frac{" + visit(ctx.expr(0)) + "}{" + visit(ctx.expr(1)) + "}"; else return visit(ctx.expr(0)) + "\\cdot " + visit(ctx.expr(1)); } // visit methods for other rules... } I'm assuming your multiplicative rule looks like multiplicative: expr opMult expr; opMult: '*' | '/'; You can find more information in The Definitive Antlr 4 Reference. You may also find more information and examples in the Antlr documentation.

http://stackoverflow.com/q/26375686
tagged with: java
tagged with: web-services
has body: I am implementing a service interface in Java which was generated using JAX-WS RI 2.2.8. I have following lines: @WebService(name = "IService", targetNamespace = "http://tempuri.org/") @XmlSeeAlso({ ObjectFactory.class }) public interface IService { @WebMethod(operationName = "PersonList", action = "http://tempuri.org/IService/PersonList") @WebResult(name = "PersonListResult", targetNamespace = "http://tempuri.org/") @RequestWrapper(localName = "PersonList", targetNamespace = "http://tempuri.org/", className = "org.test.wsdl.PersonList") @ResponseWrapper(localName = "PersonListResponse", targetNamespace = "http://tempuri.org/", className = "org.test.wsdl.PersonListResponse") public PersonListResponseX personList(); What i want to do, I want to get this: action = "http://tempuri.org/IService/PersonList") And to use it in my Service implementation's SoapActionCallback. @Service public class NewService implements IService { private final ObjectFactory of = new ObjectFactory(); @Autowired private WebServiceTemplate webServiceTemplate; @Override public PersonListResponseX personList() { // URL I need is http://tempuri.org/IService/PersonList SoapActionCallback callback = new SoapActionCallback(URL); PersonList personList = of.createPersonList(); PersonListResponse personListResponse = (PersonListResponse) webServiceTemplate.marshalSendAndReceive(personList, callback); JAXBElement&lt;PersonListResponseX&gt; value = personListResponse.getPersonListResult(); }
type: Question
score: 0
answer count: 1
has title: How to get action of @WebMethod in JAX-WS service implementation?
has answer: http://stackoverflow.com/a/29377541
type: UnansweredQuestion

http://stackoverflow.com/comment/41401486
has text: If you'd like to compare `RuntimeException` objects, create your own subclass that overrides `equals`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26372385
score: 2

http://stackoverflow.com/a/26498680
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/26498609
accepted answer of: http://stackoverflow.com/q/26498609
score: 4
type: AcceptedAnswer
has body: Use RecyclerView, a LayoutManager, and an Adapter: These components let you define one or more layouts, inflate (and/or recycle) views on demand, and initialize those views according to your data set as the user scrolls. https://developer.android.com/training/material/lists-cards.html
type: Answer

http://stackoverflow.com/comment/41374682
comment on: http://stackoverflow.com/a/26358002
has text: How do I play with the values? Tried changing 7 to other numbers but it looks the same
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26788216
has body: I solved the problem changing in gradle compile 'com.android.support:appcompat-v7:21.0.0' compile 'com.android.support:support-v4:21.0.0' to compile 'com.android.support:appcompat-v7:19.0.0' compile 'com.android.support:support-v4:19.0.0' and compile / target sdk to 19
answers question: http://stackoverflow.com/q/26471482
score: 0
type: Answer

http://stackoverflow.com/q/26471786
upvote count: 1
has comment: http://stackoverflow.com/comment/41581101
favorite count: 0
has comment: http://stackoverflow.com/comment/41581034
has body: getting an error here on the second else if.... I don't understand how it's happening whatsoever as the rest of them have no errors and are stated the same way! Would appreciate any input on this. The error states; error: illegal start of expression Here is the code; /** * @(#)Exercise4.java * * * @author * @version 1.00 2014/10/20 */ import java.util.Scanner; public class Exercise4 { public static void main(String[] args) { float unit, cost; Scanner input = new Scanner(System.in); System.out.print("Please Enter The Units Used: "); unit = input.nextFloat(); if (unit &lt;= 99) { cost = (unit*0.05); } else if (unit &gt; 99 &amp;&amp; unit &lt;= 200) { cost = ((99*0.05) + (unit*(0.03))); } else if (unit &gt; 200 &amp;&amp; &lt;= 300) { cost = (((99*0.05) + (200*0.03)) + (unit*0.02)); } else if (unit&gt;300) { cost = ((((99*0.05) + (200*0.03)) + (100*0.02)) + (unit*0.01)); } System.out.println("\nThe Cost Of Your Mobile Phone Bill Is: EUR" + String.format("%.2f",cost)); } }
has answer: http://stackoverflow.com/a/26471958
type: UnansweredQuestion
score: -3
downvote count: 4
tagged with: expression
tagged with: java
has answer: http://stackoverflow.com/a/26471840
type: Question
has title: Illegal Start of Expression... Yet I've made sure to have the correct operators
answer count: 2

http://stackoverflow.com/a/26414940
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26414890
has body: Moto X has not SD-Card, only internal storage so this is not blocked http://lifehacker.com/android-kitkat-blocks-some-access-to-micro-sd-cards-1524997895
downvote count: 0

http://stackoverflow.com/q/26402666
has answer: http://stackoverflow.com/a/26403253
has body: I am programatically trying to connect to ssh running remotely. I am running a tomcat server instance. Whenever i need, from the code, i create a session, connect and execute a few commands that are needed within a try block and then close off the connection that was created as part of the finally block at all the places. Things work well and fine, but at some cases when i execute a w or netstat command on the ssh server, I see a few connections that are idle for more than a few hours and the ip address of those connections shows the connection to be from my application, but my java heap dump does not show any instance of my class in the memory, but i see ganymed related class instances in the heap. I am using ganymed-ssh-260 library to connect to my server. Is this something that someone has already seen? Attaching the code snippet that connectes the ssh to the server public class SSHExecutor{ private OutputStream stdin; private InputStream stdout; private InputStream stderr; private Session sess; private Connection conn; public void createConnection(String hostname, int port, String userName, String password) throws Exception { try { conn = new Connection(hostname, port); final boolean isAuthenticated = publicKeyAccess(hostname, userName, password); if (!isAuthenticated) { throw new IOException("Authentication failed."); } sess = conn.openSession(); final int xWidth = 90; final int yWidth = 80; sess.requestPTY("dumb", xWidth, yWidth, 0, 0, null); sess.startShell(); stdin = sess.getStdin(); stdout = sess.getStdout(); stderr = sess.getStderr(); isConnectionActive = true; final String response = getResponse(); if (response != null &amp;&amp; response.toLowerCase().contains(ObjectConstants.CURRENTLY_NOT_AVAILABLE)) { throw new IOException("Account is currently not available."); } } catch (Exception e) { log.error("Problem in CreateConnection", e); isConnectionActive = false; throw e; } } public String getResponse() { final StringBuffer responseData = new StringBuffer(…
score: 0
has title: SSH connection leaving stale sessions on the server
answer count: 1
type: UnansweredQuestion
tagged with: ssh
tagged with: java
type: Question

http://stackoverflow.com/comment/41387129
type: QuestionComment
comment on: http://stackoverflow.com/q/26364535
score: 0
has text: Hi Eran, I tried fetching it using cell.getStringCellValue(), but then it threw the floowing exception "at org.apache.poi.hssf.usermodel.HSSFCell.typeMismatch(HSSFCell.java:643)". Type mismatch.
type: Comment

http://stackoverflow.com/a/26478497
answers question: http://stackoverflow.com/q/26477456
score: 0
type: Answer
has body: public enum Command { CONNECT, DISCONNECT, SEND, LOGLEVEL, HELP, QUIT, EXIT, XX } try { cmd = Command.valueOf(command.toUpperCase()); } catch (IllegalArgumentException e) { System.out.println("Invalid input"); cmd = XX; }

http://stackoverflow.com/comment/41441250
has text: As @August indicated, the `sort` method changes the original array. It has to do with how Java handles parameters: http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value
comment on: http://stackoverflow.com/q/26394493
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41610391
has text: And yes I am using SQLiteOpenHelper
comment on: http://stackoverflow.com/q/26487239
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27133515
score: 6
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26453668
answers question: http://stackoverflow.com/q/26453668
type: Answer
has body: I just solved a couple of minutes ago using a ViewTreeObserver. In the example below, the variable currentMode is a view that I want to animate in and out. Its default value is "gone" and I was having the EXACT same issue you were having. Here's how I solved it: ViewTreeObserver vto = currentMode.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if(currentMode.isShown()) { YoYo.with(Techniques.SlideInDown).duration(250).playOn(currentMode); } } }); currentMode.setVisibility(mShouldShowMode ? View.VISIBLE : View.GONE); Using the ViewTreeObserver we can watch global changes to the UI and then react. The View.isShown() method checks to see if its visible. If so, then I then start the animation. This works great for me. Then for the exit animation you have to attach a listener to the out animation like this: YoYo.with(Techniques.SlideOutUp).duration(250).withListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { currentMode.setVisibility(View.GONE); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }).playOn(currentMode);
downvote count: 0

http://stackoverflow.com/q/26501257
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26769657
has body: I noticed something seemly reasonable by Eclipse JDT but doesn't seem to be defined anywhere: &lt;!-- language: lang-java --&gt; public static &lt;T, TException extends Exception&gt; void iterateEx( Iterable&lt;T&gt; iterable, PredicateEx&lt;T, TException&gt; step) throws TException { for (T item : iterable) { if (step.testEx(item)) { ThreadExt.yield(); // sleep 0.001s } } } When I call the method with a lambda as the PredicateEx step, the unspecified TException is assumed to be RuntimeException if the lambda throws nothing. I found the piece of code in Eclipse JDT doing that but is it an well-defined behavior from lambda type inference, or just some decision made in the compiler implementation? Because it might also be possible for the default exception to be Exception instead (= upper bound of TException), and I'm quite concerned because I'm about to rewrite all function-taking methods that way to handle checked exceptions correctly. Callers' examples are like: &lt;!-- language: lang-java --&gt; iterateEx(listOfResultSet, rs -&gt; true); // throws RuntimeException, no try-catch required iterateEx(listOfResultSet, rs -&gt; rs.getBoolean("SOME_COLUMN")); // throws SQLException The PredicateEx is an variant of Predicate that allows throwing of exception: &lt;!-- language: lang-java --&gt; @FunctionalInterface public interface PredicateEx&lt;T, TException extends Exception&gt; { boolean testEx(T t) throws TException; }
tagged with: java
has title: Java 8 lambda: is automatically-inferred exception a RuntimeException by default?
type: Question
has comment: http://stackoverflow.com/comment/41636454
has comment: http://stackoverflow.com/comment/41645887
score: 4
accepted answer: http://stackoverflow.com/a/26769657
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
tagged with: lambda

http://stackoverflow.com/comment/41864687
type: QuestionComment
comment on: http://stackoverflow.com/q/26483230
has text: @Pavan I'm serializing the JPA entity himself (I suppose the entity is what you refer as DAO bean) and, in this case the I transfer the Jackson representation of the whole entity
score: 0
type: Comment

http://stackoverflow.com/q/26368982
has comment: http://stackoverflow.com/comment/41401921
downvote count: 0
has comment: http://stackoverflow.com/comment/41402074
has body: I have created a test program between two virtual machines on my computer. So I have an RMI Server running on a virtual machine on VMware and I have an RMI Client running on another virtual machine on VMware. I have set up SSL using SslRMIServerSocketFactory and SslRMIClientSocketFactory and it is possible to call methods from the client to the server, having the server to respond with the return value. So right now I have two Ubuntu machines running on VMware. What happens is that the client makes the call to the server and I have to wait for about 17 seconds until the response from the server reaches the client and the print is executed on console. Updated: The method's call is fast. All this time is taken by the Registry.lookup() function. Aren't 17 seconds too much time? I know that VMs are slow by nature, plus the fact that SSL is running but still, aren't 17 seconds too much for what I am doing? The remote method only adds two integers and returns the result. Thank you.
has comment: http://stackoverflow.com/comment/41401569
favorite count: 0
accepted answer: http://stackoverflow.com/a/26393773
linked to: http://stackoverflow.com/q/26320874
has comment: http://stackoverflow.com/comment/41401085
has comment: http://stackoverflow.com/comment/41401156
has comment: http://stackoverflow.com/comment/41402098
has comment: http://stackoverflow.com/comment/41400687
has comment: http://stackoverflow.com/comment/41399673
has comment: http://stackoverflow.com/comment/41398716
has comment: http://stackoverflow.com/comment/41400343
has comment: http://stackoverflow.com/comment/41400528
has comment: http://stackoverflow.com/comment/41397541
type: AnsweredQuestion
score: 1
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/41396553
has comment: http://stackoverflow.com/comment/41399986
has comment: http://stackoverflow.com/comment/41401836
possible better answer: http://stackoverflow.com/a/41636498
upvote count: 1
has answer: http://stackoverflow.com/a/41636498
tagged with: virtual-machine
type: Question
has comment: http://stackoverflow.com/comment/41399311
has comment: http://stackoverflow.com/comment/41396382
has answer: http://stackoverflow.com/a/26393773
tagged with: performance
has comment: http://stackoverflow.com/comment/41401546
has comment: http://stackoverflow.com/comment/41439685
has comment: http://stackoverflow.com/comment/41415677
tagged with: ssl
linked to: http://stackoverflow.com/q/11343132
has comment: http://stackoverflow.com/comment/41402250
has comment: http://stackoverflow.com/comment/41397365
has comment: http://stackoverflow.com/comment/41438842
has comment: http://stackoverflow.com/comment/41401392
has comment: http://stackoverflow.com/comment/41402572
has title: RMI over SSL - Slow communication
answer count: 2

http://stackoverflow.com/q/26467364
answer count: 1
has comment: http://stackoverflow.com/comment/41575359
has answer: http://stackoverflow.com/a/26467849
has comment: http://stackoverflow.com/comment/41573146
has comment: http://stackoverflow.com/comment/41572680
type: UnansweredQuestion
has title: Try/catch not working with android expression parser exp4j
tagged with: java
has comment: http://stackoverflow.com/comment/41572392
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/41573641
score: 0
has body: I am using the following bit of code to parse a string equation into a resulting double (based on some input values of doubles x, y and z and an equation input.). The program works fine when I run it as a java program in eclipse, however it hangs when I run it with in an android app (the app becomes unresponsive). In my app, I'm getting the string equation from a textbox and displaying the result number. Can anybody tell me why the following code doesn't work in android? My guess is that it has to do with the try-catch, but I can't figure out why. I'm using the exp4j jar. Thanks very much! public class ParseEquation { public double totalValue = 0; public ParseEquation(String inputEquation, double x, double y,double z) { //String inputEquation = "-4.14*x*x - 5/2 - y^2"; Calculable calc = null; try { calc = new ExpressionBuilder(inputEquation) .withVariable("x", x) .withVariable("y", y) .withVariable("z", z) .build(); } catch (UnknownFunctionException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnparsableExpressionException e) { // TODO Auto-generated catch block e.printStackTrace(); } totalValue=calc.calculate(); } }
tagged with: android

http://stackoverflow.com/comment/41382154
comment on: http://stackoverflow.com/q/26362135
type: QuestionComment
has text: Are you sure you can use List<Object> there?
type: Comment
score: 2

http://stackoverflow.com/a/26423019
type: Answer
answers question: http://stackoverflow.com/q/26422897
score: 0
has body: The basic idea is that you need to go over the entire array and accumulate a boolean as long as the the given element is the greatest. Note that you cannot have the i!=j condition in the for loop as this will terminate the loop prematurely and only check the elements against the elements before it in the array: boolean isGreatest = true; for(int i = 0; i &lt; elementiInseriti.length &amp;&amp; isGreatest; i++) { if (i != j &amp;&amp; elementiInseriti[j] &lt; elementiInseriti[i]) { isGreatest = false; } } if (isGreatest) { // do something; }

http://stackoverflow.com/q/26473077
has title: Accept nth number of element into array and sum all the prime number which is into the array?
has answer: http://stackoverflow.com/a/26473392
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26473392
score: -4
favorite count: 0
type: Question
tagged with: java
answer count: 1
has body: In this code user enter nth number of element which combination of all prime or not prime but I want to add or sum of only prime number... public class prime { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); System.out.println("enter the size of an array"); int abc = in.nextInt(); int num[] = new int[abc]; int a = 0, sum = 0; for (int k = 0; k &lt; num.length; k++) { System.out.println("enter the value" + (k + 1)); num[k] = in.nextInt(); } for (int i = 0; i &lt; num.length - 1; i++) { for (int j = 2; j &lt; i; j++) { if (num[i] % i == 0) { a = 1; break; } } if (a == 0) { sum = sum + i; } } System.out.println("number is prime" + sum); } }

http://stackoverflow.com/a/26489838
type: Answer
upvote count: 3
has body: Everything gets handled eventually. If you don't catch it then when the exception escapes the main method the JVM will catch it and write it to stderr. Some exceptions, like NullPointerExceptions and NumberFormatExceptions, are unchecked, which means the programmer isn't required to catch them. You couldn't require every possible NullPointerException to get caught, and adding them to method signatures would be pointless. Like the NullPointerException, the NumberFormatException is the result of a programmer error, it means you made a bad assumption about your input to the parse method. In some cases it isn't clear why some exceptions are checked and others aren't. Exceptions that are unchecked tend to be unrecoverable. They may indicate some external resource went down or they may indicate a programmer error; something went so wrong there's no point proceeding, the best thing to do is cancel the current work, fall back to a safe spot, and regroup. Here's an explanation of a rationale for how to handle exceptions.
has comment: http://stackoverflow.com/comment/41626218
score: 3
answers question: http://stackoverflow.com/q/26489786
downvote count: 0

http://stackoverflow.com/comment/41615154
score: 1
has text: They're presumably synchronized on different objects.
comment on: http://stackoverflow.com/q/26490567
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41519541
comment on: http://stackoverflow.com/q/26437396
score: 0
type: Comment
has text: @alfasin : yes i removed and tried to execute it. No change in the result. and hope you know the Threadpool concept which allows only certain number of threads at a time which i taken explicitly as threadcount.
type: QuestionComment

http://stackoverflow.com/a/26481729
has body: These is different because they are printed in different orders For a example, From the matrix one Loop: 1 0 1 8 19 0 6 3 5 0 prints Loop: 1 matrix[1][1] = 0 matrix[1][2] = 1 matrix[1][3] = 8 matrix[2][1] = 19 matrix[2][2] = 0 matrix[2][3] = 6 matrix[3][1] = 3 matrix[3][2] = 5 matrix[3][3] = 0 From the matrixTwo Loop: 1 0 11 15 11 0 0 0 0 0 0 0 0 0 0 0 0 prints Loop: 1 matrixTwo[0][0] = 0 matrixTwo[0][1] = 11 matrixTwo[0][2] = 15 matrixTwo[0][3] = 11 matrixTwo[0][4] = 0 matrixTwo[0][5] = 0 matrixTwo[0][6] = 0 matrixTwo[0][7] = 0 matrixTwo[0][8] = 0 matrixTwo[0][9] = 0 matrixTwo[0][10] = 0 matrixTwo[0][11] = 0 matrixTwo[0][12] = 0 matrixTwo[0][13] = 0 matrixTwo[0][14] = 0 matrixTwo[0][15] = 0 Use System.out.print("matrix[" + row + "][" + col + "] = " + matrix[row][col] + " ");. You can see the difference
accepted answer of: http://stackoverflow.com/q/26481152
answers question: http://stackoverflow.com/q/26481152
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41563834
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26462462
type: AnswerComment
has text: @androidGenX: Right, it sounds like you can't use Java 8 language features when targeting 1.7, so just use `-source 1.7`. I've updated my answer.

http://stackoverflow.com/a/26398228
accepted answer of: http://stackoverflow.com/q/26397963
has body: You ask your int[] to be sorted with a Comparator Change the type of graph to Integer[][] class DegreeComparator implements Comparator&lt;Integer&gt; { Integer[][] graph; public DegreeComparator(Integer[][] g) { graph = g; } public int compare(Integer c1, Integer c2) { return graph[c2].length - graph[c1].length; } }
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41447808
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26397963

http://stackoverflow.com/a/26512242
has comment: http://stackoverflow.com/comment/41655957
has comment: http://stackoverflow.com/comment/41663435
answers question: http://stackoverflow.com/q/26511939
has comment: http://stackoverflow.com/comment/41701946
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41662632
has comment: http://stackoverflow.com/comment/41737125
has comment: http://stackoverflow.com/comment/41702549
has comment: http://stackoverflow.com/comment/41656700
downvote count: 0
has body: If I understand you correctly you will need to use manually use appendReplacement and appendTail methods from Matcher class. This will allow you to pass result of properties.getProperty(matcher.group(1)) Here is basic example of how you can use it. In this example I'm searching for some keyword like string or secret to replace them. Replacement is decided dynamically based on mapping like string-&gt;foo, secret-&gt;whatever and is determined by simply calling get(keyword) from Map which stores this mapping. String data = "some string with some secret data"; Map&lt;String,String&gt; properties = new HashMap&lt;&gt;(); properties.put("string", "foo"); properties.put("secret", "whatever"); Pattern p = Pattern.compile("string|secret"); Matcher m = p.matcher(data); StringBuffer sb = new StringBuffer(); while (m.find()){ m.appendReplacement(sb, properties.get(m.group()));//replace found match //with result based on group } m.appendTail(sb);//append rest of text after last match, in our case " data" String result = sb.toString(); System.out.println("Original: " + data); System.out.println("Replaced: " + result); Result: Original: some string with some secret data Replaced: some foo with some whatever data
type: Answer
has comment: http://stackoverflow.com/comment/41663215

http://stackoverflow.com/a/26512481
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26512193
answers question: http://stackoverflow.com/q/26512193
has body: The problem occurs because all the fields in records class are static. Remove the static keyword from the declarations of fields. As they are static whenever you create a new object of records class you overwrite those static fields. Static fields belong to the class not to the object.
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/a/26450476
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26450282
upvote count: 1
has body: Add this to the List, and throw an exception if the user attempts to create the 21st: public class Book { private static final List&lt;Book&gt; books = Collections.synchronizedList(new ArrayList&lt;Book&gt;()); private String title; private int pages; public Book(String title, int pages) { if (books.size() == 20) throw new IllegalStateException("Maximum number of books reached"); this.title = title; this.pages = pages; books.add(this); } } I've added a call to Collections.synchronizedList() to add simple thread safety to prevent the maximum from being exceeded due to race conditions. Also note the change of the list type to List&lt;Book&gt; (from ArrayList&lt;Book&gt;) - see Liskov substitution principle
score: 1
has comment: http://stackoverflow.com/comment/41542376

http://stackoverflow.com/q/26449867
tagged with: android
tagged with: android-activity
type: UnansweredQuestion
has title: ListView: removing spaces between items, and limiting number of items in a listview
type: Question
has answer: http://stackoverflow.com/a/26449903
tagged with: android-layout
tagged with: java
tagged with: listview
has body: I have a list, and I found that there is too much spacing seperating the list items. I would like to reduce it, but not sure how. Below is the layout file: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f2f2f2" &gt; &lt;ListView android:id="@+id/listMessages" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/divider" android:layout_below="@+id/iSchedule" android:divider="@null" android:dividerHeight="0dp" android:drawSelectorOnTop="false" android:padding="0dip" android:stackFromBottom="true" android:transcriptMode="alwaysScroll" tools:listitem="@layout/message_left" /&gt; &lt;RelativeLayout android:id="@+id/divider" android:layout_width="fill_parent" android:layout_height="1dip" android:background="@color/off_white" android:layout_above="@+id/relSendMessage" /&gt; &lt;RelativeLayout android:id="@+id/relSendMessage" android:layout_width="wrap_content" android:layout_height="48dp" android:background="#ddd" android:paddingLeft="10dp" android:layout_alignParentBottom="true"&gt; &lt;EditText android:id="@+id/messageBodyField" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignBottom="@+id/sendButton" android:layout_alignTop="@+id/sendButton" android:layout_marginBottom="-4dp" android:layout_marginRight="10dp" android:layout_toLeftOf="@+id/sendButton" android:background="@android:color/white" android:hint="@string/message_elipses" android:inputType="text|textNoSuggestions|none" android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " android:textColor="#000000" android:textColorLink="#adefda" android:textSize="14sp" /&gt; &lt;Button android:id="@+id/sendButton" android:layout_width="72dp" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_margin="4dp" android:…
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41541304

http://stackoverflow.com/q/26433285
possible better answer: http://stackoverflow.com/a/26442612
type: AnsweredQuestion
score: 7
tagged with: java
tagged with: ssl
type: Question
has answer: http://stackoverflow.com/a/26442612
linked to: http://stackoverflow.com/q/18139448
answer count: 2
tagged with: applet
tagged with: ssl-certificate
tagged with: security
upvote count: 7
has comment: http://stackoverflow.com/comment/41529076
has comment: http://stackoverflow.com/comment/41525563
favorite count: 0
has comment: http://stackoverflow.com/comment/41518048
accepted answer: http://stackoverflow.com/a/26518823
downvote count: 0
has title: How to solve "The certificate is not valid and cannot be used to verify the identity of this website" error?
has body: The question is, How to solve "The certificate is not valid and cannot be used to verify the identity of this website" error?. Here are the details: I have a signed applet that has been working fine, until I updated Java to 8u25 (1.8.0_25-b18). Now, the application shows an alert message "Do you want to continue? The connection to this website is untrusted". There is a note in this message too, "The certificate is not valid and cannot be used to verify the identity of this website". The applet is loaded without problems. But when the user tries to use a specific function of that application, the warning message is displayed. I've checked the java console when this happens, and this warning message is displayed right after these lines: security: Obtain certificate collection in SSL Root CA certificate store security: Invalid certificate from HTTPS server network: Cache entry not found [url: https://sub.domain.net:9876, version: null] The application is downloaded from a different domain, say "https://app.domain.net/.....", so no jars are downloaded from "https://sub.domain.net:9876", but the applet connects to "https://sub.domain.net:9876" to send/receive data. The applet is signed correctly, and so far, it meets all the security requirements according to Java. This issue seems to happen when the application tries to connect internally with an HTTPS url like https://sub.domain.net:9876. That sites' SSL certificate is valid, issued by GoDaddy and has not expired. Again, this started to happen after updating my JRE to 8u25. I've tested adding the offending URL to Java security exception list, with no success. Here are a few screenshot of this problem: This is the warning message displayed: Edit 10/18/2014: Question posted in "Oracle Community" too, to increase answer options: Question in Oracle Community. Edit 10/21/2014: I noticed this: When I click the link "More Information" displayed in the "Security Warning" dialog, the reason displayed says: The application is be…
has answer: http://stackoverflow.com/a/26518823

http://stackoverflow.com/a/26472188
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26471930
has body: Your stacktrace is telling you what you need to know. These lines: java.lang.ExceptionInInitializerError at com.ats.dao.RetrievalDAO.&lt;init&gt;(RetrievalDAO.java:27) at com.ats.dao.test.RetrievalDAOTest.testinsertmessage(RetrievalDAOTest.java:49) ... ... tell you that your code is hitting an error in the constructor of the RetrievalDAO class while being run by the RetrievalDAOTest (presumably a unit test). The exception is further caused by: Caused by: java.lang.NullPointerException at java.util.Properties$LineReader.readLine(Unknown Source) at java.util.Properties.load0(Unknown Source) at java.util.Properties.load(Unknown Source) at com.ats.util.Config.&lt;init&gt;(Config.java:17) at com.ats.retriever.DBPropertiesRetriever.&lt;clinit&gt;(DBPropertiesRetriever.java:11) ... which tells you that the actual error is caused in the initialiser of your Config class. Check what your Config class does at line 17, and why it might be passing a null to the Properties loader.
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26471930

http://stackoverflow.com/q/26438030
has body: public String find_tree(String text){ String output = ""; // create an empty Annotation just with the given text Annotation document = new Annotation(text); // run all Annotators on this text pipeline.annotate(document); // these are all the sentences in this document // a CoreMap is essentially a Map that uses class objects as keys and has values with custom types List&lt;CoreMap&gt; sentences = document.get(SentencesAnnotation.class); for(CoreMap sentence: sentences) { TokenizerFactory tokenizerFactory = PTBTokenizer.factory(new CoreLabelTokenFactory(), ""); List wordList = tokenizerFactory.getTokenizer(new StringReader(sentence.toString())).tokenize(); Tree tree = sentence.get(TreeAnnotation.class); output +=tree.toString(); } return output; } When I run the program it throws NullPointerException for pipeline.annotate(document); Here, pipeline is StanfordCoreNLP object: private StanfordCoreNLP pipeline; pipeline = new StanfordCoreNLP(prop); // prop is Properties object // creates a StanfordCoreNLP object, with POS tagging, lemmatization, NER, parsing, and coreference resolution prop = new Properties(); try{ prop.put("annotators","tokenize, ssplit, pos, lemma, ner, parse, dcoref"); prop.put("ssplit.eolonly",true); pipeline = new StanfordCoreNLP(prop); } catch(Exception e){System.out.println(e);}
has comment: http://stackoverflow.com/comment/41520959
has comment: http://stackoverflow.com/comment/41520195
tagged with: nullpointerexception
has title: Null Pointer Exception while loading tagger mode
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/41520210
has comment: http://stackoverflow.com/comment/41520381

http://stackoverflow.com/a/26447460
score: 0
answers question: http://stackoverflow.com/q/26447429
type: Answer
has body: I dont know java but a 2d array should work like this public static void main(String[] args) { double[][] father = new double[25][25]; for (int i = 0; i &lt; 25; i++){ for (int j = 0; j &lt; 25; j++){ father[i][j] = Math.random(); } }

http://stackoverflow.com/q/26483389
has answer: http://stackoverflow.com/a/26484744
score: 0
tagged with: .net
answer count: 1
tagged with: ws-security
has body: I am trying to access a .NET Web-Service secured via WS-Security from a Java client (AXIS 1.6.2 and Rampart). Client part: ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("client-repo", null); AdminServiceStub stub = new AdminServiceStub(null,url); The WSDL (.NET WebService) uses "sp:SecureConversationToken sp:IncludeToken" &lt;sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt; Invoking the AdminServiceStub generated by wsdl2java fails with a IllegalArgumentException Generated stub: (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("&lt;wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/...")); This generated code line fails with: java.lang.IllegalArgumentException: SecurityContextToken doesn't contain any sp:IncludeToken attribute Does anyone know how to handle this sp:IncludeToken?
tagged with: rampart
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41603532
tagged with: web-services
tagged with: java
has title: Accessing .NET WebService secured by WS-Security via Java client
type: Question

http://stackoverflow.com/comment/41586678
has text: Input and expected output would help, I don't really understand the logic here.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26474582
type: QuestionComment

http://stackoverflow.com/comment/41381544
comment on: http://stackoverflow.com/a/26361437
type: AnswerComment
has text: hey Thanks for correcting me but that is not the issue.I have made change in my code but still it is giving me . [online.model.OrderDetail@23a0a8e, online.model.OrderDetail@308af1c6, online.model.OrderDetail@7207170f] Hibernate: select orderdetai_.order_detail_id, orderdetai_.bill as bill7_, orderdetai_.o_id as o3_7_, orderdetai_.p_id as p4_7_ from orderdetail orderdetai_ where orderdetai_.order_detail_id=?
type: Comment
score: 0

http://stackoverflow.com/comment/41393514
comment on: http://stackoverflow.com/q/26368120
type: Comment
type: QuestionComment
score: 2
has text: `sc.nextLine();` requests a second input immediately, does it not?

http://stackoverflow.com/a/26444350
type: Answer
has body: Don't just copy, try to understand mate: import java.io.*; import java.util.StringTokenizer; public class PrintStuff { public static void main (String[] args) { System.out.print("Enter some shit seperated by space:"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str=""; try { str = br.readLine(); } catch (IOException ioe) { System.out.println("IO error trying to read bitch!"); } StringTokenizer st = new StringTokenizer(str); while (st.hasMoreElements()) { System.out.println(st.nextElement()); } } }
answers question: http://stackoverflow.com/q/26444223
score: 0

http://stackoverflow.com/q/26504594
linked to: http://stackoverflow.com/q/23958814
score: 2
has comment: http://stackoverflow.com/comment/41641535
tagged with: java
duplicate of: http://stackoverflow.com/q/23958814
has comment: http://stackoverflow.com/comment/41640596
has comment: http://stackoverflow.com/comment/41642278
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41641802
has comment: http://stackoverflow.com/comment/41640376
has comment: http://stackoverflow.com/comment/41641387
has comment: http://stackoverflow.com/comment/41641857
favorite count: 0
has comment: http://stackoverflow.com/comment/41643150
has body: Java 8 introduced lambda expressions together with the package java.util.function. This Package consists basically of standard interfaces for Suppliers: () → T Consumers: t -&gt; void Functions: t -&gt; r Predicates: t -&gt; boolean Operators: t -&gt; t Other fixed type FunctionalInterfaces or variations that take or return more than one argument. I was wondering why there's no standard interface for a classic callback: Zero arguments and no return value: Callback: () -&gt; void Example implementation: @FunctionalInterface interface Callback { void call(); default Callback andThen(Callback after) { Objects.requireNonNull(after); return () -&gt; { call(); after.call(); }; } } Example use case: MyTask task = new MyTask(); AtomicInteger finishedTasks = new AtomicInteger(); task.finished(() -&gt; System.out.println(finishedTasks + " tasks finished")); task.finished(() -&gt; schedule(task, 1, TimeUnit.HOURS)); schedule(task, 1, TimeUnit.HOURS)); The closest interface would be Runnable but that's a bit too much related to multithreading. My questions: Do you know if Java provides this interface? Where do I find a list of classes that are annotated with @FunctionalInterface?
has comment: http://stackoverflow.com/comment/41640309
has comment: http://stackoverflow.com/comment/41641630
has comment: http://stackoverflow.com/comment/41642579
answer count: 0
has title: Functional callback in Java 8
has comment: http://stackoverflow.com/comment/41643024
upvote count: 2
has comment: http://stackoverflow.com/comment/41657813
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41642054
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/comment/63083779
type: AnswerComment
has text: Tested UIActivityViewController in iOS 9.2 and 8, still no luck on Twitter, email is fine....
type: Comment
comment on: http://stackoverflow.com/a/26535870
score: 0

http://stackoverflow.com/q/26360996
answer count: 0
has comment: http://stackoverflow.com/comment/41380297
has comment: http://stackoverflow.com/comment/41396720
type: UnansweredQuestion
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/41380456
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: post
has comment: http://stackoverflow.com/comment/41381354
has comment: http://stackoverflow.com/comment/41386360
score: 0
has comment: http://stackoverflow.com/comment/41524183
has title: HTTP POST request with JSON Reading in Multiple Classes of Students and Varying Numbers of Assignments and Grades
has body: I have been attempting to create an HTTP POST request that uses JSON for the purpose of sending information from a Java gradebook application to a Rails web-based application that displays those grades in the form of a report to students. This is what I have so far. Ultimately, I want to send more than just one student's information. Furthermore, each student might have anywhere from 0 to 50 assignments, descriptions of the assignments, as well as grades for those assignments. On top of that there will be multiple classes/courses of students. All this information needs to be "read in" to the JSON object. Does anyone have any suggestions about how I could modify this code so that I could send all that data rather than the data for just one student as is shown below (as well as more than one class/course)? public class HTTPPostRequestWithSocket { public void sendRequest(){ try { JSONObject obj = new JSONObject(); obj.put("instructorName", "Smith"); obj.put("courseName", "Biology 101"); obj.put("studentName1", "John Doe"); obj.put("studentNumber", new Integer(100)); obj.put("assignment1", "Test 1"); obj.put("gradeAssignment1", new Double("95.3")); String hostname = "nameofthewebsite.com"; InetAddress addr = InetAddress.getByName(hostname); Socket socket = new Socket(addr, port); String path = "/nameofapp"; // Send headers BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8")); wr.write("POST "+path+" HTTP/1.0rn"); wr.write("Content-Length: "+obj.length()+"rn"); wr.write("Content-Type: application/x-www-form-urlencodedrn"); wr.write("rn"); // Send parameters obj.writeJSONString(wr); wr.flush(); // Get response BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); } wr.close(); rd.close(); socket.close(); }catch (Exception e) {e.printStackTrace();} } }

http://stackoverflow.com/comment/41550684
comment on: http://stackoverflow.com/a/26454528
has text: Glad that worked for you, with this parameters and properties meanings.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41593989
score: 0
type: AnswerComment
type: Comment
has text: Classic sign of caffeine withdrawal. I suggest you consume coffee stat. Also, +1 that looks good now.
comment on: http://stackoverflow.com/a/26478482

http://stackoverflow.com/q/26456343
has answer: http://stackoverflow.com/a/26456513
tagged with: recursion
has comment: http://stackoverflow.com/comment/41553210
tagged with: java
has answer: http://stackoverflow.com/a/26456414
type: Question
has title: Nested Right Isosceles Triangles Java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26456377
has body: I'm having quite a bit of trouble getting my code to work. In my code, nested right isosceles triangles are suppose to be drawn like this: I'm not sure if my code will work either since once I run it, the triangles are not drawn. I am given this error Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError and I am not sure how to fix it. Help? import java.awt.*; import javax.swing.*; public class Ornament extends JPanel { public void paintComponent( Graphics g ) { super.paintComponent( g ); // Call JPanel's paintComponent method // to paint the background drawTriangles( g, 100, 80, 64 ); } /** * Draws an ornament made of triangles in Graphics g with the base midpoint * at (x, y) and base half-length r */ public void drawTriangles( Graphics g, int x, int y, int r ) { g.drawLine( x + r, y, x - r, y ); g.drawLine( x + r, y, x, y - r ); g.drawLine( x - r, y, x, y - r ); if ( r == 4 ) { drawTriangles( g, x-r , y, r ); drawTriangles( g, x-r , y, r ); } else { drawTriangles( g, 36+r , y, r ); r --; } } public static void main( String[] args ) { JFrame w = new JFrame( "Triangles" ); w.setBounds( 300, 300, 200, 120 ); w.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); Ornament panel = new Ornament(); panel.setBackground( Color.WHITE ); Container c = w.getContentPane(); c.add( panel ); w.setResizable( false ); w.setVisible( true ); } }
type: UnansweredQuestion

http://stackoverflow.com/q/26391047
has comment: http://stackoverflow.com/comment/41435295
possible better answer: http://stackoverflow.com/a/26391075
has answer: http://stackoverflow.com/a/26391075
type: AnsweredQuestion
has body: int ay = Integer.parseInt(tarih.substring(tarih.indexOf("/"),tarih.lastIndexOf("/"))); The error I get is : Exception in thread "main" java.lang.NumberFormatException: For input string: "/09" 09 is an input from the user. How can I solve this error without using try catch?
has comment: http://stackoverflow.com/comment/41435592
has title: java.lang.NumberFormatException: For input string: " /09"
favorite count: 0
has comment: http://stackoverflow.com/comment/41435240
type: Question
accepted answer: http://stackoverflow.com/a/26391073
has comment: http://stackoverflow.com/comment/41435278
score: 0
tagged with: java
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41435581
has answer: http://stackoverflow.com/a/26391073

http://stackoverflow.com/q/26441850
tagged with: lisp
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/26450929
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26450929
has comment: http://stackoverflow.com/comment/41528895
has title: Recursively finding indexes of an INT in an ever-shrinking LispList
type: Question
has body: 2nd-year Computer-Science student here, and as part of a set of exercises on recursion, we've been given some arbitrary problems to solve with LispLists. I'm stuck half-way through, so if anyone can point me in the right direction without explicitly giving me the answer, that would be great. I need to find the positions of every instance of intToFind in the LispList listToCheck - the only conditions are that: no additional arguments can be used it has to be done recursively For everyone who hasn't encountered LispLists - they don't have indexing, and the only methods you can call on them are: .isEmpty() returns boolean .head() returns the element at the 0th position .tail() returns a LispList of all elements that aren't the head .cons(value) adds value to the 'head' position - shifting everything else one down There's also one method I wrote previously called: recursiveCountLength(list) returns an int of the length of the passed LispList. The list I've been testing on is: [2,3,4,2,5,12,2,5], so the result I'm looking for is [0,3,6] - with that out the way, here's what I've got so far (explanation of what I'm attempting after): public static LispList&lt;Integer&gt; recursivePositions(LispList&lt;Integer&gt; listToCheck, int intToFind) { if(listToCheck.isEmpty()) return listToCheck; else { // go through the array in its entirety once through, // do everything else 'on the way back up' LispList&lt;Integer&gt; positions = recursivePositions(listToCheck.tail(), intToFind); //get the current length and current head int currentInt = listToCheck.head(); int currentLength = recursiveCountLength(listToCheck); //if a match is found, add the current length of the list to the list if(currentInt == intToFind) return positions.cons(currentLength); else return positions; } } My current theory is that length of the array at each encounter of the int we're looking for (in this case 2) subtracted from the original length of the list (in this case 8) will give us the indexes. 2 first h…
answer count: 2
has answer: http://stackoverflow.com/a/26450051
has comment: http://stackoverflow.com/comment/41529988
tagged with: recursion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26450051

macos
tags question: http://stackoverflow.com/q/26500477
tags question: http://stackoverflow.com/q/26450420
tags question: http://stackoverflow.com/q/26367452
tags question: http://stackoverflow.com/q/26455130
tags question: http://stackoverflow.com/q/26479116
tags question: http://stackoverflow.com/q/26445268
tags question: http://stackoverflow.com/q/26512518
tags question: http://stackoverflow.com/q/26378249
tags question: http://stackoverflow.com/q/26482657
tags question: http://stackoverflow.com/q/26460677
tags question: http://stackoverflow.com/q/26410290
tags question: http://stackoverflow.com/q/26388031
tags question: http://stackoverflow.com/q/26414290
tags question: http://stackoverflow.com/q/26397947
tags question: http://stackoverflow.com/q/26367081
tags question: http://stackoverflow.com/q/26507568
tags question: http://stackoverflow.com/q/26439737
tags question: http://stackoverflow.com/q/26472322
tags question: http://stackoverflow.com/q/26387342
tags question: http://stackoverflow.com/q/26375108
tags question: http://stackoverflow.com/q/26478671
tags question: http://stackoverflow.com/q/26493650
type: Tag
tags question: http://stackoverflow.com/q/26456168
tags question: http://stackoverflow.com/q/26386254
tags question: http://stackoverflow.com/q/26477692
tags question: http://stackoverflow.com/q/26392639
tag name: macos
tags question: http://stackoverflow.com/q/26370254
tags question: http://stackoverflow.com/q/26510339
tags question: http://stackoverflow.com/q/26428778
tags question: http://stackoverflow.com/q/26502332

http://stackoverflow.com/comment/41463217
has text: I'm asking about rows
comment on: http://stackoverflow.com/q/26404991
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26373721
has body: You may have hit the user's OS process limit (which from my empirical studies includes Java threads). Hitting this limit can manifest in an OutOfMemoryError. On RHEL, there is: /etc/security/limits.d/90-nproc.conf ... which contains the user limits. On RHEL6 (and CentOS6) "max user processes" is set to 1024 by default. Try setting it to unlimited: # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning. * soft nproc unlimited root soft nproc unlimited This answer suggests that you should reboot for those changes to take effect.
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/26373602
downvote count: 0
has comment: http://stackoverflow.com/comment/41407030
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26373602

http://stackoverflow.com/comment/41394007
has text: @Pshemo Then I remove everything that has with that class to do.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26368156
type: QuestionComment

http://stackoverflow.com/comment/41456097
has text: As long as the JVM has enough memory, yes. If not, no.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26403523
score: 1

http://stackoverflow.com/comment/41599897
comment on: http://stackoverflow.com/a/26481558
score: 0
type: Comment
has text: But what I can't explain is the original eclipse wizard loads an error icon too, runs the finish operation forked and doesn't throw an exception.
type: AnswerComment

http://stackoverflow.com/q/26410780
possible better answer: http://stackoverflow.com/a/26410885
has comment: http://stackoverflow.com/comment/41469644
has comment: http://stackoverflow.com/comment/41469728
has title: Java split the bits of a long in two parts using bit shifting
type: AnsweredQuestion
has body: I need to split the bits of a number say 9(1001) in two equal sized parts 10 and 01 in this case. My first idea was to just shift it but for the right number I dont get the expected result ,I suspect this is due to the sign(no unsigned in java :( ). My current code is the following: long num=9; System.out.println(Long.toBinaryString(num)); long num1=num&gt;&gt;2; System.out.println(Long.toBinaryString(num1)); long num2=num&lt;&lt;2; System.out.println(Long.toBinaryString(num2)); Output: 1001 10 100100 Any workaround?
has comment: http://stackoverflow.com/comment/41469640
tagged with: bit-shift
has answer: http://stackoverflow.com/a/26410885
tagged with: java
has comment: http://stackoverflow.com/comment/41469694
has comment: http://stackoverflow.com/comment/41469807
has answer: http://stackoverflow.com/a/26410874
type: Question
accepted answer: http://stackoverflow.com/a/26410874
has comment: http://stackoverflow.com/comment/41469720
answer count: 2
score: 0

http://stackoverflow.com/a/26500161
has comment: http://stackoverflow.com/comment/41632659
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26499917
has body: Assuming that no file is bigger than max size, you can do this public List&lt;List&lt;File&gt;&gt; fileSplit(File [] files, long maxAttachmentSize) { long totalAttachmentSize = 0; List&lt;List&lt;File&gt;&gt; allLists = new ArrayList&lt;&gt;(); List&lt;File&gt; currList = new ArrayList&lt;File&gt;(); allLists.add(currList); for (File file : files) { long fileSize = file.length(); if ((totalAttachmentSize + fileSize) &lt;= maxAttachmentSize) { currList.add(file); totalAttachmentSize += fileSize; } else { totalAttachmentSize = fileSize; currList = new ArrayList&lt;File&gt;(); allLists.add(currList); currList.add(file); // assuming no file is bigger than maxAttachmentSize } } return allLists; }
accepted answer of: http://stackoverflow.com/q/26499917
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/q/26367791
score: 0
has answer: http://stackoverflow.com/a/26367909
answer count: 1
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
tagged with: java
has title: Quiz Applications
type: Question
has comment: http://stackoverflow.com/comment/41393199
has comment: http://stackoverflow.com/comment/41392733
has body: I started a simple quiz application as below it consists of TextView to show the questions and a RadioGroup consisting of 3 RadioButtons for 3 options. When you finish the quiz it shows number of correct answers and number of wrong answers and your degree. But I have some problems as below Please help me to solve it. the problems: When i click on next question its transfer me to result activity not to next questions. The Result activity page did not show the total result correctly MainActivity public class MainActivity extends ActionBarActivity { TextView tv; Button btnNext; RadioGroup rg; RadioButton rb1,rb2,rb3; String questions[]={"qqqqq","dddddd"}; String ans[]={"",""}; String opt[]={"","","","","",""}; int flag=0; public static int marks,correct,wrong; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tvque); btnNext = (Button) findViewById(R.id.button1); rg = (RadioGroup) findViewById(R.id.radioGroup1); rb1 = (RadioButton) findViewById(R.id.radio0); rb2 = (RadioButton) findViewById(R.id.radio1); rb3 = (RadioButton) findViewById(R.id.radio2); tv.setText(questions[flag]); rb1.setText(opt[0]); rb2.setText(opt[1]); rb3.setText(opt[2]); Toast.makeText(this,"Nigative mark", 1000).show(); btnNext.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub RadioButton uans=(RadioButton)findViewById(rg.getCheckedRadioButtonId()); String ansText=uans.getText().toString(); if(ansText.equalsIgnoreCase(ans[flag])) { correct++; } else { wrong++; } flag++; if(flag&lt;questions.length) { tv.setText(questions[flag]); rb1.setText(opt[flag*3]); rb2.setText(opt[(flag*3)+1]); rb3.setText(opt[(flag*3)+2]); } else { marks=correct; } Intent i=new Intent(getApplicationContext(),ResultActivity.class); startActivity(i); } }); } } ResultActivity public class ResultActivity extends ActionBarActivity { TextView …

http://stackoverflow.com/q/26451021
has comment: http://stackoverflow.com/comment/41914053
type: UnansweredQuestion
tagged with: spring
has body: I was wondering if configuration for a default scope was possible on the event of a mentioned scope being not found, for instance consider the class : @Component @Scope("undefinedScope") public myClass This alone would result on a IllegalStateException, "No scope registered for "undefinedScope" error". If possible I would like to tell Spring to autowire classes as singleton, if the desired scope is not found. Any workarounds ?
has comment: http://stackoverflow.com/comment/41543576
tagged with: java
type: Question
tagged with: scope
score: 0
has title: Spring bean scopes, possibility of configuring default scope
answer count: 0

http://stackoverflow.com/q/26466534
score: 0
tagged with: powermock
type: UnansweredQuestion
has body: //ClassUnderTest import java.util.List; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class PlanRestClientXX { private final String mySoftVimUrl; private final Logger logger = LoggerFactory.getLogger(PlanRestClient.class); public PlanRestClientXX(final String softVimUrl) { mySoftVimUrl = softVimUrl; } public List&lt;String&gt; invokeGETRequest(final String ressourceURI) { try { final ClientRequest request = createRequest(ressourceURI); request.accept("application/json"); final ClientResponse response = request.get(List.class); final List entity = (List) response.getEntity(); if (entity == null) { return null; } return entity; } catch (final Exception e) { throw new RestClientException("Exception when qyerying softvim ", e); } } private ClientRequest createRequest(final String ressourceURI) { return new ClientRequest(ressourceURI); } } //JUNIT import java.util.ArrayList; import java.util.List; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import com.nsn.ison.service.softvim.client.rest.util.URLUtil; @RunWith(PowerMockRunner.class) @PrepareForTest({PlanRestClient.class, URLUtil.class, ClientRequest.class}) // added classes here which are to be mocked. Included class-under-test(PlanRestClient.class) also (not sure why?) public class PlanRestClientXXTest { private final String mySoftVimUrl = "https://xxx"; PlanRestClientXX planRestClient; @Mock ClientRequest request; @Mock ClientResponse response; @Before …
tagged with: junit4
tagged with: java
has comment: http://stackoverflow.com/comment/41572144
has comment: http://stackoverflow.com/comment/41570917
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/41595267
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/41570946
has answer: http://stackoverflow.com/a/32644253
has title: Powermockito not working

http://stackoverflow.com/comment/41451845
comment on: http://stackoverflow.com/a/26398110
has text: your welcome. please tick the answer and also vote up my answer thanks.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41447088
score: 0
has text: You may have a look this this question, which is similar. http://stackoverflow.com/questions/26357800/how-to-get-anchor-tag-link-from-a-url-java-android
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26397949

http://stackoverflow.com/q/26505374
favorite count: 0
has answer: http://stackoverflow.com/a/26505508
has comment: http://stackoverflow.com/comment/41641624
has answer: http://stackoverflow.com/a/26505732
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41641669
has title: Why do print statements execute in this order when using initializers, constructors and method calls?
downvote count: 0
has answer: http://stackoverflow.com/a/26505489
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26505508
has comment: http://stackoverflow.com/comment/41641682
has comment: http://stackoverflow.com/comment/41644181
has body: This is the code I'm running , the output of this code is 4 2 1 3 , could someone please explain why the result was printed in this order. public class goFuncTest { goFuncTest() { System.out.print("1 "); } { System.out.print("2 "); } public static void main(String[] args) { new goFuncTest().go(); } void go() { System.out.print("3 "); } static { System.out.print("4 "); } }
has answer: http://stackoverflow.com/a/26505455
accepted answer: http://stackoverflow.com/a/26505455
upvote count: 1
linked to: http://stackoverflow.com/q/3987428

http://stackoverflow.com/q/26471499
has body: I am using a content provider for a note taking type of app. It worked fine when I had just one table in the content provider but now that I have added another table I must have messed something up. I am able to read, write &amp; delete in the app but when I try to click on the list item to update/edit the entry the app crashes telling me that has invalid tables. I know the tables are not invalid because it recognizes them when I create new entries. I believe it has something to do with my content provider because it worked fine until I tried to add a second table. Here is my code: Content Provider package com.cossioinsurance.rentalsafety.contentprovider2; import java.util.Arrays; import java.util.HashSet; import com.cossioinsurance.rentalsafety.database.TodoDatabaseHelper; import com.cossioinsurance.rentalsafety.database.NoteTable; import com.cossioinsurance.rentalsafety.database.DeviceTable; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteQueryBuilder; import android.net.Uri; import android.text.TextUtils; public class MyNoteContentProvider extends ContentProvider{ // database private TodoDatabaseHelper database; // used for the UriMacher private static final int TODOS = 10; private static final int TODO_ID = 20; private static final int DEVICES = 30; private static final int DEVICE_ID = 40; private static final String AUTHORITY = "com.cossioinsurance.rentalsafety.contentprovider2"; private static final String BASE_PATH = "todos"; private static final String DEVICE_PATH = "devices"; public static final Uri CONTENT_URI_TODOS = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH); public static final Uri CONTENT_URI_DEVICES = Uri.parse("content://" + AUTHORITY + "/" + DEVICE_PATH); public static final String CONTENT_TYPE_TODOS = ContentResolver.CUR…
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26489779
score: 0
tagged with: java
has title: Content Provider Multiple Tables Error on Update
type: Question

http://stackoverflow.com/q/26366368
has comment: http://stackoverflow.com/comment/41390447
has body: I have this method that selects movie showtimes by movie ID from a MySQL database and puts them in a Time[]. However, it is throwing a syntax exception near '? ORDER BY schedule_id' according to the trace. public Time[] getShowTimes(int movieId) { List&lt;Time&gt; list = new ArrayList&lt;Time&gt;(); try { sql = "SELECT schedule_time FROM schedule WHERE movie_id = ? ORDER BY schedule_id"; ps = conn.prepareStatement(sql); ps.setInt(1, movieId); rs = ps.executeQuery(sql); while(rs.next()) { list.add(rs.getTime(1)); } } catch(SQLException se) { se.printStackTrace(); } Time[] times = new Time[list.size()]; times = list.toArray(times); return times; } I followed this example (if that helps). What could be wrong?
type: AnsweredQuestion
has title: SELECT with WHERE using PreparedStatement
score: 1
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41390154
upvote count: 1
tagged with: prepared-statement
type: Question
accepted answer: http://stackoverflow.com/a/26366487
has comment: http://stackoverflow.com/comment/41390342
tagged with: sql
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/26366487

http://stackoverflow.com/comment/41496497
type: QuestionComment
has text: The point is to measure it exactly the way you plan to use it.
score: 2
comment on: http://stackoverflow.com/q/26423045
type: Comment

jpa
tags question: http://stackoverflow.com/q/26434199
tags question: http://stackoverflow.com/q/26511379
tags question: http://stackoverflow.com/q/26377999
tags question: http://stackoverflow.com/q/26366556
tags question: http://stackoverflow.com/q/26381394
tags question: http://stackoverflow.com/q/26410872
tags question: http://stackoverflow.com/q/26420478
tags question: http://stackoverflow.com/q/26387302
tags question: http://stackoverflow.com/q/26482248
tags question: http://stackoverflow.com/q/26408976
tags question: http://stackoverflow.com/q/26513674
tags question: http://stackoverflow.com/q/26501436
tags question: http://stackoverflow.com/q/26443097
tags question: http://stackoverflow.com/q/26388764
tags question: http://stackoverflow.com/q/26467006
tags question: http://stackoverflow.com/q/26419194
tags question: http://stackoverflow.com/q/26481224
tags question: http://stackoverflow.com/q/26478690
tags question: http://stackoverflow.com/q/26497676
tags question: http://stackoverflow.com/q/26362470
tags question: http://stackoverflow.com/q/26468245
tags question: http://stackoverflow.com/q/26386229
tags question: http://stackoverflow.com/q/26429041
tags question: http://stackoverflow.com/q/26485936
tags question: http://stackoverflow.com/q/26406393
type: Tag
tags question: http://stackoverflow.com/q/26371556
tags question: http://stackoverflow.com/q/26444190
tags question: http://stackoverflow.com/q/26397755
tags question: http://stackoverflow.com/q/26409897
tags question: http://stackoverflow.com/q/26437501
tags question: http://stackoverflow.com/q/26449214
tags question: http://stackoverflow.com/q/26416881
tags question: http://stackoverflow.com/q/26377514
tags question: http://stackoverflow.com/q/26426083
tags question: http://stackoverflow.com/q/26422320
tags question: http://stackoverflow.com/q/26443952
tags question: http://stackoverflow.com/q/26502577
tags question: http://stackoverflow.com/q/26358833
tags question: http://stackoverflow.com/q/26468910
tags question: http://stackoverflow.com/q/26372340
tags question: http://stackoverflow.com/q/26457112
tags question: http://stackoverflow.com/q/26483603
tags question: http://stackoverflow.com/q/26372290
tags question: http://stackoverflow.com/q/26416847
tags question: http://stackoverflow.com/q/26393020
tags question: http://stackoverflow.com/q/26355535
tags question: http://stackoverflow.com/q/26421859
tags question: http://stackoverflow.com/q/26367983
tags question: http://stackoverflow.com/q/26384420
tags question: http://stackoverflow.com/q/26444253
tags question: http://stackoverflow.com/q/26379522
tags question: http://stackoverflow.com/q/26511552
tags question: http://stackoverflow.com/q/26375565
tags question: http://stackoverflow.com/q/26426878
tag name: jpa
tags question: http://stackoverflow.com/q/26454867
tags question: http://stackoverflow.com/q/26508998
tags question: http://stackoverflow.com/q/26503627
tags question: http://stackoverflow.com/q/26491406
tags question: http://stackoverflow.com/q/26417089
tags question: http://stackoverflow.com/q/26484166
tags question: http://stackoverflow.com/q/26483327
tags question: http://stackoverflow.com/q/26388848
tags question: http://stackoverflow.com/q/26359702
tags question: http://stackoverflow.com/q/26443859
tags question: http://stackoverflow.com/q/26388548
tags question: http://stackoverflow.com/q/26366484
tags question: http://stackoverflow.com/q/26424092
tags question: http://stackoverflow.com/q/26406205
tags question: http://stackoverflow.com/q/26476057
tags question: http://stackoverflow.com/q/26478098
tags question: http://stackoverflow.com/q/26497029
tags question: http://stackoverflow.com/q/26487782
tags question: http://stackoverflow.com/q/26366281

http://stackoverflow.com/comment/41561484
type: AnswerComment
has text: do you know how i can make it accept 22.483.84.3883? or one that contains dashes?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26461214

http://stackoverflow.com/comment/41539631
type: AnswerComment
comment on: http://stackoverflow.com/a/26448940
type: Comment
has text: Very good answer and also focusses on what he was trying to do in the first place instead of making everything static. +1
score: 1

http://stackoverflow.com/a/26441927
upvote count: 3
has body: I never encountered a Swing UI which was slow due to the number of JComponents visible. What I do often see is a sluggish UI because the UI thread is used/abused to perform all kinds of work not related to UI updates. In Swing, there is only one thread on which you may update the UI, and that same thread is responsible for painting the UI (the Event Dispatch Thread). If you block this thread by e.g. performing calculations on it, the UI will not be able to repaint or react on user input while your calculation is running. That is why you must perform all heavy work on a worker thread. This is clearly explained in the Concurrency in Swing tutorial. Not 100% sure that is what happening in your case, but it definitely sounds like it. If you want to be sure, take a thread dump while you are waiting for your UI and see what the thread named AWT-EventQueue-0 is doing at that moment. If it really takes 5 minutes before your UI is updated, you must be able to locate fairly quickly what is blocking the UI.
has comment: http://stackoverflow.com/comment/41571709
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41561067
answers question: http://stackoverflow.com/q/26441804
type: Answer

http://stackoverflow.com/a/26452029
answers question: http://stackoverflow.com/q/26447519
upvote count: 1
has comment: http://stackoverflow.com/comment/41706513
type: Answer
has comment: http://stackoverflow.com/comment/41747157
downvote count: 0
score: 1
has body: I'd encourage you to file a bug at: https://netbeans.org/bugzilla/enter_bug.cgi?product=serverplugins and use WildFly as the category. Have you tried running WildFly using a CLI and see if your IDE related problems go away ?

http://stackoverflow.com/q/26411368
type: Question
tagged with: java
has title: Parser code not working properly
has answer: http://stackoverflow.com/a/26429963
has body: I have trouble in simple parser wrote in Java. This parser is parsing string by-letter and than saves tokens into arraylist, than parser processes that tokens (e.g. 'PUT', or 'STRING:...') That's my code: package net.ruza; import java.util.*; public class SimpleParser { public static void main(String[] args) { SimpleParser simpleParser = new SimpleParser(); Scanner sc = new Scanner(System.in); String input = "###"; List&lt;String&gt; data = new ArrayList&lt;String&gt;(); while (input.length() &gt; 1) { input = sc.nextLine(); data.addAll(simpleParser.lex(input)); } for (String s : data) { System.out.println(s); } simpleParser.parse(data); } public List&lt;String&gt; lex(String parse) { List&lt;String&gt; tokens = new ArrayList&lt;String&gt;(); boolean stringFound = false; StringBuilder string = new StringBuilder(); StringBuilder tok = new StringBuilder(); for (char c : parse.toCharArray()) { tok.append(c); if (tok.toString().equals("put")) { tokens.add("PUT"); tok = new StringBuilder(); } else if (tok.toString().equals(" ") &amp;&amp; !stringFound) { tok = new StringBuilder(); } else if (!stringFound &amp;&amp; (tok.toString().equals("\"") || tok.toString().equals("'"))) { stringFound = true; tok = new StringBuilder(); System.out.println("String found!"); } else if (stringFound &amp;&amp; (tok.toString().equals("\"") || tok.toString().equals("'"))) { tokens.add("STRING:'" + string.toString() + "'"); System.out.println("String end!"); tok = new StringBuilder(); string = new StringBuilder(); stringFound = false; } else if (stringFound) { string.append(c); tok = new StringBuilder(); } } return tokens; } public void parse(List&lt;String&gt; tokens) { System.out.println("Parser invoked!"); boolean putNext = false; for (String s : tokens) { if (s.equals("PUT")) { putNext = true; } else if (putNext &amp;&amp; (s.substring(0, 5).equals("STRING") || s.substring(0, 2).equals("NUM"))) { doPrint(s); } else System.err.println("Invalid token!"); } } public void doPrint(String toPr…
answer count: 1
tagged with: string
favorite count: 0
tagged with: token
accepted answer: http://stackoverflow.com/a/26429963
tagged with: parsing
has comment: http://stackoverflow.com/comment/41470698
type: AnsweredQuestion
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/41517157
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26436187
has text: I like that you have broken your homework in 3-4 stackoverflow questions...why don't you try writing those methods yourself? It is very easy for me to give you the full answer and get a reputation bump in a sec but I will resist :O)

http://stackoverflow.com/comment/41469602
comment on: http://stackoverflow.com/a/26410395
type: Comment
has text: Okay, it looks like you're using Spring MVC. There are several, confusing ways to deal with exceptions using Spring MVC, but my basic advice is still the same: don't write `try/catch` blocks. [This article](http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc) may be helpful to you.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41618613
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26491564
type: QuestionComment
has text: I uploaded the whole project to Dropbox temporary because I really don't know what to do. [link](https://dl.dropboxusercontent.com/u/36670712/Programming/SGPRadio/SGPRadio%2022.10.14.zip) Please help me take a look.. thanks :) and if possible correct any error I have made in there! :)

http://stackoverflow.com/a/26470443
answers question: http://stackoverflow.com/q/26470228
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41578990
has comment: http://stackoverflow.com/comment/41578515
has comment: http://stackoverflow.com/comment/41578534
upvote count: 1
has comment: http://stackoverflow.com/comment/41579619
has comment: http://stackoverflow.com/comment/41578622
type: Answer
has body: You are getting Null Pointer Exception. Do the following for your if statement. if (password != null &amp;&amp; password.equalsIgnoreCase("password")) { } else { System.exit(0); } When you do cancel password is set to null (same if you just exit), so you need to check for that, because otherwise your program crashes.

http://stackoverflow.com/comment/41636192
score: 10
comment on: http://stackoverflow.com/q/26502235
type: Comment
type: QuestionComment
has text: Offtopic, but you should check difference between popped and pooped. lol.

http://stackoverflow.com/q/26412145
has answer: http://stackoverflow.com/a/26612178
has body: I am developing a rcp application which is distributed as a web start application. It is working at java 7u65 but after upgrading to 7u72, it is not working anymore. Application is signed with a trusted certificate and permissions: all-permissions and codebase: * attributes are added to manifest file. And jnlp template file is signed at launcher jar file. At log file following error is printed: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "*" "read,write") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPropertiesAccess(Unknown Source) at java.lang.System.getProperties(Unknown Source) at org.eclipse.equinox.launcher.Main.takeDownSplash(Main.java:1942) at org.eclipse.equinox.launcher.Main$SplashHandler.run(Main.java:109) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:183) 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.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.WebStartMain.basicRun(WebStartMain.java:79) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.WebStartMain.main(WebStartMain.java:57) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launch…
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: Web start application not starting after upgrade to java 7u72
accepted answer: http://stackoverflow.com/a/26612178
type: Question
downvote count: 0
answer count: 1
tagged with: java-web-start
favorite count: 0

http://stackoverflow.com/comment/41649282
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26509420
score: 0
has text: I forgot to mention that every permutation I can think of for getClass().getResource("file.css") always returns null.

http://stackoverflow.com/a/26356394
has body: What is the memory available with your machine? I see the parameters -Xms1G -Xmx1G. This means that your JVM will be started with Xms=1GB amount of memory and will be able to use a maximum of Xmx=1GB amount of memory. I think, may be you reduce the amount of memory (like -Xmx2048m -Xms256m). I hope it helps. You can refer to this.
upvote count: 2
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26356305

http://stackoverflow.com/comment/45764925
type: QuestionComment
has text: What is the tool that u are using for CDC and near real-time?
type: Comment
comment on: http://stackoverflow.com/q/26441130
score: 0

http://stackoverflow.com/comment/41445788
type: Comment
comment on: http://stackoverflow.com/q/26397064
score: 0
type: QuestionComment
has text: i need to restrict perticular Active Directory Domain users from accessing applications.

http://stackoverflow.com/q/26396532
answer count: 3
has answer: http://stackoverflow.com/a/26792956
has answer: http://stackoverflow.com/a/26396553
has body: I have no problem using a method int to run this program; however I wanted to be able to learn how to do the void method. I know the return statement isn't necessary in void, and for void with two int parameters. In my book it said parameters should be written as (int a, int b). However, in my code for lines 16 and 17 sum = computeSum(num1, num2); product = computeProduct(num1, num2);) I get the error incompatible types, void cannot be converted to int. How do I rectify this for future reference? Thanks so much! import java.util.Scanner; public class Lab6 { public static void main (String [] args) { //create a scanner object for receiving user input Scanner keyboard = new Scanner (System.in); int num1, num2, sum, product; System.out.println ("Please enter an integer: "); num1 = keyboard.nextInt(); System.out.println ("Please enter another integer: "); num2 = keyboard.nextInt(); sum = computeSum(num1, num2); product = computeProduct(num1, num2); } public static void computeSum(int num1, int num2) { int sum = 0; sum = num1 + num2; System.out.println ("The sum of your integers is " + sum); } public static void computeProduct(int num1, int num2) { int product = 0; product = num1 * num2; System.out.println("\nThe product of your integers is: " + product); } }
tagged with: void
tagged with: parameters
type: UnansweredQuestion
tagged with: java
tagged with: error-handling
tagged with: methods
type: Question
has title: using a void method with two int parameters instead of an int?
has answer: http://stackoverflow.com/a/26396555
has comment: http://stackoverflow.com/comment/41444499
score: 0

http://stackoverflow.com/q/26354774
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26356855
score: 2
upvote count: 2
has title: Specific line from file using java
has answer: http://stackoverflow.com/a/26354864
tagged with: java
possible better answer: http://stackoverflow.com/a/26354822
accepted answer: http://stackoverflow.com/a/26354889
has answer: http://stackoverflow.com/a/26354822
type: Question
has body: I want to print from a file a specific line, for example the fourth line or the second line. This is my code and it only displays all lines and each lines number. I'm sorry if this is a simple and stupid question, but thank you in advance :D. FileReader fr = null; LineNumberReader lnr = null; String str; int i; try{ // create new reader fr = new FileReader("test.txt"); lnr = new LineNumberReader(fr); // read lines till the end of the stream while((str=lnr.readLine())!=null) { i=lnr.getLineNumber(); System.out.print("("+i+")"); // prints string System.out.println(str); } }catch(Exception e){ // if any error occurs e.printStackTrace(); }finally{ // closes the stream and releases system resources if(fr!=null) fr.close(); if(lnr!=null) lnr.close(); } } }
linked to: http://stackoverflow.com/q/16623990
downvote count: 0
has comment: http://stackoverflow.com/comment/41369370
favorite count: 0
has answer: http://stackoverflow.com/a/26354889

http://stackoverflow.com/a/26369272
has body: Should I alter my tables in PdvHandler, because it is the file which define DB version? Should I alter my tables in each handler file? ( I have 1 handler x table = 10 handlers) You should have only one SQLiteOpenHelper per database file. onUpgrade() gets called when the version of the database schema you request with the parameter supplied to SQLiteOpenHelper constructor is larger than the schema version stored in the database file. If the database file was already upgraded to your requested version by one sqlite helper working on the same database file, onUpgrade() is not invoked on another helper. Also, you should not catch exceptions in onCreate() or onUpgrade(). If there's a problem, the exception should be thrown outside the method. See also: When is SQLiteOpenHelper onCreate() / onUpgrade() run?
score: 0
answers question: http://stackoverflow.com/q/26367077
has comment: http://stackoverflow.com/comment/41405890
type: Answer
has comment: http://stackoverflow.com/comment/41400733
has comment: http://stackoverflow.com/comment/41476204

http://stackoverflow.com/q/26418845
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26419254
has title: Method that counts amount of chars
has comment: http://stackoverflow.com/comment/41484402
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41484438
has answer: http://stackoverflow.com/a/26418911
tagged with: java
type: Question
has body: I've created a bank. I need this "Luhn" class to validate the social security number. The problem is, when the user inputs a number that's 1-9 digits, the program just stops. I want it to show a message like "Invalid input. Please try again". How do i do that? package bank6; import java.util.Scanner; public class Luhn { public static boolean checkLogin(String custPnr) { int length = custPnr.length(); int sum = 0; int pos = length-1; for (int i = 1; i&lt;=10; i++, pos--){ char tmp = custPnr.charAt(pos); int num = Integer.parseInt(String.valueOf(tmp)); int produkt; if (i % 2 != 0){ produkt = num * 1; }else { produkt = num * 2; } if ( produkt &gt; 9 ) produkt -= 9; sum += produkt; } boolean korrekt = (sum % 10) == 0; if (korrekt){ System.out.println("Correct"); return true; }else { System.out.println("Invalid"); return false; } } public static void main(String[] args) { String pnr; System.out.println("Welcome customer. Please login by using your "+ "birthdate (yymmddxxxx)"); Scanner input = new Scanner(System.in); pnr = input.nextLine(); checkLogin(pnr); } } EDIT; Okay, i edited my code. But i still get errors. I Think im kind of retarded when i comes to coding. Im about to eat my own head soon. I understand why i am getting infinite recurse but not how to fix it. And how do i fix so i dont have to print out the message to the customer two times? i am trying to build a bank. To even get logged in to watch your accounts and so on you need to validate you're a Swedish citizen by typing in a Swedish social security number. This is a class were the validation of code is. The codes mission is to validate the security number. If the number is fake, the code will give an "false" return (bottom of code) and "true" return if its true. The problem i had in the start was that if someone typed in a 1-9 digit number then it would just crash. I wanted it to give a "Sorry, invalid input. Please try again" and then the user was supposed to be taken back to the login and try again. I c…

http://stackoverflow.com/a/26474745
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You have three options to access one app's datastore from another: As suggested in the comments you can use Modules to combine the two apps into one. Read more here: https://cloud.google.com/appengine/docs/java/modules/ You can use remote_api to connect one app's datastore from another. Read more here: https://cloud.google.com/appengine/docs/java/tools/remoteapi You can write your own simple REST API that will server one app the data from its own datastore.
accepted answer of: http://stackoverflow.com/q/26473474
upvote count: 3
answers question: http://stackoverflow.com/q/26473474
score: 3

http://stackoverflow.com/q/26395501
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26395604
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/41443090
has comment: http://stackoverflow.com/comment/41443014
has comment: http://stackoverflow.com/comment/41443456
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41443149
has comment: http://stackoverflow.com/comment/41443047
has comment: http://stackoverflow.com/comment/41442847
has comment: http://stackoverflow.com/comment/41443037
has body: the exception is: Exception in thread “main” java.lang.NullPointerException at javax.swing.ImageIcon.&lt;init&gt;(Unknown Source), at PlayGame.setCards(PlayGame.java:42) at PlayGame.startGame(PlayGame.java:190) at forms.PlayGame.&lt;init&gt;(PlayGame.java:36) this is my code public class PlayGame extends javax.swing.JFrame { private LogicGame logic = new LogicGame(); private ImageIcon img1; private ImageIcon img2; // Creates new form PlayGame public PlayGame() { initComponents(); startGame(); } private void setCards() { int[] numbers = logica.getCardNumbers(); Carta1.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[0] + ".png"))); Carta2.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[1] + ".png"))); Carta3.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[2] + ".png"))); Carta4.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[3] + ".png"))); Carta5.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[4] + ".png"))); Carta6.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[5] + ".png"))); Carta7.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[6] + ".png"))); Carta8.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[7] + ".png"))); Carta9.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[8] + ".png"))); Carta10.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[9] + ".png"))); Carta11.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[10] + ".png"))); Carta12.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[11] + ".png"))); Carta13.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[12] + ".png"))); Carta14.setDisabledIcon(new ImageIcon(getClass().getResource("../img/c" + numbers[13] + ".png"))); Carta15.setDisabledIcon(new ImageIcon(getClass().getResource("../i…
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41442808
tagged with: java
has comment: http://stackoverflow.com/comment/41443101
duplicate of: http://stackoverflow.com/q/218384
has title: How can I solve Exception in thread “main” java.lang.NullPointerException error

http://stackoverflow.com/q/26478170
has comment: http://stackoverflow.com/comment/41593384
favorite count: 0
has comment: http://stackoverflow.com/comment/41593069
has title: Why do I get "Static Error: This class does not have a static void main method accepting String[]." even though I have it?
accepted answer: http://stackoverflow.com/a/26478251
type: AnsweredQuestion
has body: I'm getting "Static Error: This class does not have a static void main method accepting String[]." even though I have "public static void main(String args[])" as part of my code using Dr. Java public static void main(String args[]) throws Exception { // just for testing purposes int myArray[] = {4,6,8,1,3,2,9,5,7,6,4,2,1,3,9,8,7,5}; mergeSort(myArray); System.out.println("Sorted array is:\n"); for (int i = 0; i &lt; myArray.length; i++) { System.out.print(myArray[i] + " "); } System.out.println(); } There is code above this, I have no errors but when I try to run the code I get that error. Thanks in advance. Below is the code aside from the object class class MergeSortNonRecursive { static Stack&lt;ProgramFrame&gt; callStack; // this implement the merge algorithm seen in class. Feel free to call it. public static void merge(int A[], int start, int mid, int stop) { int index1 = start; int index2 = mid + 1; int tmp[] = new int[A.length]; int indexTmp = start; while (indexTmp &lt;= stop) { if (index1 &lt;= mid &amp;&amp; (index2 &gt; stop || A[index1] &lt;= A[index2])) { tmp[indexTmp] = A[index1]; index1++; } else { if (index2 &lt;= stop &amp;&amp; (index1 &gt; mid || A[index2] &lt;= A[index1])) { tmp[indexTmp] = A[index2]; index2++; } } indexTmp++; } for (int i = start; i &lt;= stop; i++) A[i] = tmp[i]; } static void mergeSort(int A[]) { /* WRITE YOUR CODE HERE */ //stack we use callStack = new Stack&lt;ProgramFrame&gt;(); //initial program frame ProgramFrame current = new ProgramFrame(0, A.length - 1, 1); //put frame on stack callStack.push(current); //as long as our stack isn't empty... while (!callStack.empty()) { //as long as the top Frame contains more than one integer while (callStack.peek().start &lt; callStack.peek().stop) { //must be defined before pushing or else the values mess up int left = callStack.peek().start; int middle = (callStack.peek().start + callStack.peek().stop) / 2; int right = callStack.peek().stop; current = new ProgramFrame(middle + 1, rig…
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41593400
answer count: 2
has comment: http://stackoverflow.com/comment/41593163
has comment: http://stackoverflow.com/comment/41593359
has comment: http://stackoverflow.com/comment/41593088
has answer: http://stackoverflow.com/a/26478251
has comment: http://stackoverflow.com/comment/41593098
has comment: http://stackoverflow.com/comment/41593035
has comment: http://stackoverflow.com/comment/41593081
possible better answer: http://stackoverflow.com/a/35074548
has answer: http://stackoverflow.com/a/35074548

http://stackoverflow.com/comment/41473783
type: AnswerComment
comment on: http://stackoverflow.com/a/26392383
score: 0
type: Comment
has text: Added another link in answer check that its paid library but you can check there trial version.

http://stackoverflow.com/comment/41447079
type: Comment
comment on: http://stackoverflow.com/a/26397834
has text: Thanks for your reply. My Java version is 7 and update 47. Anyway I have removed BIRT version 4.4.2 and installed 2.2.6. Everything seems ok now.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41678328
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26502192
has text: You have hit the magic restart key on your machine, happens all the time ;)
type: Comment

http://stackoverflow.com/q/26457464
has body: I am using javamail to access the available folders in james mail server but my code is throwing an exception try { Store store = mailSession.getStore(); store.connect("localhost", username , password ); Folder folder = store.getDefaultFolder(); Folder[] f = folder.list("*"); for (Folder fd : f) { System.out.println(fd.getName()); } } catch (MessagingException e) { // TODO Auto-generated catch block e.printStackTrace(); } Note : exception is thrown when calling list() method Exception : Caused by: com.sun.mail.iap.CommandFailedException: A3 NO LIST failed. Search failed.
has comment: http://stackoverflow.com/comment/41559288
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/41555456
score: 0
tagged with: jakarta-mail
has title: Cannot get the list of available folders in a apache james mail server using JavaMail
has comment: http://stackoverflow.com/comment/41555267
tagged with: email
tagged with: james

variables
tag name: variables
tags question: http://stackoverflow.com/q/26451548
tags question: http://stackoverflow.com/q/26442434
tags question: http://stackoverflow.com/q/26414762
tags question: http://stackoverflow.com/q/26450209
tags question: http://stackoverflow.com/q/26409236
tags question: http://stackoverflow.com/q/26364243
type: Tag
tags question: http://stackoverflow.com/q/26456992
tags question: http://stackoverflow.com/q/26431913
tags question: http://stackoverflow.com/q/26413406
tags question: http://stackoverflow.com/q/26398048
tags question: http://stackoverflow.com/q/26382226
tags question: http://stackoverflow.com/q/26488335
tags question: http://stackoverflow.com/q/26495704
tags question: http://stackoverflow.com/q/26469705
tags question: http://stackoverflow.com/q/26367288
tags question: http://stackoverflow.com/q/26394586

http://stackoverflow.com/comment/41602662
has text: I tried that, it didn't work.. Also, I'm getting below error Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Java HotSpot(TM) Server VM warning: You have loaded library /home/work/pradeep.rajan/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20140603-1326/eclipse_1605.so which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'. Gtk-Message: Failed to load module "atk-bridge"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26483625
type: AnswerComment

http://stackoverflow.com/comment/41613174
comment on: http://stackoverflow.com/a/26489588
type: AnswerComment
score: 0
type: Comment
has text: every class extends Object class, so protected clone method should be visible

http://stackoverflow.com/comment/41592151
type: AnswerComment
type: Comment
has text: @ Soham ... You are welcome ! ... If you find my answer helpful mark it as accepted or if you have found a better solution post as your answer and mark that as accepted .. So that it is helpful for someone else looking for same query that you have asked ! .... Cheers !
comment on: http://stackoverflow.com/a/26463354
score: 0

http://stackoverflow.com/comment/41563392
type: QuestionComment
type: Comment
has text: Yes, there are several.
comment on: http://stackoverflow.com/q/26462303
score: 0

http://stackoverflow.com/comment/41604831
type: QuestionComment
has text: Classic deadlock situation. To prevent this have a look into semaphores.
type: Comment
comment on: http://stackoverflow.com/q/26485020
score: 0

http://stackoverflow.com/q/26427693
has comment: http://stackoverflow.com/comment/41500518
has answer: http://stackoverflow.com/a/26428012
score: 0
has comment: http://stackoverflow.com/comment/41500590
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41500570
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41500915
has comment: http://stackoverflow.com/comment/41500630
accepted answer: http://stackoverflow.com/a/26428012
has body: I can't figure out how to do this. I have this constraint: at most 5 threads concurrently can read a variable , the others must keep in wait until the variable can be read again. public void methodA() { lockI.lock(); try { while (countIreaders == 5 || modify) { conditionI.await(); } countIreaders++; } catch (InterruptedException e) { e.printStackTrace(); } finally { if (condition) { countIreaders = 0; lockI.unlock(); conditionI.notifyAll(); } else { lockI.unlock(); } } } With this code I made it serial, but it isn't what I want to achieve. How can I modify the code?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41500578
has title: synchronize read of variable
type: Question

http://stackoverflow.com/q/26450297
answer count: 1
favorite count: 0
has body: My dearest community, I m new to the play Framework and wanted to simply add a String to the Cache. In the next step I want to display this String on the website. My model class looks like this: package models; public class Input { public String text; public void setText(String text){ this.text = text; } public String getText(){ return text; } } The cache is enabled in the settings. I use the default Cache (I think it's EHCache). Thanks for all your answers!
tagged with: ehcache
has answer: http://stackoverflow.com/a/26450382
upvote count: 1
accepted answer: http://stackoverflow.com/a/26450382
type: AnsweredQuestion
tagged with: playframework-2.3
tagged with: java
tagged with: caching
downvote count: 1
type: Question
has title: Caching a String with the play Framework 2.3.5
score: 0
tagged with: playframework

http://stackoverflow.com/comment/41460714
has text: possible duplicate of [EJB Transactions in local method-calls](http://stackoverflow.com/questions/427452/ejb-transactions-in-local-method-calls)
comment on: http://stackoverflow.com/q/26401802
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/41584382
type: Comment
score: 0
has text: @JacopoTerrinoni I'm glad to hear this. You can accept the answer to help others to find a solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/26454354

http://stackoverflow.com/comment/41593400
comment on: http://stackoverflow.com/q/26478170
has text: That's unreal. I'm using Dr.Java.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26390176
has comment: http://stackoverflow.com/comment/41434034
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/41434880
favorite count: 0
type: UnansweredQuestion
has title: Infinite Integer in Java
upvote count: 1
has comment: http://stackoverflow.com/comment/41433747
downvote count: 1
has comment: http://stackoverflow.com/comment/41433717
has body: I don't think I'm approaching this the right way. I'm supposed to create a class that allows users to enter in any number not matter how big it is (Of course, with the restrictions of memory it's not really infinite). I have some code but I'm pretty sure the quality is crap. I seem to be having the most trouble with a string and have been avoiding it. I'll only post what I have worked on. I just need help clearing it up because I don't think I'm going in the right direction. Here is what my code has so far. I apologize. I'm not a very seasoned coder.: public class InfiniteInteger implements Comparable&lt;InfiniteInteger&gt; { // TO DO: Instance Variables public final int BigNumbers; public final String Infinite; public final int []integerArray; public InfiniteInteger(String s) { // TO DO: Constructor Infinite=s; } public InfiniteInteger(int anInteger) { // TO DO: Constructor BigNumbers=anInteger; integerArray= new int[anInteger]; } public int getNumberOfDigits() { // TO DO: return an integer representing the number of digits of this infinite integer. // int NumberOfDigits=0; for(int i=0; NumberOfDigits&lt;0;i++){ } return BigNumbers; } /** * Checks whether this infinite integer is a negative number. * @return true if this infinite integer is a negative number. * Otherwise, return false. */ public boolean isNegative() { // TO DO if(isNegative()) { return true; } else return false; } Do I need to convert the string to int in my first constructor. I also had made an array previously in the string constructor but it caused a whole lot of grief so I got rid of it and just put one in the second constructor.
has answer: http://stackoverflow.com/a/26390243
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26390218
has answer: http://stackoverflow.com/a/26390221

http://stackoverflow.com/a/28938316
has comment: http://stackoverflow.com/comment/73031716
has comment: http://stackoverflow.com/comment/73022068
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/64343322
accepted answer of: http://stackoverflow.com/q/26466289
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26466289
has body: Here is the code I use to remove the first line of a csv file: JavaRDD&lt;String&gt; rawInputRdd = sparkContext.textFile(dataFile); Function2 removeHeader= new Function2&lt;Integer, Iterator&lt;String&gt;, Iterator&lt;String&gt;&gt;(){ @Override public Iterator&lt;String&gt; call(Integer ind, Iterator&lt;String&gt; iterator) throws Exception { if(ind==0 &amp;&amp; iterator.hasNext()){ iterator.next(); return iterator; }else return iterator; } }; JavaRDD&lt;String&gt; inputRdd = rawInputRdd.mapPartitionsWithIndex(removeHeader, false);
type: Answer

http://stackoverflow.com/comment/41440193
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26393803
has text: @KelvinNg There are no missing commas. it's just that the data input ended
type: Comment

http://stackoverflow.com/comment/41376539
has text: That's not quite clear. In the case execution of the break statement, which completes abruptly itself, includes attemping to transfer control to the nearest enclosing while and completes the while normally. Now, following by JLS 14.20 the control is transfered to the finally statement. Why not?
type: AnswerComment
comment on: http://stackoverflow.com/a/26355369
score: 0
type: Comment

http://stackoverflow.com/comment/41534690
has text: Why not use LookAt() function instead?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26444876
score: 1

http://stackoverflow.com/comment/41413234
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26377169
has text: See the NetBeans manual for a list of requirements for each installer type: http://docs.oracle.com/cd/E40938_01/doc.74/e40142/build_japps.htm#BABDGHDF

basex
tags question: http://stackoverflow.com/q/26378324
tag name: basex
type: Tag

http://stackoverflow.com/comment/41416456
comment on: http://stackoverflow.com/a/26377169
has text: OK. Thanks a lot. I installed Inno setup software and tried.. But there is an problem with sqlite db.. It is not migrating with exe file..
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26501666
has body: If you make sure that there is at most one class loader then there is no need for synchronization. The static initialization code is run once per class loader. From what i can see in the Jetty WebAppContext only one class loader can be set in configuration.
answers question: http://stackoverflow.com/q/26501549
type: Answer
has comment: http://stackoverflow.com/comment/41894919
score: 0

http://stackoverflow.com/a/26446398
upvote count: 1
has body: Your pairs variable is a Map Entry variable, but the value if it is probably a HashMap according to the description of your problem. Try HashMap names = (HashMap) pairs.getValue();.
accepted answer of: http://stackoverflow.com/q/26446248
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26446248
score: 1

http://stackoverflow.com/comment/41473876
score: 0
has text: Oh okay. If let us say JFrame displays either red or blue irrespective of the previous color it is showing, is there any other way I can do it without asking the user for a color?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26412730

http://stackoverflow.com/q/26477999
linked to: http://stackoverflow.com/q/5947063
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/41592983
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41632354
tagged with: http://stackoverflow.com/tag/html
has body: I have searched for the past few days for a solution to this problem and I am beating my head against the wall. I'm knew to programming in java so bear with me. I am currently trying to implement a Java Applet into an HTML page of mine for a school project. The Applet runs fine in Eclipse using AppletViewer, as well as in the web browser in a program called Blue Jay. I have exported the program into a jar file in the same directory as my HTML page, and added the necessary code to my HTML file, but whenever I actually run the HTML file the Applet gives me an "Illegal Argument Exception: name" error. The details of the error include the phrase "java.net.MalformedURLException:unknown protocol:e." This is the relevant code for my HTML file: Animation of moving boxes When the error occurs the phrase inside of the applet tags is not displayed either if that is significant. I have tried exporting other applets to see if they work and have received the same error every time. I'm also fairly certain that the destination for the file is correct, because when I change the destination name to something incorrect a "Class Not Found" error occurs instead. And in the off chance that the error is in my applet, here is my applet code. package theBig; import java.awt.*; public class MovingBoxes extends java.applet.Applet implements Runnable { Thread runner; int size = 15; int x_value = 200; int y_value = 175; int rndm_x; int rndm_y; int move = 1; int cntr = 0; Image dbImage; Graphics dbg; int x_value2 = 240; int y_value2 = 250; int rndm_x2; int rndm_y2; public void start() { if (runner == null) { runner = new Thread(this); runner.start(); } } public void stop() { if (runner != null) { runner.stop(); runner = null; } } public void run() { setBackground(Color.white); while (true) { rndm_x = (int)(Math.random()*10+1); rndm_y = (int)(Math.random()*10+1); if (rndm_x > 5) x_value += move; else x_value -= move; if (rndm_y > 5) y_value = 50; else y_value = 50; rndm_x2 = (int)(Math.random()*1…
has comment: http://stackoverflow.com/comment/41622413
linked to: http://stackoverflow.com/q/6255106
has title: Illegal Argument Exception- name
tagged with: java
has comment: http://stackoverflow.com/comment/41592934
type: Question
has answer: http://stackoverflow.com/a/26481263
has comment: http://stackoverflow.com/comment/41625290
tagged with: illegalargumentexception
score: 0

http://stackoverflow.com/comment/41468432
has text: I'm not prefer assign with single String only.. Seems like they have so many choice.. thanks guys :)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26410003

http://stackoverflow.com/a/30542687
answers question: http://stackoverflow.com/q/26468087
upvote count: 1
has body: ViewCompat.setElevation()/getElevation() doesnt work on pre Lollipop. There isnt anything worth checking out at the support library, at least until version 21.1.1 As for creating an elevation effect by yourself take a look at this
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26387555
accepted answer of: http://stackoverflow.com/q/26387205
has body: You can press Alt+Enter while your cursor is in the unresolved symbol to bring up a list of options to attempt to resolve the symbol. If Android Studio finds one or more classes with a matching name, it will list them and give you the option to import them.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26387205

http://stackoverflow.com/q/26433912
has answer: http://stackoverflow.com/a/26433961
accepted answer: http://stackoverflow.com/a/26433961
tagged with: java
has title: My array isn't retaining its values outside the while loop?
has body: I'm testing to see if my array list has retained the values from my text file and when I print the array outside the while loop to check this I only get the last value (20141013) from the file. When I print the for loop inside the while loop I get the list line by line. The problem is I have to now take that array, remove anything that isn't 8 digits print it, take the values that are 8 digits print it and then sort that and print it but I don't think my array is retaining those values. How can I make sure my array is filled with the correct values? I don't have to validate any of the dates. 20141003 20131105 19990205 20080304,20080305,20080306 19990206,hello,20141001,200003 20050505 July November,August 19640503 19980707 19642199 20141013 import java.util.*; public class Tokens1 { public static TextFileInput myFile; public static StringTokenizer myTokens; public static String[] list; public static String line; public static void main(String[] args) { myFile = new TextFileInput("project1.txt"); while ((line = myFile.readLine()) != null) { myTokens = new StringTokenizer(line, ","); list = new String[myTokens.countTokens()]; int i = 0; while (myTokens.hasMoreTokens()) { list[i] = myTokens.nextToken(); i++; } //while } //while for (int j = 0; j &lt; list.length; j++) System.out.println(list[j]); } //main }
type: Question
has answer: http://stackoverflow.com/a/26434159
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41512878
has comment: http://stackoverflow.com/comment/41512677
has comment: http://stackoverflow.com/comment/41512946
possible better answer: http://stackoverflow.com/a/26434159
type: AnsweredQuestion

http://stackoverflow.com/a/26460023
answers question: http://stackoverflow.com/q/26459978
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You should go with an Enum class here. If you want to have int values, you could create in each enum a emthod that will re`enter code hereturn this value:) Enum { LOW(-1), NOT_DETERMINED(0), HIGH(1); // getters }

http://stackoverflow.com/comment/52708834
has text: Though the answer above is correct, I'd like to add some inputs as well. The intent service used with wakeful broadcast receiver should be used for short operations only (I may be wrong, in which case I'd want some corrections), because the receiver holds a wake lock until the work completes. Holding wake locks for long periods of time can cause heavy battery drains and should be avoided whenever possible.
comment on: http://stackoverflow.com/a/26380942
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26449257
type: Answer
answers question: http://stackoverflow.com/q/26449229
upvote count: 1
has body: The complexity is O(n) where n is the number of entries. Its a loop over the entries with a call of list.add(Entry). for(Entry&lt;Long,Long&gt; e : unsortMap.entrySet()){ list.add(e); }
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26449229

http://stackoverflow.com/q/26480850
downvote count: 0
favorite count: 0
has title: Correc sequence of typing
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41597697
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41597726
has answer: http://stackoverflow.com/a/26480967
has body: I would like to know is ther any programmaticly way createing JFrame I mean which is correct JFrame frame = new JFrame("title"); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); frame.setSize(250,200); or JFrame frame = new JFrame("title"); frame.setSize(250,200); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); or JFrame frame = new JFrame("title"); frame.setSize(250,200); frame.pack(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); now this codes work ok with simple programm but what about if I use threads in bigger programmes
type: Question
has answer: http://stackoverflow.com/a/26480928
linked to: http://stackoverflow.com/q/7229226
answer count: 2
has comment: http://stackoverflow.com/comment/41597809

http://stackoverflow.com/q/26512473
favorite count: 0
has body: I create the configuration of Spring + JPA/Hibernate/c3p0 on this way: Spring-Servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> <context:component-scan base-package="com.nassoft.erpweb"/> <mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" /> <mvc:annotation-driven /> <mvc:interceptors> </mvc:interceptors> update org.hibernate.dialect.MySQL5Dialect <tx:annotation-driven /> </beans> I'm not using persistence.xml because I read in some places its not necessary in Spring 4 with Hibernate. When I start the server it still loading and don't start in 45s (nor 180s) in Tomcat7. I create a factory of EntityManager to use in my project: package com.nassoft.erpweb.factory; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.PersistenceUnit; public class ConnectionFactory { @PersistenceUnit private static EntityManagerFactory entityManagerFactory; public static EntityManager getEntityManager(){ if (entityManagerFactory == null){ entityManagerFactory = Persistence.createEntityManagerFactory("ERPWeb"); } return entityManagerFactory.createEntityManager(); } } I think my configuration is not correct, …
has title: Spring 4 and Hibernate 4/c3p0 with Entity Manager don't start
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/26514039
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
downvote count: 0
tagged with: hibernate-entitymanager
tagged with: c3p0
has answer: http://stackoverflow.com/a/26514039

http://stackoverflow.com/comment/41381168
comment on: http://stackoverflow.com/q/26361689
score: 0
type: QuestionComment
has text: are you just trying to access `http://localhhost:8080`? If it is tomcat then the tomcat server is asking you to enter admin credentials
type: Comment

http://stackoverflow.com/q/26375895
has answer: http://stackoverflow.com/a/26440002
type: Question
has body: I just installed multitenant single-db 0.8.3 but can't compile helloworld example. I have errors on plugin java. May be I am missing some basic setup, but I did not find any more info on doc. See below. symbol: class DeleteEvent location: class HibernateEventListener /home/scarpa/Grails/helloworld/target/work/plugins/hibernate-hijacker-0.8.1/src/java/grails/plugin/hibernatehijacker/hibernate/events/HibernateEventListener.java:168: error: cannot find symbol public void onAutoFlush(AutoFlushEvent event) throws HibernateException { ^ symbol: class AutoFlushEvent location: class HibernateEventListener /home/scarpa/Grails/helloworld/target/work/plugins/hibernate-hijacker-0.8.1/src/java/grails/plugin/hibernatehijacker/hibernate/events/HibernateEventListener.java:172: error: cannot find symbol private void publishEvent(String eventName, AbstractEvent event) { ^ symbol: class AbstractEvent location: class HibernateEventListener Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 100 errors They seem error about incomplete classpath, i.e. about basic hibernate library not found, as if grails is not completing correctly classpath during plugin installation... any hint?
has comment: http://stackoverflow.com/comment/41407726
tagged with: grails
score: 0
answer count: 1
has title: Multitenant single-db compile error
tagged with: multi-tenant
type: UnansweredQuestion
tagged with: plugins
tagged with: java

http://stackoverflow.com/comment/41644709
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26500807
has text: yes..the HttpResponse result is copied to HttpServletResponse response..(included the code for body copy part). The problem I'm facing is, some how servlet response output stream is getting wrong values.

http://stackoverflow.com/q/26405234
linked to: http://stackoverflow.com/q/16280301
has body: I want a javax.swing.ListModel be shared among multiple javax.swing.ComboBoxModels. With the following code , when I select an item from the JComboBox,in a running program through the view, the JComboBox always shows the first item as selected. public class DelegatedComboBoxModel&lt;T&gt; extends AbstractListModel&lt;T&gt; implements ComboBoxModel&lt;T&gt; { protected ListModel&lt;T&gt; listModel; protected Object selectedObject; ListDataListener listDataChangeDelegater = new ListDataListener() { @Override public void intervalRemoved(ListDataEvent e) { fireIntervalRemoved(DelegatedComboBoxModel.this, e.getIndex0(), e.getIndex1()); } @Override public void intervalAdded(ListDataEvent e) { fireIntervalAdded(DelegatedComboBoxModel.this, e.getIndex0(), e.getIndex1()); } @Override public void contentsChanged(ListDataEvent e) { fireContentsChanged(DelegatedComboBoxModel.this, e.getIndex0(), e.getIndex1()); } }; public DelegatedComboBoxModel(ListModel&lt;T&gt; listModel) { // DefaultComboBoxModel&lt;E&gt; this.listModel = listModel; if (listModel.getSize() &gt; 0) { selectedObject = listModel.getElementAt(0); } listModel.addListDataListener(listDataChangeDelegater); } @Override public T getElementAt(int index) { if (index &gt;= 0 &amp;&amp; index &lt; listModel.getSize()) return listModel.getElementAt(index); else return null; } @Override public int getSize() { return listModel.getSize(); } @Override public void setSelectedItem(Object anObject) { if ((selectedObject != null &amp;&amp; !selectedObject.equals(anObject)) || selectedObject == null &amp;&amp; anObject != null) { selectedObject = anObject; fireContentsChanged(this, -1, -1); } } @Override public Object getSelectedItem() { return selectedObject; } } I cannot figure out what went wrong with the above code. How to fix the code ? (Limitation : Should not use or subclass DefaultComboBoxModel or use any third-party library.)
has title: ComboBoxModel as wrapper for ListModel
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/41460472
score: 2
has comment: http://stackoverflow.com/comment/41462208
tagged with: java
has comment: http://stackoverflow.com/comment/41460176
tagged with: comboboxmodel
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41461242
has comment: http://stackoverflow.com/comment/41460403
favorite count: 0
has comment: http://stackoverflow.com/comment/41459252

http://stackoverflow.com/a/26416536
has body: It looks like you are assigning the cummulative salary to every new employee-input: emp[numEmployee] = new Employee(fName, lName, rank, salary); Shouldn't this be? emp[numEmployee] = new Employee(fName, lName, rank, newSal);
has comment: http://stackoverflow.com/comment/41480396
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26416179
type: Answer
has comment: http://stackoverflow.com/comment/41480822
accepted answer of: http://stackoverflow.com/q/26416179

http://stackoverflow.com/a/26507124
score: 0
has comment: http://stackoverflow.com/comment/41644882
has body: You can use Arrays#deepToString(): System.out.println(Arrays.deepToString(multiplyMatrix(A,B))); multiplyMatrix returns an array, which is an object, and in Java since each object has toString() method, the default is displaying the class name representation, then adding @ sign and then the hashcode. In order to better understand what's happening here, see the implementation of Arrays.deepToString. Note that if you want more control on the output, e.g. filtering some arrays or change the way display them, you can have nested loops.
type: Answer
answers question: http://stackoverflow.com/q/26507083

http://stackoverflow.com/q/26458476
tagged with: stack-overflow
favorite count: 0
tagged with: heap-memory
possible better answer: http://stackoverflow.com/a/26458500
downvote count: 0
has body: In java when a method calls itself and results in an infinite loop a stackoverflow error is thrown. While objects are initialized in heap memory shouldn't the heap memory overflow error be thrown since an object is involved to call the method.? Is there any such thing as a heapoverflow error?!
linked to: http://stackoverflow.com/q/79923
has answer: http://stackoverflow.com/a/26458635
accepted answer: http://stackoverflow.com/a/26458635
tagged with: object
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: stack-memory
has answer: http://stackoverflow.com/a/26458500
type: Question
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/26458494
has title: Heapoverflow instead of Stackoverflow in infinite loop

http://stackoverflow.com/q/26477405
upvote count: 14
tagged with: java
answer count: 1
has title: Use rest-assured as a general purpose http client
has answer: http://stackoverflow.com/a/26493696
accepted answer: http://stackoverflow.com/a/26493696
score: 14
tagged with: rest-assured
type: AnsweredQuestion
downvote count: 0
has body: Is there any reason to avoid using rest-assured in a non-testing-environment? The syntax the library offers for creating and parsing requests is so compact it seems a waste to only use it in testing. Which kind of begs the question, why is it targeted as a testing tool alone?
favorite count: 0
tagged with: rest
type: Question

http://stackoverflow.com/comment/41463208
has text: What do you think you've hidden?
score: 0
comment on: http://stackoverflow.com/q/26407300
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41632585
type: Comment
comment on: http://stackoverflow.com/q/26500003
has text: why didn't you post your code in the first time you ask the question?
score: 0
type: QuestionComment

http://stackoverflow.com/q/26446147
has comment: http://stackoverflow.com/comment/41535112
type: Question
has comment: http://stackoverflow.com/comment/41535051
has title: Accepting multiple integers on a single line using Scanner
tagged with: java
has comment: http://stackoverflow.com/comment/41543867
linked to: http://stackoverflow.com/q/20585675
has body: The user needs to enter a certain number of integers. Rather them enter an integer at a time, I want to make it so they can enter multiple integers on a single line, then I want those integers to be converted in an array. For example, if the user enters: 56 83 12 99 then I want an array to be created that is {56, 83, 12, 99} In other languages like Python or Ruby I would use a .split(" ") method to achieve this. No such thing exist in Java to my knowledge. Any advice on how to accept user input and create an array based on that, all on a single line?
has comment: http://stackoverflow.com/comment/41539255
has answer: http://stackoverflow.com/a/26446168
has comment: http://stackoverflow.com/comment/41534950
has answer: http://stackoverflow.com/a/69047427
tagged with: string
has answer: http://stackoverflow.com/a/26446178
favorite count: 0
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/41535379
score: 2
has answer: http://stackoverflow.com/a/26459017
has comment: http://stackoverflow.com/comment/41556057
tagged with: java.util.scanner
upvote count: 3
has comment: http://stackoverflow.com/comment/41534878
downvote count: 1

http://stackoverflow.com/comment/41408288
comment on: http://stackoverflow.com/q/26375515
has text: @Meenal I tried changing the context. Still when I run the application , it says failed initializing tts .
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41587251
score: 0
type: Comment
type: QuestionComment
has text: Does it equal 0 or 1?
comment on: http://stackoverflow.com/q/26474899

http://stackoverflow.com/comment/41436601
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26391732
type: AnswerComment
has text: The value of repeat is being checked by do while. If value is 1 will exit and can make the check outside if it 's equals to 2. Like this he has it, the repeat value is being checked twice in do while.

http://stackoverflow.com/comment/41600450
score: 1
comment on: http://stackoverflow.com/q/26482430
has text: I'm not entirely sure whether the linked URL answers the OP question about why Object is a parameter
type: Comment
type: QuestionComment

http://stackoverflow.com/a/72288096
type: Answer
has body: as a function : function isValidInt32(number){ return Number.isInteger(number) &amp;&amp; number &gt; -2147483648 &amp;&amp; number &lt; 2147483647; }
answers question: http://stackoverflow.com/q/26504604
score: 0

http://stackoverflow.com/comment/41539306
comment on: http://stackoverflow.com/q/26448813
type: Comment
score: 0
has text: I agree. You should definitely parse the CSV file into instances of a custom class which represent the overall concept (stock quotes?).
type: QuestionComment

http://stackoverflow.com/comment/41523540
type: Comment
has text: Thank you very much. I have used this solution as it's simpler and is also complete.
comment on: http://stackoverflow.com/a/26439350
type: AnswerComment
score: 0

http://stackoverflow.com/a/26400393
has body: Let's examine some JavaDoc: setListData() Parameters: listData - an array of E containing the items to display in the list In your case, this method expects an array of Strings toArray() Object[] toArray() That means, that this method returns an array of object. And that is why you're getting the mentioned exception. setListData expects an array of Strings, but you're giving him an array of Objects. List provides another toArray method you should use here: &lt;T&gt; T[] toArray(T[] a). It expects an array and it will return your list as the same array type you've specified there. That means, to fix you problem, you should change listaJListCopia.setListData( listaJListColores.getSelectedValuesList().toArray() ); to listaJListCopia.setListData( listaJListColores.getSelectedValuesList().toArray(new String[1]) ); You could also use new String[0] but this could cause another warning. And now to your warning: This warning means, that the class MarcoSeleccionMultiple implements the interface Serializable, because it extends the class JFrame which is serializable due to the extended class Component. To fix that warning, include the variable serialVersionUID in your class. For example: private static final long serialVersionUID = 1L; Your IDE should be able to generate a serialVersionUID for you. Read this JavaDoc for more information about that variable: Serializable.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26374972

http://stackoverflow.com/q/26430475
type: AnsweredQuestion
has body: I am trying to read gmail messages using GAE Service account. The code similar to below works well to read Google calendar but fails for gmail. I have only one user in the domain (who is also the admin account). I am trying to access the gmail of that user). Any help on why my code fails would be great. I have delegated domain wide authority for the following scopes. Email (Read/Write/Send) https://mail.google.com/ https://www.googleapis.com/auth/admin.directory.user.readonly Calendar (Read-Write) https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile I have enabled below APIs in the Google App Engine: Admin SDK Calendar API Drive API Gmail API Google Cloud SQL Google Cloud Storage Google Cloud Storage JSON API Below is the code that creates gmail service: // Create HTTP transport HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); // Create JsonFactory using com.google.api.client.json.jackson2.JacksonFactory JsonFactory jsonFactory = new JacksonFactory(); // Get service accont (contain service account email and P12 file name) BaseGoogleService.GoogleServiceAccount serviceAccount = getGoogleServiceAccount(); //load private key from class path to File object. Resource resource = appContext.getResource("classpath:"+serviceAccount.getServiceAccountPrivateKeyFile()); File privateKeyFile = resource.getFile(); // Create Google credential for service account List&lt;String&gt; accountScopes = new ArrayList&lt;String&gt;(); accountScopes.add(GmailScopes.MAIL_GOOGLE_COM); Credential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(jsonFactory) .setServiceAccountId(serviceAccount.getServiceAccountId()) .setServiceAccountScopes(accountScopes) .setServiceAccountPrivateKeyFromP12File(privateKeyFile) .build(); // Create Gmail client Gmail gmailClient = new Gmail.Builder(httpTransport, jsonFactory, c…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26442729
tagged with: service-accounts
tagged with: google-oauth
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26442729
favorite count: 0
tagged with: gmail-api
tagged with: google-app-engine
upvote count: 1
has title: Gmail Java API Using GAE Service account
has comment: http://stackoverflow.com/comment/41514766

http://stackoverflow.com/q/26474571
favorite count: 0
type: Question
upvote count: 2
has body: I have a java program which creates multiple threads where each thread makes POST request. It works fine most of the time but under heavy load it throws Connection reset exception. For example, when I made 40 simultaneous requests, couple of time I got Connection reset exception. Caught: java.net.SocketException: Connection reset java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:237) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java: at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105 at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection. at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMetho at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodB at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.j at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Htt at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMe at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav In my Java code, I am creating an instance of HttpClient HttpClient client = new HttpClient(); The problem does not happen when I make one request wait for it to finish and then make another request. However, the moment I turn the program into multi-threading I get this issue. Could anyone please point out how could I prevent this exception and then retry again. From google, I found out the answer may be along the lines of using org.apache.commons.httpclient.util.IdleConnectionTimeoutThread I am trying to use this in the mean time but any other suggestions are welcome.
tagged with: multithreading
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26474662
has comment: http://stackoverflow.com/comment/41586603
accepted answer: http://stackoverflow.com/a/26474662
downvote count: 0
has title: HttpClient executeMethod throws java.net.SocketException: Connection reset
type: AnsweredQuestion
score: 2
tagged with: apache-commons-httpclient

http://stackoverflow.com/comment/41589044
type: Comment
has text: That output should be going into the stdout stream you get from the Process object returned by the exec() call.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26475669

http://stackoverflow.com/comment/41599245
comment on: http://stackoverflow.com/a/26462943
type: Comment
has text: I'm afraid I don't know the reason for the difference.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41406122
type: QuestionComment
comment on: http://stackoverflow.com/q/26374984
type: Comment
has text: Please learn about `scope` of a variable.
score: 0

http://stackoverflow.com/comment/41599237
comment on: http://stackoverflow.com/q/26481768
has text: please show us your code, so that we understand what exactly you get from DB, probably you dont even have a class for your data.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41657535
type: Comment
comment on: http://stackoverflow.com/a/26513255
score: 0
type: AnswerComment
has text: Okay, your example throws exception. Still unclear why. I updated my question.

http://stackoverflow.com/q/26498365
has body: I'm trying to send data from Labview over a TCP socket and receiving the data with Java. I'm using an example TCP VI from Labview (I cant post pictures). I realize there's a TCP read, I haven't gotten to that point yet. My problem is dealing with types. import java.io.*; import java.net.*; public class JavaApplication3 { public static void main(String[] args) throws IOException { String serverHostname = new String ("97.77.53.127"); Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { echoSocket = new Socket(serverHostname, 6340); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); } catch (UnknownHostException e) { System.exit(1); } catch (IOException e) { System.exit(1); } BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)); String userInput; System.out.print ("input: "); while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); System.out.print ("input: "); } out.close(); in.close(); stdIn.close(); echoSocket.close(); } } My first problem I want to deal with, is whenever I receive a input from the Labview VI, in the java program I get: input: d echo: ?��/�?�~gʕ ?�$���;P?��G��j�?��"�?�?��;���h?� input: input: d echo: ?��/�?�~gʕ ?�$���;P?��G��j�?��"�?�?��;���h?� input: I'm assuming my problem is with type casting, but I really don't know enough to fix it. Any help would be appreciated.
tagged with: tcp
tagged with: java
type: Question
score: 0
has title: Labview TCP connection with Java
answer count: 1
has comment: http://stackoverflow.com/comment/41629642
has comment: http://stackoverflow.com/comment/41669051
tagged with: labview
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26521299

http://stackoverflow.com/q/26363573
has title: Registering and using a custom java.net.URL protocol
has answer: http://stackoverflow.com/a/46619972
tagged with: java
has comment: http://stackoverflow.com/comment/41492846
linked to: http://stackoverflow.com/q/37528167
accepted answer: http://stackoverflow.com/a/26409796
has comment: http://stackoverflow.com/comment/41385076
linked to: http://stackoverflow.com/q/2406518
answer count: 3
tagged with: uri
has comment: http://stackoverflow.com/comment/41384741
upvote count: 45
tagged with: url
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41385152
tagged with: protocols
score: 45
has comment: http://stackoverflow.com/comment/41486228
linked to: http://stackoverflow.com/q/861500
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26409796
has body: I was trying to invoke a custom url from my java program, hence I used something like this: URL myURL; try { myURL = new URL("CustomURI:"); URLConnection myURLConnection = myURL.openConnection(); myURLConnection.connect(); } catch (Exception e) { e.printStackTrace(); } I got the below exception: java.net.MalformedURLException: unknown protocol: CustomURI at java.net.URL.(Unknown Source) at java.net.URL.(Unknown Source) at java.net.URL.(Unknown Source) at com.demo.TestDemo.main(TestDemo.java:14) If I trigger the URI from a browser then it works as expected but if I try to invoke it from the Java Program then I am getting the above exception. EDIT: Below are the steps I tried (I am missing something for sure, please let me know on that): Step 1: Adding the Custom URI in java.protocol.handler.pkgs Step 2: Triggering the Custom URI from URL Code: public class CustomURI { public static void main(String[] args) { try { add("CustomURI:"); URL uri = new URL("CustomURI:"); URLConnection uc = uri.openConnection(); uc.connect(); } catch (Exception e) { e.printStackTrace(); } } public static void add( String handlerPackage ){ final String key = "java.protocol.handler.pkgs"; String newValue = handlerPackage; if ( System.getProperty( key ) != null ) { final String previousValue = System.getProperty( key ); newValue += "|" + previousValue; } System.setProperty( key, newValue ); System.out.println(System.getProperty("java.protocol.handler.pkgs")); } } When I run this code, I am getting the CustomURI: printed in my console (from the add method) but then I am getting this exception when the URL is initialized with CustomURI: as a constructor: Exception in thread "main" java.lang.StackOverflowError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at java.net.URL.getURLStreamHandler(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at sun.misc.URLClassPath$FileLoader.getResource(Unknown Source)…
has comment: http://stackoverflow.com/comment/41386649
has answer: http://stackoverflow.com/a/26528357
has comment: http://stackoverflow.com/comment/41384789
type: Question
possible better answer: http://stackoverflow.com/a/46619972

http://stackoverflow.com/comment/41653985
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26511892
type: Comment
has text: Yes, exactly. That is one of the things I can't figure out. It should be showing up, but it is not. I have checked and checked and rechecked to make sure there is no other return statement in the method, and cannot find one.

http://stackoverflow.com/a/26445343
score: 5
has comment: http://stackoverflow.com/comment/41533338
upvote count: 5
has comment: http://stackoverflow.com/comment/41533305
has comment: http://stackoverflow.com/comment/41533318
has comment: http://stackoverflow.com/comment/41533751
downvote count: 0
has body: The problem here isn't the size of number a double can hold - the problem is the size of the stack. Here, you have 20K nested call to summe, which is way too much for the stack to handle, and hence, it overflows. If s were an int instead of a double, you'd have the exact same problem.
has comment: http://stackoverflow.com/comment/41533323
type: Answer
answers question: http://stackoverflow.com/q/26445327

http://stackoverflow.com/comment/41594348
type: QuestionComment
has text: Problem is in assert lineIndex >= 0 && lineIndex <= lines.size() - 1;
type: Comment
comment on: http://stackoverflow.com/q/26478807
score: 0

http://stackoverflow.com/comment/41380355
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26361004
has text: Instead of working on all records, try solving the problem in and increasingly number of records. Lets say first select top 1000 records, then 2k, 4k, 8k ... and so on. Check if your actual solution is scalable and as said above, maybe you have a ram problem.

http://stackoverflow.com/q/26448474
has answer: http://stackoverflow.com/a/26448851
type: Question
accepted answer: http://stackoverflow.com/a/26448851
has title: Exception in java.lang.reflect.InvocationTargetException in javafx
score: 0
tagged with: invocationtargetexception
answer count: 1
tagged with: exception
has body: Can you please help me with this error. I have been trying to figure out where is the issue here. Maybe is something that I haven't seen. This is a program that should be very simple. I don't have much experience in java. This is the code. public class StudentInfo extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane and set its properties BorderPane mainpane = new BorderPane(); GridPane leftpane = new GridPane(); leftpane.setAlignment(Pos.CENTER); leftpane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5)); leftpane.setHgap(5); leftpane.setVgap(5.5); //FlowPane pane = new FlowPane(Orientation.VERTICAL); //pane.setPadding(new Insets(11, 12, 13, 14)); //pane.setHgap(5); //pane.setVgap(5); //String[] computerCourses = {"Select a course","Python", "C#", "Dephi","Java","XML"}; //String[] businessCourses = {"Select a course","Finance","Marketing","Investment Analysis","Business Communications"}; // Place nodes in the pane Label lblName = new Label("Name:"); Label lblAddress = new Label("Adress:"); Label lblProvince = new Label("Province"); Label lblCity = new Label("City:"); Label lblPostalCode = new Label("Postal Code:"); Label lblPhoneNumber = new Label("Phone number:"); Label lblEmail = new Label("Email:"); //VBox vBox = new VBox(5); //vBox.setPadding(new Insets(15, 5, 5, 5)); //vBox.getChildren().add(lblName); //vBox.getChildren().add(lblAddress); //vBox.getChildren().add(lblProvince); //vBox.getChildren().add(lblCity); //vBox.getChildren().add(lblPostalCode); //vBox.getChildren().add(lblPhoneNumber); //vBox.getChildren().add(lblEmail); //mainpane.setLeft(vBox); TextField tfName = new TextField(); TextField tfAddress = new TextField(); TextField tfProvince = new TextField(); TextField tfCity = new TextField(); TextField tfPostalCode = new TextField(); TextField tfPhoneNumber = new TextField(); TextField tfEmail = new TextField(); leftpane.add(lblName, 0, 0); leftpane.add(tfName, 1, 0…
type: AnsweredQuestion
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/41632005
type: AnswerComment
comment on: http://stackoverflow.com/a/26499852
has text: might be a noob question, is there a difference between System.exit(0) and return?
type: Comment
score: 0

http://stackoverflow.com/a/26452675
score: 1
answers question: http://stackoverflow.com/q/26452633
downvote count: 0
type: Answer
has body: There are two things to fix here: public static void get_data() This method is declared to return nothing. Change it to: public static String[] get_data() Your variable String[] data_array is declared in the while loop, therefore it is only known there. Your return statement is outside that loop, so it doesn't have access to it. Move the variable outside the loop: String sql = "SELECT data_x FROM table_x"; ResultSet result = query.executeQuery(sql); String[] data_array = new String[999]; Mind that you need to move the declaration and the initialization outside the while loop, or you will overwrite the previously stored data of that array by initializing it again. And also mind, that your for loop will overwrite the current data anyway ... you should think about storing the row data in another array so, or it will be lost.
upvote count: 1

http://stackoverflow.com/tag/rdf
tags question: http://stackoverflow.com/q/26358919
tags question: http://stackoverflow.com/q/26415922
tags question: http://stackoverflow.com/q/26399155
type: Tag
tags question: http://stackoverflow.com/q/26507388
tag name: rdf

http://stackoverflow.com/a/26478536
type: Answer
has body: If I have understood your requirement correctly, you could have forms for each row. So that when ever user click the button you will only have getOrder and hidden field getOrderId for each form. So you can use get parameter to get the value as you like. &lt;c:forEach var="item" items="${openOrders}"&gt; &lt;form&gt; &lt;tr&gt; &lt;td&gt; &lt;input name="getOrder" type="submit" value="- Coffee Order ${item.id}"/&gt; &lt;input type="hidden" name="getOrderID" value="${item.id}"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/form&gt; &lt;/c:forEach&gt;
accepted answer of: http://stackoverflow.com/q/26440385
score: 0
answers question: http://stackoverflow.com/q/26440385
type: AcceptedAnswer

http://stackoverflow.com/a/26432649
accepted answer of: http://stackoverflow.com/q/26432512
upvote count: 1
answers question: http://stackoverflow.com/q/26432512
score: 1
has comment: http://stackoverflow.com/comment/41523101
has comment: http://stackoverflow.com/comment/41516161
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The simplest solution seems to be to add an output parameter than hands back the result: public Object remove(Comparable theKey) { Object[] result = new Object[1]; rootPtr = remove(theKey, rootPtr, result); // fix for deletion from a one-node tree return result[0]; } public Node remove(Comparable theKey, Node node, Object[] result) { if(node == null) { return node; } int diff = theKey.compareTo(node.key); if (diff &lt; 0) { node.leftChild = remove(theKey, node.leftChild, result); } else if (diff &gt; 0) { node.rightChild = remove(theKey, node.rightChild, result); } else { result[0] = node.key; if (node.rightChild == null) { node = node.leftChild; } else if (node.leftChild == null) { node = node.rightChild; } else { Node foundNode = findMin(node.rightChild); node.key = foundNode.key; node.data = foundNode.data; node.rightChild = remove(node.key, node.rightChild, new Object[1]); } numNodes--; } return node; } Returning the found node doesn't work without significant changes because the return parameter is used to replace nodes as needed, and in the case where the found node has two children, you'd need to make a copy or insert a new node. Handling the case where the root node gets removed would be an issue, too. p.s. I am assuming this is not a "trick question" and you can't just return theKey -- which has to equal the found key after all :)

http://stackoverflow.com/comment/41520837
type: Comment
has text: For something like calling await(), I'd be more likely to use an existing concurrent queue datastructure in real code. But, if that isn't an option, then yeah, you really do need to use a Lock, then.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26435675

http://stackoverflow.com/comment/41446345
type: Comment
comment on: http://stackoverflow.com/q/26397604
score: 0
type: QuestionComment
has text: You can indeed only do it if the code is correctly indented and formed, (i.e. all the function declarations are at the same indentation level and are in one line)

http://stackoverflow.com/q/26434278
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/26434874
has body: For a class with an array field Josh says if the clone method merely return super.clone(), the resulting class instance will have the correct values in primitive fields, but its array field will refer to the same array as the original class instance. Modifying the original will destroy the invariants and vice-versa. He used the example of custom Stack implementation, I am using a simple Student class class Student implements Cloneable { private String name; private int age; private int[] marks = {90, 70, 80}; public void setName(String name) { this.name = name; } public void setAge(int age) { this.age = age; } public void setMarks(int[] marks) { this.marks = marks; } public Student(String name, int age) { this.name = name; this.age = age; } @Override protected Student clone() throws CloneNotSupportedException { return (Student) super.clone(); } @Override public String toString() { return "Student - Name : " + name + " Age : " + age + " Marks : " + Arrays.toString(marks); } } Please note: I didn't invoke clone() on my array field in my clone method's override. Then I did: public class CloningDemo { public static void main(String[] args) { Student s1 = new Student("Mohit", 30); Student s2 = null; try { s2 = s1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } System.out.println("S1 : " + s1); System.out.println("S2 : " + s2); System.out.println("Updating the clone..."); s2.setName("Rohit"); s2.setAge(29); s2.setMarks(new int[]{10, 29, 30}); System.out.println("S1 : " + s1); System.out.println("S2 : " + s2); System.out.println("Updating the array elements in Original..."); s1.setMarks(new int[]{10, 10, 10}); System.out.println("S1 : " + s1); System.out.println("S2 : " + s2); } } Output: S1 : Student - Name : Mohit Age : 30 Marks : [90, 70, 80] S2 : Student - Name : Mohit Age : 30 Marks : [90, 70, 80] Updating the clone... S1 : Student - Name : Mohit Age : 30 Marks : [90, 70, 80] S2 : Student - Name : Rohit Age : 29 Marks : [10, 29, 30] Updating t…
has answer: http://stackoverflow.com/a/26434874
type: AnsweredQuestion
score: 3
tagged with: cloning
has answer: http://stackoverflow.com/a/26434411
upvote count: 3
tagged with: java
has title: Effective Java Item 11: Override clone Judiciously
tagged with: effective-java
type: Question
accepted answer: http://stackoverflow.com/a/26434411
answer count: 2

http://stackoverflow.com/a/26523037
has body: There are three limitations that will probably cause you problems here: 1/sec write limit per entity group 5 entity groups per XG 10 concurrent 'threads' per instance The last one is the tricky one for your use case. Its a bit hard to find info on (and may in fact be out of date information - so its worth testing), but each instance only allows 10 concurrent core threads (regardless of size - F1/F2/F...). That is, ignoring the creation of background threads, if you were to assume that each request takes a thread, as does each RPC (datastore, memcache, text search etc), you can only use 10 at a time. If the scheduler thinks an incoming request would exceed 10, it will route the request to a new instance. In a scenario you want to write to 100 entities in parallel, i'd expect it to only allow about 10 concurrent writes (the rest blocking), but also your instance could only service one request at a time. Alternatives for you: Use dedicated memcache - you'll need to handle backing the counters onto durable storage but you could do that in batches on a backend. This may result in you losing some data due to flushes, whether thats ok or not you'll have to decide Use CloudSQL sequences or tables - if you dont require huge scale, but do require lots of counters, this may be a good approach - you could store counts as raw counts, or as timeseries data and post-process for accurate counts Use pull queues to update counters in batches on a backend. You can process many 'events' across your many counter tables in larger batches. The downside is that the counts will not be up to date at any given point in time The best approach is probably a hybrid. For example, accepting some eventual consistency in counts: When a request comes in - atomic increment of counters in memcache When a request comes in - queue an 'event' task Serve needed counts from memcache - if not present load from the datastore Use TTLs on memcache, so that eventually the datastore is seen as the 'source of trut…
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41712919
answers question: http://stackoverflow.com/q/26456058

http://stackoverflow.com/q/26489072
possible better answer: http://stackoverflow.com/a/26489608
has answer: http://stackoverflow.com/a/26489608
has answer: http://stackoverflow.com/a/26492465
score: 0
answer count: 2
has body: When using the java Kafka(0.8) high level consumer is there a way to determine that a rebalance has, or needs to occur? Thank you!
tagged with: apache-kafka
tagged with: java
accepted answer: http://stackoverflow.com/a/26492465
type: AnsweredQuestion
has title: When using the Kafka high level consumer is there a way to be notified of a rebalancing?
type: Question

http://stackoverflow.com/q/26398209
has answer: http://stackoverflow.com/a/26438874
has comment: http://stackoverflow.com/comment/41448178
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26437786
has comment: http://stackoverflow.com/comment/41447902
has comment: http://stackoverflow.com/comment/41447745
score: 0
has comment: http://stackoverflow.com/comment/41447640
answer count: 2
has title: Trouble implementing priority queue Java
has comment: http://stackoverflow.com/comment/41448059
has comment: http://stackoverflow.com/comment/41447960
has comment: http://stackoverflow.com/comment/41447988
tagged with: priority-queue
has body: I currently have an issue with my priority queue. When i'm testing my methods the I get an error saying my Queue isn't returning the highest priority. I have stepped through and I can't see why the Poll or Offer method is causing this issue. Any help would be appreciated. Thanks public class HeapArrayQueue &lt;E extends Comparable&lt;? super E&gt; &gt; extends AbstractQueue &lt;E&gt; { @SuppressWarnings("unchecked") private E[] data = (E[])(new Comparable[7]); private int count = 0; private int front = 0; public int size() { return count; } public boolean isEmpty() { return size() == 0; } public E poll() { if (isEmpty()) return null; else { E ans = data[front ]; front = (front+1); return ans; } } public boolean offer(E element) { if (element == null)return false; else { ensureCapacity(); data[count] = element; bubbleUpFromIndex(count); count++; return true; } } private void bubbleUpFromIndex(int nodeIndex) { if (nodeIndex != 0){ int parent = (nodeIndex -1) / 2; if (data[nodeIndex].compareTo(data[parent]) &gt; 0){ swap(nodeIndex, parent); bubbleUpFromIndex(parent); } } } private void swap(int from, int to) { E temp = data[from]; data[from] = data[to]; data[to] = temp; } private void ensureCapacity() { if (count == data.length) { @SuppressWarnings("unchecked") E[] newData = (E[])new Comparable[data.length * 2]; for (int loop = 0; loop &lt; count; loop++) { newData[loop] = data[loop]; } data = newData; } return; } public Iterator&lt;E&gt; iterator() { return null; } } Failing test @Test public void QueueRespectsPriority() { nonEmptyQueue.offer(t1); assertEquals("Queue should return element with highest priority", t1, nonEmptyQueue.poll()); }
type: UnansweredQuestion

http://stackoverflow.com/comment/52862876
type: AnswerComment
type: Comment
has text: Why try this solution instead of that one?
comment on: http://stackoverflow.com/a/32501698
score: 0

pecs
tags question: http://stackoverflow.com/q/26424687
type: Tag
tag name: pecs

http://stackoverflow.com/comment/41579933
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26393607
score: 0
has text: Thank you for the link! Good to know that even Joe Celko agrees this is bad design...

http://stackoverflow.com/q/26450489
has answer: http://stackoverflow.com/a/73548760
has body: I've made an app, I've tested it and it was fine on my phone. But... when I gave the .apk to someone else whose phone language is RTL the whole layout broke and it messed up everything. My question is - How can I force my app to use only LTR and disable the auto layout change which breaks my whole app design?
has answer: http://stackoverflow.com/a/58221903
downvote count: 0
has answer: http://stackoverflow.com/a/26450579
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/68882851
has title: Disable automatic layout change on Android
tagged with: layout
tagged with: user-interface
has answer: http://stackoverflow.com/a/43155908
upvote count: 29
favorite count: 0
answer count: 5
tagged with: android
type: UnansweredQuestion
score: 29

http://stackoverflow.com/comment/42077500
has text: You have to award the bounty - because it will expire in an hour..
comment on: http://stackoverflow.com/q/26467359
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41462199
type: AnswerComment
has text: its mean that i must delete this project and retyping? or just clean project and copy-paste that code? This may the crash report: when i run this app, then it show a messege like this "Unfortunately, MainActivity has stopped"
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26385894

http://stackoverflow.com/q/26403445
accepted answer: http://stackoverflow.com/a/26409578
possible better answer: http://stackoverflow.com/a/26403973
has answer: http://stackoverflow.com/a/26403973
answer count: 2
tagged with: thread-sleep
downvote count: 0
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I am working on a strange bug in our implementation of ArcGIS maps. Recently, I've noticed that our software works properly when I put a breakpoint in certain place and run application in debug mode (probably we are facing concurrency/thread issue). After the breakpoint is hit, I immediately (1-2 seconds) resume application and everything on map draws perfectly. However, when I replace breakpoint with Thread.sleep(2000); and run application, the bug is still there. To me its really weird, I thought both things would do exactly the same. The breakpoint is set to "Suspend Thread" and I use Eclipse IDE. What is the difference between put thread to sleep and suspend thread in Java? EDIT: I don't ask for this specific bug solution. I just want to know what's the difference in execution of program in these two cases: Case 1 open Eclipse IDE put breakpoint at the line X debug as... My Program ButtonEvent, program hits breakpoint at line X I click on resume button in Eclipse Case 2 open Eclipse IDE put Thread.sleep(2000) at the very beginning of line X debug as... My Program ButtonEvent Pasting code here will make no difference since I am not asking about any particular code execution scenario, I am just only interested whether JVM treats breakpoints in the same way as it treats Thread.sleep(). What is happening in JVM when thread is put to sleep for a particular time? What is happening in JVM when thread is put to suspend (by hitting breakpoint)? Is there any difference?
has comment: http://stackoverflow.com/comment/41457449
has comment: http://stackoverflow.com/comment/41457385
tagged with: sleep
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/26409578
has comment: http://stackoverflow.com/comment/41456354
has title: Difference between Thread.sleep() and breakpoint (Suspend Thread)
has comment: http://stackoverflow.com/comment/41456643
has comment: http://stackoverflow.com/comment/41456575

http://stackoverflow.com/a/26407900
upvote count: 6
has body: You need to specify it as a surrogate pair - two UTF-16 code units. For example, if you copy and paste the character into my Unicode explorer you can see that U+1F174 is represented in UTF-16 code units as U+D83C U+DD74. (You can work this out manually, of course.) So you could write it in a Java string literal as: String text = "\uD83C\uDD74"; Other options include: String text = new StringBuilder().appendCodePoint(0x1f174).toString(); String text = new String(new int[] { 0x1f174 }, 0, 1); char[] chars = Character.toChars(0x1f174);
has comment: http://stackoverflow.com/comment/41464851
answers question: http://stackoverflow.com/q/26407782
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/q/26424734
accepted answer: http://stackoverflow.com/a/26425064
has answer: http://stackoverflow.com/a/26425057
type: AnsweredQuestion
score: 1
tagged with: java
has title: Java String Manipulation into Columns
type: Question
has answer: http://stackoverflow.com/a/26425797
has answer: http://stackoverflow.com/a/26425009
tagged with: algorithm
has answer: http://stackoverflow.com/a/26425828
answer count: 6
has answer: http://stackoverflow.com/a/26425064
possible better answer: http://stackoverflow.com/a/26425009
has body: I'm working on a tool and am required to split text into columns. For example - 1 2 3 4 5 6 7 8 9 1 Would return this if the period is 2 - 1,3,5,7,9 and 2,4,6,8,1 IF the period is 3 - 1,4,7,1 and 2,5,8 and 3,6,9 Etc etc. I'm struggling to construct this alogirithm, any help would be appreciated! How is best to go about constructing these sort of algorithms? I've written it down on paper but can't transfer into code! I'm stuck on constructing a second loop to increase the period. Here's an example of what I have so far String to_test = "1234567891"; StringBuilder sb = new StringBuilder(); int period = 2; int startAt = 0; int characterToCheck = 0; while (startAt &lt; period) { for (int i = 0; i &lt; to_test.length(); i++) { if (i % period == 0) { sb.append(to_test.charAt(characterToCheck)); } characterToCheck++; } // String is constructed System.out.println(sb); sb = new StringBuilder(); startAt ++; characterToCheck = startAt; } }
downvote count: 0
has answer: http://stackoverflow.com/a/26425314
has comment: http://stackoverflow.com/comment/41494535
tagged with: string
favorite count: 0
upvote count: 1

http://stackoverflow.com/a/26431891
type: Answer
has comment: http://stackoverflow.com/comment/41508563
has body: For one thing, if(String yn = "y") { } is not what you think it is in Java. String yn = "y" is an assignment statement, not a comparison. To compare strings in Java you want to use String's equals() method. There's are more syntax issues and obvious compiler errors. I suggest you try out one of the many tutorials online for beginning Java.
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/41508557
has comment: http://stackoverflow.com/comment/41508592
has comment: http://stackoverflow.com/comment/41508647
score: 1
has comment: http://stackoverflow.com/comment/41508513
has comment: http://stackoverflow.com/comment/41508591
answers question: http://stackoverflow.com/q/26431826
has comment: http://stackoverflow.com/comment/41508573

http://stackoverflow.com/q/26415006
has comment: http://stackoverflow.com/comment/41496886
tagged with: miglayout
has answer: http://stackoverflow.com/a/26415229
upvote count: 3
tagged with: java
linked to: http://stackoverflow.com/q/26433846
answer count: 1
type: UnansweredQuestion
score: 3
downvote count: 0
has body: Why does this SSCCE (with MigLayout libraries) ... public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } JFrame frame = new JFrame(); frame.setLayout(new MigLayout(new LC().fill().insetsAll("0"))); JTabbedPane jtp = new JTabbedPane(); jtp.add(new JPanel(), "Tab 1"); jtp.add(new JPanel(), "Tab 2"); JLabel label = new JLabel("label"); JPanel panel = new JPanel(new MigLayout(new LC().fill())); panel.add(jtp, "id tabbedpane, grow, span"); panel.add(label, "pos (tabbedpane.w-label.w) 10, id label"); label.setBounds(100, 100, 10, 10); frame.add(panel, "grow, span"); frame.setSize(500, 500); frame.setLocationRelativeTo(null); // Sorry, Andrew Thompson frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } Throw this error: Unstable cyclic dependency in absolute linked values! Unstable cyclic dependency in absolute linked values! Unstable cyclic dependency in absolute linked values! Unstable cyclic dependency in absolute linked values! ? I figured it out that if you remove the WindowsLookAndFeel code, then everything runs fine... So, this is a problem with MigLayout and the WindowsLookAndFeel. Yet my real application necessitates its use. EDIT: This is what the frame looks like when the error is thrown:
favorite count: 0
has comment: http://stackoverflow.com/comment/41512508
type: Question
tagged with: swing
has title: MigLayout error: "Unstable cyclic dependency in absolute linked values!"

http://stackoverflow.com/comment/41512853
type: AnswerComment
type: Comment
has text: Or simply `int[] guessInteger = guess.chars().map(Character::getNumericValue).toArray();`
score: 2
comment on: http://stackoverflow.com/a/26434013

datetime-parsing
tags question: http://stackoverflow.com/q/26460299
tag name: datetime-parsing
type: Tag

http://stackoverflow.com/comment/41578105
has text: @J4M0 thx for ur help, but still i can insert into client (save c in main class), but i cant insert into facture table (cant save f in main class).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26457891

http://stackoverflow.com/q/26367262
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/26367293
type: Question
has title: Strings - How do they work in Java? Also, what does immutability mean?
has answer: http://stackoverflow.com/a/26367392
has answer: http://stackoverflow.com/a/26367388
has comment: http://stackoverflow.com/comment/41391795
has body: String is immutable. See this code. String a="ninja"; String b= "ninja"; String c=a+" name "; In this a and b are pointing to same object. c will be another object. How it will become immutable when two strings are pointing to same object? Suppose if i modify a with another string like, a=" ninjaturtle" then it will points to another place in heap. So can anyone explain in detail, when we can modify that object how can you say that its immutable?
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26368316
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41391868
type: UnansweredQuestion

http://stackoverflow.com/a/26418519
has comment: http://stackoverflow.com/comment/41484150
downvote count: 0
has body: Use FB Sdk You can download from here Add it to ypur project as library Using the following code will get you the user's FB profile picture ProfilePictureView profilePictureView; profilePictureView = (ProfilePictureView) findViewById(R.id.imageView); authButton.setSessionStatusCallback(new Session.StatusCallback() { @SuppressWarnings("deprecation") @Override public void call(Session session, SessionState state, Exception exception) { Log.i(TAG, "Access Token" + session.getAccessToken()); Request.executeMeRequestAsync(session, new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { profilePictureView.setProfileId(user.getId()); } } }); } }
answers question: http://stackoverflow.com/q/26417850
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41484210
upvote count: 1

http://stackoverflow.com/q/26503855
has body: This is what I have done so far Bidder []Bidlist = new Bidder [3]; Bidlist[0]= new Bidder ("AB111","Bill Chivers"); Bidlist[1]= new Bidder ("AB222","Ric Herbert"); Bidlist[2]= new Bidder ("AB333","Simon"); I can print out the whole array with System.out.ptint(BidList[1); however I have no idea how to call the value of index 0 in a index of 0 which is "AB111" .
has comment: http://stackoverflow.com/comment/41639131
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41639345
has answer: http://stackoverflow.com/a/26503909
has answer: http://stackoverflow.com/a/26503946
has comment: http://stackoverflow.com/comment/41639144
type: Question
has comment: http://stackoverflow.com/comment/41639135
tagged with: arrays
has answer: http://stackoverflow.com/a/26503961
has comment: http://stackoverflow.com/comment/41639120
downvote count: 4
has answer: http://stackoverflow.com/a/26503922
has title: how to call value of an array that was in an array(for java)?
answer count: 4
favorite count: 0
type: UnansweredQuestion
score: -4

http://stackoverflow.com/a/26407220
has comment: http://stackoverflow.com/comment/41464215
has comment: http://stackoverflow.com/comment/41463974
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41464209
has body: I think you are missing the point of the launcher applet. It serves as a shim between the applet container and its system ClassLoader on one hand, and the JCL-loaded real applet and JCL on the other. There should be nothing in the launcher applet besides the applet lifecycle methods. I am unsure how any methods other than lifecycle methods are being invoked on your launcher applet anyway. That can't be accidental, so just stop trying to do it. Implement all your applet's functionality in the real applet class and any helper classes you need, as if the launcher applet didn't exist. If you must have external components looking up your applet and invoking methods on it, then modify or subclass JCL to provide additional shim methods, using the same model that it already uses for application lifecycle methods.
has comment: http://stackoverflow.com/comment/41464361
type: Answer
has comment: http://stackoverflow.com/comment/41466571
accepted answer of: http://stackoverflow.com/q/26406824
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26406824
has comment: http://stackoverflow.com/comment/41465602

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/26448813
tags question: http://stackoverflow.com/q/26379518
tag name: csv
tags question: http://stackoverflow.com/q/26359673
tags question: http://stackoverflow.com/q/26445775
tags question: http://stackoverflow.com/q/26384257
tags question: http://stackoverflow.com/q/26360602
tags question: http://stackoverflow.com/q/26401463
tags question: http://stackoverflow.com/q/26408878
tags question: http://stackoverflow.com/q/26393803
tags question: http://stackoverflow.com/q/26378774
tags question: http://stackoverflow.com/q/26488681

http://stackoverflow.com/comment/42180918
type: Comment
has text: Unfortunately I had to get the 3rd party developer to add the properties file directly to their jar. I am awarding points for providing useful information and for helping out :)
type: AnswerComment
comment on: http://stackoverflow.com/a/26492711
score: 0

http://stackoverflow.com/comment/41587254
type: Comment
score: 0
has text: show us what error you get
type: QuestionComment
comment on: http://stackoverflow.com/q/26474899

http://stackoverflow.com/q/26430298
answer count: 1
upvote count: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26431217
has title: Is it possible to look at the Java console of a Tomcat 7 server?
has body: I have a Tomcat 7 server on top of Windows 08 Enterprise. One of my servlets is not returning anything when I deployed it -while it was working fine in the development server. I talked to the old sysadm and it seems that logging was NOT enabled anywhere, and since this is the first time I have to debug a server problem -because there is no new sysadm- my first reaction was to check the server log to see if there was any problems, in special, the Java Console log. I Googled around, and was even able to turn the Tomcat manager on, but it was pointless, there's no console over there either. Is it even possible to look at the console?
type: Question
score: 2
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/41507425
accepted answer: http://stackoverflow.com/a/26431217
tagged with: windows

http://stackoverflow.com/a/26473189
type: Answer
accepted answer of: http://stackoverflow.com/q/26449214
answers question: http://stackoverflow.com/q/26449214
type: AcceptedAnswer
has body: I'm not sure I understand the question properly: how to check whether token was created earlier If you are storing the token in a DB, then when you receive the token from the cookie, you can validate it against values in the DB. If the token received in the cookie already exists in the DB, then it has already been created. As for how to keep it in the cookie, when you first create the cookie, just set the appropriate expiry date. If MaxAge is set to a negative value, then the cookie will be automatically deleted once the browser session is closed.
score: 0

c#
tags question: http://stackoverflow.com/q/26394616
tags question: http://stackoverflow.com/q/26380247
tags question: http://stackoverflow.com/q/26446486
tags question: http://stackoverflow.com/q/26383627
tags question: http://stackoverflow.com/q/26379484
tag name: c#
tags question: http://stackoverflow.com/q/26489765
tags question: http://stackoverflow.com/q/26416779
tags question: http://stackoverflow.com/q/26505831
tags question: http://stackoverflow.com/q/26467964
tags question: http://stackoverflow.com/q/26440739
tags question: http://stackoverflow.com/q/26422715
tags question: http://stackoverflow.com/q/26404046
tags question: http://stackoverflow.com/q/26496646
tags question: http://stackoverflow.com/q/26395303
tags question: http://stackoverflow.com/q/26375239
tags question: http://stackoverflow.com/q/26386134
tags question: http://stackoverflow.com/q/26399865
type: Tag
tags question: http://stackoverflow.com/q/26359387
tags question: http://stackoverflow.com/q/26474963
tags question: http://stackoverflow.com/q/26437626
tags question: http://stackoverflow.com/q/26387726
tags question: http://stackoverflow.com/q/26391091
tags question: http://stackoverflow.com/q/26469090
tags question: http://stackoverflow.com/q/26417127
tags question: http://stackoverflow.com/q/26459988

http://stackoverflow.com/q/26454766
has comment: http://stackoverflow.com/comment/41550310
upvote count: 1
has body: I need help rewriting a function so that System.arraycopy() does what the function does. For example, my code: for( int k = 0; k &lt;= i - 1; k++ ) { a[ j + k ] = a[ j + k + 1 ]; } is equivalent to: System.arraycopy( a, j + 1, a, j, i ); But I can't figure out how to do this for: for ( int k = n; k &gt; i; k-- ) { a[ j + k ] = a[ j + k - 1 ]; } Thanks for any input.
tagged with: java
has answer: http://stackoverflow.com/a/26455847
tagged with: loops
has answer: http://stackoverflow.com/a/26455789
type: Question
answer count: 2
tagged with: for-loop
tagged with: arrays
downvote count: 0
has title: Making System.Arraycopy equivalent to a function
score: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41544653
type: Comment
comment on: http://stackoverflow.com/q/26451271
has text: Cast it to the http equivalent.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41441690
type: QuestionComment
comment on: http://stackoverflow.com/q/26394008
score: 0
has text: `private JTextField textField = new JTextField(); textField.setText("10000000000");` possibly better `private JSpinner orderSize = new JSpinner(new SpinnerNumberModel(..));` E.G. as shown in [this answer](http://stackoverflow.com/a/16271173/418556).
type: Comment

automated-tests
tags question: http://stackoverflow.com/q/26494220
tag name: automated-tests
tags question: http://stackoverflow.com/q/26440012
tags question: http://stackoverflow.com/q/26384622
tags question: http://stackoverflow.com/q/26482861
type: Tag

http://stackoverflow.com/comment/41579669
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26453671
type: AnswerComment
has text: I am not sure but since you are using the toString() method which makes a string object may be creating a problem. try removing the toString and then check.

http://stackoverflow.com/a/26477155
has comment: http://stackoverflow.com/comment/41591265
type: AcceptedAnswer
score: 0
has body: The problem is your search routines are guard to only find a single word... return ("Line " + lnr.getLineNumber() + ": " + currentLineText + "\n"); Will stop any further execution and return to the caller, never looking for any new results. The fact that you only return a String is another problem, as you can never find more than a single String, unless you intend to concatenate the results A better solution would be to allow the method to return an array or List of results, adding each result to the List as it's found and then adding all the results found from the subsequent calss to recursiveSearch, for example... import java.io.File; import java.io.FileReader; import java.io.LineNumberReader; import java.util.ArrayList; import java.util.List; public class Test1 { public static void main(String[] args) { try { for (String line : searchWord("land")) { System.out.println(line); } } catch (Exception exp) { exp.printStackTrace(); } } public static List&lt;String&gt; searchWord(String key) throws Exception { LineNumberReader lnr = new LineNumberReader(new FileReader(new File("StuffToRead.txt"))); return recursiveSearch(lnr.readLine(), key, lnr); } public static List&lt;String&gt; recursiveSearch(String currentLineText, String key, LineNumberReader lnr) throws Exception { List&lt;String&gt; results = new ArrayList&lt;String&gt;(25); if (currentLineText != null) { String lCase = currentLineText.toLowerCase(); if (lCase.contains(key.toLowerCase())) { results.add("Line " + lnr.getLineNumber() + ": " + currentLineText); } results.addAll(recursiveSearch(lnr.readLine(), key, lnr)); } return results; } }
type: Answer
answers question: http://stackoverflow.com/q/26476982
has comment: http://stackoverflow.com/comment/41591308
accepted answer of: http://stackoverflow.com/q/26476982

http://stackoverflow.com/comment/41517220
type: QuestionComment
has text: Because there are five words and all five of them contain at least one vowel. Your five `println` calls are all referencing the same `number` variable, without it changing in between, so you shouldn't expect it to be different.
comment on: http://stackoverflow.com/q/26436276
score: 0
type: Comment

http://stackoverflow.com/q/26357064
has body: I have web based application and have MSSQL server 2012 and need to access that database using window authentication and using Tomcat 6 and OS Windows But same functionality work fine (window authentication) with MSSQL server 2008 not MSSQL server 2012. So may i know the reason is there some thing miss in configuration. i put jtds-1.2.5.jar in apache\lib directory and also put the ntlmauth.dll in C:\Windows\System32 location and also added the system variable "JAVA_OPTS" for the dll location but it does not work. It gives the error message : 2014-10-14 13:35:35,237 ERROR Unable to get database connection: SQL Exception occurred java.sql.SQLException: Cannot open database "Test" requested by the login. The login failed. Then i put the dll in jre\bin directory but it does not work please let is any wrong am doing. Also try put the dll in apache\bin loc still getting the same issue. But as per the client requirement that want using JTDS api not the Microsoft driver so need solution in JTDS api. Although it work fine MSSQL server 2008 but does not work in MSSQL server 2012. I follow the link http://www.dekho.com.au/dekho-connecting-to-sql-server-using-windows-authentication/
type: UnansweredQuestion
tagged with: java
tagged with: jtds
type: Question
has answer: http://stackoverflow.com/a/26357192
tagged with: tomcat6
tagged with: sql-server
score: 0
answer count: 1
has title: MSSQL Window authentication issue with Tomcat server

http://stackoverflow.com/q/26510339
score: 3
tagged with: opengl
tagged with: glsl
tagged with: java
has comment: http://stackoverflow.com/comment/41668888
has body: I am trying to create a GLSL texture shader in java on a mac, but mac doesn't support any version above #version 120. How would I port this 330 shader: //this is my Vertex Shader #version 330 layout (location = 0) in vec3 position; layout (location = 1) in vec2 texCoord; out vec2 texCoord0; uniform mat4 transform; void main() { gl_Position=transform*vec4(position,1.0); texCoord0=texCoord; } This is my Fragment Shader #version 330 in vec2 texCoord0; uniform sampler2D sampler; out vec4 gl_FragColor; void main() { gl_FragColor=texture2D(sampler,texCoord0.xy); } How do I convert these shaders to glsl 120 without losing functionality?
has answer: http://stackoverflow.com/a/26511885
type: Question
has comment: http://stackoverflow.com/comment/41655362
downvote count: 0
has comment: http://stackoverflow.com/comment/41651640
favorite count: 0
has comment: http://stackoverflow.com/comment/41650949
answer count: 1
has title: GLSL Shader won't work on mac
tagged with: macos
has comment: http://stackoverflow.com/comment/41651099
upvote count: 3
type: UnansweredQuestion

http://stackoverflow.com/q/26381226
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26381266
score: 0
has body: I have a java web service in centos 7 on tomcat 7, and i use this service to update a database. I need to call its method regulary, example: createCustomer will called in every 12 hour, createOrder will called in every 3 minute etc. How can i write this triger and where this code have run (in same server or something else)
has title: Calling Java Web Service Method In A Regular Time Period
answer count: 1
has comment: http://stackoverflow.com/comment/41417184
type: UnansweredQuestion
tagged with: centos7
tagged with: web-services

http://stackoverflow.com/q/26465829
has answer: http://stackoverflow.com/a/26465951
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41569536
tagged with: java
linked to: http://stackoverflow.com/q/10239891
has body: I am working on book app. I want to add a zoom feature on my text file. here my code: XML file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="match_parent" &gt; &lt;TextView android:id="@+id/textview_data" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Naruto" android:textSize="25dp" /&gt; &lt;/ScrollView&gt; &lt;/LinearLayout&gt; In the mainActivity i applied some mapView Zoom methods to solve the issue but those methods didn't help much. package com.example.readtextfiles; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.widget.TextView; public class ReadTextFileActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView textView = (TextView)findViewById(R.id.textview_data); String data = readTextFile(this, R.raw.books); textView.setText(data); } public static String readTextFile(Context ctx, int resId) { InputStream inputStream = ctx.getResources().openRawResource(resId); InputStreamReader inputreader = new InputStreamReader(inputStream); BufferedReader bufferedreader = new BufferedReader(inputreader); String line; StringBuilder stringBuilder = new StringBuilder(); try { while (( line = bufferedreader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append('\n'); } } catch (IOException e) { return null; } return stringBuilder.toString(); } } Please suggest some help,
has title: Zoom in "TextView" on text file from the Resource file
downvote count: 1
has answer: http://stackoverflow.com/a/26466053
type: Question
upvote count: 0
score: -1
answer count: 2
favorite count: 0

http://stackoverflow.com/a/26364506
score: 0
type: Answer
has body: I use to declare my fields with 'package' visibility. Its the default visibility, it can be accessed by inhered classes and same package classes. It helps a lot when you are unit testing, because test are written in the same package. Indiscriminate use of getters/setters breaks encapsulation in my opinion. You are exposing all by fields default, when probably its not needed. If your variables are setted only one time in constructor, then they should be 'final'. If a setter has some logic, and in a future you may need to override it, then make it overridable, but its not a good practice to use an overridable method inside a constructor.
answers question: http://stackoverflow.com/q/26364243

http://stackoverflow.com/comment/41506792
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26430854
type: Comment
has text: @JulienVincent if the `query` variable is not `null` which in this case isn't, the `executeUpdate()` method would ALWAYS throw an `SQLException` if it encounters any exception.

http://stackoverflow.com/comment/41460576
type: QuestionComment
comment on: http://stackoverflow.com/q/26405955
has text: `want to replace it's content with another exact string.`. makes no sense to me.
score: 0
type: Comment

http://stackoverflow.com/q/26357132
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41373638
score: 3
has title: generic Enum.valueOf method : Enum class in parameter and return Enum item
accepted answer: http://stackoverflow.com/a/26357618
favorite count: 0
has body: I'd like to make a method that implement valueOf on any Enum class passed in parameter (and also wrap some specialized error/missing-name code). So basically, I have several Enum such as: enum Enum1{ A, B, C } enum Enum2{ D, E, F } And I want a method that wrap around valueOf. I could not find a way to directly pass an Enum class in parameter on which I could call valueOf. Here is what I came up with: private static Enum getEnum(Class&lt;Enum&gt; E, String name){ for(Enum e: E.getEnumConstants()) if(e.name().equals(name)){ return e; } return null; } Which I want to call with: getEnum(Enum1,"A"). But it does not like it: java: cannot find symbol symbol: variable Enum1 location: class Main
type: AnsweredQuestion
tagged with: enums
possible better answer: http://stackoverflow.com/a/26357317
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26357317
type: Question
has answer: http://stackoverflow.com/a/26357618

http://stackoverflow.com/comment/41379407
has text: After logging in into some page, for example, like banking or any other transactions, u can't go back to the previous page. For disabling that back button property I am asking..
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26360573
type: AnswerComment

http://stackoverflow.com/a/26409578
accepted answer of: http://stackoverflow.com/q/26403445
type: AcceptedAnswer
has body: There are some fairly big differences, yes. Thread.sleep requests the OS to remove the thread from CPU scheduling for n millis. Note that the impact of this is OS specific, and is mostly limited to the one thread. Entering a break point requires activating the JVM's Debug Mode, which affects the behavior of the JVM as a whole and thus affects timings/races. AMD has documented the performance effects of putting the JVM into debug mode. The effects do vary, and a lot of them come down communication between JVM and debugger and limiting the optimizations that the JVM is allowed to make when in debug mode. The most extreme example is to not let the JVM use native byte codes for some methods, thus forcing it to use the much slower interpreter. However the most important difference from the point of view of this question is that debuggers offer the ability to halt a single thread or multiple threads. There is a big difference between a thread requesting to go to sleep, and a thread causing another thread to become blocked. In Java, it requires co-operation between threads to halt a thread, even for a break point. In the case of a break point, the co-operation is done for us by the JVM and it only occurs when a thread reaches a safe point. Safe points do not occur at every line of code, and thus will affect race conditions quite strongly as the JVM has to wait for a thread to reach a safe point before it can be halted and the debugger can take over. Safe points typically happen where method calls and the back edges of loops (but not always).
answers question: http://stackoverflow.com/q/26403445
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/q/26510866
tagged with: java
has comment: http://stackoverflow.com/comment/41652090
has title: 3 abstract classes-1superclass,2subclass....how do i call the method from the both subclasses
answer count: 1
has comment: http://stackoverflow.com/comment/41652491
favorite count: 0
tagged with: abstract
has answer: http://stackoverflow.com/a/26511332
upvote count: 0
type: UnansweredQuestion
downvote count: 3
score: -3
type: Question
has body: import java.io.*; import java.util.*; abstract class n { int i=5; abstract void showme(); abstract void display1(); void display() { System.out.println(i); } } abstract class p extends n { int i=2; void showme(){ System.out.println("7"); } } abstract class q extends n { void display1() { System.out.println("10"); } } public class m { public static void main(String a[]) { } } How do i call the 2 methods since all the classes are abstract...i dont want to use showme in class 'q' and display1 in class 'p'

http://stackoverflow.com/comment/41462385
has text: Why are you setting the bounds on your panel? Let the layout manager handle that.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26399782
type: QuestionComment

http://stackoverflow.com/q/26477759
has answer: http://stackoverflow.com/a/26477814
has comment: http://stackoverflow.com/comment/42020938
type: Question
accepted answer: http://stackoverflow.com/a/26477814
score: -2
possible better answer: http://stackoverflow.com/a/26477839
has answer: http://stackoverflow.com/a/26477839
has body: When compiling this java program, I get errors like cannot find symbol... any suggestions? import java.io.*; import java.util.Scanner; public class joel001 { public int d; // find the smallest number of an array public static int small(int a[]) { int smallest=0; for(int i=0;i&lt;a.length();i++) { if(a[i]&lt;smallest) { smallest=a[i]; } } return smallest; } // subtract the smallest number of an array from all its elements public static int[] sub(int a[],int d) { this.d=d; for(int i=0;i&lt;a.length();i++) { a[i]=a[i]-d; } return a; } // count the array's non zero elements public static int count(int a[]) { int countn=0; for(int i=0;i&lt;a.length();i++) { if(a[i]!=0) { countn=countn+1; } } return countn; } public static void main(String args[]) { int b,c,z,k=1; int a[]=new int[1000]; Scanner s=new Scanner(System.in); b=s.nextInt(); //input for(i=0;i&lt;b;i++) { a[i]=s.nextInt(); } while(k==1) { z=count(a); if(z==0) { break; } System.out.println(z); c=small(a); a=sub(a,c); } } }
answer count: 2
has title: I get errors, any suggestions?
upvote count: 0
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41592397
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41592444

http://stackoverflow.com/comment/41501689
comment on: http://stackoverflow.com/a/26427865
score: 1
type: AnswerComment
has text: @TheRevguin if you want to insert a row at the end, use `addRow` instead of `insertRow`. Also, I haven't tried, but I would imagine using `getRowCount` for `insertRow` would cause an `ArrayIndexOutOfBounds` exception, as that row doesn't exist. Are you getting this exception?
type: Comment

http://stackoverflow.com/comment/41380951
comment on: http://stackoverflow.com/q/26361092
score: 0
type: QuestionComment
type: Comment
has text: Have you checked it in your database?

http://stackoverflow.com/comment/41512894
type: AnswerComment
score: 0
type: Comment
has text: Reference http://stackoverflow.com/questions/17870881/cant-find-theme-appcompat-light-for-new-android-actionbar-support
comment on: http://stackoverflow.com/a/26433726

http://stackoverflow.com/q/26433171
tagged with: charat
has body: I got stuck on this section of the code. The idea is to return the character at a given index without using String, StringBuilder, and Wrapper classes. What I have: a "this.data" as a char[] data for my "MyOwnString" object. This is my understanding on what the main class code should look like: public char charAt(int index){ create a new char from this.data, then use charAt() method to select a given index. } } The string will be in a tester class. Just need some guidance on this challenging homework assignment without any of the easy shortcuts.
possible better answer: http://stackoverflow.com/a/26433248
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41511039
favorite count: 0
has comment: http://stackoverflow.com/comment/41511074
has title: Creating a CharAt() method in the main class
has answer: http://stackoverflow.com/a/26433248
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26433198
accepted answer: http://stackoverflow.com/a/26433198
score: 1
tagged with: java

http://stackoverflow.com/q/26363096
score: 0
has answer: http://stackoverflow.com/a/26363261
answer count: 1
has comment: http://stackoverflow.com/comment/41384106
tagged with: properties
has comment: http://stackoverflow.com/comment/41384004
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26363261
tagged with: java
type: Question
has title: Join values in properties file
has body: For example, properties file has three properties: val1 = 1 val2 = 2 val3 = 3 I would like to add fourth value which is in form of x.x.x (x is a number from previous val). val4 = val1+.+val2+.+val3 = 1.2.3 I've done a lot of googling and haven't found a way to do that.

http://stackoverflow.com/comment/41599569
type: AnswerComment
comment on: http://stackoverflow.com/a/26481558
score: 0
type: Comment
has text: I use methods `setErrorMessage(message)` and `setMessage(message, DialogPage.WARNING)` which load a warning/error icon. My read is this is the root of the issue.

http://stackoverflow.com/q/26508701
has answer: http://stackoverflow.com/a/26526387
tagged with: apache-camel
type: Question
has body: We have a couple of web services (REST+SOAP) running in Apache Camel 2.13.0 based on CXF version 2.7.10 which use SSL and basic authentication all the way, which worked pretty fine. Due to a version upgrade of Camel to version 2.14.0, which internally uses now CXF 3.0.1, our services now stoped working as of a Protocol mismatch for port x: engine's protocol is http, the url protocol is https - the configuration however was untouched during the version-update. ... Caused by: java.io.IOException: Protocol mismatch for port 8081: engine's protocol is http, the url protocol is https at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngineFactory.createJettyHTTPServerEngine(JettyHTTPServerEngineFactory.java:271) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:121) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:154) ... 48 more I therefore created a new eclipse project which simplifies things to its bare minimum (just a simple SOAP service with two endpoints which both use either HTTP or HTTPS). The configuration of the Jetty server can be seen here The actual service is configured as bean to later on use this bean within Camel's route: @Bean(name="endpoint1ServiceSSL") public CxfSpringEndpoint endpoint1ServiceSSL() throws Exception { final CxfSpringEndpoint factoryBean = new CxfSpringEndpoint(); factoryBean.setServiceClass(EnhancedEndpoint1Endpoint.class); factoryBean.setWsdlURL("classpath:/wsdl/test.wsdl"); factoryBean.setEndpointName(new QName(NAMESPACE, "Endpoint1ServicePort", PREFIX)); factoryBean.setServiceName(new QName(NAMESPACE, "Endpoint1_Service", PREFIX)); factoryBean.setAddress(env.getProperty("services.address.ssl")+"/endpoint1"); factoryBean.setDataFormat(DataFormat.POJO); final Map&lt;String, Object&gt; properties = new HashMap&lt;&gt;(); properties.put("schema-validation-enabled", "true"); properties.put("allowStreaming", true); factoryBean.setPr…
answer count: 1
has title: Camel 2.14.0/CXF 3.0.1 Jetty configuration: Protocol mismatch error
downvote count: 0
accepted answer: http://stackoverflow.com/a/26526387
score: 3
favorite count: 0
tagged with: jetty
type: AnsweredQuestion
tagged with: cxf
upvote count: 3
tagged with: java

http://stackoverflow.com/a/26502883
downvote count: 0
has body: " + " " + "<Release batchNo=\"\"/>" + " " + "
accepted answer of: http://stackoverflow.com/q/26502841
answers question: http://stackoverflow.com/q/26502841
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/41534438
type: Comment
comment on: http://stackoverflow.com/q/26445706
type: QuestionComment
has text: Dupe: http://stackoverflow.com/q/10516248/589259
score: 1

http://stackoverflow.com/a/26526630
has comment: http://stackoverflow.com/comment/41706119
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26504356
score: 5
accepted answer of: http://stackoverflow.com/q/26504356
has body: No, this is not sufficient. Even though the browser gives the 'Access-Control-Allow-Origin' error, the request has still been made by the browser. If withCredentials is specified by the attacking page: $http.post(url, {withCredentials: true, ...}) then this request will be sent to your domain with the victim's authentication cookies, meaning that the request to http://www.example.com:8080/user/delete will succeed. Also, this request could also be made without XHR using a standard HTML form: &lt;form method="post" action="http://www.example.com:8080/user/delete"&gt; and JavaScript would just be used to submit the form rather than making the request itself. An easy way to protect your system against CSRF is to check for a custom header such as X-Requested-With or the Origin header. X-Requested-With cannot be sent cross domain without enabling CORS server-side. However, the Synchronizer Token Pattern is still the strongest method of CSRF prevention as this is not subject to flaws in browser plug-ins such as a previous flaw in Flash that allowed headers to be sent that weren't normally possible from a browser.
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/41714162

http://stackoverflow.com/a/28208608
has body: Use a try-catch block in the main method, don't make it throw an exception. What is your JDK version? Try something like: public static void main(String[] args){ try{ //insert code here }catch(Exception e){e.printStackTrace();} Also, use a java.util.ArrayList&lt;String&gt; to store the input text using its add(&lt;String&gt;) method. Then get the number of rows using size() and the number of columns using get(0).length() Also, you have missing code. The main method does not have 20 lines and Exception occurs at line 20. It's probably due to a out-of-bounds condition in your code for calculating the neighbours, but we need the rest of the code to work that out. Please edit accordingly.
score: 0
answers question: http://stackoverflow.com/q/26430738
type: Answer

http://stackoverflow.com/a/26382517
has comment: http://stackoverflow.com/comment/41433696
has comment: http://stackoverflow.com/comment/41437325
score: 0
has comment: http://stackoverflow.com/comment/41424356
has body: For basic image manipulation (resize, crop, rotate etc.), you can use the Images API and in particular, the interface com.google.appengine.api.images.Image. The API seems to support many of the requirements that you mention.
answers question: http://stackoverflow.com/q/26371990
type: Answer

http://stackoverflow.com/comment/41441780
type: AnswerComment
has text: Didn't work, the following results were provided `Float: 5.2109E-41` from sending the float value of `72.5f` through the network.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26394670

http://stackoverflow.com/q/26459164
has comment: http://stackoverflow.com/comment/41578694
tagged with: plsql
linked to: http://stackoverflow.com/q/1947754
linked to: http://stackoverflow.com/q/3699891
has comment: http://stackoverflow.com/comment/41594026
favorite count: 0
type: Question
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/41558550
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41641561
has comment: http://stackoverflow.com/comment/41558321
has comment: http://stackoverflow.com/comment/41558271
answer count: 1
has comment: http://stackoverflow.com/comment/41568164
has title: Is it possible to call pl/sql function from jdbc and register the return value by name?
has comment: http://stackoverflow.com/comment/41558285
score: 4
has body: I am able to call pl/sql functions, using call statements with the following syntax: String call = "{ ? = call p_some_package.some_function( ?, ?, ?, ?, ?) }"; CallableStatement cs = connection.prepareCall(call); But then I have to pass arguments using their indexes, because I have to register the return value, which doesn't have a name: cs.registerOutParameter(1, OracleTypes.NUMBER); cs.setInt(2, someInteger); ... However when calling procedures, I can provide parameter names, because there's no "nameless" out parameter, as there is with a function: cs.setInt("param_name", param_value); Oracle pl/sql reference states that for functions Oracle creates one additional OUT parameter which it returns. So my questions is: Is it possible to pass the name of this parameter or somehow assign a name to this parameter and use it to pass arguments to pl/sql functions from JDBC as I do for procedures? Similar question, no answer: Java named parameter&#39;s name (for Oracle JDBC function result)
has comment: http://stackoverflow.com/comment/41558476
has comment: http://stackoverflow.com/comment/41558425
tagged with: java
has comment: http://stackoverflow.com/comment/41558541
has comment: http://stackoverflow.com/comment/41558366
tagged with: oracle11g
downvote count: 1
has comment: http://stackoverflow.com/comment/41558884
has comment: http://stackoverflow.com/comment/41558256
upvote count: 5
has comment: http://stackoverflow.com/comment/41558121
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26630419

http://stackoverflow.com/q/26388742
upvote count: 0
answer count: 1
has title: how to calculate difference bewteen each line number like excel in javascript or java
favorite count: 0
type: UnansweredQuestion
tagged with: excel
tagged with: node.js
has body: I have a given list of data, which contains the following records, the records are for give fiscal year, from jan-decemebr Date order 1/1/10 787668 1/2/10 787789 1/3/10 788031 1/4/10 788240 ............. ............. ............. 12/29/10 839832 12/30/10 839965 12/31/10 840238 In excel it's easy to get the difference between two given consecutive, date create a formula and drag it and it will display the difference I have to the same thing in Node.js or Java, is there any Java API or java script, node_module present so that i can just the input as orders and the output will be the difference between two consecutive data, the sample example Order diff 787668 119 787787 161 787948 32 787980 114 788094 30
has answer: http://stackoverflow.com/a/26389390
tagged with: java
downvote count: 1
type: Question
tagged with: javascript
score: -1

http://stackoverflow.com/comment/41414541
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26376237
has text: I have found this site: http://www.regular-expressions.info/ one of the best to learn regex.

http://stackoverflow.com/a/26353880
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: You could use a for-each loop to accomplish that: for (Employee employee : al) { System.out.println(employee.name); }
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26353862
answers question: http://stackoverflow.com/q/26353862

http://stackoverflow.com/a/38037415
type: Answer
score: 1
upvote count: 1
has body: In spring-security 4.0 this problem has solved by default.You do not need to write any additional codes,even in security XML configurations.
answers question: http://stackoverflow.com/q/26420941
downvote count: 0

http://stackoverflow.com/comment/41464583
type: AnswerComment
comment on: http://stackoverflow.com/a/26390186
type: Comment
has text: Since you're using WebLogic, I'd suggest opening a support ticket.
score: 0

http://stackoverflow.com/comment/41584463
has text: You actually can, as long as it's not in java.lang and you haven't imported the class
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26473494

http://stackoverflow.com/q/26512430
score: 0
has comment: http://stackoverflow.com/comment/41655284
answer count: 1
tagged with: applet
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/41727046
accepted answer: http://stackoverflow.com/a/26512644
has comment: http://stackoverflow.com/comment/41666542
type: AnsweredQuestion
tagged with: java-2d
upvote count: 1
has body: I am trying to write an applet program in which a circle is drawn. The size of circle will increase if i press L and decrease if I press S. import java.applet.Applet; import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class oval extends Applet implements KeyListener{ private int d=10; @Override public void init() { setSize(500,500); addKeyListener(this); } @Override public void paint(Graphics g) { super.paint(g); g.drawOval(100, 100, d, d); } @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if(e.getKeyChar()=='L') d=d+5; else if(e.getKeyChar()=='S') d=d-5; repaint(); } @Override public void keyReleased(KeyEvent e) { throw new UnsupportedOperationException("Not supported yet."); } }
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41654981
tagged with: java
tagged with: keylistener
has answer: http://stackoverflow.com/a/26512644
has title: Adjustable circle in GUI

http://stackoverflow.com/a/26432293
type: Answer
answers question: http://stackoverflow.com/q/26432197
has body: Just do this: public static String getFormatedValue(String data) { String[] split = data.split(" ", 3); return split[0] + split[2]; } This will take the first and last section, and skip the middle T section.
score: 0

http://stackoverflow.com/q/26488486
tagged with: logging
type: Question
has body: I have a log4j.properties file in the classpath. It was found at the location APP/XX.jar/log4j.properties. And I noticed that in the ear file I can also find log4j-1.2.17.jar in lib folder. But whatever I wrote in the log4j.properties file, they were ignored. Like: log4j.rootCategory=WARN Or something like this: log4j.rootCategory=INFO, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.logger.org.springframework=WARN But all of the loggings will still be printed on the server. Did I configure them wrong or has my Wildfly this property file igored?
tagged with: java
has title: log4j.properties doesn't work correctly on wildfly
score: 4
accepted answer: http://stackoverflow.com/a/26497804
upvote count: 4
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41611611
favorite count: 0
tagged with: log4j
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26497804
has comment: http://stackoverflow.com/comment/41611859
tagged with: wildfly
has comment: http://stackoverflow.com/comment/41613049

http://stackoverflow.com/a/26358942
has comment: http://stackoverflow.com/comment/41376719
accepted answer of: http://stackoverflow.com/q/26358684
type: AcceptedAnswer
downvote count: 0
has body: First do it as string. you can use custom librarys for that like String message = org.apache.commons.io.IOUtils.toString(rd); or a StringBuilder StringBuilder sb = new StringBuilder(); String line; br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } Then you can parse it. Since it's an object because of the "{" (array begin and ends with []) you need to create an JSONObject. JSONObject json = new JSONObject(sb.toString()); then you can access your elements with //{ "status": "ERROR", "errorCode": "MISSING_PARAMS", "errorMessage": null, "requestId": "20141014181739_11625805172", "downstreamModuleErrorCode": null, "object": [ "activity_code", "activity_name", "points", "frequency", "strategy", "vsa_app_access_token" ]} json.getString("status"); or the array with JSONArray jsonArray = new JSONArray(json.getString("object")); or you use the method getJSONArray() JSONArray jsonArray = json.getJSONArray("object");
type: Answer
answers question: http://stackoverflow.com/q/26358684
score: 25
upvote count: 25
has comment: http://stackoverflow.com/comment/41376605

http://stackoverflow.com/comment/41473872
score: 0
type: Comment
type: QuestionComment
has text: What type of variable is `choice`? String? char?
comment on: http://stackoverflow.com/q/26412762

http://stackoverflow.com/q/26490967
has answer: http://stackoverflow.com/a/33213802
has answer: http://stackoverflow.com/a/26514779
type: AnsweredQuestion
score: 125
has answer: http://stackoverflow.com/a/49037272
tagged with: java
has answer: http://stackoverflow.com/a/60133852
has answer: http://stackoverflow.com/a/65502527
has answer: http://stackoverflow.com/a/51079239
has answer: http://stackoverflow.com/a/28439685
type: Question
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/33213802
has comment: http://stackoverflow.com/comment/78179003
has comment: http://stackoverflow.com/comment/41634002
has comment: http://stackoverflow.com/comment/41626134
has answer: http://stackoverflow.com/a/54599849
has comment: http://stackoverflow.com/comment/41642927
has answer: http://stackoverflow.com/a/59823791
tagged with: hikaricp
has answer: http://stackoverflow.com/a/70958176
has answer: http://stackoverflow.com/a/47246045
has answer: http://stackoverflow.com/a/32093013
has answer: http://stackoverflow.com/a/52326856
downvote count: 0
has comment: http://stackoverflow.com/comment/41630100
has answer: http://stackoverflow.com/a/31759040
has answer: http://stackoverflow.com/a/47355799
has comment: http://stackoverflow.com/comment/78239594
possible better answer: http://stackoverflow.com/a/47246045
favorite count: 0
has answer: http://stackoverflow.com/a/50905729
has title: How do I configure HikariCP in my Spring Boot app in my application.properties files?
has answer: http://stackoverflow.com/a/38864646
upvote count: 125
has body: I'm trying to set up HikariCP in my Spring Boot (1.2.0.M1) app so I can test using it in place of Tomcat DBCP. I'd like to configure the connection pool in my application.properties file like I was doing with Tomcat, but I can't figure out how I should be doing it. All examples I've found show either JavaConfig style, or using a separate HikariCP properties file. Can someone help me figure out the property names to configure it in application.properties? I'd like to also switch from using the driverClassName approach to the DataSourceClassName approach since it looks cleaner and is recommended. Is this also possible in my application.properties file(s)? Here's what I had for Tomcat DBCP (just some basic config, not fully flushed out) spring.datasource.validation-query=SELECT 1 spring.datasource.max-active=10 spring.datasource.max-idle=8 spring.datasource.min-idle=8 spring.datasource.initial-size=5 spring.datasource.test-on-borrow=true spring.datasource.test-on-return=true And I'm currently using driverClassName and jdbc url to set up the connection: spring.datasource.url=jdbc:mysql://localhost:3306/myDb spring.datasource.driverClassName=com.mysql.jdbc.Driver
has answer: http://stackoverflow.com/a/36287225
answer count: 18
tagged with: spring

http://stackoverflow.com/q/26430075
tagged with: webcam
type: UnansweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26492833
tagged with: opencv
score: 1
tagged with: java
tagged with: rtp
tagged with: video-streaming
has title: Secure streaming audio/video in JAVA
downvote count: 0
answer count: 1
has body: I'm doing project for my university and I'm stuck with several problems. It's a team project, so we designed an app which core functionality would be secure streaming AV from few cameras (our destination target are IP cameras). We assumed that JMF is not enough for us, so we have found OpenCV library which has JAVA API what is ideal for us since JAVA is our language of choice but I am aware that languages such as C++ would done better for this kind of work, but we haven't sufficient experience and a little time remaining. What we have accomplished for now: We have found and tested ZRTP protocol implementation ZRTP4J and we want to used it for secure transmission (no one should be able to overhear a conversation and now we are also thinking about certification so we would authorize the caller) We can capture frames from the webcam using OpenCV but we have problems with transmitting it via RTP using JMF implementation of this protocol We can encode captured sequence of frames to specific format using Xuggler library and pack it to media container In other words we have frames captured by OpenCV, we want to mux captured frames with captured audio from a microphone and send it over RTP protocol which uses UDP in transport layer. The question is how to do this properly? Should we use some muxer before streaming and demuxer on the output? Or maybe we should have 2 different streams, first for the video and latter for audio? The JMF itself is other problem. We have to care about its AV formats applicable for RTP transmition and its API is rough and mastering it takes much time for us and the fact that this library is old and not developed anymore doesn't motivate us at all. Could someone of you point some tested, verified RTP implementation for JAVA? We are also open for other propositions, maybe we are mistaken at more points in our design. Thank you in advance! Hubert
favorite count: 0

http://stackoverflow.com/q/26374442
has comment: http://stackoverflow.com/comment/41405321
answer count: 1
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/41405619
has title: How to compare one value in an arraylist of objects to output largest value?
has answer: http://stackoverflow.com/a/26374883
accepted answer: http://stackoverflow.com/a/26374883
linked to: http://stackoverflow.com/q/369512
has comment: http://stackoverflow.com/comment/41405495
has body: I need to create a method getLargestObject() that finds the object in the array list with the largest area that returns its position and outputs the contents of the object. The current loop I am using doesn't work and I'm not sure how to compare the values of the areas in an arraylist so I can get the largest one. package csu.cole; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Driver { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File( "C:/Users/Charles/Desktop/GeometricObjectsData.txt")); ArrayList&lt;GeometricObject&gt; list = new ArrayList&lt;GeometricObject&gt;(); while (input.hasNextLine()) { String line = input.nextLine(); String[] tokens = line.split(", "); if (tokens[0].equals("CIRCLE")) { Circle c = new Circle(); if (tokens.length == 4) { float radius = Float.parseFloat(tokens[1]); c.setRadius(radius); String color = String.valueOf(tokens[2]); c.setColor(color); Boolean filled = Boolean.valueOf(tokens[3]); c.setFilled(filled); c.getArea(); list.add(c); System.out.println(c.toString()); } else if (tokens.length == 3) { float radius = Float.parseFloat(tokens[1]); c.setRadius(radius); String color = String.valueOf(tokens[2]); c.setColor(color); Boolean filled = false; c.setFilled(filled); c.getArea(); list.add(c); System.out.println(c.toString()); } else if (tokens.length == 1) { String color = "white"; c.setColor(color); Boolean filled = false; c.setFilled(filled); c.getArea(); list.add(c); System.out.println(c.toString()); } } else if (tokens[0].equals("RECTANGLE")) { Rectangle r = new Rectangle(); if (tokens.length == 5) { float height = Integer.parseInt(tokens[1]); r.setHeight(height); float width = Integer.parseInt(tokens[2]); r.setWidth(width); String color = String.valueOf(tokens[3]); r.setColor(color); Boolean filled = Boolean.valueOf(tokens[4]); r.setFilled(filled); r.getArea(); list.add(r); Sy…
has comment: http://stackoverflow.com/comment/41405228
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41405349
tagged with: java
type: Question

http://stackoverflow.com/q/26361948
type: Question
type: AnsweredQuestion
has title: Updating tab content after it's already been initialized
score: 1
tagged with: java
has body: I have a tab called Status that I've initialized in my main window like so: private static void setupTabbedPane ( JTabbedPane tabbedPane ) { //Create tab related components status = new Summary(); // Create tabs tabbedPane.addTab ("Status", new WebScrollPane(status.summaryPage)); tabbedPane.setBackgroundAt(0, Color.DARK_GRAY); tabbedPane.setForegroundAt(0, Color.BLACK); } It adds a summaryPage which is simply a JPanel. I've added a feature where when the user right clicks they can launch a scaled down window (new JFrame) with the content in the summary page, now I'm trying to put back that summary page inside that Status tab when the user closes that mini window they launched. Here's what I have: public class MiniSmryWindow { public JFrame frame; public MiniSmryWindow() { // Initialize Mini Window frame = new JFrame("Status"); frame.setLayout(new BorderLayout()); frame.setSize(200, 300); frame.setLocationRelativeTo(null); frame.add(BootWindow.status.summaryPage); frame.setVisible(true); frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { System.out.println("Closing mini window"); BootWindow.tabbedPane.setTabComponentAt(0, BootWindow.status.summaryPage); } }); } Right now the component gets added where the tab title is not inside the tab's panel, how can I fix this?
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26362161
tagged with: jtabbedpane
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/26362161

http://stackoverflow.com/q/26430562
has comment: http://stackoverflow.com/comment/41581004
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26494332
accepted answer: http://stackoverflow.com/a/26494332
tagged with: httpurlconnection
has comment: http://stackoverflow.com/comment/41511768
has body: I read data from a source location via BufferedInputStream and I pass the data to a destination using BufferedOutputStream. The problem I'm having is that sometimes my thread never exits the while loop because of starving on the bandwidth. Any ideas? Here's the code: BufferedInputStream bis = new BufferedInputStream(sourceConnection.getInputStream()); BufferedOutputStream request = new BufferedOutputStream(destConnection.getOutputStream()); request.write(content.getBytes("UTF-8")); boolean eof = false; byte[] input = new byte[4096]; while ((length = bis.read(input)) != -1) { request.write(input, 0, length); request.flush(); } request.close(); bis.close();
type: AnsweredQuestion
has title: How to avoid starving BufferedInputStream?
has comment: http://stackoverflow.com/comment/41580484
tagged with: java
tagged with: bufferedinputstream
has comment: http://stackoverflow.com/comment/41506695

http://stackoverflow.com/a/26406102
answers question: http://stackoverflow.com/q/26399757
has comment: http://stackoverflow.com/comment/65087215
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26399757
has body: I figured out that the OnItemSelected method is never/rarely called on touch devices. It fires up if you use the emulator cross-navigation and on special devices with hybrid or non-touch control. It is only called if you scroll through the list but not if you click on it. Thats why you should use the OnItemClickListener on a general tablet/smartphone with touch control.
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/41748339
score: 0
type: Comment
type: QuestionComment
has text: Hi Neo, I am able to play the file through VLC player on PC but not WMP. I still cannot figure out the issue !!
comment on: http://stackoverflow.com/q/26443758

http://stackoverflow.com/a/26430597
has body: As seems typical with much example code, the suggested correct solution is inadiquate. Here is an actually correct solution: public boolean nestParen(final String value) { if (value != null) { if (value.isEmpty()) { return true; } if (value.charAt(0) == '(' &amp;&amp; value.charAt(value.length()-1) == ')') { return nestParen(value.substring(1, value.length()-1)); } else { return false; } } else // value is null { return true; } } Explanation: (same as with the other answer) if the parameter is not null, continue. This prevents NullPointerExceptions. if the parameter is empty, return true. The problem appears to be return true if a string contains zero or more nested pairs of parens and nothing else. If the first char is '(' and the last char is ')', strip these chars and check again (this is the recursion). otherwise (first is not '(' and/or last is not ')') return false. lastly, if the parameter was null, return true (it contains zero pairs and nothing else).
score: 0
answers question: http://stackoverflow.com/q/26430327
type: Answer

http://stackoverflow.com/comment/41457361
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26401841
has text: @MetaData Good to hear that you solved your problem.

http://stackoverflow.com/a/26405311
has body: This is a typical usage for interfaces. See interfaces as defining the Type of an instance. Therefore, you know that all instance of a certain Type can do a particular task. At that point, you don't really care about the concrete class of the object, you just know it has that particular interfaces available to you to use. Example : public interface Worker { public void doWork(); } public class Object1 implements Worker { public void doWork() { // work for this specific object } } public class Object2 implements Worker { public void doWork() { // work for this specific object } } public class Object3 implements Worker { public void doWork() { // work for this specific object } } Then your if statements would be replaced by obj.doWork();
score: 0
answers question: http://stackoverflow.com/q/26405164
type: Answer

http://stackoverflow.com/q/26474223
tagged with: character
score: 1
tagged with: java
has title: Java - Replace a character in a string
upvote count: 1
has answer: http://stackoverflow.com/a/26474326
type: Question
type: AnsweredQuestion
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/26474362
answer count: 3
accepted answer: http://stackoverflow.com/a/26474326
downvote count: 0
possible better answer: http://stackoverflow.com/a/26474356
favorite count: 0
has answer: http://stackoverflow.com/a/26474356
has body: don't think I haven't searched online for an answer. Why is it giving me outofbounds error? I have two 6-chars long strings. One is "daniel" and another is "------". User enters a character. Loop goes through the "daniel" string and checking char by char is they match with the user input. If it matches, it should replace the guessed char with the one in "------". So if you input 'a' it should output "-a----" and the loop continues. Next if you enter 'e' it should output "-a--e-" etc. Code gives no compilation error or any warning and also makes perfect sense. I tried substring and replace but this is simpler and shorter. I tried debugging it but it gives no useful info. I don't know why is it returning outofbounds error. package hello.world; import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { Scanner in=new Scanner(System.in); String word="daniel"; StringBuilder guess2 = new StringBuilder("------"); char guess; System.out.println("**********************"); System.out.println("* Welcome to Hangman *"); System.out.println("**********************"); for (int i=0;i&lt;10;i++) { System.out.print("Enter a letter: "); guess=in.nextLine().charAt(0); for (int j=0;i&lt;word.length();j++) { if (guess==word.charAt(j)) { guess2.setCharAt(word.charAt(j), guess); System.out.print(guess2); } } } } } Output: ********************** * Welcome to Hangman * ********************** Enter a letter: a Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 97 at java.lang.AbstractStringBuilder.setCharAt(AbstractStringBuilder.java:380) at java.lang.StringBuilder.setCharAt(StringBuilder.java:76) at hello.world.HelloWorld.main(HelloWorld.java:22) Java Result: 1 BUILD SUCCESSFUL (total time: 2 seconds)

http://stackoverflow.com/q/26478010
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41592821
score: 2
type: AnsweredQuestion
upvote count: 2
has title: How to handle Currency in Java 8?
has answer: http://stackoverflow.com/a/26478036
tagged with: java-8
type: Question
tagged with: jakarta-ee
has body: What is the preferred way to handle currencies in Java 8? The things that could be of interest would be * Currency Full Name (e.g. United States Dollar) * Currency Abbreviation (e.g. USD) * Currency Symbol (e.g. $) Any other thing that I might be missing here? What are the best options?
has comment: http://stackoverflow.com/comment/41598301
tagged with: java
accepted answer: http://stackoverflow.com/a/26478036

http://stackoverflow.com/a/26400413
answers question: http://stackoverflow.com/q/26396639
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26396639
downvote count: 0
has body: The easiest place to find library, sources and javadocs is Maven Central in my opinion. If you use the sbt-idea plugin, you can make sbt generate your project files, and that will automatically include a full Scala facet with sources and docs.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41477790

http://stackoverflow.com/a/26388551
downvote count: 0
has comment: http://stackoverflow.com/comment/41433965
answers question: http://stackoverflow.com/q/26386808
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26386808
has body: The best place to keep configuration values such as this key is in your Config.groovy, the application configuration. Using your example you might have something like this: // Config.groovy ... jasyptKey = 'myKeyGoesHere' ... Taking this one step further you should consider using an external configuration file (or property file) to store sensitive production information such as this encryption key. The Grails documentation has more information on externalized configurations. Then in your domain/service/controller you can use dependency injection to access the grailsApplication: // example service class MyService { def grailsApplication ... def serviceMethod() { ... encryptor.setPassword(grailsApplication.config.jasyptKey) ... } ... } In the very rare case where you need to access this configuration from outside a Grails/Spring artifact that doesn't support dependency injection you can use the Holders instead: // some class in /src/ import grails.util.Holders ... encryptor.setPassword(Holders.config.jasyptKey) ...
upvote count: 2
has comment: http://stackoverflow.com/comment/41433895
has comment: http://stackoverflow.com/comment/41434482
has comment: http://stackoverflow.com/comment/41433225
has comment: http://stackoverflow.com/comment/41434426
type: AcceptedAnswer

http://stackoverflow.com/a/26546902
accepted answer of: http://stackoverflow.com/q/26507355
score: 2
has comment: http://stackoverflow.com/comment/79310282
answers question: http://stackoverflow.com/q/26507355
upvote count: 3
has body: I have read the following link then applied the servlet mapping technique. I can access the wsdl and make successfuly SOAP request via SOAPUI http://www.krestjaninoff.ru/2013/09/custom-context-path-for-jax-ws-web.html TestWSPort TestWSPort name.krestjaninoff.TestWSService TestWSPort myOwn/path/TestWS Here is the project I have created, you can download https://www.dropbox.com/s/vztkfqxekw43n4a/WeblogicJaxWsProject.zip?dl=0 Thanks Mikhail Krestjaninoff who is owner of the post given by link above
downvote count: 1
has comment: http://stackoverflow.com/comment/74583879
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41805008
has text: Without full information I wont be able to help you.my skype is krutik.jayswal
comment on: http://stackoverflow.com/q/26510089
score: 0
type: Comment
type: QuestionComment

extjs
tags question: http://stackoverflow.com/q/26485145
type: Tag
tag name: extjs

http://stackoverflow.com/a/26375588
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26369491
upvote count: 3
has body: @XmlElement(name = "tags") List&lt;Tag&gt; tags; It basically reads, for each item in the list, create a element named &lt;tags&gt;. So in essence, all you have is a &lt;subject&gt; element wrapping multiple &lt;tags&gt;. A couple options to get another "upper-level" element You can create a "upper-level" class to represent that, say Tags public class Tags { protected List&lt;Tag&gt; tags; @XmlElement(name = "tag") public List&lt;Tag&gt; getTags() { if (tags == null) { tags = new ArrayList&lt;&gt;(); } return tags; } public void setTags(List&lt;Tag&gt; tags) { this.tags = tags; } } Then have an instance of Tags as a property of Sample @XmlRootElement(name = "sample") public class Sample { private Tags tags; @XmlElement(name = "tags") public void setTags(Tags tags) { this.tags = tags; } public Tags getTags() { return tags; } } OR An even simpler solution is just to use @XmlElementWrapper Generates a wrapper element around XML representation. This is primarily intended to be used to produce a wrapper XML element around collections Using your original code, you can simple add the annotation to the list @XmlRootElement(name = "sample") public class Sample { private List&lt;Tag&gt; tags; @XmlElementWrapper(name = "tags") @XmlElement(name = "tag") public List&lt;Tag&gt; getTags() { if (tags == null) { tags = new ArrayList&lt;&gt;(); } return tags; } public void setTags(List&lt;Tag&gt; tags) { this.tags = tags; } }

http://stackoverflow.com/a/26375229
type: AcceptedAnswer
downvote count: 0
has body: This most certainly the work of a WIndows environment. Some other process must be holding the lock to the folder or its contents. Once you have identified the process which is holding the lock and kill it, u will certainly be able to delete the folder. If ur not sure of the process that is accesing the folder , u might consider restarting ur machine.
has comment: http://stackoverflow.com/comment/82165288
answers question: http://stackoverflow.com/q/26375165
accepted answer of: http://stackoverflow.com/q/26375165
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/41617688
type: AnswerComment
comment on: http://stackoverflow.com/a/26491776
type: Comment
has text: Hmmm, that class is in the same jar as OrderToolRequest. I can insert the line "OrderToolResponse response = new OrderToolResponse();" into my code in this function and it works perfectly. Is this something to do with the fact that the URLClassLoader doesn't have that jar in one of its paths?
score: 0

http://stackoverflow.com/comment/41461569
comment on: http://stackoverflow.com/a/26406340
score: 0
type: Comment
has text: it's not working... is there a step between request.setAttribute and the jsp finding it?
type: AnswerComment

http://stackoverflow.com/comment/41558669
type: AnswerComment
comment on: http://stackoverflow.com/a/26459400
type: Comment
has text: I have difficulty to understand this. how this always true?
score: 0

http://stackoverflow.com/q/26442873
favorite count: 0
has comment: http://stackoverflow.com/comment/41531240
accepted answer: http://stackoverflow.com/a/26531460
upvote count: 7
tagged with: checkbox
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41778056
has body: I want to make a checklist webpage in jsp page. I am using struts2 tags in my jsp page. I want when my jsp first loaded the check box should automatically populated based on the value which comes from database. And when a user manually check or uncheck the check box something should get stored in the database, so that when another user access the same URL he can see the same state of check box. I don't want to use submit button. Please help me how to implement it....!!! Thanks in advance
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/41530133
type: Question
answer count: 1
tagged with: jsp
tagged with: struts2
tagged with: ajax
has title: auto populating struts2 checkboxes from database
downvote count: 0
has answer: http://stackoverflow.com/a/26531460

http://stackoverflow.com/q/26479507
type: UnansweredQuestion
tagged with: fonts
tagged with: java
downvote count: 2
has body: I have a desktop application in java that converts from literal hindi text to corresponding english translitration. I am using jTextArea in desktop application. Now I want to make a web application for doing the same. My end goal is to have two text areas in html in one of which I can type hindi characters and in other one would show translitration result in english characters at the same time. For Hindi I want to use kruti dev font and Times new roman for english.
has answer: http://stackoverflow.com/a/76565302
tagged with: hindi
type: Question
answer count: 2
upvote count: 0
score: -2
tagged with: textarea
has answer: http://stackoverflow.com/a/26479790
favorite count: 0
has title: Allowing Hindi fonts in html text area
has comment: http://stackoverflow.com/comment/41595457
has comment: http://stackoverflow.com/comment/66613195
tagged with: non-english

http://stackoverflow.com/q/26436824
tagged with: ubuntu
linked to: http://stackoverflow.com/q/5928225
has answer: http://stackoverflow.com/a/26437437
has comment: http://stackoverflow.com/comment/41518129
answer count: 1
downvote count: 0
favorite count: 0
has title: Executing Ubuntu commands from java program
has comment: http://stackoverflow.com/comment/41519614
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class MyCommand { public static void main(String[] args) { String [] commandList = {"/bin/bash","-c", "/home/atul/Desktop/javaprogramm/" , "mkdir newmanisha" , "mkdir newmanisha"}; Runtime r = Runtime.getRuntime(); try { Process p = r.exec(commandList); BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); String line=reader.readLine(); while(line!=null) { System.out.println(line); line=reader.readLine(); } } catch (IOException e) { e.printStackTrace(); } } } Trying to execute this but nothing happens . I am using ubuntu 13.10.how to do cd in ubuntu using java program. I have used "-c" but it is not working.
has comment: http://stackoverflow.com/comment/41518683

http://stackoverflow.com/comment/41717808
type: QuestionComment
has text: Back on the problem: LD_LIBRARY_PATH has restrictions on linux, and more restrictions on Android. not that any app launched from am will likely not inherit the shell environment, because am will not spawn a process from the shell, but instead from the init. So it is very likely that you'll not be able to inherit it. I suggest to avoid this problem by putting the library in a directory already in the library search path.
comment on: http://stackoverflow.com/q/26501677
score: 0
type: Comment

http://stackoverflow.com/comment/41550116
comment on: http://stackoverflow.com/a/26444469
score: 0
type: AnswerComment
has text: @smitamallik Glad it worked! Don't forget to accept the answer to let everyone else know this was the solution - see the [site tour in the help center](http://stackoverflow.com/tour) for more on this and how the site works
type: Comment

processing
tags question: http://stackoverflow.com/q/26399782
tags question: http://stackoverflow.com/q/26508221
type: Tag
tags question: http://stackoverflow.com/q/26394622
tags question: http://stackoverflow.com/q/26504843
tags question: http://stackoverflow.com/q/26429965
tags question: http://stackoverflow.com/q/26384119
tags question: http://stackoverflow.com/q/26479383
tag name: processing

http://stackoverflow.com/comment/62768133
type: QuestionComment
has text: Have you been able to load the driver in the end? Maybe take a look at [my question](http://stackoverflow.com/questions/37644148/java-lang-illegalstateexception-could-not-load-jdbc-driver-class-com-mysql-jdb).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26490057

http://stackoverflow.com/comment/41655730
score: 0
has text: @ajb the memory leak is that the scanner isn't closed...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26512543

http://stackoverflow.com/comment/41564841
score: 0
type: QuestionComment
type: Comment
has text: JohnnyAW maybe i saw it in pattern attibute and not in mapping, I'm no more sure where i saw it
comment on: http://stackoverflow.com/q/26463008

http://stackoverflow.com/a/26411249
downvote count: 0
answers question: http://stackoverflow.com/q/26410465
accepted answer of: http://stackoverflow.com/q/26410465
type: Answer
score: 4
has body: There are a couple of things wrong here, I think. Like Thomas Kagan said in the comments, there are some typos: The range select widget has a ; after "value:" and a ) after "label: Range". Next, in your getRangeArray function, you are actually building a string! That's not necessary - you would have to parse it with JSON.parse to be useful. Instead, just build the array with objects directly: function getRangeArray(pulselen){ var myOptions = []; var array = [0.5,1,2,5,10,20,40]; console.log("Length got is " + pulselen); for(i=0;i&lt;array.length;i++){ myOptions.push({label: array[i].toString(), value: "" + array[i]*1000 }); } return myOptions; } Notice that I call toString() on the labels! Otherwise dijit/form/Select will throw some really weird errors - it expects the labels to be strings. Also, although I don't know if it's necessary, you may have to call reset() on the _Range widget after updating its options: registry.byId("_Range").set("options", newOptions).reset(); .. at least you used to, but it seems to work without it now. Here's a fiddle with your code, and the updated parts: http://jsfiddle.net/ycrz1ug4/
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/41516093
score: 0
has text: There are a lot of things you are missing here about the lifecycle of Java objects and the lifecycle of Spring beans. I recommend reading the duplicate and reading the Spring IoC documentation. (Constructors are ran before Spring can inject anything into fields.)
type: QuestionComment
comment on: http://stackoverflow.com/q/26433174
type: Comment

http://stackoverflow.com/a/26502260
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41636281
has comment: http://stackoverflow.com/comment/41640252
answers question: http://stackoverflow.com/q/26502051
has comment: http://stackoverflow.com/comment/41636299
has body: Not sure why you are creating a dynamic instance of a job (eg. Job_16997761, it seems that each job has its own class). But when creating the jobs you can maintain a map that will have the number of jobs per day. Something like: Map&lt;String, Long&gt; jobsPerDay=new HashMap&lt;String,Long&gt;(); Then when creating a new job you can simply increment the counter for each day: jobsPerDay.put(day,jobsPerDay.get(day)!=null?jobsPerDay.get(day)++:1); This way you will be able to get the number of jobs for a day by using: jobsPerDay.get(day) Please note that you can use java.time.DayOfWeek instead of a String.
score: 1

http://stackoverflow.com/comment/41625081
type: Comment
comment on: http://stackoverflow.com/a/26495912
score: 0
type: AnswerComment
has text: I'd also advise against using `BuildConfig.DEBUG` as it's inherently broken, and prefer defining your own DEBUG parameter in Gradle.

http://stackoverflow.com/q/26427450
type: UnansweredQuestion
downvote count: 2
has body: I have a basic JUnit test which I want to run only on Linux. How I can skip the test if I build the code on Windows? For example can I get the OS platform from Java?
upvote count: 9
has comment: http://stackoverflow.com/comment/41500907
has answer: http://stackoverflow.com/a/26427519
tagged with: java
has comment: http://stackoverflow.com/comment/88656379
has answer: http://stackoverflow.com/a/26427575
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41499864
score: 7
favorite count: 0
tagged with: junit
has title: Run JUnit test only on Linux

http://stackoverflow.com/comment/41653078
type: AnswerComment
type: Comment
has text: @MD1984 Thanks for the confirmation, I edited my post to reflect the new release. That was fast!
comment on: http://stackoverflow.com/a/26493179
score: 0

http://stackoverflow.com/q/26496752
tagged with: arrays
downvote count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/26496838
has body: I'm very close to completing this, all I need is help on finding the five lowest values from a text file by using arrays. I figured out how to find the five highest values, but my min array to find the lowest values always outputs five 0's. Output: //obviously dependent on individual text file Total amount of numbers in text file is 10 Sum is: 1832 1775 14 9 9 7 //max 0 0 0 0 0 //min Any help is much appreciated! import java.util.Scanner; import java.io.*; public class HW3 { public static void main(String[] args) throws IOException { File f = new File("integers.txt"); Scanner fr = new Scanner(f); int sum = 0; int count = 0; int[] max = new int[5]; int[] min = new int[5]; int temp; while(fr.hasNextInt()) { count++; fr.nextInt(); } Scanner fr2 = new Scanner(new File("integers.txt")); int numbers[] = new int[count]; for(int i=0;i&lt;count;i++) { numbers[i]=fr2.nextInt(); //fills array with the integers } for(int j:numbers)//get sum { sum+=j; } for (int j=0; j &lt; 5; j++) //finds five highest { for (int i=0; i &lt; numbers.length; i++) { if (numbers[i] &gt; max[j]) { temp = numbers[i]; numbers[i] = max[j]; max[j] = temp; } } } for (int j=0; j &lt; 5; j++) //finds five lowest...array not assigned values { for (int i=0; i &lt; numbers.length; i++) { if (numbers[i] &lt; min[j]) { temp = numbers[i]; numbers[i] = min[j]; min[j] = temp; } } } System.out.println("Total amount of numbers in text file is " + count); System.out.println("Sum is: " + sum); System.out.println(max[0] + " " + max[1] + " " + max[2] + " " + max[3] + " " + max[4]); System.out.println(min[0] + " " + min[1] + " " + min[2] + " " + min[3] + " " + min[4]); } }
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26498489
accepted answer: http://stackoverflow.com/a/26498489
has answer: http://stackoverflow.com/a/26497095
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26497463
has answer: http://stackoverflow.com/a/26496919
tagged with: java
has title: Can't find five lowest values in an array...max works while min array is not assigned values
type: Question
tagged with: highest
possible better answer: http://stackoverflow.com/a/26496838

http://stackoverflow.com/comment/41481579
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26417260
has text: What does `fgetc` do?
type: Comment

http://stackoverflow.com/comment/127831644
type: Comment
has text: Why isn't something like that in the standard library?
comment on: http://stackoverflow.com/a/26489227
score: 1
type: AnswerComment

http://stackoverflow.com/q/26484675
score: 0
has comment: http://stackoverflow.com/comment/41607557
has body: I've written a function which can get the environment variables value. The input parameter would be as follows ${machine}/bin or ${machine/bin} or ${machine}/bin${path${OS}}/path I would need to check the values which start with ${} I've written a function which is kinda recursive in nature, but would appreciate it if anyone can review the code for me and tell me what can be done better private String replaceWithEnvironmentVariables(String specialChars) { String result=""; boolean flag=true; try{ result = specialChars; String temp = ""; char loopBreaker = '}'; char dollarCheck = '$'; char slashCheck = '/'; int index = result.indexOf("{"); if (index == -1){ result = result.replaceAll("[{},$]", ""); return result; } for (int i = index; i &lt; result.length(); i++) { if(slashCheck==result.charAt(i)) break; temp += result.charAt(i); if(dollarCheck==result.charAt(i) || loopBreaker==result.charAt(i)){ break; } } String sub = temp.replaceAll("[{},$/]", ""); if(sub==null || sub.length()==0){ sub=""; flag=false; result = result.replace(temp, sub); } if(flag){ String returnSub = getEnvironmentVariableValue(sub); result = result.replace(temp, returnSub); } }catch(NullPointerException nullPointer){ nullPointer.printStackTrace(); }catch(Exception except){ except.printStackTrace(); } return replaceWithEnvironmentVariables(result); } PS: The code is working, but I'm just here to know what I do to improve this. If this question seems to be off-topic I'm terribly sorry.
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41603988
tagged with: recursion
tagged with: java
has title: What improvements can be made to this?
type: Question

http://stackoverflow.com/comment/41433965
type: AnswerComment
type: Comment
has text: Agreed. Okay. Thank you for explaining. I will update the answer. I also agree, DI should be used when it can be. I assumed too much from the code being presented in the question. Thank you again, for the clarification and I will be sure to be more specific in the future when mentioning the use of Holders.
comment on: http://stackoverflow.com/a/26388551
score: 0

http://stackoverflow.com/comment/41588324
comment on: http://stackoverflow.com/a/26475216
score: 0
type: AnswerComment
type: Comment
has text: @ElliottFrisch thanks for clearing this up. It makes more sense now. Also thats probably the reason i had to user DecimalFormat to get rid of the fractions.

http://stackoverflow.com/a/26359872
answers question: http://stackoverflow.com/q/26358494
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/50551623
has body: I'm not sure are you trying to just use build in theme valo or extend it with your own theme... If you want to use valo theme in your app you don't need to write scss just add @Theme annotation to your UI class: @Theme("valo") @SuppressWarnings("serial") public class MyVaadinUI extends UI {..... If you are planning to write your own theme (named eg mytheme), which extends valo theme you have to create own theme folder under VAADIN\themes dir : src\main\webapp\VAADIN\themes\mytheme and write files in that dir: mytheme.scss @import "addons.scss"; @import "mytheme.scss"; /* This file prefixes all rules with the theme name to avoid causing conflicts with other themes. */ /* The actual styles should be defined in mytheme.scss */ .mytheme { @include addons; // Include mytheme theme styles in your theme @include mytheme; } styles.scss // Global variable overrides. Must be declared before importing Valo. // Defines the plaintext font size, weight and family...... //$v-font-size: 16px; //$v-font-family: "Open Sans", sans-serif; @import "../valo/valo.scss"; @mixin mytheme { @include valo; // Insert your own theme rules here } BTW: You can use maven archetype to create working Vaadin app project with theme mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype- application -DarchetypeVersion=7.3.2 -Dpackaging=war
downvote count: 0

http://stackoverflow.com/q/26422837
has comment: http://stackoverflow.com/comment/41491356
has answer: http://stackoverflow.com/a/26582455
type: Question
has answer: http://stackoverflow.com/a/26427103
score: 0
accepted answer: http://stackoverflow.com/a/26582455
linked to: http://stackoverflow.com/q/15415136
has answer: http://stackoverflow.com/a/26425708
possible better answer: http://stackoverflow.com/a/26425708
has body: i am trying to read the xml file data using a java program. But the o/p shows null only. The idea is to read the value for example the content name from the below xml file 1.e. Content Value="AssetFlow_Trial_07.mpg" from the below xml file. But all i get is blank output only. Below is my xml file, xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ADI&gt; &lt;Metadata&gt; &lt;AMS Asset_Name="mntario8616_8889pk_026" Provider="Rogers" Product="DRAOD" Version_Major="4" Version_Minor="12" Description="Kids_in_Hall_Ep__1Package_Asset" Creation_Date="2010-06-11" Provider_ID="HBOworld" Asset_ID="TJPK0000000000000026" Asset_Class="package"/&gt; &lt;App_Data App="MOD" Name="Provider_Content_Tier" Value="IFCC_FREE_10"/&gt; &lt;App_Data App="MOD" Name="Metadata_Spec_Version" Value="CableLabsVOD1.1"/&gt; &lt;/Metadata&gt; &lt;Asset&gt; &lt;Metadata&gt; &lt;AMS Asset_Name="mntario8616_8889m_024" Provider="Rogers" Product="DRAOD" Version_Major="1" Version_Minor="0" Description="Kids_in_Hall_Ep__1Title_Movie" Creation_Date="2010-06-11" Provider_ID="HBOworld" Asset_ID="TJMV0000000000000024" Asset_Class="movie"/&gt; &lt;App_Data App="MOD" Name="Type" Value="movie"/&gt; &lt;App_Data App="MOD" Name="Encryption" Value="N"/&gt; &lt;App_Data App="MOD" Name="Audio_Type" Value="Stereo"/&gt; &lt;App_Data App="MOD" Name="Languages" Value="en"/&gt; &lt;App_Data App="MOD" Name="Viewing_Can_Be_Resumed" Value="Y"/&gt; &lt;App_Data App="MOD" Name="HDContent" Value="Y"/&gt; &lt;/Metadata&gt; &lt;Content Value="AssetFlow_Trial_07.mpg"/&gt; &lt;/Asset&gt; This is my java code, Java code: XMLInputFactory factory = null; XMLStreamReader reader = null; XMLInputFactory factory = null; XMLStreamReader reader = null; try { factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.IS_COALESCING, true); reader = factory.createXMLStreamReader(new FileInputStream(new File( "D:\\seachange\\AssetFlow Test Files\\DR-Sun3.xml"))); boolean readCharacters = false; while (reader.hasNext())…
has title: Read xml data in java
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26444609
tagged with: java

http://stackoverflow.com/q/26416955
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26419698
tagged with: java
has answer: http://stackoverflow.com/a/26419698
type: Question
tagged with: min
has comment: http://stackoverflow.com/comment/41488375
tagged with: max
tagged with: arrays
tagged with: class
score: 0
answer count: 2
has body: I am making a program for a java class of mine that asks this: Write A Rainfall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following: The total rainfall for the year The average monthly rainfall The month with most rain The month with least rain Demonstrate the class in a complete program. (Do not accept negative numbers for monthly rainfall figures) import java.util.Scanner; import java.io.*; public class apples{ public static void main (String[] args){ Scanner kenny = new Scanner(System.in); double rain[]=new double[13]; double sum = 0; double avg =0; double most =0; double least =0; System.out.println("Your local weather man here getting paid to tell you the wrong weather!!"); System.out.println(""); System.out.println("Please enter in the following rainfall for the months ahead: "); System.out.println("Month\tRainfall (In inches)"); System.out.print("January: "); rain [0] = kenny.nextDouble(); System.out.print("February: "); rain [1] = kenny.nextDouble(); System.out.print("March: "); rain [2] = kenny.nextDouble(); System.out.print("April: "); rain [4] = kenny.nextDouble(); System.out.print("May: "); rain [5] = kenny.nextDouble(); System.out.print("June: "); rain [6] = kenny.nextDouble(); System.out.print("July: "); rain [7] = kenny.nextDouble(); System.out.print("August: "); rain [8] = kenny.nextDouble(); System.out.print("September: "); rain [9] = kenny.nextDouble(); System.out.print("October: "); rain [10] = kenny.nextDouble(); System.out.print("November: "); rain [11] = kenny.nextDouble(); System.out.print("December: "); rain [12] = kenny.nextDouble(); //(Or rain[] = 1,2,3,4,5,6,7,8,9,10,11,12); sum = rain[0] + rain[1] + rain[2] + rain[3] + rain[4] + rain[5] + rain[6] + rain[6] + rain[7] + rain[8] + rain[9] + rain[10] + rain[11] + rain[12] ; avg = (rain[0] + rain[1] + rain[2] + rain[3] + rain[4] + rain[5] + rain[6] + rain[6] + rain[7] + rain[8] + rain[9] + rain[10] + rai…
has answer: http://stackoverflow.com/a/26417081
accepted answer: http://stackoverflow.com/a/26417081
has title: Rainfall class, finding the max and minimum from an array

http://stackoverflow.com/a/26510493
upvote count: 1
answers question: http://stackoverflow.com/q/26510378
has body: Your condition: } while (HexFile.next() != " "); also reads a hex number and discards it (because you don't store its return value anywhere). This explains why only the even numbers are printed by your code. Instead use the following condition: } while (HexFile.hasNext()); Scanner.hasNext() just tests if there are more tokens but does not read or discard the next token if there are more. Also you might want to use a while loop which tests before reading because the file might not contain anything, so for example: while (HexFile.hasNext()) { String Hex = HexFile.next(); // rest of your code }
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/41467912
has text: [This answer](http://stackoverflow.com/a/17926847/2970947) implies it's JRF (rather then Weblogic proper). Also, SO is not a forum site.
comment on: http://stackoverflow.com/q/26408994
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26361715
score: 2
accepted answer of: http://stackoverflow.com/q/26359679
answers question: http://stackoverflow.com/q/26359679
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has body: From the image you pasted, it looks like it is a text INPUT control (under Show Info button), like JTextField and not a JLabel. You can use HTML content with JLabel constructor as well as with its setText method too. It works fine. JLabel lbl = new JLabel(" Type: Circle Some info More info ") JLabel lbl2 = new JLabel(); lbl2.setText(" Type: Circle Some info More info ") But if you want to have an INPUT control (as in your image), you can not use HTML with JTextField. You have to use JTextPane for this. JTextPane txt = new JTextPane(); txt.setContentType("text/html"); txt.setText(" Type: Circle Some info More info ");

http://stackoverflow.com/comment/41429534
comment on: http://stackoverflow.com/q/26385422
score: 0
has text: Yes, I would like to store it in a public static variable. At the moment it is stored in a proteced static variable, which works fine. The question is not if it would work (it works, I tried it already) but the question is, if it is save to do this.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41555160
type: AnswerComment
comment on: http://stackoverflow.com/a/26457350
type: Comment
has text: Right, that is because randNumber is a field in the 'Bagels' class. The instance of 'Bagels' that you have created, called myBagels, has the randNumber field. So from outside of that class, (like in your main method), you would access it with `myBagels.randNumber`. I would have a look at [this page](http://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) and try to add a constructor for your Bagels class that takes an int, and uses it to initialize the randNumber field. Calling the constructor would then look like `Bagels myBagels = new Bagels(10);` to initialize that to 10.
score: 0

http://stackoverflow.com/q/26434320
has title: Form Based Authentication
has comment: http://stackoverflow.com/comment/41514445
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: web
accepted answer: http://stackoverflow.com/a/26444197
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/41525572
has comment: http://stackoverflow.com/comment/41514523
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26444197
type: Question
has body: I have experience programming Java Applications but never any Web Apps so xml is relatively new to me. I've learned quite a bit in my research but I'm currently stumped and hopefully you all can help me out. Context: The company I work for hired a contractor to develop software for inventory. The developer chose to create a web app on the company's intranet (not connected to Internet at all). Several months and a handful of revisions down the road, the developer quit working on the project for unknown reasons (to me, at least). So here I am using a .war file to reverse engineer and then finish the project! I've configured Tomcat and MS SQL Server and all connections are good according to Netbeans. I can deploy the app but here is where I get stuck. The index.jsp contains a login.jsp. Looking at the code for these pages has me confused. As best I can tell, the developer was going for Form Based Authentication so that user roles are determined at login. I don't understand how this code redirects to any page at all, much less does anything: <form method="POST" action='<%= response.encodeURL("j_security_check") %>' > Username: Password: Specifically, what tells the app that a login is good or bad? What handles the events when the buttons are clicked? I appreciate your patience and help!
tagged with: j-security-check

http://stackoverflow.com/q/26373160
has comment: http://stackoverflow.com/comment/41404036
has comment: http://stackoverflow.com/comment/41404776
has comment: http://stackoverflow.com/comment/41403519
has comment: http://stackoverflow.com/comment/41403875
score: 0
has comment: http://stackoverflow.com/comment/41404912
has body: I have written a program with minimal errors but do not know where I should place the Average or Letter grade function: package org.education.tutorial; import java.util.Scanner; public class GradingScale { public static void main (String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Please enter the number of students attending your current session :"); int numberOfStudents = keyboard.nextInt(); System.out.println(); System.out.print("Also, please enter the amount of exams taken during the duration of the course : "); int examScores = keyboard.nextInt(); AssignValueToArray(numberOfStudents, examScores); keyboard.close(); } public static void AssignValueToArray(int amountOfStudents, int amountOfExams) { int[][] overallScore = new int[amountOfStudents][amountOfExams]; Scanner keyboardArray = new Scanner(System.in); int numberValue = 1; for (int index = 0; index &lt; amountOfStudents; index++) { System.out.println ("\n" + "Please submit Student #" + numberValue + " 's score :" ); for(int indexOfHomeWork=0; indexOfHomeWork &lt; amountOfExams; indexOfHomeWork++) { overallScore[index][indexOfHomeWork] = keyboardArray.nextInt(); } numberValue++; } DisplayvalueInArray(overallScore); keyboardArray.close(); } public static void DisplayvalueInArray(int[][] overallScoreArray) { System.out.println ("The students' scores are posted below : " + "\n"); int studentCount = 1; for (int index = 0; index &lt; overallScoreArray.length; index++) { System.out.print("Grades for student " + studentCount +": "); for (int indexOfHomeWork = 0; indexOfHomeWork &lt; overallScoreArray[index].length; indexOfHomeWork++) { System.out.print(overallScoreArray[index][indexOfHomeWork]+"\t"); } System.out.println(); studentCount++; } }
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/41403100
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41403925
has comment: http://stackoverflow.com/comment/41404089
has answer: http://stackoverflow.com/a/26373270
tagged with: java
has comment: http://stackoverflow.com/comment/41404005
has comment: http://stackoverflow.com/comment/41403945
has comment: http://stackoverflow.com/comment/41404070
type: Question
has title: How do you incorperate an AVERAGE and LETTERGRADE in a java program which has 2D Array
tagged with: oop

http://stackoverflow.com/comment/41448507
comment on: http://stackoverflow.com/a/26377405
score: 0
type: Comment
has text: If you have a existing project id first determine on which technologie it runs (basicially any framework will in some sort have to be "attached" via the deployment descriptor web.xml). Then pick a action (businesscase, flow, ...) where you expect a refresh of the content will happen (for example a link/button 'search' will mostly result in displaying search-results). Once something like the search-function has been identified id try to track the behaviour until you reach the entry point to "your" classes. Somewhere from there maintenance of the session state should be handlet in some sort.
type: AnswerComment

http://stackoverflow.com/comment/41488443
has text: Thanks a lot, I will report the issue and provide the link.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26406866

http://stackoverflow.com/comment/41373171
has text: That is array of json not single josn record
comment on: http://stackoverflow.com/q/26357157
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26393303
has body: The problem is raw (untyped) types. Raw types have all generic info stripped from them - hence no type match. The type of AbstractError is itself raw: Change: public abstract class AbstractError&lt;E extends AbstractError&gt; { To public abstract class AbstractError&lt;E extends AbstractError&lt;E&gt;&gt; { Next, ErrorCaptchaRequired extends the raw (untyped) form of AbstractError, so every instance of ErrorCaptchaRequired is then raw. Change: public class ErrorCaptchaRequired extends AbstractError { To: public class ErrorCaptchaRequired&lt;E extends AbstractError&lt;E&gt;&gt; extends AbstractError&lt;E&gt; { And change: public class MyObject&lt;E extends AbstractError&gt;{ To: public class MyObject&lt;E extends AbstractError&lt;E&gt;&gt;{
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/41439314
upvote count: 1
has comment: http://stackoverflow.com/comment/41439582
answers question: http://stackoverflow.com/q/26392671

http://stackoverflow.com/a/26419254
has body: The problem is here: for (int i = 1; i&lt;=10; i++, pos--) You always loop from 1 to 10 as if there were 10 characters. If the user inputs a String smaller than 10 characters, your "pos" will go beyond 0, and you will get a StringIndexOutOfBoundsException here: char tmp = custPnr.charAt(pos); Instead you should try: for (int i = 1; i&lt;=length; i++, pos--) To check the length of the input before you perform the check: String str = input.nextLine(); if(str.length() != 10){ System.out.println("Invalid input. Please try again"); return false; }else{ checkLogin(str); }
has comment: http://stackoverflow.com/comment/41485765
score: 0
has comment: http://stackoverflow.com/comment/41485299
answers question: http://stackoverflow.com/q/26418845
type: Answer

http://stackoverflow.com/q/26499120
accepted answer: http://stackoverflow.com/a/26501318
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
upvote count: 2
tagged with: swt
has title: How to prevent ScrolledComposite from endlessly expanding vertically
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26501318
tagged with: java
type: Question
answer count: 1
has body: I have a dialog box with the below code. The scroll bar appears, but does not scroll till the end. It is too long that the contents in the end do not come up. Even if the dialog is re-sized to be small, the contents towards the end cannot be seen. Please suggest how to get the scroll bar working right for the below scenario. public class SampleDialog extends TrayDialog { public SampleDialog(final Shell shell) { super(shell); this.shell = shell; } @Override public void create() { super.create(); } @Override protected Control createDialogArea(final Composite parent) { final GridLayout layout = new GridLayout(); layout.numColumns = 1; parent.setLayout(layout); final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER); sc1.setExpandHorizontal(true); sc1.setExpandVertical(true); //sc1.setMinWidth(0); final Composite composite = new Composite(sc1, SWT.NONE); final GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; composite.setLayout(gridLayout); sc1.setContent(composite); //this.sc1.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); //this.sc1.setMinHeight(50); //this.sc1.setAlwaysShowScrollBars(true); sc1.addControlListener(new ControlAdapter() { @Override public void controlResized(final ControlEvent e) { final Rectangle r = sc1.getClientArea(); sc1.setMinSize(parent.computeSize(r.width, SWT.DEFAULT)); } }); final GridData gridDataLabel = new GridData(); final Label label = new Label(composite, SWT.NONE); label.setText("Testing"); label.setLayoutData(gridDataLabel); for (i = 0 ; i &lt;= n ; i++) { // n can be 1 to any number -- decided at run time createSampleCombo(composite); } } public void createSampleCombo(Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 3; composite.setLayout(layout); final GridData gridDataCombo = new GridData(); gridDataCombo.horizontalAlignment = GridData.FILL; gridDataCombo.grabExcessHorizontalSp…

http://stackoverflow.com/q/26419188
has answer: http://stackoverflow.com/a/26419264
has title: Sort by string weight by java
has body: Write a java program to sort a string array in descending order based upon their weight. Weight of string can be calculated in the following way letter A has weight 1 and letter a has weight -1.Likewise letter Z has weight 26 and letter z has -26. so the weight of string Java will be -14.(J=10,a=-1,v=-22,a=-1) Hence sort the array in descending order based upon the weight. Sample Input: 3 Python Java HTML Sample Output: Java Python HTML Note if two strings have same weight then print the one which is entered first in the array
has comment: http://stackoverflow.com/comment/41485080
has comment: http://stackoverflow.com/comment/41485139
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/41484920
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26419478
downvote count: 6
tagged with: java
has comment: http://stackoverflow.com/comment/41484972
has comment: http://stackoverflow.com/comment/41485327
type: Question
answer count: 2
tagged with: algorithm
upvote count: 0

http://stackoverflow.com/comment/41390635
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26366621
has text: I faced the same problem once. I then used another Data Structure to copy the values from RS and use it afterwards. I don't know why that happens though.

http://stackoverflow.com/q/26482362
has title: How to retrieve SQL records dynamically in JSP using servlet in Struts
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41600994
possible better answer: http://stackoverflow.com/a/26482684
tagged with: servlets
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26482702
downvote count: 0
tagged with: jsp
has body: Currently i am retrieving sql records from jsp itself, for example when i want to view details of a specific person i will enter his id in a text box in jsp and record will be searched and displayed in the jsp itself. But what i want actually is, i want to search the record in servlet and display them through jsp. Moreover i am using struts framework for this application. Below code is the controller and i retrieved all records in controller and stored them in a Collection object. String driverName = "com.mysql.jdbc.Driver"; String connectionUrl = "jdbc:mysql://235.4.23.34:3306/"; String dbName = "abc"; String userId = "root"; String password = "ipser"; Connection con = null; Statement stmt = con.createStatement(); ResultSet rs; Class.forName(driverName); con = DriverManager.getConnection(connectionUrl+dbName, userId, password); String s=" select * from contacts"; rs=stmt.executeQuery(s); while(rs.next()){ List agentList = new ArrayList(); agentList.add(rs.getString("CUSTOMER_ID")); agentList.add(rs.getString("VENDOR")); agentList.add(rs.getString("sector")); agentList.add(rs.getString("AMOUNT")); agentList.add(rs.getString("total_AMOUNT")); agentList.add(rs.getString("STATUS")); agentList.add(rs.getString("delivery_STATUS")); } request.setAttribute("data", agentList); RequestDispatcher dispatcher = request.getRequestDispatcher("success.jsp"); if (dispatcher != null){ dispatcher.forward(request, response); } Then i passed the collection object to success.jsp and iterating the collection object using iterator as below success.jsp: CUSTOMER_ID VENDOR sector AMOUNT total_AMOUNT STATUS delivery_STATUS <% List mydata= (List)request.getAttribute("data"); Iterator itr = mydata.iterator(); while (itr.hasNext()) { Object element = itr.next();%> <%=element%> <%}%> The problem is for single record this works fine. but for more than one record all the records are displayed in one row itself. I want to display seven fields of a record in one row only.Can somebody provide me solu…
favorite count: 0
tagged with: struts2
has answer: http://stackoverflow.com/a/26482702
has answer: http://stackoverflow.com/a/26482684

http://stackoverflow.com/q/26500312
has comment: http://stackoverflow.com/comment/41632786
type: Question
has answer: http://stackoverflow.com/a/26500340
tagged with: int
score: 0
answer count: 1
tagged with: hex
has body: I'm trying to understand something about this method, setBackgroundColor(int) in android. I keep seeing people say that to use it with hex values, you should do 0xFF000000 + 0x[6 digit hex value that you want] But, and correct me if I'm wrong, isn't 0xFFFFFFFF, a legal input to the function, larger than the maximum size of an integer? Why am I allowed to put it in as input? Is it because of two's complement cutting the max size of integers in half?
has title: Android - setBackgroundColor int value too large?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/319199
tagged with: android
tagged with: java

http://stackoverflow.com/comment/41496578
score: 1
comment on: http://stackoverflow.com/a/26425764
type: Comment
has text: When you don't state a package, your class lives in the "default package", which is just another package (without a name). Leo's example would still behave the same if there were no package declarations anywhere.
type: AnswerComment

http://stackoverflow.com/q/26456801
score: -1
has body: 0 10 010 1010 01010 101010 0101010 This is my code but I always print a 1 in the (i%2 != 0) part that is not needed. This is not related to number systems just a pattern to print. public class Playground { public static void main(String[] args) { for (int i = 1; i &lt;= 7; i++) { for (int j = 1; j &lt;= i; j+=2) { if (i % 2 != 0) { System.out.print(0); System.out.print(1); } } for (int j = 1; j &lt;= i; j+=2) { if (i % 2 == 0) { System.out.print(1); System.out.print(0); } } System.out.println(); } } }
type: Question
accepted answer: http://stackoverflow.com/a/26456855
answer count: 1
favorite count: 0
has title: Why is this code to print the following zeros and ones pattern not working?
downvote count: 2
has answer: http://stackoverflow.com/a/26456855
upvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26375269
has answer: http://stackoverflow.com/a/26375654
accepted answer: http://stackoverflow.com/a/37253767
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/61024390
has answer: http://stackoverflow.com/a/37253767
type: Question
score: 3
linked to: http://stackoverflow.com/q/29162447
upvote count: 3
tagged with: hadoop
has title: Sqoop: ERROR manager.SqlManager: Error reading from database: java.sql.SQLException:
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/39575337
possible better answer: http://stackoverflow.com/a/26375654
tagged with: sqoop
favorite count: 0
has body: When I am trying to import data from mysql to HDFS using Sqoop and running the following command sqoop import --connect jdbc:mysql://IP Address/database name --username root --password password --table table name --m 1 I am getting the below error ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@555b6c34 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries. I am unable to understand what it is and browsed many websites for solutions but did not even got a clue. Please suggest.

http://stackoverflow.com/q/26483734
has comment: http://stackoverflow.com/comment/41606787
tagged with: informix
score: 0
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/41602667
has answer: http://stackoverflow.com/a/26483917
linked to: http://stackoverflow.com/q/1497569
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37186526
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41604877
has body: I am using Java (JDBC) to create a command line utility for SQL statement execution. A script is defined as a text file, having many queries. Each query is separated by a query separator (";"). The output is routed to stdout. SELECT * FROM table1; UPDATE table1 SET field1='' WHERE field2=''; SELECT * FROM table1; INSERT INTO table1 VALUES(...) SELECT * FROM table1; Since JDBC can execute statements batchwise, only if they don't return a ResultSet, I need another approach. As of now, I would read the script file with the queries, split them by the separator, and analyze each query, whether it's a "SELECT" query, or an "INSERT", "UPDATE", "DELETE" query. After that, I would execute each query in it's own statement. The ones that return something are written to stdout, the queries that manipulate the database are executed. And, of course I would keep the order of the queries from the file. My problem is: If one of the queries in the file is wrong, I can't rollback, because each query is executed separately. How could I handle this issue?
tagged with: mysql
has answer: http://stackoverflow.com/a/26484959
type: Question
has title: Execute multiple SQL statements (CRUD) with JDBC
tagged with: java

http://stackoverflow.com/a/26411068
has comment: http://stackoverflow.com/comment/41505079
has comment: http://stackoverflow.com/comment/41472596
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41471806
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26410639
score: 1
answers question: http://stackoverflow.com/q/26410639
has comment: http://stackoverflow.com/comment/41503565
has comment: http://stackoverflow.com/comment/41470603
has body: i think what you are looking for is a singleton, create a new static class with a getter to get executor service,and call it anywhere you like: public class MyExecutors { private static ExecutorService ex; public static synchronized ExecutorService getExecutor(){ if(ex == null){ ex = new ThreadPoolExecutor(0, 50, 60L, TimeUnit.SECONDS, new SynchronousQueue&lt;Runnable&gt;()); } return ex; } } now just use MyExecutors.getExecutor() in all your instances. this will ensure the same executor instance for each class

http://stackoverflow.com/a/26439394
answers question: http://stackoverflow.com/q/26437950
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/41625177
score: 2
has body: 'for many years, the partly line from the Java team was "Operator overloading is too complicated." This and many other decisions where someone clearly didn't do their homework is why I have a reputation for disdaining many of the choices made by Gosling and the Java team' - Bruce Eckel in The Positive Legacy of C++ and Java

http://stackoverflow.com/comment/41639095
type: QuestionComment
has text: @chrylis Hi, I think when my spring xml instantiates the `machineinpitimpl` class it running only the init method which is in the default constructor. How can I have a another constructor so that it instantiates the whole class?
type: Comment
comment on: http://stackoverflow.com/q/26501041
score: 0

http://stackoverflow.com/a/26501480
score: 0
has body: The problem is that you don't define your request's body content. In your client you should do : clientRequest.body("application/json", input); Where input is your newUser encoded in JSON. After this only you should call clientResponse = clientRequest.post(User.class);
answers question: http://stackoverflow.com/q/26501070
type: Answer

http://stackoverflow.com/comment/41656708
comment on: http://stackoverflow.com/q/26511703
score: 0
type: Comment
type: QuestionComment
has text: I think Triangle is 2D. Be sure to post your solution as an answer when you decide what to use. I know I'd be interested.

http://stackoverflow.com/a/32313339
downvote count: 0
answers question: http://stackoverflow.com/q/26360378
upvote count: 1
type: Answer
score: 1
has body: If you want to restrict the user to go back then try this small script. &lt;script&gt; history.forward(); &lt;/script&gt; Put this code into the &lt;head&gt; element of your page and try to go back. For more details click on following link... How to disable browser back button after logout in JSP?

http://stackoverflow.com/comment/41474505
has text: Is it mandatory to hold all elements in the same collection (perhaps due to post-processing when all threads are finished)? Because if no, you could even use different lists for every thread and combine the lists afterwards if desired.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26413245

http://stackoverflow.com/q/26418832
has answer: http://stackoverflow.com/a/26418945
accepted answer: http://stackoverflow.com/a/26418945
tagged with: java
duplicate of: http://stackoverflow.com/q/16871367
type: Question
linked to: http://stackoverflow.com/q/40025528
has body: I am trying to convert a String ("01-OCT-2014") into Date format. Below is my code for this. SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); Date d= formatter.parse("01-OCT-2014"); System.out.println("Converted date:"+d); The above code is working fine in Windows. But when I am running in Unix environment, it is throwing an exception Unparseable date Can any one help me out in solving this issue..
has title: How to convert String to date using Java in UNIX environment
tagged with: date
score: 0
linked to: http://stackoverflow.com/q/16871367
answer count: 1
tagged with: unix
has comment: http://stackoverflow.com/comment/41484393
has comment: http://stackoverflow.com/comment/120266443
tagged with: date-conversion
type: AnsweredQuestion

node.js
tags question: http://stackoverflow.com/q/26445771
tags question: http://stackoverflow.com/q/26357833
tags question: http://stackoverflow.com/q/26436803
type: Tag
tag name: node.js
tags question: http://stackoverflow.com/q/26388742

opensaml
tags question: http://stackoverflow.com/q/26459489
tag name: opensaml
tags question: http://stackoverflow.com/q/26421017
type: Tag
tags question: http://stackoverflow.com/q/26482902
tags question: http://stackoverflow.com/q/26445910

http://stackoverflow.com/q/26430090
tagged with: windows-7-x64
score: 0
tagged with: playframework
answer count: 1
linked to: http://stackoverflow.com/q/10894615
accepted answer: http://stackoverflow.com/a/26432766
has body: I'm preparing a deploy using Distcommand in Windows 7. (play 2.0.4) The zip is generated successful but when I'm trying to start the application with this command: java -Dhttp.port=9001 -cp "e:\deploy\test-1.0-SNAPSHOT\lib\*" play.core.server.NettyServer The console displays this error: Error: Could not find or load main class e:\deploy\test-1.0-SNAPSHOT\lib\ch.qos.logback.logback-core-logback-core-1.0.0.jar I've checked that this jar is generated by Play Framework in... c:\Play\play-2.0.4\repository\cache\ch.qos.logback\ If I execute start or run command, the compilation and execution are successful. Using stage command I receive other error: [error] {file:/C:/test/}test/*:stage: java.io.IOException: Cannot run program "chmod": CreateProcess error=2, The system cannot find the file specified I'm not sure but would be related with the original problem.
has answer: http://stackoverflow.com/a/26432766
tagged with: deployment
type: AnsweredQuestion
tagged with: playframework-2.0
has title: Deploying play framework could not find or load main class
type: Question
tagged with: java

http://stackoverflow.com/q/26457982
has answer: http://stackoverflow.com/a/26458193
type: Question
score: -2
has title: how to add user input to array java?
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41556030
tagged with: arrays
has answer: http://stackoverflow.com/a/26458022
answer count: 3
has body: So I have this project that requires me to generate a single dimensional array of user specified length and then have the user populate the array and I can't figure out what I'm supposed to do at the point where I'm at import java.util.*; public class singledimensionalarray { public static void main(String[] args) { // TODO Auto-generated method stub Scanner keyboard = new Scanner (System.in); System.out.println("Please input array length: "); String[] SDArray= new String[keyboard.nextInt()]; System.out.println("Please input " + SDArray.length + " double numbers:"); int n = 0; for (n = 0; n &lt;= SDArray.length; n++){ SDArray.add (keyboard.nextDouble()); //keep getting an error here } } }
has comment: http://stackoverflow.com/comment/41556219
favorite count: 0
has answer: http://stackoverflow.com/a/26458028
upvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26497148
has comment: http://stackoverflow.com/comment/41651607
score: 1
has comment: http://stackoverflow.com/comment/41627519
downvote count: 0
type: Answer
has body: The println() method of the ConsoleProgram class doesn't print the object to the standard output, it prints it to the IOConsole which is an java.awt.Container that has to be added to a Frame of JFrame. If you want to print those values to the console use System.out.println(...) instead. In answer to your second question. To return both an int and a String you can set that method's return type to Object[] but in this case you should create some Getters and Setters for the itunes class.
upvote count: 1
answers question: http://stackoverflow.com/q/26496892
has comment: http://stackoverflow.com/comment/41638126

http://stackoverflow.com/a/26471828
type: Answer
score: 25
accepted answer of: http://stackoverflow.com/q/26445483
answers question: http://stackoverflow.com/q/26445483
upvote count: 25
type: AcceptedAnswer
has body: I've used both of these. I've used Hibernate with GORM in Grails as well as in a traditional Spring app and I've used JDBI in Dropwizard. I have really enjoyed the simplicity of JDBI and here are a couple of reasons why I prefer it over Hibernate. I know exactly what SQL is going to be executed to acquire the data I'm requesting. With Hibernate, you can sometimes have to do a lot of messing around with HQL and configuring your objects to what you intended to have returned. You ultimately resort to SQL, but then have the difficultly of properly mapping your results back to your domain objects, or you give up and allow hibernate to fetch them one by one. I don't need to worry about lazy/eager fetching and how that is going to affect my query time on large data sets. Mappings aren't complicated because you manage them on your own and you don't have to rely on getting the right combinations of annotations and optimizations. For your case in particular, it sounds like you'd want something lightweight because you don't have a lot of use cases and that would definitely be JDBI over Hibernate in my opinion.
downvote count: 0

http://stackoverflow.com/comment/41394459
has text: if all numbers would be placed into the same bucket - each add operation will cost O(i), where 1 = 1..N. total complexity would be 1 + 2 + ... + N = N * (N + 1) / 2 = O(N^2)
comment on: http://stackoverflow.com/q/26368081
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26379091
type: Answer
has body: am comparing three arrays of Strings using the two classes below. Without using any hash maps or changing the structure of my code too much (I can't change the signature of findMatchingElements()), is there a way to minimize the number of comparisons that my method makes, in order to construct the new array of shared elements? Sure. Your nested loops have complexity of O(m*n). When you create a temporary HashMap, you can reduce it to O(m+n) and gain a lot for big inputs. From practical POV, somewhere around length of 10 it should get faster than your solution. I'm giving no code as it's too straightforward.
answers question: http://stackoverflow.com/q/26374896
score: 0

http://stackoverflow.com/q/26478671
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/41594164
has comment: http://stackoverflow.com/comment/41594053
has comment: http://stackoverflow.com/comment/41594318
linked to: http://stackoverflow.com/q/7229226
score: 0
has comment: http://stackoverflow.com/comment/41593933
tagged with: linux
has title: Java Swing Problems going from Mac to Linux - ArrayIndexOutOfBoundsException
tagged with: macos
has comment: http://stackoverflow.com/comment/41593955
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41594145
tagged with: swing
has comment: http://stackoverflow.com/comment/41594087
type: Question
has body: I've been working on building an MS paint like program for a class, but I've just realize that the TA marks in Linux and I've been building my program on a Mac. I didn't think it was going to be a big deal, but I thought I'd test it on a linux anyways, and I'm getting errors that won't let me even open the program. I'm getting "main" java.lang.ArrayIndexOutOfBoundsException: No such child: 0 thrown at frame.pack(); in my main method and all over the place in Container and JComponent, ect and Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: No such child: 0thrown at Container and JComponent and BorderLayouts. I have no idea where the problem is, so I've just put the whole program up on pasteBin. I really have no idea what I've done and I don't have any idea how to fix it. This works 100% fine on my Mac. I don't understand what the difference between the operating systems are. If anyone could please help I really need it. http://pastebin.com/KDKm7D9w
has comment: http://stackoverflow.com/comment/41594065
has comment: http://stackoverflow.com/comment/41594024
tagged with: java
has comment: http://stackoverflow.com/comment/41594000

http://stackoverflow.com/comment/41405934
type: AnswerComment
has text: Heheh, "advanced". This kind of stuff makes me yearn for Ruby: `list.max_by(&:area)` (or, for more flexibility, `list.max { |a, b| a.area <=> b.area }`).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26374883

http://stackoverflow.com/q/26505781
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41642484
has title: Android show menu item as action in Activity extends FragmentActivity
linked to: http://stackoverflow.com/q/17914017
has comment: http://stackoverflow.com/comment/41642358
score: 0
has body: If you want to show a menu item in action bar, the activity MUST extends ActionBarActivity according to this answer. I have an activity which extends FragmentActivity. Actually I have to extend FragmentActivity because I'm using Tabs in my Application. So my question is, how can I show a menu item as action bar and also use Tabs in my activity?! Thanks for any help.

http://stackoverflow.com/q/26473768
has comment: http://stackoverflow.com/comment/41585161
tagged with: java
has answer: http://stackoverflow.com/a/45777087
has answer: http://stackoverflow.com/a/26474047
has body: I am using the following code to check internet connectivity: try { HttpURLConnection httpConnection = (HttpURLConnection) (new URL("http://clients3.google.com/generate_204").openConnection()); httpConnection.setRequestProperty("User-Agent", "Test"); httpConnection.setRequestProperty("Connection", "close"); httpConnection.setConnectTimeout(15000); httpConnection.connect(); if (httpConnection.getResponseCode() == 204 &amp;&amp; httpConnection.getContentLength() == 0){ //internet is avialable return; }else{ Log.e(TAG, "Internet connection error: " + httpConnection.getResponseCode() + ": " + httpConnection.getResponseMessage()); } } catch (IOException e) { Log.e(TAG, "Internet connection error: " + e); } And i am getting the following response : code: 204 message: No Content but content length is greater than 0 and hence it fails. Could some one please help me understand what is going on? Thanks, Sunny
has title: Java: Internet connectivity check via ping to google not working
score: 0
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/41585253
linked to: http://stackoverflow.com/q/3905358
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41585197
has answer: http://stackoverflow.com/a/26474565
tagged with: http-status-code-204
tagged with: http
has comment: http://stackoverflow.com/comment/41585315
type: Question
has comment: http://stackoverflow.com/comment/41585371

http://stackoverflow.com/q/26502374
accepted answer: http://stackoverflow.com/a/26503488
type: Question
linked to: http://stackoverflow.com/q/11945563
tagged with: listview
linked to: http://stackoverflow.com/q/15844338
has comment: http://stackoverflow.com/comment/41636616
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/41637863
has answer: http://stackoverflow.com/a/26503488
has comment: http://stackoverflow.com/comment/41637077
has title: Wrong order in which items in the listview when scroll
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41636641
score: 0
tagged with: java
tagged with: scroll
has body: I have a layout as shown below: In listview there are several CustomViews. Items are displayed according to their indices. I use this code: @Override public int getItemViewType(int position) { return UL.separators.contains(position) ? 1 : 0; } This is getView func: @Override public View getView(int position, View convertView, ViewGroup parent) { NewsHolder holder = null; View row = convertView; holder = null; int type = getItemViewType(position); if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); holder = new NewsHolder(); switch (type) { case 1: row= inflater.inflate(R.layout.section_header, null); holder.itemName = (TextView)row.findViewById(R.id.header); holder.itemName.setText("CUSTOM TEXT"); row.setTag(holder); break; case 0: row= inflater.inflate(R.layout.custom_row, null); holder.itemName = (TextView)row.findViewById(R.id.example_itemname); holder.icon=(ImageView)row.findViewById(R.id.example_image); holder.button3=(Button)row.findViewById(R.id.swipe_button3); row.setTag(holder); ItemRow itemdata = data.get(position); holder.itemName.setText(itemdata.getItemName()); holder.icon.setImageDrawable(itemdata.getIcon()); break; } } else { holder = (NewsHolder)row.getTag(); } return row; But when I scrol listview, elements are arranged at random, as shown on screenshots below. Before scroll: After scroll:
tagged with: eclipse

http://stackoverflow.com/comment/41637565
score: 0
comment on: http://stackoverflow.com/q/26502917
type: Comment
type: QuestionComment
has text: The format of my wiki code above (beginning with !|Create Programs) is correct, it just was skewed when posted.

http://stackoverflow.com/comment/41409264
comment on: http://stackoverflow.com/q/26376439
score: 1
has text: Of course this should be linked to a country, but the same is true for other "locale" settings like the number or date format. While it seems to be no problem to use `SimpleDateFormat("...", new Locale("es")) (should I use ES or US date format?) the same thing fails for .getCurrency. So the question is: Are there other things that could fail as well?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41406735
has text: what is `matt` in your main
score: 0
comment on: http://stackoverflow.com/q/26375311
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41510521
score: 0
comment on: http://stackoverflow.com/q/26432883
type: Comment
type: QuestionComment
has text: How far along in class are you? Are you allowed to use java Collections (e.g. java.util.List) - are you allowed to use additional Classes?

antlr4
tags question: http://stackoverflow.com/q/26468348
type: Tag
tags question: http://stackoverflow.com/q/26473479
tag name: antlr4

http://stackoverflow.com/q/26437041
tagged with: http://stackoverflow.com/tag/r
has answer: http://stackoverflow.com/a/26442700
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26442700
favorite count: 0
has body: From an article I read that It is possible to find whether a word has attributes or not by using WordNet. For example the word size has attributes – big, small similarly the word quality has attributes: inferior, superior etc. Can anyone please tell me how to do it in java(java or R)? . Thanks in Advance.
linked to: http://stackoverflow.com/q/22403642
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41520333
tagged with: wordnet
type: Question
possible better answer: http://stackoverflow.com/a/26438158
has title: Getting attributes from wordnet
has answer: http://stackoverflow.com/a/26438158

http://stackoverflow.com/q/26363223
tagged with: swing
tagged with: jcombobox
type: AnsweredQuestion
has title: Cannot read data from file to JComboBox
tagged with: java
accepted answer: http://stackoverflow.com/a/26363440
has comment: http://stackoverflow.com/comment/41456677
type: Question
has body: I am trying to make a ui in which i read file from text file to JComboBoxes and display the results in JTextFields.Only the first combobox is getting updated from the file while the rest is not getting updated from the file. Here is my Code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.*; public class Main1 extends JPanel { public Main1() { JPanel buttonPanel = new JPanel(); add(buttonPanel); buttonPanel.setLayout(new GridLayout(0, 4, 5, 5)); JTextField field1 = new JTextField(5); field1.setEditable(false); buttonPanel.add(field1); JTextField field2 = new JTextField(5); field2.setEditable(false); buttonPanel.add(field2); JTextField field3 = new JTextField(5); field3.setEditable(false); buttonPanel.add(field3); JTextField field4 = new JTextField(5); field4.setEditable(false); buttonPanel.add(field4); JComboBox comboBox = new JComboBox(); comboBox.setEditable(true); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox comboBox = (JComboBox) event.getSource(); field1.setText((String) comboBox.getSelectedItem()); } }); JComboBox comboBox1 = new JComboBox(); comboBox1.addItem("1"); comboBox1.addItem("2"); comboBox1.addItem("4"); comboBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox comboBox1 = (JComboBox) event.getSource(); Object selected = comboBox1.getSelectedItem(); if(selected.toString().equals("1")) field2.setText("3"); else if(selected.toString().equals("2")) field2.setText("6"); else if(selected.toString().equals("4")) field2.setText("12"); } }); JComboBox comboBox2 = new JComboBox(); comboBox2.addItem("1"); comboBox2.addItem("2"); comboBox2.addItem("4"); comboBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JComboBox comboBox2 = (JComboBox) event.getSource(); Object selected = comboBox2.getSelectedItem(); if(selected.toString().equals("1")) field3.setT…
answer count: 2
score: 0
possible better answer: http://stackoverflow.com/a/26363584
has answer: http://stackoverflow.com/a/26363584
has answer: http://stackoverflow.com/a/26363440
has comment: http://stackoverflow.com/comment/41384498

http://stackoverflow.com/comment/41407278
type: Comment
score: 0
has text: I tried that and it didn't work. Its still spliting the day, month and year when it should only split at a comma
type: AnswerComment
comment on: http://stackoverflow.com/a/26373268

gridbaglayout
tags question: http://stackoverflow.com/q/26472233
tags question: http://stackoverflow.com/q/26482054
type: Tag
tags question: http://stackoverflow.com/q/26394429
tags question: http://stackoverflow.com/q/26411775
tag name: gridbaglayout
tags question: http://stackoverflow.com/q/26372338

http://stackoverflow.com/q/26480023
type: AnsweredQuestion
has body: I am Developing an project in which i want diffrent task for diffrent time like if user button up after 5 milisecond then a code execute and if pressing time is more then that then a diffrent actually em creating a chathead like in facebook chat problem is this on ActionDown Event i want to open or launch my app but problem is when user try to reallocate the chathead from one location to other the event fire like This is my code here in ACTION_DOWN event i want to intent to the app public class ChadHead extends Service { private final Handler mHandler = new Handler(); private Runnable mTimer1; private WindowManager windowManager; private ImageView chatHead; Display display; int width; int count=0; @Override public IBinder onBind(Intent intent) { // Not used return null; } @Override public void onCreate() { super.onCreate(); mTimer1 = new Runnable() { @Override public void run() { count++; // TODO Auto-generated method stub mHandler.postDelayed(this, 5000); if (count == 1) { mHandler.removeCallbacks(mTimer1); // put your code here: } } }; windowManager = (WindowManager) getSystemService(WINDOW_SERVICE); chatHead = new ImageView(this); chatHead.setImageResource(R.drawable.ic_launcher); final WindowManager.LayoutParams params = new WindowManager.LayoutParams( WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); params.gravity = Gravity.TOP | Gravity.LEFT; params.x = 0; params.y = 100; windowManager.addView(chatHead, params); chatHead.setOnTouchListener(new View.OnTouchListener() { private int initialX; private int initialY; private float initialTouchX; private float initialTouchY; @SuppressWarnings("deprecation") @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: initialX = params.x; initialY = params.y; initialTouchX = event.getRawX(); initialTouchY = event.get…
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26480419
tagged with: java
has answer: http://stackoverflow.com/a/26480290
score: 0
has answer: http://stackoverflow.com/a/26480163
has title: how to count button press time in android?
possible better answer: http://stackoverflow.com/a/26480290
favorite count: 0
accepted answer: http://stackoverflow.com/a/26480419
tagged with: timer
tagged with: android
has answer: http://stackoverflow.com/a/26480259
answer count: 4

http://stackoverflow.com/comment/41636026
score: 0
comment on: http://stackoverflow.com/q/26502067
type: QuestionComment
has text: Your code as given compiles and runs without an exception. I just ran it.
type: Comment

http://stackoverflow.com/q/26437071
has body: So this was going to be my question, but I actually figured out the problem while I was writing it. Perhaps this will be useful for others (I will remove the question if it's a duplicate or is deemed inappropriate for this site). I know of two possible solutions to my problem, but perhaps someone will come up with a better one than I thought of. I don't understand why TreeSet isn't removing the first element here. The size of the my TreeSet is supposed to stay bounded, but appears to grow without bound. Here is what I believe to be the relevant code: This code resides inside of a double for loop. NUM_GROUPs is a static final int which is set to 100. newGroups is a TreeSet&lt;TeamGroup&gt; object which is initialized (with no elements) before the double for loop (the variables group and team are from the two for-each loops). final TeamGroup newGroup = new TeamGroup(group, team); newGroups.add(newGroup); System.err.println("size of newGroups: " + newGroups.size()); if (newGroups.size() &gt; NUM_GROUPS) { System.err.println("removing first from newGroups"); newGroups.remove(newGroups.first()); System.err.println("new size of newGroups: " + newGroups.size()); } I included my debugging statements to show that the problem really does appear to happen. I get the following types of output: size of newGroups: 44011 removing first from newGroups new size of newGroups: 44011 You see that although the if statement is clearly being entered, the size of the TreeSet&lt;TeamGroup&gt; teamGroups isn't being decremented. It would seem to me that the only way for this to happen is if the remove call doesn't remove anything--but how can it not remove something from a call to first() which should definitely be an element in the TreeSet? Here is the compareTo method in my TeamGroup class (score is an int which could very reasonably be the same for many different TeamGroup objects hence why I use the R_ID field as a tie-breaker): public int compareTo(TeamGroup o) { // sorts low to high so…
has comment: http://stackoverflow.com/comment/41518979
accepted answer: http://stackoverflow.com/a/26437327
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41519054
type: Question
has comment: http://stackoverflow.com/comment/41519091
has answer: http://stackoverflow.com/a/26437327
answer count: 1
has comment: http://stackoverflow.com/comment/41519029
tagged with: twos-complement
has title: Debugging Challenge in regards to TreeSet
score: 0
tagged with: java

http://stackoverflow.com/a/26754986
upvote count: 10
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26437253
type: Answer
has body: Try to delete android:, like this: &lt;style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"&gt;
downvote count: 0
score: 10
answers question: http://stackoverflow.com/q/26437253
has comment: http://stackoverflow.com/comment/62796892

http://stackoverflow.com/q/26489168
tagged with: java
has answer: http://stackoverflow.com/a/26495644
score: 0
answer count: 1
has body: I am trying to sent a screenshot from desktop to android, and display on android. As I know returned null maybe cause I did not inputStream.read() read all of inputstream, therefore I made a while loop to read all of them then to display. The desktop also sent the size of byte array, in order to let android set the size of byte array, here is the code: public class connection extends AsyncTask { private byte[] data; public void setByteSize(int size) { data = new byte[size]; } public byte[] getByteSize() { return data; } @Override protected Object doInBackground(Object... arg0) { try { clientSocket = new Socket("134.129.125.126", 8080); System.out.println("client connect to server"); input = clientSocket.getInputStream(); System.out.println("getinputstream"); } catch (UnknownHostException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (true) { int totalBytesRead = 0; int chunkSize = 0; int tempRead = 0; String msg = null; // byte[] data = null; byte[] tempByte = new byte[1024 * 1024 * 4]; try { // read from the inputstream tempRead = input.read(tempByte); // tempbyte has x+4 byte System.out.println("Fist time read:" + tempRead); // convert x+4 byte into String String message = new String(tempByte, 0, tempRead); msg = message.substring(0, 4); // cut the header into imageMsg String imageMsg = new String(tempByte, 4, tempRead - 4); // convert string into byte System.out.println("message head:" + msg); byteSize = Integer.parseInt(msg); System.out.println("ByteSize:" + byteSize); data = imageMsg.getBytes(); setByteSize(byteSize); totalBytesRead = tempRead - 4; System.out.println("total Byte Read=" + totalBytesRead); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // get string for the size of image try { int tmp = 0; while (chunkSize &gt; -1) { System.out.println("data length:" + getByteSize().length); chunkSize = input.read(get…
type: UnansweredQuestion
tagged with: sockets
tagged with: android
has title: Still SkImageDecoder::Factory returned null after read all of inputstream
tagged with: image-processing
type: Question
tagged with: network-programming

http://stackoverflow.com/q/26466116
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26466390
has body: I am passing a file as input stream to parser.parse() method while using apache tika library to convert file to text.The method throws an exception (displayed below) but the input stream is closed in the finally block successfully. Then while renaming the file, the File.renameTo method from java.io returns false. I am not able to rename/move the file despite successfully closing the inputStream. I am afraid another instance of file is created, while parser.parse() method processess the file, which doesn't get closed till the time exception is throw. Is that possible? If so what should I do to rename the file. The Exception thrown while checking the content type is java.lang.NoClassDefFoundError: Could not initialize class com.adobe.xmp.impl.XMPMetaParser at com.adobe.xmp.XMPMetaFactory.parseFromBuffer(XMPMetaFactory.java:160) at com.adobe.xmp.XMPMetaFactory.parseFromBuffer(XMPMetaFactory.java:144) at com.drew.metadata.xmp.XmpReader.extract(XmpReader.java:106) at com.drew.imaging.jpeg.JpegMetadataReader.extractMetadataFromJpegSegmentReader(JpegMetadataReader.java:112) at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(JpegMetadataReader.java:71) at org.apache.tika.parser.image.ImageMetadataExtractor.parseJpeg(ImageMetadataExtractor.java:91) at org.apache.tika.parser.jpeg.JpegParser.parse(JpegParser.java:56) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:244) at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:244) at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:121) Please suggest any solution. Thanks in advance. public static void main(String args[]) { InputStream is = null; StringWriter writer = new StringWriter(); Metadata metadata = new Metadata(); Parser parser = new AutoDetectParser(); File file = null; File destination = null; try { file = new File("E:\\New folder\\testFile.pdf"); boolean a = file.exists(); destination = new File("E:\\New folder\\test\\testOutput.pdf"); is = new FileInputStrea…
score: 0
tagged with: java
type: Question
tagged with: apache-tika
tagged with: file-rename
tagged with: java-io
has comment: http://stackoverflow.com/comment/41603985
has comment: http://stackoverflow.com/comment/41570176
has title: Unable to move a file using java while using apache tika
answer count: 1
has comment: http://stackoverflow.com/comment/41570566
tagged with: file-moving
has answer: http://stackoverflow.com/a/26466390
has comment: http://stackoverflow.com/comment/41789291

http://stackoverflow.com/comment/41472911
comment on: http://stackoverflow.com/q/26412385
score: 3
has text: Isn't That what "programming to interface" is all about?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26363078
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/67037875
has comment: http://stackoverflow.com/comment/41384150
has answer: http://stackoverflow.com/a/65213370
tagged with: java
has answer: http://stackoverflow.com/a/26365781
type: Question
has body: My task is to write a java program that first asks the user how many numbers will be inputted, then outputs how many odd and even numbers that were entered. It is restricted to ints 0-100. My question is: What am I missing in my code? import java.util.Scanner; public class Clancy_Lab_06_03 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n; System.out.println("How many numbers will be entered?"); n = input.nextInt(); while (n &lt; 0 || n &gt; 100) { System.out.println("ERROR! Valid range 0-100. RE-Enter:"); n = input.nextInt(); n++; } int odd = 0; int even = 0; while (n &gt;= 0 || n &lt;= 100) { n = input.nextInt(); if (n % 2 == 0) { even++; } else { odd++; } } System.out.println(even + "even" + odd + "odd"); } }
has answer: http://stackoverflow.com/a/26363322
has comment: http://stackoverflow.com/comment/41384067
has comment: http://stackoverflow.com/comment/41384981
has comment: http://stackoverflow.com/comment/41384037
score: 0
has comment: http://stackoverflow.com/comment/41384141
has answer: http://stackoverflow.com/a/26363673
has title: java program outputting even/odd numbers
has comment: http://stackoverflow.com/comment/41384018

http://stackoverflow.com/a/62747862
has body: Attention, I have a puzzling problem like this. I have a java project created by Eclipse, and now I open it with IdeaJ, the problem is If you just open the project directory and DID NOT IMPORT it as a new project, there is NO RUN OPTION on each file right click menu. Only if you create new project from existing directory, that you can run a single java file in IdeaJ, or you will not do what you want. I hope this tip will help you, 'cause it bothers me a lot.
answers question: http://stackoverflow.com/q/26467569
type: Answer
downvote count: 1
score: 0
upvote count: 1

http://stackoverflow.com/comment/41485957
comment on: http://stackoverflow.com/q/26418798
score: 0
type: Comment
type: QuestionComment
has text: @Antoniossss the thing is, the memory model doesn't specify the behaviour in the event that `testValue` is not volatile; sure, there _may_ be JVM implementations which will reread each time but it is not required. The semantics of `volatile`, however, are enforced: a write to a `volatile` variable always "happens before" any read of that variable. Which means that eventually the reading thread _will_ see the result of the incrementation. Any JVM must obey this.

http://stackoverflow.com/q/26446391
has title: JAVA cast to Object to ArrayList doesn't work
has comment: http://stackoverflow.com/comment/41535415
has comment: http://stackoverflow.com/comment/41535400
upvote count: 1
has answer: http://stackoverflow.com/a/26446435
downvote count: 1
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26446453
accepted answer: http://stackoverflow.com/a/26446435
has answer: http://stackoverflow.com/a/26446453
type: Question
answer count: 2
favorite count: 0
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/41535319
has body: About problem Eventually when i try cast Object to ArrayList i've problem when i use method from ArrayList like .size(), .get(): That the error returned to me: error: cannot find symbol Source public String parseValueParam(Object value) throws InvalidAttribute{ if(value instanceof ArrayList){ value = (ArrayList) value; String result = ""; for(int i = 0, _len = value.size(); i < _len; i ++){ result += this.parseValueParam(value.get(i)); if (i < _len - 1) result += " , "; }; return result; } else if(helper.isString(value)){ return value.toString().replaceAll("'", ""); } else if (helper.isInteger(value) || helper.isDouble(value)){ return value.toString(); } else { throw new InvalidAttribute("Invalid attribute type"); } } I've tried to declare couple of methods with same name one using Object to accept String, Int and Double and another only accept ArrayList. However when i run my code execute only the use Object. public String parseValueParam(ArrayList value) throws InvalidAttribute{ String result = ""; for(int i = 0, _len = value.size(); i < _len; i ++){ result += this.parseValueParam(value.get(i)); if (i < _len - 1) result += " , "; }; return result; }

http://stackoverflow.com/comment/41662186
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26513571
has text: Thank you so much for your response! I'm still having an issue though, I can't access the site after changing the port to 80...any ideas?

http://stackoverflow.com/comment/41646820
comment on: http://stackoverflow.com/a/26508009
score: 0
type: AnswerComment
type: Comment
has text: Please,give me some suggestion.How can I implement this.

http://stackoverflow.com/a/35886544
answers question: http://stackoverflow.com/q/26477692
has body: I had the problem with one particular run configuration (unittests for one project in my case). In Run Configurations, I selected the troubled run configuration, then the JRE tab, and I could see it was broken (even though I couldn’t tell how it had happened). Selecting the right JRE solved my problem (project JRE in my case, even though this was just my standard JRE and not configured for the project specifically).
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/41486913
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26418367
type: AnswerComment
has text: I don't see a point in downvoting this answer, but it did not really mimic the code the OP presented. This solution achieves a quite different goal than what the OP stated (neither of which makes any sense to me). The OP's question seemed to want to append the `ArrayList` at `hm.get(1)` with `"hello"` strings--which this solution does not do.

currency
tag name: currency
tags question: http://stackoverflow.com/q/26447059
type: Tag
tags question: http://stackoverflow.com/q/26457601

http://stackoverflow.com/a/26479342
has comment: http://stackoverflow.com/comment/41629373
type: Answer
has body: You could use an enum like, enum SelectionType { ONE, ALL, NONE; }
answers question: http://stackoverflow.com/q/26479322
upvote count: 1
has comment: http://stackoverflow.com/comment/41596642
score: 1
has comment: http://stackoverflow.com/comment/41595380
downvote count: 0

http://stackoverflow.com/q/26355786
has comment: http://stackoverflow.com/comment/41370447
favorite count: 0
possible better answer: http://stackoverflow.com/a/26356490
has answer: http://stackoverflow.com/a/26355821
answer count: 5
upvote count: 1
has title: How to use an enum for an array subscript in Java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26355902
tagged with: enums
score: 1
tagged with: java
has body: How do you use an enum for an array subscript? enum {VALUE_ONE, ... , SIZE}; int[] x = new int[SIZE];
accepted answer: http://stackoverflow.com/a/26355838
type: Question
has answer: http://stackoverflow.com/a/26356490
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26355838
has answer: http://stackoverflow.com/a/26355871
has comment: http://stackoverflow.com/comment/41370417

http://stackoverflow.com/q/26368831
has title: Testng @Factory method fails when tied with a DataProvider
accepted answer: http://stackoverflow.com/a/26370975
tagged with: testng
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26370975
type: Question
has body: I have a testng DataProvider and Factory annotated class that dynamically executes a test class based on various data provided by the data provider. Here's the classes: DataProvider ================== @DataProvider (name="GenericDataProvider", parallel=true) public static Object[][] genericDP(Method method, ITestContext context) throws Exception{ Map<String,String> arguments = DataProviderUtils.resolveDataProviderArguments(method); List<Map<String,String>> valList = null; if (arguments.containsKey("propFile")) { String file = arguments.get("propFile"); InputStream stream = BaseDataProvider.class.getClassLoader().getResourceAsStream(file); TestUtilities testUtil = new TestUtilities(); valList = testUtil.parseXML(testUtil.getStringFromInputStream(stream), "dataset"); } return new Object[][] { { valList } }; } The Factory class ===================== @Factory @Test(dataProviderClass=BaseDataProvider.class, dataProvider="GenericDataProvider") @DataProviderArguments({"propFile=psgITest.xml"} ) public void runMultipleAccountProvisioningTestsWithDifferentUniversityPartners(List<Map<String,String>> datasets) { String partner = null; String source = null; for (Map<String,String> dataset : datasets) { for (String data : dataset.keySet()) { if ("partner".equalsIgnoreCase(data)) { partner = dataset.get(data); } else if ("source".equalsIgnoreCase(data)) { source = dataset.get(data); } if (null != partner && null != source) { new com.example.psgITestAccountProvisioning001(partner, source); new com.example.psgITestAccountProvisioning002(partner, source); } } } } psgITest.xml is a properties file in the format below <?xml version="1.0" encoding="UTF-8"?> abc xyz Exception ================ org.testng.TestNGException: The factory method class com.example.psgITestAccountProvisioning.runMultipleAccountProvisioningTestsWithDifferentUniversityPartners() threw an exception at org.testng.internal.FactoryMethod.invoke(FactoryMethod.java:93) at org.testng.internal.TestNGClassFinder.(TestNGCla…
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/41435752
type: Comment
has text: @GeorgeK if you have strings in one line you could replace `\b` by anchors having `^(\\w+(?:_DBF|_REP|_TABLE|_TBL))$`. On the other hand, you could do what you said, it is skipping the lines starting with --. If my answer solved your question bear in mind to mark the question as solved :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26385397

http://stackoverflow.com/comment/41780311
comment on: http://stackoverflow.com/a/26532971
type: Comment
has text: yes . i needs to run from a remote server instead of a machine where Outlook is installed.thanks a lot if you can help me
score: 0
type: AnswerComment

http://stackoverflow.com/q/26443831
has comment: http://stackoverflow.com/comment/41530452
linked to: http://stackoverflow.com/q/25094229
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/41531721
type: Question
has comment: http://stackoverflow.com/comment/41532312
linked to: http://stackoverflow.com/q/23907118
linked to: http://stackoverflow.com/q/2674174
has title: Java multithreading, main thread has stopped why?
score: 0
has answer: http://stackoverflow.com/a/26443862
answer count: 1
linked to: http://stackoverflow.com/q/25586271
has body: I am trying to create a separate thread for LWJGL's Display.update(), but the main thread is sleeping or is stopped while my second thread is running, how can I make both threads execute simultaneously? public Window(int width, int height, String title){ } @Override public void run() { try { Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); } while(!Display.isCloseRequested()){ Display.update(); Main.Render(); } Display.destroy(); } } public static void main(String[] args) { //To be moved Window window = new Window(100, 100, "1"); Thread windowThread = new Thread(window); windowThread.run(); System.out.print("I am workign, please show me!"); } public static void Render(){ System.out.println("Hello There!"); }
linked to: http://stackoverflow.com/q/262816
linked to: http://stackoverflow.com/q/4830302
type: UnansweredQuestion
tagged with: multithreading
duplicate of: http://stackoverflow.com/q/262816
linked to: http://stackoverflow.com/q/15841301
has comment: http://stackoverflow.com/comment/41532273

http://stackoverflow.com/comment/41486861
score: 0
has text: I want pass a number also to Message, WhatsApp apps. It seems it in not possible on above code
type: AnswerComment
comment on: http://stackoverflow.com/a/26420347
type: Comment

http://stackoverflow.com/comment/130491648
score: 1
type: AnswerComment
type: Comment
has text: @PetrJaneček I'm sorry, but I don't have those notes any more. I faintly remember that polish character being the only issue
comment on: http://stackoverflow.com/a/26420752

http://stackoverflow.com/comment/41563497
score: 0
type: Comment
type: QuestionComment
has text: @RuchiraGayanRanaweera I believe maybe you are wrong because I have an idea, but it seems to be inefficient. So I questioned the possibility of some method already exists
comment on: http://stackoverflow.com/q/26462303

http://stackoverflow.com/a/26369586
has comment: http://stackoverflow.com/comment/41396441
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41396482
type: Answer
has body: Basically two common solutions: 1- Using break: while ((line = user.readLine()) != null) { if (line.toLowerCase().contains(nume.toLowerCase())) { System.out.println("Ce mai faci " + nume + "?"); ceva = scanIn.nextLine(); break; // exists the closest loop } } 2- Using a boolean flag: boolean stop = false; while (!stop &amp;&amp; (line = user.readLine()) != null) { if (line.toLowerCase().contains(nume.toLowerCase())) { System.out.println("Ce mai faci " + nume + "?"); ceva = scanIn.nextLine(); stop = true; } }
has comment: http://stackoverflow.com/comment/41397043
accepted answer of: http://stackoverflow.com/q/26369522
score: 2
answers question: http://stackoverflow.com/q/26369522

http://stackoverflow.com/a/59832311
has comment: http://stackoverflow.com/comment/105802280
answers question: http://stackoverflow.com/q/26433929
score: 0
has body: ("%-11s%03d%n")% : used as a formatter. -: minus sign used for left indentation of the string. 11s: here 11 denotes the string's minimum field width 11. 0: pads the extra 0s in the integer. 3d: here 3 denotes integer's minimum field width 3. %n: prints the new line. Hope, this helps!
type: Answer

http://stackoverflow.com/comment/41618188
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26491933
has text: thank you it worked when i declared public float[] toSortedArray(float[][] a, int m, int n) but in main function toSortedArray() is empty and it gives another error because ublic float[] toSortedArray(float[][] a, int m, int n) and toSortedArray() are not same. Also i cant change main function. are there any other way to correct this ?
type: AnswerComment

http://stackoverflow.com/q/26465087
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56917246
upvote count: 1
tagged with: tesseract
tagged with: java
has title: How to turn off the dictionary in tess4j?
downvote count: 1
type: Question
tagged with: tess4j
has answer: http://stackoverflow.com/a/26476678
score: 0
answer count: 1
tagged with: ocr
favorite count: 0
has body: The accuracy of character recognition in my tess4j OCR application is very low. I have heard that turning off the dictionary in tess4j will increase the accuracy by letting individual characters to be recognized. But i don't know how to do it. Anyone know how to turn off the dictionary in tess4j?

http://stackoverflow.com/comment/41570808
type: AnswerComment
comment on: http://stackoverflow.com/a/26465936
score: 0
type: Comment
has text: Are you using a Debug build for your add.dll ? If so, it's bad, very bad. Try using a Release build of your dll.

http://stackoverflow.com/a/26498724
downvote count: 0
has body: Put the + outside the character class so that it would match one or more digits. [0-9+] would match only a single character from the given list (digit from the range 0-9 or +) Pattern ptn = Pattern.compile("Section [0-9]+:"); While you running this "Section [0-9+]:" regex, it returns false because there isn't a string Section followed by a single digit or a literal + again followed by a : in your original string (Note: Your original string contains two digits followed by a colon, Section 12: sadfdggfgfgf). But "Section [0-9+]" returns true because there is a string Section followed by a single digit.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26498712
score: 3

http://stackoverflow.com/q/26460768
type: Question
tagged with: java
score: -1
has body: I have a couple of things that I would like some clarification about: Object serialization is pretty handy when storing otherwise hard-to-store data. You use a class with a SerialVersionUUID and then you can read &amp; write it around. What if: I add a new variable in the serializable class so that the old serializable objects don't have this variable? Will it still load and leave the variable uninitialized or will it throw an Exception, making the serialized objects unusable? What if I change the SerialVersionUUID? The "outdated" serialized objects will no longer load? Is there a way to convert them easily or would there be a custom system in place to do that? What if I change a variable type that exists already? There might be a casting exception? Are there any alternatives to saving big serializable classes in a way that the data will not become corrupt if the "model" (being the serializable class) is altered? Thanks in advance for answering this. I apologize if the questions are bad. They just came to my mind and I would like to know more about it. After looking around for posting etiquette asking multiple questions in one post is not forbidden nor frowned upon. The only risk is getting incorrect answers.
accepted answer: http://stackoverflow.com/a/26461953
answer count: 1
favorite count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/26461953
downvote count: 1
has title: Java Object Serialization... is it redundant and robust?
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/26382433
type: Question
has title: Collision detection between two Rect in android
tagged with: collision-detection
score: 0
tagged with: accelerometer
answer count: 1
tagged with: android
tagged with: rect
has body: i have draw two rectangles over a canvas using canvas.drawRect(top,left,right,bottom) note that one of the rectangles is static and the other is moving using the android accelerometer. now i want to detect the collision between those two rectangles i tried lots of ways but they are not perfect the two rectangles overlaps sometimes so what is the perfect way to detect the collision between them. that's what i tried hero is the moving triangle maze Component is the static rectangle if ((hero.top &gt;= mazeComponent.top) &amp;&amp; (hero.top &lt;= mazeComponent.bottom) &amp;&amp; (hero.left &lt;= mazeComponent.right)) { collision = true; } if ((hero.bottom &gt;= mazeComponent.top) &amp;&amp; (hero.bottom &lt;= mazeComponent.bottom) &amp;&amp; (hero.right &gt;= mazeComponent.left)) { collision = true; } if ((hero.left &gt;= mazeComponent.left) &amp;&amp; (hero.left &lt;= mazeComponent.right) &amp;&amp; (hero.top &lt;= mazeComponent.bottom)) { collision = true; } if ((hero.top &gt;= mazeComponent.top) &amp;&amp; (hero.top &lt;= mazeComponent.bottom) &amp;&amp; (hero.left &gt;= mazeComponent.left)) { collision = true; } if ((hero.left &gt;= mazeComponent.left) &amp;&amp; (hero.left &lt;= mazeComponent.right) &amp;&amp; (hero.top &gt;= mazeComponent.top)) { collision = true; }
has answer: http://stackoverflow.com/a/26382928
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/26365033
has body: The command should work. If it doesn't, then that means you made a mistake in the setup of Maven or it printed more errors before that, namely that it could download plugins from Maven Central. Delete the folder %HOME%/.m2/repository/ and try again. Now look closely for any problems in the output of Maven. If it still doesn't work, show us the content of %HOME%/.m2/repository/org/apache/maven/plugins/maven-help-plugin/
has comment: http://stackoverflow.com/comment/41388118
has comment: http://stackoverflow.com/comment/41389372
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26364608
score: 0
has comment: http://stackoverflow.com/comment/41563377
type: Answer

http://stackoverflow.com/q/26399500
has title: Difference between HttpServletRequest.getSession(false) and HttpSession
has body: I am working in an Spring MVC project, where to get values from session we have used.. session = request.getSession(false); Object obj = (Object) session.getAttribute("sessionVeriable"); Where as request is HttpServletRequest class object passed from controller. My point is why HttpServletRequest object is passed why not HttpSession directly. Is there any difference getting session object from HttpServletRequest and directly from HttpSession?
has comment: http://stackoverflow.com/comment/41449853
answer count: 1
favorite count: 0
upvote count: 2
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26400194
downvote count: 0
linked to: http://stackoverflow.com/q/25873446
tagged with: session-variables
accepted answer: http://stackoverflow.com/a/26400194

http://stackoverflow.com/a/26448032
type: Answer
answers question: http://stackoverflow.com/q/26404223
downvote count: 0
score: 1
has body: If you don't want to use spring-security for some reason and want to have your custom implementation to allow access only is session exists, then you could also write a RequestFilter that implements javax.servlet.Filter, and check if the request has a valid session then allow it to go through else show an error page. Here's an example. public class RequestAuthenticationFilter implements Filter { private static final Logger LOG = Logger.getLogger(RequestAuthenticationFilter.class); protected static final List<String> ALLOWED_URL_LIST = Arrays.asList("/login.htm", "/400.htm", "/403.htm", "/404.htm", "/405.htm", "/500.htm", "/503.htm"); @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest req, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpSession session = request.getSession(false); String url = (request.getRequestURI()); if(ALLOWED_URL_LIST.contains(url) || url.endsWith(".css") || url.endsWith(".js") || url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg") || url.endsWith(".ttf") || url.endsWith(".woff") || url.endsWith(".csv")) { filterChain.doFilter(request, response); } else if((null == session) || session.getAttribute("user") == null || StringUtils.isEmpty(((User) session.getAttribute("user")).getUsername().trim())) { ((HttpServletResponse) response).sendRedirect("/login.htm"); } else { filterChain.doFilter(request, response); } } @Override public void destroy() { } } In this example the additional check is that if the request is for any image,js,css file then we skip the session check. Once you have added the filter implementation, you will have to next make sure that all the requests that you want to validate with session go through this Filter. For that you will have to create a bean for this filter and then reference that bean in your web.xml Here's what you will have t…
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26404223

http://stackoverflow.com/a/26432362
has comment: http://stackoverflow.com/comment/41510373
has body: I will now answer this specific question for the interest of the new users. If you see the reported error: Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in. It means, well, that you have to include the "-Xannotate" switch to enable this plugin. Please refer to the documentation on the front page of the jaxb2-annotate-plugin: org.jvnet.jaxb2.maven2 maven-jaxb2-plugin true -Xannotate org.jvnet.jaxb2_commons jaxb2-basics-annotate org.jvnet.jaxb2_commons jaxb2-annotate-plugin-test-annox-annotations See the -Xannotate switch? This is it. jaxb2-annotate-plugin can be used with maven-hyperjaxb3-plugin the same way. Here is a an example from Hyperjaxb tests: org.jvnet.hyperjaxb3 maven-hyperjaxb3-plugin -Xannotate org.hibernate hibernate-search 3.0.0.GA org.hibernate hibernate-annotations 3.5.6-Final (You don't need to include jaxb2-annotate-plugin as it is already included by maven-hyperjaxb3-plugin automatically.)
answers question: http://stackoverflow.com/q/26430199
downvote count: 0
has comment: http://stackoverflow.com/comment/41509923
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/a/26364724
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26363585
type: Answer
has comment: http://stackoverflow.com/comment/41387111
upvote count: 1
has comment: http://stackoverflow.com/comment/41387288
answers question: http://stackoverflow.com/q/26363585
score: 1
has body: Added: see my comment, I think the check in Crawler // While URL's left to visit while((data.url_to_visit_size() &gt; 0) &amp;&amp; counter&lt;INDEX_LIMIT) { is wrong. The 2nd Thread will stop immediately since the 1st Thread polled the only URL. You can ignore the remaining, but left for history ... My general approach to such types of "big blocks that can run in parallel" is: Make each crawler a Callable. Probably Callable&lt;List&lt;String&gt;&gt; Submit them to an ExecutorService When they complete, take the results one at a time and add them to a List. Using this strategy there is no need to use any concurrent lists at all. The disadvantage is that you don't get much live feedback as they are runnìng. And, if what they return is huge, you may need to worry about memory. Would this suit your needs? You would have to worry about the addVisitedURL so you still need that as a concurrent data structure. Added: Since you are starting with a single URL this strategy doesn't apply. You could apply it after the visit to the first URL.

http://stackoverflow.com/q/26443482
tagged with: comparable
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/26443508
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26443508
tagged with: merge
type: AnsweredQuestion
has title: Is it possible to have a method that takes a generic Comparable?
score: 1
tagged with: java
upvote count: 1
has body: I'm implementing a merge sort algorithm in Java for school. It should be able to take any object that is comparable. I created a static mergeSort(ArrayList input) method but apparently I cannot cast ArrayList or ArrayList into ArrayList even though they both implement comparable. How can I represent an ArrayList of Comparable data ?
type: Question
tagged with: sorting

http://stackoverflow.com/q/26429530
has body: I have been searching online for solutions to this problem for hours, but cannot find one. I am a beginner with java so I don't understand many of the errors and this is why I wasn't able to correct this myself. Anyway, I am trying to assign a value to variable and then add the int value from the variable to another. When compiling I am getting errors: "this is not a statement" and an error that I missing a semicolon which I suspect will be cleared up if I fix the statement. Here is the error, just in case you need it: hw8_ex2_jm2rv.java:61: error: ';' expected int sumOfGames += value; ^ hw8_ex2_jm2rv.java:61: error: not a statement int sumOfGames += value; ^ 2 errors This is my code: public static int oneGame() { int trueValue = 1; int falseValue = 0; int total = sumTwoDice(); if((total == 7) || (total == 11)) { //System.out.println(trueValue + " " + total); return(trueValue); } else if((total == 2) || (total == 3) || (total == 12)) { //System.out.println(falseValue + " " + total); return(falseValue); } else { int total2 = 0; while((total2 != 7) || (total2 != total)) { total2 = sumTwoDice(); if(total2 == total) { //System.out.println(trueValue + " " + total + " " + total2); return(trueValue); } else if(total2 == 7) { //System.out.println(falseValue + " " + total + " " + total2); return(falseValue); } } } } You are probably wondering about the sumTwoDice method, all it does is return a number between 2 and 12 and I already know that it is working.If you want to see it I can post it too, just ask. The oneGame function just simulates a game of craps and returns an integer value 1 or 0. With 1 being a win and 0 being a loss. //this method runs a simulation of n values and returns the avg. public static double monteCarloSim() { int trueValue = 1; int falseValue = 0; int sumOfGames = 0; int n = 2; for (int i = 0; i &lt;= n; i++) { int value = oneGame(); int sumOfGames += value; } double avg = sumOfGames / n; return(avg); } I just have a small n at the moment so that it i…
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26429589
tagged with: java
has title: Problems assigning variable to the return of a function
has comment: http://stackoverflow.com/comment/41504125
has answer: http://stackoverflow.com/a/26429585
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26429592

http://stackoverflow.com/a/26443355
has comment: http://stackoverflow.com/comment/41608567
accepted answer of: http://stackoverflow.com/q/26441826
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26441826
has body: In your main class you have to create two objects : roomba and furniture roomba r = new roomba(1f,1f,1f); furniture furn = new furniture("chair",2f,2f,2f,2f); boolean retValBool = r.inCollision(1.5f,1.5f,furn); // System.out.println(" inCollision method returns : " + retValBool); In java you can handle for printing all primitive data types the same way. That means you can print integers, doubles , booleans etc with the same way :)
has comment: http://stackoverflow.com/comment/41609989

http://stackoverflow.com/comment/41696963
type: QuestionComment
comment on: http://stackoverflow.com/q/26505842
score: 0
has text: I give the WRITE_EXTERNAL_STORAGE permission. Now it works, but only if I create "/Android/data/com.examples.sms/databases/" folders step by step in File Explorer. If they aren't exist, I get this log errors again.
type: Comment

http://stackoverflow.com/comment/41608567
type: Comment
has text: Sorry for the wait I was looking for a way to print the boolean, but I still have no results. Where are my supposed to put the code you gave me? I tried putting in it the roomba class but I get an error telling me to delete the three dots within the inCollision. I also tried in the main class but it says that the method inCollision is undefined.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26443355

http://stackoverflow.com/a/26368131
type: AcceptedAnswer
has body: To upload a image to the server, it is highly recommended to use web services. This is explained with a neat example in the this link . Recommend you to refer the steps provided in the link to proceed working on your project.
type: Answer
accepted answer of: http://stackoverflow.com/q/26363882
answers question: http://stackoverflow.com/q/26363882
score: 0

opencv
type: Tag
tags question: http://stackoverflow.com/q/26438993
tags question: http://stackoverflow.com/q/26404564
tags question: http://stackoverflow.com/q/26430075
tags question: http://stackoverflow.com/q/26408921
tag name: opencv

http://stackoverflow.com/comment/116515560
comment on: http://stackoverflow.com/a/26487083
has text: `That thread becomes the JVM's "main" thread`. What do you by "main" here? You mean that the current thread become JVM internal main thread(that is used by JVM for its own stuff) or you mean that it becomes actually the main thread of Java execution(the one that calls `public static void main`) ? thank you
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41388428
has text: Download tomcat 6.0 again for jdk 1.6 . If you are using jdk 1.7 download tomcat 7.0
comment on: http://stackoverflow.com/q/26365311
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26508802
type: Question
tagged with: java
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/26510002
tagged with: android
has answer: http://stackoverflow.com/a/26546348
has body: With the code below, I can open applications such as: Google Maps, calculator and retain their state when they pass to foreground: Intent i; PackageManager manager = getPackageManager(); try { i = manager.getLaunchIntentForPackage("com.google.android.apps.maps"); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (i == null) throw new PackageManager.NameNotFoundException(); i.setAction("android.intent.action.VIEW"); startActivity(i); } catch (PackageManager.NameNotFoundException e) { } My problem is with an application created by me, because my application does not maintain the state. She is always restarted. I have tried to use the properties in the manifest: launchMode, alwaysRetainTaskState, always unsuccessful. Thanks in Advance
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8515936
has title: Launch an application from another application on Android, maintaining state

logic
tags question: http://stackoverflow.com/q/26450548
tag name: logic
tags question: http://stackoverflow.com/q/26416318
tags question: http://stackoverflow.com/q/26399865
type: Tag
tags question: http://stackoverflow.com/q/26452484
tags question: http://stackoverflow.com/q/26380983
tags question: http://stackoverflow.com/q/26476181

http://stackoverflow.com/q/26475710
has title: How can i return to my menu after executing a method?
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/26475911
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: menu
has body: package javaapplication10; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; /** * * @author Tom */ public class JavaApplication10 { static int randomWithRange(int min, int max) { int range = (max - min) + 1; return (int)(Math.random() * range) + min; } public static void menu(){ System.out.println("MENU:"); System.out.println("1.Questions"); System.out.println("2.High Scores"); System.out.println("3.Exit"); }//creates the function "menu" with 3 different options public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter your name: "); String userName = scanner.next();//stores the user's name as the variable userName System.out.println("What class are you in "+userName+"? (1, 2 or 3"); int userClass = scanner.nextInt(); menu();//outputs the function "menu" System.out.println("Please choose an option from the menu:"); int menuChoice = scanner.nextInt();//stores the integer that the user has entered as the menuChoice int[] highScores1 = new int[30]; int[] highScores2 = new int[30]; int[] highScores3 = new int[30]; String[] Names = new String[30]; boolean run = true; ArrayList calc = new ArrayList();//stores all the operations in an array list calc.add("+"); calc.add("-"); calc.add("*"); while(menuChoice != 3){ switch(menuChoice){ case 1://if the menuChoice = 1 it carries out te following code System.out.println(" "); System.out.println("Please answer the following questions:"); System.out.println("This test will involve some negative answers so watch out for them!"); System.out.println(" "); int counter = 0;//starts the counter at 0 int counter1 = 0; int score = 0; Names[counter1] = userName; for (int i = 1; i&lt;11; i++){ int randomnr = randomWithRange(10,0);//creates a random number with the max number being 10 int randomnr2 = randomWithRange(10,0); int randomcalc = randomWithRange(0,2); System.out.println("Question "+i+": "+randomnr+" "+calc.get(randomcalc)+" "+randomnr2); System.out.print…
tagged with: java
has answer: http://stackoverflow.com/a/26475905
tagged with: loops

http://stackoverflow.com/comment/41652064
type: Comment
has text: see modified answer. now it builds on itself.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26510744

http://stackoverflow.com/comment/41409802
has text: Yes, that's correct :) I'm interested in pros/cons of both
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26377108
type: QuestionComment

http://stackoverflow.com/a/26367388
score: 0
answers question: http://stackoverflow.com/q/26367262
type: Answer
has comment: http://stackoverflow.com/comment/41392789
has body: immutable means that the physical string cannot be changed. This means that while I can change the location that a string points to, I cannot alter the string in any way. That is why when you do something like String a = " hello world"; a.trim(); System.out.println(a); //Prints out: hello world there will still be 4 spaces before "hello world". you must reassign the location, like so: String a = " hello world"; a = a.trim(); System.out.println(a); //Prints out:hello world Strings don't change, memory locations do.

http://stackoverflow.com/q/26356506
tagged with: dependencies
has comment: http://stackoverflow.com/comment/41375606
favorite count: 0
tagged with: c++
has comment: http://stackoverflow.com/comment/41372171
has comment: http://stackoverflow.com/comment/41373634
has body: I have a builder C++ application that create a VM to process metadata from file. My application comunicate with my ExtractMetadata.jar with JNI. When i test that with my IDE, it works fine(the process metadata works fine). But when i create my setup application and i run that the process metadata is not run fine. I logged that and it seems the class is not found. jclass cls; jmethodID midAllfield, midConstructor, mid1; jobject newObj; jboolean isCopy; FILE *FileMeta; String strFields, strValueFields, strFld; JavaVM* jvm; JNIEnv* env; // Attach this Thread to JVM jint succGetJVM = gl_env-&gt;GetJavaVM(&amp;jvm); int succ1 = succGetJVM; if(succGetJVM!=0) logging(sExtractMetaLogFile, "\n GetJavaVM(&amp;jvm) : failure "); else { logging(sExtractMetaLogFile, "\n GetJavaVM(&amp;jvm) : Success :"); logging(sExtractMetaLogFile, IntToStr(succ1)); } jint succAttchd = jvm-&gt;AttachCurrentThread((void**)&amp;env, NULL); int succ2 = succAttchd; if(succAttchd!=0) logging(sExtractMetaLogFile, "\n AttachCurrentThread : failure "); else{ logging(sExtractMetaLogFile, "\n AttachCurrentThread : Success : "); logging(sExtractMetaLogFile, IntToStr(succ2)); } cls = (*env).FindClass("ExtractMetaData"); jthrowable exc = env-&gt;ExceptionOccurred(); if (exc) { jclass newExcCls; try { env-&gt;ExceptionDescribe(); } catch (...) { ShowMessage("env-&gt;ExceptionDescribe()"); return; } logging(sExtractMetaLogFile, "\n ExceptionDescribe : "); env-&gt;ExceptionClear(); } if(cls !=0) { //.... } else { logging(sExtractMetaLogFile, "\n Tika Thread Not Found class : ExtractMetaData "); } And my log result is GetJavaVM(&amp;jvm) : Success :0 AttachCurrentThread : Success : ExceptionDescribe : Tika Thread Not Found class : ExtractMetaData Why it works fine when i start my application from my IDE and not work when run it from my installed application?!!
upvote count: 1
has comment: http://stackoverflow.com/comment/41372652
has answer: http://stackoverflow.com/a/26387307
has comment: http://stackoverflow.com/comment/41376690
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41374396
has comment: http://stackoverflow.com/comment/41375922
score: 1
tagged with: java-native-interface
tagged with: java
accepted answer: http://stackoverflow.com/a/26387307
has comment: http://stackoverflow.com/comment/41375403
type: Question
has comment: http://stackoverflow.com/comment/41374929
has title: application C++/Java dependency
answer count: 1
downvote count: 0
tagged with: jvm
has comment: http://stackoverflow.com/comment/41375778

http://stackoverflow.com/a/26454131
type: AcceptedAnswer
downvote count: 0
has body: Field injection is fragile all on its own, and constructor injection should be preferred whenever possible. That's the clean solution here: Make an abstract (protected) constructor on your base class that takes your bean as an argument, and use @Qualifier on the subclass constructors.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26453618
answers question: http://stackoverflow.com/q/26453618

glassfish-2.x
type: Tag
tags question: http://stackoverflow.com/q/26485715
tag name: glassfish-2.x
tags question: http://stackoverflow.com/q/26487324

http://stackoverflow.com/comment/41616517
comment on: http://stackoverflow.com/a/26491104
score: 0
type: AnswerComment
type: Comment
has text: Yeah i dont realize of this. Thank you

http://stackoverflow.com/a/26478774
answers question: http://stackoverflow.com/q/26478743
has body: See inline comments below: int s = 0; int t = 1; int i = 0; // init i outside the while-loop while (i &lt; 5) // replaces for-loop stop condition { s = s + i; int j = i; // init j outside the while-loop while (j &gt; 0) // replaces for-loop stop condition { t = t + (j-1); j--; // decrement j } s = s + t; System.out.println("T is " + t); i++; // increment i } System.out.println("S is " + s); OUPUT T is 1 T is 1 T is 2 T is 5 T is 11 S is 30
upvote count: 1
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/26366756
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/41391300
tagged with: parsing
has body: I am parsing an array into multiple smaller arrays but the returned result to my main is the last object in the original array. I understand why it is happening but I don't know how to fix it. Here is my main class calling my class parseUDP to parse the array: import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; public class MarketDataReader { public static void main(String[] args) { try { byte[] i = null; //byte[] decodedArray = null; String readableMessage = "Null Null"; ipaddrConnection ip = new ipaddrConnection(); parseUDP p = new parseUDP(); DecodeMessage message = new DecodeMessage(); while(1==1){ i = ip.getPacket(); byte[] decodedArray = p.parseUDP(i); //decodedArray = p. StringBuilder sb = new StringBuilder(); for (byte b : decodedArray) { sb.append(String.format("%02X ", b)); } System.out.println("new: " + sb.toString()); //readableMessage = message.decode(decodedArray); //System.out.println(readableMessage); } } catch (IOException ex) { Logger.getLogger(MarketDataReader.class.getName()).log(Level.SEVERE, null, ex); } } } Here is my class to parse the original Array into smaller arrays: public class parseUDP { public byte[] parseUDP(byte[] i) { final ByteBuffer buffer = ByteBuffer.wrap(i); byte[] newArr = null; byte[] headerArr = new byte[12]; byte[] head; byte[] completeArray= null; head = Arrays.copyOf(i, 12); buffer.get(headerArr); while (buffer.hasRemaining()) { buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.mark(); int length = buffer.getShort() &amp; 0xffff; if (length == 0) { break; } //System.out.println(length); newArr = new byte[length]; buffer.reset(); buffer.get(newArr, 0, length); completeArray = new byte[head.length + newArr.length]; for(int x = 0; x &lt; head.length; x++) { completeArray[x] = head[x]; } for(int x = head.length, j = 0; j &lt; newArr.length; x++, j++) { completeArray[x] = newArr[j]; } return completeArray; } return completeArray; } }
answer count: 0
type: UnansweredQuestion
has title: parsed array only returns last object
tagged with: java
has comment: http://stackoverflow.com/comment/41391228
type: Question

http://stackoverflow.com/comment/41616548
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26483173
has text: Open `pom.xml` and click on `Dependency graph` - look for `servlet-api` related dependencies.

http://stackoverflow.com/comment/41679269
has text: And I also have my filter work which filters specific jsp files not servlers without even having web.xml file
type: Comment
comment on: http://stackoverflow.com/a/26513790
type: AnswerComment
score: 0

http://stackoverflow.com/a/26369554
downvote count: 0
has body: The direct problem is the following line during encryption: encrypted = cipher.doFinal((Arrays.copyOfRange(byteArrayMessage, startIndex, endIndex))); as the endIndex can be larger than the size of the array. So you should use the minimum of the endIndex and the actual size of the array. You should however use a hybrid cryptosystem (mixing AES and RSA) instead. Note that just concatenating RSA encryption has many drawbacks such as high CPU usage and a larger ciphertext overhead, and does not provide you with integrity. Also note that it is a good idea to use OAEP encryption instead of PKCS#1 compatible encryption.
type: Answer
has comment: http://stackoverflow.com/comment/41396301
has comment: http://stackoverflow.com/comment/41400005
upvote count: 3
answers question: http://stackoverflow.com/q/26367225
accepted answer of: http://stackoverflow.com/q/26367225
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/41470764
type: Comment
has text: @Brian, it was a composed paste. I fix it. thanks
comment on: http://stackoverflow.com/q/26411305
score: 0
type: QuestionComment

http://stackoverflow.com/q/26498189
tagged with: java
has body: Periodically our Glassfish 4.1 installation seems to be unable to allow the WSDL for our Web service to be available. When I try to reach it through my browser it gives a "connection was reset" error. The typical stack trace from our java applications that consume the services get when this happens is included below. Any ideas what could be causing this? Thanks! javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://venus:9090/USProjectServices/LingoAtTaskService?wsdl. It failed with: Got Unexpected end of file from server while opening stream from http://venus:9090/USProjectServices/LingoAtTaskService?wsdl. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:155) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:120) at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:260) at com.sun.xml.internal.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:223) at com.sun.xml.internal.ws.client.WSServiceDelegate.&lt;init&gt;(WSServiceDelegate.java:171) at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:96) at javax.xml.ws.Service.&lt;init&gt;(Service.java:77) at com.lingosys.ws.LingoAtTaskService.&lt;init&gt;(LingoAtTaskService.java:42) at com.ws.test.Tester1.&lt;init&gt;(Tester1.java:27) at com.ws.test.Tester1.main(Tester1.java:45) Caused by: java.io.IOException: Got Unexpected end of file from server while opening stream from http://venus:9090/USProjectServices/LingoAtTaskService?wsdl at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:842) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:283) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:140) ... 9 more Caused by: java.net.SocketException: Unex…
has comment: http://stackoverflow.com/comment/41629146
type: Question
has title: WSDL periodically unavailable on Glassfish
score: 0
tagged with: wsdl
tagged with: web
has comment: http://stackoverflow.com/comment/41667705
type: UnansweredQuestion
tagged with: glassfish-4
tagged with: soap
answer count: 0

http://stackoverflow.com/comment/41388760
has text: According to the Javadoc, [`getMtimeString()`](http://epaul.github.io/jsch-documentation/simple.javadoc/com/jcraft/jsch/SftpATTRS.html#getMtimeString()) returns a String representation of the modification time, and [`getMTime()`](http://epaul.github.io/jsch-documentation/simple.javadoc/com/jcraft/jsch/SftpATTRS.html#getMTime()) returns the number of seconds since January 1, 1970, as an `int`.
score: 0
comment on: http://stackoverflow.com/q/26365218
type: Comment
type: QuestionComment

http://stackoverflow.com/a/44791104
type: Answer
has body: Best solution is to use a test number or a disposable card If you have access to the web page DOM, just change the input type form "text" to "password"
answers question: http://stackoverflow.com/q/26370928
score: 0

http://stackoverflow.com/q/26449946
has body: I have write program that program have 2 frame one frame to add item and save to database in another frame I have to select the item which is add in first frame in JComboBox I write that code for insert data into database but I don't know how to display in JComboBox try { String host = "jdbc:derby://localhost:1527/PROCAT"; String uName = "zain"; String uPass = "zain"; con = DriverManager.getConnection(host, uName, uPass); String m = "insert into ITEMB (ITEM,ITEMNAME,PRISE) values(?,?,?)"; ps = con.prepareStatement(m); ps.setInt(1, Integer.parseInt(jTextField3.getText())); ps.setString(2, jTextField2.getText()); ps.setString(3, jTextField4.getText()); ps.executeUpdate(); JOptionPane.showMessageDialog(null, "record saved"); } catch (Exception ex) { JOptionPane.showMessageDialog(null, ex); } This for JComboBox: try { String host = "jdbc:derby://localhost:1527/PROCAT"; String uName = "zain"; String uPass = "zain"; con = DriverManager.getConnection(host,uName,uPass); st = con.createStatement(); rs = st.executeQuery("select ITEMNAME from ITEMB;"); while (rs.next()) { jCom.addItem(rs.getString("ITEMNAME")); } } catch(Exception ex) { JOptionPane.showMessageDialog(null,ex); }
tagged with: database
has title: How can I insert data into JComboBox using JTextField
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41542298
score: -1
tagged with: jcombobox
has answer: http://stackoverflow.com/a/26450347
has comment: http://stackoverflow.com/comment/41542059
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: jtextfield
accepted answer: http://stackoverflow.com/a/26450347
has comment: http://stackoverflow.com/comment/41542196
type: Question
upvote count: 0

http://stackoverflow.com/q/26381424
has answer: http://stackoverflow.com/a/26381518
score: 0
has comment: http://stackoverflow.com/comment/41417485
has answer: http://stackoverflow.com/a/26381574
tagged with: constructor
possible better answer: http://stackoverflow.com/a/26381456
answer count: 5
has answer: http://stackoverflow.com/a/26381456
has comment: http://stackoverflow.com/comment/41417684
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47110157
has title: Constructor method try to init insatnce variable from subclass get StackOverflowError
tagged with: java
has body: I need to fill the user in Person because is mandatory in DB, but User is a child of Person and I get java.lang.StackOverflowError User is a Person Person has a User I know that is a recursion problem, but I save User in Person to know who has created that person. I think it is a design problem, but how to solve this? I'd like to save a default value for this, because database requieres that field. Class Person public class Person { private long idPerson; //mandatory field in database private User useredt; public Person() { useredt = new User("test"); } ... } Class User public class User extends Person { private String username; private String password; private Boolean enabled = false; public User() { } ... } Failure trace java.lang.StackOverflowError at sun.util.calendar.ZoneInfo.getOffsets(Unknown Source) at sun.util.calendar.ZoneInfo.getOffsets(Unknown Source) at java.util.GregorianCalendar.computeFields(Unknown Source) at java.util.GregorianCalendar.computeFields(Unknown Source) at java.util.Calendar.setTimeInMillis(Unknown Source) at java.util.GregorianCalendar.&lt;init&gt;(Unknown Source) at java.util.Calendar.createCalendar(Unknown Source) at java.util.Calendar.getInstance(Unknown Source) at com.javalabs.web.dao.Person.&lt;init&gt;(Person.java:56) at com.javalabs.web.dao.User.&lt;init&gt;(User.java:72) at com.javalabs.web.dao.Person.&lt;init&gt;(Person.java:60) at com.javalabs.web.dao.User.&lt;init&gt;(User.java:72)
has comment: http://stackoverflow.com/comment/41417583
has answer: http://stackoverflow.com/a/26381451
type: Question
accepted answer: http://stackoverflow.com/a/26381451
tagged with: inheritance

http://stackoverflow.com/comment/41506081
type: AnswerComment
type: Comment
has text: @Drejc The best thing to do is have a method like "DoubleChecker" - you can even use a custom [Hamcrest](https://code.google.com/p/hamcrest/) matcher - but all of that is more complicated than the scope of this question.
comment on: http://stackoverflow.com/a/26430492
score: 0

http://stackoverflow.com/comment/41568244
comment on: http://stackoverflow.com/a/26463796
type: Comment
has text: You could look into optimising your background process. Is it necessary to perform all those steps in your test environment? How much data is needed to set up the application? Often tests are performed against a certain amount of test data.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26416970
accepted answer of: http://stackoverflow.com/q/26416885
score: 0
has comment: http://stackoverflow.com/comment/41481405
has body: It looks like you have a copy/paste error. You only have 5 fragments, but you have 6 cases in your switch with cases 3 and 4 containing the same code. Case 4 should be your logout logic.
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41481569
answers question: http://stackoverflow.com/q/26416885

http://stackoverflow.com/a/26506821
answers question: http://stackoverflow.com/q/26506466
score: 1
has body: You can decide by the help of . in String which contains SSS and note it's not always safe,so be careful,as for SSS it can parse .767,.76,.7 of milliseconds. Date timestamp = null; if(string.contains(".")) { timestamp =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") .parse(string); } else { timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") .parse(string); } System.out.println(timestamp); Note here if you parse milisecond .76 with .SSS than during retrieval you have to format it with .SS otherwise it returns .076 instead of .76 same thing happens with other. So, be careful!
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26506466
downvote count: 0

http://stackoverflow.com/q/26488337
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26494978
downvote count: 0
tagged with: rhino
score: 1
tagged with: java
type: Question
has title: Rhino AstNode toSource method encodes in ISO-8859-1?
has body: I parse a js string to an abstract syntax tree, then I change the value of a StringLiteral node and need to write the whole Ast content back to a string. But when I use the toSource method, the special characaters from the StringLiterals values are encoded in ISO-8859-1. Example: In class test: public static void main(){ testString = " Assignment = 'Glück'; " CompilerEnvirons env = new CompilerEnvirons(); AstRoot astRoot = new Parser(env).parse(testString, null, 1); PrintVisitor visitor = new PrintVisitor(); astRoot.visitAll(visitor); } In class PrintVisitor extends NodeVisitor: @Override public boolean visit(AstNode node) { if (node.getClass() == StringLiteral.class){ StringLiteral sl = (StringLiteral) node; System.out.println("value: " + sl.getValue()); System.out.println("src: " + sl.toSource()); } } Output: value: Glück src: 'Gl\xfcck" As you see, the value is stored in correct encoding, but the toSource method returns escaped ISO-8859-1 characters. Do you know any way to get the toSource method return UTF-8? Or can you suggest any other way to reverse the parsing process, so I can get back plain text from the whole ast? I spend a lot of time looking for any properties of the nodes or the parser, and I tried to postprocess the output string, but nothing did suceed yet. Thanks for helping!
tagged with: encoding
upvote count: 1

http://stackoverflow.com/comment/41458714
type: Comment
type: QuestionComment
score: 1
has text: You need to share your PlayingCard class. Have you overridden equals over there ?
comment on: http://stackoverflow.com/q/26404976

http://stackoverflow.com/comment/113982577
type: Comment
has text: It worked for me after removing the pasted code and typed myself. Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/43163334

http://stackoverflow.com/comment/41548792
comment on: http://stackoverflow.com/q/26453992
score: 0
type: Comment
type: QuestionComment
has text: use * instead of {3,}

http://stackoverflow.com/q/26463440
answer count: 3
tagged with: user-interface
tagged with: events
possible better answer: http://stackoverflow.com/a/26463539
has answer: http://stackoverflow.com/a/26463539
has answer: http://stackoverflow.com/a/26463662
has body: Here is my ButtonListener class in my GUI. I have several buttons within it, that when clicked, I want to call a certain method for each one, for instance: public class ButtonListener implements ActionListener{ public void actionPerformed( ActionEvent event ){ if (event.getSource( ) == buttonA) If button A is selected, I want to call a method and have its return statement displayed.
has answer: http://stackoverflow.com/a/26463549
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41565556
type: Question
tagged with: if-statement
has title: How do I call methods when actionPerformed is called in GUI
accepted answer: http://stackoverflow.com/a/26463549
score: 0

http://stackoverflow.com/q/26390812
has body: I have overridden hashCode() and equals() method in my class Supplier given below. public class Supplier { private final String name; public Supplier(String name) { this.name = name; } public String getName() { return name; } @Override public int hashCode() { char[] charArray = name.toCharArray(); int sumOfchars = 0; for (char element : charArray) { sumOfchars += element; } return 51 * sumOfchars; } @Override public boolean equals(Object o) { if (o == null) { return false; } if (getClass() != o.getClass()) { return false; } final Supplier other = (Supplier) o; return this.name.equals(other.name); } } Objects of this class are added to a HashMap with name field as Key. Supplier s1 = new Supplier("supplierA"); Supplier s2 = new Supplier("supplierB"); Map&lt;String, Supplier&gt; supplierMap = new HashMap&lt;&gt;(); supplierMap.put(s1.getName(), s1); supplierMap.put(s2.getName(), s2); supplierMap.containsKey("supplierA")); But, when I put() or get() an element my overridden hashCode() method is not called. Same is the case for equals() when I use contains(Key key). I thought HashMap internally calls hashCode() in case of put and get(). And equals is called in case of contains(). Kindly throw some light on this.
has title: Overridden hashCode() function is not called by any of HashMap methods
type: AnsweredQuestion
tagged with: hashcode
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26390834
answer count: 2
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/26390852
downvote count: 0
possible better answer: http://stackoverflow.com/a/26390834
favorite count: 0
tagged with: equals
has answer: http://stackoverflow.com/a/26390852

runtime.exec
tags question: http://stackoverflow.com/q/26429178
tags question: http://stackoverflow.com/q/26407746
tags question: http://stackoverflow.com/q/26379124
type: Tag
tags question: http://stackoverflow.com/q/26496791
tag name: runtime.exec
tags question: http://stackoverflow.com/q/26497975
tags question: http://stackoverflow.com/q/26489106

http://stackoverflow.com/q/26408241
has answer: http://stackoverflow.com/a/26408271
has comment: http://stackoverflow.com/comment/41465022
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26408271
favorite count: 0
has body: Suppose I have a class Foo in package my.package which contains some static fields. I want to use reflection to get the values of those static fields. I know I can write my.package.Foo.class.getDeclaredField(... but this is unsatisfactory as I'm hardcoding the class and package names. I'd like to use this.class.getDeclaredField(... but this is invalid in Java even if called from within a non-static member function. Is there a way?
upvote count: 2
possible better answer: http://stackoverflow.com/a/26408678
has answer: http://stackoverflow.com/a/26408678
score: 2
type: AnsweredQuestion
tagged with: reflection
has title: Correct way of achieving this.class using reflection
tagged with: java

http://stackoverflow.com/comment/41514660
comment on: http://stackoverflow.com/q/26434905
type: QuestionComment
has text: @DaveNewton--this is where I need help: the syntax of opening a resource. I'm Googling... it's not helping. (And what does the apps classpath have to do with user's computer?) I'm lost, here...
score: 0
type: Comment

http://stackoverflow.com/q/26409015
tagged with: android
linked to: http://stackoverflow.com/q/16949512
score: -1
has answer: http://stackoverflow.com/a/26409110
answer count: 1
downvote count: 1
has title: Android DrawerLayout not sliding actionbar
tagged with: java
type: UnansweredQuestion
upvote count: 0
has body: i have created a slidermenu but the issue i am having is that it does not slide the action bar? It only slides the content. Here is my xml of the activity <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawerLayout" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v4.widget.DrawerLayout>
favorite count: 0
type: Question

http://stackoverflow.com/a/26377497
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/26377063
has body: TL;DR "is there any other way in which i can create only single object and crate multiple objects?" Maybe you can use a singleton/factory class.
score: -1

http://stackoverflow.com/q/26510649
has comment: http://stackoverflow.com/comment/41651482
tagged with: android-activity
favorite count: 0
has answer: http://stackoverflow.com/a/26510831
has answer: http://stackoverflow.com/a/26510726
has comment: http://stackoverflow.com/comment/41651544
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/41652132
answer count: 4
has title: Is there a way to restart the application instead of having it restart the last activity after a crash?
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: Since I store certain information that is necessary in my Application class, when a user encounters a crash, sometimes they encounter two crashes since the last activity needs information stored in the application class. Activity A >> Activity B (needs info from Application class) >> Activity C Crash occurs on C >> Application tries to open Activity B >> Crash occurs on B because it needs info from the Application class (this has been reset) I want to avoid this, so I was hoping that there is someway I can restart the whole application after a crash instead of the activity.
has answer: http://stackoverflow.com/a/26510921
score: 0
has answer: http://stackoverflow.com/a/26511148

http://stackoverflow.com/q/26408084
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26448795
upvote count: 1
type: Question
has title: Jersey - What is the difference in injecting UriInfo as class instance variable and injecting it as method parameter?
answer count: 1
downvote count: 0
tagged with: jersey-2.0
has body: I came across injecting UriInfo in two ways - @Path("/users/") public class UsersResource { @Context UriInfo uriInfo; ... @GET @Produces("application/json") public JSONArray getUsersAsJsonArray() { } Another way is - @Path("/users/") public class UsersResource { ... @GET @Produces("application/json") public JSONArray getUsersAsJsonArray(@Context UriInfo uriInfo) { } What is the preferred way to inject UriInfo? Is Jersey resources instantiated per request Or it is Singleton? If it is Singleton, then would it be good to use 2nd approach?
favorite count: 0
has answer: http://stackoverflow.com/a/26448795

http://stackoverflow.com/a/26474887
answers question: http://stackoverflow.com/q/26474527
type: Answer
upvote count: 1
score: 1
has body: Assuming you do not want to change the input file format, you could check if the String you're reading is numeric or not. public static boolean isNumeric(String str) { try { double d = Double.parseDouble(str); } catch(NumberFormatException nfe) { return false; } return true; } For storing both Strings in same variable, use StringBuffer in case the second String is not numeric and convert the StringBuffer later to String.
downvote count: 0

http://stackoverflow.com/comment/41410872
type: AnswerComment
has text: Import could be problem if you already have import like import java.awt.List; p.s. Sorry I haven't enough reputation for comment others answers))
type: Comment
comment on: http://stackoverflow.com/a/26376933
score: 0

http://stackoverflow.com/a/30885191
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26411823
has comment: http://stackoverflow.com/comment/97527889
has body: @UnitOfWork is only registered for Resource methods. So annotating your service methods wouldn't work. Instead you in your Resource method set: @UnitOfWork(transactional = false) So that the entire method isn't wrapped up in a single transaction, but you still get the hibernate Session from UnitOfWork. Then in your DAO methods, control the transactions manually by: Transaction transaction = currentSession().beginTransaction(); try { // do some transactions transaction.commit(); } catch (Exception e) { transaction.rollback(); throw new RuntimeException(e); }
downvote count: 0

http://stackoverflow.com/q/26481137
favorite count: 0
tagged with: android-asynctask
has body: I use https://github.com/loopj/android-async-http but I think this can be applied to an Async Task (native one) AsyncHttpClient client = new AsyncHttpClient(); client.get("http://www.google.com", new AsyncHttpResponseHandler() { @Override public void onStart() { // called before request is started //Some debugging code here } @Override public void onSuccess(int statusCode, Header[] headers, byte[] response) { // called when response HTTP status is "200 OK" //here is the interesting part } @Override public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) { // called when response HTTP status is "4XX" (eg. 401, 403, 404) //Some debugging code here, show retry dialog, feedback etc. } @Override public void onRetry(int retryNo) { //Some debugging code here------- } }); I use it alot in lots of separate classes. The onStart, onFailure and onRetry are the same everywhere, just copy-paste, just the onSuccess is different. I want to keep my code as clean as possible and to reuse what I've already written, so my question is, how do I make this custom, in a separate "file", and just reuse it. I need just the "OnSuccess" function. Thank you --------------------------------------- SOLUTION for GET &amp; POST (Thanks to furkan3ayraktar) 1st file RequestListener package com.classicharmony.krakenmessages.utils.AsyncHttp; import org.apache.http.Header; public interface RequestListener { public void onSuccess(int statusCode, Header[] headers, byte[] response); } 2nd file RequestHandler import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.util.Log; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import org.apache.http.Header; import org.apache.http.entity.StringEntity; import java.io.UnsupportedEncodingException; public class RequestHandler { private static RequestHandler instance; private AsyncHttpClient client; private static fin…
possible better answer: http://stackoverflow.com/a/26481383
has comment: http://stackoverflow.com/comment/81091097
tagged with: android
has answer: http://stackoverflow.com/a/26481445
has comment: http://stackoverflow.com/comment/81254869
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/26481445
has title: Custom Async Http Client in Android
answer count: 3
has answer: http://stackoverflow.com/a/26481460
has answer: http://stackoverflow.com/a/26481383
downvote count: 0

http://stackoverflow.com/a/26403527
answers question: http://stackoverflow.com/q/26403349
downvote count: 0
score: 1
has body: Change your simple date format as of below code: SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Here mm is minutes and MM for monts.
type: Answer
upvote count: 1

http://stackoverflow.com/a/26465007
score: 1
downvote count: 1
has body: Wow, the answer to this question could lead to multiple books and several flame wars, but I try myself to keep it civil. 1) Yes and no. A short comparison of Spring and Java EE Short: As long as you are not afraid of using parts of the Java EE stack like JPA or JSF (if you need those), and you don't need real JTA transaction handling against multiple datasources and you don't need any other advanced stuff from Java EE, Spring + ORM Framework + Webframework on Tomcat is as powerful as Java EE on an full-blown Application Server. To break things up a little: Springs Core DI container is on par with the different CDI implementations Springs own persistence framework (Spring JDBC) is less powerfull than the JPA Standard, however you easily can use any even a container managed JPA Springs MVC framework is more a low-level framework than the JSF standard, however you can easily use that one as well Springs MVC framework is also well suited for REST apps, about on the same level as the JAX-RS standard So you can mix and match it as you like, one of the good things about Spring is, that is has nearly no "vendor tie in" regarding third party libraries, and no one forces you to use a part that you don't need or don't like. 2) It has been true up until the more recent Java EE standards, however nowadays with CDI, I'd say Java EE has caught up and developing Java EE Apps is as simple. 3) A simple singleton bean. Probably with a Transactional annotation.
type: Answer
answers question: http://stackoverflow.com/q/26464104
upvote count: 2

http://stackoverflow.com/q/26426944
type: AnsweredQuestion
has title: Why Hazelcast is fast?
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26427673
answer count: 1
tagged with: database
downvote count: 0
tagged with: hazelcast
has comment: http://stackoverflow.com/comment/41500536
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/26427673
has body: I have several years of experience of working with code related to databases, but there was one question I always asked myself. How Java-based Hazelcast (in-memory) can be faster than any another non-Java based database? For example, in-memory Redis and Memcached are not based on Java. I heard a lot of negative stuff about Java and its JVM which slows down code 10-1000 times comparing to non-VM environments. Does that mean that everything has changed within time? I know it's now lot better than few years before, but it still has performance decrease because of its obvious idea "working on every platform". So how can Java code suddenly be faster than non virtual machine code or even same speed?

http://stackoverflow.com/a/26477496
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: You can also check for duplicates before adding new elements if(!myArray.contains('a')) myArray.add('a');
answers question: http://stackoverflow.com/q/26477436

http://stackoverflow.com/comment/41464506
type: Comment
comment on: http://stackoverflow.com/a/26407838
type: AnswerComment
has text: and as everyone has suggested, store it in a database!
score: 0

http://stackoverflow.com/q/26372873
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/41402449
has title: Syntax error for catch block, works on one computer, but not on the other?
type: Question
has comment: http://stackoverflow.com/comment/41402476
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/41402516
answer count: 1
has comment: http://stackoverflow.com/comment/41402486
has body: This part of my code won't compile on my laptop, but it works just fine on my desktop. Am I missing something simple here? The only difference is that I'm using DR JAVA instead of eclipse. It gives me a syntax error saying Syntax error on token "|", . expected. This is on the catch line of code. protected void done() { try { get(); } catch (InterruptedException | ExecutionException e) { // do something with any exceptions here } }
tagged with: exception
has comment: http://stackoverflow.com/comment/41402515
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26372923

http://stackoverflow.com/comment/41419432
score: 2
has text: Why do your getters have a parameter? I don't see a way to retieve anything having been previously set for your Items class.
comment on: http://stackoverflow.com/q/26381714
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26453384
tagged with: swing
duplicate of: http://stackoverflow.com/q/15992831
type: Question
has answer: http://stackoverflow.com/a/26453541
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26454730
type: UnansweredQuestion
has body: I want to set background in JTextArea (having transparency), but I don't have any idea. Maybe it's not very important, but I just want have characteristically program. Please help. This part of code, I create JTextArea. notatnik_k = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(notatnik_k); scrollPane2.setBounds(20,30, 263,200); notatnik_k.setEditable(false); add(scrollPane2); This photo showing my problem: Is there a simply way, to do it?
has title: Is it possible to set a background image inside JTextArea (including JScrollPane) not all the frame window?
linked to: http://stackoverflow.com/q/15992831
tagged with: java

web-services
type: Tag
tags question: http://stackoverflow.com/q/26362021
tags question: http://stackoverflow.com/q/26414441
tags question: http://stackoverflow.com/q/26381226
tags question: http://stackoverflow.com/q/26375686
tags question: http://stackoverflow.com/q/26473339
tags question: http://stackoverflow.com/q/26403573
tags question: http://stackoverflow.com/q/26426056
tags question: http://stackoverflow.com/q/26464757
tags question: http://stackoverflow.com/q/26405950
tags question: http://stackoverflow.com/q/26354639
tags question: http://stackoverflow.com/q/26507900
tags question: http://stackoverflow.com/q/26411358
tags question: http://stackoverflow.com/q/26403581
tags question: http://stackoverflow.com/q/26462457
tags question: http://stackoverflow.com/q/26418055
tags question: http://stackoverflow.com/q/26456778
tags question: http://stackoverflow.com/q/26456071
tags question: http://stackoverflow.com/q/26405139
tags question: http://stackoverflow.com/q/26363571
tags question: http://stackoverflow.com/q/26459304
tags question: http://stackoverflow.com/q/26454672
tags question: http://stackoverflow.com/q/26360161
tags question: http://stackoverflow.com/q/26501070
tags question: http://stackoverflow.com/q/26423485
tags question: http://stackoverflow.com/q/26425092
tags question: http://stackoverflow.com/q/26506669
tags question: http://stackoverflow.com/q/26498278
tags question: http://stackoverflow.com/q/26382612
tags question: http://stackoverflow.com/q/26357458
tags question: http://stackoverflow.com/q/26489726
tags question: http://stackoverflow.com/q/26381696
tags question: http://stackoverflow.com/q/26435551
tags question: http://stackoverflow.com/q/26399608
tags question: http://stackoverflow.com/q/26384473
tags question: http://stackoverflow.com/q/26355555
tags question: http://stackoverflow.com/q/26361136
tags question: http://stackoverflow.com/q/26501527
tags question: http://stackoverflow.com/q/26459004
tag name: web-services
tags question: http://stackoverflow.com/q/26403674
tags question: http://stackoverflow.com/q/26462244
tags question: http://stackoverflow.com/q/26452926
tags question: http://stackoverflow.com/q/26482985
tags question: http://stackoverflow.com/q/26405460
tags question: http://stackoverflow.com/q/26491726
tags question: http://stackoverflow.com/q/26474469
tags question: http://stackoverflow.com/q/26443547
tags question: http://stackoverflow.com/q/26486320
tags question: http://stackoverflow.com/q/26377833
tags question: http://stackoverflow.com/q/26468745
tags question: http://stackoverflow.com/q/26444790
tags question: http://stackoverflow.com/q/26483389
tags question: http://stackoverflow.com/q/26419938
tags question: http://stackoverflow.com/q/26440682

nullpointerexception
tags question: http://stackoverflow.com/q/26443527
tags question: http://stackoverflow.com/q/26455018
tags question: http://stackoverflow.com/q/26503822
tags question: http://stackoverflow.com/q/26362353
tags question: http://stackoverflow.com/q/26450867
tags question: http://stackoverflow.com/q/26354170
tags question: http://stackoverflow.com/q/26395501
tags question: http://stackoverflow.com/q/26509758
tags question: http://stackoverflow.com/q/26449721
tags question: http://stackoverflow.com/q/26447534
tags question: http://stackoverflow.com/q/26357009
tags question: http://stackoverflow.com/q/26389938
tags question: http://stackoverflow.com/q/26477445
tags question: http://stackoverflow.com/q/26390366
tags question: http://stackoverflow.com/q/26394565
tags question: http://stackoverflow.com/q/26510039
tags question: http://stackoverflow.com/q/26398048
tags question: http://stackoverflow.com/q/26453520
tags question: http://stackoverflow.com/q/26477610
tags question: http://stackoverflow.com/q/26481513
type: Tag
tags question: http://stackoverflow.com/q/26413874
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/26475444
tags question: http://stackoverflow.com/q/26459688
tags question: http://stackoverflow.com/q/26474281
tags question: http://stackoverflow.com/q/26422673
tags question: http://stackoverflow.com/q/26476537
tags question: http://stackoverflow.com/q/26455632
tags question: http://stackoverflow.com/q/26418775
tags question: http://stackoverflow.com/q/26435576
tags question: http://stackoverflow.com/q/26375220
tags question: http://stackoverflow.com/q/26456935
tags question: http://stackoverflow.com/q/26502593
tags question: http://stackoverflow.com/q/26387666
tags question: http://stackoverflow.com/q/26493846
tags question: http://stackoverflow.com/q/26430955
tags question: http://stackoverflow.com/q/26507594
tags question: http://stackoverflow.com/q/26474139
tags question: http://stackoverflow.com/q/26438030

http://stackoverflow.com/comment/41584693
type: QuestionComment
score: 0
has text: Your last comment shows that you're not even trying to learn the language, you're not putting any effort at all in learning Java. But still, you're applying for a work or any other place where you will use Java. This is off topic for the site and you shall not pass this test until you study Java or the required elements/technologies for whatever you're applying-
comment on: http://stackoverflow.com/q/26473494
type: Comment

http://stackoverflow.com/q/26404233
upvote count: 2
tagged with: java
answer count: 2
has title: How to programatically parse a java code (method) into control flow graph
has answer: http://stackoverflow.com/a/32692756
has body: Is there any API or reference library available to parse a java code or java method into control flow graph (CFG). I tried to convert AST into CFG but couldn't do it using AST Parser but didnt find any way to do so. I am working on Eclipse IDE JAVA (J2SE). Kindly help.
has comment: http://stackoverflow.com/comment/41464674
has comment: http://stackoverflow.com/comment/41462796
has comment: http://stackoverflow.com/comment/41458940
has comment: http://stackoverflow.com/comment/41493404
has comment: http://stackoverflow.com/comment/41460201
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41462719
has comment: http://stackoverflow.com/comment/41470492
tagged with: abstract-syntax-tree
score: 2
has answer: http://stackoverflow.com/a/26411596
downvote count: 0
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/41457696
tagged with: control-flow-graph
type: Question
has comment: http://stackoverflow.com/comment/41470596
has comment: http://stackoverflow.com/comment/41493253
has comment: http://stackoverflow.com/comment/41460096
has comment: http://stackoverflow.com/comment/41470406

http://stackoverflow.com/q/26461209
has title: How to decrypt in Java strings that have been encrypted using JS crypto
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41611272
type: Question
has comment: http://stackoverflow.com/comment/41561672
has answer: http://stackoverflow.com/a/44179348
tagged with: javascript
has comment: http://stackoverflow.com/comment/41606463
has comment: http://stackoverflow.com/comment/41606069
answer count: 2
has answer: http://stackoverflow.com/a/26499496
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41562562
type: UnansweredQuestion
has body: What would be the equivalent of this JS code in Java, using javax.crypto.xxx? encryptString : function encryptString(str, password) { var cipher = crypto.createCipher("aes128", password); return cipher.update(str, "binary", "base64") + cipher.final("base64"); }, decryptString : function decryptString(str, password) { var desipher = crypto.createDecipher("aes128", password); return desipher.update(str, "base64", "binary") + desipher.final("binary"); } I'll be encoding in JS to decode in Java, and vice versa. Both 'str' and 'password' variables are strings, 'password' being 16 chars long. Looks like this createCipher(algorithm, password) method uses some method to generate raw key and IV, which is not standard across the board. I think using createCipheriv(algorithm, key, iv) will be a more portable approach. More here: http://nodejs.org/api/crypto.html#crypto_crypto_createcipheriv_algorithm_key_iv I'll update the latest soon.
tagged with: encryption
has comment: http://stackoverflow.com/comment/41631167

http://stackoverflow.com/comment/41479136
type: QuestionComment
has text: Every activity should be declared in the manifest, but that won't yield the right answer if you've forgotten to declare some. Maybe the point of this exercise is to ensure that you've declared them all.
comment on: http://stackoverflow.com/q/26415843
score: 0
type: Comment

http://stackoverflow.com/comment/41416712
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26379432
has text: @DirkNM - Thanks, I have done that and got it working..!
score: 0

http://stackoverflow.com/a/26440387
score: 0
answers question: http://stackoverflow.com/q/26440208
has comment: http://stackoverflow.com/comment/41524479
type: Answer
has body: Use this one:- EditText valueofet = (EditText)findViewById(R.id.edittext1); String value=valueofet.getText().toString(); String base64 = Base64.encodeToString(value, Base64.DEFAULT); cheers....! Please let me know if it works or not...!!

http://stackoverflow.com/a/26455556
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26454672
answers question: http://stackoverflow.com/q/26454672
has body: I've just tested your code. Below is an example of the missing info that Martijn Courteaux requests: /Users/javier/Downloads/Lab1-master/ToDo_SOAP_WebApp-ws/src/main/java/servlets/ToDoAddServlet.java:39: error: cannot find symbol ToDoWebServiceService twss = new ToDoWebServiceService(); ^ symbol: class ToDoWebServiceService location: class ToDoAddServlet The reason of the error is that you forgot to add import todo_soap.*; in the file ToDoAddServlet.java. If you look at src-gen\main\java you can see that the generated code belongs to the package todo_soap.

http://stackoverflow.com/comment/66803220
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26455315
type: QuestionComment
has text: The question title says this is for a local variable yet the answers and duplicate reference a class variable. Am I missing something here?

http://stackoverflow.com/q/26450915
tagged with: string
favorite count: 0
score: 0
has body: I'm new to Java and i have to make a small application that will calculate GCD of up to 5 numbers. If the input is nothing before 5 numbers have been entered, the application will calculate it on the already given numbers Unfortunately my code seems to ignore my else if statement that will make sure it doesn't try to add "" to a int array. This is the part that i am struggling on, i have already tried contains instead of equals but with no result. Am i writing the !input.. wrong? The code runs correct when i try to add a 0, it will not execute the else if. But if i enter "" to make the application run the first part of the if statement it will go to the else if after its done and try to add "" to the array which of course results in an error. I'm sure its something small i am missing or am unaware of, but i can't seem to figure it out. }else if(Integer.parseInt(input) != 0 || !input.equals(""));{ ggdGetallen[count] = Integer.parseInt(input); count++; txtGetal.selectAll(); } Full code private void txtGetalActionPerformed(java.awt.event.ActionEvent evt) { String input = txtGetal.getText(); //Berekenen van het kleinste getal in het array if(count &gt; 4 || input.equals("")){ int kleinsteGetal = ggdGetallen[0]; for (int getal : ggdGetallen){ if (getal &lt; kleinsteGetal &amp;&amp; getal != 0){ kleinsteGetal = getal; } } boolean isDividableBy; boolean ggdFound = false; while(!ggdFound){ for (int getal : ggdGetallen) { if (getal != 0){ isDividableBy = (getal % kleinsteGetal == 0); ggdFound = true; if(!isDividableBy){ kleinsteGetal--; ggdFound = false; break; } } } } lblResultaat.setText(String.format("De grootste gemene deler is %d", kleinsteGetal)); }else if(Integer.parseInt(input) != 0 || !input.equals(""));{ ggdGetallen[count] = Integer.parseInt(input); count++; txtGetal.selectAll(); } }
answer count: 1
has comment: http://stackoverflow.com/comment/41543287
accepted answer: http://stackoverflow.com/a/26450922
upvote count: 1
downvote count: 1
has title: Else if condition being ignored?
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26450922

http://stackoverflow.com/comment/41511633
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26431581
has text: that is not a valid json object. the same key is present twice.

http://stackoverflow.com/comment/41635135
comment on: http://stackoverflow.com/q/26501611
type: Comment
type: QuestionComment
has text: You could take a look at [`Toolkit#addAWTEventListener`](http://docs.oracle.com/javase/7/docs/api/java/awt/Toolkit.html#addAWTEventListener(java.awt.event.AWTEventListener,%20long))
score: 3

input
tags question: http://stackoverflow.com/q/26506083
tags question: http://stackoverflow.com/q/26437149
tags question: http://stackoverflow.com/q/26430197
tags question: http://stackoverflow.com/q/26507614
tags question: http://stackoverflow.com/q/26411791
tags question: http://stackoverflow.com/q/26500578
tags question: http://stackoverflow.com/q/26500275
tags question: http://stackoverflow.com/q/26419093
tags question: http://stackoverflow.com/q/26498714
tags question: http://stackoverflow.com/q/26454388
tags question: http://stackoverflow.com/q/26419538
tags question: http://stackoverflow.com/q/26416779
tags question: http://stackoverflow.com/q/26511756
tags question: http://stackoverflow.com/q/26382702
tags question: http://stackoverflow.com/q/26417123
tags question: http://stackoverflow.com/q/26447059
tags question: http://stackoverflow.com/q/26395303
tags question: http://stackoverflow.com/q/26498609
tags question: http://stackoverflow.com/q/26456695
tag name: input
type: Tag

http://stackoverflow.com/comment/41439872
type: Comment
type: AnswerComment
has text: when you say "the answer is "write a service"" you propose solution 1 or 2?
comment on: http://stackoverflow.com/a/26389283
score: 0

http://stackoverflow.com/q/26411693
has answer: http://stackoverflow.com/a/26411830
answer count: 5
has answer: http://stackoverflow.com/a/26411759
has title: How to create an ArrayList of arrays of Objects in Java?
type: UnansweredQuestion
type: Question
has body: I was wondering how exactly to create an ArrayList of an array of objects. For example Object[] objectArray = new Object() // Varying amount of object[] I would like to add Object[] to an ArrayList as they come in. I have seen that an ArrayList of arrays can be created by the following: ArrayList&lt;String[]&gt; action = new ArrayList&lt;String[]&gt;(); So I was thinking it would be as simple as: ArrayList&lt;objectArray[]&gt; action = new ArrayList&lt;objectArray[]&gt;(); But apparently not.
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26414378
tagged with: arrays
has answer: http://stackoverflow.com/a/26411721
tagged with: arraylist
has answer: http://stackoverflow.com/a/26411723

http://stackoverflow.com/a/26471886
has comment: http://stackoverflow.com/comment/41581468
type: Answer
upvote count: 0
downvote count: 1
answers question: http://stackoverflow.com/q/26471403
has comment: http://stackoverflow.com/comment/41581489
score: -1
has body: I see you're using SQLite. It seems to me that you're going about this all wrong. It seems like you need to use Entity Classes: /** * * @author kkennedy */ @Entity(name = "TransferData") @Table(name = "TransferData") public class TransferData implements Serializable { @Id @Basic(optional = false) @Column(name = "ID", nullable = false, length = 8) private String ID; @Basic(optional = false) @Column(name = "data", nullable = false, length = 8) private String data; /** * Default Constructor */ public TransferData() { } /** * Getter * * @return */ public String getID() { return ID; } /** * Setter * * @param ID */ public void setID(String ID) { this.ID = ID; } /** * Getter * * @return */ public String getData() { return data; } /** * Setter * * @param data */ public void setData(String data) { this.data = data; } } I'm sure this is not what you would actually use, but by using Entity Classes, the JDBC driver does all the work of actually putting the data into and out of the database. You just enter it into the class and then persist and query the database, as needed. Not sure if this is the best place to start, but try here for more info: http://docs.oracle.com/javaee/5/tutorial/doc/bnbqw.html

http://stackoverflow.com/a/26407603
has comment: http://stackoverflow.com/comment/41464459
type: Answer
has comment: http://stackoverflow.com/comment/41463900
answers question: http://stackoverflow.com/q/26407432
has comment: http://stackoverflow.com/comment/41464126
score: 0
has body: Try this instead: Button btMain = (Button)findViewById(R.id.button1); btMain.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doStuff(); } }); This is the best way to start understanding how the listeners work.

header
type: Tag
tags question: http://stackoverflow.com/q/26384769
tag name: header

http://stackoverflow.com/q/26440776
tagged with: ejb-3.1
type: Question
tagged with: java
has body: JSR-000318 spec defines the TimerService (chapter 18). Given an EJB, you can create an automatic timer or a programmatic timer. An automatic timer looks like this @Schedules( { @Schedule(hour=”12”, dayOfWeek=”Mon-Thu”), @Schedule(hour=”11”, dayOfWeek=”Fri”) }) public void sendLunchNotification() { ... } While a programmatic timer looks like this @Resource private TimerService timerService; void someMethod(){ ScheduleExpression exp = new ScheduleExpression(); (... set exp ...) TimerConfig config = new TimerConfig(); (... set config ...) Timer created = timerService.createCalendarTimer(exp,config); } When a programmatic timer is created, the task to be triggered by the timer is that one annotated with @Timeout My question, since I could not find it clearly stated in the JSR, if a create 2 programmatic timers for the same EJB using the same ScheduleExpression, the container must call the @Timeout method twice or once? To make my question clearer. Let's suppose I've created 2 programmatic timers. Each one has a different metadata (stored in the serializable timer INFO attribute). Then, I'd like to have two different timers, and when the @Timeout method executes, it would get this INFO attribute to choose what to do. If the answer of my question is twice, than I can do it. If the answer of my question is once, then I cannot. Notice that if the answer is once, it makes some sense from the performance point of view, because you don't actually need to notify the EJB more than once for a given moment, even if you have several triggers for it, but if you are planning to deal with these triggers independently (because each one has a different INFO), then someone is just ignoring the attempt to create a timer when there's already one persisted.
has title: How do I create several triggers for the same EJB @Timeout method?
answer count: 2
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26478523
favorite count: 0
possible better answer: http://stackoverflow.com/a/27269595
has answer: http://stackoverflow.com/a/27269595
type: AnsweredQuestion
tagged with: timer
upvote count: 2
accepted answer: http://stackoverflow.com/a/26478523

http://stackoverflow.com/comment/41523558
has text: Thank you very much for your help. I have saved your code into my algo libraby.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26439318

http://stackoverflow.com/a/26509184
type: Answer
accepted answer of: http://stackoverflow.com/q/26509075
answers question: http://stackoverflow.com/q/26509075
score: 10
upvote count: 10
type: AcceptedAnswer
has body: you can simply call return without a value to exit a void method earlier. public void run() { boolean success = performTask(); if( success == false ){ return; //ends the thread } // further processing if success == true }
downvote count: 0

http://stackoverflow.com/comment/41440145
score: 0
type: Comment
type: QuestionComment
has text: Is there a missing comma after 9 and 10. Probably it is not a standard csv mentioned in rfc4180 "Each line should contain the same of fields throughout the file"
comment on: http://stackoverflow.com/q/26393803

http://stackoverflow.com/q/26461180
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
type: Question
accepted answer: http://stackoverflow.com/a/26461214
answer count: 2
possible better answer: http://stackoverflow.com/a/26461192
upvote count: 0
tagged with: parseint
has answer: http://stackoverflow.com/a/26461192
tagged with: android
favorite count: 0
has title: ParseInt crashes on longer numbers
has answer: http://stackoverflow.com/a/26461214
downvote count: 1
has body: After a few weeks i finally found out how to parse my numbers through my app. But now the app crashes when given a number in the following format: 92839283982938 or 22.483.84.3883. I just dont know how to make it accept those number formats. The problem is connected to a barcode scanner, so i really need it to accept those number formats. The code i used to parse is: JSONObject c = user.getJSONObject(Integer.parseInt(xyz)-1);
type: AnsweredQuestion

sql
tags question: http://stackoverflow.com/q/26401197
tags question: http://stackoverflow.com/q/26409130
tags question: http://stackoverflow.com/q/26441466
tags question: http://stackoverflow.com/q/26489171
tags question: http://stackoverflow.com/q/26359857
tags question: http://stackoverflow.com/q/26487660
tags question: http://stackoverflow.com/q/26377928
tags question: http://stackoverflow.com/q/26371733
tags question: http://stackoverflow.com/q/26452846
tags question: http://stackoverflow.com/q/26480766
tags question: http://stackoverflow.com/q/26407829
tags question: http://stackoverflow.com/q/26509672
tags question: http://stackoverflow.com/q/26445483
tags question: http://stackoverflow.com/q/26375409
tags question: http://stackoverflow.com/q/26488999
tags question: http://stackoverflow.com/q/26364039
tags question: http://stackoverflow.com/q/26422802
tags question: http://stackoverflow.com/q/26485495
tags question: http://stackoverflow.com/q/26382276
tags question: http://stackoverflow.com/q/26505645
tags question: http://stackoverflow.com/q/26487239
tags question: http://stackoverflow.com/q/26391151
tags question: http://stackoverflow.com/q/26382368
tags question: http://stackoverflow.com/q/26464926
tags question: http://stackoverflow.com/q/26384146
tag name: sql
tags question: http://stackoverflow.com/q/26397185
tags question: http://stackoverflow.com/q/26371463
type: Tag
tags question: http://stackoverflow.com/q/26388572
tags question: http://stackoverflow.com/q/26375269
tags question: http://stackoverflow.com/q/26510344
tags question: http://stackoverflow.com/q/26474097
tags question: http://stackoverflow.com/q/26405931
tags question: http://stackoverflow.com/q/26385780
tags question: http://stackoverflow.com/q/26359634
tags question: http://stackoverflow.com/q/26507039
tags question: http://stackoverflow.com/q/26483734
tags question: http://stackoverflow.com/q/26366368
tags question: http://stackoverflow.com/q/26512721
tags question: http://stackoverflow.com/q/26383897
tags question: http://stackoverflow.com/q/26400323
tags question: http://stackoverflow.com/q/26409737
tags question: http://stackoverflow.com/q/26438761
tags question: http://stackoverflow.com/q/26363967
tags question: http://stackoverflow.com/q/26396010
tags question: http://stackoverflow.com/q/26488340
tags question: http://stackoverflow.com/q/26376937
tags question: http://stackoverflow.com/q/26382719
tags question: http://stackoverflow.com/q/26425880
tags question: http://stackoverflow.com/q/26369521
tags question: http://stackoverflow.com/q/26374660
tags question: http://stackoverflow.com/q/26474447
tags question: http://stackoverflow.com/q/26503942
tags question: http://stackoverflow.com/q/26381169
tags question: http://stackoverflow.com/q/26396926
tags question: http://stackoverflow.com/q/26449520

http://stackoverflow.com/comment/41417684
type: QuestionComment
has text: How to avoid the recursion but initialize the useredt in Person? I have a database with People and a reduced group of this (User) that can create Person. And I save the User whose has created the Person.
comment on: http://stackoverflow.com/q/26381424
score: 0
type: Comment

http://stackoverflow.com/comment/41457178
score: 0
has text: post the code of the both the activites
comment on: http://stackoverflow.com/q/26404099
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41506140
comment on: http://stackoverflow.com/a/26430663
has text: I think he is talking about the JIT (Just in time compiler) with jitter
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26436434
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41524632
has title: Retrofit POST request to Spring Boot service
has comment: http://stackoverflow.com/comment/41533948
has comment: http://stackoverflow.com/comment/41531884
tagged with: post
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41545117
favorite count: 0
has answer: http://stackoverflow.com/a/26451939
tagged with: retrofit
has comment: http://stackoverflow.com/comment/41536172
score: 1
tagged with: java
upvote count: 1
has body: I am using Retrofit for post request to Spring Boot service but always is called failure Callback method. This is my simplified code: Spring Boot service (Controller): @RestController public class ServController { @Autowired private UserRepository userRepository; @RequestMapping(value = "/user", method = RequestMethod.POST) public Boolean signUpUser(@RequestBody User user) { return true; } } My client interface: public interface ChainApi { public static final String USER_PATH = "/user"; @POST(USER_PATH) public void signUpUser(@Body User user, Callback&lt;Boolean&gt; callback); } Async POST request: User user = new User(); user.setId(12); user.setName(nameEtx.getText().toString()); user.setEmail(emailEtx.getText().toString()); user.setPassword(passwordEtx.getText().toString()); RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(Constant.URL_LOCALHOST) .build(); ChainApi service = restAdapter.create(ChainApi.class); service.signUpUser(user, new Callback&lt;Boolean&gt;() { @Override public void success(Boolean aBoolean, Response response) { Log.i(TAG, "Succesfull"); @Override public void failure(RetrofitError error) { Log.i(TAG, "Error " + error.getMessage()); // 400 Bad Request } }); This is my User class(POJO): @JsonIgnoreProperties(value = { "additionalProperties"}) public class User { @JsonProperty("id") private Integer id; @JsonProperty("name") private String name; @JsonProperty("password") private String password; @JsonProperty("email") private String email; @JsonIgnore private Map&lt;String, Object&gt; additionalProperties = new HashMap&lt;String, Object&gt;(); // methods } NOTES: I am developing in Android and when make manual POST request from Postman I get 200 OK. In addition I get in logcat message: 400 Bad Request
accepted answer: http://stackoverflow.com/a/26451939
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26437323
has answer: http://stackoverflow.com/a/26444469
tagged with: excel-formula
tagged with: excel
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
has body: I have a formula like this : =ISNUMBER(SEARCH("*AM*",A1)) in column B. After populating column A with: cell.setCellValue("Smita AM D"); I call: workbook.getCreationHelper().createFormulaEvaluator().evaluateAll(); The formula is not getting evaluated correctly. If I go to column B and click enter, the formula is evaluated correctly. I have tried setting CELL_TYPE_STRING to column A but no difference in result.
type: Question
accepted answer: http://stackoverflow.com/a/26444469
score: 0
has title: Poi formula not getting evaluated correctly
answer count: 1

http://stackoverflow.com/a/26375936
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: You can configure Eclipse to automatically check for updates for all the installed plugins. From the following website: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-37a.htm You can configure Eclipse update to search for updates to the installed features on a periodic basis automatically. You can configure how these updates are scheduled and performed from the Windows -> Preferences -> Install/Update -> Automatic Updates preference page. There you can define your: scheduling options - i.e. not at all, at startup or at a specific time. download options - search for updates and notify when available or download and notify when ready to install Note there will be no notification if no updates are found.
accepted answer of: http://stackoverflow.com/q/26371195
score: 2
answers question: http://stackoverflow.com/q/26371195

http://stackoverflow.com/q/26390911
upvote count: 1
has comment: http://stackoverflow.com/comment/41435532
downvote count: 1
has title: How do I implement an AVL tree in java? Why does compareTo say source unknown?
tagged with: tree
type: AnsweredQuestion
tagged with: compareto
tagged with: java
tagged with: javadoc
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/26391241
has comment: http://stackoverflow.com/comment/41437344
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41435743
has comment: http://stackoverflow.com/comment/41435517
has body: I am working on implementing an AVL tree for a project for class. I've written my search and insert methods but I am not sure if it works. When I try to test my search and insert, everytime my search method in my program reaches my compareTo statement, it gives a null pointer exception. I know that search works only if there is one item, the root, and it returns true. But it seems like the root's left/right child are not linked. When I insert multiple integers and search for them, it doesn't do anything, or it always returns true. How do I implement an AVL tree? Do I HAVE to use a linked list/arraylist? Is is possible to implement it without using any of these. Part of the requirement is that I must NOT use anything from the JCF. I have spent countless hours trying to figure out what is wrong and I always get back to first base. When I use .compareTo, it tells me source is unknown. Example test run: Is the tree empty false Size of tree: 2 testing left height Height of tree: 2 Exception in thread "main" java.lang.NullPointerException at java.lang.Integer.compareTo(Unknown Source) at java.lang.Integer.compareTo(Unknown Source) at AVLTree.search(AVLTree.java:110) at AVLTreeTest.main(AVLTreeTest.java:13) Main test program: public class AVLTreeTest { public static void main(String args[]){ AVLTree&lt;Integer&gt; tree = new AVLTree&lt;Integer&gt;(); tree.insert(9); //tree.insert(5); tree.insert(4); //tree.insert(3); //tree.insert(19); System.out.println("Is the tree empty " + tree.isEmpty()); System.out.println("Size of tree: " + tree.size()); System.out.println("Height of tree: " + tree.height()); System.out.println(tree.search(9)); System.out.println(tree.search(5)); } } When I press f2 on my compareTo line: else if(root!=null &amp;&amp; item.compareTo(root.getItem())==0){ The following pops up: Open Declaration: int java.lang.Comparable.compareTo(T arg0) Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
has answer: http://stackoverflow.com/a/26391241
has comment: http://stackoverflow.com/comment/41435436

http://stackoverflow.com/a/26418290
answers question: http://stackoverflow.com/q/26418055
score: 1
has body: You have a few options for solving this. The easiest would be to create a class to act as a container for your parameters, and store those in an ArrayList public class Parameter { private String key; private String value; // Getters, setters, other stuff. } Which you would then store in an ArrayList You could also make a class to act as a parameter builder of sorts. You might do something like this: public class Parameters { private ArrayList&lt;String&gt; keys = new ArrayList&lt;&gt;(); private ArrayList&lt;String&gt; values = new ArrayList&lt;&gt;(); public void add(String key, String value) { ... } public ArrayList&lt;String&gt; getKeys() { ... } public ArrayList&lt;String&gt; getValues() { ... } } The second option requires a bit more code but adds some extra flexibility and should make for a cleaner API. Alternatively, as you mentioned in your own comment, you have the option of using a Map&lt;String, ArrayList&lt;String&gt;&gt;. Which would also work very well in place of the ArrayLists in the above example.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41435749
type: Comment
comment on: http://stackoverflow.com/a/26390798
type: AnswerComment
has text: @LuiggiMendoza Not multiline code, which is what you want if you want to explain how to pass a parameter in a constructor and call a super constructor.
score: 0

http://stackoverflow.com/a/26453935
has comment: http://stackoverflow.com/comment/41549418
answers question: http://stackoverflow.com/q/26453627
has comment: http://stackoverflow.com/comment/41551213
has body: The problem is this line: if (ordListe.toString().contains(s)) Because 1) you do not compare the lowercase or uppercase versions of the two strings and 2) you probably not overrided toString so it returns the items in the list as you probably expect. Put this function in your ordListe class assuming that your ordliste extends arraylist: public boolean containsIgnoreCase(String item) { for(int i = 0; i &lt; size(); i++) { if (get(i).toString().equalsIgnoreCase(item)) { return true; } } return false; } Now you can call containsIgnoreCase to determinate if there is a specific item in the list ignoring the case
has comment: http://stackoverflow.com/comment/41570871
score: 0
has comment: http://stackoverflow.com/comment/41549237
type: Answer

http://stackoverflow.com/q/26466197
upvote count: 2
tagged with: classloader
has comment: http://stackoverflow.com/comment/41573699
has title: Tomcat shutdown: class loading during contextDestroyed does not work
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41605357
has answer: http://stackoverflow.com/a/26489091
tagged with: java
has body: I'm running a web application in Tomcat 7.0.53. I implement a ServletContextListener (call it InitListener) and correctly define it as a Listener in the web.xml: listener that initializes common web app/service resources x.y.z.InitListener During the contextDestroyed event I would like to clean-up some code (e.g., shutdown a org.jboss.netty.channel.group.ChannelGroup using close ()), but my code always fails in this method with the error: SEVERE: Exception sending context destroyed event to listener instance of class x.y.z.InitListener java.lang.NoClassDefFoundError: org/jboss/netty/util/internal/ConcurrentHashMap$Values Now, if I already use the ConcurrentHashMap$Values during the contextInitialized part of the InitListener by, e.g., calling close () on the ChannelGroup, then the shutdown works without problems. It seems to me that during the contextDestroyed event Tomcat is not able to load the class any longer, but if it has been loaded beforehand, that there's no problem. But this can't be the solution, as I have other classes used in the contextDestroyed with the same problem. I would have to pre-load all classes I would like to use later on. Sounds like a hack to me. What am I doing wrong? Why is Tomcat not able to load a new class any longer at this stage? EDIT: As an additional information, the problem only occurs when I do a remote deployment of my web application. When I reload or undeploy the web application on the Tomcat it always shuts down gracefully. Just during remote deployment, the shutdown fails.
type: Question
tagged with: shutdown
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/41606351
accepted answer: http://stackoverflow.com/a/26489091
has comment: http://stackoverflow.com/comment/41574448
has comment: http://stackoverflow.com/comment/41602994
has comment: http://stackoverflow.com/comment/41602938
score: 2

http://stackoverflow.com/q/26507332
tagged with: applet
score: 1
favorite count: 0
type: Question
tagged with: web-applications
has comment: http://stackoverflow.com/comment/41680199
upvote count: 1
tagged with: java-8
tagged with: signed-applet
tagged with: java
has title: Java applet .jar file not load from database in JAVA version 8u25
has comment: http://stackoverflow.com/comment/41645797
has body: We have a custom authorization in our application login page, authorization by using eToken and java (signed jar classes) and applet as login button on page. It's work fine on older and current java versions like 7u67, 7u71 but it's not work on new java version 8u25. We write a test class named AuthControl without package, we found that problem is in .jar file path, for example: //applet is loading with no error when client has java version 7u*, but fails if client has java version 8u* &lt;script src="https://www.java.com/js/deployJava.js"&gt;&lt;/script&gt; &lt;script&gt; var attributes = {code:'AuthControl', archive:'http://example.com/f?p=getApplet', width:132, height:37}; // problem in the path to the .jar file var parameters = { scriptable:true, mode:'login' }; var version = '1.6'; deployJava.runApplet(attributes, parameters, version); &lt;/script&gt; Error is: ... java.lang.ClassNotFoundException: AuthControl at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) basic: load: class AuthControl not found. ... But if we use a direct path to the jar file, it's work fine without errors, example: //applet is loading with no error when client has java version 7u* or 8u* &lt;script src="https://www.java.com/js/deployJava.js"&gt;&lt;/script&gt; &lt;script&gt; var attributes = {code:'AuthControl', archive:'http://example.com/myapplet.jar', width:132, height:37}; var parameters = { scriptable:true, mode:'login' }; var version = '1.6'; deployJava.runApplet(a…
answer count: 0
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26480528
has body: My entity in appengine datastore looks like @Id private long playerId; So in appengine whenever a new entity is created it gets assigned an ID more than 1000000. However whenever the code is run locally the ID starts from 1 and increments like 2, 3, 4, etc. I have done certain assumption with 1000000 as the minimum player id , so my tests fails when IDs like 1, 3, 4, etc generated locally. Is there any way to force the local server or test environment generate higher IDs similar to appengine environments.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26482274
tagged with: java
has title: Generate high value IDs in appengine local dev server datastore
type: Question
has comment: http://stackoverflow.com/comment/41603201
tagged with: google-cloud-datastore
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41604265
has comment: http://stackoverflow.com/comment/41607071
tagged with: google-app-engine

http://stackoverflow.com/comment/41648128
has text: Yes, read here: http://docs.oracle.com/javase/tutorial/java/generics/erasure.html and here http://stackoverflow.com/questions/9548779/java-generics-accessing-generic-type-at-runtime
comment on: http://stackoverflow.com/a/26508761
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41603494
comment on: http://stackoverflow.com/a/26484227
type: AnswerComment
has text: @ifLoop Thanks, I'll mention that too. Difficult to know to what extent one can assume people are using Java 8, but should definitely have mentioned it.
type: Comment
score: 1

http://stackoverflow.com/q/26486591
has body: I have a SWT application which displays and sorts image files by renaming the file. Scruffy I know, but the sorted-by-name files are the input for a later step that I cannot change. So far I have the UI almost working but the initial image at startup does not generate a paint event, so the Canvas is blank. If I minimally resize the window, it immediately appears correctly. I am trying (perhaps incorrectly) to generate the event explicitly using the notifyListeners() method of Canvas which needs to be passed a PaintEvent and I am stuck on how to instantiate one. What is the correct way to force this initial event to be generated?
tagged with: events
favorite count: 0
tagged with: paint
accepted answer: http://stackoverflow.com/a/26486955
tagged with: swt
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to generate SWT paint event at startup
type: Question
tagged with: canvas
has answer: http://stackoverflow.com/a/26486955
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/41627155
score: 0
type: Comment
type: QuestionComment
has text: What's wrong with your first version? It needs a `break` statement when you get a match, of course.
comment on: http://stackoverflow.com/q/26497055

http://stackoverflow.com/comment/41476410
has text: Could you add some code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26414258
score: 1

http://stackoverflow.com/comment/41492907
type: AnswerComment
score: 0
type: Comment
has text: In Java you always have a class; in your case you just use class provided buy third-party library. So it's better to check it's docs and class description for possible properties and methods. As far as I see according to http://commons.apache.org/proper/commons-dbcp/api-1.2.2/org/apache/commons/dbcp/BasicDataSource.html there are no init or destroy methods for this class. If you need to perform some initialization, then it's better to write an own class extending or using (via injection) an existing one.
comment on: http://stackoverflow.com/a/26415803

http://stackoverflow.com/a/26435501
has body: You want the compile-time return type of getComponentByType() to depend on the parameter that you use to select the component. This is possible with generics, but only if the parameter actually carries the compile-time type information that you need. Unfortunately, you can't add type parameters to enum values (see this question), but if you look at your own code again, you might realize that you already have an object that fittingly describes which component you want to get, and that happens to carry the type information we need: the Class&lt;&gt; object of each component type! So, here's my suggestion for your function (not compiled or tested, beware, my Java might be rusty): public &lt;T extends Component&gt; T getComponentByType(Class&lt;T&gt; type) { for(Component component : componentList) { if(component.getClass() == type) { return (T)component; } } return null; }
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26433334
score: 2
accepted answer of: http://stackoverflow.com/q/26433334

http://stackoverflow.com/comment/41532394
comment on: http://stackoverflow.com/q/26444794
type: Comment
type: QuestionComment
has text: @John you can edit the question and paste code here
score: 0

http://stackoverflow.com/q/26372756
accepted answer: http://stackoverflow.com/a/26621853
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26372792
has answer: http://stackoverflow.com/a/26372792
upvote count: 2
answer count: 3
tagged with: android
downvote count: 1
has title: How to set download directory in DownloadManager?
has answer: http://stackoverflow.com/a/62511706
favorite count: 0
tagged with: android-download-manager
has body: I am using DownloadManager but it puts the download somewhere I don't know. I want to download the file in a specific folder like "mp3" in sdcard. Here is the code I am using : private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView webview, String url) { if(url.endsWith(".mp3") || !url.startsWith("http://xnm")) { String servicestring = Context.DOWNLOAD_SERVICE; DownloadManager downloadmanager; downloadmanager = (DownloadManager) getSystemService(servicestring); Uri uri = Uri.parse(url); DownloadManager.Request request = new Request(uri); Long reference = downloadmanager.enqueue(request); setProgressBarIndeterminateVisibility(false); } else { mWebView.loadUrl(url); setProgressBarIndeterminateVisibility(true); } return true; } @Override public void onPageFinished(WebView webview, String url){ super.onPageFinished(webview, url); setProgressBarIndeterminateVisibility(false); } } Thanks in advance !!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26621853

http://stackoverflow.com/a/26373147
type: Answer
answers question: http://stackoverflow.com/q/26372994
accepted answer of: http://stackoverflow.com/q/26372994
score: 0
type: AcceptedAnswer
has body: Connection pools are not there for single process/app to take advantage of multiple connections. According to Wikipedia: a connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required. Connection pools are used when there are a large number of processes/apps running. If each process/app were to create a new database connection in the beginning of each request cycle (and to close it in the end of each request cycle), the overhead will be large. Instead, you can maintain a fixed number of open connections (probably on server startup) and reuse them whenever a process/app requires to query the database. And the overhead of opening and closing connections will no longer be there. A connection may be shared by multiple threads, but ultimately will be serving only one request at a given time. And developers are encouraged to use synchronization and make sure that race conditions would not arise. Large number of undesirable things can happen if you do this. There are pitfalls of sharing a connection among multiple threads. Committing or rolling back a transaction closes all open ResultSet objects and currently executing Statements, unless you are using held cursors. If one thread commits, it closes the Statements and ResultSets of all other threads using the same connection. Executing a Statement automatically closes any existing open ResultSet generated by an earlier execution of that Statement. If threads share Statements, one thread could close another's ResultSet. The same page lists some practices to avoid undesirable behavior: Avoid sharing Statements (and their ResultSets) among threads. Each time a thread executes a Statement, it should process the results before relinquishing the Connection. Each time a thread accesses the Connection, it should consistently commit or not, depending on application protocol. Have one thread be the "managing" database Connection thread that shoul…

http://stackoverflow.com/comment/41516713
type: Comment
type: QuestionComment
has text: I know I'm not using StringBuilder. I am converting a C# project to Java. It was easier to leave the variable named 'stringbuilder' than it was to refactor it. The Java StringBuilder class doesn't seem to have any methods to do what I want. With String I at least have a format() method
comment on: http://stackoverflow.com/q/26435990
score: 0

http://stackoverflow.com/comment/41473830
type: Comment
score: 0
type: AnswerComment
has text: @PankajKushwaha You're welcome. And you can always accept the answer by clicking the checkmark :)
comment on: http://stackoverflow.com/a/26412120

http://stackoverflow.com/comment/41383547
type: Comment
type: QuestionComment
has text: jar-with-dependencies don't works correct. In separate project which use this jar 'web-interface' of db don't work at all (because of rewriting META-INF/service files-I have couple of neo4j component in maven dependencies), but non-web functions works. I use shaded plugin to concatenate implementations in META-INF/service. But it is possible this cause a mess and my project crush...
comment on: http://stackoverflow.com/q/26362014
score: 0

intellij-idea
tags question: http://stackoverflow.com/q/26364634
tags question: http://stackoverflow.com/q/26501129
tags question: http://stackoverflow.com/q/26412183
tags question: http://stackoverflow.com/q/26444461
tags question: http://stackoverflow.com/q/26467569
tags question: http://stackoverflow.com/q/26478690
tags question: http://stackoverflow.com/q/26448566
tags question: http://stackoverflow.com/q/26472472
tags question: http://stackoverflow.com/q/26431260
tags question: http://stackoverflow.com/q/26381796
tags question: http://stackoverflow.com/q/26368943
type: Tag
tags question: http://stackoverflow.com/q/26354651
tag name: intellij-idea
tags question: http://stackoverflow.com/q/26376115
tags question: http://stackoverflow.com/q/26455018
tags question: http://stackoverflow.com/q/26458386
tags question: http://stackoverflow.com/q/26432479
tags question: http://stackoverflow.com/q/26396639
tags question: http://stackoverflow.com/q/26403183
tags question: http://stackoverflow.com/q/26390749
tags question: http://stackoverflow.com/q/26441837
tags question: http://stackoverflow.com/q/26414546
tags question: http://stackoverflow.com/q/26443976
tags question: http://stackoverflow.com/q/26482449
tags question: http://stackoverflow.com/q/26505901
tags question: http://stackoverflow.com/q/26381013
tags question: http://stackoverflow.com/q/26355761
tags question: http://stackoverflow.com/q/26407406
tags question: http://stackoverflow.com/q/26480314
tags question: http://stackoverflow.com/q/26460410
tags question: http://stackoverflow.com/q/26453191
tags question: http://stackoverflow.com/q/26378249
tags question: http://stackoverflow.com/q/26400893
tags question: http://stackoverflow.com/q/26470972
tags question: http://stackoverflow.com/q/26481937
tags question: http://stackoverflow.com/q/26496888

http://stackoverflow.com/comment/41504678
comment on: http://stackoverflow.com/a/26429858
has text: Our client (unfortunately) insists he wants the emails to look "normal" and not have download links in them. I've heard Google App Engine doesn't allow us to create files. But I haven't tried it yet. Let me try that. Thanks.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41592468
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26477300
has text: @StilesCrisis, I personally hope there's a XX for C++ Programmers book. If not, any good book on the language still does nicely for at least skimming through.

http://stackoverflow.com/comment/41411827
score: 0
type: QuestionComment
type: Comment
has text: @Shakiba: mvn needs you to be connected to the internet while you run any mvn command, Please check if any of earlier console traces suggest any connection failures while running this command. you can always do 'mvn help:effective-pom >> log.txt', After running this you can check log.txt to see any problems
comment on: http://stackoverflow.com/q/26364608

http://stackoverflow.com/comment/41635392
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26501549
has text: Maybe a look into the commit which introduces that `synchronize` might give an insight.
score: 0

jaas
tags question: http://stackoverflow.com/q/26408651
type: Tag
tag name: jaas
tags question: http://stackoverflow.com/q/26427161

http://stackoverflow.com/comment/41589522
has text: Do you know how to calculate a percentage? I mean in general (not necessarily in a computer program).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26476181

http://stackoverflow.com/q/26429442
tagged with: video
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/69222539
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29102614
tagged with: mediametadataretriever
has title: Android MediaMetadataRetriever OPTION_CLOSET not working for some videos
upvote count: 3
answer count: 2
has body: I'm just starting on android development. I've been trying for some time to extract frames from video files I have on my phone like this: MediaMetadataRetriever retriever = new MediaMetadataRetriever(); retriever.setDataSource(getApplicationContext(),linkToVideo); // linkToVideo is Uri ImageView frameView = (ImageView) findViewById(R.id.video_frame); frameView.setImageBitmap(retriever.getFrameAtTime(frameTime,MediaMetadataRetriever.OPTION_CLOSEST)); // frameTime in microseconds This works for 640x480 .mp4 videos but not for the 1280x720 .3gp files my camera has recorded. It just takes an awfull long time and eventually the app stops responding. When I use OPTION_CLOSEST_SYNC everything runs smoothly, however I'm interested in getting more than the sync frames. Any ideas on how I can solve this? I was trying to avoid video encoding but if there is no other option I'll resort to that. Thanks in advance for the time you take to help me.
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/26479640
has comment: http://stackoverflow.com/comment/46468188
type: Answer
has body: Declare a JCombobox array and store all your JCombobox in the array as below, JComboBox[] comboBoxs = new JComboBox[6]; comboBoxs[0] = comboBox1; comboBoxs[1] = comboBox2; comboBoxs[2] = comboBox3; comboBoxs[3] = comboBox4; comboBoxs[4] = comboBox5; comboBoxs[5] = comboBox6; Declare a Arraylist and store the data which you read from the file as below, // Other code goes here. ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); String line; while ((line=br.readLine())!=null) { String[] s = line.split(" "); list.add(s[0]); list.add(s[1]); } br.close(); Finally loop over each Arraylist and populate the Combobox's. for(int i = 0; i &lt; comboBoxs.length; i++) { comboBoxs[i].setSelectedItem(list.get(i)); } This should do good.
score: 2
accepted answer of: http://stackoverflow.com/q/26463155
upvote count: 2
answers question: http://stackoverflow.com/q/26463155
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26382612
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26402764
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: basic-authentication
has answer: http://stackoverflow.com/a/53501250
downvote count: 0
score: 1
tagged with: java
tagged with: web-services
tagged with: wss4j
type: Question
has body: For a SOAP web service, I have a working example of the configuration for PasswordDigest authentication via camel-cxf and WSS4J : <camel-cxf:cxfEndpoint id="myService" address="${ws.endpoint.address}" serviceName="es:MyService" wsdlURL="wsdl/myservice.wsdl" endpointName="es:MyServicePort" serviceClass="com.us.MyServiceEndpoint" xmlns:es="http://us.com/services/MyService"> <camel-cxf:inInterceptors> <entry key="action" value="UsernameToken"/> <entry key="passwordType" value="PasswordDigest"/> <entry key="passwordCallbackRef" value-ref="myPasswordCallback"/> </camel-cxf:inInterceptors> </camel-cxf:cxfEndpoint> We have a request to enable the same resource for BASIC authentication - how can this configuration be modified to do that? I have changed the following line and tested via SOAP UI: <entry key="passwordType" value="PasswordText"/> However the result is a SOAP fault from UsernameTokenValidator.java: <soap:Fault> soap:Server These policy alternatives can not be satisfied: {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702} UsernameToken: Password hashing policy not enforced </soap:Fault> If anyone has some guidance here it would be appreciated.
has title: Basic Auth with WSS4J / camel cxf (Https)

http://stackoverflow.com/comment/41596581
score: 0
comment on: http://stackoverflow.com/a/26480259
type: Comment
has text: you may ask more if you need further guidance
type: AnswerComment

http://stackoverflow.com/comment/80443900
type: AnswerComment
score: 4
type: Comment
has text: which changes are needed to support wss protocol (secured ws)?
comment on: http://stackoverflow.com/a/26467775

http://stackoverflow.com/comment/41641630
has text: @Holger my comment was in response to the comment in the post which states "The closest interface would be Runnable but that's a bit too much related to multithreading." `Runnable` is an interface so has no behaviour; it is purely a contract. Just because it happens to be used primarily by the threading classes does not mean it can **only** be used by those classes.
comment on: http://stackoverflow.com/q/26504594
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26359911
answer count: 1
downvote count: 0
tagged with: maven-plugin
favorite count: 0
tagged with: maven
has title: Dependencies specified in POM not resolved in the generated jar in correct directory
has comment: http://stackoverflow.com/comment/41378595
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26360778
accepted answer: http://stackoverflow.com/a/26360778
tagged with: maven-assembly-plugin
type: Question
has comment: http://stackoverflow.com/comment/41377896
has body: I want to create a JAR file of my maven application. So to bundle the dependencies I have used the maven-assembly-plugin. But I want that the dependencies should go the lib/ folder and not anywhere else. My current pom.xml plugin tag is maven-assembly-plugin 2.4.1 jar-with-dependencies make-assembly package single Please suggest. Also is it possible to achieve the same with maven jar plugin. After the above changes in POM The dependencies get generated in the jar which is generated with suffix 'jar-with-dependencies'. But the dependent jars are scattered I want all those dependent jars to be part of one folder lib similart to WEB-INF/lib for war files. How do I achieve this?
upvote count: 1

http://stackoverflow.com/q/26500247
has title: Destroying multiple references to the same object in Java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26503422
tagged with: reference
has comment: http://stackoverflow.com/comment/41632823
accepted answer: http://stackoverflow.com/a/26503658
has comment: http://stackoverflow.com/comment/41633029
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: oop
tagged with: java
type: Question
has body: Say I have a Citizen class and a Population class. A population contains a set of citizens. In this simulation, citizens may die. Currently, to represent the death of a citizen, I destroy all references to that citizen object, as a Population may not contain a dead citizen. I want to be able to create multiple Population objects where citizen overlap is possible. Ex. Citizen C may belong to both Population A and Population B. However, this makes citizen deaths difficult as I would have to remove citizen C from both A and B on the event of a death. Sometimes A and B aren't even in the same scope. Also, each citizen must belong to at least one population. Generally speaking, how would I organize my Population and Citizen class to ensure that a citizen is completely removed from all instances of Population upon that citizen's death? I'm thinking of making Citizen a member class of Population, but I do not know where to go from there. Thanks.
possible better answer: http://stackoverflow.com/a/26501334
has answer: http://stackoverflow.com/a/26501334
has answer: http://stackoverflow.com/a/26503658
has comment: http://stackoverflow.com/comment/41632762
has comment: http://stackoverflow.com/comment/41632698
has comment: http://stackoverflow.com/comment/41632736

http://stackoverflow.com/comment/41593547
type: QuestionComment
comment on: http://stackoverflow.com/q/26478385
score: 2
has text: This logic is wrong. It'll return `true` only if the last element of the 1st list and the second list are equals.
type: Comment

http://stackoverflow.com/a/26467671
score: 27
has comment: http://stackoverflow.com/comment/97719731
upvote count: 27
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/54519184
has comment: http://stackoverflow.com/comment/54518843
has body: You can remove the Make task in your run configuration. But you have to compile the single class manually before launch (Right click or Build -> Compile your class). Or you could even try to compile the whole project if you need more than a single class. This might work if you have no dependencies to a broken class.
has comment: http://stackoverflow.com/comment/41573196
has comment: http://stackoverflow.com/comment/120518635
has comment: http://stackoverflow.com/comment/112606988
has comment: http://stackoverflow.com/comment/104870370
accepted answer of: http://stackoverflow.com/q/26467569
answers question: http://stackoverflow.com/q/26467569

http://stackoverflow.com/q/26412246
has comment: http://stackoverflow.com/comment/41472967
answer count: 1
has comment: http://stackoverflow.com/comment/41472574
has comment: http://stackoverflow.com/comment/41472833
tagged with: generics
has answer: http://stackoverflow.com/a/26414387
favorite count: 0
has comment: http://stackoverflow.com/comment/41473597
has comment: http://stackoverflow.com/comment/41472549
has comment: http://stackoverflow.com/comment/41472536
has comment: http://stackoverflow.com/comment/41472537
has comment: http://stackoverflow.com/comment/41472458
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6643241
upvote count: 1
has comment: http://stackoverflow.com/comment/41473230
downvote count: 1
has comment: http://stackoverflow.com/comment/41472551
has title: Field with multiple generics
has body: Why can't I declare a field with generics that implements multiple interfaces/classes? class MyClass { private Class&lt;? extends Enum&lt;?&gt; &amp; Foo&gt; bar; //.. } interface Foo { // ... } public enum A implements Foo { // ... } Compiler error: Syntax error on token &amp;
tagged with: java
has comment: http://stackoverflow.com/comment/41472620
has comment: http://stackoverflow.com/comment/41472947
has comment: http://stackoverflow.com/comment/41472664
type: Question
has comment: http://stackoverflow.com/comment/41473210
has comment: http://stackoverflow.com/comment/41472535
has comment: http://stackoverflow.com/comment/41472478
has comment: http://stackoverflow.com/comment/41472718
has comment: http://stackoverflow.com/comment/41472559
has comment: http://stackoverflow.com/comment/41476892
score: 0
has comment: http://stackoverflow.com/comment/41473421

http://stackoverflow.com/comment/41438224
type: Comment
has text: I guess what I'm getting at is that you don't address the "why" -- why would the cumulative product ever pass through 0? Tim S.'s answer gives some indication of why, but the real answer lies in modular arithmetic.
type: AnswerComment
comment on: http://stackoverflow.com/a/26387762
score: 0

http://stackoverflow.com/a/26424950
has comment: http://stackoverflow.com/comment/41495097
has comment: http://stackoverflow.com/comment/41495779
has comment: http://stackoverflow.com/comment/41495040
score: 4
answers question: http://stackoverflow.com/q/26424904
has comment: http://stackoverflow.com/comment/41498954
upvote count: 4
has comment: http://stackoverflow.com/comment/41495865
accepted answer of: http://stackoverflow.com/q/26424904
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41496217
has comment: http://stackoverflow.com/comment/41499097
has comment: http://stackoverflow.com/comment/41495428
has comment: http://stackoverflow.com/comment/41495849
has body: There are multiple problems here. In general, you need to use Base64.decode in order to reverse the result of Base64.encode: byte[] data = android.util.Base64.decode(to_decode, DEFAULT); In general, you should always ask yourself "How did I perform the conversion from type X to type Y?" when working out how to get back from type Y to type X. Note that you've got a typo in your code too - "Authentification" should be "Authentication". However, you've also got a problem with your encoding - you're creating a byte[], and using string concatenation with that will call toString() on the byte array, which is not what you want. You should call encodeToString instead. Here's a complete example: String prefix = "Authentication "; // Note fix here... // TODO: Don't use basic authentication; it's horribly insecure. // Note the explicit use of ASCII here and later, to avoid any ambiguity. byte[] rawData = (login + ":" + password).getBytes(StandardCharsets.US_ASCII); String header = prefix + Base64.encodeToString(rawData, NO_WRAP); // Now to validate... String toDecode = header.substring(prefix.length()); byte[] decodedData = Base64.decode(toDecode, DEFAULT); System.out.println(new String(decodedData, StandardCharsets.US_ASCII));
type: Answer
has comment: http://stackoverflow.com/comment/41498072
has comment: http://stackoverflow.com/comment/41499044
has comment: http://stackoverflow.com/comment/41499114

http://stackoverflow.com/comment/41435728
type: QuestionComment
score: 0
has text: yes gTree is set to something, here is the full test1 class.
comment on: http://stackoverflow.com/q/26390366
type: Comment

http://stackoverflow.com/a/26403274
has comment: http://stackoverflow.com/comment/41461421
answers question: http://stackoverflow.com/q/26402654
has body: Below code will produce output <?xml version="1.0" encoding="UTF-8"?> foo Java Code import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; public class XMLTest { public static void main(String[] args) throws ParserConfigurationException, TransformerException { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element element = doc.createElementNS("http://www.myschema.com", "documentObject"); doc.appendChild(element); Element element1 = doc.createElement("element1"); element.appendChild(element1); element1.appendChild(doc.createTextNode("foo")); Attr attr = doc.createAttribute("attr1"); attr.setValue("value"); element1.setAttributeNode(attr); element.appendChild(element1); // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File("testfile.xml")); transformer.transform(source, result); System.out.println("File saved!"); } }
score: 0
has comment: http://stackoverflow.com/comment/41461781
type: Answer

http://stackoverflow.com/q/26362701
tagged with: mysql
type: Question
accepted answer: http://stackoverflow.com/a/26363196
has title: Copy consecutive (MySQL) resultsets into single multidimensional array
answer count: 1
has body: I would like to copy several resultset I'm obtaining from several tables from a MySQL DB into a single multidimesnsional array. Using a for loop I run through an array with the names of tables in the DB. I've successfully selected the data and obtained a resultset and it is these various resultsets corresponding to the table I intend on copying into a single multidimensional array. At the moment when I attempt printing out this multidimensional array it seems to be empty. In case you were wondering the number of rows and columns of the multidimensional array are known beforehand. So in my code below the number of rows is 12 and number of columns is 18. Below is my EDITED code: // Pass array holding existing tables for selection of all data from each array element String[][] arr = null, current = null; int i = 0; int j = 0; for(int k = 0; k &lt;= existingTablesInDBAsArr.length; k++) { String sql = "SELECT * FROM " + existingTablesInDBAsArr[k]; try ( //Connection conn = DBUtil.getConnection(DBType.MYSQL); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); ){ System.out.println("\nRS as a string buffer: "); while (rs.next()) { StringBuffer bf = new StringBuffer(); bf.append(rs.getInt("entryID") + ": "); bf.append(rs.getString("agentID") +"~ "); bf.append(rs.getString("company") +"~ "); bf.append(rs.getString("contact") +"~ "); bf.append(rs.getString("telephone") +"~ "); bf.append(rs.getString("fax") +"~ "); bf.append(rs.getString("address") +"~ "); bf.append(rs.getString("email") +"~ "); bf.append(rs.getString("county") +"~ "); bf.append(rs.getString("postcode") +"~ "); bf.append(rs.getString("country") +"~ "); bf.append(rs.getString("admin_notes") +"~ "); bf.append(rs.getString("agent_notes") +"~ "); bf.append(rs.getString("enqr_taken_by") +"~ "); bf.append(rs.getString("enqr_type") +"~ "); bf.append(rs.getString("enqr_action") +"~ "); bf.append(rs.getString("enqr_date") +"~ "); bf.append(rs.getString("enqr_time")); System.out.println(bf.t…
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26363196

http://stackoverflow.com/a/26506035
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26505997
has body: You arent saving the converted value to any string before returning it, you return age which remains an int: String result=Integer.toString(age); return result;

http://stackoverflow.com/comment/41656367
score: 0
type: AnswerComment
has text: This just moves the checking logic to the dummy builder which wouldn't be so dummy after all - I think I got it sorted out - that no magic will actually choose the proper type.×Comments may only be edited for 5 minutes×Comments may only be edited for 5 minutes×Comments may only be edited for 5 minutes
type: Comment
comment on: http://stackoverflow.com/a/26511549

http://stackoverflow.com/comment/41428287
comment on: http://stackoverflow.com/a/26365943
score: 0
type: AnswerComment
has text: @Mena I just edited your example with this `s.useDelimiter("(?<=\\p{Punct})|(?=\\p{Punct})| ");` because otherwise the separators which were at the end of the line wouldn't have been output. I guess I just need to study the regex better.
type: Comment

http://stackoverflow.com/comment/41604310
type: Comment
has text: The libgdx wiki https://github.com/libgdx/libgdx/wiki/Reading-%26-writing-JSON says to use JsonReader to read the file into JsonValue objects. The JSONObject class is part of the android-sdk and not included in the ligbdx engine.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26484431

http://stackoverflow.com/comment/41717627
has text: I had a similar problem, updating su binary on the mobile device solved the issue.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26501677

http://stackoverflow.com/q/26438427
answer count: 1
score: 0
has title: How to ensure that a android app is accessing the Real server
tagged with: android
linked to: http://stackoverflow.com/q/4065379
type: UnansweredQuestion
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/26439705
tagged with: servlets
type: Question
has body: I've implemented HTTPS connection with servlet running REST api. Device is able to connect to server using HTTPS. Device is accepting server's certificate and establishing HTTPS. How to make sure that the device accepts only a particular certificate? The intention is that someone should not be able to setup a fake server identifying itself as right server using self-signed certificate. In a browser environment, user would see Chrome's crossed out https in the url and know that the certificate is not verified. How to ensure that for an app.

multithreading
tags question: http://stackoverflow.com/q/26481796
tags question: http://stackoverflow.com/q/26421701
tags question: http://stackoverflow.com/q/26443831
tags question: http://stackoverflow.com/q/26461428
tags question: http://stackoverflow.com/q/26434005
tags question: http://stackoverflow.com/q/26429616
tags question: http://stackoverflow.com/q/26452570
tags question: http://stackoverflow.com/q/26441649
tags question: http://stackoverflow.com/q/26476679
type: Tag
tags question: http://stackoverflow.com/q/26492163
tags question: http://stackoverflow.com/q/26480711
tags question: http://stackoverflow.com/q/26406811
tags question: http://stackoverflow.com/q/26361742
tags question: http://stackoverflow.com/q/26449342
tags question: http://stackoverflow.com/q/26509503
tags question: http://stackoverflow.com/q/26502592
tags question: http://stackoverflow.com/q/26434353
tags question: http://stackoverflow.com/q/26359618
tags question: http://stackoverflow.com/q/26420681
tags question: http://stackoverflow.com/q/26396721
tags question: http://stackoverflow.com/q/26425400
tags question: http://stackoverflow.com/q/26495337
tags question: http://stackoverflow.com/q/26353887
tags question: http://stackoverflow.com/q/26409766
tags question: http://stackoverflow.com/q/26437396
tags question: http://stackoverflow.com/q/26392015
tags question: http://stackoverflow.com/q/26373688
tags question: http://stackoverflow.com/q/26435933
tags question: http://stackoverflow.com/q/26427693
tags question: http://stackoverflow.com/q/26363585
tags question: http://stackoverflow.com/q/26398036
tags question: http://stackoverflow.com/q/26437881
tags question: http://stackoverflow.com/q/26444878
tags question: http://stackoverflow.com/q/26406620
tags question: http://stackoverflow.com/q/26505414
tags question: http://stackoverflow.com/q/26373573
tags question: http://stackoverflow.com/q/26482149
tags question: http://stackoverflow.com/q/26435678
tags question: http://stackoverflow.com/q/26499747
tags question: http://stackoverflow.com/q/26421239
tags question: http://stackoverflow.com/q/26380333
tags question: http://stackoverflow.com/q/26507904
tags question: http://stackoverflow.com/q/26482213
tags question: http://stackoverflow.com/q/26485102
tags question: http://stackoverflow.com/q/26475574
tags question: http://stackoverflow.com/q/26455970
tags question: http://stackoverflow.com/q/26410639
tags question: http://stackoverflow.com/q/26413245
tags question: http://stackoverflow.com/q/26361777
tags question: http://stackoverflow.com/q/26499850
tags question: http://stackoverflow.com/q/26512515
tags question: http://stackoverflow.com/q/26389413
tags question: http://stackoverflow.com/q/26490540
tags question: http://stackoverflow.com/q/26396579
tags question: http://stackoverflow.com/q/26388465
tags question: http://stackoverflow.com/q/26438830
tags question: http://stackoverflow.com/q/26429672
tags question: http://stackoverflow.com/q/26446684
tags question: http://stackoverflow.com/q/26455105
tags question: http://stackoverflow.com/q/26384304
tags question: http://stackoverflow.com/q/26391428
tags question: http://stackoverflow.com/q/26361367
tags question: http://stackoverflow.com/q/26485020
tags question: http://stackoverflow.com/q/26513442
tags question: http://stackoverflow.com/q/26466855
tags question: http://stackoverflow.com/q/26481425
tags question: http://stackoverflow.com/q/26391181
tags question: http://stackoverflow.com/q/26481826
tags question: http://stackoverflow.com/q/26470638
tags question: http://stackoverflow.com/q/26410554
tags question: http://stackoverflow.com/q/26377063
tags question: http://stackoverflow.com/q/26478022
tags question: http://stackoverflow.com/q/26504117
tags question: http://stackoverflow.com/q/26450519
tags question: http://stackoverflow.com/q/26501549
tags question: http://stackoverflow.com/q/26433987
tags question: http://stackoverflow.com/q/26405667
tags question: http://stackoverflow.com/q/26438651
tags question: http://stackoverflow.com/q/26414660

http://stackoverflow.com/comment/41415943
type: QuestionComment
has text: read the documentation! it is all about WAKE_LOCKs
score: 0
comment on: http://stackoverflow.com/q/26380534
type: Comment

http://stackoverflow.com/comment/41592791
type: Comment
type: QuestionComment
has text: I don't understand what the rank has to do with the score at all. Why are you even looking at ranks in this case? You just want to add all the different card scores together, don't you?
comment on: http://stackoverflow.com/q/26476973
score: 0

http://stackoverflow.com/comment/46571303
has text: It helped me btw. Danke
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26383729
score: 0

http://stackoverflow.com/comment/41634288
type: QuestionComment
comment on: http://stackoverflow.com/q/26492239
score: 0
type: Comment
has text: For starters there is a difference in JDK I would start by fixing that. Next check your dependencies with `mvn dependency:tree` and make sure that you don't have conflicting SLF4J jars (or other jars.

http://stackoverflow.com/a/26366709
upvote count: 2
has comment: http://stackoverflow.com/comment/41395990
has comment: http://stackoverflow.com/comment/41396379
has body: The parameter you should pass is the persistence-unit. (Not the file name.) <?xml version="1.0" encoding="UTF-8" standalone="yes"?> generated.Items generated.Items$Item generated.PurchaseOrderType generated.USAddress So it should be generated for the persistence.xml above: entityManagerFactory = Persistence.createEntityManagerFactory("generated", persistenceProperties); For your persistence, should be: entityManagerFactory = Persistence.createEntityManagerFactory("org.jvnet.hyperjaxb3.ejb.tests.po", persistenceProperties);
type: Answer
has comment: http://stackoverflow.com/comment/41392565
has comment: http://stackoverflow.com/comment/41398791
has comment: http://stackoverflow.com/comment/41391826
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41390944
has comment: http://stackoverflow.com/comment/41410137
answers question: http://stackoverflow.com/q/26366556

http://stackoverflow.com/q/26402452
has comment: http://stackoverflow.com/comment/41454517
answer count: 0
type: UnansweredQuestion
tagged with: wildfly
upvote count: 1
score: 1
tagged with: java
has body: I have written a small Web Service using JAXWS and Wildfly 8.1.final. So far so good. When a try to access SOAP headers for incoming messages using something like HeaderList headerList = (HeaderList) this.context.getMessageContext().get(JAXWSProperties.INBOUND_HEADER_LIST_PROPERTY); it throws a NullPointerException because of headerList being null. IMHO the reason is that Wildfly uses rt.jar instead of jaxws-rt.jar although I have included the jaxws-rt.jar in my WAR file. When I run the Web Service using JBOSS 4.2.1, no error gets thrwon. Thanks Edmond
has comment: http://stackoverflow.com/comment/41454373
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/91361792
favorite count: 0
has title: Use jaxws-rt.jar instead rt.jar

sqlite
tags question: http://stackoverflow.com/q/26486917
tags question: http://stackoverflow.com/q/26420853
tags question: http://stackoverflow.com/q/26487239
tags question: http://stackoverflow.com/q/26355615
type: Tag
tags question: http://stackoverflow.com/q/26361092
tags question: http://stackoverflow.com/q/26461860
tags question: http://stackoverflow.com/q/26367077
tags question: http://stackoverflow.com/q/26486393
tags question: http://stackoverflow.com/q/26482046
tags question: http://stackoverflow.com/q/26448187
tags question: http://stackoverflow.com/q/26482648
tags question: http://stackoverflow.com/q/26465913
tags question: http://stackoverflow.com/q/26365944
tags question: http://stackoverflow.com/q/26492976
tags question: http://stackoverflow.com/q/26505510
tags question: http://stackoverflow.com/q/26444591
tags question: http://stackoverflow.com/q/26411117
tags question: http://stackoverflow.com/q/26366866
tags question: http://stackoverflow.com/q/26409951
tags question: http://stackoverflow.com/q/26505364
tags question: http://stackoverflow.com/q/26507479
tags question: http://stackoverflow.com/q/26444038
tags question: http://stackoverflow.com/q/26465182
tags question: http://stackoverflow.com/q/26471403
tags question: http://stackoverflow.com/q/26386556
tags question: http://stackoverflow.com/q/26438230
tags question: http://stackoverflow.com/q/26474447
tags question: http://stackoverflow.com/q/26381169
tags question: http://stackoverflow.com/q/26491049
tags question: http://stackoverflow.com/q/26505842
tags question: http://stackoverflow.com/q/26391151
tags question: http://stackoverflow.com/q/26469403
tags question: http://stackoverflow.com/q/26447287
tag name: sqlite
tags question: http://stackoverflow.com/q/26511532

http://stackoverflow.com/comment/41493057
type: Comment
has text: @user1338998 In Chrome click on the right mouse button and select Inspect element. Firefox and other browsers also have such function.
comment on: http://stackoverflow.com/a/26422968
score: 1
type: AnswerComment

http://stackoverflow.com/q/26508010
tagged with: facebook-opengraph
answer count: 0
type: UnansweredQuestion
tagged with: facebook
upvote count: 1
tagged with: java
type: Question
downvote count: 0
has title: Android Facebook request using OpenGraphObject interface class
favorite count: 0
tagged with: android
score: 1
has body: Hi i have 2 interfaces: public interface SpendAction extends OpenGraphAction{ @PropertyName("namespace:transport") // I tried @PropertyName("transport") or without property public void setTransport(OGObject object); public OGObject getTransport(); } And public interface OGObject extends OpenGraphObject{ @PropertyName("namespace:hours") public void setHours(int hours); @PropertyName("namespace:minutes") public void setMinutes(int minutes); @PropertyName("namespace:seconds") public void setSeconds(int seconds); public int getHours(); public int getMinutes(); public int getSeconds(); public void setUrl(String url); public String getUrl(); public void setTitle(String title); public String getTitle(); public void setDescription(String message); public String getDescription(); } 1st is an OpenGraphAction and 2nd one is object. I'm creating interfaces this way: SpendAction action = GraphObject.Factory.create(SpendAction.class); OGObject object = GraphObject.Factory.create(OGObject.class); Then I'm setting object after filling it with data, url, title description etc. action.setTransport(object); // I've tried to replace this with action.addProperty("transport", object) and action.addProperty("namespace:transport", object") //also action.setType("transport") and action.setType("namespace:transport) action.setExplicitlyShared(true); Facebook request creation: Request request = new Request( Session.getActiveSession(), "me/namespace:spent", null, HttpMethod.POST, new Request.Callback() { @Override public void onCompleted(Response response) { if(response != null &amp;&amp; response.getError() != null) Log.d("Facebook Share", "Error message:" + response.getError().getErrorCode() + ", " + response.getError().getErrorMessage()); if(response != null &amp;&amp; response.getGraphObject() != null){ Toast.makeText(context, "Success!", Toast.LENGTH_SHORT).show(); } } } ); request.setGraphObject(action); request.executeAsync(); And I'm getting following error: Error message:1611072, The …

http://stackoverflow.com/comment/41481529
has text: @JarrodRoberson point taken about the debugger, will get on that. What is a better method of reading a file in your opinion ? I was advised to use Scanner and thats the only reason why its in there.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26416966

http://stackoverflow.com/comment/41384127
comment on: http://stackoverflow.com/q/26362941
score: 0
type: Comment
type: QuestionComment
has text: http://www.degraeve.com/reference/simple-ajax-example.php Have a look at the javascript part.

http://stackoverflow.com/a/26418740
has body: I assume that first option is faster. In both options you have setting the values. In the first option it is done explicitly, and in the second option it is done implicitly by the constructor after the object is created. So the main difference between first and second option is the constructor call for the second option. So this extra work, I think, will cause weaker performance for the second option. But, you have to do some performance testing in order to get confident results.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26418087
upvote count: 1
type: Answer

http://stackoverflow.com/q/26445705
tagged with: arraylist
score: 0
has body: I have two arrayLists&lt;myObject&gt;, where myObject is an object of a custom class I've created. I want to be able to compare those arrayLists using the equals() method. After reading and looking for answers, I've read that certain objects like int[] are only considered equal by the equals() method when they are referencing the same thing. To fix that, I tried to override the equals method in my custom object. My objects have 3 atributes (all basic types), so my equals method now returns true if all the 3 atributes are equal to those of the object compared, and false otherwise. However, comparing the arraylists still doesn't work. What am I doing wrong? Excuse me for explaining the code instead of posting it, I do it because the variables and names aren't in English. EDIT: Ok, here's the code. Compra is my custom class; cantidad,concepto and id are its atributes. @Override public boolean equals(Object obj) { boolean result = true; if (obj == null) { result = false; }else{ Compra comprobada = (Compra) obj; if(!(this.id == comprobada.getId())){ result = false; } if(!(this.cantidad == comprobada.getCantidad())){ result = false; } if(!this.concepto.equals(comprobada.getConcepto())){ result = false; } } return result; }
has comment: http://stackoverflow.com/comment/41534239
has answer: http://stackoverflow.com/a/26445791
has comment: http://stackoverflow.com/comment/41534171
has comment: http://stackoverflow.com/comment/41534176
tagged with: equals
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26445756
has comment: http://stackoverflow.com/comment/41534120
tagged with: java
has comment: http://stackoverflow.com/comment/41534004
has title: I have two arrayList<myObject>, I'm not able to use equals() to be able to compare them correctly. Why?
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2989987
has comment: http://stackoverflow.com/comment/41534512

http://stackoverflow.com/a/26443631
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/41530111
answers question: http://stackoverflow.com/q/26443527
has body: From the JLS: 15.25. Conditional Operator ? : If one of the second and third operands is of primitive type T, and the type of the other is the result of applying boxing conversion (§5.1.7) to T, then the type of the conditional expression is T. Aka: when the 2nd and 3rd operand are primitive and boxed reference type, the result is considered the primitive type. At the end of your operation you are boxing it again, but by then you have already tried to assign null to a primitive type - which isn't possible. The signature of String#equalsIgnoreCase is... public boolean equalsIgnoreCase
downvote count: 0
score: 8

http://stackoverflow.com/q/26437947
type: AnsweredQuestion
type: Question
has title: neo4j merge query to execute with REST API
tagged with: java
has answer: http://stackoverflow.com/a/26438645
accepted answer: http://stackoverflow.com/a/26438645
score: 0
answer count: 1
tagged with: neo4j
has body: I need to use Rest API to issue a merge query to execute for neo4j database. I am trying to refer the Neo4J manual, but it only defines for the case of creating nodes, relationships not executing queries of the like. What needs to be done to execute a merge query? Is there any examples in the web? Thanks!!! EDIT: I tried to use the following String response = resource.accept( MediaType.APPLICATION_JSON_TYPE ) .entity( query, MediaType.APPLICATION_JSON_TYPE ) .post( String.class ); With query = "{\"query\":\"MERGE (n:Person) RETURN n\"}", It creates the node But when I try to add a property to the node like the following query = "{\"query\":\"MERGE (n:Person{name:"JRapid"}) RETURN n\"}" I encountered the following error - Caused by: com.sun.jersey.api.client.UniformInterfaceException: POST http://localhost:7474/db/data/cypher returned a response status of 500 Internal Server Error Is there any other way to specify the properties while issuing merge command in REST API?

http://stackoverflow.com/comment/41392503
has text: Don't compare strings with ==. Instead do if (playAgain.equals("Y")).
type: Comment
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/26367626

http://stackoverflow.com/q/26491986
answer count: 3
has comment: http://stackoverflow.com/comment/41617766
tagged with: java
has answer: http://stackoverflow.com/a/26492176
tagged with: jsp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26492283
has title: How to align the output of the elements in JSP?
type: Question
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/83073
has body: I'm having some trouble aligning the output form the my JSP code it looks like this And i want it formatted in a nice way and i don't know how to do it &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=ISO-8859-1"&gt; &lt;title&gt;Weather Manager&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div align="left"&gt; &lt;form action=/Orange_assignment/Login&gt; Email : &lt;input type="text" name="Email" align="left"&gt; &lt;br&gt; Password:&amp;nbsp;&lt;input type="text" name="Password" align="left"&gt; &lt;br&gt; &lt;button type="submit" align="left"&gt;&amp;nbsp;Login!&lt;/button&gt; Login using your credentials &lt;/form&gt; &lt;form action='Signup.jsp' method=POST&gt; &lt;button type="submit"&gt;Signup!&lt;/button&gt; Not a user? Signup! &lt;pre&gt; &lt;img src="OrangeTM.jpg" alt="Orange Logo" style="width: 50px; height: 50px"&gt; &lt;/pre&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;
has answer: http://stackoverflow.com/a/26492342
score: 0

http://stackoverflow.com/comment/41633914
comment on: http://stackoverflow.com/a/26500605
score: 0
type: AnswerComment
type: Comment
has text: Okay if do input to console of 2 + 7, i want the output of " operator is: +, and the numbers are 2 and 7", and i want to use it to then answer, but if i get this, ill get that.

http://stackoverflow.com/q/26503325
has title: Store custom data maps as attributes within ServletContext?
has comment: http://stackoverflow.com/comment/41638659
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26505653
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
tagged with: jersey-2.0
has body: I was looking for a way to load some data from DB into a HashMap and make that map available for all root resource classes and some additional provider classes (implementation of ContainerRequestFilter to be more precise). I found and implemented a solution where I execute a query and load the map within a contextInitialized method of ServletContextListener and set it as an ServletContext attribute: @WebListener public class ServletContextCaching implements ServletContextListener { @Inject private SomeBeanLocalInterface someBean; @Override public void contextDestroyed(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); context.removeAttribute("CUSTOM_DATA_MAP"); } @Override public void contextInitialized(ServletContextEvent sce) { List&lt;SomeEntity&gt; someEntities = someBean.findAllActive(); Map&lt;String, String&gt; temp = new HashMap&lt;String, String&gt;(); for (SomeEntity e : someEntities) { temp.put(e.getSomeKey(), e.getSomeValue()); } ServletContext context = sce.getServletContext(); context.setAttribute("CUSTOM_DATA_MAP", temp); } } Is it good practice to store custom data (i.e. attributes) within servlet context and thus make it available for "everyone"? What is the suggested practice for loading some data from DB into memory maps within REST services? I am pretty sure I am not the first one needing this :)
tagged with: jax-rs
favorite count: 0
tagged with: resteasy
tagged with: rest
accepted answer: http://stackoverflow.com/a/26505653

http://stackoverflow.com/q/26445749
has answer: http://stackoverflow.com/a/26445810
type: UnansweredQuestion
type: Question
has title: Need help compilig an ANTLR grammar file
tagged with: java
tagged with: antlr
score: 0
tagged with: grammar
answer count: 1
has body: im new with ANTLR and I don´t know how to compile my grammar. I´m using the v4.4 of ANTLR with a .g4 file that contains: grammar JayGrammar; program: KEYWORD_VOI KEYWORD_MAI SEPARATOR_PAB SEPARATOR_PCD (declarations statements); declarations: (declaration)*; declaration: (type identifiers); type: (KEYWORD_INT | KEYWORD_BOO); identifiers: (IDENTIFIER)*; statements: (statement)*; statement: (block | assignment | ifstatement | whilestatementk); block: SEPARATOR_LAB statements SEPARATOR_LCD; assignment: (IDENTIFIER OPERATOR_IGU expression); ifstatement: KEYWORD_IF SEPARATOR_PAB expression SEPARATOR_PCD statement (KEYWORD_ELS statement)?; whilestatementk: KEYWORD_WHI SEPARATOR_PAB expression SEPARATOR_PCD statement; expression: conjunction ((OPERATOR_O) conjunction)*; conjunction: relation ((OPERATOR_Y) relation)*; relation: addition ((OPERATOR_REL) addition)*; addition: term ((OPERATOR_SUM|OPERATOR_RES) term)*; term: negation ((OPERATOR_POR|OPERATOR_DIV) negation)*; negation:(OPERATOR_NO) factor; factor: IDENTIFIER|LITERAL|SEPARATOR_PAB expression SEPARATOR_PCD; INPUTELEMENT: (WHITESPACE|TOKEN); WHITESPACE: (' '|'\t'|'\r'|'\n'|'\f'); TOKEN: (IDENTIFIER|KEYWORD_BOO|KEYWORD_ELS|KEYWORD_IF|KEYWORD_MAI|KEYWORD_VOI|KEYWORD_WHI|LITERAL |SEPARATOR_COM|SEPARATOR_LAB|SEPARATOR_LCD|SEPARATOR_PAB|SEPARATOR_PCD|SEPARATOR_PYC |OPERATOR_REL|OPERATOR_DIV|OPERATOR_IGU|OPERATOR_NO|OPERATOR_O|OPERATOR_POR|OPERATOR_RES|OPERATOR_SUM|OPERATOR_Y); LITERAL: (BOOLEAN INTEGER); KEYWORD_BOO: BOOLEAN; KEYWORD_ELS:'else'; KEYWORD_IF: 'if'; KEYWORD_INT: 'int'; KEYWORD_MAI: 'main'; KEYWORD_VOI: 'void'; KEYWORD_WHI: 'while'; BOOLEAN: ('true'|'false'); INTEGER: (DIGIT+); IDENTIFIER: (LETTER (LETTER| DIGIT)*); DIGIT: ('0'..'9')+; LETTER: ('a'..'z'|'A'..'Z')+; SEPARATOR_PAB: '('; SEPARATOR_PCD: ')'; SEPARATOR_LAB: '{'; SEPARATOR_LCD: '}'; SEPARATOR_PYC: ';'; SEPARATOR_COM: ','; OPERATOR_IGU: ('='); OPERATOR_SUM: ('+'); OPERATOR_RES: ('-'); OPERATOR_POR: ('*'); OPERATOR_DIV: ('/'); OPERATOR_REL: ('&lt;'|…

http://stackoverflow.com/comment/41527558
comment on: http://stackoverflow.com/a/26391384
type: Comment
score: 0
has text: Array values are printed parallely as expected ,now i need to store each row values in a seperate array.could you pls help me on this . Thanks in advance,
type: AnswerComment

http://stackoverflow.com/q/26372572
tagged with: java
tagged with: mysql
type: Question
tagged with: jakarta-ee
tagged with: jboss6.x
has body: I am trying to set up a persistence unit in JEE 6 on JBoss AS 6. The injected EntityManager is always null. I've fiddled around with the configuration quite a bit but can't get anything to work. I've tried JTA/LOCAL_RESOURCE, I've tried using a unit name in my code the same as in my persistence.xml, but also with the war name prepended, as the log suggests the JNDI name might be that. I have a mysql-ds.xml file as follows: <?xml version="1.0" encoding="UTF-8"?> myconnection jdbc:mysql://localhost:3306/cog1 org.gjt.mm.mysql.Driver bw 2 20 5 <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name> <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name> I have a persistence.xml as follows: <?xml version="1.0" encoding="UTF-8"?> java:/myconnection java:/myconnection com.cognitura.simulation.dao.model.History <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> <property name="eclipselink.logging.level" value="INFO" /> And I have a bean with the following code in it: @Stateful @LocalBean public class HistoryEJB { @PersistenceContext(unitName = "myunit") private EntityManager em; @EJB private RealityElement el; I can see that the RealityElement el is getting injected fine, so I think it's definitely being container-managed? Grateful for any ideas! EDIT: The logs seem to be fine for setting up the 'myunit' unit. There is a warning, but I read that it's not important? 01:28:06,276 INFO [org.jboss.jpa.deployment.PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitN ame=cog1.war#myunit 01:28:06,278 INFO [org.hibernate.ejb.Ejb3Configuration] Processing PersistenceUnitInfo [ name: myunit ...] 01:28:06,305 WARN [org.hibernate.ejb.Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec co rrectly.PersistenceUnitInfo.getNewTempClassLoader() is null. Seems happy here: 01…
score: 0
has answer: http://stackoverflow.com/a/26373530
answer count: 1
type: UnansweredQuestion
has title: What is wrong with this persistence unit configuration?

http://stackoverflow.com/a/26495687
has comment: http://stackoverflow.com/comment/41625012
score: 1
answers question: http://stackoverflow.com/q/26495620
downvote count: 0
has comment: http://stackoverflow.com/comment/41649341
has comment: http://stackoverflow.com/comment/41625249
type: Answer
has body: On your level of detail this cannot be decided, but with some additional requirements such a split could be desirable. Specifically, splitting between mutable and immutable parts is the essence of the Flyweight pattern: you can freely reuse the immutable part between all instances which need it in the same state. You can also freely publish the immutable part to any interested party, without breaking any internals. Additionally this may help if you need to deep-clone objects. The immutable part would be shared between clones.
has comment: http://stackoverflow.com/comment/41625411
has comment: http://stackoverflow.com/comment/41635934
has comment: http://stackoverflow.com/comment/41649539
upvote count: 1
has comment: http://stackoverflow.com/comment/41626755
has comment: http://stackoverflow.com/comment/41625091

http://stackoverflow.com/comment/41877963
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26501791
has text: Also, please provide the definitions of these tables.

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/26462846
tags question: http://stackoverflow.com/q/26362353
type: Tag
tags question: http://stackoverflow.com/q/26472739
tags question: http://stackoverflow.com/q/26501624
tags question: http://stackoverflow.com/q/26395807
tags question: http://stackoverflow.com/q/26357720

http://stackoverflow.com/comment/41460270
comment on: http://stackoverflow.com/q/26405594
has text: It seems like you're using the wrong tool. You probably want to base your system around messages sent through SQS. If you still need DynamoDB for storage, why not include a reference to the item in the SQS message?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/41423490
type: QuestionComment
comment on: http://stackoverflow.com/q/26384294
score: 0
has text: @a_horse_with_no_name so what you're saying is that if I change they Look&Feel to Windows, it will work they way I want? It currently is one of the "ugly" Java-looking application, and it isn't working. Are you sure that changing this will help?
type: Comment

http://stackoverflow.com/comment/41483694
has text: I am not sure. I have just listed the commands I used to install JDK in the update.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26412861
type: AnswerComment

http://stackoverflow.com/comment/41553294
type: QuestionComment
score: 2
has text: It would be nice if there is something like a documentation for every common method .... oh here it is: http://docs.oracle.com/javase/7/docs/api/java/util/List.html#remove(int)
type: Comment
comment on: http://stackoverflow.com/q/26456340

http://stackoverflow.com/q/26446328
score: 0
answer count: 1
tagged with: maven
has answer: http://stackoverflow.com/a/38634491
has body: I am using this dependency in POM.XML: org.jboss.spec.javax.ejb jboss-ejb-api_3.1_spec provided But when I try to invoke createCalendarTimer(ScheduleExpression) in javax.ejb.TimerService, I get: "The method createCalendarTimer(ScheduleExpression, TimerConfig) is undefined for the type TimerService" Thank you in advance for your help and attention!! Regards.
accepted answer: http://stackoverflow.com/a/38634491
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41549847
has comment: http://stackoverflow.com/comment/41584743
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41589921
has title: Why is the method createCalendarTimer(ScheduleExpression) undefined for the type TimerService?

http://stackoverflow.com/comment/41566363
type: Comment
comment on: http://stackoverflow.com/q/26462858
type: QuestionComment
has text: Can you write the input which triggers the exception ? (the content of prob_c.in)
score: 0

http://stackoverflow.com/a/26359714
has body: Broadly speaking, it's not going to make much difference. Regardless of which approach you take, you're going to need enough memory on the box to handle task X and task Y running simultaneously. If anything, a multithreaded (single-app) approach might have a slightly lower memory footprint, as it would not require loading two copies of the common elements (e.g. the JDK and standard library itself). But I doubt there would be much in it in practice. Writing a multithreaded application is likely to be simpler, as well. There's less to go wrong when you're just submitting task Y to an executor, compared to trying to send a message to a different process. (What happens if the other process isn't running? What happens if you're dropping trigger files and the disk is full, or you're communicating by ports and get an IOException, or...)
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26359618
downvote count: 0

http://stackoverflow.com/comment/41600114
type: Comment
type: QuestionComment
has text: also some (not required) fields
score: 0
comment on: http://stackoverflow.com/q/26481224

http://stackoverflow.com/comment/41593955
type: Comment
comment on: http://stackoverflow.com/q/26478671
type: QuestionComment
score: 2
has text: [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi)

http://stackoverflow.com/comment/115455899
score: 0
has text: Doesn't this do exactly the same as the accepted answer, except that it's using in-line expressions instead of if blocks? The compiled code will e identical.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/65307129

http://stackoverflow.com/comment/41497564
score: 1
comment on: http://stackoverflow.com/a/26426218
type: AnswerComment
type: Comment
has text: That declares 3 type parametes; one named `T`, one named `StringBuffer` and one named `StringBuilder`. Only the first one is used and since its upper bound `String` is `final`, it will always be `String`.

http://stackoverflow.com/comment/41415180
comment on: http://stackoverflow.com/a/26379689
type: Comment
score: 0
type: AnswerComment
has text: database code is in servlet but i want to access it from jsp page as object(for getting connection variable for later use).how to do it without using jstl.

http://stackoverflow.com/comment/41407526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26361028
score: 0
has text: Thanks @Lonzak i got the solution and I used Adobe Desinger tool to make the fields readonly .

http://stackoverflow.com/q/26377280
tagged with: java
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/41410351
favorite count: 0
has answer: http://stackoverflow.com/a/26377443
has title: How to implement specific criteria into compareTo() method
has answer: http://stackoverflow.com/a/26377568
score: -1
has comment: http://stackoverflow.com/comment/41409986
type: UnansweredQuestion
has body: Driver: public static void main(String[] args) { Circle c1 = new Circle(1, "BLUE", true); Circle c2 = new Circle(2, "BLUE", true); Circle c3 = new Circle(3, "BLUE", false); Circle c4 = new Circle(4, "BLACK", true); System.out.println("c1 ? c1 " + c1.compareTo(c1)); System.out.println("c1 ? c2 " + c1.compareTo(c2)); System.out.println("c1 ? c3 " + c1.compareTo(c3)); System.out.println("c1 ? c4 " + c1.compareTo(c4)); Rectangle r1 = new Rectangle(1, 1, "BLUE", true); Rectangle r2 = new Rectangle(2, 2, "RED", true); Rectangle r3 = new Rectangle(4, 4, "GREEN", false); Rectangle r4 = new Rectangle(4, 4, "GREEN", true); System.out.println("r1 ? r2 " + r1.compareTo(r2)); System.out.println("r1 ? r2 " + r1.compareTo(r2)); System.out.println("c1 ? r2 " + c1.compareTo(r2)); System.out.println("r3 ? r4 " + r3.compareTo(r4)); } GeometricObject: public int compareTo(GeometricObject otherfigure) { if (this.getArea() == otherfigure.getArea()) { return 0; } else if (this.getArea() &gt; otherfigure.getArea()) { return 1; } return -1; } Right now I can only compare based on areas, I'm not sure how I would go about adding the other two criteria listed below into my method. How would I add the criteria if the object is a circle and blue that it is greater than any other object regardless of area, and if the object is transparent (filled = false) then it contributes only 50% of its area?
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41410074
tagged with: compareto

http://stackoverflow.com/q/26403574
type: Question
has comment: http://stackoverflow.com/comment/41456253
has comment: http://stackoverflow.com/comment/41456189
possible better answer: http://stackoverflow.com/a/26403796
tagged with: java
has answer: http://stackoverflow.com/a/26403796
has answer: http://stackoverflow.com/a/26403688
accepted answer: http://stackoverflow.com/a/26403688
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26403899
has comment: http://stackoverflow.com/comment/41456217
has body: I'm currently working on an assignment about java interface and I'm in the last 2 steps stuck there without knowing the exact problem here is the code I wrote @Override public boolean isNonDescending() { double smallestElement = data[0]; for (int i = 0; i &lt; data.length;) { if (data[i] &gt;= smallestElement) { i++; } } return true; } but when I submit my work to WebCat, it says this specific method is not working as it suppose to do, the main thing it should do is: • isNonDescending: Returns a boolean value indicating whether the set of elements is organized from smallest to largest (with equal elements being adjacent). Put another way, a set of elements is nondescending if there is no smaller element that comes after a larger element. For example, (1, 2, 2, 3, 4, 5) is nondescending while (1, 2, 2, 3, 1, 5) is not, because a smaller element (1) came after a larger element (3). the other method which are mentioned smallestElement in the method IsNonDescending if you need it: @Override public double smallestElement() { double minElement = data[0]; for (int i = 1; i &lt; data.length; i++) { if (data[i] &lt; minElement) { minElement = data[i]; } } return minElement; } My question is where is the line with a wrong code or am i missing something? Thanks in advance
type: AnsweredQuestion
has title: Java Interface Code is Wrong?

autowired
tags question: http://stackoverflow.com/q/26462926
tags question: http://stackoverflow.com/q/26443144
tags question: http://stackoverflow.com/q/26473333
tags question: http://stackoverflow.com/q/26461697
tags question: http://stackoverflow.com/q/26431015
type: Tag
tags question: http://stackoverflow.com/q/26454555
tags question: http://stackoverflow.com/q/26426694
tags question: http://stackoverflow.com/q/26433631
tags question: http://stackoverflow.com/q/26463728
tag name: autowired

http://stackoverflow.com/comment/41591955
score: 2
comment on: http://stackoverflow.com/q/26477521
has text: @peeskillet Your comment should be an answer. I agree with you on that one.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41400678
score: 0
type: Comment
type: QuestionComment
has text: you need to consume data from your scanner via `scanner.nextLine`, `scanner.next` within your while loop.
comment on: http://stackoverflow.com/q/26371931

http://stackoverflow.com/a/26403253
answers question: http://stackoverflow.com/q/26402666
has body: You're creating a local Connection variable but you're testing what must be a member variable, which is always null, so you're never closing it. If authentication fails you're leaking the connection.
has comment: http://stackoverflow.com/comment/41457047
score: 0
type: Answer

http://stackoverflow.com/a/26479614
answers question: http://stackoverflow.com/q/26479376
downvote count: 0
has body: Spring looks for views in the location you specify in your configuration, namely in the definition of ViewResolver bean. So to get Spring to register views, which are in /WEB-INF/views in your case, you must have following bean in your Spring config: &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" &gt; &lt;property name="prefix" value="/WEB-INF/views/"/&gt; &lt;property name="suffix" value=".jsp"/&gt; &lt;/bean&gt; or if you are using Java config: @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; } After you specify this configuration your views should be correctly resolved. You can also return absolute location of the view from your controller method, if you don't want to configure ViewResolver: return "/WEB-INF/views/home.jsp"
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/26385888
score: 3
answers question: http://stackoverflow.com/q/26380008
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41447039
downvote count: 0
has body: As shown here, you can initialize arbitrarily large amounts of data in the background using a SwingWorker, publish() interim results, and update your view component's model on the EDT in process(). Use a PropertyChangeListener to pace any progress animation. Disable controls that should not be used until loading is complete; enable them when the StateValue is DONE. In this manner, Results will begin appearing immediately. There will be reduced perceived latency. The GUI will remain responsive. The approach works best with view components that minimize rendering using the flyweight pattern, e.g. JTable, JList, JTextArea, etc. Profile to find the best candidates for re-factoring.

http://stackoverflow.com/comment/41395505
type: Comment
type: QuestionComment
has text: Yes, your fix is fine.
comment on: http://stackoverflow.com/q/26368943
score: 0

http://stackoverflow.com/comment/41512374
comment on: http://stackoverflow.com/a/26433729
type: Comment
score: 1
has text: Thank you so much. I get so caught up on the REGEX itself I overlook the actual function.
type: AnswerComment

http://stackoverflow.com/q/26434419
has comment: http://stackoverflow.com/comment/41513624
answer count: 2
tagged with: arrays
tagged with: minecraft
has comment: http://stackoverflow.com/comment/41513614
has comment: http://stackoverflow.com/comment/41513617
has comment: http://stackoverflow.com/comment/41513647
score: -1
has answer: http://stackoverflow.com/a/26434493
favorite count: 0
has title: Unknown ArrayIndexOutOfBounds: 1 exception
upvote count: 2
has comment: http://stackoverflow.com/comment/41513575
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26434473
has comment: http://stackoverflow.com/comment/41513783
tagged with: java
tagged with: bukkit
downvote count: 3
has body: In this game called minecraft, which all of you have probably heard of, is great for getting to learn java and more about libraries. However, Me and my friend were trying to code a plugin for fun and we fell upon this huge ArrayIndexOutOfBounds error. I need to know what is the problem with this. From what i gathered, the problem was in line 53. package com.dillyg10.pvpprotect; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; import com.earth2me.essentials.UserMap; import java.io.PrintStream; import java.util.HashMap; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginLoader; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitScheduler; public class PvpProtect extends JavaPlugin implements Listener { public Map&lt;Player, Integer&gt; tagged = new HashMap(); public void onEnable() { if (getEss() == null) { System.out.println("You must have Essentials installed"); getPluginLoader().disablePlugin(this); return; } Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { Player[] removeUser = new Player[] {null}; Player[] addUser = new Player[] {null}; int[] x = new int[] {0}; int rx = 0; int ax = 0; for (Player p : PvpProtect.this.tagged.keySet()) { int i = ((Integer)PvpProtect.this.tagged.get(p)).intValue(); i--; if (i == 0) { p.sendMessage("§aYou are no longer pvp-tagged! You are free to logout without penalty."); remov…
type: Question

http://stackoverflow.com/comment/41550962
type: Comment
type: QuestionComment
has text: @DonRoby Oh, I see. But, still, OP doesn't do anything with the return value of `triangle`, so what's the point of the recursive call?
score: 1
comment on: http://stackoverflow.com/q/26455024

http://stackoverflow.com/comment/41546358
comment on: http://stackoverflow.com/q/26452484
score: 0
type: Comment
type: QuestionComment
has text: @dici I should have said at the beginning, the assignment requires for us to use a recursive method in the prefix method

http://stackoverflow.com/q/26377827
answer count: 0
has comment: http://stackoverflow.com/comment/41411254
tagged with: java
has comment: http://stackoverflow.com/comment/49648224
type: Question
has title: How to programmatically start a new virtual machine?
has comment: http://stackoverflow.com/comment/41410927
score: 0
has comment: http://stackoverflow.com/comment/41410929
has comment: http://stackoverflow.com/comment/41410950
tagged with: jvm
type: UnansweredQuestion
has body: I have a code that is not thread safe (is using static fields). I want to run it in many threads. the code is doing some parsing of websites. I know I can refactor it, but I don't want to do it now. I would like to run every thread in a new virtual machine. I know I can do it using "java package.class -cp ...", but I have a lot of dependencies. I also cannot use maven "mvn exec:java " since it doesn't support java8. Is there any way to programmatically start a new virtual machine ? P.S. I don't want to refactor my code now
has comment: http://stackoverflow.com/comment/41410834

http://stackoverflow.com/comment/41527816
type: QuestionComment
has text: Which version of the maven-site-plugin are you using?
score: 1
comment on: http://stackoverflow.com/q/26442003
type: Comment

http://stackoverflow.com/q/26500036
has answer: http://stackoverflow.com/a/47552676
type: AnsweredQuestion
has title: Using Retrofit in Android
has comment: http://stackoverflow.com/comment/41761056
downvote count: 2
has answer: http://stackoverflow.com/a/33239974
type: Question
has answer: http://stackoverflow.com/a/45161592
has answer: http://stackoverflow.com/a/45212463
has answer: http://stackoverflow.com/a/26573636
linked to: http://stackoverflow.com/q/32424184
has answer: http://stackoverflow.com/a/60147991
has comment: http://stackoverflow.com/comment/41632355
tagged with: java
has answer: http://stackoverflow.com/a/43088178
has answer: http://stackoverflow.com/a/26581104
has answer: http://stackoverflow.com/a/47516986
answer count: 19
accepted answer: http://stackoverflow.com/a/26573636
has answer: http://stackoverflow.com/a/26573609
has answer: http://stackoverflow.com/a/39385674
has answer: http://stackoverflow.com/a/55453462
upvote count: 47
tagged with: api
has comment: http://stackoverflow.com/comment/41791239
has comment: http://stackoverflow.com/comment/46791084
has body: I have an android app that has 3 activities : A login activity A tasks acivity where all tasks pertaining to a user are displayed (Populated using an Array Adapter) A task_details activity which results from clicking a task on the list I have to consume REST Apis. The research I have done so far directs me to use Retrofit. I checked how to use it and found out that : Set the base URL in the Main Activity (Mine is the Login Activity) I need to create a API class and define my functions using annotations. Use the class Rest Adapter in the Activity and define Callbacks. Had my app been a single activity app, I would have crunched everything in my MainActivity.java but I don't know how and where to put all the code from steps 1,2,3 for use in my 3 activities.Could you please help by telling how to use Retrofit in my app. Thanks a lot. Specifically, I need network calls to : 1. Login the user 2. Get all the tasks of the user. And for both I would be using a given REST api. ********************************************* Calling Api USing Retrofit ********************************************* **Dependancies** :- implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.android.support:cardview-v7:27.1.1' enter code here **Model** use the Pozo class **Api Call** -&gt; getLogin() // use the method //API call for Login private void getLogin() { getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE, WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE); AsyncHttpClient client = new AsyncHttpClient(); RequestParams requestParams = new RequestParams(); requestParams.put("email_id", edit_email.getText().toString()); requestParams.put("password", edit_password.getText().toString()); Log.e("", "LOGIN URL==&gt;" + Urls.LOGIN + requestParams); Log.d("device_token", "Device_ Token" + FirebaseInstanceId.getInstance().getToken()); client.post(Urls.LOGIN, requestParams, new JsonHttpResponseHandler() { @Overrid…
favorite count: 0
has answer: http://stackoverflow.com/a/72138655
has answer: http://stackoverflow.com/a/26682054
has answer: http://stackoverflow.com/a/49600884
tagged with: retrofit
possible better answer: http://stackoverflow.com/a/26666965
score: 45
linked to: http://stackoverflow.com/q/39866613
tagged with: android
has answer: http://stackoverflow.com/a/26666965
has answer: http://stackoverflow.com/a/73871886
has answer: http://stackoverflow.com/a/26658073
has answer: http://stackoverflow.com/a/26611983

http://stackoverflow.com/q/26451503
has comment: http://stackoverflow.com/comment/41544295
possible better answer: http://stackoverflow.com/a/26451615
has answer: http://stackoverflow.com/a/26451615
has answer: http://stackoverflow.com/a/26451535
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41544284
accepted answer: http://stackoverflow.com/a/26451535
type: Question
has body: I have a string Saxon Securitie/Logo/horse-logo.jpg_1413458235818 in format "A/B/C" I want the result as C by removing "A/B/" from the above string and get a result String C = "horse-logo.jpg_1413458235818"
linked to: http://stackoverflow.com/q/3481828
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26451529
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41544255
has answer: http://stackoverflow.com/a/26451531
has comment: http://stackoverflow.com/comment/41544236
has title: How to split a string and get the last part?
answer count: 4
has comment: http://stackoverflow.com/comment/41544910
has comment: http://stackoverflow.com/comment/41549342
downvote count: 2
has comment: http://stackoverflow.com/comment/41544261

http://stackoverflow.com/comment/41517009
has text: @Eran oh i see. The reason I did that was because the task was to return an int if the left object is greater than the right object of 1, and the opposite a -1. Thats why I add a > to the loop
type: AnswerComment
comment on: http://stackoverflow.com/a/26436197
score: 0
type: Comment

http://stackoverflow.com/a/61030008
upvote count: 1
answers question: http://stackoverflow.com/q/26479280
type: Answer
has body: Try https://chaquo.com/chaquopy/ It does exactly what you need but their licensing process is very unfriendly. I have the same issue and I'm still unable to find another solution, although because of the licensing, I'm not going to use it. As an idea I'm thinking of making a service completely in python using kivy and all the rest in java, but I can't yet find an example.
downvote count: 0
score: 1

jquery
tags question: http://stackoverflow.com/q/26443944
tags question: http://stackoverflow.com/q/26407874
tags question: http://stackoverflow.com/q/26488798
tags question: http://stackoverflow.com/q/26424043
tags question: http://stackoverflow.com/q/26438459
tags question: http://stackoverflow.com/q/26422044
type: Tag
tags question: http://stackoverflow.com/q/26454585
tags question: http://stackoverflow.com/q/26461426
tags question: http://stackoverflow.com/q/26432369
tags question: http://stackoverflow.com/q/26405795
tags question: http://stackoverflow.com/q/26362941
tags question: http://stackoverflow.com/q/26389986
tags question: http://stackoverflow.com/q/26357835
tags question: http://stackoverflow.com/q/26417811
tags question: http://stackoverflow.com/q/26461605
tags question: http://stackoverflow.com/q/26450067
tags question: http://stackoverflow.com/q/26450686
tag name: jquery
tags question: http://stackoverflow.com/q/26475894
tags question: http://stackoverflow.com/q/26366192
tags question: http://stackoverflow.com/q/26381696
tags question: http://stackoverflow.com/q/26376640
tags question: http://stackoverflow.com/q/26477625
tags question: http://stackoverflow.com/q/26497159

http://stackoverflow.com/comment/41544739
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26451716
has text: Is it possible that you are going outside of the image bounds?
score: 0

http://stackoverflow.com/q/26400049
tagged with: java
type: Question
upvote count: 12
has title: Generic super class in java
has answer: http://stackoverflow.com/a/26400196
tagged with: class
has comment: http://stackoverflow.com/comment/41450742
score: 12
answer count: 3
has answer: http://stackoverflow.com/a/26400095
downvote count: 0
has comment: http://stackoverflow.com/comment/41450355
has comment: http://stackoverflow.com/comment/41450534
tagged with: generics
favorite count: 0
tagged with: extends
possible better answer: http://stackoverflow.com/a/26400429
has answer: http://stackoverflow.com/a/26400429
has comment: http://stackoverflow.com/comment/41450411
has body: Is it possible to create something like this in java public abstract class GenericView&lt;LAYOUTTYPE extends AbstractLayout&gt; extends LAYOUTTYPE so that public class MyView extends GenericView&lt;HorizontalLayout&gt; extends GenericView and HorizontalLayout and public class MyView2 extends GenericView&lt;VerticalLayout&gt; extends GenericView and VerticalLayout?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26400095
has comment: http://stackoverflow.com/comment/41450629

http://stackoverflow.com/comment/41550322
type: QuestionComment
has text: Can you make a comment on line AccountConnectionSignUp.java:22.
comment on: http://stackoverflow.com/q/26454555
score: 0
type: Comment

http://stackoverflow.com/comment/41608335
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26486867
has text: So is this about the depth of a constant-fan-in circuit or what's happening here? It's hard to get that `log` otherwise

http://stackoverflow.com/comment/41472789
comment on: http://stackoverflow.com/q/26412113
score: 0
type: Comment
type: QuestionComment
has text: Simple: traverse over the tree till you find your target node as a left or right of some other node.

http://stackoverflow.com/comment/41440807
has text: nice I didn't even noticed that it is fahrenheit conversion. I guys my proff already introducing the use of java in code.
comment on: http://stackoverflow.com/q/26393982
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41438345
has text: Thanks, I managed to get it all working simply because you pointed out the encryption changes.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26391416
type: Comment

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/26420548
tags question: http://stackoverflow.com/q/26378907
tags question: http://stackoverflow.com/q/26404478
tags question: http://stackoverflow.com/q/26363682
type: Tag

http://stackoverflow.com/q/26395468
has answer: http://stackoverflow.com/a/26395541
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26395839
type: Question
has body: My main goal is to iterate from a defined start location in an array to the end of the array to find the index of the minimum value then swap it with the index zero, iterating through will keep swapping it to 1 index higher than the previous . I have a method that finds the minimum of the array and a method at my attempt to obtain the index of the min value. Here is what I have: static int min(int[] parameter){ int minValue = 101; for(int z = 0 ; z&lt;parameter.length; z++){ if(parameter[z] &lt; minValue){ minValue = parameter[z]; } } return minValue; } static int locateMin (int start, int[] array) { int n = 0; int value = array[n]; int location = 0; for (n= start; n &lt; array.length; n++) { if (array[n] &lt; value){ value = array[n]; location = n; } } return location; } static void swap(int[] arr, int locationOne, int locationTwo){ int pos = arr[locationOne]; arr[locationOne] = arr[locationTwo]; arr[locationTwo] = pos; } public static void main(String[] args){ int[] array = generateArray(10); showArray(array); swap(array, 0, locateMin(0, array)); swap(array, 1, locateMin(1, array)); swap(array, 2, locateMin(2, array)); showArray(array); } My problem is that it doesn't place the values in the correct index, and iterates incorrectly. Any ideas as to why? Furthermore, my current output shows: 63 10 47 94 89 68 15 12 27 42 10 10 10 94 89 68 15 12 27 42
tagged with: arrays
has comment: http://stackoverflow.com/comment/41442848
tagged with: int
answer count: 3
has answer: http://stackoverflow.com/a/26395577
downvote count: 0
has title: Int array iteration?
favorite count: 0
tagged with: iteration
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41442798
score: 2

http://stackoverflow.com/a/26504133
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26504072
has comment: http://stackoverflow.com/comment/41639664
upvote count: 2
has body: Get a System line separator instead of using '\n' String newLine = System.getProperty("line.separator"); Pattern ena = Pattern.compile("S[a-zA-z]{2}ei"); if(ena.matcher(tretja_beseda).matches()){ fw.write(prva_beseda + newLine);} Pattern dva = Pattern.compile("P[a-zA-z]{3}ei"); if(dva.matcher(tretja_beseda).matches()){ fw.write(prva_beseda + newLine); }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26504072

http://stackoverflow.com/comment/41498666
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26426738
type: QuestionComment
has text: and the manifest file is ended by a new line? This is important.

http://stackoverflow.com/q/26380564
has answer: http://stackoverflow.com/a/26380850
has answer: http://stackoverflow.com/a/55185354
score: 0
answer count: 3
tagged with: web.xml
linked to: http://stackoverflow.com/q/26375573
tagged with: spring
has answer: http://stackoverflow.com/a/26382454
accepted answer: http://stackoverflow.com/a/26382454
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1234298
possible better answer: http://stackoverflow.com/a/26380850
has title: No mapping found for HTTP request with URI [/myapp/img/logout.png]
tagged with: java
has body: I am writing spring mvc application. I had asked this question should I make two different servlet entry for rest and normal html in web.xml, and it got resolved by the answers given by knowledgeable people present over stackoverflow (Answer: should I make two different servlet entry for rest and normal html in web.xml) Now my web.xml include below code myapp org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring_myapp-servlet.xml 1 myapp / But after making changes to web.xml as mentioned in the answer, I am getting error No mapping found for HTTP request with URI [/myapp/img/logout.png]. I am not able to load any of the css, js as well as images. I searched for this issue and got the answer https://stackoverflow.com/a/17946825/3898076. If you find this question duplicate then please share the solution for it. I am not able to figure out my mistake. Can you please help me out with this issue. Note: I am including files as . Thanks.
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/17897790

http://stackoverflow.com/a/76539571
score: 1
upvote count: 1
has body: In your formatter you are using Ms which doesn't add the milliseconds. Instead, you may want to use SSS.
type: Answer
answers question: http://stackoverflow.com/q/26400779
downvote count: 0

c++
tags question: http://stackoverflow.com/q/26477300
tags question: http://stackoverflow.com/q/26419763
tags question: http://stackoverflow.com/q/26447137
tags question: http://stackoverflow.com/q/26354559
tags question: http://stackoverflow.com/q/26358380
tags question: http://stackoverflow.com/q/26410408
tags question: http://stackoverflow.com/q/26403823
tags question: http://stackoverflow.com/q/26500962
tags question: http://stackoverflow.com/q/26369950
tags question: http://stackoverflow.com/q/26477340
type: Tag
tags question: http://stackoverflow.com/q/26507231
tags question: http://stackoverflow.com/q/26431950
tags question: http://stackoverflow.com/q/26412295
tags question: http://stackoverflow.com/q/26398063
tags question: http://stackoverflow.com/q/26445268
tags question: http://stackoverflow.com/q/26428468
tags question: http://stackoverflow.com/q/26415393
tags question: http://stackoverflow.com/q/26378274
tags question: http://stackoverflow.com/q/26356506
tags question: http://stackoverflow.com/q/26476628
tags question: http://stackoverflow.com/q/26479116
tags question: http://stackoverflow.com/q/26436810
tags question: http://stackoverflow.com/q/26380923
tags question: http://stackoverflow.com/q/26487437
tags question: http://stackoverflow.com/q/26465624
tag name: c++
tags question: http://stackoverflow.com/q/26485650

http://stackoverflow.com/q/26379501
tagged with: xuggler
score: 0
has answer: http://stackoverflow.com/a/32688870
answer count: 1
type: UnansweredQuestion
has title: Access violation in Xuggler - cannot write minidump
has body: The code snippet below is to extract audio from video file. The work environment is Eclipse Luna on Windows 7. import com.xuggle.mediatool.*; import com.xuggle.xuggler.ICodec; public class VideoToAudio{ public void convertVideoToAudio(){ IMediaReader reader = ToolFactory.makeReader("D://vid.mp4"); IMediaWriter writer = ToolFactory.makeWriter("D://a.mp3",reader); int sampleRate = 44100; int channels = 1; writer.addAudioStream(0, 0, ICodec.ID.CODEC_ID_MP3, channels, sampleRate); while (reader.readPacket() == null); } public static void main(String [] args){ VideoToAudio vta = new VideoToAudio(); vta.convertVideoToAudio(); } } The error generated for the code is as follows: A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006ee76520, pid=13968, tid=7220 # # JRE version: Java(TM) SE Runtime Environment (8.0_20-b26) (build 1.8.0_20-b26) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.20-b23 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [xuggle4458410956560120581.dll+0x736520] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows I followed a series of actions one after the another to fix the error: Configured Windows to create MiniDump files after looking into link Removed metadata folder from workspace and imported project again to eclipse. Still the above error persists. Could someone fix the error?
tagged with: java
tagged with: minidump
tagged with: eclipse
linked to: http://stackoverflow.com/q/30457570
type: Question

ancestor
tags question: http://stackoverflow.com/q/26392862
tag name: ancestor
type: Tag

http://stackoverflow.com/comment/41604054
type: QuestionComment
comment on: http://stackoverflow.com/q/26484540
type: Comment
has text: Is this the above code that triggers an infinite loop ?
score: 0

http://stackoverflow.com/comment/41567962
has text: could you show me an example of creating and starting a thread object outside main function
comment on: http://stackoverflow.com/a/26464722
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41493285
comment on: http://stackoverflow.com/a/26423867
type: Comment
has text: You should mark the question as duplicate instead ...
type: AnswerComment
score: 0

http://stackoverflow.com/a/26508286
score: 0
has body: You'd be better off with having each list of grades as an ArrayList&lt;Double&gt; rather than a double[]. It's very hard work on the JVM (and on the programmer!) having to copy the whole array each time so that you can increase its length and add a new one. If you use an ArrayList&lt;Double&gt; gradeList, then you can just gradeList.add(grade); without needing to do all the copying. I would also consider having the larger structure as a Map rather than an array. So rather than having a two-dimensional array, you could have a HashMap&lt;Character,List&lt;Double&gt;&gt; that maps the row onto the list of grades for that row. That avoids having to convert between characters and doubles, which you're currently (implicitly) doing. Finally, the addGrade() method ought to take a char and a double (a row and a new grade), rather than a String: you're making a lot of work for yourself with having to process inappropriate data structures. Once you've done this, calling addGrade for each item should be fairly easy. Once you've extracted a String representing a particular grade (say, String gr = "e77.5") then you can add to the list inside your HashMap gradeMap like this: char row = gr.charAt(0); double grade = Double.parseDouble(gr.substring(1)); gradeMap.get(row).add(grade); I think you'll need to supply more info if you need more help than that.
answers question: http://stackoverflow.com/q/26508058
type: Answer
has comment: http://stackoverflow.com/comment/41648138
has comment: http://stackoverflow.com/comment/41647224
has comment: http://stackoverflow.com/comment/41647669
has comment: http://stackoverflow.com/comment/41647315

http://stackoverflow.com/q/26485413
has body: I retrieve data from java then insert into Oracle, problem is oracle took "" values then convert it into NULL into the table. this is unwanted behaviour, and it cause problems when I retrieve it from the oracle again, which I am expecting a "" rather than NULL I prefer a elegant solution setting something on the oracle server side. a global config or something rather than putting millions of if statements into my Java code.
score: 2
type: AnsweredQuestion
has title: Oracle Turns "" into NULL
linked to: http://stackoverflow.com/q/203493
upvote count: 2
tagged with: java
duplicate of: http://stackoverflow.com/q/203493
type: Question
has answer: http://stackoverflow.com/a/26485681
accepted answer: http://stackoverflow.com/a/26485493
linked to: http://stackoverflow.com/q/13278773
possible better answer: http://stackoverflow.com/a/26485681
has comment: http://stackoverflow.com/comment/41605245
answer count: 2
downvote count: 0
tagged with: mybatis
favorite count: 0
has comment: http://stackoverflow.com/comment/41605253
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/41610104
has answer: http://stackoverflow.com/a/26485493

http://stackoverflow.com/a/26391103
answers question: http://stackoverflow.com/q/26389679
upvote count: 20
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41436961
has comment: http://stackoverflow.com/comment/41436367
type: Answer
has comment: http://stackoverflow.com/comment/41435755
has body: After a short discussion in comments it seems (according to this instructions) that You need add the following task to build.gradle file: task stage(type: Copy, dependsOn: [clean, build]) { from jar.archivePath into project.rootDir rename { 'app.jar' } } stage.mustRunAfter(clean) clean &lt;&lt; { project.file('app.jar').delete() } And the content of Procfile will be: web: java $JAVA_OPTS -jar app.jar Now it should work fine. Explanation: Task stage prepares jar file to be run. After it's finished the output jar is copied into project.rootDir and renamed to app.jar. It guarantees that it will have always the same name and can be easily run with the command from Procfile. stage task also depends on clean (which has an additional action to remove app.jar) and build (which builds the app). It's important to set stage.mustRunAfter(clean) because otherwise the order in which tasks are run is not determined (this probably happens now - check it locally). What I mean is if just dependsOn is specified build may be run, then clean and finally stage - and nothing is created. I hope it's clear.
has comment: http://stackoverflow.com/comment/41435651
score: 20
has comment: http://stackoverflow.com/comment/41436154
accepted answer of: http://stackoverflow.com/q/26389679

http://stackoverflow.com/a/26439487
upvote count: 23
accepted answer of: http://stackoverflow.com/q/26429751
answers question: http://stackoverflow.com/q/26429751
score: 23
has comment: http://stackoverflow.com/comment/41534069
has comment: http://stackoverflow.com/comment/41541633
has comment: http://stackoverflow.com/comment/41532735
has body: Apache HttpClient does not implement any of the TLS protocol aspects. It relies on JSSE APIs to do TLS/SSL handshaking and to establish secure SSL sessions. With the exception of SSL hostname verification logic, as far as TLS/SSL is concerned Apache HttpClient is as secure (or as vulnerable) as the JRE it is running in. Update: HttpClient 4.3 by default always uses TLS, so, unless one explicitly configures it to use SSLv3 HttpClient should not be vulnerable to exploits based on POODLE . This turned out to be wrong. One MUST explicitly remove SSLv3 from the list of supported protocols! SSLContext sslContext = SSLContexts.custom() .useTLS() // Only this turned out to be not enough .build(); SSLConnectionSocketFactory sf = new SSLConnectionSocketFactory( sslContext, new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"}, null, SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); CloseableHttpClient client = HttpClients.custom() .setSSLSocketFactory(sf) .build(); Update 2: As of version 4.3.6 HttpClient disables all versions of SSL (including SSLv3) by default.
has comment: http://stackoverflow.com/comment/41522993
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41529687
type: Answer
has comment: http://stackoverflow.com/comment/41531529

http://stackoverflow.com/comment/41575762
comment on: http://stackoverflow.com/q/26467439
type: Comment
type: QuestionComment
has text: One thing that I don't see mentioned: when you transfer the file with a regular FTP client rather than your Java code, the decryption does succeed? It would be such a shame if the file is broken to begin with or you need a specific public key to decrypt it.
score: 0

http://stackoverflow.com/q/26482389
has title: Java- feasibility of session timeout limit
has answer: http://stackoverflow.com/a/26482540
possible better answer: http://stackoverflow.com/a/26482461
accepted answer: http://stackoverflow.com/a/26482869
tagged with: spring
has answer: http://stackoverflow.com/a/26482461
answer count: 4
type: AnsweredQuestion
has body: Is it feasible to set unlimited session time out programmatically using HttpSession. setMaxInactiveInterval(int seconds) or using -1 ? Will this lead to any overhead?
score: 0
has answer: http://stackoverflow.com/a/26482483
tagged with: tomcat7
type: Question
tagged with: session
tagged with: java
has comment: http://stackoverflow.com/comment/41600692
has answer: http://stackoverflow.com/a/26482869

http://stackoverflow.com/q/26422802
has comment: http://stackoverflow.com/comment/41491350
has comment: http://stackoverflow.com/comment/41491299
tagged with: stored-procedures
answer count: 0
score: 0
tagged with: java
has title: how to pass another database in stored procedure as a parameter in java
has comment: http://stackoverflow.com/comment/41491126
type: Question
has comment: http://stackoverflow.com/comment/41491934
has comment: http://stackoverflow.com/comment/41491800
tagged with: sql
has body: i want to pass another database to the stored procedure in java like call Sel_RptDaywiseProduction(?) how to pass DIERP database in this SP in java in callable statement please help thank you. Edit: code from the comment CallableStatement cs = con.prepareCall("{call Sel_RptDaywiseProduction(?)}"); cs.setString(1, "DIERP"); ResultSet rs1 = cs.executeQuery(); while (rs1.next()) { System.out.println("mat_code = "); }
has comment: http://stackoverflow.com/comment/41491335
type: UnansweredQuestion

http://stackoverflow.com/a/26492787
has comment: http://stackoverflow.com/comment/41661963
has body: Any chance you could post the code you are using? You could try doing a string.replace() and replace the 'br' tags with \n. Or, you can just keep the HTML tags and Java will recognize the tags. Just enclose the text in HTML tags: string x = "&lt;html&gt;" + yourHTML + "&lt;/html&gt;"; Not sure about the empty lines at the bottom without seeing your code.
has comment: http://stackoverflow.com/comment/41623169
score: 0
answers question: http://stackoverflow.com/q/26492401
has comment: http://stackoverflow.com/comment/41624145
type: Answer
has comment: http://stackoverflow.com/comment/41662784

http://stackoverflow.com/comment/41579566
comment on: http://stackoverflow.com/q/26470980
has text: Try to use [Joda](http://www.joda.org/joda-time/) library
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/110411458
has text: This reply is valuable for providing a working example with data-source-properties!
type: AnswerComment
comment on: http://stackoverflow.com/a/54599849
type: Comment
score: 1

http://stackoverflow.com/comment/41480617
has text: Yeah I want to make an answer for that but I think I just want to confirm it to you first, because I don't see any problem when you are trying to display it using picasso
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26416263
type: QuestionComment

http://stackoverflow.com/comment/41515951
type: AnswerComment
has text: In this question, you wouldn't use pass-by-reference. You'd only use pass-by-value-result. You use pass-by-reference in other scenarios where you want to commit the modification immediately. Note that, in multithreading scenarios, using pass-by-reference also requires that reads/writes of the reference are synchronized (or that the item being written is volatile and written atomically) to ensure that reads do not see the value in an invalid, partially written state.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26427203

http://stackoverflow.com/comment/41604296
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26484810
score: 0
has text: I wouldn't advice using `@Embeddable` it means you can logically create two objects of the table hibernate created for you. That means the tables are not normalized. I would suggest to have a `@OneToOne` relationship rather.

http://stackoverflow.com/q/26454471
score: -1
type: Question
answer count: 1
has title: Write a method to compute all permutations of a string of unique characters
tagged with: arraylist
has answer: http://stackoverflow.com/a/26454563
downvote count: 1
accepted answer: http://stackoverflow.com/a/26454563
has body: When I test it with 5 elements set, I get the following exception: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 4, Size: 2 Here is the code: static ArrayList&lt;ArrayList&lt;Integer&gt;&gt; permutation(ArrayList&lt;Integer&gt; set){ ArrayList&lt;ArrayList&lt;Integer&gt;&gt; permutations = new ArrayList&lt;ArrayList&lt;Integer&gt;&gt;(); if (set.size() &lt;= 1) { permutations.add(set); return permutations; } for (int element : set){ ArrayList&lt;Integer&gt; setcopy = new ArrayList&lt;Integer&gt;(); setcopy.addAll(set); setcopy.remove(element); add(permutations, element, permutation(setcopy)); } return permutations; } static void add(ArrayList&lt;ArrayList&lt;Integer&gt;&gt; permutations, int element, ArrayList&lt;ArrayList&lt;Integer&gt;&gt; setcopy){ for (ArrayList&lt;Integer&gt; al : setcopy){ ArrayList&lt;Integer&gt; p = new ArrayList&lt;Integer&gt;(); p.add(element); p.addAll(al); permutations.add(p); } }
favorite count: 0
upvote count: 0
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/41549860

http://stackoverflow.com/q/26502955
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41637765
has comment: http://stackoverflow.com/comment/41638152
tagged with: spring
has comment: http://stackoverflow.com/comment/41640194
has comment: http://stackoverflow.com/comment/41639805
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41637941
type: Question
has body: I have some simple class Man which contain constructors, getters and setters public class Man { @Size(min = 3, max = 20, message = "Username must be between 3 and 20 characters long.") @Pattern(regexp="^[a-zA-Z0-9]+$", message = "Username must be alphanumeric with no spaces") private String name; @Size(min = 1, max = 2, message = "Age must be between 1 and 2 characters long") @Pattern(regexp = "^[0-9]+$", message = "Age must be numerical with no spaces") private String age; Man(){ } Man(String name, String age){ super(); this.name = name; this.age = age; } public String getName(){ return name; } public String getAge(){ return age; } public void setName(String name){ this.name = name; } public void setAge(String age){ this.age = age; } } it service: @Service public class ManService { Map<String, Man> people = new HashMap(); public void saveMan(Man man){ System.err.println(man); // after the form is submitted object is created System.err.println(man.getName()); // but it name == null System.err.println(man.getAge()); // and age == null people.put(man.getName(), man); } } common controller. When go to /user?new, will be created object Man() and inserted into box modelAttribute, but after the form will be commited, name and age Man() object's fields will be equal null values. @RequestMapping(value="/user", method = GET, params = "new") public String outputParam(Model model){ model.addAttribute("box",new Man()); return "param"; } @RequestMapping(value="/user", method = POST) public String addFromForm(@Valid Man man, BindingResult bindingResult){ if (bindingResult.hasErrors()) { return "param"; } manService.saveMan(man); return "redirect:../list"; } view: <sf:form method="POST" modelAttribute="box" enctype="multipart/form-data"> <sf:label path="name">User name:</sf:label> <sf:input path="name" size="15" /> <sf:errors path="name" cssClass="error"/> <sf:label path="age">Age:</sf:label> <sf:input path="age" size="20" /> <sf:errors path="name" cssClass="error"/> </sf:form> In…
downvote count: 0
answer count: 1
has title: spring mvc. POST form doesn't bind
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26503292
has answer: http://stackoverflow.com/a/26503292

http://stackoverflow.com/q/26413871
tagged with: java
accepted answer: http://stackoverflow.com/a/26413974
type: Question
has answer: http://stackoverflow.com/a/26414003
has comment: http://stackoverflow.com/comment/41476345
tagged with: class
has title: Java : Duplication of methods
answer count: 3
has comment: http://stackoverflow.com/comment/41475817
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26413974
upvote count: 2
possible better answer: http://stackoverflow.com/a/26413937
has answer: http://stackoverflow.com/a/26413937
score: 2
type: AnsweredQuestion
has body: This feels like such a basic question but this is all new for me: I have a Person and Room class, both of which have a list of Item objects. public class Person{ private ArrayList&lt;Item&gt; items; public Person() { items = new ArrayList&lt;&gt;(); } public void addItem(){ ... } public void removeItem(){ ... } } public class Room { private ArrayList&lt;Item&gt; items; public Room () { items = new ArrayList&lt;&gt;(); } public void addItem(){ ... } public void removeItem(){ ... } } The item methods e.g. addItem() are duplicated in both the Room class and the Person class which wasn't very nice. I thought about making a separate Inventory class which has a list of items and item methods and then every room and person would have an inventory. But then I wouldn't be able to call the Item methods from a Person or Room if I use a private Inventory field. What's the best way to stop duplication here? Thanks in advance!
tagged with: oop

http://stackoverflow.com/q/26499092
has answer: http://stackoverflow.com/a/26499140
tagged with: loops
type: Question
answer count: 2
has title: adding to a class using a loop
downvote count: 0
has comment: http://stackoverflow.com/comment/41630966
has comment: http://stackoverflow.com/comment/41631394
tagged with: class
has comment: http://stackoverflow.com/comment/41631267
has answer: http://stackoverflow.com/a/26499363
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41631380
has body: I'm working on a project at the moment that involves reading data from a text file and storing it as a new Class. In order to get it all done easily, I figured it best to use a while loop like the following: while (text.hasNextLine()) { System.out.print("Please enter class name: "); tempName = kb.next(); //sort text into parts for the class Class (tempName?) = new Class(); } kb is the Scanner, tempName is a String variable. Would a code like that work? I figured I can't just go "Class name = new Class" because each time the loop ran, it would overwrite the previous data, where-as I need to store all the data. It would be better if I could just get it to go "Class name(x) = new Class" where x is an int variable that increases each time the loop runs, but I'm not sure if that would work either. If it wouldn't work, an alternative way to do this would be appreciated. I'm also not sure how to validate the Class name so that data isn't accidentally overwritten. Please note: I can't use ArrayList, as the project's instructions forbids "dynamic data structures such as arraylists", so basic Java code is all I am allowed to use. EDIT: Here's one of the classes I have to use. public class Customer_16997761 { private int customerID; private String surname; private String firstname; private String address; private String suburb; private int postcode; //Bunch of get methods } The text file I have has a bunch of lines with those variables listed in that order. I need to read the line, split it into the parts, store it as a new Customer, then rinse and repeat until the end of the file.
tagged with: java

http://stackoverflow.com/comment/41457889
comment on: http://stackoverflow.com/a/26366917
has text: I looked at this issue a while ago and saw what was needed to fix it, but didn't bother. Not a single customer (out of 380K+) using my viewers have told me they need it. I did recently rewrite my LZW decoder to do away with the dictionary and doubled the speed in the process. Not terribly valuable to anyone, but this is the kind of stuff that occupies my mind :)
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26450937
has comment: http://stackoverflow.com/comment/41544059
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41545886
has comment: http://stackoverflow.com/comment/41543716
has comment: http://stackoverflow.com/comment/41545333
accepted answer of: http://stackoverflow.com/q/26450906
has comment: http://stackoverflow.com/comment/41543762
upvote count: 1
answers question: http://stackoverflow.com/q/26450906
type: AcceptedAnswer
has body: that's because of me&amp;field=id must be me?field=id https://graph.facebook.com/v2.1/me?fields=id&amp;access_token=accesstoken for all public user information https://graph.facebook.com/v2.1/me?access_token=accesstoken i would recommend you to use Facebook SDK. see Using the Graph API Example graph api me request with facebook sdk: new Request( Session.getActiveSession(), "/me", null, HttpMethod.GET, new Request.Callback() { @Override public void onCompleted(Response response) { GraphObject graphObject = response.getGraphObject(); if (graphObject != null) { if (graphObject.getProperty("id") != null) { String fbId = graphObject.getProperty("id").toString(); String userName = graphObject.getProperty("name").toString(); } } } } ).executeAsync();

http://stackoverflow.com/a/26359643
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41377691
has body: @Formula is used id for: If we want to apply a virtual property in your entity to get a calculated value, we can use @Formula annotation to set the formula. This formula can be as complex as we want. @Column(name="length") private int length; @Column(name="width") private int width; @Formula(" length * width ") public long area; To calculate anything using your own formula @Index is used for: @Index applies the index at property level. If the property of an entity is annotated with @Index, an index with the given name will be applied on the column. @Column(name="name") @Index(name="nameIndex") private String name;
answers question: http://stackoverflow.com/q/26358973

http://stackoverflow.com/comment/41395430
type: Comment
has text: Homework hint: define a variable scoped to your main method, add user input to the variable (String.concat() is one way), and output to screen.
type: QuestionComment
comment on: http://stackoverflow.com/q/26369078
score: 0

http://stackoverflow.com/comment/41382259
type: QuestionComment
comment on: http://stackoverflow.com/q/26361736
type: Comment
has text: Most people don't like vague questions I advise you follow the [oracle DOM tutorial](http://docs.oracle.com/javase/tutorial/jaxp/dom) then ask a specific question
score: 0

http://stackoverflow.com/comment/41583991
comment on: http://stackoverflow.com/a/26473253
score: 0
type: AnswerComment
has text: That didn't work EDIT: Specifically, I'm looking to check the components of a JPanel and need to know how to reference it if it's empty. In this example tiles[3][3] IS empty. I just need to know how to reference it within the if statement.
type: Comment

http://stackoverflow.com/comment/41420978
comment on: http://stackoverflow.com/a/26383277
type: AnswerComment
score: 0
type: Comment
has text: sampleDao.getJdbcTemplate() is not possible as i mentioned in very first. getJdbcTemplate() is no where related to interface SampleDao... As a work-around I already did with mocking SampleDaoImpl as mentioned by @Duncan. But looking for better approach.

http://stackoverflow.com/comment/41677243
score: 0
type: AnswerComment
type: Comment
has text: Edited to Fix it. Thanks!
comment on: http://stackoverflow.com/a/26504703

http://stackoverflow.com/q/26424221
has title: JVM memory cleaned up without any GC activity
score: 4
upvote count: 4
tagged with: permgen
has comment: http://stackoverflow.com/comment/41496611
tagged with: groovy
has answer: http://stackoverflow.com/a/26481586
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41497178
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has body: I am currently running a long running JVM application (that includes groovy classes), and I have observed some strange behaviour. I run the application and update my Groovy classes (correctly cleaning up metaclass info etc - I know there isn't a leak) so I know there are several classes that could be collected from permgen (normally I observe that permgen isn't collected eagerly - i believe it is just full GC that collects permgen, so not unusual for this state). The oddity is that if I leave the application running with no activity, after about an hour or so there is a sudden drop in memory usage (heap and permgen, but most pronounced in permgen), but visualvm reports no GC/CPU activity has happened. Below is the screenshot of my visualvm logging My question is how is there such a big drop (~80mb) in permgen with no registered GC activity? visualvm does normally log GC/CPU activity pretty well.
tagged with: java
type: Question

http://stackoverflow.com/a/26411277
answers question: http://stackoverflow.com/q/26403051
type: AcceptedAnswer
downvote count: 0
has body: This is an issue in the client, there's a line missing in https://github.com/droolsjbpm/droolsjbpm-integration/blob/6.2.0.Beta3/kie-remote/kie-remote-client/src/main/java/org/kie/services/client/api/command/TaskServiceClientCommandObject.java#L261 It should also do cmd.setData(values). Fixing on master now.
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26403051

http://stackoverflow.com/comment/41406811
has text: Yes, you need to translate the source point to it's parent context...see answer for examples...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26375259

http://stackoverflow.com/q/26444794
favorite count: 0
type: Question
has body: How do I replace the number that the user inputs as their choice with the actual corresponding string that their choice means in the print line. import java.util.Scanner; public class MagicGame { public static void main(String [] args) { String name; int userCharacter; int armorChoice; int weaponChoice; Scanner input = new Scanner(System.in); System.out.println("Please enter your name"); name = input.nextLine(); { System.out.println("Please select the character you would like to play:" + '\n' + "1 for Magic User" + '\n' + "2 for Fighter" + '\n' + "3 for Thief" + '\n' + "4 for Druid" ); userCharacter = input.nextInt(); System.out.println("Please select your Armor Type:" + '\n' + "1 for Steel plate – Armor Class 10" + '\n' + "2 for Chain mail – Armor Class 5" + '\n' + "3 for Leather armor – Armor Class 3" + '\n' + "4 for A robe – Armor Class 1"); armorChoice = input.nextInt(); System.out.println("Please choose a Weapon:" + '\n' + "1 for Sword" + '\n' + "2 for Short Sword" + '\n' + "3 for Scimitar" + '\n' + "4 for Dagger"); weaponChoice = input.nextInt(); System.out.println("Hello " + name + "! You chose to play a " + userCharacter + "." + '\n' + "Your armor is" + armorChoice + "." + '\n' + "You will be fighting with a " + weaponChoice + "."); } } It is longer but I had to trim it down.
has comment: http://stackoverflow.com/comment/41532292
has comment: http://stackoverflow.com/comment/41532394
has answer: http://stackoverflow.com/a/26444827
tagged with: java
has comment: http://stackoverflow.com/comment/41532266
upvote count: 1
linked to: http://stackoverflow.com/q/4105331
answer count: 1
downvote count: 7
has comment: http://stackoverflow.com/comment/41532373
score: -6
has title: How do i rename a integer to a string
has comment: http://stackoverflow.com/comment/41532398
has comment: http://stackoverflow.com/comment/41532239
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41532457

http://stackoverflow.com/a/26500030
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26499484
has body: I made a few changes to your code, first to the map loading function, so that every element had a position. You can get rid of this and use rheStack.push(new Position(row,col)); but i was too lazy. for(int row = 0; inLine != null &amp;&amp; row &lt; numRows; row++) { inLine = inFile.readLine(); tokens = inLine.trim().split("\\s+"); for(int col = 0; col &lt; numCols; col++) { maze[row][col] = new MazeElement(tokens[col].charAt(0),new Position(row,col)); } } The next change is to the backtracking code. Now in essence you can backtrack using only a stack, however it is not enough to just store the places you have been. For example, after if you first went east and then west, then you need to store that on the stack as well. This makes backtracking more complicated, however programming languages gives us a much easier way of dealing with stacks - recursion. All the parameters passed to a function, and all the temporaries it creates, are stored on a special stack - the program stack. This is the same stack referenced in StackOverflow. Therefore recursive functions have all the same strucutre as a backtracking alogorithm. So I broke you backtracking algorithm to make it recursive public void backTracking() { Stack&lt;Position&gt; theStack = new Stack&lt;Position&gt;();//initialise stack theStack.push(start); //pass it the stack and the goal backTrackingRecursive(theStack, exit); } public boolean backTrackingRecursive(Stack&lt;Position&gt; theStack, Position goal) { //displayMaze(); Position curr = theStack.top(); int currRow = curr.getRow(); int currCol = curr.getCol(); //setting visited positions to '.', open = '0', wall = '1', exit==goal = 'e' for(int i = 0; i != 4; i++) { //forget this code, it is only to avoid writing out north, south, etc int col = currCol; int row = currRow; if(i%2 == 1) col += ((i==1)?1:-1); else row += ((i==2)?1:-1); //check it is a valid position, if not continue if(row &lt; 0 || row &gt;= numRows || col &lt; 0 || col &gt;= numCols) continue; Maz…

http://stackoverflow.com/comment/42154720
type: Comment
type: QuestionComment
has text: Thanks man, I am happy to help you solve the problem :)
comment on: http://stackoverflow.com/q/26446808
score: 0

http://stackoverflow.com/q/26403393
has title: How to login to Gmail account in SWT browser?
tagged with: browser
score: 0
answer count: 2
type: UnansweredQuestion
has body: I have an embedded SWT browser in my Java application.I want to directly login to my gmail account in this browser given username and password .I dont want to see the login page in the browser and i want to go directly to the mail.Is this possible?What do i set the URL to?Is it possible by taking help of javascript? import org.eclipse.swt.SWT; import org.eclipse.swt.browser.Browser; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.*; public class Dummy2 { public static void main(String args[]) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Browser b= new Browser(shell,SWT.NONE); b.setUrl("www.Gmail.com"); //b.setText("&lt;html&gt;&lt;body&gt; Helllooooooooooooo &lt;/body&gt;&lt;/html&gt;"); shell.open(); while (!shell.isDisposed()) { //while (BGTrayApp.isOpen) { if (!display.readAndDispatch()) display.sleep(); } } }
tagged with: java
tagged with: swt
has answer: http://stackoverflow.com/a/26406292
has answer: http://stackoverflow.com/a/26406410
type: Question

http://stackoverflow.com/q/26411823
score: 2
upvote count: 2
tagged with: transactions
has body: I have method in my resources to creating users in bulk. I annotate my resource method with @UnitOfWork, but my specific service method for this operation are annotated too, because situation when only part of the users are saved is okey for me. Summarazing I have main transaction, and many nested transactions needed to save users separately. I noticed dropwizard can't begin transaction when my resource method is not annotated with @UnitOfWork and my service BulkSave method is. From logical point of view this should work but isn't working. I tried to set flush mode using @UnitOfWork, first I set FlushMode to Manual, and this was almost perfect. When nested transaction is rollback, main transaction can be commit, this is great solution. But this solution wasn't as good as I thought. Saving related entities using cascade don't work! Finally I have related entities which aren't saved, or error in main transaction when nested transaction is rollback (don't flush the Session after an exception occurs) Anyone had similar situation or know more about Session management in Dropwizard?
tagged with: java
tagged with: hibernate
has title: Dropwizard nested transactions
type: Question
has answer: http://stackoverflow.com/a/30885191
tagged with: dropwizard
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41487862
comment on: http://stackoverflow.com/q/26415550
type: Comment
type: QuestionComment
has text: Can you provide the compiler error!?
score: 0

http://stackoverflow.com/comment/41553689
comment on: http://stackoverflow.com/q/26456518
score: 1
has text: @user2884025 When it was designed, serialisation was used to transmit content over the wire, while this might still be possible, it's no longer consider a good idea to serialize the actual model, but the content instead. The model carries additional information which might not be serializable, like listeners, so the state can become unstable. Serialization of objects for their long term storage is also considered a bad idea and you should have a look at technologies like JAXB instead
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42178370
has text: Funny thing, i just tried it out and you are right - I don't get an exception when deserializing - I am already getting an exception when serializing. Why we should not serialize inner classes anyway, is described here: http://stackoverflow.com/a/17805016/1406325
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26386166

http://stackoverflow.com/a/26476019
upvote count: 5
has comment: http://stackoverflow.com/comment/41589210
downvote count: 1
has body: Try this, it should work: for(counter = 1; counter &lt;= 20; counter++){ factorials *= counter; System.out.printf("%4d%,30d\n", counter, factorials); } It is more "clean"(java standard) to have the for-loop like this: for(x; x&lt;=y; x++) and then between these {} have the other logic/calculations.
type: AcceptedAnswer
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26475985
has comment: http://stackoverflow.com/comment/41589265
accepted answer of: http://stackoverflow.com/q/26475985

http://stackoverflow.com/q/26423690
score: 1
duplicate of: http://stackoverflow.com/q/201323
tagged with: java
tagged with: email-validation
has answer: http://stackoverflow.com/a/26424114
type: Question
has body: I need to validate an email pattern which starts with an alphabat and ends with @gmail.com. Following is my code. public static boolean isValidEmail(String email) { String endPattern = "@gmail.com"; if(null == email){ return false; } if(email.length()&lt;10){ return false; } if(!email.endsWith(endPattern)){ return false; } String[] strArr = email.split(endPattern); String mailId = strArr[0]; if(!Character.isLetter((mailId.charAt(0)))){ return false; } return true; } Is there a better way to acheive this? A regex or a better code?
answer count: 6
has title: Validating email format in java
possible better answer: http://stackoverflow.com/a/26423716
upvote count: 1
has answer: http://stackoverflow.com/a/26424075
favorite count: 0
accepted answer: http://stackoverflow.com/a/26423799
has answer: http://stackoverflow.com/a/26424018
tagged with: regex
has answer: http://stackoverflow.com/a/26423837
has answer: http://stackoverflow.com/a/26423799
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26423716
downvote count: 0

http://stackoverflow.com/comment/41608293
comment on: http://stackoverflow.com/q/26467439
type: Comment
type: QuestionComment
has text: ... no, but aren't you getting that error while decrypting the file? You are not answering my question in any way either.
score: 0

http://stackoverflow.com/comment/41602633
comment on: http://stackoverflow.com/a/26480427
has text: Have you correctly mocked the DaoManager before? Before defining the expected behavior (when...thenReturn), you should do DaoManager daoMock = mock(DaoManager.class). I edited the example in my answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41558410
type: AnswerComment
comment on: http://stackoverflow.com/a/26459098
type: Comment
has text: If you wanted to get all OCD then you could also check that the passed in param does not already match what is in the class variable. IE. if it is the same don't change it. Some thing like.. ... && n if(newName != null && !newName.isEmpty() && !newName.equals(name)) {
score: 0

http://stackoverflow.com/a/26493023
has comment: http://stackoverflow.com/comment/41619750
type: Answer
answers question: http://stackoverflow.com/q/26492545
has comment: http://stackoverflow.com/comment/41694316
has body: Maybe declare an map of expected colors and use that for counting: public static void main(String[] args) { HashMap&lt;String, Integer&gt; allColorCount; //optionally pre-populate your map if you want it to be static colors allColorCount.put("blue", 0); //... repeat for all colors allColorCount.put("white", 0); /* * your orig code for populating your lists */ for(String s: list) { if(allColorCount.containsKey(s)) { allColorCount.put(s, allColorCount.get(s)++); } //or if you want to dynamically map your counts: else { allColorCount.put(s, 1); } } //then at the end: Set&lt;String&gt; colorSet = allColorCount.keyset(); for(String currColor : colorSet) { System.out.println(allColorCount.get(currColor) + " " + currColor + " Found"); } }
score: 0
has comment: http://stackoverflow.com/comment/41688021
has comment: http://stackoverflow.com/comment/41695075
has comment: http://stackoverflow.com/comment/41693041

http://stackoverflow.com/q/26404976
tagged with: java
has comment: http://stackoverflow.com/comment/41458714
has comment: http://stackoverflow.com/comment/41460613
downvote count: 1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/26405651
answer count: 1
has comment: http://stackoverflow.com/comment/41459515
has title: Java for loop/jvm broken?!? Increment operator inside loop does not increment after 1
has comment: http://stackoverflow.com/comment/41459358
accepted answer: http://stackoverflow.com/a/26405651
tagged with: jvm
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/41458756
has comment: http://stackoverflow.com/comment/41459147
has body: Striking the weirdest bit of code in the debugger and runtime. I have an ArrayList populated with 60 objects. When I iterate over this list and check the cards inside for uniqueness, the increment operator does not seem to work?!? This is my code that checks: public boolean isPresentOnce(PlayingCard cardToCheck) { int foundTimes = 0; for (int i=0;i&lt;playingCards.size();i++) { if (playingCards.get(i).equals(cardToCheck)) { foundTimes++; System.out.println("Found the card:"+foundTimes+":"+i); } } return foundTimes == 1; } I get this output: Found the card:1:0 Found the card:1:1 Found the card:1:2 Found the card:1:3 &lt;&lt;SNIP&gt;&gt; Found the card:1:56 Found the card:1:57 Found the card:1:58 Found the card:1:59 Why does my counter not get incremented over 1? I tried cleaning my workspace, tried doing a maven clean install, alternating the code by using +=1. and by using a little more complex double if statement. Nothing seems to work, this corner of the code somehow seems to be broken. When using the double if statement, a return statement simply does not exit the method. Some more side information: Using IntelliJ 13.1.5 with JRE 1.6.0_65 64bits with HotSpot on a MacBook Pro running 10.9.5. Population looks like this: private ArrayList&lt;PlayingCard&gt; generateCards() { ArrayList&lt;PlayingCard&gt; cards = new ArrayList&lt;PlayingCard&gt;(); for (int i = 0; i &lt; 60; i++) { PlayingCard playingCard = new PlayingCard(); List&lt;CardImage&gt; images = new ArrayList&lt;CardImage&gt;(); images.add(new CardImage(TokenColor.Blue, TokenType.Book)); images.add(new CardImage(TokenColor.Gray, TokenType.Chair)); playingCard.addImages(images); cards.add(playingCard); } return cards; } Apologies for the crappy code, this is a hobby project ;-)
has comment: http://stackoverflow.com/comment/41459514
has comment: http://stackoverflow.com/comment/41464645
type: AnsweredQuestion

http://stackoverflow.com/comment/41398731
type: Comment
has text: @StefanoGroenland: You're fixing things backwards. The solution is not to make stuff static but to fix your code so that you don't need static methods or fields. See edit.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26370064

http://stackoverflow.com/q/26481596
has title: Could not transfer artifact despite I see this jar inside my local repo
type: Question
has comment: http://stackoverflow.com/comment/41599185
has comment: http://stackoverflow.com/comment/41599218
has comment: http://stackoverflow.com/comment/41599750
score: 0
has body: I try to build my applivation and get followinf error message: [ERROR] Failed to execute goal on project XXX: Could not resolve dependencies for project XXX:1.0.0-SNAPSHOT: Failed to collect dependencies at com.day.cq:cq-i18n:jar:5.4.4: Failed to read artifact descriptor for com.day.cq:cq-i18n:jar:5.4.4: Could not transfer artifact com.day.cq:cq-i18n:pom:5.4.4 from/to repo1 (http://HOST.COM/content/groups/public/): Connection to http://HOST.COM refused: Connection refused: connect But on filesystem I see that this jar exists inside following folder: .m2\repository\com\day\cq\cq-i18n\5.4.4 How to fix this problem? update Tried to execute with -o option: Failed to execute goal on project XXXs: Could not resolve dependencies for project XXX:bundle:1.0.0-SNAPSHOT: Cannot access adobe (http://repo.adobe.com/nexus/content/groups/public/) in offline mode and the artifact com.day.cq:cq-i18n:jar:5.4.4 has not been downloaded from it before.
tagged with: dependencies
has comment: http://stackoverflow.com/comment/41599106
has comment: http://stackoverflow.com/comment/41624244
answer count: 0
linked to: http://stackoverflow.com/q/2529218
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/41628650
has comment: http://stackoverflow.com/comment/41599154
tagged with: java
has comment: http://stackoverflow.com/comment/41601827

http://stackoverflow.com/a/26505500
has comment: http://stackoverflow.com/comment/41643568
has comment: http://stackoverflow.com/comment/41643407
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26504267
has body: As you probably have understood, there is no groups or domains in Spring Security authentication. One way to go around this is to append the group name to the username (with a slash delimiter for example), so the username internally is "username/group". If you still want username and group to be separate fields in your login form, you can do a custom authentication filter like this to concatenate username and group: public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter { @Override protected String obtainUsername(HttpServletRequest request) { String username = super.obtainUsername(request); String group = request.getParameter("group"); username += "/" + group; return username; } } Then in your UserDetailsService you need to split them apart: public UserDetails loadUserByUsername(String username) { int index = username.indexOf("/"); String group = username.substring(index + 1); username = username.substring(0, index); // find the user by username and group }
upvote count: 2

http://stackoverflow.com/comment/41433345
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26389046
type: Comment
has text: Yes, I have part of code which trying to send data from different threads. Looks like this is not very correct approach:) Will it help if blocking calls will be replaced with future or writeCallbacks?

http://stackoverflow.com/a/26433983
downvote count: 0
has body: You can use this regex: ^(GO(?: ([A-Z])(?!.*\2))+)$ RegEx Demo
answers question: http://stackoverflow.com/q/26433864
type: Answer
upvote count: 6
score: 6
accepted answer of: http://stackoverflow.com/q/26433864
type: AcceptedAnswer

http://stackoverflow.com/comment/41634896
type: Comment
has text: Where's the *client* code that's calling it?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26501041

http://stackoverflow.com/comment/41653205
has text: Ok... after the downvotes. I can only guess what i did wrong. Didn't provide examples of what I've tried. And this looks like a `do my homework-question`. I'll fix my question
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26511506

http://stackoverflow.com/q/26453521
type: Question
tagged with: jtextpane
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/26454790
score: 0
tagged with: java
has title: JTextPane.setText(JTextPane.getText()) clear gaps in HTML mode
has body: When I use JTextPane and type some text in HTML editor mode JTextPane textPane = new JTextPane(); textPane.setContentType("text/html"); //... textPane.setText(textPane.getText()); Spaces at the beginning of lines are removed. Why?
accepted answer: http://stackoverflow.com/a/26454790
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/41586550
score: 0
has text: Reference values. *Shudder*.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26474562

http://stackoverflow.com/a/26485713
downvote count: 1
upvote count: 0
score: -1
has body: create Is wrong for hibernate.cfg.xml, use create instead.
type: Answer
answers question: http://stackoverflow.com/q/26484919

http://stackoverflow.com/q/26480405
type: Question
has comment: http://stackoverflow.com/comment/41596852
has comment: http://stackoverflow.com/comment/41596880
score: 1
tagged with: java
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26480469
favorite count: 0
has comment: http://stackoverflow.com/comment/41598469
has title: why two JRE are installed while installing java
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/33847568
has body: I installed jdk 1.8. While installing, two JRE were copied to my computer: The first is inside JDK folder and the second is outside .What's the purpose of having two JRE in the same Operating System . Isn't one JRE enough to handle all requests .
has answer: http://stackoverflow.com/a/33847568
accepted answer: http://stackoverflow.com/a/26480469
upvote count: 1

http://stackoverflow.com/q/26442211
answer count: 1
has comment: http://stackoverflow.com/comment/41527601
tagged with: jcombobox
upvote count: 2
has answer: http://stackoverflow.com/a/26446119
has comment: http://stackoverflow.com/comment/41528343
tagged with: swing
linked to: http://stackoverflow.com/q/14974228
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41594914
tagged with: java
has comment: http://stackoverflow.com/comment/41528898
type: Question
accepted answer: http://stackoverflow.com/a/26446119
has title: Adding JTable into JComboBox
downvote count: 0
favorite count: 0
has body: Is there anyone who know how to put JTable into JComboBox ? (just like date pickers) I saw many questions of Put JComboBox into JTable. but I want Opposite. I tried to change code of "put JComboBox into JTable" questions but I have no idea. Thanks if anyone can help me.
tagged with: jtable
tagged with: custom-controls

http://stackoverflow.com/comment/41496786
comment on: http://stackoverflow.com/q/26379889
type: Comment
type: QuestionComment
score: 1
has text: May be logging on client side is still the easiest option (http://hc.apache.org/httpclient-3.x/logging.html) by just passing JVM args with -D. Setting debug level logger on org.apache.http should give you all the data transferred including headers and content even if you use SSL.

http://stackoverflow.com/q/26367969
linked to: http://stackoverflow.com/q/26308699
has body: I've searched extensively online but all solutions I've found use two parameters to keep track of the size of the area being used. This would be easy if I was allowed to do that, but I'm not. As you can see below, the code lacks a stop value, because I have no idea how to retain the original information. This is the code on Wikipedia, you can see they use imin and imax for tracker variables: http://en.wikipedia.org/wiki/Binary_search_algorithm#Recursive My (very incorrect) code is below. The mid variable doesn't mean anything, because I don't know how to set low and high correctly if I'm not allowed to have any extra arguments in the function. public static int findRecursiveB( String s, char c) { int low = 0; int high = s.length()-1; int mid = (low+high)/2; if (s.charAt(mid) &lt; c) { return findRecursiveB(s.substring(low, mid), c); } else if (s.charAt(mid) &gt;= c) { return findRecursiveB(s.substring(mid+1, high), c); } else return mid; }
score: 0
has comment: http://stackoverflow.com/comment/41393102
has comment: http://stackoverflow.com/comment/41393144
answer count: 1
has comment: http://stackoverflow.com/comment/41393153
tagged with: java
has comment: http://stackoverflow.com/comment/41395742
has answer: http://stackoverflow.com/a/26368102
has comment: http://stackoverflow.com/comment/41393653
type: UnansweredQuestion
tagged with: binary-search
type: Question
has title: Recursive binary search -- Java

http://stackoverflow.com/a/27784433
answers question: http://stackoverflow.com/q/26471367
score: 1
has body: You need to use forward slashes to separate host from path and the different path elements. The way to specify a dos drive depends a bit on the SFTP server you use. Some of them use cygwin path like /cygdrive/c/temp, others use /C/Temp and some use a base directory somewhere below the base path. I am not sure if there is one which actually allows the drive letter with colon, but anyway in case you care, you need to escape the : (colon) with %3a (the hex code): sftp://user@ip/C%3a/temp If you do not want to quote all possible characters in an URL yourself, you can use the URI class like suggested in this answer: (But you need to make sure to start the path string with a / (slash) to make it absolute.) URI uri1 = new URI("sftp", "user:p@ssword", "127.0.0.1", -1, "/C:/temp", null, null); fsm.resolveFile(uri1.toString(), opts); or when you do not want to convert the local path, you can use: String path = new File("C:\\temp").toURI().getPath(); URI uri2 = new URI("sftp", "user:p@ssword", "127.0.0.1", -1, path, null, null); fsm.resolveFile(uri2.toString(), opts); Please let me know which path syntax works.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/41416061
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26380537
has text: If you need to read the file from a hard drive, the bottleneck is going to be I/O and parallelising won't help...

http://stackoverflow.com/comment/41404168
comment on: http://stackoverflow.com/q/26373809
type: Comment
type: QuestionComment
has text: I'd be concerned about the controller needing to be multi threaded, that seems wrong to me, but that's just me...
score: 2

http://stackoverflow.com/q/26470861
has answer: http://stackoverflow.com/a/26479028
has comment: http://stackoverflow.com/comment/41579402
has comment: http://stackoverflow.com/comment/41579996
has comment: http://stackoverflow.com/comment/41580303
has comment: http://stackoverflow.com/comment/41636924
score: 0
has comment: http://stackoverflow.com/comment/41580078
has comment: http://stackoverflow.com/comment/41579323
has comment: http://stackoverflow.com/comment/41582665
tagged with: android
tagged with: path
has comment: http://stackoverflow.com/comment/41579654
has comment: http://stackoverflow.com/comment/41648952
has comment: http://stackoverflow.com/comment/41647344
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/41579429
type: Question
linked to: http://stackoverflow.com/q/8474821
has title: Android Folder's File path
tagged with: java
has comment: http://stackoverflow.com/comment/41579313
has body: I have a text file residing in a folder which is in the same directory as the 'src' folder. How can I read a text file stored in there? I have already tried storing the file in assets, but since assets are not unzipped, it is inappropriate. Also, putting it in raw folder doesn't work. I need some way of getting an Inputstream object from the filename. Help will be appreciated.
has comment: http://stackoverflow.com/comment/41632327
answer count: 1

http://stackoverflow.com/comment/41588362
score: 0
has text: As I remember if jsp has error it is difficult to detect.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26475256

http://stackoverflow.com/a/26390470
upvote count: 1
answers question: http://stackoverflow.com/q/26390413
has comment: http://stackoverflow.com/comment/41434180
score: 1
has body: Your constructor's method is wrong, it should be: public BankDisplay(double checking,double saving) // Constructor for subclass { this.checking = checking; this.saving = saving; } You also should have a toString() function in your class for you to appropriately print objects. Such as: public String toString() { return String.format("Checking: %s\nSavings: %s\n", this.checking, this.saving); } Use like this: System.out.println(checking1.toString());
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41434331

http://stackoverflow.com/q/26458525
tagged with: spring
has answer: http://stackoverflow.com/a/75214802
score: 2
tagged with: java
tagged with: mysql
tagged with: spring-transactions
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/36298610
downvote count: 0
has body: This is my bean &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt; &lt;property name="defaultTimeout" value="400" /&gt; &lt;/bean&gt; Spring JpaTransactionManager default time out is -1.In my case I have overridden defaultTimeout with 400 sec.So,if I have overridden it then it will time out after specified defaultTimeout time. Looking at the code on DataSourceTransactionManager class int timeout = determineTimeout(definition); if (timeout != -1) { txObject.getConnectionHolder().setTimeoutInSeconds(timeout); } public void setTimeoutInSeconds(int seconds) { setTimeoutInMillis(seconds * 1000); public void setTimeoutInMillis(long millis) { this.deadline = new Date(System.currentTimeMillis() + millis); } } So if timeout value is not equal to -1 then timeout i have specified is multiple by 1000 and that is used for timeout.But,in case i have not overridden timeout value then it will be -1. So,when will be timeout occur for default value of -1 . Does it time out when MySql.Data.MySqlClient.MySqlException: Timeout expired exception is thrown? Any suggestions?
has title: When do spring transaction timeout for default value of -1?
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26456873
answer count: 1
tagged with: generics
accepted answer: http://stackoverflow.com/a/26456950
type: AnsweredQuestion
tagged with: enums
tagged with: java
type: Question
has title: Enumerating Enum class from type parameter
has body: Hi I'm trying to provide an enum to a generic class so I can iterate over the a set of members defined by the supplied Enum type parameter. I found a way to do this, but in order for it to work, I need to supply an arbitrary instance of the enum. public enum suits { spades, hearts, diamonds, clubs; } public static class Card&lt;E extends Enum&lt;E&gt;&gt; { public final EnumSet&lt;E&gt; suits; public Card(E instance) { EnumSet&lt;E&gt; mySet = EnumSet.allOf(instance.getDeclaringClass()); this.suits = mySet; } } Now I can do something like this: Card&lt;Suits&gt; myCard = new Card&lt;Suits&gt;(Suits.clubs); String names = ""; for (Suit s : myCard.suits) {names += s.name + "|";} // "spades|hears|diamonds|clubs| Here is the question: Can I do this without supplying an instance of the enum in the Card object constructor? What I would think ought to work is to replace instance.getDeclaringClass() with the type parameter when creating the enum, as in: EnumSet&lt;E&gt; mySet = EnumSet.allOf(E); but that gives a syntax error. Somehow it seems like it should be possible to get type type parameter without having to resort to supplying an enum instance and then calling getDeclaringClass().
has answer: http://stackoverflow.com/a/26456950
score: 0

http://stackoverflow.com/q/26503822
has body: I'm trying to clear a list, for which I need to clear the SharedPreference. But on doing so, I get a nullpointerexception. Here's my code. - MainActivity.savedLogName.edit().clear().commit(); MainActivity.savedLogNumber.edit().clear().commit(); MainActivity.savedLogTime.edit().clear().commit(); I've also tried using remove(), but the same error persists. Here's the code using remove() MainActivity.savedLogName.edit().remove("logName").commit(); MainActivity.savedLogNumber.edit().remove("logNumber").commit(); MainActivity.savedLogTime.edit().remove("logTime").commit(); Note - savedlogName, savedLogNumber and savedLogTime are static variables declared in MainActivity. I'm calling them from a different activity class. From MainActivity - savedLogName = PreferenceManager.getDefaultSharedPreferences(this); savedLogNumber = PreferenceManager.getDefaultSharedPreferences(this); savedLogTime = PreferenceManager.getDefaultSharedPreferences(this); logName = new ArrayList(Arrays.asList(TextUtils.split(savedLogName.getString("logName", null), ","))); logNumber = new ArrayList(Arrays.asList(TextUtils.split(savedLogNumber.getString("logNumber", null), ","))); logTime = new ArrayList(Arrays.asList(TextUtils.split(savedLogTime.getString("logTime", null), ","))); I want logName, logNumber and logTime to be intialized null if sharedPreference is empty. That doesn't happen. It just initializes to old values like it was never cleared.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26503902
tagged with: java
type: Question
answer count: 1
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/26503902
has title: SharedPreference clear() throwing nullpointerexception
has comment: http://stackoverflow.com/comment/41639097
tagged with: android

http://stackoverflow.com/comment/41644825
score: 0
has text: At the very least you should be able to understand the difference between the JSP and the HTML that is generated by it...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26507132

http://stackoverflow.com/comment/41531605
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26444108
has text: What do you mean by 'which one'? When i'm using the cursor, doesn't it automatically know that it's the KEY_WORKOUT_ID of the current object that needs to be updated?
type: AnswerComment

http://stackoverflow.com/comment/41595707
type: Comment
score: 0
has text: You can use SharedPreferences to store data that will be shared among all app activities
type: QuestionComment
comment on: http://stackoverflow.com/q/26479694

http://stackoverflow.com/a/27140353
has body: To understand rules around port binding and self-contained apps, it's helpful to view things from the perspective of the platforms designed to run 12-factor apps, like Heroku or Deis. These platforms are scaling applications at the process level. When processes are scaled up, the platform tries to place these additional workers behind the routing mesh so they can start serving traffic. If the app is not self-contained and, for example, is tightly coupled to a front-end Apache server using mod_jk -- it is not possible to scale by running more isolated worker processes. Port binding exists to solve the problem of "port brokering" at the platform level. If every application worker listened on port 80 there would be conflicts. To solve this, port binding is a convention whereby the application listens on a port the platform has allocated -- and which is passed in as a $PORT environment variable. This ensures a) the application worker listens on the right port and b) the platform knows where to route traffic destined for that worker.
score: 11
downvote count: 0
type: Answer
upvote count: 11
answers question: http://stackoverflow.com/q/26491425

http://stackoverflow.com/comment/41572527
has text: @ahsanawan it doesn't even result in what you wrote. The result is 2147483647, and not 2147483648.
comment on: http://stackoverflow.com/q/26467312
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/26476645
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/26476909
answer count: 1
score: -1
has title: Resizing Path2D circle by clicking and dragging its outer edge
has comment: http://stackoverflow.com/comment/41591538
has comment: http://stackoverflow.com/comment/41593052
favorite count: 0
has comment: http://stackoverflow.com/comment/41590636
tagged with: shapes
has comment: http://stackoverflow.com/comment/41590527
tagged with: swing
has answer: http://stackoverflow.com/a/26476909
has comment: http://stackoverflow.com/comment/41590391
has comment: http://stackoverflow.com/comment/41590592
has body: So, when I click and drag a Path2D circle on my JPanel, it is resizing. The problem is that when I initially click-and-drag it, the circle jumps to a smaller size, but then resized correctly as you click and drag. The easiest way to demonstrate is to run the runnable code below. I know I need to fix this code: @Override public void mouseDragged(MouseEvent e) { int mouseX = e.getX(); int mouseY = e.getY(); if (resizing) { System.out.println("resizing"); Rectangle bounds = shapes.get(currentIndex).getBounds(); int shapeX = bounds.x; int shapeY = bounds.y; shapes.get(currentIndex).reset(); shapes.get(currentIndex).append( new Ellipse2D.Double(shapeX, shapeY, mouseX - shapeX, mouseX - shapeX), true); repaint(); } } I'm not sure how, though. I am clicking on the outer edge of the circle, and then I am setting the length and width of the bounds of the circle to where the new mouse point is...but what I need to do is the the outer edge of the circle's coordinates to the new mouse points. Any ideas on how to compute the correct point? Full Code import java.awt.BasicStroke; import java.awt.Color; import java.awt.Cursor; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Panel; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Ellipse2D; import java.awt.geom.Path2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import static javax.swing.JFrame.EXIT_ON_CLOSE; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Editor { public static void main(String[] args) { new Editor(); } public Editor() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | Instantia…
linked to: http://stackoverflow.com/q/26456405
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41590498
tagged with: java
tagged with: jpanel
downvote count: 1

http://stackoverflow.com/comment/41548966
has text: Isnt the second else case redundant? +1 for nice explanation!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26454030

http://stackoverflow.com/comment/41628845
comment on: http://stackoverflow.com/a/26498001
type: AnswerComment
type: Comment
score: 2
has text: could you explained a little more simple.. sorry

http://stackoverflow.com/comment/41440028
comment on: http://stackoverflow.com/a/26375097
type: AnswerComment
has text: could you post a sample string which reflects the above?
type: Comment
score: 0

http://stackoverflow.com/comment/109827077
comment on: http://stackoverflow.com/q/26383926
score: 0
type: QuestionComment
has text: You're also ignoring the first character.
type: Comment

http://stackoverflow.com/q/26457921
has title: Is this a real warning or an over-sensitive lint?
accepted answer: http://stackoverflow.com/a/26458003
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/26458101
possible better answer: http://stackoverflow.com/a/26457981
type: Question
score: 3
has answer: http://stackoverflow.com/a/26457981
tagged with: java
has answer: http://stackoverflow.com/a/26458003
downvote count: 0
has body: I have this method: private Boolean compare(String property, String relationOperator, String operand) { Integer propertyValue = NumberUtils.toInt(property); Integer operandValue = NumberUtils.toInt(operand); switch (relationOperator) { case "&lt;": return propertyValue.compareTo(operandValue) &lt; 0; case "&lt;=": return propertyValue.compareTo(operandValue) &lt;= 0; /*WARN*/case "=": return propertyValue.compareTo(operandValue) == 0; case "&gt;=": return propertyValue.compareTo(operandValue) &gt;= 0; case "&gt;": return propertyValue.compareTo(operandValue) &gt; 0; case "!=": return propertyValue.compareTo(operandValue) != 0; } return Boolean.FALSE; } For the line marked /*WARN*/, FindBugs 3.0.0 tells me: Suspicious comparison of Integer references in com.foo.MyClass.compare(String, String, String) [Scariest(1), High confidence] I think the code is OK as I am comparing ints not Integers, so can I safely @SuppressWarnings on this line?
tagged with: findbugs
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/41451832
type: AnswerComment
comment on: http://stackoverflow.com/a/26400527
score: 0
type: Comment
has text: @ftr Thanks! I edited my answer taking into account your suggestions.

http://stackoverflow.com/q/26480338
tagged with: multipart
answer count: 1
tagged with: download
type: UnansweredQuestion
tagged with: spring
has title: Open the file in browser using Spring-MVC
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/7137634
has body: I am reading the file from the database and trying to open the file in browser. My code is below... when I am doing like this at that time file is automatically downloaded response.setContentType("application/octet-stream"); response.setHeader("Content-disposition", "inline; filename=\""+ docName + "\""); But when I am doing like this at that time file is opening in browser. response.setContentType("application/pdf"); response.setHeader("Content-disposition", "inline; filename=\""+ docName + "\""); It is happening due to mimetype "application/pdf". But in my application I don't know the file's mimetype. It can be anything like pdf, image, txt, doc etc. So, I want to keep my mimetype default that is "application/octet-stream" and I also want to open that file in browser. Please help me out. Thanks in advance...
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26483248
score: 0

http://stackoverflow.com/a/48216390
downvote count: 1
score: 1
has body: On the Jasper report designer; Right click on the TextField for the sentence Click show properties Next to the expression field open the expression editor Input the below statement on the expression editor $F{some_field}.substring(0,1).toUpperCase()+$F{some_field}.substring(1,$F{some_field}.length()).toLowerCase() For instance: the username's first letter is converted to uppercaps on the below expression. For your case it will be sentence Press Finish Button to save, then run the report
type: Answer
answers question: http://stackoverflow.com/q/26462178
upvote count: 2

http://stackoverflow.com/q/26442938
has answer: http://stackoverflow.com/a/26451370
tagged with: android
has comment: http://stackoverflow.com/comment/41531428
tagged with: checkbox
answer count: 4
type: AnsweredQuestion
tagged with: java
has title: Set Condition on checkbox, in android
has body: In my actiivty, i have created multiple checkbox items like this, where the text of checkboxes is coming from my SQLite db finaldb.open(); String[] db_data = finaldb.getdbdata(sensIds[i]); finaldb.close(); for (int j = 0; j &lt; db_data.length; j++) { cb = new CheckBox(getApplicationContext()); cb.setButtonDrawable(id); cb.setText(db_data[j]); mainLayout.addView(cb); } Now, i want to set a condition on my BUTTON that, if any of the checkbox is checked, activityA should be started or in other case activityB will be started. I'm trying to do it like this, if(cb.isChecked()) { //ActivityA start } else { //ActivityB start } but its giving me IndexOutOfBoundExceptionError. Can anyone help me in the right direction? EDIT: When i remove my if else condition and works with only ActivityA, the code works perfectly fine, but when using this if else condition, it's only consider the else condition and start ActivityB every time. Here is my logcat report, 10-18 15:10:33.065: E/AndroidRuntime(1138): FATAL EXCEPTION: main 10-18 15:10:33.065: E/AndroidRuntime(1138): Process: com.example.mydb, PID: 1138 10-18 15:10:33.065: E/AndroidRuntime(1138): java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2 10-18 15:10:33.065: E/AndroidRuntime(1138): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 10-18 15:10:33.065: E/AndroidRuntime(1138): at java.util.ArrayList.get(ArrayList.java:308) 10-18 15:10:33.065: E/AndroidRuntime(1138): at com.example.mydb.FinalActivity.onClick(FinalActivity.java:219) 10-18 15:10:33.065: E/AndroidRuntime(1138): at android.view.View.performClick(View.java:4438) 10-18 15:10:33.065: E/AndroidRuntime(1138): at android.view.View$PerformClick.run(View.java:18422) 10-18 15:10:33.065: E/AndroidRuntime(1138): at android.os.Handler.handleCallback(Handler.java:733) 10-18 15:10:33.065: E/AndroidRuntime(1138): at android.os.Handler.dispatchMessage(Handler.java:95) 10-18 15:10:33.065: E/AndroidRuntime(1138): at android.os.Looper.loop(Looper.…
has comment: http://stackoverflow.com/comment/41531422
type: Question
has comment: http://stackoverflow.com/comment/41575828
has answer: http://stackoverflow.com/a/26450383
has comment: http://stackoverflow.com/comment/41529175
score: 0
has answer: http://stackoverflow.com/a/26443892
possible better answer: http://stackoverflow.com/a/26446088
has answer: http://stackoverflow.com/a/26446088
has comment: http://stackoverflow.com/comment/41529281
has comment: http://stackoverflow.com/comment/41576449
has comment: http://stackoverflow.com/comment/41531890
has comment: http://stackoverflow.com/comment/41542274
accepted answer: http://stackoverflow.com/a/26450383

http://stackoverflow.com/q/26389195
score: 0
tagged with: frequency
possible better answer: http://stackoverflow.com/a/26389806
tagged with: exception
has body: public static void frequencyFinder() throws FileNotFoundException, IOException { String foldername = ".../Meta_Oct/separate"; File folder = new File(foldername); File[] listOfFiles = folder.listFiles(); String line; for (int x = 0; x &lt; listOfFiles.length; x++) { BufferedReader in = new BufferedReader(new FileReader(listOfFiles[x])); String filename = listOfFiles[x].getName(); String language = filename.split("@")[0]; String target = filename.split("@")[1]; String source = filename.split("@")[2]; int frequency = 0; while ((line = in.readLine()) != null) { lemma_match = line.split(";")[3]; frequency = 1; while((in.readLine().split(";")[3]).equals(lemma_match)){ frequency++; line = in.readLine(); } System.out.println(target + ":" + source +":"+lemma_match + ":" + frequency); frequency = 0; lemma_match = null; } } } The frequency of the words in the last column has to be calculated. The problem is that the while loop skips some of the lines and it ends up in NullPointerExceptions and not all frequencies are calculated until that point either. I have attached the stack trace below, as well as the sample file. EN;GOVERNMENT;DISEASE;bristle at EN;GOVERNMENT;DISEASE;contract EN;GOVERNMENT;DISEASE;detect in EN;GOVERNMENT;DISEASE;detect in EN;GOVERNMENT;DISEASE;immunize against EN;GOVERNMENT;DISEASE;inherit from EN;GOVERNMENT;DISEASE;spread EN;GOVERNMENT;DISEASE;spread EN;GOVERNMENT;DISEASE;spread EN;GOVERNMENT;DISEASE;stave off EN;GOVERNMENT;DISEASE;stave off EN;GOVERNMENT;DISEASE;transmit EN;GOVERNMENT;DISEASE;treat EN;GOVERNMENT;DISEASE;treat EN;GOVERNMENT;DISEASE;treat as EN;GOVERNMENT;DISEASE;treat by EN;GOVERNMENT;DISEASE;ward off STACK TRACE: GOVERNMENT:DISEASE:bristle at :1 GOVERNMENT:DISEASE:detect in :2 GOVERNMENT:DISEASE:spread :2 GOVERNMENT:DISEASE:stave off :1 Exception in thread "main" java.lang.NullPointerException GOVERNMENT:DISEASE:treat :2 at javaapplication6.FrequencyFinder.frequencyFinder(FrequencyFinder.java:53) at javaapplication6.FrequencyFinder.main…
has answer: http://stackoverflow.com/a/26389268
accepted answer: http://stackoverflow.com/a/26389268
tagged with: loops
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26389806
tagged with: java
has title: Counting the frequency of words in a sorted list
answer count: 2

selenide
tag name: selenide
type: Tag
tags question: http://stackoverflow.com/q/26508193

http://stackoverflow.com/comment/41425223
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26384830
has text: @AttilaHerbert Yes, I got your point.
score: 0

http://stackoverflow.com/comment/41612825
type: AnswerComment
score: 0
type: Comment
has text: Yes OP does need to clarify this but [it works without multiline mode also](http://regex101.com/r/rB4dV3/1)
comment on: http://stackoverflow.com/a/26489033

http://stackoverflow.com/comment/41486346
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26419951
score: 2
has text: One general advice: Don't run programs if there are compilation errors. Work on those errors first.

http://stackoverflow.com/q/26377108
has body: Let us assume we have a website and, for the sake of argument, that the back end is written in Java. Let us also assume that we would like to capture clickstream data for users on our website. We would like to track various things, for example: IP Access time Referral User Agent etc. Another assumption is that we have a clickstream web-service somewhere with REST interface and that it simply saves the information we deliver to it to the database. Now, from my, limited knowledge about this stuff, point of view, I see 2 issues. How to ensure that clickstream data is captured and not avoided by user? How to make your clickstream service portable? At the moment, I'm seeing 2 ways of implementing clickstream, but both have some flaws. Use Javascript to send clickstream data, making it portable so you can hook it to any website without changing the backend code. The only changes that should be made are in HTML (and those are minor ones) Have a HTML page with &lt;body onload="captureAndSendClickStreamData();"&gt;...&lt;/body&gt; where captureAndSendClickStreamData() is a function in your Clickstream.js you included. Obviously, this approach offers easy portability, right? However, what if the user disables JS? In essence, he's blocking the clickstream service you worked so hard on. You handle capturing clickstream data in some ClickStreamServletFilter class. The obvious advantage is that the end user has no knowledge of it, and can't really disable it. However, to extend some other site with your clickstream service, you need to mess up with the back end, which is even more messy if the website you're trying to enhance is not written, in this case, in Java. So, my final questions are: Are there any other not-so-obvious (dis)advantages to the approaches mentioned? Are there any other viable approaches? How do big guns, like Google, Facebook, Amazon, handle this? Thank you for your time :)
favorite count: 0
answer count: 0
tagged with: data-collection
has comment: http://stackoverflow.com/comment/71442608
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/41409950
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41409833
has comment: http://stackoverflow.com/comment/41409802
has comment: http://stackoverflow.com/comment/41410172
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/41409728
tagged with: javascript
has comment: http://stackoverflow.com/comment/41410234
tagged with: clickstream
has title: What is the standard way to implement a clickstream today?
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/comment/41562494
has text: If you are creating new instances yourself spring will not autowire them, spring will only inject into bean instances it knows about. Why do you need a new instance each time?
type: QuestionComment
comment on: http://stackoverflow.com/q/26461697
type: Comment
score: 2

http://stackoverflow.com/comment/41636038
comment on: http://stackoverflow.com/a/26502126
type: AnswerComment
has text: You are right. Classpath is the problem. Thanks Maroun.
type: Comment
score: 2

http://stackoverflow.com/comment/41498482
score: 0
has text: @Dejan check if that part contains # in it that means you have to use the part after that. or you could also change it to Pattern.compile(",\\#(.*?)\\#,"); but you would be skipping the first element. You would get 2000 in this case.
comment on: http://stackoverflow.com/q/26426464
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/88393128
score: 2
type: AnswerComment
has text: E.g. (though I do not know the language very well) I am guess that the "done!!!" is not part of the proposed solution. Consider putting that on a different (preferrably with extended explanation). Then format the part which actually is code with the appropriate formatting.
type: Comment
comment on: http://stackoverflow.com/a/50691716

http://stackoverflow.com/comment/41409544
comment on: http://stackoverflow.com/a/26376981
score: 0
type: AnswerComment
type: Comment
has text: Yep, I get the exact same thing, I still see the html tags and br

http://stackoverflow.com/q/26397349
has answer: http://stackoverflow.com/a/26397423
has body: Little unsure of how to get to number of edges from the Nodes produced. private TreeMap&lt;Node, Set&lt;Node&gt;&gt; nodeToNeighbours; Add Edge Class public void addEdge(Node node1, Node node2) { nodeToNeighbours.put(node2, new TreeSet&lt;Node&gt;()); nodeToNeighbours.put(node1, new TreeSet&lt;Node&gt;()); } Here's were im stuck. Would I have to cast? public int getNumEdges() { //TreeSet&lt;Node&gt; x = new nodeToNeighbours.get(node1); return x; }
tagged with: tree
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26397455
has title: How to retrieve SET of objects from MAP
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41445764
answer count: 4
has answer: http://stackoverflow.com/a/26397457
has comment: http://stackoverflow.com/comment/41445820
type: Question
has answer: http://stackoverflow.com/a/26397661
tagged with: dictionary

http://stackoverflow.com/a/26489227
downvote count: 0
has comment: http://stackoverflow.com/comment/127831644
has comment: http://stackoverflow.com/comment/101153897
has body: You can use Apache Commons IO TeeOutputStream for this purpose. This OutputStream proxies all bytes written to it to two underlying OutputStreams. You can use multiple TeeOutputStreams in a chain when you want to write to more than two OutputStreams at once. OutputStream out = new TeeOutputStream( new FileOutputStream(new File("A")), new TeeOutputStream( new FileOutputStream(new File("B")), new FileOutputStream(new File("C")) ) );
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26489122
score: 6

http://stackoverflow.com/q/26373376
tagged with: spring-tool-suite
has comment: http://stackoverflow.com/comment/41543057
has body: I am using SpringToolSuite 3.3.0 and this is a desktop application in java. I use to run my project from "Run -> Run configuration" . My project was running OK for some time. But from last few days, when I try to run my project using "Run -> Run configuration-> Main tab -> Run", a pop up comes up saying Exception occurred executing command line. Cannot run program "C:\Program Files(X86)\jdk1.6.0_31\bin\javaw.exe" (in directory "C:\projects\arm\src\arm-positionBuilder"): CreateProcess error=206, The filename or extension is too long I look for this issue on this website but could not found solution for it. I am using Maven for build. Please advise what changes should I do in project configuration to resolve it.
has comment: http://stackoverflow.com/comment/41407374
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41407453
has answer: http://stackoverflow.com/a/70186669
favorite count: 0
has comment: http://stackoverflow.com/comment/41403949
linked to: http://stackoverflow.com/q/10519558
has comment: http://stackoverflow.com/comment/41456771
has title: CreateProcess error=206
type: UnansweredQuestion
score: 1
tagged with: maven
upvote count: 1
tagged with: spring
type: Question
tagged with: java

http://stackoverflow.com/q/26476605
answer count: 1
has body: I am learning Java 8. The most difficult thing I have to face is the Parallel Reduction. Here is the code from a example of the user @Stuart Marks I am studying with. class ImmutableAverager { private final int total; private final int count; public ImmutableAverager(){this.total = 0;this.count = 0;} public ImmutableAverager(int total, int count) { this.total = total; this.count = count; } public double average(){return count &gt; 0 ? ((double) total) / count : 0;} public ImmutableAverager accept(final int i) { return new ImmutableAverager(total + i, count + 1); } public ImmutableAverager combine(final ImmutableAverager other) { return new ImmutableAverager(total + other.total, count + other.count); } The call public static void main(String[] args) { System.out.println(Stream.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) .parallel() .reduce(new ImmutableAverager(), ImmutableAverager::accept, ImmutableAverager::combine) .average()); } This produce the right results but later I checked the signature of the reduce method &lt;U&gt; U reduce(U identity, BiFunction&lt;U, ? super T, U&gt; accumulator, BinaryOperator&lt;U&gt; combiner); I would understand clearly if the code would be something like: .reduce(new ImmutableAverager(),(a,b)-&gt;a.accept(b),(a,b)-&gt;a.combine(b)) I don't understand how: ImmutableAverager::accept Can convert into a BiFunction My understanding is this: ImmutableAverager::accept is convert it in something like (ImmutableAverage a)-&gt;a.accept(); //but this is a function with 1 parameter not with 2 parameters. and ImmutableAverager::merge can convert into a BinaryOperator. My friend @Stuart Marks says The methods match the function arguments to reduce so we can use method references.
tagged with: java-8
has comment: http://stackoverflow.com/comment/41590775
type: AnsweredQuestion
tagged with: reduce
tagged with: java-stream
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26476910
tagged with: binary-operators
type: Question
has title: Java 8 stream parallel reduce BiFunction accumulator
accepted answer: http://stackoverflow.com/a/26476910

http://stackoverflow.com/q/26395007
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/26395075
type: Question
has title: My Code Generator Won't Work Properly
tagged with: jtextarea
has body: So I'm trying to make a code generator that will generate setter and getter methods if you input variable names like: "int nums" or "String words" etc. My problem is that it can only take one input If you put more than one variable it will give me this: Input int nums String words Output public int set nums string() { return nums string; } public int get nums string() { return nums string; } My approach was to create two text files with the templates for static and nonstatic methods, for example they look like this: public &lt;&lt;Variable&gt;&gt; set &lt;&lt;Name&gt;&gt;() { return &lt;&lt;Name&gt;&gt;; } public &lt;&lt;Variable&gt;&gt; get &lt;&lt;Name&gt;&gt;() { return &lt;&lt;Name&gt;&gt;; } I know that the setter isn't supposed to return anything, but I am just trying to get this first step to work before I move on. Then I store these in a string and get input from the user and use their input to replace the &lt;> and the &lt;> elements of the string. Here is my code Note: I am using Swing to make this a GUI import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.io.*; public class CodeGenerator { //Private Variables and Methods private boolean checked = false; private String staticTemplate = null; private String nonStaticTemplate = null; private ArrayList&lt;String&gt; input = new ArrayList&lt;String&gt;(); /** * Will Replace The Parts Of The Text Documents With the Variable Type And Name And Repeat For All Of The Variables In The Text Area. * It Will Then Put The Result In The Output Text Area For The User To Copy And Paste */ public static void replace(ArrayList&lt;String&gt; inputs, String methods, JTextArea output) { for(int i = 0; i &lt; inputs.size(); i+=2) { methods = methods.replaceAll("&lt;&lt;Variable&gt;&gt;", inputs.get(i)); } for(int i = 1; i &lt; inputs.size(); i+=2) { methods = methods.replaceAll("&lt;&lt;Name&gt;&gt;", inputs.get(i)); } output.setText(methods); } private JFrame frame; /** * Launch the …
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/41442068
tagged with: arrays
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6592468

http://stackoverflow.com/comment/41655284
comment on: http://stackoverflow.com/q/26512430
type: QuestionComment
type: Comment
has text: What problem you are having with this code? Does it not not compile/throw exception/gives bad results?
score: 0

http://stackoverflow.com/q/26511617
has answer: http://stackoverflow.com/a/26511947
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41708501
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26513435
type: Question
downvote count: 0
tagged with: hazelcast
has answer: http://stackoverflow.com/a/26542196
favorite count: 0
has title: Find the lowest / highest key of a distributed map
has answer: http://stackoverflow.com/a/26521525
answer count: 4
has answer: http://stackoverflow.com/a/26513435
has body: I have a distributed map and I want to find the lowest or highest key (an object implementing compareable). What is the most efficient way to get those keys? I mean something like every node provides his lowest key and in the end the lowest key is the lowest of every node. So I think: MyObj max = Collections.max(map.keySet()); is not the most efficient way. And if I want to use new DistributedTask&lt;&gt;(new Max(input), key); I would need to now the key and therefore fetch all Keys over wire. I think in that case I could do Collections.max(map.keySet()); as well. Hmm ... any ideas?
possible better answer: http://stackoverflow.com/a/26511947

http://stackoverflow.com/a/26397050
answers question: http://stackoverflow.com/q/26396367
score: 0
has comment: http://stackoverflow.com/comment/41482459
type: AcceptedAnswer
has body: You can't do this with enums because Java's class model doesn't work the way you would need in order for this style to work. I haven't been able to find a function foo() that returns the enum class itself. Returning the enum class itself is easy, you just do Domain1Tables.class, but that won't give you the completion you want because what it gives you is a Class&lt;Domain1Tables&gt; object, and that object doesn't have fields named Customers and Orders. You want to be able to treat the "Domain1Tables" class as if it's an object and refer to the enum constants (which are effectively static final fields) as if they were members of that object, but Java simply doesn't do that. If you give up on using enums for it, then you can simply have: public class DataObjectNames { public class Domains { class Domain1 { class Tables { class Customers { public static final String id = "id"; public static final String email = "email"; } } } } } but in that case DataObjectNames.Domains.Domain1 wouldn't be a valid expression anymore (because it reference to a class scope, but not to an object. There's probably a solution to what you're trying to do, but without more context I can provide anything more details than what's above.
type: Answer
accepted answer of: http://stackoverflow.com/q/26396367

http://stackoverflow.com/comment/41494667
comment on: http://stackoverflow.com/a/26421991
has text: I implemented your suggestions, but now I'm getting an error: "Expected String but was BEGIN_OBJECT". I'm guessing it has to do with the fact that my asynctask is expecting a string and returns a string, also my doInBackground method expects a string and returns a string to my onPostExecute which also expects a string. I've used arrays in my POJOs and used PostResponse response = new Gson().fromJson(bufferedReader, PostResponse.class);
type: AnswerComment
score: 0
type: Comment

selenium
tags question: http://stackoverflow.com/q/26413755
tags question: http://stackoverflow.com/q/26405606
tags question: http://stackoverflow.com/q/26426691
tags question: http://stackoverflow.com/q/26363566
tags question: http://stackoverflow.com/q/26389986
tags question: http://stackoverflow.com/q/26354209
tags question: http://stackoverflow.com/q/26380378
tags question: http://stackoverflow.com/q/26420681
tags question: http://stackoverflow.com/q/26495441
tags question: http://stackoverflow.com/q/26465526
tags question: http://stackoverflow.com/q/26424146
tags question: http://stackoverflow.com/q/26433053
tags question: http://stackoverflow.com/q/26511741
tags question: http://stackoverflow.com/q/26431144
tag name: selenium
tags question: http://stackoverflow.com/q/26410934
tags question: http://stackoverflow.com/q/26370928
tags question: http://stackoverflow.com/q/26390869
tags question: http://stackoverflow.com/q/26469902
tags question: http://stackoverflow.com/q/26360993
tags question: http://stackoverflow.com/q/26397247
tags question: http://stackoverflow.com/q/26398421
tags question: http://stackoverflow.com/q/26390634
tags question: http://stackoverflow.com/q/26404866
tags question: http://stackoverflow.com/q/26482517
tags question: http://stackoverflow.com/q/26441431
tags question: http://stackoverflow.com/q/26403489
tags question: http://stackoverflow.com/q/26422720
tags question: http://stackoverflow.com/q/26442154
tags question: http://stackoverflow.com/q/26429789
tags question: http://stackoverflow.com/q/26490951
tags question: http://stackoverflow.com/q/26480110
tags question: http://stackoverflow.com/q/26468630
type: Tag
tags question: http://stackoverflow.com/q/26498299
tags question: http://stackoverflow.com/q/26380231
tags question: http://stackoverflow.com/q/26461344
tags question: http://stackoverflow.com/q/26411344
tags question: http://stackoverflow.com/q/26459652
tags question: http://stackoverflow.com/q/26467057
tags question: http://stackoverflow.com/q/26419540
tags question: http://stackoverflow.com/q/26413508
tags question: http://stackoverflow.com/q/26416090

http://stackoverflow.com/a/26457751
type: Answer
upvote count: 1
downvote count: 1
has body: Maybe you're calling your method only once, try calling: loop1(1,10,1); loop1(2,9,3); I tested here and worked: http://ideone.com/W0DM4H
score: 0
answers question: http://stackoverflow.com/q/26457697

http://stackoverflow.com/comment/41582645
has text: @Dustin look at my answer and you will see what you were doing wrong.
comment on: http://stackoverflow.com/q/26472274
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26404538
type: Question
tagged with: mongodb
possible better answer: http://stackoverflow.com/a/26404633
tagged with: jackson
answer count: 2
upvote count: 1
favorite count: 0
has body: I receive the following JSON: {"firstName":"charle","lastName":"charly","books":[{"title":"navle"}]} And i try to parse it into this Jackson object: @JsonIgnoreProperties(ignoreUnknown = true) public class Person { @Id @ObjectId private String _id; private String firstName; private String lastName; List&lt;Book&gt; books; // getters/setters .. } The problem is that the Object "Person" that i get have always an empty list of books ! What i'm missing ?
has title: jackson do not deserialize child list object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26404863
accepted answer: http://stackoverflow.com/a/26404863
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26404633

selenium-webdriver
tags question: http://stackoverflow.com/q/26405606
tags question: http://stackoverflow.com/q/26426691
tags question: http://stackoverflow.com/q/26363566
tags question: http://stackoverflow.com/q/26495441
tags question: http://stackoverflow.com/q/26424146
tags question: http://stackoverflow.com/q/26370928
tags question: http://stackoverflow.com/q/26390869
tags question: http://stackoverflow.com/q/26469902
tags question: http://stackoverflow.com/q/26428147
tags question: http://stackoverflow.com/q/26371032
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/26360993
tags question: http://stackoverflow.com/q/26398421
tags question: http://stackoverflow.com/q/26358148
tags question: http://stackoverflow.com/q/26508193
tags question: http://stackoverflow.com/q/26482517
tags question: http://stackoverflow.com/q/26434000
tags question: http://stackoverflow.com/q/26422720
tags question: http://stackoverflow.com/q/26433889
tags question: http://stackoverflow.com/q/26463741
tags question: http://stackoverflow.com/q/26490951
tags question: http://stackoverflow.com/q/26480110
tags question: http://stackoverflow.com/q/26458276
type: Tag
tags question: http://stackoverflow.com/q/26498299
tags question: http://stackoverflow.com/q/26461344
tags question: http://stackoverflow.com/q/26467057
tags question: http://stackoverflow.com/q/26419540
tags question: http://stackoverflow.com/q/26413508

http://stackoverflow.com/q/26403319
has comment: http://stackoverflow.com/comment/41455861
accepted answer: http://stackoverflow.com/a/26406722
score: 22
tagged with: java-stream
has title: Skip last x elements in Stream<T>
answer count: 3
tagged with: java-8
has comment: http://stackoverflow.com/comment/41461303
linked to: http://stackoverflow.com/q/33635717
tagged with: java
upvote count: 22
has comment: http://stackoverflow.com/comment/41456261
has answer: http://stackoverflow.com/a/79291979
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47044547
has answer: http://stackoverflow.com/a/26406722
downvote count: 0
favorite count: 0
has body: If I have a Stream&lt;T&gt;, I can easily use skip(long) to skip the first few elements of a stream. However, there seems to be no equivalent for skipping a given number of elements at the end of the stream. The most obvious solution is to use limit(originalLength - elementsToRemoveAtEnd), but that requires knowing the initial length beforehand, which isn't always the case. Is there a way to remove the last few elements of a stream of unknown length without having to collect it into a Collection, count the elements and stream it again?
possible better answer: http://stackoverflow.com/a/47044547
type: Question

http://stackoverflow.com/q/26457381
upvote count: 1
has title: Java, replacing characters in a for-loop
linked to: http://stackoverflow.com/q/11588916
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26457414
tagged with: java
downvote count: 1
tagged with: replace
type: Question
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/41555017
score: 0
has answer: http://stackoverflow.com/a/26457631
tagged with: char
has answer: http://stackoverflow.com/a/26457414
has body: Okay so, obviously I'm new with Java and what I currently wish to do is a very simple program to encrypt a string by breaking it into an array of characters and replacing the characters with new ones. So what I did so far was to create a key-array containing the alphabet, which I'm comparing the split-up string with, and I'm trying to replace the characters with a value-array which is basically just the alphabet backwards. My code so far works when I'm just printing out the value, but it wont properly replace the characters. public class Main { public static void main(String[] args) { char[] keyArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; char[] valueArray = {'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'p', 'q', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'}; String myString = "abcxyz"; char[] myStringArray = myString.toCharArray(); for(int x = 0; x&lt;myString.length(); x++) { for(int i = 0; i&lt;keyArray.length; i++) { if(myStringArray[x] == keyArray[i]) { //System.out.println(valueArray[i]); would give the output "zyxcba" as expected myStringArray[x] = valueArray[i]; // this will only change the characters in the first half of keyArray } } } System.out.println(myStringArray); //Outputs "abccba" instead of "zyxcba" } }
possible better answer: http://stackoverflow.com/a/26457631
favorite count: 0
tagged with: encryption

http://stackoverflow.com/comment/41498578
type: QuestionComment
has text: @Tenfour04 I've added this line in render(): Gdx.gl.glClearColor(0, 0, 0.2f, 1); and now I see everything blue instead of black!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26426263

http://stackoverflow.com/a/26500719
answers question: http://stackoverflow.com/q/26500554
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26500554
type: Answer
has body: Setting the border of the panel to an empty border with 0 as dimensions changed nothing. You need to set the Border of the content pane of the dialog. Don't know if it will work on all LAF's but you can use the following for Metal and Windows: UIManager.put("OptionPane.border", new EmptyBorder(0, 0, 0, 0) ); See UIManager Defaults for more information. This will change the property for all option panes. So you may want to save the default border, create your option pane and then restore the original border for creating other option panes. Maybe another option is to add an ContainerListener to the panel. Then you could handle the componentAdded(...) event. When the event is generated you can get the parent panel and remove the Border.

http://stackoverflow.com/comment/41627573
type: Comment
type: QuestionComment
has text: Yes, but I want the simple case, where one byte => one character.
comment on: http://stackoverflow.com/q/26497204
score: 0

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/26407432
tags question: http://stackoverflow.com/q/26474281
tags question: http://stackoverflow.com/q/26399537
tags question: http://stackoverflow.com/q/26467087
type: Tag

http://stackoverflow.com/comment/41655628
type: Comment
type: QuestionComment
has text: Also, is this Sql Server or SQLExpress? Sql Server defaults to port 1433. SQLExpress uses a dynamically assigned port which can be determined from the Configuration Manager applet.
comment on: http://stackoverflow.com/q/26512721
score: 0

haxm
tags question: http://stackoverflow.com/q/26452873
type: Tag
tag name: haxm

http://stackoverflow.com/q/26479261
has body: We recently switched professors and this new professor was under the impression that we had a wealth of knowledge we do not possess. We have a programming project due and I would just like some clarification, if possible. (From exercise 4.4) Write a method void interchange (List l) which interchanges the current element in the list and the one following it. (First make it work in the normal case; then, if you still have time, make sure it handles special cases, such as: the list is empty; the list has only one element; current is at the end of the list (From exercise 4.6) Write a method void reverse (List l) which reversed the order of items stored in the list. Again, make sure it works for any special cases you can think of. (From exercise 4.7) Write a method List mergeLists (List l1, List l2)which takes two sorted Lists as input, producing a new List containing all the elements of both lists, also sorted. The new list is the return value for the method. So I created a list ArrayList&lt;String&gt; numbers = new ArrayList&lt;String&gt;(); numbers.add("Zero"); numbers.add("One"); numbers.add("Two"); numbers.add("Three"); System.out.println (numbers); And so I'm assuming that under this I'm to make these 3 new methods. I'm just having a hard time following his instructions. I'm not asking anyone to do my work for me, I would just like some clarification on exactly what he wants us to do, and I can subsequently attempt to do research. Thank you in advance.
favorite count: 0
type: Question
score: -2
tagged with: void
tagged with: list
has answer: http://stackoverflow.com/a/26479331
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/41594861
answer count: 1
has comment: http://stackoverflow.com/comment/41594846
has title: Programming project, ADT Lists
type: UnansweredQuestion
upvote count: 0

http://stackoverflow.com/a/26502672
upvote count: 2
type: Answer
has body: Finally found the problem. Trying another version of Hibernate (lower than 4.0.2) works. Anyone knows why?
score: 2
has comment: http://stackoverflow.com/comment/45453174
accepted answer of: http://stackoverflow.com/q/26422320
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26422320
downvote count: 0

http://stackoverflow.com/comment/41649512
has text: using string spliiter should work
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26508762

http://stackoverflow.com/a/26406722
upvote count: 12
answers question: http://stackoverflow.com/q/26403319
has body: There is no general storage-free solution for Streams that may have an unknown length. However, you don’t need to collect the entire stream, you only need a storage as large as the number of elements you want to skip: static &lt;T&gt; Stream&lt;T&gt; skipLastElements(Stream&lt;T&gt; s, int count) { if(count&lt;=0) { if(count==0) return s; throw new IllegalArgumentException(count+" &lt; 0"); } ArrayDeque&lt;T&gt; pending=new ArrayDeque&lt;T&gt;(count+1); Spliterator&lt;T&gt; src=s.spliterator(); return StreamSupport.stream(new Spliterator&lt;T&gt;() { public boolean tryAdvance(Consumer&lt;? super T&gt; action) { while(pending.size()&lt;=count &amp;&amp; src.tryAdvance(pending::add)); if(pending.size()&gt;count) { action.accept(pending.remove()); return true; } return false; } public Spliterator&lt;T&gt; trySplit() { return null; } public long estimateSize() { return src.estimateSize()-count; } public int characteristics() { return src.characteristics(); } }, false); } public static void main(String[] args) { skipLastElements(Stream.of("foo", "bar", "baz", "hello", "world"), 2) .forEach(System.out::println); }
score: 11
accepted answer of: http://stackoverflow.com/q/26403319
has comment: http://stackoverflow.com/comment/81035536
type: AcceptedAnswer
type: Answer
downvote count: 1

http://stackoverflow.com/a/26486955
upvote count: 1
has comment: http://stackoverflow.com/comment/41616568
answers question: http://stackoverflow.com/q/26486591
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41639495
type: Answer
accepted answer of: http://stackoverflow.com/q/26486591
has body: You don't have to explicitly fire a PaintEvent. Instead use one, or combination, of the below options: layout() marks forces the repositioning of all composite-children. This will become visible on next repaint, which will be done somewhere in the future, when composite's screen-area will be redrawn redraw() marks the widget an invalidated. On next redraw-system-action this area will be repainted. update() forces all outstanding redraw() requests to be completed NOW.
score: 1

http://stackoverflow.com/comment/41545232
comment on: http://stackoverflow.com/q/26451873
score: 0
has text: You specify the date format on the date field of your jaxb-annotated class
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41641459
has text: Check : http://stackoverflow.com/questions/26121219/how-can-i-change-the-font-of-my-listview-items/26121491#26121491
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26505109
type: Comment

http://stackoverflow.com/comment/41630533
has text: [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi) - but in your case, since you're using a `null` layout, they will have no effect anyway...
comment on: http://stackoverflow.com/q/26498950
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41527926
type: Comment
score: 4
comment on: http://stackoverflow.com/q/26442434
has text: It seems a non-issue to me. Use whatever you understand the best, now, and 6 months from now.
type: QuestionComment

http://stackoverflow.com/q/26488268
linked to: http://stackoverflow.com/q/20626140
type: AnsweredQuestion
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/9425079
has body: So guys, as what the title implies. I cant access my report when i clean and build my program to a jar file to be deployed. I tried surfing the internet for possible solutions but none of them has gone right. So below is what i did to try to access the report inside the jar file: URL reportURL = getClass().getClassLoader().getResource("assessmentrecordsystem\\reports\\report1.jrxml");//returns nothing reportInputStream = this.getClass().getClassLoader().getResourceAsStream("\\reports\\report1.jrxml");//all so returns nothing What did i miss?? This is what my jar file contains:
linked to: http://stackoverflow.com/q/13322899
type: Question
has answer: http://stackoverflow.com/a/26488522
tagged with: jasper-reports
accepted answer: http://stackoverflow.com/a/26488522
score: -1
has comment: http://stackoverflow.com/comment/41634684
has title: Accessing report inside a .jar file
answer count: 1
downvote count: 1
favorite count: 0
tagged with: embedded-resource

http://stackoverflow.com/comment/41431507
comment on: http://stackoverflow.com/q/26388809
score: 0
has text: @JasonBarrett can you check my log trace
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26453661
type: Question
has comment: http://stackoverflow.com/comment/41548151
has comment: http://stackoverflow.com/comment/41548119
has comment: http://stackoverflow.com/comment/41559855
upvote count: 3
answer count: 3
tagged with: android
favorite count: 0
accepted answer: http://stackoverflow.com/a/26465981
has body: I've just received this crash log by a user and I can't understand what caused it. My app is a text editor. I have a TextWatcher on the TextView but I'm not sure if that is the problem, since the logcat dosen't contain any line of my app. java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at android.widget.TextView.sendOnTextChanged(TextView.java:7231) at android.widget.TextView.handleTextChanged(TextView.java:7290) at android.widget.TextView$ChangeWatcher.onTextChanged(TextView.java:8880) at android.text.SpannableStringBuilder.sendTextChanged(SpannableStringBuilder.java:962) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:496) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:435) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:30) at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:672) at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:435) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:333) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)
has answer: http://stackoverflow.com/a/45870671
has title: Android java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1
possible better answer: http://stackoverflow.com/a/41499452
has answer: http://stackoverflow.com/a/41499452
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26465981
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41548208

http://stackoverflow.com/comment/41381065
type: QuestionComment
comment on: http://stackoverflow.com/q/26356873
has text: possible duplicate of [Java: Sort an array](http://stackoverflow.com/questions/8938235/java-sort-an-array)
score: 0
type: Comment

http://stackoverflow.com/a/26366568
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/133522394
has comment: http://stackoverflow.com/comment/67754408
type: Answer
upvote count: 90
has comment: http://stackoverflow.com/comment/87126821
has body: As explained above this is a feature in Java 7 and beyond. try with resources allows to skip writing the finally and closes all the resources being used in try-block itself. As stated in Docs Any object that implements java.lang.AutoCloseable, which includes all objects which implement java.io.Closeable, can be used as a resource. See this code example static String readFirstLineFromFile(String path) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader(path))) { return br.readLine(); } } In this example the resource is BufferReader object as the class implements the interface java.lang.AutoCloseable and it will be closed whether the try block executes successfully or not which means that you won't have to write br.close() explicitly. Another important thing to notice here is that if you are writing the finally block yourself and both your try and finally block throw exception then the exception from try block is supressed. While on the other hand if you are using try-with-resources statement and exception is thrown by both try block and try-with-resources statement then in this case the exception from try-with-resources statement is suppressed. As the @Aaron has answered already above I just tried to explain you. Hope it helps. Source: http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
score: 89
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26356777
answers question: http://stackoverflow.com/q/26356777

http://stackoverflow.com/q/26409235
has comment: http://stackoverflow.com/comment/41467004
type: Question
possible better answer: http://stackoverflow.com/a/26746540
has answer: http://stackoverflow.com/a/26746540
has answer: http://stackoverflow.com/a/26409345
has comment: http://stackoverflow.com/comment/41493136
answer count: 2
has comment: http://stackoverflow.com/comment/41490966
downvote count: 0
tagged with: precision
favorite count: 0
accepted answer: http://stackoverflow.com/a/26409345
has comment: http://stackoverflow.com/comment/41491814
type: AnsweredQuestion
tagged with: biginteger
has body: I'm currently working on project which needs absolutely exact precision - no approximation at all. Is there in Java anything like BigRational in C# ? Java's BigDecimal doesn't seem like good enough.
has title: Java's equivalent of C# Big Rational
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26443952
type: Question
answer count: 1
tagged with: jpa
downvote count: 0
linked to: http://stackoverflow.com/q/26327274
has answer: http://stackoverflow.com/a/26444535
has body: From the following source : hibernate transaction eg. It is written that, A typical transaction should use the following idiom: Session sess = factory.openSession(); Transaction tx; try { tx = sess.beginTransaction(); //do some work ... tx.commit(); } catch (Exception e) { if (tx!=null) tx.rollback(); throw e; } finally { sess.close(); } My question is what does tx object have if it goes in catch block i.e. any exception occurs and is this the result of tx.commit()?? And if yes, then how, because it returns nothing. I mean to ask that when and where the value of tx is changing and to what? Quesion 2) Is it necessary to begin transacion in case of read only transactions i.e. select queries ..
favorite count: 0
upvote count: 1
has title: What value does transaction object has in case of exception.?
accepted answer: http://stackoverflow.com/a/26444535
has comment: http://stackoverflow.com/comment/41531479
type: AnsweredQuestion
tagged with: transactions
score: 1
tagged with: java
tagged with: hibernate
tagged with: database

http://stackoverflow.com/a/26464428
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41570366
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41567014
accepted answer of: http://stackoverflow.com/q/26464331
answers question: http://stackoverflow.com/q/26464331
has body: add - i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
type: AcceptedAnswer

http://stackoverflow.com/a/26421184
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41492633
answers question: http://stackoverflow.com/q/26420836
has comment: http://stackoverflow.com/comment/41488438
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/41511052
has body: Yes that's called Mode Z (or Compressed Transfer Mode). FTPClient ftpClient = new FTPClient(); ftpClient.connect(server.getServer()); ftpClient.login(server.getUsername(), server.getPassword()); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); ftpClient.setFileTransferMode(FTP.COMPRESSED_TRANSFER_MODE); You can also obviously compress the files on the server side then send them via standard FTP (it should be the same in the end).
accepted answer of: http://stackoverflow.com/q/26420836

http://stackoverflow.com/q/26442179
upvote count: 1
type: Question
has title: Receive UDP packets fast
downvote count: 0
tagged with: udp
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/31204491
type: UnansweredQuestion
score: 1
has body: I have an UDP listener thread, which is looped and calls a method once a packet is received. It works just fine, just that the method is not being called when more than one packet arrives quickly after the first one. Two packets are send once after another, first is 2 bytes long, the second is 3 bytes long. The receive() method tends to be fired mostly when the second packet arrives. Here is the UDP listener class: public class UDPListener extends Thread{ private boolean running = true; byte[] data = new byte[1500]; DatagramPacket packet = new DatagramPacket(data, data.length); public void run() { Log.v("MR", "Runs"); try { while(running) { Log.v("MR", "Listening... "); socket.receive(packet); Log.v("MR", "Received Data: " + packet.getData()[0] + "; Length: " + packet.getLength()); device.post(new Runnable() { public void run() { device.receive(packet.getData(), packet.getData().length); } }); } } catch (Throwable e) { e.printStackTrace(); Log.v("MR", "Failed receiving"); } } } Here is the device.receive() method: public final void receive(byte[] inData, int length) { data = inData; dataLength = length; Log.v("MR", "Receive(): Data: +" + data[0] + "; Length: " + String.valueOf(data.length)); } Here is part of the Log result: 10-18 17:24:34.393 Received Data: 79; Length: 3 10-18 17:24:34.393 Listening... 10-18 17:24:34.393 Receive(): Data: +79; Length: 1500 10-18 17:24:34.393 Receive(): Data: +79; Length: 1500 10-18 17:24:34.413 Received Data: 6; Length: 2 10-18 17:24:34.413 Listening... 10-18 17:24:34.413 Received Data: 79; Length: 3 10-18 17:24:34.413 Listening... 10-18 17:24:34.413 Receive(): Data: +79; Length: 1500 10-18 17:24:34.413 Receive(): Data: +79; Length: 1500 10-18 17:24:34.423 Received Data: 6; Length: 2 10-18 17:24:34.423 Listening... As it can be seen packets are actually coming in, just receive() is called more often for the second (length: 3) packet. 'device' is a custom view, with receive() method. I tried also with handler and runOnUiThread() with…
tagged with: java

http://stackoverflow.com/comment/41659481
comment on: http://stackoverflow.com/q/26496413
score: 0
type: Comment
type: QuestionComment
has text: 333kenshin : Perhaps they might share the same root cause, however, my question is regarding command line maven in general and not regarding hudson double reporting unit tests.

http://stackoverflow.com/comment/93225357
has text: I'm getting this error while doing so... `java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name`, any clues?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26499384

http://stackoverflow.com/comment/41381606
comment on: http://stackoverflow.com/q/26361367
score: 0
type: Comment
type: QuestionComment
has text: @chiastic-security Sorry to say that ... But you are wrong. Look at the `run` methods. They try to call the synchronized methods 10 times (the argument 10 was passed into the constructor). But the output happens only once, and then is dead-locked, which happens because of the `wait` calls! As the first `wait` call releases the lock, the other thread can enter the synchronized block - until the `wait` call. That also releases the lock, and both threads now are waiting (because no thread reaches the `notify` call)!

http://stackoverflow.com/a/26462964
type: Answer
has comment: http://stackoverflow.com/comment/41567071
has body: I'm not sure what you really want .. Do you want to use a dialog from JOptionPane but using your own JPanel? Did you try: Object[] options = { "Yes", "No", "Cancel" }; JOptionPane.showOptionDialog(JFrame, YOURPANEL, "Information", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);
score: 0
has comment: http://stackoverflow.com/comment/41566605
answers question: http://stackoverflow.com/q/26462846

http://stackoverflow.com/a/26382379
type: Answer
has body: I would recommend using bsh.shared namespace, this way you will be able to store any Java object and access it even from different Thread Groups if needed. JMeter-specific example is in the official documentation, in Sharing Variables chapter At the end of 1st script: bsh.shared.strList = strList; At the beginning of the 2nd script: List strList = bsh.shared.strList; Random rnd = new java.util.Random(); vars.put("TheValue",strList.get(rnd.nextInt(strList.size()))); See How to use BeanShell: JMeter's favorite built-in component guide for more details on Beanshell scripting for JMeter.
has comment: http://stackoverflow.com/comment/41419830
has comment: http://stackoverflow.com/comment/41420430
accepted answer of: http://stackoverflow.com/q/26381643
has comment: http://stackoverflow.com/comment/76010460
answers question: http://stackoverflow.com/q/26381643
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26441446
has title: List files in a directory from a runnable jar
type: AnsweredQuestion
score: 2
tagged with: loading
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26441534
has body: So I've been trying for quite a while to deal with an issue I have after converting my java project(game) into a runnable jar. My issue has to do with the way I'm loading my resources. As I've read in many other answers that one possible way to deal with image loading for example when dealing with a runnable jar is to use ImageIO.read(getClass().getResourceAsStream(path);This works perfectly. But my issue is that in a particular folder I have 300 pngs I need to load and they way I've been dealing with this so far is by using a File dir object representing the directory and then iterating through all the files in that directory by using dir.listFiles(), extracting their path and loading them normally with ImageIO. The problem is that this method throws an exception when launching the jar. Although I could theoretically hard code every single image loading for all the 300 pngs I would like to know if there is a way around this obstacle. Many thanks and sorry for the long post! Alex (Update) My project hierarchy in eclipse look like this: Game // the project &gt;src //source code &gt;main //main package &gt;loader // the loader file &gt;res // resources &gt;images // the folder containing the 300pngs
accepted answer: http://stackoverflow.com/a/26441534
tagged with: image
linked to: http://stackoverflow.com/q/14189162
answer count: 1
downvote count: 0
tagged with: executable-jar
tagged with: jar
favorite count: 0

http://stackoverflow.com/comment/128067752
type: QuestionComment
has text: [How to convert float to uint by float representation?](https://stackoverflow.com/q/21801213/995714), [Convert float to raw bits to int in C#](https://stackoverflow.com/q/30786704/995714), [c# how to convert float to int](https://stackoverflow.com/q/7173677/995714), [C# floating point to binary string and vice versa](https://stackoverflow.com/q/59704806/995714)
comment on: http://stackoverflow.com/q/26394616
score: 0
type: Comment

http://stackoverflow.com/q/26418730
tagged with: bean-validation
has comment: http://stackoverflow.com/comment/41491803
has comment: http://stackoverflow.com/comment/41492451
score: 0
has body: I have a problem how messages are resolved using hibernate annotations in Spring forms. I have following method in the controller: @RequestMapping(value = "/path", method = RequestMethod.POST) public CustResponse storeForm(HttpServletResponse response, HttpServletRequest request, @Valid @RequestBody Form form, BindingResult result) { And when request comes I want to resolve all error messages into CustResponse object. In order to resolve warning message I am using following method from BindingResult result: result.getCode(); According to documentation it: Return the default code of this resolvable, that is, * the last one in the codes array. And default code are is resolved is very general: NotBlank for this annotation: import org.hibernate.validator.constraints.NotBlank; However it also exists other more specific error codes in the BindingResult result. As example: [NotBlank.form.fieldNAme, NotBlank.fieldNAme, NotBlank.java.lang.String, NotBlank] And I think it makes more sense to resolve error message using most meaningful error code: NotBlank.form.fieldNAme In order to resolve warning message I don't want to iterate through all error codes. How would you suggest to cope with such kind of issue ?
tagged with: validation
has comment: http://stackoverflow.com/comment/41492073
type: UnansweredQuestion
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41495468
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41490686
has comment: http://stackoverflow.com/comment/41490946
has title: Spring bean validation with hibernate annotation warning messages resolution
type: Question

http://stackoverflow.com/comment/41658150
type: Comment
has text: Yep I would prefer a `for` loop, since u know the #input in advance `n`.
comment on: http://stackoverflow.com/a/26500303
type: AnswerComment
score: 0

android-fragments
tags question: http://stackoverflow.com/q/26408533
tags question: http://stackoverflow.com/q/26372665
tags question: http://stackoverflow.com/q/26373622
tags question: http://stackoverflow.com/q/26491564
tags question: http://stackoverflow.com/q/26493846
type: Tag
tags question: http://stackoverflow.com/q/26371395
tags question: http://stackoverflow.com/q/26479714
tags question: http://stackoverflow.com/q/26367699
tags question: http://stackoverflow.com/q/26492783
tags question: http://stackoverflow.com/q/26445893
tags question: http://stackoverflow.com/q/26389938
tags question: http://stackoverflow.com/q/26381934
tags question: http://stackoverflow.com/q/26403901
tags question: http://stackoverflow.com/q/26486534
tags question: http://stackoverflow.com/q/26449588
tags question: http://stackoverflow.com/q/26477658
tags question: http://stackoverflow.com/q/26373573
tags question: http://stackoverflow.com/q/26467212
tags question: http://stackoverflow.com/q/26360427
tags question: http://stackoverflow.com/q/26414256
tags question: http://stackoverflow.com/q/26425816
tags question: http://stackoverflow.com/q/26401354
tags question: http://stackoverflow.com/q/26398641
tags question: http://stackoverflow.com/q/26390858
tags question: http://stackoverflow.com/q/26513648
tags question: http://stackoverflow.com/q/26397563
tags question: http://stackoverflow.com/q/26359308
tags question: http://stackoverflow.com/q/26493171
tags question: http://stackoverflow.com/q/26422673
tags question: http://stackoverflow.com/q/26457074
tags question: http://stackoverflow.com/q/26423383
tag name: android-fragments
tags question: http://stackoverflow.com/q/26457535

http://stackoverflow.com/comment/41415679
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26380378
has text: We used Selenium Grid to run the tests on multiple machines at the same time. For each machine we configured Selenium Grid to use different browser (Firefox and IE). I can't tell you how exactly it was set up, as it was done by our Jenkins admin, but it is possible!

http://stackoverflow.com/comment/46179397
score: 1
comment on: http://stackoverflow.com/a/26403314
type: AnswerComment
type: Comment
has text: @Kao why not? Cloneable interface with default public clone() *will* work for classes, created for previous versions, because method implementations are linked at runtime.

http://stackoverflow.com/comment/41445390
type: AnswerComment
score: 0
has text: Hi, as much as I would want to go with modern Option #2, we have not touched that in our lessons yet, but thank you very much for providing an alternative. Upvoted and accepted as correct answer.
type: Comment
comment on: http://stackoverflow.com/a/26396748

http://stackoverflow.com/comment/41585566
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26474069
has text: `[!=<>]` can represent only one character. Read about [quantifiers](http://docs.oracle.com/javase/tutorial/essential/regex/quant.html) (especially about greedy and reluctant).

http://stackoverflow.com/a/26360978
has comment: http://stackoverflow.com/comment/41380378
type: Answer
has comment: http://stackoverflow.com/comment/41380573
has comment: http://stackoverflow.com/comment/41380769
has comment: http://stackoverflow.com/comment/41413635
has comment: http://stackoverflow.com/comment/41412153
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41381885
has comment: http://stackoverflow.com/comment/41380474
has comment: http://stackoverflow.com/comment/41380758
has comment: http://stackoverflow.com/comment/41380531
has comment: http://stackoverflow.com/comment/41389326
has comment: http://stackoverflow.com/comment/41380905
has body: Store the resulting array. It won't change the original array object. listItems = ArrayUtils.remove(listItems, i); Edit: But for using this method you need the change to return type of your method public static ItemTracker[] deleteItem(ItemTracker[] listItems){ System.out.println("Which item you want to delete? "); for(int i=0; i &lt; listItems.length; i++) { if(input.equalsIgnoreCase("Quantity")) { // Some Code } else if(input.equalsIgnoreCase("Something"){ listItems = ArrayUtils.remove(listItems, i); // This is the part where it should delete .. but it doesnt delete. } break; } return listItems; }
has comment: http://stackoverflow.com/comment/41380556
has comment: http://stackoverflow.com/comment/41380247
has comment: http://stackoverflow.com/comment/41380584
upvote count: 3
has comment: http://stackoverflow.com/comment/41383033
has comment: http://stackoverflow.com/comment/41380104
has comment: http://stackoverflow.com/comment/41380542
answers question: http://stackoverflow.com/q/26360865
has comment: http://stackoverflow.com/comment/41413067

http://stackoverflow.com/a/26505653
score: 1
answers question: http://stackoverflow.com/q/26503325
has comment: http://stackoverflow.com/comment/41646800
accepted answer of: http://stackoverflow.com/q/26503325
has body: Storing data with an application scope is very common. You could use the ServletContext but there are other alternatives. As Ashley Frieze already commented you can use one instance of a bean and inject it where needed. This would be e.g. an @ApplicationScoped bean if you use CDI or a @Singleton bean if you use EJBs. If you want a pure JAX-RS solution without any dependencies you can use @Context like described by Bill Burke. Here's a copy of the example: public class MyApplication extends Application { public MyApplication(@Context Dispatcher dispatcher) { MyClass myInstance = new MyClass(); dispatcher.getDefaultContextObjects().put(MyClass.class, myInstance); } } You can than inject your class like this: public void get(@Context MyClass myInstance) { ... } If you have a huge amount of data to be stored a distributed cache like infinispan or hazelcast may also be an option. But may be oversized for most use cases.
upvote count: 1
has comment: http://stackoverflow.com/comment/41679774
has comment: http://stackoverflow.com/comment/41653786
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/26427901
has answer: http://stackoverflow.com/a/26428028
score: 0
answer count: 2
has body: Currently with my program, if the user inputs "cat" then the chatbot would spit back out "Tell me more about your pets." as expected. However this is also true if the letters cat are part of another word. So a word like catch would be picked up as catch and the chatbot would return "Tell me more about your pets." How else would I go about to polish up the keyword detection? if (statement.indexOf("cat") >=0) { response = "Tell me more about your pets.";
has comment: http://stackoverflow.com/comment/41500753
has comment: http://stackoverflow.com/comment/41501022
has title: Detecting Whole Words for JAVA
accepted answer: http://stackoverflow.com/a/26428028
has comment: http://stackoverflow.com/comment/41501349
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26427998
tagged with: java
possible better answer: http://stackoverflow.com/a/26427998
type: Question

http://stackoverflow.com/q/26510341
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26511752
tagged with: inheritance
has body: The searchDatabase method will accept a query string and search the ArrayList to see if the object contains the query(your search should be case-insensitive!) as the name or is of that object type (Hint: use instanceof to check for object type). It will return an ArrayList containing all of the values whose objects contain the query string. I need to see if the query is the same as a class name (Such as Don/Talent/Overseer) and if it is then I print all objects of that type. If it's equal to a name in one of the objects then I just print that object out. I am confused as to what to do from here. I am looping through all goons in the Database and checking if they are instances of Don/Overseer/Talents and if they are then checking if the user query is equal to the object type and if it is print all of those objects but if it isn't then checking if it's equal to the name of any objects of type "Dom" in the arraylist. protected ArrayList&lt;Goon&gt; searchDatabase(String query) { ArrayList&lt;Goon&gt; clone = new ArrayList&lt;Goon&gt;(); for(Goon a : goonDB) { if(a instanceof Don) { if(query.equalsIgnoreCase("don")) { } else { if(a.getName().equals(query)) { } } } else if(a instanceof Overseer) { }
tagged with: arraylist
answer count: 2
tagged with: instanceof
type: UnansweredQuestion
has title: Searching Arraylists with instanceof for a user query JAVA
has answer: http://stackoverflow.com/a/26511053

http://stackoverflow.com/comment/41375016
comment on: http://stackoverflow.com/a/26358215
has text: You are quite right Peter, I edited the question, thanks
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26377347
has title: Inconsistent Fetch From Google App Engine Datastore
type: Question
tagged with: datanucleus
has comment: http://stackoverflow.com/comment/41417802
possible better answer: http://stackoverflow.com/a/26390748
tagged with: google-cloud-datastore
has comment: http://stackoverflow.com/comment/41416869
downvote count: 0
has answer: http://stackoverflow.com/a/53846525
answer count: 3
linked to: http://stackoverflow.com/q/8112331
upvote count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/26390748
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/27872202
tagged with: jdo
has comment: http://stackoverflow.com/comment/41416883
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41415958
has body: I have an application deployed in Google app engine. I am getting inconsistent data when i fetch an entity by id immediately after updating that entity. I'm using JDO 3.0 to access the app engine datastore. I have an entity Employee @PersistenceCapable(detachable = "true") public class Employee implements Serializable { /** * */ private static final long serialVersionUID = -8319851654750418424L; @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, defaultFetchGroup = "true") @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true") private String id; @Persistent(defaultFetchGroup = "true") private String name; @Persistent(defaultFetchGroup = "true") private String designation; @Persistent(defaultFetchGroup = "true") private Date dateOfJoin; @Persistent(defaultFetchGroup = "true") private String email; @Persistent(defaultFetchGroup = "true") private Integer age; @Persistent(defaultFetchGroup = "true") private Double salary; @Persistent(defaultFetchGroup = "true") private HashMap&lt;String, String&gt; experience; @Persistent(defaultFetchGroup = "true") private List&lt;Address&gt; address; /** * Setters and getters, toString() * */ } Initially, when I create an employee I do not set the fields salary and email. I update the Employee entity to add salary and email later. The update works fine and the data gets persisted into the appengine datastore. However, when i immediately try to fetch the same employee entity by id, I sometimes get the stale data, where salary and email are null. The code I use to create and to fetch the employee entity is given below. public Employee create(Employee object) { Employee persObj = null; PersistenceManager pm = PMF.get().getPersistenceManager(); Transaction tx = null; try { tx = pm.currentTransaction(); tx.begin(); persObj = pm.makePersistent(object); tx.commit(); } finally { if ((tx != null) &amp;&amp; tx.isActive()) { tx.rollback(); } pm.close(); } return persObj; } public Employee findById(Seri…
has answer: http://stackoverflow.com/a/27891239
accepted answer: http://stackoverflow.com/a/27891239
score: 7
linked to: http://stackoverflow.com/q/6173555
tagged with: java
has comment: http://stackoverflow.com/comment/41415597

http://stackoverflow.com/q/26430133
has comment: http://stackoverflow.com/comment/41505290
has answer: http://stackoverflow.com/a/26430325
type: AnsweredQuestion
has body: If i export my app in android studio while runProguard=true and install APK to real device my App stops and says: Unfortunately [yourapp] has stopped. Whats the problem? i left proguard-rules.txt file in default status: # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the ProGuard # include property in project.properties. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} Without Proguard my app installs and runs perfectly.
type: Question
tagged with: android
has title: exporting APK with Proguard fails in real device install
tagged with: proguard
accepted answer: http://stackoverflow.com/a/26430325
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/26434449
tagged with: graphics
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41541077
has body: There is some not a silly issue.. Let's say, we have a lot of only black colored png icons (over hundred), but they may consist of more than one unconnected elements like: What I want to achieve is to make set of colors and automatically color(fill black content) all those graphics, and leave the rest parameters like unchanged(format/resolution). Is there any library or approach that should be applied to perform this task? Thanks
has answer: http://stackoverflow.com/a/26434947
type: Question
has comment: http://stackoverflow.com/comment/41521622
linked to: http://stackoverflow.com/q/6881578
answer count: 1
has title: Automatic color fill?
score: 0
has comment: http://stackoverflow.com/comment/41513735
has comment: http://stackoverflow.com/comment/41536186
tagged with: colors
has comment: http://stackoverflow.com/comment/41545580
tagged with: android
accepted answer: http://stackoverflow.com/a/26434947

http://stackoverflow.com/comment/41548981
comment on: http://stackoverflow.com/q/26441826
type: QuestionComment
has text: I've looked through the code several times. I cannot see where you are calling `inCollision`. Perhaps you should point it out to us.
type: Comment
score: 0

http://stackoverflow.com/q/26444643
upvote count: 1
has comment: http://stackoverflow.com/comment/41532153
has comment: http://stackoverflow.com/comment/41532507
has comment: http://stackoverflow.com/comment/41532058
has answer: http://stackoverflow.com/a/26445872
tagged with: int
tagged with: char
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/26445872
type: Question
possible better answer: http://stackoverflow.com/a/26445246
has comment: http://stackoverflow.com/comment/41531979
answer count: 2
has body: When I converted the alphabet characters from char to int in java gave me the values 97 to 122, in alphabetical order. int a = (char) 'a'; //97 int b = (char) 'b'; //98 ... What are the char values when converted to int gives the values 1 to 96?
has answer: http://stackoverflow.com/a/26445246
score: -2
has title: What are the char symbols that when converted to ints make up the int values 1 to 96?
has comment: http://stackoverflow.com/comment/41532341
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/41532326

http://stackoverflow.com/q/26494775
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has body: I have a class with an AsyncTask that collect data for me. I created an object of this class, make ArrayList, and when it comes back to another class, this ArrayList becomes empty. This is the class for storing and calculating data private Context context; public ArrayList&lt;Category&gt; categories; public CategoriesParser(Context context) { this.context = context; } public void startParse(){ this.categories = new ArrayList&lt;Category&gt;(); new JSONParse().execute(); } private static String url = "http://..."; private static final String TAG_CAT = "categories"; private static final String TAG_ID = "id"; private static final String TAG_TITLE = "title"; private static final String TAG_PARENT = "parent"; JSONArray android = null; public ArrayList&lt;Category&gt; getCategories(){ return categories; } private class JSONParse extends AsyncTask&lt;String, String, JSONObject&gt; { private ProgressDialog pDialog; @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(context); pDialog.setMessage("Подождите пожалуйста ..."); 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; } @Override protected void onPostExecute(JSONObject json) { try { // Getting JSON Array from URL android = json.getJSONArray(TAG_CAT); for(int i = 0; i &lt; android.length(); i++){ JSONObject c = android.getJSONObject(i); // Storing JSON item in a Variable String id = c.getString(TAG_ID); String title = c.getString(TAG_TITLE); String parent = c.getString(TAG_PARENT); categories.add(new Category(id, title, parent)); //data is STILL here } pDialog.dismiss(); //even now } catch (JSONException e) { e.printStackTrace(); } } } } Main_Activity this.catParser = new CategoriesParser(this); this.catParser.startParse(); mTitle = (String)getTitle(); //and here cat…
has answer: http://stackoverflow.com/a/26494963
has title: Object become empty android
tagged with: object
upvote count: 0
score: -1
answer count: 1
accepted answer: http://stackoverflow.com/a/26494963
favorite count: 0
tagged with: android

http://stackoverflow.com/q/26476669
score: -1
has answer: http://stackoverflow.com/a/26484490
type: Question
has answer: http://stackoverflow.com/a/26550130
answer count: 2
has comment: http://stackoverflow.com/comment/41591774
upvote count: 0
has comment: http://stackoverflow.com/comment/41686075
linked to: http://stackoverflow.com/q/6555040
has comment: http://stackoverflow.com/comment/41603605
has comment: http://stackoverflow.com/comment/41603392
has title: How do I implement a JOptionpane List Option?
has comment: http://stackoverflow.com/comment/41684178
accepted answer: http://stackoverflow.com/a/26550130
favorite count: 0
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/41603223
has body: Github Link to full download https://github.com/Jamiex304/Chess-Game I am currently developing a chess game and have ran into a problem Currently when a pawn reaches the end of the other side of the board it changes into a white queen by default I want to let the user decide what it changes into (hence the rules of chess) i was toying around with JOption pane but I am having trouble getting it to work i can run it with our errors but it does nothing for me in terms of chaging the pieces i am looking for some help with the implementation, The queen code snipet (didnt include full code here because it would be to long all files found on github link if you wish to run the file for yourselfs) if(!validMove){ int location=0; if(startY ==0){ location = startX; } else{ location = (startY*8)+startX; } String pieceLocation = pieceName+".png"; pieces = new JLabel( new ImageIcon(pieceLocation) ); panels = (JPanel)chessBoard.getComponent(location); panels.add(pieces); } else{ if(success){ int location = 56 + (e.getX()/75); if (c instanceof JLabel){ Container parent = c.getParent(); parent.remove(0); pieces = new JLabel( new ImageIcon("WhiteQueen.png") ); parent = (JPanel)chessBoard.getComponent(location); parent.add(pieces); } else{ Container parent = (Container)c; pieces = new JLabel( new ImageIcon("WhiteQueen.png") ); parent = (JPanel)chessBoard.getComponent(location); parent.add(pieces); } } else{ if (c instanceof JLabel){ Container parent = c.getParent(); parent.remove(0); parent.add( chessPiece ); } else { Container parent = (Container)c; parent.add( chessPiece ); } chessPiece.setVisible(true); } } If you want to see what I mean by all means download and run the java file itself you can see the way it only changes to the white queen
has comment: http://stackoverflow.com/comment/41684909
tagged with: swing
downvote count: 1
tagged with: chess
has comment: http://stackoverflow.com/comment/41591183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41612053
tagged with: performance
has comment: http://stackoverflow.com/comment/41612455
has comment: http://stackoverflow.com/comment/41618061
possible better answer: http://stackoverflow.com/a/26484490
tagged with: java
has comment: http://stackoverflow.com/comment/41591199

http://stackoverflow.com/q/26506560
has answer: http://stackoverflow.com/a/26511011
type: AnsweredQuestion
has title: Working with UTC Dates in Javascript and MongoDB
tagged with: java
accepted answer: http://stackoverflow.com/a/26511011
tagged with: date
has body: I am having a problem correctly working with UTC-Dates and wondered if there is a common way of dealing with this. Basically I have a javascript datepicker where I can select a date. For example: 2014-10-15 When this gets converted to a string with JSON.stringify() I end up with: 2014-10-14T22:00:00+0200 I am assuming that this is correct because the date gets converted to a UTC date. When the date then arrives at my java (jersey) REST interface it looks like the following: 2014-10-14T22:00:00.000Z The date appears to be the same, but the +0200 is no longer there. Possibly causing the problem. The next step is to save the date to my mongo database, which then stores the date like this: 2014-10-14 20:00:00.000Z Another 2 hours have been taken off and I am assuming that this is because the date is being converted to UTC "again". The problem I have now is that if I reload the page, my input field now says: 2014-10-14 instead of 2014-10-15. If I manually change the date in the database and add the 2 hours again to end up with "2014-10-14T22:00:00.000Z", the date is displayed correctly in the frontend again - the date is now correctly represented as local time because 2 hours on top of 2014-10-14T22:00:00.000Z makes 2014-10-15 again. My question is: Where do I need to make my change to prevent this from happening? a) I only use local time in the frontend, so that mongodb then only converts to UTC. This does not sound very safe to me as I am sure this will cause problems when the client is being called from different time-zones. b) I only work with UTC dates, but I then need to somehow tell mongodb that the date is already in UTC and therefore there is no need to convert it again. Any help would be greatly appreciated. Thanks, Michael EDIT I think I may be a step further now. I can tell the json deserializer what date-format can be expected. I have configured this to: new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") If I test the date format manually I end up with SimpleDat…
type: Question
tagged with: mongodb
score: 2
downvote count: 0
tagged with: javascript
answer count: 1
has comment: http://stackoverflow.com/comment/41648155
tagged with: momentjs
favorite count: 0
has comment: http://stackoverflow.com/comment/41647242
upvote count: 2

http://stackoverflow.com/q/26436271
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/6828076
upvote count: 3
tagged with: java
tagged with: character-encoding
type: Question
has answer: http://stackoverflow.com/a/26436287
has title: Java Why is the length of the string twice 36 while it contains just 18 characters?
downvote count: 0
tagged with: string-length
has body: The following string st contains just 18 characters but when I print its length it shows 36 its twice. String st = ""; System.out.println(st.length()); Note: The string contains symbols which I am going to use in my chat application, the length maybe vary due to 16bit and 8bit characters but I am blurry about it.
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/26436287

http://stackoverflow.com/comment/41467256
has text: @MarkoTopolnik: Things should not be deprecated unless nearly every user would be able to switch to something which is, at least for that user, just as good in every way. Some code uses `Cloneable` in ways that would be difficult to mimic any other way.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26398951

apache
tag name: apache
tags question: http://stackoverflow.com/q/26360322
tags question: http://stackoverflow.com/q/26407397
tags question: http://stackoverflow.com/q/26473007
tags question: http://stackoverflow.com/q/26420512
tags question: http://stackoverflow.com/q/26403674
tags question: http://stackoverflow.com/q/26391418
tags question: http://stackoverflow.com/q/26361722
tags question: http://stackoverflow.com/q/26418069
tags question: http://stackoverflow.com/q/26420836
tags question: http://stackoverflow.com/q/26506669
tags question: http://stackoverflow.com/q/26418768
tags question: http://stackoverflow.com/q/26383619
tags question: http://stackoverflow.com/q/26384925
type: Tag
tags question: http://stackoverflow.com/q/26375515
tags question: http://stackoverflow.com/q/26428487
tags question: http://stackoverflow.com/q/26419654
tags question: http://stackoverflow.com/q/26396476

http://stackoverflow.com/q/26509092
linked to: http://stackoverflow.com/q/4728625
has comment: http://stackoverflow.com/comment/41659156
type: Question
has comment: http://stackoverflow.com/comment/41648573
tagged with: java
tagged with: tag-soup
accepted answer: http://stackoverflow.com/a/26509210
tagged with: groovy
has body: I'm parsing some HTML4 with Groovy's XmlSlurper backed by a tagsoup Parser. I'm getting the text() of a node successfully, but HTML &amp;nbsp; spaces are giving me some difficulty when trying to test for equality with another value. Specifically, .trim() does not actually trim the string of all whitespace. It appears to me that the characters on either side of the value are whitespace (see code below) but String.trim() isn't trimming the way I'd expect. As can be seen from the code sample, Character.isSpaceChar() for the first character in the string is determined to be a space character. Why is String.trim() not trimming this value that I've obtained from XmlSlurper? @Grab('org.ccil.cowan.tagsoup:tagsoup:1.2.1') import org.ccil.cowan.tagsoup.Parser def html = ''' &lt;html&gt; &lt;body&gt; &lt;span id="interested"&gt;&amp;nbsp;hello&amp;nbsp;&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; ''' def slurper = new XmlSlurper(new Parser() ) def document = slurper.parseText(html) def value = document.'**'.find { it['@id'] == 'interested' }.text() println "value=[${value}]" println "first char isWhitespace? ${Character.isWhitespace(value.charAt(0))}" println "first char isSpaceChar? ${Character.isSpaceChar(value.charAt(0))}" assert 'hello' == value.trim() Yields: value=[ hello ] first char isWhitespace? false first char isSpaceChar? true Exception thrown Assertion failed: assert 'hello' == value.trim() | | | | | hello | hello false I'm using Groovy Version: 2.3.6 JVM: 1.8.0 Vendor: Oracle Corporation OS: Mac OS X
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
has title: Groovy XmlSlurper with TagSoup and non-breaking space values
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26509210
upvote count: 2
has comment: http://stackoverflow.com/comment/41648619
tagged with: xmlslurper

http://stackoverflow.com/q/26363585
has comment: http://stackoverflow.com/comment/41387184
has comment: http://stackoverflow.com/comment/41384929
has body: Here is the original web crawler in which i wrote: (Just for reference) https://github.com/domshahbazi/java-webcrawler/tree/master This is a simple web crawler which visits a given initial web page, scrapes all the links from the page and adds them to a Queue (LinkedList), where they are then popped off one by one and each visited, where the cycle starts again. To speed up my program, and for learning, i tried to implement using threads so i could have many threads operating at once, indexing more pages in less time. Below is each class: Main class public class controller { public static void main(String args[]) throws InterruptedException { DataStruc data = new DataStruc("http://www.imdb.com/title/tt1045772/?ref_=nm_flmg_act_12"); Thread crawl1 = new Crawler(data); Thread crawl2 = new Crawler(data); crawl1.start(); crawl2.start(); } } Crawler Class (Thread) public class Crawler extends Thread { /** Instance of Data Structure **/ DataStruc data; /** Number of page connections allowed before program terminates **/ private final int INDEX_LIMIT = 10; /** Initial URL to visit **/ public Crawler(DataStruc d) { data = d; } public void run() { // Counter to keep track of number of indexed URLS int counter = 0; // While URL's left to visit while((data.url_to_visit_size() &gt; 0) &amp;&amp; counter&lt;INDEX_LIMIT) { // Pop next URL to visit from stack String currentUrl = data.getURL(); try { // Fetch and parse HTML document Document doc = Jsoup.connect(currentUrl) .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36") .referrer("http://www.google.com") .timeout(12000) .followRedirects(true) .get(); // Increment counter if connection to web page succeeds counter++; /** .select returns a list of elements (links in this case) **/ Elements links = doc.select("a[href]"); // Relative URL // Add newly found links to stack addLinksToQueue(links); } catch (IOException e) { //e.printStackTrace(); System.out.println(…
has comment: http://stackoverflow.com/comment/41387643
possible better answer: http://stackoverflow.com/a/39776443
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/41387397
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26364724
has title: Implementing Threads Into Java Web Crawler
tagged with: concurrency
tagged with: web-crawler
has answer: http://stackoverflow.com/a/39776443
has comment: http://stackoverflow.com/comment/41386879
score: 0
answer count: 2
tagged with: jsoup
has comment: http://stackoverflow.com/comment/41387104
has comment: http://stackoverflow.com/comment/41647894
has answer: http://stackoverflow.com/a/26364724
has comment: http://stackoverflow.com/comment/41388250

http://stackoverflow.com/a/26498671
type: Answer
has body: You're going to want to put your data into a collection object and populate a ListView.
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26498609

http://stackoverflow.com/comment/41630073
type: Comment
comment on: http://stackoverflow.com/q/26498714
score: 0
has text: import java.util.*; public class GameOfLife { public static void main(String[] args) { int steps = 0; int size = 0; Scanner sc = new Scanner(System.in); String [] layout = new String[size]; System.out.println("The Game of Life."); System.out.print("How many steps in time? "); steps = sc.nextInt(); System.out.print("What size is the grid? "); size = sc.nextInt(); System.out.println("Enter the intial grid layout:"); for(int i = 0; i < size; i++) { layout [i] = sc.nextLine(); } } }
type: QuestionComment

http://stackoverflow.com/q/26417778
tagged with: java
type: Question
tagged with: perl
tagged with: tripledes
has comment: http://stackoverflow.com/comment/41554078
upvote count: 2
linked to: http://stackoverflow.com/q/2817407
has title: TripleDes Perl<->Java (CCBill implementation)
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
score: 2
has body: I ran into a problem when trying to integrate with a payment processor (CCBill) who is requesting a string to be encrypted to be used as a token, using the TripleDES standard. My application is in Java, and the result I am getting back is not what the payment processor expects. There is a post here that is addressing Perl&lt;->PHP and Perl&lt;->ColdFusion, but no solutions for Java. The PERL version of the code looks like this: #!/usr/bin/perl # Perl Crypt Calamity (here be...something) use strict; use CGI; use MIME::Base64; use Crypt::TripleDES; my $cgi = CGI-&gt;new(); my $param = $cgi-&gt;Vars(); $param-&gt;{key} = "bC5PEcLzvb+jY1FZWuP4pw50"; $param-&gt;{string} = "subscriptionId=0214288302000000207"; my $des = Crypt::TripleDES-&gt;new(); my $enc = $des-&gt;encrypt3($param-&gt;{string}, $param-&gt;{key}); $enc = encode_base64($enc); $enc =~ s/\n//gs; # resulting string (enc): yvT6h6jti9krth/BaA3cO3ABKult8N38fnEb24MS0BwnX+gc1NNgEA== This is my little Java class trying to do the same as the perl script, but which returns a completely different value: import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; import org.apache.commons.codec.binary.Base64; public class Encoder { public String encrypt(String message, String encryptionKey) throws Exception { // handle the key SecretKey secretKey = null; byte[] keyValueAsBytes = Arrays.copyOf(encryptionKey.getBytes("UTF-8"), 24); DESedeKeySpec keySpec = new DESedeKeySpec(keyValueAsBytes); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede"); secretKey = keyFactory.generateSecret(keySpec); // cipher Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, secretKey); // encode byte[] plainText = message.getBytes("UTF-8"); byte[] encryptedText = cipher.doFinal(plainText); return Base64.encodeBase64String(encryptedText); } public static void main(String[] args) throws…
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/41592153
type: QuestionComment
has text: Ollegn, please read Mad's link before replying. He's not asking for you to post your whole code. Rather if you have similar questions, you will want to create a new program, one that is quite small, compiles, runs, and demos your problem and that's it. Otherwise we're reduced to guessing, and while ppskillet guessed right today, that's the exception not the rule. Again, your question could be improved on.
score: 0
comment on: http://stackoverflow.com/q/26477521
type: Comment

http://stackoverflow.com/q/26374793
has title: Why am I getting java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet error?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41405848
tagged with: spring
has comment: http://stackoverflow.com/comment/41406975
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/41405824
tagged with: java
type: Question
has body: I am trying to learn Spring MVC. So far I have done the following: web.xml <?xml version="1.0" encoding="UTF-8"?> SpringMvc spring org.springframework.web.servlet.DispatcherServlet 1 spring / spring-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.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"> <mvc:resources location="/resources/" mapping="/resources/**"/> <mvc:annotation-driven/> <context:component-scan base-package="com.awesomememe"></context:component-scan> </beans> HomeController.java package com.awesomeme.controllers; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @Controller public class HomeController { public String showHomePage(Model model){ model.addAttribute("message","Smrita is awesome"); return "home"; } } home.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Home Page Message from the controller is ${message} And my directory structure looks as follows: And I have added the following jars : But when I try to run the app I get the following error: What exactly am I missing. Any suggestion would be of great help.
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/41405846
tagged with: dispatcher
has comment: http://stackoverflow.com/comment/41405833
has comment: http://stackoverflow.com/comment/41405908

http://stackoverflow.com/comment/41520292
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26437975
score: 0
has text: I don't understand why you expect it to print numbers instead of the asterisks.

http://stackoverflow.com/q/26511365
has comment: http://stackoverflow.com/comment/41653303
tagged with: windows-7
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: swt
upvote count: 1
has comment: http://stackoverflow.com/comment/41653380
type: Question
has comment: http://stackoverflow.com/comment/41652815
tagged with: java
has comment: http://stackoverflow.com/comment/41653197
has comment: http://stackoverflow.com/comment/41653079
downvote count: 0
has title: SWT Right click menu item selection listener not getting called.
favorite count: 0
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/41653117
tagged with: events
has body: We have a client who complains that the right click functionality suddenly stopped working. So I debugged a little and found that the RCP app is not throwing any exceptions, just that the right click menuItem listeners are not getting called. Here is the outline of the code that we use in our app. rightClickListener = new Listener(){ public void handleEvent(Event event) { TRACER.trace("Handle event for tree's right click listener"); if(treeComp.tree.getSelectionCount()&gt;0 &amp;&amp; PlatformUI.getPreferenceStore().getBoolean("RightClickEnabled")){ TRACER.trace(currSelection + " selected."); rcmenu.selectionMenu(event); } } }; treeComp.tree.addListener(SWT.MenuDetect,rightClickListener); And the actual menu and menu items are created in the rcmenu class. Listeners are added there. public void selectionMenu(Event event){ TRACER.trace("Begin selectionMenu()"); shell = tree.getShell(); display = tree.getDisplay(); Menu menu = null; try{ menu = new Menu(shell, SWT.POP_UP); }catch(Exception e){ ERROR_REPORTER.report("Error when creating menu ", e); } menu.addDisposeListener(new DisposeListener(){ @Override public void widgetDisposed(DisposeEvent e) { TRACER.trace("Menu Disposed"); } }); TreeItem[] selectionItems = tree.getSelection(); if(selectionItems.length=1){ addMenuItems(menu); } handleSetEnableLogic(); //after adding the menu items in addMenuItems(menu) we enable them here in this method. menu.setLocation(event.x, event.y); menu.setVisible(true); try{ while (!menu.isDisposed() &amp;&amp; menu.isVisible()) { boolean readAndDispatch = display.readAndDispatch(); if (!readAndDispatch){ display.sleep(); } } }catch(Exception e){ ERROR_REPORTER.report("Error during dispatch event ",e); } try{ menu.dispose(); }catch(Exception e){ ERROR_REPORTER.report("Error during menu dispose ",e); } TRACER.trace("End selectionMenu()"); } And the addMenuItems() method is as shown item_modify = new MenuItem(menu, SWT.PUSH); item_modify.setText("Modify"); //Modify //"Modify" item_modify.a…

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/26388706
tag name: restful-architecture

http://stackoverflow.com/a/26489021
type: Answer
has body: There is nothing wrong with using a boolean method as a condition for a while-loop. However, stuffing loop functionality in the loop header is, generally, a bad practice. It leads to a code which is difficult to understand, debug (breakpoints become inconvenient) and maintain.
answers question: http://stackoverflow.com/q/26488849
score: 0

http://stackoverflow.com/comment/41422423
type: Comment
comment on: http://stackoverflow.com/q/26383789
score: 0
type: QuestionComment
has text: Show your ResultReceiver.java class

http://stackoverflow.com/a/26469436
answers question: http://stackoverflow.com/q/26469356
upvote count: 1
has body: You have to close the stream opened by: new FileInputStream(aFile)
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26469356
score: 1

http://stackoverflow.com/q/26471482
tagged with: java
has comment: http://stackoverflow.com/comment/41584784
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/26788216
accepted answer: http://stackoverflow.com/a/26483432
favorite count: 0
score: 0
tagged with: sdk
answer count: 3
tagged with: android
has title: Got new HDD so and downloaded Android SDK. Making new project gives 100+ errors
has comment: http://stackoverflow.com/comment/41581392
has body: Today I downloaded Android SDK together with Eclipse. I ran Android SDK Manager and let him download every API. When I wanted to actually do something I went in Eclipse and made a new project. Program gave me aroun 108 errors and console showed this: [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:79: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:25: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:37: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. [2014-10-20 19:17:59 - reewwww] D:\AndroidProjects\appcompat_v7\res\values-v21\styles_base.xml:41: error: Error retr…
has comment: http://stackoverflow.com/comment/41580631
possible better answer: http://stackoverflow.com/a/26677939
upvote count: 1
has comment: http://stackoverflow.com/comment/41581121
has comment: http://stackoverflow.com/comment/41584914
downvote count: 1
has answer: http://stackoverflow.com/a/26677939
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26483432
has comment: http://stackoverflow.com/comment/41580508

http://stackoverflow.com/q/26489172
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: gradle
has comment: http://stackoverflow.com/comment/41637740
type: Question
has title: Start elasticsearch within gradle build for integration tests
has answer: http://stackoverflow.com/a/26528643
has body: Is there a way to start elasticsearch within a gradle build before running integration tests and afterwards stop elasticsearch? My approach so far is the following, but this blocks the further execution of the gradle build. task runES(type: JavaExec) { main = 'org.elasticsearch.bootstrap.Elasticsearch' classpath = sourceSets.main.runtimeClasspath systemProperties = ["es.path.home":"$buildDir/elastichome", "es.path.data":"$buildDir/elastichome/data"] }
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26528643
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/41616071

http://stackoverflow.com/a/26478567
has body: Look into lexical analysis and parsing (same as if you were writing a compiler). You might not even need a parser if you're not requiring full statements.
score: 3
answers question: http://stackoverflow.com/q/26478445
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41593845
downvote count: 0

http://stackoverflow.com/q/26389358
linked to: http://stackoverflow.com/q/390150
has title: Authentication against remote active directory in java on Linux
tagged with: java
tagged with: authentication
has body: My scenario is similar to what's described in this question How to authenticate users with a customer's (remote) active directory server, except that our web application is Java based and runs under CentOS Linux. I have been searching and reading a lot, but don't seem to be able to find useful information for my scenario because of the following: Although there are different solutions for Java based application to authenticate against AD (Kerberos, NTLM, LDAP from Authenticating against Active Directory with Java on Linux), but I don't think they are for remote AD authentication from what I read. Kerberos is said to be the "new" mechanism for AD authentication recommended by Microsoft. However, it seems that either conf files or system properties are required for it to work. Our web application is SaaS based so the same code base will server multiple customers, and I don't see a good way to make Kerberos work nicely (even if it support remote authentication, which I don't see). Product Jespa uses NTLMv2 based authentication (again, I am not seeing it supports remote authentication), which is "old" and not recommended by Microsoft anymore. Plus it requires the creation of a "computer account". Okta has a solution that will work for the remote scenario I am facing. However, it requires the installation of an "AD agent" on customers AD server to handle all SAML communications between the "AD agent" and a Java library sitting with our web application. It's definitely a concern for our customers to install a software in their infrastructure that they are not a customer of. Now based on my recent reading, best security practices are for organizations to hide Active Directory server behind firewall and do not expose it to the Internet. I wonder whether that means there will not be "direct" path of remote Active Directory authentication integration regardless of tools and libraries, and some kind of trusted agent or proxy residing within the customer infrastructure will be …
type: Question
has answer: http://stackoverflow.com/a/26391587
has comment: http://stackoverflow.com/comment/42464696
linked to: http://stackoverflow.com/q/8934753
tagged with: active-directory
has comment: http://stackoverflow.com/comment/41434636
has comment: http://stackoverflow.com/comment/41432989
score: 0
tagged with: linux
answer count: 1
has comment: http://stackoverflow.com/comment/41435125
has comment: http://stackoverflow.com/comment/41434064
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41433957
has comment: http://stackoverflow.com/comment/41433168

http://stackoverflow.com/comment/41451227
type: AnswerComment
comment on: http://stackoverflow.com/a/26400527
type: Comment
has text: I used a StringBuilder which is more efficient than string concatenation, so far. You could also inline all 3 checks instead of using an `Predicate` or you could make that `Predicate` an static class member.
score: 0

http://stackoverflow.com/a/26481405
has comment: http://stackoverflow.com/comment/41598761
has body: You need to create different entity manager for each datasource and in the code you need to define unitName property of @PersistenceContext to inject particular entity manager.
type: Answer
answers question: http://stackoverflow.com/q/26480665
has comment: http://stackoverflow.com/comment/41668792
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/26372036
tagged with: java
has comment: http://stackoverflow.com/comment/41457792
has answer: http://stackoverflow.com/a/26421229
has body: We are porting our application over to GAE and one of the options it has is to render to a printer? Is this possible in GAE (being in the cloud it may not have the concept of printers). If so, how is that done? (Google search does not appear to show anything.) thanks - dave
type: Question
has title: How can we write to a printer in GAE?
score: 0
tagged with: printing
answer count: 1
has comment: http://stackoverflow.com/comment/41477084
has comment: http://stackoverflow.com/comment/41401563
has comment: http://stackoverflow.com/comment/41403310
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/a/26401150
has comment: http://stackoverflow.com/comment/41574385
has comment: http://stackoverflow.com/comment/41456646
has comment: http://stackoverflow.com/comment/41453758
type: Answer
has comment: http://stackoverflow.com/comment/41457651
has comment: http://stackoverflow.com/comment/41457826
answers question: http://stackoverflow.com/q/26400323
score: 2
has comment: http://stackoverflow.com/comment/41453800
has comment: http://stackoverflow.com/comment/41457142
has comment: http://stackoverflow.com/comment/41457350
upvote count: 2
has comment: http://stackoverflow.com/comment/41456985
accepted answer of: http://stackoverflow.com/q/26400323
has comment: http://stackoverflow.com/comment/41565054
has comment: http://stackoverflow.com/comment/41564125
has comment: http://stackoverflow.com/comment/41456146
has comment: http://stackoverflow.com/comment/41482592
has comment: http://stackoverflow.com/comment/41453617
has comment: http://stackoverflow.com/comment/41565347
has comment: http://stackoverflow.com/comment/41452785
has body: In most of the cases the answer is NO, you can't export a .war with an embedded database created with eclipse. You have to export your database files separately and upload them on the production server. This usually means that you have to install the database server you used while developing and export your DDL and table data. In your particular case (MySQL with Tomcat) we can say that MySQL is not built for embedded use, unless using an out of date and not quite complete MySQL Embedded Library for Java, which would led you to some major changes in your project DB configuration. You can altough change your DB server, switching from MySQL to Derby or H2 (thanks to @specializt for this )which have the possibility to embed the server directly in your war . This is taken directly from an Eclipse Corner Article on Creating Database Web Applications with Eclipse. BEWARE!!: the linked article is deprecated thus you should not rely on it completely. The quoted part is still sensitive for your case and covers a Derby database deploy. Deploying the Database When you are ready to deploy the application to a production Tomcat application server, you must copy the Derby database data folders to the application server computer. You then have a couple of options for accessing the Derby database from your deployed application. You can install Derby on the application server computer, and run it in client/server mode. Your application connects to the database using the same technique as I've demonstrated in this article. The drawback to this approach is that you have two server processes to manage: Tomcat and Derby. You can use Derby in embedded mode. In this scenario, the Derby engine runs inside the Tomcat process. You don't have to stop and start Derby separately from Tomcat. For more information, refer to the Derby website.
has comment: http://stackoverflow.com/comment/41565420
has comment: http://stackoverflow.com/comment/41522184
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41459568
has comment: http://stackoverflow.com/comment/41574612

http://stackoverflow.com/q/26434589
has title: RMI server won't return class instances
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26434893
has answer: http://stackoverflow.com/a/26434936
tagged with: rmi
tagged with: java
type: Question
answer count: 2
tagged with: jsp
score: 0
has body: I had a JSP/Servlet application that was running ok with MySQL. Now I had to implement the same application with RMI for my DAO's. Through some tests I can see that it works fine when I return int, String or something like that. Remote methods with these type of objects works fine. But when I try to call a remote method that returns an instance of a class I created (Produto) all the attributes of that object are null. For example: I have a db table with 3 rows. The method returns a list with 3 objects on it, but if I call product.getName() for example I get this: null null null On the following code, I'm not even using any database methods. Just a test method to see that an object produto will be returned with null attributes. My interface, ProdutoDAO: public interface ProdutoDAO extends Remote{ public Produto teste() throws RemoteException; } My (what would be my Server) ProdutoDAOImpl: public class ProdutoDAOImpl implements ProdutoDAO { private Connection con; Produto prod = new Produto(); public ProdutoDAOImpl() throws RemoteException { con = Conecta.getConnection(); } public Produto teste(){ prod.setNome("Testing! THIS WILL RETURN AS NULL"); return prod; } public static void main(String args[]) { int port = 1099; try { ProdutoDAOImpl obj = new ProdutoDAOImpl(); ProdutoDAO stub = (ProdutoDAO) UnicastRemoteObject.exportObject(obj, 0); Registry registry = LocateRegistry.createRegistry(port); registry.bind("ProdutoDAO", stub); System.err.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } } Index.jsp Produto prod = new Produto(); try { Registry registry = LocateRegistry.getRegistry(null); ProdutoDAO produtoDAO = (ProdutoDAO) registry.lookup("ProdutoDAO"); prod = produtoDAO.teste(); %&gt;&lt;%= prod.getNome() %&gt;&lt;% } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } The problem is that &lt;%= prod.getNome() %&gt; is printing null. Is…

http://stackoverflow.com/comment/92276502
comment on: http://stackoverflow.com/a/26410276
type: Comment
has text: Please don't have an empty catch block. Bad practice.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41440026
score: 0
comment on: http://stackoverflow.com/q/26393644
has text: You could start by increasing the heap space limit.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26444065
answer count: 1
tagged with: android-spinner
has body: so basically I have 6 spinner with 6 edittext and a button, and when I click the button I want all the selected element in spinners + edit text to go in a textview(display).I have this java code to make that, but the code doesnt fit my actual code: import android.content.Intent; import android.os.Bundle; import android.widget.TextView; public class Affichage extends ActionBarActivity { TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_affichage); textView = (TextView) findViewById(R.id.afficher); Intent intent = getIntent(); if(intent!=null) { String day = intent.getStringExtra("day"); String month = intent.getStringExtra("month"); String text = intent.getStringExtra("text"); textView.setText(day + "\n" + month + "\n" + text); } else { textView.setText("Intent is null"); } }} In this code, spinner were defined like this: String[] days = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; But I define my spinner in an xml file(mainactivity.xml) like this for example: <Spinner android:id="@+id/spinner3" android:layout_width="130dp" android:layout_height="35dp" android:layout_above="@+id/button1" android:layout_alignLeft="@+id/spinner2" android:entries="@array/Products" /> And I populate the spinner this way, in an array,in xml file: p1 p2 p3 So how to adapt the first code to the way im defining spinner? thank you
tagged with: textview
favorite count: 0
score: -1
type: UnansweredQuestion
tagged with: android
downvote count: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26444311
has title: adapting this code to mine? (android)
tagged with: android-layout
upvote count: 0

http://stackoverflow.com/comment/41540278
has text: I usually use a tooltip.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26448524

http://stackoverflow.com/comment/41498756
score: 0
comment on: http://stackoverflow.com/q/26426842
type: Comment
type: QuestionComment
has text: The trapezoidal rule (also known as the trapezoid rule or trapezium rule) is a technique for approximating a definite integral. The trapezoidal rule works by approximating the region under the graph of the function f(x) as a trapezoid and calculating its area.

http://stackoverflow.com/a/26501625
downvote count: 0
answers question: http://stackoverflow.com/q/26499698
has body: This should work futureValue = balance; double doubleBalance = balance*2; while(futureValue &lt;= doubleBalance) { futureValue += futureValue * (( 1 + r)/100); years++; } System.out.println("Your balance will double in " + years + " year(s).");
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41650069
score: 1
accepted answer of: http://stackoverflow.com/q/26499698
type: AcceptedAnswer

http://stackoverflow.com/a/26385728
accepted answer of: http://stackoverflow.com/q/26384257
type: Answer
has body: There's no official standard for CSV but there is an unofficial one, and the sample you show doesn't comply with it. Values containing the double-quote character should be quoted, and the double-quote characters within the value should be doubled. valueA1,"va""lueB"" of A1" (It's permitted but not required to put double quotes around "valueA1" in this example.) Since you're creating the CSV file yourself, from an XLS file, you should fix the problem in the conversion. Excel 2007 does this correctly if you save as "CSV (MS-DOS) (*.csv)". I recall that older versions of Excel had an CSV options screen that you might need to play with.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26384257
score: 0

http://stackoverflow.com/comment/41638119
type: Comment
has text: If you created the views using xml then the answer is no. If you add them dynamically then you can use the removeView and addView methods.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26501833

http://stackoverflow.com/comment/41468933
type: QuestionComment
type: Comment
has text: See here (many-to-many): http://stackoverflow.com/questions/5127129/mapping-many-to-many-association-table-with-extra-columns
score: 1
comment on: http://stackoverflow.com/q/26409737

http://stackoverflow.com/comment/41592288
score: 0
comment on: http://stackoverflow.com/a/26477654
type: AnswerComment
type: Comment
has text: Thank you for the array answer, it saved me from having to rewrite my code. It did the trick! Thank you!

http://stackoverflow.com/a/26478576
answers question: http://stackoverflow.com/q/26478228
score: 0
type: Answer
has body: Java arrays have no definition of full or of empty. Consider int[] foo = {0}; int[] bar = new int[1]; Is foo full because it has a value assigned to its only position? Is bar empty because it has no values assigned? Both arrays are the same, they both have one value stored and in both cases the contain the value 0. Full implies you can't add any more items, you can never add new items to java arrays, just replace existing items, so either all arrays are full or full does not make sense for a java array. I say it is the second.

http://stackoverflow.com/a/26518135
has body: You can use an array of Textview's instead of trying to define custom name based on row number etc.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26475396
score: 0
accepted answer of: http://stackoverflow.com/q/26475396
type: Answer

http://stackoverflow.com/comment/41640220
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26503902
has text: I've done `if(savedLogName != null && savedLogNumber != null && savedLogTime != null) { logName = new ArrayList(Arrays.asList(TextUtils.split(savedLogName.getString("logName", null), ","))); logNumber = new ArrayList(Arrays.asList(TextUtils.split(savedLogNumber.getString("logNumber", null), ","))); logTime = new ArrayList(Arrays.asList(TextUtils.split(savedLogTime.getString("logTime", null), ","))); }else{ logName = null; logNumber = null; logTime = null; }` Still doesn't work. The if loop gets executed.

http://stackoverflow.com/q/26468347
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/35246765
has answer: http://stackoverflow.com/a/26471009
type: UnansweredQuestion
has title: CMN0420E Websphere Commerce error
has body: I am trying to generate Web Service client from a WSDL in an IBM Websphere Commerce project. I am very new to Websphere Commerce. I follow default wizardry approach of RAD for doing this. It seems it creates the stubs and works fine when I tested it from a simple JAVA class. However, when I generated a client in WebsphereCommerceServerExtensionsLogic, it throws CMN0420E error. Do I need to register client or add some kind of JARs in any other module(WC or Store). What am I missing? Please see the detailed logs below: 0000003b CommerceSrvr E com.ibm.commerce.command.ECCommandTarget executeCommand CMN0420E: The following command exception has occurred during processing: "java.lang.NoSuchMethodError: org/apache/axis/description/ParameterDesc.setOmittable(Z)V". java.lang.NoSuchMethodError: org/apache/axis/description/ParameterDesc.setOmittable(Z)V at org.tempuri.BasicHttpBinding_IAuthorizationServiceStub._initOperationDesc1(BasicHttpBinding_IAuthorizationServiceStub.java:30) at org.tempuri.BasicHttpBinding_IAuthorizationServiceStub.&lt;clinit&gt;(BasicHttpBinding_IAuthorizationServiceStub.java:20) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:200) at org.tempuri.AuthorizationServiceLocator.getBasicHttpBinding_IAuthorizationService(AuthorizationServiceLocator.java:55) at org.tempuri.AuthorizationServiceLocator.getBasicHttpBinding_IAuthorizationService(AuthorizationServiceLocator.java:50) at com.epicor.www.Retail.Store.IAuthorizationServiceProxy._initIAuthorizationServiceProxy(IAuthorizationServiceProxy.java:18) at com.epicor.www.Retail.Store.IAuthorizationServiceProxy.&lt;init&gt;(IAuthorizationServiceProxy.java:8) at com.trifecta.perfumania.dao.GiftCardDAO.checkBalance(GiftCardDAO.java:99) at com.trifecta.perfumania.commands.controller.AddGiftCardCmdImpl.validateGiftCard(AddGiftCardCmdImpl.java:115) at com.trifecta.perfumania.commands.controller.AddGiftCardCmdImpl.validateParameters(AddGiftCardCmdImpl.j…
tagged with: java
tagged with: websphere-commerce

http://stackoverflow.com/comment/41519677
comment on: http://stackoverflow.com/q/26437026
type: Comment
type: QuestionComment
has text: "The program writes the text with a new line [...]" Your little code snippet exactly shows that you write the text _without_ a newline. With calling `newLine()` on your `BufferedWriter` you will get what you want, exactly as @MrunalGosar's answer explains.
score: 0

http://stackoverflow.com/q/26449102
has answer: http://stackoverflow.com/a/26449126
has answer: http://stackoverflow.com/a/26449560
score: 0
type: UnansweredQuestion
has title: make a user re-enter values if value not correct
has comment: http://stackoverflow.com/comment/41539902
tagged with: java
type: Question
answer count: 2
has body: Sorry for the basic question - just starting on JAVA Trying to validate value user enters before next value is entered in sequence - Program is running to next if statement in sequence instead of asking me to re-enter start time ... System.out.println("Enter start time in 24 hr format eg 0800 "); startTime = in.nextInt(); if (startTime &gt;=0000 &amp;&amp; startTime &lt;=2400) // verify hours { System.out.println ( "thank you start hours entered "); } else if (startTime &gt;2400 ) // verify hours { System.out.println ( "invalid start hours ! please re-enter "); } System.out.println("Enter stop time in 24 hr format eg 1700 "); stopTime = in.nextInt(); if (stopTime &gt;=0000 &amp;&amp; stopTime &lt;=2400) // verify hours { System.out.println ( "thank you stop hours entered "); } else if (stopTime &gt;2400 ) { System.out.println ( "invalid stop hours ! please re-enter "); } // proceed with rest of program

http://stackoverflow.com/comment/41547131
score: 0
type: Comment
type: QuestionComment
has text: If you need speed and this really is your main bottleneck, try to avoid multidimensional arrays altogether.
comment on: http://stackoverflow.com/q/26453100

http://stackoverflow.com/a/26425350
answers question: http://stackoverflow.com/q/26424939
type: Answer
score: 1
upvote count: 1
has body: Try to execute a SHUTDOWN statement before you stop the server
accepted answer of: http://stackoverflow.com/q/26424939
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/41465062
type: Comment
type: QuestionComment
has text: See my answer below.
comment on: http://stackoverflow.com/q/26400206
score: 0

http://stackoverflow.com/comment/41552752
type: AnswerComment
type: Comment
has text: @bknight Is there any advantage in using custom image and color classes ? The above code just uses `BufferedImage` and works fine. Plus, you don't update `h` and `w` after rotating whereas you did in your previous version.
comment on: http://stackoverflow.com/a/26452585
score: 0

http://stackoverflow.com/comment/41615797
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26462952
has text: @LucaBassoRicci I though it was maybe the java class of for output.. maybe something is wrong there...

http://stackoverflow.com/q/26501527
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26547627
has comment: http://stackoverflow.com/comment/41695452
upvote count: 2
has title: Cannot create webservice Client provided by weblogic
tagged with: web-services
answer count: 1
has body: Using weblogic 12c - I am having a following error while creating a webservice client from wsdl url. URL ile alive what is the problem? Error loading [http://localhost:7001/app/AppDetailsEndPointService?wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Illegal XML character: 0x0 org.apache.xmlbeans.impl.piccolo.io.IllegalCharException: Illegal XML character: 0x0 at org.apache.xmlbeans.impl.piccolo.xml.UTF8XMLDecoder.decode(UTF8XMLDecoder.java:196) at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader$FastStreamDecoder.read(XMLStreamReader.java:762 at org.apache.xmlbeans.impl.piccolo.xml.XMLStreamReader.read(XMLStreamReader.java:162) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yy_refill(PiccoloLexer.java:3474) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:3958) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345) at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:663) at com.eviware.soapui.support.xml.XmlUtils.createXmlObject(XmlUtils.java:253) at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.readCleanWsdlFrom(WsdlLoader.java:147) at com.eviware.soapui.impl.wsdl.support.wsdl.WsdlLoader.loadXmlObject(WsdlLoader.java:116) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:539) at com.eviware.soapui.impl.wsdl.support.xsd.SchemaUtils.getDefinitionParts(SchemaUtils.java:528) at com.eviware.soapui.impl.support.definition.support.AbstractDefinitionCache.update(Abstra…
has comment: http://stackoverflow.com/comment/41688902
accepted answer: http://stackoverflow.com/a/26547627
has comment: http://stackoverflow.com/comment/41666400
tagged with: java
tagged with: jakarta-ee
tagged with: weblogic
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/26414590
has body: Whenever you do something that can throw a particular type of Exception, you have to have something in place to deal with it. This can be either of two things: surround it with a try/catch block; add the Exception type to the throws clause of your method. In your case, you're invoking the LinearAlgebra.vectorAdd() method, and that method can throw an IllegalOperandException (presumably if one of its arguments is dodgy). That means that the method in which you invoke it can also throw that exception. Either catch it, or add throws IllegalOperandException to the signature of the method in which that line occurs. Sounds as though it's your main method, so it would become public static void main(String[] args) throws IllegalOperandException { //... } This is called letting the exception propagate upwards. To catch the exception instead, you'd have try { System.out.println(LinearAlgebra.VectorAdd(v1, v2)); } catch (IllegalOperandException e) { // do something with the exception, for instance: e.printStackTrace(); // maybe do something to log it to a file, or whatever... // or you might be able to recover gracefully... // or if there's just nothing you can do about it, then you might: System.exit(1); } That will allow you to deal with it when it happens. It enables you to return some specific result instead if it all goes wrong, or (in this case) print an error and terminate the program.
accepted answer of: http://stackoverflow.com/q/26414522
downvote count: 0
answers question: http://stackoverflow.com/q/26414522
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/41411253
comment on: http://stackoverflow.com/q/26378017
type: Comment
type: QuestionComment
has text: It is in base64 or somethig else?
score: 1

http://stackoverflow.com/q/26513065
type: UnansweredQuestion
upvote count: 1
answer count: 0
score: 1
tagged with: java
has title: Rotate an image while it is being used
tagged with: image
type: Question
tagged with: rotation
downvote count: 0
tagged with: awt
has comment: http://stackoverflow.com/comment/41666697
has body: I am creating a car game and I want to rotate my car ( Image ) when I'm using the car but I don't know how. I've tried a few things that don't work. Here is what I have: g2d.drawImage(DEFAULT_CAR_SKIN, DEFAULT_BOX.x, DEFAULT_BOX.y, null); DEFAULT_BOX.setLocation(DEFAULT_BOX.x + 1, DEFAULT_BOX.y); if (Game.rotateFront == true) { AffineTransform identity = new AffineTransform(); AffineTransform trans = new AffineTransform(); trans.setTransform(identity); trans.rotate(Math.toRadians(Game.Angle)); g2d.drawImage(DEFAULT_CAR_SKIN, trans, this); } But this code draws a new image but with the characteristics that I want.
favorite count: 0

http://stackoverflow.com/comment/41411300
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26377928
has text: Are you certain that the `sessiontimezone` of the Java session is actually +8? I would wager that the Java app server's locale is setting the session time zone to GMT.

http://stackoverflow.com/q/26448813
has comment: http://stackoverflow.com/comment/41539504
tagged with: http://stackoverflow.com/tag/csv
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41539283
has answer: http://stackoverflow.com/a/26449042
type: AnsweredQuestion
score: 3
has title: How to sort csv file by two columns in java?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41539306
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26449042
tagged with: sorting
has body: How to sort CSV file by two columns? Right now I am able to sort it by one column. I need to sort it by first two columns. How to do it? Here is the code that I am using for sorting it by its first column: import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; public class Practice { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new FileReader("sample-input.csv")); Map&lt;String, List&lt;String&gt;&gt; map = new TreeMap&lt;String, List&lt;String&gt;&gt;(); String line = reader.readLine();//read header while ((line = reader.readLine()) != null) { String key = getField(line); List&lt;String&gt; l = map.get(key); if (l == null) { l = new LinkedList&lt;String&gt;(); map.put(key, l); } l.add(line); } reader.close(); FileWriter writer = new FileWriter("output.csv"); writer.write("Symbol, Exchange, Minimum, Average, Maximum, Total\n"); for (List&lt;String&gt; list : map.values()) { for (String val : list) { writer.write(val); writer.write("\n"); } } writer.close(); } private static String getField(String line) { return line.split(",")[0]; // extract value you want to sort on } } EDIT: The output after two column sort becomes like: ABC,X,0.10,10 ABC,X,0.09,20 ABC,X,0.11,10 ABC,X,0.11,20 ABC,X,0.10,10 ABC,Y,0.09,10 ABC,Y,0.08,10 ABC,Z,0.12,15 ABC,Z,0.10,15 DEF,X,0.17,10 DEF,X,0.14,10 DEF,Y,0.15,15 DEF,Y,0.15,15 DEF,Y,0.17,15 DEF,Y,0.16,15 DEF,Y,0.17,15 DEF,Z,0.14,10 DEF,Z,0.15,10 I need the output like this: ABC,X,0.09,0.11 ABC,X,0.09,0.11 ABC,X,0.09,0.11 ABC,X,0.09,0.11 ABC,X,0.09,0.11 ABC,Y,0.08,0.9 ABC,Y,0.08,0.9 ABC,Z,0.10,0.12 ABC,Z,0.10,0.12 DEF,X,0.14,0.17 DEF,X,0.14,0.17 DEF,Y,0.15,0.17 DEF,Y,0.15,0.17 DEF,Y,0.15,0.17 DEF,Y,0.15,0.17 DEF,Y,0.15,0.17 DEF,Z,0.14,0.15 DEF,Z,0.14,0.15 But, I want the third column to display the minimum of the values for X, then min value for Y, and then Z …

http://stackoverflow.com/comment/41522860
score: 0
type: AnswerComment
type: Comment
has text: Thank you, this one was great. You have my +1 and correct answer/
comment on: http://stackoverflow.com/a/26378642

http://stackoverflow.com/a/26499363
has body: As I can't imagine any project/assignment would call for allowing an end user to decide on the names of variables, I'm going to answer the question under an assumption: The project wants the Class() you create to have a field called "name" and let the user manipulate it. public class Foo() { String name; //other stuff //Contstructor makes it easy Foo(String _name) { name = _name; } } Then in your code you can do: int counter = 0; while (text.hasNextLine()) { ++counter; } Foo[] myFoos; myFoos = new Foo[counter]; Start the read over: int i = 0; while(text.hasNextLine()) { System.out.print("Please enter class name: "); tempName = kb.next(); //sort text into parts for the class Foo[i] = new Foo(tempName); ++i; } There are more efficient ways of doing it, depending on how you want to get the number of lines in the file, when and what you want to do stuff with those lines, and the method you want to use for the second read. But, this should give you an idea of how to compose your custom solution.
has comment: http://stackoverflow.com/comment/41631795
answers question: http://stackoverflow.com/q/26499092
has comment: http://stackoverflow.com/comment/41631446
score: 0
type: Answer

dll
tags question: http://stackoverflow.com/q/26465624
tags question: http://stackoverflow.com/q/26488707
type: Tag
tags question: http://stackoverflow.com/q/26507231
tag name: dll

http://stackoverflow.com/a/26470277
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41578417
answers question: http://stackoverflow.com/q/26470240
has comment: http://stackoverflow.com/comment/41578235
has body: Try to return string like below: public String toString() { StringBuilder output = new StringBuilder(lastName + ", " + firstName); output.append(phoneNumber); if (relationship == 'F') return output.append("Friend").toString(); else if (relationship == 'M') return output.append("Family Member").toString(); else if (relationship == 'B') return output.append("Buisness Associate").toString(); else return output.append("Not Specified").toString(); }
downvote count: 0
type: Answer

http://stackoverflow.com/q/26403312
has answer: http://stackoverflow.com/a/26403475
has body: I got the first two columns but now i am having trouble aligning the rest of the columns with their headers What prints Male Female Rank Name Number Name Number 1 Christopher 52,308 Jessica 46,459 2 Matthew 44,783 Ashley 45,548 3 Joshua 43,203 Brittany 36,535 4 Daniel 33,791 Amanda 34,389 5 Nicholas 27,901 Samantha 25,862 6 Anthony 25,070 Sarah 25,801 7 William 24,875 Stephanie 24,850 8 Kyle 22,695 Jennifer 22,217 9 Jacob 21,992 Elizabeth 20,738 System.out.printf("%4.5s %-3.20s %,-9d%10.20s%,9d%n", rank,maleName,maleCount,femaleName,femaleCount);
answer count: 2
tagged with: printing
has answer: http://stackoverflow.com/a/26403455
accepted answer: http://stackoverflow.com/a/26403455
upvote count: 1
favorite count: 0
has title: How to print format align a list of columns
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26403475
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: format
tagged with: alignment

httpclient
tags question: http://stackoverflow.com/q/26387186
type: Tag
tags question: http://stackoverflow.com/q/26362372
tags question: http://stackoverflow.com/q/26379853
tags question: http://stackoverflow.com/q/26508925
tags question: http://stackoverflow.com/q/26397006
tag name: httpclient

http://stackoverflow.com/comment/41487205
type: Comment
has text: This helped, the other parts (and the repository) will be most likely generated with Spring ROO, or if I can help it with Maven subgenerators
type: AnswerComment
comment on: http://stackoverflow.com/a/26380872
score: 0

http://stackoverflow.com/comment/41420637
has text: Ok, thanks again. With getAdapter(...) instead of adapt(...) this park of code finally works.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26382283
type: AnswerComment

http://stackoverflow.com/comment/41780668
comment on: http://stackoverflow.com/q/26507389
score: 0
type: Comment
type: QuestionComment
has text: @Shirish Have you looked at: http://stackoverflow.com/questions/13121606/after-upgrading-from-primefaces-3-2-to-3-4-1-noclassdeffounderror-org-primefa

http://stackoverflow.com/q/26459832
has comment: http://stackoverflow.com/comment/41561577
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41559263
score: -2
tagged with: java
type: Question
downvote count: 2
answer count: 1
favorite count: 0
has body: I'm writing a code that needs to continually updates a text file in a loop: remove the actual content and write another one. The problem is the update in not done correctly. It uses the previous version of the file. For example, in loop 4, the called file is the file updated in the loop 3. My question is how to update my file correctly ? public static void main(String[] args) throws IOException { for(int level:levels){ RecipeTree.CloneTree(root, partialroot); for(int i =0; i&lt;100; i++){ RecipeTree.removalcondition = RecipeTree.levelOfConditions(depth, length, recipe, level); System.out.println(removalcondition); RecipeTree.PartialTree(partialroot, RecipeTree.removalcondition); // Here the update of the file InitSTRIPSPlanner(partialroot); for(RecipeTree leaf: partialroot.getLeaves()){ ........... } } } public static void InitSTRIPSPlanner(RecipeTree root) throws IOException{ String adresseBut = System.getProperty("user.dir") + "/prolog/test-2p/Domain_knowledge.pl"; String adresseSource = System.getProperty("user.dir") + "/prolog/test-2p/STRIPS_planner.pl"; try { copyFileUsingStream(new File(adresseSource), new File(adresseBut)); } catch (IOException e) { e.printStackTrace(); } File fw = new File (adresseBut); OutputStream output = new FileOutputStream(fw,true); output.write("\n".getBytes()); output.flush(); FromTreeToProlog(root,output); output.close(); } public static void FromTreeToProlog(RecipeTree root, OutputStream output) throws IOException{ for(RecipeTree leaf: root.getLeaves()){ if (leaf.getHead().getPostconditions() != null) { output.write("\n".getBytes()); output.flush(); output.write("\n".getBytes()); output.flush(); if (leaf.getHead().getPreconditions() != null) { output.write(("strips_preconditions(" + leaf.getHead().getName().toLowerCase() + ",[" + leaf.getHead().getPreconditions().toLowerCase()+ "]).").getBytes()); output.write("\n".getBytes()); output.flush(); } else { output.write(("strips_preconditions(" + leaf.getHead().getName().toLowerCase() +…
has title: Java : How to contnually update a file in a loop
has answer: http://stackoverflow.com/a/26461326
upvote count: 0

http://stackoverflow.com/a/26491954
upvote count: 5
has comment: http://stackoverflow.com/comment/41644970
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26491937
has comment: http://stackoverflow.com/comment/41645206
type: Answer
has body: Your sleeping the paint method, something you should never do. It's bad to call Thread.sleep(...) on the Swing event thread, but it's a sin to do it in any painting method. So now the applet can't draw. Remember that any painting method must do nothing but painting, and must do it blazingly fast. It shouldn't do any program logic, it shouldn't directly do animation, it should just paint. Use a Swing timer as any similar question will show you how to do. Also, never draw directly in the applet but instead in the paintComponent method of a JPanel that the applet holds. So create your JPanel, override its paintComponent method, and draw using fields of the class. Then change the state of those fields in your Timer and call repaint() on the JPanel. Edit And yes, you should avoid using null layouts as that's preventing you from easily and adequately adding components to your GUI. Instead in this situation, a FlowLayout, the default layout for JPanel, would work great. For example: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.ExecutionException; import javax.swing.*; @SuppressWarnings("serial") public class SpaceCadets extends JApplet { @Override public void init() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { SpaceCadetsPanel panel = new SpaceCadetsPanel(); getContentPane().add(panel); setSize(SpaceCadetsPanel.PREF_W, SpaceCadetsPanel.PREF_H); } }); } catch (InvocationTargetException | InterruptedException e) { e.printStackTrace(); } } } @SuppressWarnings("serial") class SpaceCadetsPanel extends JPanel { public static final int PREF_W = 600; public static final int …

http://stackoverflow.com/comment/41549911
type: Comment
comment on: http://stackoverflow.com/q/26454311
type: QuestionComment
has text: @andersschuller I'm just trying to learn about how to use queues in a linked list and this method was suggested to me
score: 0

http://stackoverflow.com/comment/41469255
type: QuestionComment
comment on: http://stackoverflow.com/q/26408994
score: 0
type: Comment
has text: Thank you. Now I understand. I tried to activate the JRF here, to do a test, but I got the same error in this post: https://community.oracle.com/thread/2175893?tstart=0 And I don't have another wlst.cmd in my instalation. Do I need a special instalation to have access to JRF resources?

http://stackoverflow.com/comment/41520185
type: Comment
comment on: http://stackoverflow.com/q/26437840
has text: Unavailable is a variable?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41433751
has text: Well. I am developing a java program which needs to know the disk space of remote Linux server. My client program is supposed to transfer certain files by checking total space on a remote machine.
comment on: http://stackoverflow.com/q/26390098
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26361152
type: Question
has comment: http://stackoverflow.com/comment/41380592
linked to: http://stackoverflow.com/q/7052422
tagged with: java-2d
has comment: http://stackoverflow.com/comment/41380264
duplicate of: http://stackoverflow.com/q/7052422
score: 0
has body: Assuming you have an image composed of lines drawn in different directions NE NS SE e.t.c, and with different colors(yellow, blue, black)? Can someone tell me what would be the fastest way to write a java code to be able to get the paths(x,y co-ordintes used to draws the lines) for lines of a particular color. without having to loop through all the pixels of the image.
tagged with: swing
has comment: http://stackoverflow.com/comment/41380284
has title: Java code to get the areas of a particular color in an image
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41380549
answer count: 0

http://stackoverflow.com/q/26511198
downvote count: 2
upvote count: 1
type: Question
has title: problems with drawing and displaying shapes on images
tagged with: java
score: -1
tagged with: image
tagged with: optimization
tagged with: draw
answer count: 1
has answer: http://stackoverflow.com/a/26511566
favorite count: 0
has body: Please bear with me, english is neither my first nor my second language. The basic idea is to load images and draw a few shapes using the mouse. I created these three java classes (see code at the botoom end): 1 Main, right now this is only used to initiate the second class "Action" 2 Action, this class should contain every action the user performs on the ui (drawing, loading images...) 3 UI, this class creates the UI and holds every object concerning the UI (Jlabels, JButtons, JFrame ....) At this stage it (kinda) works as intended but i have still a few questions. I tried to visualise every problem but i can only use 2 images in this post, so please use this image. 1) Drawing shapes works as itended but as soon as the user creates (releases the mousebutton) the shape it should be displayed in blue colours. This doesn't work unless a new shape is drawn. How can i update the shape after the user releases the button? As seen in the first and second frame of the linked image. -- solved added a call to paint(); in the mouseReleased event. 2) The first shape is darker/a fuller colour than the rest of the shapes, see second and fifth frame in the linked image. I am not sure how to correct this one, any ideas? --solved exchanged this two lines g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); g2d.fill(shape); 3) None of the shapes are visiable after resizing the UI, as seen in the third and foruth frame of the linked image. How do i force the program to draw them? -- solved added ComponentListener to the JFrame, now calling paint() in the componentResized() event 3.1) How do i get the shapes to stay within the original image (the black square) after resizing? Fourth frame of the linked image. -- solved i forgot to add an offset if the frame was resized.... 4) Checking if the mouse is still within the borders of the image works only if the user doesn't use the scrollpanes. Does anyone have a better idea to check if the mouse is within the image b…
has comment: http://stackoverflow.com/comment/41652601
type: UnansweredQuestion

http://stackoverflow.com/comment/41534838
score: 0
type: Comment
type: QuestionComment
has text: It's adding all the calls together, there's a simple case that would return 1 but your example isn't it.
comment on: http://stackoverflow.com/q/26446077

http://stackoverflow.com/a/38804620
answers question: http://stackoverflow.com/q/26489504
score: 0
has body: In Maven run the 'package' goal and in Gradle run the 'assemble' task, both will update the target directory, and cause devserver to reload the application.
type: Answer

http://stackoverflow.com/a/26446694
upvote count: 1
has body: use: turtles.remove(turtles.size() -1 ); because: turtles.get(turtles.size() - 1) = null; will not work because you can only assign a value to a variable The method .remove(int) removes the object form the ArrayList with the specified id. here is a 'description' of the .remove() method: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#remove%28int%29
answers question: http://stackoverflow.com/q/26446684
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/41615358
score: 0
comment on: http://stackoverflow.com/q/26487103
type: Comment
type: QuestionComment
has text: That might be an option. I've used it for date conversions, didn't come in mind to work a way for number fields as well. Thanks for now!

shared-libraries
tags question: http://stackoverflow.com/q/26410408
tag name: shared-libraries
type: Tag

http://stackoverflow.com/a/26511534
answers question: http://stackoverflow.com/q/26487437
score: 0
has body: One problem I see is that SWIG needs to be told about template instantiations; otherwise, it won't generate code for them. %template(spRenderer) vtkSmartPointer&lt;vtkRenderer&gt;; %template(spWindow) vtkSmartPointer&lt;vtkRenderWindow&gt;; %template(spInteractor&gt; vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;;
type: Answer

http://stackoverflow.com/comment/41406420
comment on: http://stackoverflow.com/q/26375165
type: Comment
type: QuestionComment
has text: try googling to see how you can change read/write persmissions of a folder or file. Make your code set rw permissions and see if it helps.
score: 1

http://stackoverflow.com/a/26412351
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/102734514
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/65601875
has comment: http://stackoverflow.com/comment/107236107
accepted answer of: http://stackoverflow.com/q/26381064
has body: Yes, this is a limitation of Querydsl. Since the normal path initialization uses final fields a limit needs to be used. Luckily path initialization can be customized in many ways http://www.querydsl.com/static/querydsl/3.5.0/reference/html/ch03s03.html#d0e2181
upvote count: 11
answers question: http://stackoverflow.com/q/26381064

http://stackoverflow.com/a/26413347
score: 3
type: AcceptedAnswer
downvote count: 0
has body: Use .Exec instead of .Run and capture the objects StdErr: var exec = oShell.Exec(strRun); WScript.Echo(exec.StdErr.ReadAll()); (specify --verbose in strRun; use the docs to replace the hack above with a more robust version that checks .Status and .StdErr.AtEndOfStream)
answers question: http://stackoverflow.com/q/26412324
type: Answer
has comment: http://stackoverflow.com/comment/41475282
accepted answer of: http://stackoverflow.com/q/26412324
upvote count: 3

http://stackoverflow.com/comment/41531459
comment on: http://stackoverflow.com/q/26444049
score: 0
type: Comment
type: QuestionComment
has text: If the new value depends on the number of diagonal zero neighbors in the original matrix, should you not make a new matrix to put in these values? Modifying the same matrix would result in incorrect values for the remaining elements.

http://stackoverflow.com/q/26490315
has comment: http://stackoverflow.com/comment/41614414
has answer: http://stackoverflow.com/a/26490562
answer count: 3
has body: I am getting tons of info log messages from a 3rd party jar in my eclipse console. Cracking open the jar I see that it uses java.util.logging. I would like to set the output level for their jar to WARNING. I have tried using the VM argument of -Djava.util.logging.config.file=pathToMy/JUL.properties where the contents of the file are: handlers=java.util.logging.ConsoleHandler .level=WARNING java.util.logging.ConsoleHandler.level=WARNING Unfortunately, that made no difference in the output. If it makes it any easier, my application uses SLF4J. So if there's a simple answer using a different logging mechanism I can just switch my binding to use it.
accepted answer: http://stackoverflow.com/a/26492711
has title: Suppress java util logging from 3rd party jar
type: AnsweredQuestion
tagged with: logging
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26492711
tagged with: slf4j
score: 0
has answer: http://stackoverflow.com/a/38909271
possible better answer: http://stackoverflow.com/a/26490562

http://stackoverflow.com/q/26375546
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41407036
upvote count: 2
tagged with: java
downvote count: 2
has title: How to insert an integer after each digit in an integer value
has answer: http://stackoverflow.com/a/26375584
has body: Hi I have an integer value as 1234. Now I want to insert programatically an integer like 3 before each digit in my integer value . So I want final result as 31323334.
has answer: http://stackoverflow.com/a/26375832
has answer: http://stackoverflow.com/a/26375631
type: Question
has comment: http://stackoverflow.com/comment/41407006
possible better answer: http://stackoverflow.com/a/26375584
accepted answer: http://stackoverflow.com/a/26375832
score: 0
has comment: http://stackoverflow.com/comment/41407029
favorite count: 0
has answer: http://stackoverflow.com/a/26376964
answer count: 4

http://stackoverflow.com/q/26360427
score: 0
type: Question
tagged with: android-fragments
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26360466
type: UnansweredQuestion
tagged with: android
has title: Android CalendarView Getting close
has body: Hi In my application I am using navigation drawer to move from one fragment to another. In this I added one calendar view in one fragment. Whenever I try to open that fragment. the application is getting closed. By saying Unfortunately the applicatio "..." is closed. And my fragment.xml is &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;CalendarView android:id="@+id/calendarView1" android:layout_width="match_parent" android:layout_height="300dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="53dp" /&gt; &lt;/RelativeLayout&gt; And the java file is public class AcademicCalendarFrament extends Fragment { public AcademicCalendarFrament(){} CalendarView calendar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_calendar, container, false); return rootView; } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); calendar=(CalendarView) getActivity().findViewById(R.id.calendarView1); //initializes the calendarview initializeCalendar(); } public void initializeCalendar() { // TODO Auto-generated method stub calendar = (CalendarView) getActivity().findViewById(R.id.calendarView1); // sets whether to show the week number. calendar.setShowWeekNumber(false); // sets the first day of week according to Calendar. // here we set Monday as the first day of the Calendar calendar.setFirstDayOfWeek(2); //The background color for the selected week. calendar.setSelectedWeekBackgroundColor(getActivity().getResources().getColor(R.color.green)); //sets the color for the dates of an unfocused month. calendar.setUnfocusedMonthDateColor(getActivity().getResources().getColor(R.color.transparent)); //sets the color for the …

http://stackoverflow.com/q/26436356
has answer: http://stackoverflow.com/a/26436410
answer count: 1
has title: Java regex wildcard not accepted
accepted answer: http://stackoverflow.com/a/26436410
tagged with: regex
type: AnsweredQuestion
score: 0
has body: String depends2 = "success(job1) AND n(job2)"; depends2 = depends2.replaceAll("[\\s].(?i)[snd][\\s]*\\(", ""); System.out.println(depends2); I expect this to output success(job1) ANDjob2) Instead it outputs success(job1) AND n(job2)
type: Question
tagged with: java

http://stackoverflow.com/comment/41642846
type: Comment
type: QuestionComment
has text: @Flow - Will keep you posted. Thanks a lot for your help
comment on: http://stackoverflow.com/q/26497773
score: 0

http://stackoverflow.com/comment/41607891
type: AnswerComment
has text: This code gives me always 0. Bubble sort working well but I really have issues here...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26486528

http://stackoverflow.com/comment/41454423
score: 0
type: Comment
type: QuestionComment
has text: There's no action mapped, because there's no action configuration.
comment on: http://stackoverflow.com/q/26396423

http://stackoverflow.com/comment/41656545
comment on: http://stackoverflow.com/q/26513217
has text: All information is needed and required. Wondering other options.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41414517
type: QuestionComment
comment on: http://stackoverflow.com/q/26379715
type: Comment
has text: To get binary String you can call BigInteger.toString(2)
score: 0

http://stackoverflow.com/comment/41381736
comment on: http://stackoverflow.com/q/26361367
score: 0
type: Comment
type: QuestionComment
has text: @Seelenvirtuose Yes, you're right, I'd missed that it was being run 10 times. We are both right, in fact: the `wait()` is why the two `synchronized` methods can both be entered simultaneously; but it's also why they then both block and there's no more output.

http://stackoverflow.com/a/26477468
type: Answer
accepted answer of: http://stackoverflow.com/q/26477436
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26477436
has body: you can create a Set&lt;&gt; Object from this since it only contains unique objects. So all the dublicates will be eliminated. And the size of the Set will be the number of different words. Set can be creates like Set&lt;String&gt; mySet = new HashSet&lt;String&gt;(myArray); int differentWords = mySet.size(); Try doing this.
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/26396138
type: Question
has comment: http://stackoverflow.com/comment/41471189
answer count: 2
tagged with: spring-data-rest
has comment: http://stackoverflow.com/comment/41472605
has body: As the title says, when I am adding spring-data-rest-repository to existing working spring-data-rest-webmvc project, I start getting errors in project run. org.springframework.data spring-data-rest-webmvc 2.2.0.RELEASE org.springframework.data spring-data-rest-repository 1.0.0.RELEASE I am trying to follow this link for embeddedId conversion in Entity using @ConvertWith(MyConverter.class). However, just adding the jar has resulted into below error and lot of o.s.c.i.s.PathMatchingResourcePatternResolver loggings. java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey; at org.hibernate.cfg.AnnotationBinder.bindManyToOne(AnnotationBinder.java:2881) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1795) at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:963) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:796) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3788) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3742) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1410) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1844) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createN…
has answer: http://stackoverflow.com/a/26458123
has comment: http://stackoverflow.com/comment/41475819
linked to: http://stackoverflow.com/q/26249506
score: 0
has title: Adding spring-data-rest-repository to spring-data-rest-webmvc
tagged with: spring-data
linked to: http://stackoverflow.com/q/11851645
tagged with: spring
has answer: http://stackoverflow.com/a/26447988
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26447988
has comment: http://stackoverflow.com/comment/41467675
accepted answer: http://stackoverflow.com/a/26458123

w3c-validation
tags question: http://stackoverflow.com/q/26458728
type: Tag
tag name: w3c-validation

http://stackoverflow.com/a/26416552
has comment: http://stackoverflow.com/comment/41531679
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26416318
upvote count: 1
type: AcceptedAnswer
has body: Original expression: ( msg CONTAINS "A" ) or ( msg CONTAINS "B" ) or (msg CONTAINS "C") or (msg IS NULL) Desired inverse: NOT ( ( msg CONTAINS "A" ) or ( msg CONTAINS "B" ) or (msg CONTAINS "C") or (msg IS NULL) ) DeMorgan's Theorem applied: NOT( msg CONTAINS "A" ) AND NOT( msg CONTAINS "B" ) AND NOT(msg CONTAINS "C") AND NOT(msg IS NULL) Using available primitives: ( msg NOT CONTAINS "A" ) AND ( msg NOT CONTAINS "B" ) AND (msg NOT CONTAINS "C") AND (msg IS NOT NULL) Optionally, using the commutative law of conjunction, move the NOT NULL test first: (msg IS NOT NULL) AND (msg NOT CONTAINS "A") AND (msg NOT CONTAINS "B") AND (msg NOT CONTAINS "C") (Moving the NOT NULL test first may help if NOT CONTAINS fails when given a null first argument or if msg is NULL often and the system avoids performing the rest of the NOT CONTAINS checks.)
answers question: http://stackoverflow.com/q/26416318
type: Answer

http://stackoverflow.com/a/27920067
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26478445
type: Answer
upvote count: 1
has body: You could use a Java parser or create one using the BNF but the issue here is that you said the code may not be parsable so it will fail. My advice : use some custom regexp to detect special patterns in the code. Use as many as possible to have a good success rate. Some examples : for\s*\( (for loop) while\s*\( (while loop) [a-zA-Z_$][a-zA-Z\d_$]*\s*\( (constructor) \)\s*\{ (begin of a block / method) ... Yes it's a long shot but looking at what you want, you don't have many possibility.

http://stackoverflow.com/q/26425156
possible better answer: http://stackoverflow.com/a/26425420
downvote count: 0
has title: onLocationChanged isn't called even though the GPS provider is availble
accepted answer: http://stackoverflow.com/a/26425505
has answer: http://stackoverflow.com/a/26425420
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: gps
has body: I try to get the device current location using MyCustomLocationListener. My code passes here and indicated GPS and Network providers are both available. // getting GPS status isGPSEnabled = androidLocationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = androidLocationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) { // no network provider is enabled Log.e(MyLogger.TAG, "Non providers are enabled"); showEnableGpsDialog(); return; } if (isGPSEnabled) { androidLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, saveToSharedPrefListener); Log.d(MyLogger.TAG, "GPS Enabled"); } if (isNetworkEnabled) { if (androidLocationManager == null) { androidLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, saveToSharedPrefListener); Log.d(MyLogger.TAG, "Network Enabled"); } } but then the onLocationChanged is never called when I'm indoor. Only when I use a Fake GPS app, the onLocationChanged is called. How can I write a fallback (with\out timeout) to force invoke onLocationChanged I used to use another API requestSingleUpdate : What is the difference between these two in a matter of working indoor? if (isGPSEnabled) { androidLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, saveToSharedPrefListener); Log.d(MyLogger.TAG, "GPS Enabled"); } and if (BaseApplication.getCurrentActivity() != null) { locationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, saveToSharedPrefListener, BaseApplication.getCurrentActivity() .getMainLooper());
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/26425505
answer count: 2
tagged with: location

http://stackoverflow.com/comment/42178200
score: 0
type: Comment
type: QuestionComment
has text: @Alnitak My instructor was aware of that problem and said, few days after I asked here, that I can use my method or @Tarek's one because the probability of reaching `k` or `l` is infinitesimal
comment on: http://stackoverflow.com/q/26461382

http://stackoverflow.com/a/26705674
accepted answer of: http://stackoverflow.com/q/26353839
type: Answer
has body: Actualy to fix the issue i simply enabled the cookies. I guess it was necessary to load the page. The code: webClient.getCookieManager().setCookiesEnabled(true);
answers question: http://stackoverflow.com/q/26353839
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26440012
score: 1
tagged with: java
has body: I am completely new to maven and testng. I am using maven as build tool, and testng as my testing framework. I am not following the standard maven project structure. Now I want my pom.xml to execute the test cases in my project. The question is, how pom.xml knows what are the test cases to consider for execution?
has comment: http://stackoverflow.com/comment/41528303
has comment: http://stackoverflow.com/comment/41538712
type: Question
tagged with: automated-tests
has comment: http://stackoverflow.com/comment/41547116
accepted answer: http://stackoverflow.com/a/26440180
favorite count: 0
has title: How maven pom.xml identifies the testng test cases in a non-standard project structure?
answer count: 1
tagged with: pom.xml
tagged with: testng
has comment: http://stackoverflow.com/comment/41546277
upvote count: 2
tagged with: maven
downvote count: 1
has answer: http://stackoverflow.com/a/26440180
has comment: http://stackoverflow.com/comment/41524350
type: AnsweredQuestion

http://stackoverflow.com/a/26479281
answers question: http://stackoverflow.com/q/26468484
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26468484
has body: One thing I can see here is that your roll size is significantly larger than the channel capacity. So before rolling the file everything is stored in the channel which gets filled up after a point and starts throwing an error. instance_35001.channels.channel1.capacity=200000000 instance_35001.sinks.sink1.hdfs.rollSize=21521880492 Keep your role size around the block size you have set for HDFS. Also HDFS sink has a default batch size of 100. Change it to some larger value and see how it behaves.

size
type: Tag
tags question: http://stackoverflow.com/q/26368165
tag name: size
tags question: http://stackoverflow.com/q/26467896
tags question: http://stackoverflow.com/q/26408012
tags question: http://stackoverflow.com/q/26496034

http://stackoverflow.com/q/26384420
has body: i want to add index in map attribute i doen't have any idea about adding index in map attribute i have refer objectdb site link but i doesn't find soultion @index is enough for added index for example: @Entity @Table(name = Customer.TABLE_NAME) public class Country { @index @OneToMany(fetch = FetchType.LAZY) @JoinTable(name = Country.TABLE_TRANSLATION_NAME, joinColumns = @JoinColumn(name = Country.TABLE_NAME), inverseJoinColumns = @JoinColumn(name = NameTranslation.TABLE_NAME)) @MapKeyJoinColumn(name = Language.TABLE_NAME) private Map&lt;Language, NameTranslation&gt; names; } language and nametranslation has seperate entity
tagged with: jpa
downvote count: 0
answer count: 1
has title: how to adding index on Map fields in entity using object db
tagged with: objectdb
favorite count: 0
accepted answer: http://stackoverflow.com/a/26386997
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26386997
type: Question

http://stackoverflow.com/comment/41488375
type: Comment
has text: I assume that this is a task intended for practicing/learning loops. Otherwise, you could simply use http://docs.oracle.com/javase/8/docs/api/java/util/DoubleSummaryStatistics.html . However, a general hint: Aren't you annoyed by having to enter these numbers again and again, each time that you start the program? For the tests, just comment out all the manual input, and write `rain = new double[] { 1.2, 3.4, .... };`
comment on: http://stackoverflow.com/q/26416955
score: 0
type: QuestionComment

http://stackoverflow.com/q/26399822
has answer: http://stackoverflow.com/a/26399978
has answer: http://stackoverflow.com/a/26399920
has answer: http://stackoverflow.com/a/26400349
has answer: http://stackoverflow.com/a/26399916
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/26399878
has answer: http://stackoverflow.com/a/26399882
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26399878
tagged with: double
has body: Having trouble with the if statement. It gives me the error "Double cannot be converted to boolean." Some help would be appriciated import java.util.Scanner; public class Temperatures { public static void main(String[] args) { Scanner reader = new Scanner(System.in); // Write your code here. while(true){ System.out.println("Enter a temperature: "); double value = reader.nextDouble(); if ( value =&gt; 40 &amp;&amp; value &lt;= -30){ System.out.println("Too high or low temperature, try again"); }else{ Graph.addNumber(value); } if (value == 00){ break; } } } }
has comment: http://stackoverflow.com/comment/41450035
has title: Double cannot be converted to boolean
type: Question
has comment: http://stackoverflow.com/comment/41450159
tagged with: java
answer count: 6
accepted answer: http://stackoverflow.com/a/26399882
tagged with: boolean

http://stackoverflow.com/q/26471915
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41581340
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Fibonacci Range in Java
tagged with: fibonacci
downvote count: 0
has answer: http://stackoverflow.com/a/26472129
has comment: http://stackoverflow.com/comment/41581369
has comment: http://stackoverflow.com/comment/41581949
has comment: http://stackoverflow.com/comment/41581546
answer count: 1
has body: Hey guys i would like to create a java programm to find fibonacci sequence within a range of numbers. Now i would like to put another input so that i can get the inputs value of the fibonacci nubers For example if the min is 10 and max is 150 the result will be 13 21 35 55 89 144 but in the third input i would like if the value is 2 to give me only 13 and 21 as result. Any help?? My Code is: public void actionPerformed(ActionEvent e) { String x = t1.getText(); String y = t3.getText(); String o = t4.getText(); if (x.isEmpty()) { JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE); } else if (y.isEmpty()) { JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE); } else if (o.isEmpty()) { JOptionPane.showMessageDialog(TestFibMethodRange.this, "This field cannot be empty", "Required Field", JOptionPane.ERROR_MESSAGE); } else { if (isInteger(x) &amp;&amp; isInteger(y) &amp;&amp; isInteger(o)) { int min = Integer.valueOf(x); int max = Integer.valueOf(y); int nSequence = Integer.valueOf(o); for (int i = min; i &lt;= nSequence; i++) { if (x3 &lt;= max) { if (x3 &gt;= min) { t2.setText(t2.getText() + " " + x3); } x1 = x2; x2 = x3; x3 = x1 + x2; } } } } }
favorite count: 0
has comment: http://stackoverflow.com/comment/41581885
has comment: http://stackoverflow.com/comment/41581906
accepted answer: http://stackoverflow.com/a/26472129

http://stackoverflow.com/q/26473728
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41584886
type: Question
has answer: http://stackoverflow.com/a/26473774
score: 4
has comment: http://stackoverflow.com/comment/41584998
upvote count: 4
has comment: http://stackoverflow.com/comment/41584912
has answer: http://stackoverflow.com/a/26473805
downvote count: 0
has answer: http://stackoverflow.com/a/26473750
has answer: http://stackoverflow.com/a/26473745
favorite count: 0
linked to: http://stackoverflow.com/q/9560600
has comment: http://stackoverflow.com/comment/41584930
duplicate of: http://stackoverflow.com/q/9560600
has title: Why can I not access an inner class in Java?
answer count: 4
has body: I am having a trouble using nested classes in Java, does anyone know why Java does not allow me to do it? public class A{ private class B{ public B(){ System.out.println("class B"); } } public static void main(String[] args){ A a = new A(); B b = new B(); } }
tagged with: inner-classes

http://stackoverflow.com/comment/41476283
type: Comment
has text: Yes if I call `vehicle.save()` it will work fine. However, I don't even want to persists the `User` object or the `Vehicle` object, all I want to do is save the `Address` object, but I can't because hibernate marks the `Vehicle` object to be persisted
comment on: http://stackoverflow.com/q/26410872
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41426275
has text: What is your input string?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26386134

http://stackoverflow.com/comment/41546655
score: 0
has text: So you are trying to read 1.2 MB into a 1 MB buffer ... think about it ...
comment on: http://stackoverflow.com/q/26452710
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41575110
score: 1
has text: @PiotrChojnacki i'll do it asap, so tomorrow.
type: AnswerComment
comment on: http://stackoverflow.com/a/26465981
type: Comment

http://stackoverflow.com/a/26397010
downvote count: 0
score: 13
has comment: http://stackoverflow.com/comment/41445513
has comment: http://stackoverflow.com/comment/41445438
type: AcceptedAnswer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/26396859
type: Answer
answers question: http://stackoverflow.com/q/26396859
has body: Please, use next expression #{T(java.lang.String).format('%d-%d', user.id, user.serviceId)}. Hope this helps. Update. If this expression will be used within @Cacheable(key) field, please update expression in next way: T(java.lang.String).format('%d-%d', #user.id, #user.serviceId).

http://stackoverflow.com/comment/41425565
type: Comment
type: QuestionComment
has text: wanna post at least some pseudocode?
score: 0
comment on: http://stackoverflow.com/q/26385798

http://stackoverflow.com/q/26372385
has title: Why do Exception classes in Java NOT implement equals method?
type: AnsweredQuestion
has body: Why do Exception classes (like RuntimeException) not implement equals() method? For example, the output for this code is false: /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { final RuntimeException e1 = new RuntimeException("e"); final RuntimeException e2 = new RuntimeException("e"); System.out.println(e1.equals(e2)); } } Is there a reason why equals() is not implemented? Seems to me it would be fairly useful. Edit: Let me expand on the question, since it seems that most people believe an equals() implementation would not be useful. I would like to know, why Exceptions should be treated differently than normal objects and only be matched if its the same instance. Does it not have enough information about itself to compare with other objects. For example, the underlying StackTraceElement, which I presume stores the call stack, already implements an equals method. Is there something in the definition of Exceptions that stop them from implementing an equals method based on their attributes?
has comment: http://stackoverflow.com/comment/41401579
tagged with: java
has comment: http://stackoverflow.com/comment/41409289
upvote count: 7
has comment: http://stackoverflow.com/comment/41401821
has comment: http://stackoverflow.com/comment/41402168
type: Question
has comment: http://stackoverflow.com/comment/41401700
has comment: http://stackoverflow.com/comment/41402254
score: 5
possible better answer: http://stackoverflow.com/a/26372745
has answer: http://stackoverflow.com/a/26372442
accepted answer: http://stackoverflow.com/a/26372442
has comment: http://stackoverflow.com/comment/41402739
has comment: http://stackoverflow.com/comment/41401486
has answer: http://stackoverflow.com/a/26372643
answer count: 3
has comment: http://stackoverflow.com/comment/41401773
has comment: http://stackoverflow.com/comment/41401487
has comment: http://stackoverflow.com/comment/41402087
has answer: http://stackoverflow.com/a/26372745
linked to: http://stackoverflow.com/q/24596941
has comment: http://stackoverflow.com/comment/41401483
favorite count: 0
has comment: http://stackoverflow.com/comment/41401639
downvote count: 2

http://stackoverflow.com/comment/41633583
has text: chrylis.. I get that.. This was my question. What is the reason behind such a behaviour? Have appended more details to the question..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26500689
type: Comment

http://stackoverflow.com/q/26440631
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41524690
has answer: http://stackoverflow.com/a/26442237
favorite count: 0
tagged with: jtable
has title: How to use jTable to retrieve data from database
tagged with: jdbc
has answer: http://stackoverflow.com/a/26441398
type: UnansweredQuestion
downvote count: 2
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/41525897
tagged with: java
answer count: 2
has body: I am new to java. I am trying to write a code for search which should retrieve that particular searched data from database(MS Access) and display it in jTable. But its giving me a null pointer exception. the code is as given below: import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import java.util.Vector; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; public class GuestDetail extends javax.swing.JFrame { PreparedStatement ps; ResultSet rs; Connection conn; Statement stmt; TableModel tm; int sr; /** * Creates new form GuestDetail */ public GuestDetail() { initComponents(); try{ conn = HotelManagement.ConnectDb(); tm=new DefaultTableModel(4, 4); jTable1.setModel(tm); }catch(Exception ex) { JOptionPane.showMessageDialog(null, ex); } } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ System.out.println("Searching Records.."); String fn=jTextField1.getText(); System.out.println("searching name="+fn); stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); // String query1="SELECT * FROM GuestDetails WHERE FirstName LIKE'fn%'"; String query="select FirstName,LastName,City,ContactNo from GuestDetails where FirstName= ' "+jTextField1.getText()+" '"; System.out.println("query:"+query); rs.next(); int rows=rs.getInt(1); ResultSet rs= stmt.executeQuery(query); Object[][] data=new Object[rows][4]; Object[] headers={"FirstName","LastName","City","ContactNo"}; int i=0; while(rs.next()) { int j=0; data[i][j++]=rs.getString(1); data[i][j++]=rs.getString(2); data[i][j++]=rs.getString(3); data[i++][j]=rs.getLong(4); } DefaultTableModel tm=new DefaultTableModel(data, headers); jTable1.setModel(tm); }catch (Exception ex) { Logger.getLogge…

http://stackoverflow.com/comment/41536620
score: 0
comment on: http://stackoverflow.com/a/26447101
type: Comment
has text: Good point. Fortunately in most cases like this you have the option of restructuring your code to allow using interfaces. Especially with the excellent `default` implementations added in Java8
type: AnswerComment

http://stackoverflow.com/a/26490490
has comment: http://stackoverflow.com/comment/41618158
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41616888
has body: Do not close the loader. Javadoc: Closes this URLClassLoader, so that it can no longer be used to load new classes or resources that are defined by this loader.
answers question: http://stackoverflow.com/q/26490227
downvote count: 0

http://stackoverflow.com/comment/41524759
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26422879
type: Comment
has text: @Viswa: I don't have any particular recommendations on that front, but note that Java 8 has provided a lot of new options for data handling using Streams.

http://stackoverflow.com/comment/41454259
comment on: http://stackoverflow.com/q/26388807
has text: Could it possibly be related to the character encoding of your feature files?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26500275
downvote count: 0
score: 1
tagged with: java
tagged with: file
type: Question
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/41632878
has answer: http://stackoverflow.com/a/26500303
has title: Java: assigning values to an Array
accepted answer: http://stackoverflow.com/a/26500303
upvote count: 1
has comment: http://stackoverflow.com/comment/41653916
favorite count: 0
has body: I have a method that reads in a file. The first line of the file has an integer that shows how many additional lines there are. Each additional line after that has a pair of two double values (no commas) For Example: 4 13 15 20.2 33.5 24 38 30 31 etc. I have two static double arrays, x and y. For each line after the first, I want to assign the first double in the set to x, and the second double in the set to y. However, i'm not 100% sure what to do how to assign. This is my code so far: (note that line is a call to another method not shown) Scanner input = new Scanner(System.in); System.out.println("Enter the name of the data file."); fileName = input.nextLine(); while(input.hasNext()) { int num = input.nextInt(); // the first line integer line.x[0] = input.nextDouble(); //the additional line x coordinate line.y[0] = input.nextDouble(); //the additional line y coordinate } The only problem is, how do I increment the value of x and y from [0] to [1], [2], 3, etc for each additional line in the file, based on what the first line int value 'num' is, so that I don't keep overwriting [0]? For example, in the example above, the value of 'num' is 4, because there are four additional lines after it. How do I increase (+=) the value of x and y by one based on the value of num? I know this sounds stupid but I'm stumped at this point.
possible better answer: http://stackoverflow.com/a/26500321
tagged with: input
has answer: http://stackoverflow.com/a/26500321
type: AnsweredQuestion

junit4
tags question: http://stackoverflow.com/q/26401642
tags question: http://stackoverflow.com/q/26435207
tags question: http://stackoverflow.com/q/26480129
tags question: http://stackoverflow.com/q/26479681
tags question: http://stackoverflow.com/q/26398703
tags question: http://stackoverflow.com/q/26371441
tags question: http://stackoverflow.com/q/26466534
tags question: http://stackoverflow.com/q/26437580
tags question: http://stackoverflow.com/q/26439804
type: Tag
tags question: http://stackoverflow.com/q/26473333
tag name: junit4
tags question: http://stackoverflow.com/q/26382924

http://stackoverflow.com/a/26584122
has body: you could use apache ThreadContext to put the id there and then retrieve the map in you log via the convention Id:[%X{id}] where id is the id you put in the ThreadContext Map ..
score: 0
answers question: http://stackoverflow.com/q/26408992
type: Answer

http://stackoverflow.com/comment/41546853
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26452894
has text: Why do you get a BigDecimal from the database as a String rather than as a BigDecimal in the first place? http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getBigDecimal%28int%29
score: 0

http://stackoverflow.com/q/26444521
has comment: http://stackoverflow.com/comment/41531774
possible better answer: http://stackoverflow.com/a/26444564
has answer: http://stackoverflow.com/a/26444564
has title: Required: variable Found:value Error Java Text-Based Calculator
has answer: http://stackoverflow.com/a/26444906
accepted answer: http://stackoverflow.com/a/26444906
type: AnsweredQuestion
upvote count: 0
tagged with: java.util.scanner
tagged with: compiler-errors
type: Question
has body: Hello Stack Overflow. I have a problem with my code. The goal is to create a text-based calculator that reads an input file and processes the equations. The first number tells the program how many lines are there. I think I set up that part right, count is the number of lines. Here's what I got so far. Scanner equationScan; int count; double a=0; double b=0; double calc1; equationScan = new Scanner(new File("calculator.txt")); count = equationScan.nextInt(); while(count &gt; 0) { String line = equationScan.nextLine(); if(line.equals("sin")) { a = equationScan.nextDouble(); *Error shows up here. Req: variable Found: value Math.sin(a)= calc1; } } The goal is a number of 'if' statements for the program to follow. I understand that part, but I can't get past this error. The first line of the text file reads an integer and I'm trying to see the second line of the file that reads sin of a double and to calculate that and store it. Help would be greatly appreciated!
score: -2
tagged with: java
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/41531825
linked to: http://stackoverflow.com/q/7056749
has comment: http://stackoverflow.com/comment/41531875
has comment: http://stackoverflow.com/comment/41531811
favorite count: 0

http://stackoverflow.com/comment/50477247
score: 0
has text: Because that's the way the string is made. The input value would have to be formatted that way. But the input is not "20-10-2014"...
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26460469

http://stackoverflow.com/a/26415097
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41478278
accepted answer of: http://stackoverflow.com/q/26415045
has body: Easiest way to do it: lotteryNumberFinal = ""; for(int i=0; i &lt; 3; i++) { lotteryNumber = (int)(Math.random()*10); System.out.print(lotteryNumber); lotteryNumberFinal += lotteryNumber; } System.out.println(lotteryNumberFinal); Notice that now you don't need to do the Integer.toString conversion, since the int will be coerced to String representation when you cat it onto another String. You can then use substring to get the individual numbers if you want... but an array would be the right way to do it.
has comment: http://stackoverflow.com/comment/41477918
answers question: http://stackoverflow.com/q/26415045

http://stackoverflow.com/comment/41580073
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26471266
score: 1
has text: @brso05 Because strings are interned, hence passwords may be held in memory.

http://stackoverflow.com/a/26373783
has comment: http://stackoverflow.com/comment/41481172
accepted answer of: http://stackoverflow.com/q/26373647
score: 0
answers question: http://stackoverflow.com/q/26373647
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41436111
has comment: http://stackoverflow.com/comment/41443404
type: Answer
has comment: http://stackoverflow.com/comment/41504094
has comment: http://stackoverflow.com/comment/41535232
has body: in your current code: public static void setTextArea(String string) { // TODO Auto-generated method stub } nothing is being done, use JTextArea.setText(String t) method to set the value

http://stackoverflow.com/a/26733465
accepted answer of: http://stackoverflow.com/q/26384473
type: Answer
answers question: http://stackoverflow.com/q/26384473
score: 0
type: AcceptedAnswer
has body: Solved. I changed from using a model to a string variable. I then use the JSONParser to parse the json String received as parameter followed by type casting it to a JSONObject. Here is my modified code - @Path("/storeMovement") @POST @Consumes("application/json") @Produces("application/json") public String storeTrace(String json) { JSONObject response = new JSONObject(); JSONParser parser = new JSONParser(); String ret = ""; try { Object obj = parser.parse(json); JSONObject jsonObj = (JSONObject) obj; RecordMovement re = new RecordMovement((double) jsonObj.get("longitude"), (double) jsonObj.get("latitude"), (long) jsonObj.get("IMSI")); ret = re.Store(); // Clear object re = null; System.gc(); response.put("status", ret); } catch (Exception e) { response.put("status", "fail " + e.toString()); } return response.toJSONString(); }

http://stackoverflow.com/a/26387520
score: 1
answers question: http://stackoverflow.com/q/26378305
accepted answer of: http://stackoverflow.com/q/26378305
downvote count: 0
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: i found a satisfactory Solution now, which works correctly, doesnt need instanceof and yields no compile warnings: public interface Action&lt;E extends State&lt;?&gt;&gt; { public E execute(E state); } public interface State&lt;E extends Action&lt;?&gt;&gt; { public Collection&lt;E&gt; getPossibleActions(); } public static &lt;A extends Action&lt;S&gt;, S extends State&lt;A&gt;&gt; Collection&lt;S&gt; getAllSuccessorStates(S state){ Collection&lt;S&gt; allSuccessors = new HashSet&lt;&gt;(); for (A localAction: state.getPossibleActions()){ S successorState = localAction.execute(state); allSuccessors.add(successorState); allSuccessors.addAll(getAllSuccessorStates(successorState)); } return allSuccessors; } Example of using getAllSuccessorStates (i forgo the implementation Details of the concrete classes here, but the Point should be apparent. You can use the method getAllSuccessorStates with any concrete State class, get Instances of this class in return collection and use them) public class TestState implements State&lt;TestAction&gt; {...} public class TestAction implements Action&lt;TestState&gt; {...} public static void main(String[] args) { TestState initialState = new TestState("1"); Collection&lt;TestState&gt; allSuccessorStates = getAllSuccessorStates(initialState); for (TestState state: allSuccessorStates){ System.out.println(state.getStateStr()); } } This Question arose from the book "AI-A modern approache" by Stuart Russel and Peter Norvig, in case somebody who reads this book has the same Problem and searches for solutions. In the book the Action and State methods are inside a Problem Class, but i think in this way the OO-design is better.

http://stackoverflow.com/comment/41439725
score: 0
comment on: http://stackoverflow.com/a/26393488
type: Comment
has text: You will need to the instance fields. You need to initialize the fields within the constructor
type: AnswerComment

http://stackoverflow.com/comment/41655614
score: 0
type: Comment
type: QuestionComment
has text: Don't create the `Scanner` every time around the loop.
comment on: http://stackoverflow.com/q/26512543

http://stackoverflow.com/a/45390989
answers question: http://stackoverflow.com/q/26413910
score: 5
upvote count: 5
downvote count: 0
has body: In avg case, is O(log n) for 1 insert operation since it consists of a test (constant time) and a recursive call (with half of the total number of nodes in the tree to visit), making the problem smaller in constant time. Thus for n insert operations, avg case is O(nlogn). The key is that the operation requieres time proportional to the height of the tree. In average, 1 insert operation is O(logn) but in the worst case the height is O(n) If you're doing n operations, then avg is O(nlgn) and worst O(n^2)
type: Answer

http://stackoverflow.com/comment/41586455
has text: I understood his way of doing but there are too many unknowns in his question so i want to provide a solution.
comment on: http://stackoverflow.com/a/26474479
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26469422
has comment: http://stackoverflow.com/comment/41577257
has comment: http://stackoverflow.com/comment/41577765
answers question: http://stackoverflow.com/q/26469346
has comment: http://stackoverflow.com/comment/41577320
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41577612
has body: The method name findViewById() suggests that you provide the id of a view and not a layout. Therefore use an id you have added within your layout file. Should look like this: findViewById(R.id.my_mega_awesome_view); Update: The way you try to get the entered text is correct. I guess your problem is that you need to find the right place and time to get the data. I mean the user has to type something into it before it makes sense to get it. Try reading about the addTextChangedListener() method
type: Answer

http://stackoverflow.com/comment/41437208
comment on: http://stackoverflow.com/a/26391881
score: 0
type: AnswerComment
type: Comment
has text: Thanks, @splungebob's comment was all I needed, but I'll mark this as correct for anyone who needs the information in the future as it's the same answer.

http://stackoverflow.com/comment/41554562
comment on: http://stackoverflow.com/q/26457113
type: QuestionComment
score: 0
has text: @Tirath The OP already does, that's what `nextLine` does...
type: Comment

http://stackoverflow.com/q/26436460
accepted answer: http://stackoverflow.com/a/26436664
type: Question
score: 0
has title: Java Regex, Multiple expressions with variables
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26436664
has body: So, I am trying to make a function that will visit one page, grab the ID and TYPE of an item, then visits a link and plugs in the ID and TYPE to get the ITEM NAME. Then it will add all of this into an ArrayList like. new List(id,type,name); public static ArrayList&lt;Kad&gt; getDetails(final String strHTML, final String strHTML2) { final ArrayList&lt;Kad&gt; kads = new ArrayList&lt;Kad&gt;(); try { final Pattern regex = Pattern .compile( "id=(\\d+)\\&amp;tab=([a-zA-Z]+)", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); final Pattern regex2 = Pattern .compile( "font-weight:bold; font-size:11px;\"&gt;([\\w\\s]+)&lt;/div&gt;", Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); final Matcher regexMatcher = regex.matcher(strHTML); final Matcher regexMatcher2 = regex2.matcher(strHTML2); String ids = ""; while (regexMatcher.find() &amp;&amp; regexMatcher2.find()) { final int id = Integer.parseInt(regexMatcher.group(1)); final String tab = regexMatcher.group(2); final String name = regexMatcher2.group(1); if (!ids.contains(id + "|") &amp;&amp; !ignoreList.contains(id)) { kads.add(new Kad(id,tab,name)); ids += id + "|"; } } return kads; } catch (final Exception ex) { ex.printStackTrace(); } return new ArrayList&lt;Kad&gt;(); } This code works to get the id, type and name of the item. But, I can't get a list of IDs since this function gets the ID and then the name. What is the best way to break this up into two functions where one gets the ID and TYPE, then the other gets the name. This method is called using: data = wrapper.post("LINK1", "tab=" + "food" + "&amp;page=" + "1", ""); data2 = wrapper.post("LINK2", "tab=" + "CURRENT ITEM TYPE IN LIST GOES HERE" + "&amp;id=" + "CURRENT ITEM ID IN LIST GOES HERE", ""); final ArrayList&lt;Kad&gt; kadList = Kad.getDetails(data, data2); I tried to break it up into two seperate methods, but could not figure out how to add the name found in method 2 to the already created list of ID and TYPE in method 1. EDIT: Okay, so after the suggest…
type: AnsweredQuestion
tagged with: regex

http://stackoverflow.com/q/26402279
downvote count: 0
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26419199
upvote count: 1
answer count: 1
has title: Windows Azure Java SDK keystore path issue
has body: I am trying to setup Windows Azure Java SDK in Windows 7 machine followed their Wiki setup page https://github.com/Azure/azure-sdk-for-java/wiki/Devbox-Setup when I run test cases/ trying to access Azure REST webservice URLS, getting below error. set management.keystore.path=E:/Program Files (x86)/Java/jdk1.7.0_51/jre/lib/security/clientcert.jks Windows Azure Java SDK keystore path issue java.lang.IllegalArgumentException: The keystore path cannot be null or empty. at com.microsoft.windowsazure.core.utils.SSLContextFactory.create(SSLContextFactory.java:86) at com.microsoft.windowsazure.core.utils.SSLContextFactory.create(SSLContextFactory.java:60) at com.microsoft.windowsazure.credentials.CertificateCloudCredentials.applyConfig(CertificateCloudCredentials.java:128) at com.microsoft.windowsazure.core.pipeline.apache.Exports$2.create(Exports.java:51) at com.microsoft.windowsazure.core.pipeline.apache.Exports$2.create(Exports.java:1) at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200) at com.microsoft.windowsazure.core.pipeline.apache.Exports$3.create(Exports.java:65) at com.microsoft.windowsazure.core.pipeline.apache.Exports$3.create(Exports.java:1) at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200) at com.microsoft.windowsazure.core.DefaultBuilder$1.create(DefaultBuilder.java:138) at com.microsoft.windowsazure.core.DefaultBuilder.build(DefaultBuilder.java:200) at com.microsoft.windowsazure.Configuration.create(Configuration.java:113) at com.microsoft.windowsazure.management.storage.StorageManagementService.create(StorageManagementService.java:47) at com.microsoft.windowsazure.management.compute.ComputeManagementIntegrationTestBase.createStorageManagementClient(ComputeManagementIntegrationTestBase.java:63) at com.microsoft.windowsazure.management.compute.VirtualMachineOperationsTests.setup(VirtualMachineOperationsTests.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.Nativ…
has answer: http://stackoverflow.com/a/26419199
favorite count: 0
tagged with: azure
tagged with: keystore

http://stackoverflow.com/a/26423213
type: Answer
accepted answer of: http://stackoverflow.com/q/26422133
answers question: http://stackoverflow.com/q/26422133
downvote count: 0
score: 1
type: AcceptedAnswer
has body: You can solve it using custom converters. Main idea is to register new converter for Sets using ConvertUtils.register(Converter converter, Class&lt;?&gt; clazz). It's not a problem to implement your custom set-to-list converter's convert(Class&lt;T&gt; type, Object value) method. Here is simple example for your issue: ListEntity, which has List property (don't ignore setters and getters, as far as I know, their existence is mandatory): public class ListEntity { private List&lt;Integer&gt; col = new ArrayList&lt;&gt;(); public List&lt;Integer&gt; getCol() { return col; } public void setCol(List&lt;Integer&gt; col) { this.col = col; } } SetEntity, which has Set property: public class SetEntity { private Set&lt;Integer&gt; col = new HashSet&lt;&gt;(); public Set&lt;Integer&gt; getCol() { return col; } public void setCol(Set&lt;Integer&gt; col) { this.col = col; } } Simple test class to make in work: public class Test { public static void main(String... args) throws InvocationTargetException, IllegalAccessException { SetEntity se = new SetEntity(); se.getCol().add(1); se.getCol().add(2); ListEntity le = new ListEntity(); ConvertUtils.register(new Converter() { @Override public &lt;T&gt; T convert(Class&lt;T&gt; tClass, Object o) { List list = new ArrayList&lt;&gt;(); Iterator it = ((Set)o).iterator(); while (it.hasNext()) { list.add(it.next()); } return (T)list; } }, List.class); BeanUtils.copyProperties(le, se); System.out.println(se.getCol().toString()); System.out.println(le.getCol().toString()); } } The main idea of this code snipper: we register converter for all destination class List properties, it will try to convert some object o to List. Assuming, that o is a collection, we iterate over it and then return newly created list. As a result, le will contains both 1 and 2 values. If you don't need this converter anymore, you can unregister it using ConvertUtils.deregister().
upvote count: 1

http://stackoverflow.com/a/26428239
has comment: http://stackoverflow.com/comment/41642526
answers question: http://stackoverflow.com/q/26428093
score: 0
has body: you can use the init method of servlet for connection and table creation with a condition check if table doesn't exist in database. public void init(ServletConfig config) throws ServletException { // Store the ServletConfig object and log the initialization super.init(config);`` // create the database connection and table creation with condition if //table do not exist in DB }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26428093

http://stackoverflow.com/comment/41647120
score: 0
type: Comment
has text: Sorry, but what am I doing with your main layout? where am I adding it in my layout? Also I don't see where you used the popupborder.xml
comment on: http://stackoverflow.com/a/26398176
type: AnswerComment

http://stackoverflow.com/comment/41617307
has text: But is polymorphism allowed for generics in Java? For example, am I allowed to pass an `Event.Type<Object> type` and a `String handler` because `String` extends `Object`?
comment on: http://stackoverflow.com/q/26491569
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26477482
has comment: http://stackoverflow.com/comment/41596078
has comment: http://stackoverflow.com/comment/41592586
answers question: http://stackoverflow.com/q/26477456
score: 4
upvote count: 4
downvote count: 0
has body: It looks like you want to use continue (starts the next loop iteration) instead of return.
type: Answer

http://stackoverflow.com/comment/41411254
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26377827
score: 1
has text: You already named the in-Java solutions. Using standard APIs there’s only [JNI](http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/invocation.html#wp15956) left. But I recommend trying the suggested `ClassLoader` approach first.

http://stackoverflow.com/comment/41439809
has text: web service 1 created for clients. Also the web service 2 (we will create it now) can be a client for wb1 and produce an new service. So what is your opinion?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26389260

http://stackoverflow.com/a/26357192
has comment: http://stackoverflow.com/comment/41373380
upvote count: 1
has comment: http://stackoverflow.com/comment/42270451
has comment: http://stackoverflow.com/comment/41373603
score: 1
downvote count: 0
has body: we had similar problems with JDTS and at some point resorted to using the official JDBC driver from Microsoft. The Microsoft Driver works on Windows, Linux and MacOS and did not require me to put any DLLs or something like this anywhere. http://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx The only downsides to this driver are (1) it is not open source so you cannot change it in case you need to, and (2) you need to accept a license. However (2) should not be a problem since you are using MSSQL Server anyways. Finally (I am not sure if this applies to you) the Microsoft driver cannot be used with Maven. So I (on a Mac) use the following bash script to install the driver into my local Maven repository. #!/bin/bash mvn install:install-file -Dfile=lib/sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0 -Dpackaging=jar For the JDBC Connection strings see the following webpage: http://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx In your case since you want to do Windows authentication you need to make sure that you add ;integratedSecurity=true; to the jdbcUrl.
has comment: http://stackoverflow.com/comment/41374422
has comment: http://stackoverflow.com/comment/41373674
answers question: http://stackoverflow.com/q/26357064
type: Answer
has comment: http://stackoverflow.com/comment/41373345
has comment: http://stackoverflow.com/comment/41373272

http://stackoverflow.com/q/26374781
has body: I have been following the official tutorials about Sockets (link to the tutorials); however, I have not been able to 'link' two PC's with two different operating systems, there are not errors shown. I would like to know if it is possible to do this entirely on Java, or if there is any existent library out there that does it. Thank you in advance.
type: Question
has title: How to create a OS-independent client-server application on Java?
has comment: http://stackoverflow.com/comment/41408294
score: -1
has comment: http://stackoverflow.com/comment/41405845
has comment: http://stackoverflow.com/comment/41405947
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41406339
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26374900
tagged with: sockets
upvote count: 0
tagged with: java

http://stackoverflow.com/q/26502841
has answer: http://stackoverflow.com/a/26502883
has body: I have the below string in which I am successfully escaping the quotes with . " + " " + "<Release batchNo=\"\"/>" + " " + " My question is, lets say I want to replace one of the values in this string with my DTO.getVal(), how do I do it? For eg - " + " " + "<Release batchNo=\"\"/>" + " " + " I have done this multiple ways, and haven't been successful so far. Can you please advise?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41637381
score: 0
accepted answer: http://stackoverflow.com/a/26502883
possible better answer: http://stackoverflow.com/a/26502881
has title: Escape quotes in a String in Java
has answer: http://stackoverflow.com/a/26502881
has comment: http://stackoverflow.com/comment/41637419
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41637433

http://stackoverflow.com/q/26483615
favorite count: 0
type: UnansweredQuestion
upvote count: 4
has answer: http://stackoverflow.com/a/26484720
type: Question
has body: I have created a Hazelcast set up with one node running hazelcast instance. My client application is using client config to read the cache from Hazelcast instance. I want to implement Near cache in my client app to use it as local cache. Could you please provide me an example where i can see how it is used in java. My current code is this Hazel cast cache node public class HazelCastNode1 { public static void main(String[] args) { Config cfg = new Config(); HazelcastInstance instance = Hazelcast.newHazelcastInstance(cfg); Map&lt;Integer, String&gt; citiesMap = instance.getMap("Cities"); for(int i = 0; i &lt; 100000; i++){ citiesMap.put(i, "Vienna"+i); } System.out.println("Map Size:" + citiesMap.size()); } } Client Code public class ReadClient { public static void main(String[] args) { ClientConfig clientConfig = new ClientConfig(); HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig); IMap&lt;Integer, String&gt; cumap = client.getMap("Cities"); System.out.println(cumap.size()); } } Could you please give me an example which I can fit in here for Near cache implementation.
tagged with: java
has answer: http://stackoverflow.com/a/26546946
score: 4
tagged with: distributed-caching
answer count: 2
downvote count: 0
tagged with: hazelcast
has title: Programatically setting up Near Cache in hazelcast and Java Verify if Near cache is returning data from local cache

http://stackoverflow.com/comment/41406675
type: QuestionComment
comment on: http://stackoverflow.com/q/26375259
type: Comment
has text: Ohk but can we move the position of lable according to the mouse moves ?
score: 0

http://stackoverflow.com/q/26383865
has comment: http://stackoverflow.com/comment/41421915
has comment: http://stackoverflow.com/comment/41421994
has title: Initialization in while block?
score: 0
has answer: http://stackoverflow.com/a/26384289
type: UnansweredQuestion
has body: Isn't there a cleaner way of doing the following (eliminating the need for initializing line prior to the while block)? It just seems unnecessary to intialize a variable prior to its usage instead of doing something like while ((String line = br.readLine) != null) {}. If not, why not? BufferedReader reader = null; try { File file = new File("sample-file.dat"); reader = new BufferedReader(new FileReader(file)); String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } finally { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } }
answer count: 4
has answer: http://stackoverflow.com/a/26384009
has answer: http://stackoverflow.com/a/26383994
tagged with: java
has answer: http://stackoverflow.com/a/26384124
has comment: http://stackoverflow.com/comment/41422120
has comment: http://stackoverflow.com/comment/41421916
type: Question

http://stackoverflow.com/comment/41533890
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26445584
has text: What is your question? Are you asking us whether your reasoning is correct? Whether your conclusion is true? Or what hiding or overriding actually mean?

http://stackoverflow.com/comment/41463018
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26405326
has text: It doesn't work because you didn't follow the snippet correctly: 1) you have an extra `wrap` when adding `tstcJCheckBox` component. 2) `openButton` should be added in 3rd place (and not further) because it has to be located at 3rd column to properly span rows in that column.
score: 0

http://stackoverflow.com/comment/41466241
has text: There are some strange `()` after the class declarations which I also assume are typos.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26408813
score: 0

http://stackoverflow.com/a/26455081
answers question: http://stackoverflow.com/q/26455021
type: Answer
has body: I use it for convenience. You don't need to consider the boundary and condition with "for (Type e : set).
score: 0

http://stackoverflow.com/q/26500492
duplicate of: http://stackoverflow.com/q/513832
type: Question
has title: Compare Strings in Java
tagged with: object
has comment: http://stackoverflow.com/comment/41633092
score: -1
has body: why the first code gives output as "true" and second code gives output as "false"? code 1 ............... String str1="abc"; String str2="abc"; if (str1==str2) System.out.println("true"); else System.out.println("false"); code 2 NOTE : Input to both string will be same value .................... Scanner sc=new Scanner(System.in); System.out.println("enter string 1"); String String1=sc.next(); System.out.println("enter string 2"); String String2=sc.next(); if(String1==String2) System.out.println("true"); else System.out.println("false");
downvote count: 2
upvote count: 1
tagged with: compare
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/26500498
has comment: http://stackoverflow.com/comment/41633125
tagged with: java

http://stackoverflow.com/q/26494389
has answer: http://stackoverflow.com/a/26524195
downvote count: 0
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has title: Java GUI JScrollBar How to set the length?
type: Question
linked to: http://stackoverflow.com/q/7229226
answer count: 1
tagged with: user-interface
favorite count: 0
accepted answer: http://stackoverflow.com/a/26524195
has body: I have the following GUI codded up but I would like to increase the length of the scroll bar on the right side. Any Idea How to do this? // test class that implements the gui stuff. public class testing { //variables private JFrame f = new JFrame("GUI TEST"); private JPanel p = new JPanel(); private JPanel p2 = new JPanel(); private JPanel p3 = new JPanel(); private JPanel p4 = new JPanel(); private JPanel p5 = new JPanel(); private JPanel p6 = new JPanel(); private JPanel p7 = new JPanel(); private JPanel p8 = new JPanel(); private JPanel p9 = new JPanel(); private JPanel p10 = new JPanel(); private JPanel p11 = new JPanel(); private JButton b1 = new JButton("Button"); private JTextField tf1 = new JTextField(" "); private JTextField tf2 = new JTextField(" "); private JTextField tf3 = new JTextField(" "); private JTextArea ta1 = new JTextArea(10,45); private JLabel label1 = new JLabel("Label 1"); private JLabel label2 = new JLabel("Label 2"); private JLabel label3 = new JLabel("Label 3"); private JLabel label4 = new JLabel("Label 4"); private JScrollBar sb1 = new JScrollBar(); //class constructor public testing() { gui(); } public void gui() { //change length of scroll bar f.setVisible(true); f.setSize(600,300); p.add(label1); p.add(tf1); p2.add(label2); p2.add(tf2); p3.add(label3); p3.add(tf3); p4.add(sb1); p4.add(label4); p5.add(ta1); p6.add(b1); p4.setBackground(Color.GRAY); p9.setBackground(Color.GRAY); p10.setBackground(Color.GRAY); p11.setBackground(Color.GRAY); p9.add(p); p9.add(p2); p9.add(p3); p10.add(p5); p11.add(p6); //adds panels to frames f.add(p4, BorderLayout.EAST); f.add(p9, BorderLayout.NORTH); f.add(p10, BorderLayout.CENTER); f.add(p11, BorderLayout.PAGE_END); } public static void main(String[] args) { new testing(); }
has comment: http://stackoverflow.com/comment/41626525
has comment: http://stackoverflow.com/comment/41664134
upvote count: 1
has comment: http://stackoverflow.com/comment/41664002
has comment: http://stackoverflow.com/comment/41624421
has comment: http://stackoverflow.com/comment/41622128

http://stackoverflow.com/a/26427887
has body: You are using GenerationType.IDENTITY for sequencing, which requires retrieving the IDs from each insert statement one by one. Try a sequencing scheme that allows preallocation in batches of 500 and you will see improvements: http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Identity_sequencing
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41502522
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/41570939
accepted answer of: http://stackoverflow.com/q/26416847
answers question: http://stackoverflow.com/q/26416847
upvote count: 5

http://stackoverflow.com/comment/41506788
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26430487
has text: @user3201263 I just meant that they could both use the same C/C++ source code but compiling them for the different architectures would naturally result in different executable files (binaries).

http://stackoverflow.com/comment/41621335
has text: What im saying is i understand what u guys are saying but i have the same exact code in a different class and it works but not in this one for some reason. My database is fine i know that because my other class connects to it and gets the data
score: 0
comment on: http://stackoverflow.com/q/26491528
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26368336
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
tagged with: http
type: Question
has title: Session storage in spring integration and processing multiple http outbound gateways
has answer: http://stackoverflow.com/a/26786205
downvote count: 0
accepted answer: http://stackoverflow.com/a/26786205
has body: An example of the integration diagram is as follows HTTP Inbound gateway along with GET parameters such as for example "dataValue" Call two seperate http outbound gateways Process the response of both the outbound gateways Display the response of the result of both outbound gateways along with the passed GET parameters We have two requirements, one where we need to send two separate requests to two http outbound gateways that provide two different type of responses (one with base data and one with prices data). How can we aggregate these two results for processing. Is there a special type of aggregator, pattern etc that needs to be used The other requirement being, as we have an a http-inbound gateway which calls the above mentioned two http gateways, processes both requests and produces a json output. In the request to the http-inbound gateway there might be a GET parameter passed called "dataValue" which contains the value "17". When the request is complete after the two http outbound gateway response is processed the "dataValue" parameter and value that was passed as a GET parameter must be attached to the response. What is the best way to store and retieve the "dataValue" parameter of each specific request and attach it to the response. Can we pass this through another channel to an aggregator of the final response or is there a way to store it in a session store for each request and such techniques. Regards, Milinda
answer count: 1
score: 1
favorite count: 0
upvote count: 1
tagged with: request
tagged with: spring

http://stackoverflow.com/comment/50401244
comment on: http://stackoverflow.com/q/26504670
score: 0
has text: hi mohit_d! did you find some way to solve this issue ?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26499140
score: 0
has body: Your solution will not work however as an alternative you could just create a new java file on each iteration and in the file you could put the text for class definition. So you could name the file tempname.java and in the file put public class tempname{}. Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/26499092

http://stackoverflow.com/a/53683061
type: Answer
score: 0
has body: I am not sure from which version this is available, but you can just add a parameter for CsrfToken on your controller method to get the token to be passed into the model, like so: @GetMapping("/dashboard") public String dashboard(CsrfToken csrfToken, Model model) { model.addAttribute("_csrf", csrfToken); // render page } You don't have to use HttpServletRequest. Now you can use your first template. If the above is too tedious to do for each controller methods, we can register an interceptor instead. Interceptor: public class CsrfTokenInterceptor implements HandlerInterceptor { @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { CsrfToken csrfToken = (CsrfToken) request.getAttribute("_csrf"); if (modelAndView != null) { modelAndView.addObject("_csrf", csrfToken); } } } Bean: @Configuration public class Config { @Bean public CsrfTokenInterceptor csrfTokenInterceptor() { return new CsrfTokenInterceptor(); } } Add interceptor in WebMvcConfigurer: @Configuration public class WebMvcConfig implements WebMvcConfigurer { @Autowired CsrfTokenInterceptor csrfTokenInterceptor; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(csrfTokenInterceptor); } }
answers question: http://stackoverflow.com/q/26397168

http://stackoverflow.com/comment/41535521
type: QuestionComment
score: 5
has text: @Victor2748 The question you referred is different. He is pointing other thing.
comment on: http://stackoverflow.com/q/26446512
type: Comment

http://stackoverflow.com/comment/41677479
comment on: http://stackoverflow.com/a/26516520
score: 0
type: AnswerComment
type: Comment
has text: Again: Ignore above comment, I have now resolved I will post code below, thank you for pointing me in the right direction!

http://stackoverflow.com/comment/41594969
comment on: http://stackoverflow.com/a/26479266
score: 0
type: Comment
has text: @ScaryWombat Got tired of trying to nudge people to correct their answers...:P
type: AnswerComment

http://stackoverflow.com/comment/41519293
type: QuestionComment
has text: You may just be breaking down the problem too small, and each thread task is completing before the next has a chance to start. Try calling the executor in the `i` loop and putting the `j` loop inside the task instead for example.
comment on: http://stackoverflow.com/q/26437396
score: 0
type: Comment

http://stackoverflow.com/a/26411023
has comment: http://stackoverflow.com/comment/41470409
has body: Try this code below instead. The reason for this suggestion, is that there is some note in the docs about using setImageURI that might cause hiccups... UPDATE, sample onClick: _ContactImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); startActivityForResult(intent, 1) } }); private Bitmap bitmap; @Override protected void onActivityResult(int reqCode, int resCode, Intent data) { if (reqCode== 1 &amp;&amp; resCode == Activity.RESULT_OK) { try { if (bitmap != null) { bitmap.recycle(); } InputStream stream = getContentResolver().openInputStream( data.getData()); bitmap = BitmapFactory.decodeStream(stream); stream.close(); _ContactImage.setImageBitmap(bitmap); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } super.onActivityResult(reqCode, resCode, data); } }
answers question: http://stackoverflow.com/q/26409951
score: 0
type: Answer

http://stackoverflow.com/a/74559329
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26453735
has body: Here is an example of how you would get all the shops in a specific bouding box and store them in lists for the nodes, ways, and relations in lists. I use kotllin with gradle. In the gradle.kts: dependencies { implementation("org.openstreetmap.osmosis:osmosis-pbf:0.48.3") implementation("org.openstreetmap.osmosis:osmosis-areafilter:0.48.3") } The code: import crosby.binary.osmosis.OsmosisReader import org.openstreetmap.osmosis.areafilter.v0_6.BoundingBoxFilter import org.openstreetmap.osmosis.core.container.v0_6.* import org.openstreetmap.osmosis.core.domain.v0_6.* import org.openstreetmap.osmosis.core.filter.common.IdTrackerType import org.openstreetmap.osmosis.core.task.v0_6.Sink import java.io.FileInputStream class CustomProcessor : Sink { // Here the results will be stored val nodes = mutableListOf<Node>() val ways = mutableListOf<Way>() val relations = mutableListOf<Relation>() override fun close() { // Close all your readers and such } override fun initialize(metaData: MutableMap<String, Any>?) { // Don't know when to use this } override fun complete() { // If you first put data into storages you can process them here after you have all you need } override fun process(entityContainer: EntityContainer?) { val entity = entityContainer?.entity // Filter for shops var foundIt = false if (entity != null) { for (tag in entity.tags) { if (tag.key == "shop") { foundIt = true break } } } // If the object is a shop if (foundIt) { if (entity is Node) { nodes.add(entity) } else if (entity is Way) { ways.add(entity) } else if (entity is Relation) { relations.add(entity) } else if (entity is Bound) { // We don't store bounds } else { // Shouldn't be possible } } } } fun main(args: Array<String>) { // Set input stream val inputStream = FileInputStream("path/to/my/file.osm.pbf") // Create the bounding box filter val bbFilter = BoundingBoxFilter( IdTrackerType.Dynamic, // ID tracker used internally. This is the default. 11.5256, // Left lon 11.5004, // Right lon 48.84543, // T…

http://stackoverflow.com/q/26413812
has body: I need to customize this listview, I wonder how I could do to put the buttons and an identifier of different colors to distinguish them. Anyone know how it could be the xml? and how it could change colors ?? is there any component in android? or I could use an imageview to the colors? I appreciate your help.
has answer: http://stackoverflow.com/a/26414552
tagged with: java
type: Question
has title: Listview with color and button android
score: 0
tagged with: customization
answer count: 1
tagged with: button
tagged with: android-listview
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/41527279
comment on: http://stackoverflow.com/a/26436374
type: Comment
score: 0
has text: How did you get the output?
type: AnswerComment

machine-learning
tags question: http://stackoverflow.com/q/26452253
tag name: machine-learning
type: Tag

http://stackoverflow.com/q/26420941
type: Question
tagged with: session
has body: When a user is logged on session information is stored. And session information is erased when the user is logged out . But when I hit the browser 's back button user information is displayed. Since session is gone but we can not be sure the user login operation is carried out. How do I resolve this issue ? ----------------------------log out ------------------------------- @RequestMapping(value="logout.htm",method = RequestMethod.GET) public void logOut(HttpSession session,HttpServletResponse response,HttpServletRequest request) throws IOException{ final String refererUrl = request.getHeader("Referer"); response.setHeader(refererUrl, "no-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", 0); session.removeAttribute("user"); session.invalidate(); response.sendRedirect("index.htm"); } ---------------------------------- login --------------- @RequestMapping(value="/userLogin",method=RequestMethod.POST) public @ResponseBody JsonResponse login(@ModelAttribute(value="user") User user, BindingResult result,HttpServletRequest request,HttpSession session,ModelMap model) throws UnsupportedEncodingException{ JsonResponse res = new JsonResponse(); if(!result.hasErrors()&amp;&amp; userService.findUser(user, request)){ res.setStatus("SUCCESS"); session.setAttribute("user", new String(user.getUsername().getBytes("iso- 8859-1"), "UTF-8")); } else{ res.setStatus("FAIL"); result.rejectValue("username","1"); res.setResult(result.getAllErrors()); } return res; } --------------------------profile -------------------------------------- @RequestMapping(value="myProfile.htm",method = RequestMethod.GET) public String showmyProfile(@ModelAttribute(value="addUser") User user,Model model,HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException{ if(session.getAttribute("user")== null){ response.sendRedirect("index"); }
has answer: http://stackoverflow.com/a/38037415
upvote count: 2
accepted answer: http://stackoverflow.com/a/26423261
has answer: http://stackoverflow.com/a/26421071
has answer: http://stackoverflow.com/a/73640407
favorite count: 0
has answer: http://stackoverflow.com/a/26423261
answer count: 5
has answer: http://stackoverflow.com/a/31217043
tagged with: spring
tagged with: logout
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/31217043
tagged with: java
has title: How handle browser back button in spring mvc

http://stackoverflow.com/comment/41593933
score: 4
type: Comment
comment on: http://stackoverflow.com/q/26478671
type: QuestionComment
has text: Start the UI from within the confines of the EDT, see [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html);

http://stackoverflow.com/comment/41517547
comment on: http://stackoverflow.com/a/26424700
type: Comment
has text: Means EZR.Alter__c is null at some point you have to check it for null. like u can use if(EZR.Alter__c!=null) for doing what if null value appears.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41550908
type: Comment
type: QuestionComment
has text: Make the array one element larger: `feld = new long[(int) n + 1];` (valid indices are from 0 to length-1)
comment on: http://stackoverflow.com/q/26455056
score: 0

http://stackoverflow.com/a/26458028
type: Answer
has comment: http://stackoverflow.com/comment/41556158
has body: Well first off do not write a for loop using n. Use the letter i. Second you are trying to store a double value inside a String array. What exactly does the user want to populate the array with? EDIT: This is the only answer I have ever wrote. I was a sophomore in college and was not particularly well versed in java. Please for the love of Jesus unblock my account. I just spent a hour writing a well thought out answer only to have it blocked because of this single answer.
score: 0
answers question: http://stackoverflow.com/q/26457982

http://stackoverflow.com/a/26406611
has comment: http://stackoverflow.com/comment/41462080
has body: You should use a SAXParser instead of a DOMParser The difference is that it doesn't load the complete XML data in memory. Look at this tutorial : http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/ Regards, Romain.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26406506
upvote count: 1
has comment: http://stackoverflow.com/comment/41462375

http://stackoverflow.com/a/26509655
downvote count: 0
score: 1
has body: You seem to have some bugs in your code, but those are just the immediate problem. I'll outline the larger picture of why you won't measure anything very useful here. A precise answer as to the actual reasons behind a certain performance profile is attainable only by a very detailed and painstaking analysis of the execution of your code. Why? Because it depends on a potentially huge number of factors impinging on the complex function of JVM's just-in-time compiler. However, this much is certain: you won't be enlightened by the answer because it will not relate much to your code; rather it will relate to exactly how you have chosen to test it. Just to get a feel of the kind of answer you may expect: the level of granularity for most optimizations is the method, and a method will be JIT-compiled only after it has been proven to be a hot spot (by default, it will have to accumulate 10,000 invocations). So when you extract the code to a method, you will receive the benefit of compilation as soon as it is performed. However, there is also the technique of on-stack replacement, where a method is optimized while being executed. This is what you have to rely on in the inlined case. The optimizer will detect a hot loop in the middle of the method and compile. This is a very different mechanism, however, so you can expect different results.
answers question: http://stackoverflow.com/q/26509458
upvote count: 1
type: Answer

http://stackoverflow.com/q/26397698
has title: Parsing R.java back to xml files
possible better answer: http://stackoverflow.com/a/26397746
tagged with: android
has body: I have an R.java file, but I lost the corresponding XML files. Is there a tool that could parse the R.java and translate the fields back to XML attributes?
has answer: http://stackoverflow.com/a/26397844
downvote count: 1
accepted answer: http://stackoverflow.com/a/26397844
favorite count: 0
upvote count: 0
type: Question
has answer: http://stackoverflow.com/a/26397746
type: AnsweredQuestion
tagged with: android-layout
tagged with: syntax
tagged with: java
score: -1
answer count: 2
tagged with: xml-parsing

http://stackoverflow.com/comment/75487868
type: AnswerComment
score: 0
type: Comment
has text: @KSK It's not clear to me how that's related to this question an answer. I think you'd be better asking a new question with some more details
comment on: http://stackoverflow.com/a/26484253

http://stackoverflow.com/a/26573609
downvote count: 1
has body: Found a small, but complete and concise example at https://github.com/square/retrofit/tree/master/samples
answers question: http://stackoverflow.com/q/26500036
upvote count: 2
type: Answer
score: 1

http://stackoverflow.com/a/26420375
has comment: http://stackoverflow.com/comment/41492473
upvote count: 1
has body: It is bad practise to mix "back-end entity" annotations with "front-end entity" annotations. Create separate class for inserting user and updating user with @Required annotations accordingly. Remove front-end annotations from User entity and leave only JPA annotations like @Id @Column etc.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26417691
type: Answer

http://stackoverflow.com/comment/41585356
score: 0
type: AnswerComment
type: Comment
has text: Please note that I didn't remove the ojdbc.jar from the war file though
comment on: http://stackoverflow.com/a/26470731

http://stackoverflow.com/q/26473297
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26476207
type: UnansweredQuestion
has title: Why ShuffleConsumerPlugin doesn't start before mapping?
tagged with: java
type: Question
tagged with: hadoop
tagged with: hadoop2
has body: I created a custom implementation of ShuffleConsumerPlugin and it works. However, it is instantiated after my mapping task is done: org.apache.hadoop.mapred.LocalJobRunner: Waiting for map tasks org.apache.hadoop.mapred.LocalJobRunner: Starting task: attempt_local1582630093_0001_m_000000_0 org.apache.hadoop.mapred.LocalJobRunner: map &gt; sort org.apache.hadoop.mapred.Task: Task 'attempt_local1582630093_0001_m_000000_0' done. org.apache.hadoop.mapred.LocalJobRunner: map task executor complete. org.apache.hadoop.mapred.LocalJobRunner: Waiting for reduce tasks org.apache.hadoop.mapred.LocalJobRunner: Starting task: attempt_local1582630093_0001_r_000000_0 org.apache.hadoop.mapred.ReduceTask: Using ShuffleConsumerPlugin: FooPlugin Reduce task starts after the mapping one is finished. I'm setting mapreduce.job.reduce.slowstart.completedmaps to 0.0 for the job as suggested here, but it doesn't make any difference. I'm using Hadoop 2.5.1

http://stackoverflow.com/comment/41474908
type: Comment
type: QuestionComment
has text: thats what i wrote...
score: 0
comment on: http://stackoverflow.com/q/26413450

http://stackoverflow.com/a/26436484
downvote count: 0
answers question: http://stackoverflow.com/q/26436276
type: Answer
score: 1
upvote count: 1
has body: You can do without any loops, quite easily so public static void averageVowels(ArrayList&lt;String&gt; vowels) { System.out.println(vowels); String arrayToString = vowels.toString(); int length = arrayToString.length(); System.out.println("a count: " + (length - arrayToString.replace("a", "").length())); System.out.println("e count: " + (length - arrayToString.replace("e", "").length())); System.out.println("i count: " + (length - arrayToString.replace("i", "").length())); System.out.println("o count: " + (length - arrayToString.replace("o", "").length())); System.out.println("u count: " + (length - arrayToString.replace("u", "").length())); } It prints [mitsubishi, subaru, nissan, honda, toyota] a count: 4 e count: 0 i count: 4 o count: 3 u count: 3

http://stackoverflow.com/a/26365441
has body: You are only including the class file output. If you want to include all SourceSet output do: from sourceSets.main.output
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26362186
answers question: http://stackoverflow.com/q/26362186
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26446139
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42099768
type: UnansweredQuestion
tagged with: bigdata
has body: I'm trying to process the wikipedia dump found here. Specifically with the file - enwiki-latest-pages-articles-multistream.xml.bz2. This is about 46GB uncompressed. I am currently using the STAX parser in Java (xerces) and am able to extract 15K page elements per second. However the bottleneck seems to be the parser and I have toyed around with aalto-xml but it hasn't helped. Since I'm parsing each page element in the Storm spout, it is a bottleneck. However, I thought I could simply emit the text between ... tags and have several bolts process each of those page elements in parallel. This would reduce the amount of work the Storm spout has to perform. However I am not sure of the specific approach to take here. If I use a parser to extract the content between tags then that would mean it would parse every single element from the beginning of the tag until the end. Is there a way to eliminate this overhead in a standard SAX/STAX parser?
tagged with: java
tagged with: apache-storm
type: Question
has answer: http://stackoverflow.com/a/36346268
answer count: 2
has title: Parallel Processing Wikipedia's XML Data Dump with Storm
has answer: http://stackoverflow.com/a/28604720
has comment: http://stackoverflow.com/comment/60313870
score: 0

http://stackoverflow.com/q/26511939
has body: I have the following scenario in my current Java project: A properties file: animal1=cat animal2=dog A Java method: public String replace(String input) { return input.replaceAll("%(.*?)%", properties.getProperty("$1")); } The part that says properties.getProperty("$1") obviously doesn't work because it will return the property for the key "$1" but not for the actual value for $1. Is there any simple method to replace for example "%animal1%" with "cat"? The properties file will contain a few hundred entries, so searching after a substring that could be replaced for every value in the properties file is not an option.
type: AnsweredQuestion
has title: Java: Replace RegEx with method outcome
tagged with: java
has answer: http://stackoverflow.com/a/26512242
accepted answer: http://stackoverflow.com/a/26512315
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26512242
tagged with: replace
score: 0
tagged with: string
has answer: http://stackoverflow.com/a/26512315
tagged with: properties
tagged with: regex

http://stackoverflow.com/a/26513560
has comment: http://stackoverflow.com/comment/41657909
score: 1
has comment: http://stackoverflow.com/comment/88307258
upvote count: 1
has body: I suggest you put a debug print statement before this line: if (null == mro) { return false; } Since this is in a while loop, and allows the method to return false even thoughresult has been set true. I'll bet this is where the false return is coming from, and why you don't see the final print statements being executed.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26511892
type: Answer
accepted answer of: http://stackoverflow.com/q/26511892
downvote count: 0
has comment: http://stackoverflow.com/comment/88367416

http://stackoverflow.com/comment/41536427
comment on: http://stackoverflow.com/q/26446865
has text: I do call the draw method in another class. I put System.out.println("test"); at the beginning of the draw method and it printed test.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26391048
has answer: http://stackoverflow.com/a/26445390
tagged with: restlet
accepted answer: http://stackoverflow.com/a/26589094
favorite count: 0
has title: Restlet Client :: how to add filters?
upvote count: 3
has answer: http://stackoverflow.com/a/26589094
tagged with: restlet-2.0
downvote count: 0
has body: I suffering of a lack of documentation on the use of Restlet at the client side. I am getting a resource on server via a ClientResource: new ClientResource(url).get(); But the server can return an ETag header. To handle this I want to save the ETag when returned and send it back to the server when using the same url. Currently I am doing it like this: ClientResource clientResource = new ClientResource(url); addEtag(url, clientResource); // add the cached ETag to the query if any clientResource.get(); saveEtag(url, clientResource); // cache the ETag if any I would like to do this using the Restlet framework. I am searching for days wihtout understanding the missing link. I can extend an application, overwrite the createOutboundRoot() method and return a filter: public class RestLetClient extends Application { private Client client; // instantiation of the client and other things here @Override public Restlet createOutboundRoot() { return new Filter(getContext(), client){ @Override protected int beforeHandle(Request request, Response response) { addEtag(request); return super.doHandle(request, response); } @Override protected void afterHandle(Request request, Response response) { saveEtag(request, reponse); return super.afterHandle(request, response); } }; } } BUT how can I use this filtering around the Restlet client from my business code? EDIT The best I could get to work until now is this: Request request = new Request(Method.GET, uri); //the filter created in original post filter.handle(request).getEntity(); This works but it is not integrated in the framework. What I am achieving to do is at the client side what is only documented for the server side. On the server you would do: public class ServerApplication extends Application { @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); router.attach(GET_URL, GetResource.class); return router; } } and then start the server. The application will the be triggered on the reception of …
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/26445390

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/26373495
type: Tag

http://stackoverflow.com/comment/41485592
type: QuestionComment
comment on: http://stackoverflow.com/q/26419513
has text: The answer is: No, this is not supported, you can only loop over 1 collection at a time in an enhanced for loop. Reference to the language specification: http://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.14.2
score: 0
type: Comment

http://stackoverflow.com/comment/41584321
comment on: http://stackoverflow.com/a/26473412
score: 0
type: Comment
has text: the return type is boolean and no it does not depend on his requiremtn
type: AnswerComment

http://stackoverflow.com/comment/41645175
type: Comment
has text: oh so i can do this? i never thought about that
type: AnswerComment
comment on: http://stackoverflow.com/a/26504092
score: 0

http://stackoverflow.com/q/26359679
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/41377435
has comment: http://stackoverflow.com/comment/41377495
has body: I'm trying to call a method from a class called Circle in my project which displays some basic information about the object in a JLabel. For some reason the text won't go to a new line even when I use HTML to try and format it: @Override public String toString(){ return " Type: " + this.getClass().getSimpleName() + " Radius: " + getRadius() + " Area: " + df.format(getArea()) + " Perimeter: " + df.format(getPerimeter()); } I'm trying to display the info with this code: @Override public void actionPerformed(ActionEvent ae) { if(ae.getSource()==btnCalc && x==1){ //create object double R = Double.parseDouble(Txt1.getText()); Circle circ = new Circle(R); lblResult.setText(circ.toString()); } When I run the program it just returns this: Type: Circle Radius: 4.0 Area: 50.27 Perimeter: 25.13 edit: I tried just setting the text as an exception message instead of calling the method and it didn't work this way either edit: Now this happens when I try to run the cylinder-sphere classes, but it doesn't do that when I don't have any html in the toString() method. Turns out I was using a DecimalFormat in the last four classes which was what was giving me the exception. Once I got rid of that, the strings formatted nicely using a JTextPane instead of a JtextField.
type: Question
has comment: http://stackoverflow.com/comment/41377698
answer count: 1
has title: JLabel HTML New Line Issue
has answer: http://stackoverflow.com/a/26361715
has comment: http://stackoverflow.com/comment/41377543
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/26361715
has comment: http://stackoverflow.com/comment/41380945
tagged with: jlabel
tagged with: line
type: AnsweredQuestion

http://stackoverflow.com/comment/41517890
type: Comment
has text: The range of `char` is U+0000 to U+FFFD. (And, of ASCII: 0 to 127.)
comment on: http://stackoverflow.com/a/26436424
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41419893
type: QuestionComment
comment on: http://stackoverflow.com/q/26382653
has text: What do you use as an IDE?
score: 0
type: Comment

http://stackoverflow.com/q/26421144
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41488120
tagged with: java
has answer: http://stackoverflow.com/a/26421249
has comment: http://stackoverflow.com/comment/41488133
accepted answer: http://stackoverflow.com/a/26421249
type: Question
has answer: http://stackoverflow.com/a/26421258
score: -1
answer count: 6
has answer: http://stackoverflow.com/a/26421242
has answer: http://stackoverflow.com/a/26421217
downvote count: 2
possible better answer: http://stackoverflow.com/a/26421192
upvote count: 1
has answer: http://stackoverflow.com/a/26421320
has answer: http://stackoverflow.com/a/26421192
has body: how to change values in ​​string in java String s = "Welcome!This is CS211 Course"; I want to change word "CS211" to "CS222" so s will be Permanently = "Welcome!This is CS222 Course";
has title: How to change values in string in java?
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41488199

http://stackoverflow.com/q/26462846
linked to: http://stackoverflow.com/q/12448947
has comment: http://stackoverflow.com/comment/41567162
score: 0
has body: Say I have a class MyDialogClass extends JDialog, which I use everywhere in my application, in order to acheive some specific behaviour of my dialogs. Now, I also want to enjoy the benefits of JOptionPane utilities, and call showXxxDialog to view messages / errors etc., but I still want the underlying dialogs to behave as a MyDialogClass instances. Is it possible to achive (prefferably without deeply replicating the source of JOptionPane)? EDIT: The specific behaviour I am trying to acheive is setting the dialog alwaysOnTop to true. I will try @Andrew's solution for this issue. BUT, this is only the current problem I'm facing, and not the only extended behaviour in MyDialogClass. So there might be such "workaround" for every single problem, but I was intentionaly looking for a conceptual solution, which is the reason for putting my question as I originally did. For instance - MyDialogClass also registeres a WindowListener to it's instances in the constructor
has title: JOptionPane - show dialog of my own JDialog sub class
has answer: http://stackoverflow.com/a/26470541
type: UnansweredQuestion
tagged with: swing
tagged with: oop
tagged with: dialog
has comment: http://stackoverflow.com/comment/41571694
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26462964
linked to: http://stackoverflow.com/q/16826009

http://stackoverflow.com/a/26459698
answers question: http://stackoverflow.com/q/26459166
has comment: http://stackoverflow.com/comment/41577143
type: Answer
downvote count: 0
score: 3
has body: You can try using Mockito's annotation in order to avoid the first warning. In the second one, Matchers allow to use Generics so this should works fine @RunWith(MockitoJUnitRunner.class) public class TestCase1 { @Mock private Foo&lt;Bar&gt; fooMock; @Test public void testBar() { fooMock.doIt(Matchers.&lt;Bar&gt;any()); Mockito.verify(fooMock, Mockito.times(1)).doIt(Matchers.&lt;Bar&gt;any()); } }
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26459166
type: AcceptedAnswer

http://stackoverflow.com/q/26458146
tagged with: java
has answer: http://stackoverflow.com/a/26458226
has comment: http://stackoverflow.com/comment/41583868
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41556757
has title: java output single line instead of line by line
has answer: http://stackoverflow.com/a/26458278
score: 1
favorite count: 0
type: Question
has body: I have a sample java program as follows: public class Test { public static void main(String[] args) { for(int i =0;i&lt;100;i++){ System.out.println("Value:"+i); } } } I run this program in CMD using the following command: java Test I am getting output as follows: Value:1 Value:2 .......... What I want is the output should be on a single line like: Value 1 Instead of displaying each value on a separate line, it should change the printed value on the same line as it counts. How do I do that?
upvote count: 2
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/26458160

http://stackoverflow.com/q/26456700
has comment: http://stackoverflow.com/comment/41554020
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41554243
has body: I am trying to make a information JFrame on loading, after load the new frame will open up with the game I am creating, the only problem is that my loading time keeps flashing, I know basic java, but I'm not super advanced, here is my code: package Console; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; public class Main extends Canvas implements Runnable{ public boolean running = false; public boolean LoadingScreen = false; public Thread mainThread; public Thread loadThread; public boolean finishedLoading = false; public void start_loading() { } public void stop_loading() { if(!LoadingScreen) { return; }else { LoadingScreen = false; try { loadThread.join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public synchronized void start() { if(LoadingScreen) { return; }else { LoadingScreen = true; loadThread = new Thread(this); loadThread.start(); } if(running == true) { return; }else { running = true; mainThread = new Thread(this); mainThread.start(); } } public synchronized void stop() { if(!running) { return; }else { running = false; try { mainThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } } public static final int WIDTH = 240, HEIGHT = 260, SCALE = 2; //public static JTextArea loadingShow = new JTextArea(); public static void main(String args[]) { Main Main = new Main(); Main.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE)); Main.setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE)); Main.setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE)); JFrame screen = new JFrame("Screen"); screen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); screen.setSize(WIDTH * SCALE, HEIGHT * SCALE); screen.setResizable(false); //screen.setLayout(new FlowLayou…
has comment: http://stackoverflow.com/comment/41554146
has title: JFrame graphics flashing
tagged with: java
has comment: http://stackoverflow.com/comment/41554070
has comment: http://stackoverflow.com/comment/41554258
has comment: http://stackoverflow.com/comment/41554002
type: Question
has comment: http://stackoverflow.com/comment/41554003
has comment: http://stackoverflow.com/comment/41554267
score: 0

http://stackoverflow.com/comment/41514523
comment on: http://stackoverflow.com/q/26434320
score: 0
type: Comment
type: QuestionComment
has text: see http://docs.oracle.com/javaee/6/tutorial/doc/bncbx.html

http://stackoverflow.com/q/26401642
score: 6
has answer: http://stackoverflow.com/a/26402622
type: Question
possible better answer: http://stackoverflow.com/a/38533010
tagged with: junit4
has answer: http://stackoverflow.com/a/38533010
tagged with: java
accepted answer: http://stackoverflow.com/a/32354014
answer count: 3
tagged with: rest-assured
downvote count: 0
favorite count: 0
has title: Using PowerMock to mock static class in a rest-assured test
tagged with: powermock
upvote count: 6
has body: Is there any way to use PowerMock with rest-assured, because when I'm trying to test a RESTful API with rest-assured. I want to PowerMock a static call. The code of operation: @POST @Produces("application/json") @Consumes(MediaType.APPLICATION_JSON) public Response createEntity(@Context HttpHeaders hh, String body) { . . . String sec = MDI.check(Some_string, ..., ...); if (sec == null) throw ... return Response.... } And the test: @RunWith(PowerMockRunner.class) @PrepareForTest(MDI.class) public class createSOTest { @Test public void testStatic() { mockStatic(MDI.class); expect(MDI.check(Some_string, ..., ...).andReturn(Some_String); replay(MDI.class) given(). contentType(ContentType.JSON). header("SomeHeader", "something"). body(root). when(). post("/"). then(). statusCode(...); } } The problem is that I obtain an exception when the test try to run the rest-assured code (given()....): org.apache.http.conn.ssl.SSLInitializationException: class configured for SSLContext: sun.security.ssl.SSLContextImpl$TLS10Context not a SSLContext at org.apache.http.conn.ssl.SSLContexts.createDefault(SSLContexts.java:58) at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:162) at org.apache.http.impl.conn.SchemeRegistryFactory.createDefault(SchemeRegistryFactory.java:52) at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(AbstractHttpClient.java:305) at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:465) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) at org.codehaus.groovy.runtime.metaclass.MethodMetaProperty$G…
has answer: http://stackoverflow.com/a/32354014
type: AnsweredQuestion

http://stackoverflow.com/comment/41619676
has text: An arraylist of bitmaps is very heavy for the memory. Maybe you should try an arraylist of the bitmap url or File paths.
comment on: http://stackoverflow.com/a/26492962
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26475279
type: Answer
has body: This is like saying you'd like to see your Java code with the user's input hardcoded into the source. That would be ridiculous, because you know that the user's input is never combined with the Java source. It's combined (so to speak) with the compiled Java app at runtime. There is never a time when input data becomes merged into the source. It's the same way with prepared SQL statements. During prepare(), the RDBMS receives the textual SQL string, and parses it internally and retains a sort of "bytecode" version of the query. In this internal representation, the parameter placeholders are noted, and the query cannot execute before values are provided. During execute(), the RDBMS receives parameter values, and combines them with the bytecode. The parameters never see the original SQL text! That's the way it is supposed to work.
answers question: http://stackoverflow.com/q/26474097
has comment: http://stackoverflow.com/comment/41615751
has comment: http://stackoverflow.com/comment/41612385
score: 0

http://stackoverflow.com/a/26520128
type: Answer
accepted answer of: http://stackoverflow.com/q/26499982
score: 0
answers question: http://stackoverflow.com/q/26499982
type: AcceptedAnswer
has body: Where do you want to store the entity's state? Session, view or db? Add @SessionAttributes({"myPojo"}) To your controller Or use a hidden input field in your view with c's value Or annotate a controller method with @ModelAttribute and return the entity from the db each request You can also create a new, smaller POJO just for the form(s) and use Dozer to copy values to/from your real entity, and use dynamic update.
has comment: http://stackoverflow.com/comment/41671504

http://stackoverflow.com/comment/41444663
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26396582
has text: Your question is really confusing.

http://stackoverflow.com/q/26385748
tagged with: android
has body: I'm trying to detect if there is actually an internet connection and websites are reachable. I have a broadcast receiver that runs the following method on receive: public boolean hasInternetNow() { Thread checkinternet = new Thread(new Runnable() { @Override public void run() { try { try { ConnectivityManager cm = (ConnectivityManager) myContext.getSystemService(Context.CONNECTIVITY_SERVICE); if (cm.getActiveNetworkInfo().isConnectedOrConnecting()) { URL url = new URL("http://www.google.com"); HttpURLConnection urlc = (HttpURLConnection) url .openConnection(); urlc.setRequestProperty("User-Agent", "test"); urlc.setRequestProperty("Connection", "close"); urlc.setConnectTimeout(1000); // mTimeout is in seconds urlc.connect(); if (urlc.getResponseCode() == 200) { setinternetDetected(true); } else { setinternetDetected(false); } } } catch (IOException e) { e.printStackTrace(); setinternetDetected(false); } catch (NullPointerException e){ e.printStackTrace(); setinternetDetected(false); } } catch (Exception e) { e.getLocalizedMessage(); setinternetDetected(false); } } }); checkinternet.start(); return internetDetected(); } While connected to the Wifi and google is reachable through the internet app, I get the following error: 10-15 07:50:46.656: W/System.err(24203): java.net.UnknownHostException: Unable to resolve host "www.google.com": No address associated with hostname 10-15 07:50:46.656: W/System.err(24203): at java.net.InetAddress.lookupHostByName(InetAddress.java:426) 10-15 07:50:46.656: W/System.err(24203): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242) 10-15 07:50:46.656: W/System.err(24203): at java.net.InetAddress.getAllByName(InetAddress.java:220) 10-15 07:50:46.656: W/System.err(24203): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:71) 10-15 07:50:46.656: W/System.err(24203): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) 10-15 07:50:46.656: W/System.err(24203): at libcore.net.http.HttpConnection$…
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/26385831
tagged with: httpconnection
has comment: http://stackoverflow.com/comment/41427627
has comment: http://stackoverflow.com/comment/41425674
tagged with: unknown-host
type: AnsweredQuestion
has title: java.net.UnknownHostException: Unable to resolve host "www.google.com"
tagged with: java
type: Question
tagged with: connectivity
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26385831

http://stackoverflow.com/comment/41506216
has text: "JIT compiler will likely inline the length() method". Any documentation on this? I love to read about this sort of stuff.
type: AnswerComment
comment on: http://stackoverflow.com/a/26430729
score: 0
type: Comment

http://stackoverflow.com/a/26443043
score: -1
downvote count: 1
has body: Try this code import java.util.Scanner; public class ReverseArray{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Please input the size of array: "); int arraySize = sc.nextInt(); //Stores user input double[] myArray = new double[arraySize]; //Create array[userInput] System.out.print("Please input " + arraySize + " double numbers: ");//Collect user input for(int i = 0; i &lt; myArray.length; i++){ if (sc.hasNextDouble()) { myArray[i] = sc.nextDouble(); //Insert user input into array } } // Reverse myArray for(int i = 0, j = myArray.length-1; i &lt; (myArray.length/2); i++, j--){ Double temp = myArray[i]; myArray[i] = myArray[j]; myArray[j] = temp; } //Print the reversed myArray System.out.println("After reverse order: "); for (int i=0;i&lt;arraySize;i++) System.out.println(myArray[i]); } }
answers question: http://stackoverflow.com/q/26441604
type: Answer
has comment: http://stackoverflow.com/comment/49153045
upvote count: 0

rampart
tags question: http://stackoverflow.com/q/26483389
type: Tag
tag name: rampart

http://stackoverflow.com/comment/41540975
score: 0
comment on: http://stackoverflow.com/a/26448169
type: Comment
has text: do not use @ResponseBody as you want viewer resolver to do its work
type: AnswerComment

http://stackoverflow.com/a/26507271
type: Answer
downvote count: 0
has body: You can make the Garage generic and re-use the type in the addCarToGarage method: public abstract class Garage&lt;T extends Car&gt; { public abstract List&lt;T&gt; getCars(); public abstract void addCarToGarage(T car); } Then, the SportCarGarage would look like this: public class SportCarGarage extends Garage&lt;SportCar&gt; { @Override public List&lt;SportCar&gt; getCars() { // code to return the cards } @Override public void addCarToGarage(SportCar car){ // code to add car to garage } }
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/41645155
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26507212
answers question: http://stackoverflow.com/q/26507212

http://stackoverflow.com/comment/41566210
type: QuestionComment
has text: I have set s[0] and s[1] for combobox1 and combobox2 for reading first line,how do i read the send line and third line.
comment on: http://stackoverflow.com/q/26463155
score: 0
type: Comment

http://stackoverflow.com/comment/41459182
comment on: http://stackoverflow.com/q/26405164
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/5579309/switch-instanceof
score: 0

http://stackoverflow.com/comment/140195817
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26442349
has text: I would note that the "three levels" here is navigating back up to the directory above `META-INF/`
type: Comment

http://stackoverflow.com/a/26498948
score: 1
answers question: http://stackoverflow.com/q/26498928
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26498928
type: Answer
upvote count: 1
has body: try using core taglib &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; &lt;c:if test="${sessionScope.LOGGEDINUSER.groupname == 'admin'}"&gt; // or whatever your object is called &lt;!-- show it --&gt; &lt;c:if&gt;

http://stackoverflow.com/comment/41580273
comment on: http://stackoverflow.com/q/26462474
has text: Well, I understand that, but I am more asking about calling an event that requires a click event occur. IE, I could make a button that calls a toast that says, "hi!" via a button hit, but I also could make that same toast happen by calling a method in the onCreate() that produces a toast. I am trying to figure out how to do the latter via an automatic event that happens without user intervention.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26390855
has title: How to make this program follow 2 conditions?
tagged with: swing
type: Question
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/26390923
answer count: 1
score: 0
has body: I have some code which I want to follow two conditions. ans can be m/f and ans1 can be b/m/l How can I connect them? if (ans == 'm') + (ans1 == 'b') { total = (((((9.99 * result2) + (6.25 * result3)) - (4.92 * result1)) - 161) * result4) + 1000; JOptionPane.showMessageDialog(null, "You need " + total + " calories to maintain weight"); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41434930

http://stackoverflow.com/a/29245605
has body: I'd recommend lowering the severity for unused methods in general. Simply go to Settings | Inspections | Declaration redundancy | Unused Declarations, and change the severity to "Info" or "Weak Warning" .
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26355761
downvote count: 0

http://stackoverflow.com/a/26374366
score: 1
upvote count: 1
has body: Solution: You just need to test the input before you process it. int emrips = scanner.nextInt(); if (emrips &lt;= 0) { System.exit(0); }
downvote count: 0
answers question: http://stackoverflow.com/q/26374326
accepted answer of: http://stackoverflow.com/q/26374326
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41547344
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26453100
score: 0
has text: @Alex No, don't do that under any circumstances. What I tried to say was that if this **really** is what slows your application down (and 99% of the time it's something else), you might consider using a one-dimensional array with NxM elements.

http://stackoverflow.com/a/26443892
has comment: http://stackoverflow.com/comment/41531628
has body: I agree, use breakpoints to check each iteration of the loop and see what the data is for each index. Perhaps there's an error in your getdbdata() method? Are you still having problems with the Activity launching on checkbox check?
has comment: http://stackoverflow.com/comment/41531430
has comment: http://stackoverflow.com/comment/41530778
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/26442938
has comment: http://stackoverflow.com/comment/41531205
has comment: http://stackoverflow.com/comment/41531485
type: Answer
has comment: http://stackoverflow.com/comment/41530730
has comment: http://stackoverflow.com/comment/41530586
has comment: http://stackoverflow.com/comment/41537158
has comment: http://stackoverflow.com/comment/41537881
has comment: http://stackoverflow.com/comment/41530900
upvote count: 0

http://stackoverflow.com/comment/50599657
comment on: http://stackoverflow.com/q/26360245
has text: I agree with your sentiment on desired 100% coverage. For me though its more about OCD desires. In one project I refactored the try-with-resources into a few separate very simple methods, so I could easily isolate and test the various pieces independently.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41378102
type: Comment
has text: `A continue statement must refer to a label within the immediately enclosing method, constructor, initializer, or lambda body.` There are no non-local jumps. If no labeled statement with Identifier as its label in the immediately enclosing method, constructor, initializer, or lambda body contains the continue statement, a compile-time error occurs.
score: 0
comment on: http://stackoverflow.com/a/26359968
type: AnswerComment

http://stackoverflow.com/comment/41467361
comment on: http://stackoverflow.com/q/26409243
has text: I guess it's time for an update then.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26356657
score: 0
has comment: http://stackoverflow.com/comment/41375891
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has body: Acutally I want to know: When we call SSLContext.getDefault() to get SSLContext instanse, from where this (returned object) SSLContext is created. is It either created from: local machine specific java internal specific as per web server configuration did in server.xml based (in case used in web based application) or some thing else.
tagged with: ssl
tagged with: truststore
tagged with: ssl-certificate
has comment: http://stackoverflow.com/comment/41404936
has title: getDefault() of SSLContext from where this object is created

http://stackoverflow.com/q/26503109
tagged with: swing
has comment: http://stackoverflow.com/comment/41638295
downvote count: 1
tagged with: jbutton
has body: My goal is creating a function that waits half second, set the jbutton's background to red for one second, and after this second the jbutton will return to normal. Cant make this work.. This is my Function private void paint(final int num){ Timer timer = new Timer(500, new ActionListener() { public void actionPerformed(ActionEvent e) { if (num == 1){ btn.setBackground(Color.black); } } }); timer.start(); }
type: Question
type: AnsweredQuestion
has title: make jbutton to turn on and off
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41638028
answer count: 2
has answer: http://stackoverflow.com/a/26503192
favorite count: 0
has comment: http://stackoverflow.com/comment/41641166
accepted answer: http://stackoverflow.com/a/26503192
possible better answer: http://stackoverflow.com/a/26503526
tagged with: timer
has answer: http://stackoverflow.com/a/26503526
upvote count: 2

http://stackoverflow.com/q/26355535
tagged with: java
tagged with: hibernate
type: Question
tagged with: jakarta-ee
tagged with: ejb
has answer: http://stackoverflow.com/a/26356179
tagged with: jpa
answer count: 1
score: 0
type: UnansweredQuestion
has body: Supposing that I've a DAO defined as follows: @Local(MyEntityDAO.class) @TransactionAttribute(TransactionAttributeType.REQUIRED) @Stateless public class MyEntityDAO { public MyEntity create(MyEntity entity) { entityManager.persist(entity); return entity; } // Etc. [...] } All methods throw JPA standard exceptions. Now, I'd like to setup data transactions in order to manage rollbacks if an occurs at runtime. A first approach that I found is to inject an UserTransaction together with a DAO instance, as follows: @ManagedBean class myBean() { @Inject myEntityDAO myEntityDAO; @Resource UserTransaction userTransaction; void doSomething() { try { // userTransaction.begin(); MyEntity myEntity = new MyEntity("sample-data"); myEntityDAO.create(myEntity); userTransaction.commit(); } catch (Exception ex) { userTransaction.rollback(); throw ex; } } } Is the solution above right? Is it possible to automatically manage transactions just by annotating an EJB and using as said JPA standard exceptions?
has title: Transaction management with JPA: how to perform a rollback if an error occurs at runtime

http://stackoverflow.com/q/26402783
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26402912
tagged with: stax
has body: I am using XMLStreamWriter class from StAX to generate XML file from a java program. I followed this tutorial and the XMLFile is getting generated correctly. How do I get the size of the file that has been generated ?
has title: How to get filesize of file generated using XMLStreamWriter?
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26402912

http://stackoverflow.com/comment/41473384
comment on: http://stackoverflow.com/a/26412298
score: 0
type: Comment
has text: getlost, i wanted to get rid of .setIconImage, and now i would have to add .setTitle(); so it would bring more code again. But thank you. You've been very helpful.
type: AnswerComment

http://stackoverflow.com/a/26446571
type: Answer
has body: nextLine() will always return a String, so that isn't your problem. compareTo(str) returns an negative number if str is lexicographically less than the value being compared to, 0 if the Strings are lexicographically equal, or a positive number if the str is lexicographically more than the value being compared to. You want to use equals(str), which returns a boolean value.
answers question: http://stackoverflow.com/q/26446538
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26446538
score: 3
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/26385957
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26386078
upvote count: 2
has title: How to run java class command line?
answer count: 3
has answer: http://stackoverflow.com/a/26386532
downvote count: 1
accepted answer: http://stackoverflow.com/a/26386177
tagged with: cmd
has body: I have the following test question: Given: 1. package com.company.application; 2. 3. public class MainClass { 4. public static void main(String[] args) {} 5. } And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory).Which two java commands entered at the command line will run MainClass? (Choose two.) A. java MainClass if run from the /apps directory B. java com.company.application.MainClass if run from the /apps directory C. java -classpath /apps com.company.application.MainClass if run from any directory D. java -classpath . MainClass if run from the /apps/com/company/application directory E. java -classpath /apps/com/company/application:. MainClass if run from the /apps directory F. java com.company.application.MainClass if run from the /apps/com/company/application directory I think the correct are D and E but the are B and C and I am wondering why?
favorite count: 0
has answer: http://stackoverflow.com/a/26386177
possible better answer: http://stackoverflow.com/a/26386078
type: AnsweredQuestion
tagged with: scjp
has comment: http://stackoverflow.com/comment/41425833
score: 1
tagged with: classpath

http://stackoverflow.com/q/26365457
tagged with: performance
downvote count: 0
has title: Should I dump java.util.HashSet in favor of CompactHashSet?
tagged with: java
has comment: http://stackoverflow.com/comment/41388967
has comment: http://stackoverflow.com/comment/41388813
has comment: http://stackoverflow.com/comment/41388771
upvote count: 8
type: Question
possible better answer: http://stackoverflow.com/a/26365584
has comment: http://stackoverflow.com/comment/41388988
tagged with: hashset
has comment: http://stackoverflow.com/comment/41388805
has answer: http://stackoverflow.com/a/26369483
accepted answer: http://stackoverflow.com/a/26369483
answer count: 3
has comment: http://stackoverflow.com/comment/41388529
has answer: http://stackoverflow.com/a/26367488
score: 8
tagged with: big-o
has comment: http://stackoverflow.com/comment/41388683
favorite count: 0
has answer: http://stackoverflow.com/a/26365584
has comment: http://stackoverflow.com/comment/41388531
has body: I found that there is an implementation of a Set that uses hashes (with all the useful consequences, like O(1) for contains() etc) that is claimed to be more efficient than java.util.HashSet in every aspect: http://ontopia.wordpress.com/2009/09/23/a-faster-and-more-compact-set/ http://alias-i.com/lingpipe/docs/api/com/aliasi/util/CompactHashSet.html Would it then be a good idea to quit using java.util.HashSet completely wherever I need a java.util.Set in favor of com.aliasi.util.CompactHashSet?
tagged with: collections
has comment: http://stackoverflow.com/comment/41390022
has comment: http://stackoverflow.com/comment/41388898
has comment: http://stackoverflow.com/comment/41388557
type: AnsweredQuestion

http://stackoverflow.com/comment/41396047
type: Comment
comment on: http://stackoverflow.com/q/26369002
has text: Please look at the edit.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26387128
tagged with: instance
has comment: http://stackoverflow.com/comment/41428282
tagged with: java
has comment: http://stackoverflow.com/comment/41428964
type: Question
tagged with: class
tagged with: arraylist
score: 0
answer count: 2
has title: Accessing an instance of a class in an arraylist loop
has answer: http://stackoverflow.com/a/26387412
has comment: http://stackoverflow.com/comment/41428793
has answer: http://stackoverflow.com/a/26387642
type: UnansweredQuestion
has body: So I have a class LayerCopper that holds a few textboxes and a few methods to set values in those textboxes: public class LayerCopper extends javax.swing.JPanel { public LayerCopper() { initComponents(); } private static javax.swing.JFormattedTextField CuWeightTextField; private static javax.swing.JFormattedTextField LayerNumJFormattedTextField; ... ... ... public void setLayerNumberText(int layerNumber) { LayerNumJFormattedTextField.setText("" + layerNumber); } public void setLayerCuThickness(double CuThickness) { CuWeightTextField.setValue(CuThickness); } } I also have another class StackupCalculator with multiple instances of the LayerCopper panels in it. I have an arraylist that holds each instance of the LayerCopper panel: static ArrayList&lt;LayerCopper&gt; layerSet_Copper = new ArrayList&lt;&gt;(); ... ... ... public void createLayerSetArray() { layerSet_Copper.add(layerCopper1); layerSet_Copper.add(layerCopper2); layerSet_Copper.add(layerCopper3); layerSet_Copper.add(layerCopper4); layerSet_Copper.add(layerCopper5); initializeLayerArrayValues(); } When my initializeLayerArrayValues runs, It's supposed to populate a couple textfields with text: private void initializeLayerArrayValues() { for (int i = 0; i &lt; layerSet_Copper.size(); i++) { layerSet_Copper.get(i).setLayerNumberText(i + 1); layerSet_Copper.get(i).setLayerCuThickness(0.750); } } When I run the program though it doesn't update the fields. I'm guessing I am calling the main class LayerCopper and not the instanced version of it? How would I call the instanced version of the layer?

http://stackoverflow.com/comment/41663829
type: Comment
has text: @StriplingWarrior But don't take my word for it :) You have the benchmark code that I'm using so you can see what I'm seeing pretty easily if you like.
type: QuestionComment
comment on: http://stackoverflow.com/q/26513492
score: 0

http://stackoverflow.com/a/26415579
score: 1
answers question: http://stackoverflow.com/q/26415533
has body: You should actually never generate a random number (unless a homework criteria requires that of you). Instead, you should guess 500. That number partitions the space from 1...1000 in half. If the user's number is higher, guess 750 (mid-way between 500 and 1000). Continue to partition the range of possibly correct user numbers in half, until you reach the actual number. If you do generate a new random number within the space of possibly correct numbers, you are not guaranteed to finish in 10 steps or less.
has comment: http://stackoverflow.com/comment/41478865
upvote count: 1
has comment: http://stackoverflow.com/comment/41479251
type: Answer
downvote count: 0

http://stackoverflow.com/q/26394505
tagged with: http
type: AnsweredQuestion
tagged with: jersey
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26394528
favorite count: 0
tagged with: rest
has title: Multiple PUT methods in Jersey Rest Service
score: 1
has body: I was wondering if it is possible to have two PUT methods in one resource which take a differing number of arguments via a Form. Eg: @PUT @Produces(MediaType.TEXT_XML) public Response updateOrderStatus( @FormParam("status") String status ){ .... } @PUT @Produces(MediaType.TEXT_XML) public Response updateOrder( @FormParam("coffeeType") String type, @FormParam("addition") String addition, @FormParam("cost") String cost ){ .... } I tried replicating the functions but only changing the function names and it compiled without error. Is this acceptable and if so, is it considered good/bad practice? Thank you for your help.
accepted answer: http://stackoverflow.com/a/26394528
upvote count: 1
tagged with: methods

http://stackoverflow.com/comment/41442940
has text: I second the need for clarity on "efficient" :). In terms of speed, the list of constants will be the fastest, since the right string is "found" at compile time. If you want to make the list dynamic/configurable without recompilation, you can gain some speed by storing the strings in an array with the error code being the index (assuming your error codes are not huge integers, you will waste some memory and gains some lookup speed :)
type: QuestionComment
comment on: http://stackoverflow.com/q/26392672
score: 0
type: Comment

http://stackoverflow.com/q/26458675
tagged with: jenkins
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/74402783
has comment: http://stackoverflow.com/comment/41557640
tagged with: java
has comment: http://stackoverflow.com/comment/41557630
has comment: http://stackoverflow.com/comment/41559276
has body: I am aware that there are many who faced the same issue as I have. I am facing difficulty compiling it with the Maven Compiler Plugin using eclipse. I almost tried all the trouble shooting suggested by others. Any help would be great! ERROR DETAILS: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ WebScraper --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 12 source files to E:\Projects\Workspace\Repos\git\automateon2.0\WebScraper\target\classes The system is out of resources. Consult the following stack trace for details. java.lang.StackOverflowError at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418) at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460) at com.sun.tools.javac.comp.Attr.visitBinary(Attr.java:2062) at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1565) Note: The above 4 lines are repeated 20 + times [ERROR] An unknown compilation problem occurred [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project WebScraper: Compilation failure [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/MojoFailureException Troubleshot with the following : 1. Tried increasing the memory for the maven plugin's configuration node in pom.xml -Xmx512m -XX:MaxPermSize=256m MAVEN_OPTS = Xmx512m -XX:MaxPermSize=128m 2. Tried setting up and increasing memory for the MAVEN_OPTS env variable -Xms1024m -Xmx1024m -XX:MaxPermSize=256m System Information: Windows 7 - 64 bit | Compile Plugin Version: 3.1 | Kepler 64 Nature of my project: Maven, TestNG project, with few java c…
has title: Maven Compilation Issue: The system is out of resources
linked to: http://stackoverflow.com/q/4782509
type: Question
has comment: http://stackoverflow.com/comment/41557301
score: 0
has comment: http://stackoverflow.com/comment/41557456
answer count: 1
has answer: http://stackoverflow.com/a/72382584
has comment: http://stackoverflow.com/comment/41559409

http://stackoverflow.com/a/26497613
has comment: http://stackoverflow.com/comment/41633511
has comment: http://stackoverflow.com/comment/41640468
has body: I've answered similar question here: Calling Graphviz dot from Java You can use the Graphviz Java API class which is a wrapper for Runtime.exec(), this is if you have the dot binaries on the same server as your Java App. If you don't have dot installed on the server or if you are using an environment like Google AppEngine where you can't install dot binaries locally then you can use Graphviz Server, a lightweight Java based HTTP server, you still need to install the dot binaries on the server on which you run Graphviz Server. The following is a code example using the Graphviz Java API class // graphTypeis one of: pdf, svg, png, etc... private static final String TEMP_PATH = "/tmp/graph."; private File generateGraph(String dot, String graphType) { GraphViz gv = new GraphViz(); gv.readString(dot); File out = new File(TEMP_PATH + graphType); // Linux gv.writeGraphToFile( gv.getGraph( gv.getDotSource(), graphType ), out ); return out; }
type: Answer
has comment: http://stackoverflow.com/comment/41638722
downvote count: 1
has comment: http://stackoverflow.com/comment/41712066
has comment: http://stackoverflow.com/comment/53019192
answers question: http://stackoverflow.com/q/26481910
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/41709062
has comment: http://stackoverflow.com/comment/41641275

http://stackoverflow.com/a/26457879
accepted answer of: http://stackoverflow.com/q/26457579
has comment: http://stackoverflow.com/comment/41580024
has comment: http://stackoverflow.com/comment/41555917
has body: Starting with the before and after images... By using new Color(0, 0, 0, 0) instead of 0xff000000 (and painting SOMETHING when the pixels as equal), I get Using... import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JOptionPane; public class ConvertBuffer { public static void main(String[] args) { try { BufferedImage before = ImageIO.read(new File("/Before.jpg")); BufferedImage after = ImageIO.read(new File("/After.jpg")); BufferedImage result = bufferedImagesEqual(before, after); JLabel label = new JLabel(new ImageIcon(result)); label.setOpaque(true); label.setBackground(Color.BLUE); JOptionPane.showMessageDialog(null, label); } catch (Exception e) { e.printStackTrace(); } } private static BufferedImage bufferedImagesEqual(BufferedImage prevImage, BufferedImage currImage) { boolean changed = false; BufferedImage imagePart = new BufferedImage(currImage.getWidth(), currImage.getHeight(), BufferedImage.TYPE_INT_ARGB); if (prevImage.getWidth() == currImage.getWidth() &amp;&amp; prevImage.getHeight() == currImage.getHeight()) { for (int x = 0; x &lt; currImage.getWidth(); x++) { for (int y = 0; y &lt; prevImage.getHeight(); y++) { if (prevImage.getRGB(x, y) != currImage.getRGB(x, y)) { // return false; // currImage.setRGB(x, y, 0); if (!changed) { changed = true; } imagePart.setRGB(x, y, currImage.getRGB(x, y)); } else { imagePart.setRGB(x, y, new Color(0, 0, 0, 0).getRGB()); } } } } else { return imagePart; } if (changed) { return imagePart; } else { return null; } } } So, unless you have an example image to play with, this is the best we can do...
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41555942
downvote count: 0
has comment: http://stackoverflow.com/comment/41583629
has comment: http://stackoverflow.com/comment/41555955
type: Answer
has comment: http://stackoverflow.com/comment/41580277
answers question: http://stackoverflow.com/q/26457579
score: 1
upvote count: 1

http://stackoverflow.com/comment/41525845
type: Comment
type: QuestionComment
has text: @espertus very funny comic strip.
score: 0
comment on: http://stackoverflow.com/q/26430630

http://stackoverflow.com/q/26402875
answer count: 1
has body: I'm getting error as Request processing failed; nested exception is java.lang.NumberFormatException: null. Here is my code: @Controller @RequestMapping("/customerAdmin") public class CustomerAdmincontroller { @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(Customer.class, "customer", new PropertyEditorSupport() {@ Override public void setAsText(String customer) { setValue(new Customer(Integer.parseInt(customer))); } }); } @RequestMapping(value = "/addProfile.htm", method = RequestMethod.GET) public ModelAndView addProfileForm(ModelMap model, HttpServletRequest request) { int id = Integer.parseInt(request.getParameter("id")); System.out.println(id); Profile profile = new Profile(); Customer customer = new Customer(id); profile.setCustomer(customer); model.addAttribute("profile", profile); ModelAndView mav = new ModelAndView("addProfile"); return mav; } } Am getting error as Oct 16, 2014 4:31:47 PM invoke SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [/CustomerPortal] threw exception [Request processing failed; nested exception is java.lang.NumberFormatException: null] with root cause when i run the project this error already show and i see this error in this Here but still it's error for me. any one can help me ? My controler : @Autowired addozv stdDAO; private ServletRequest request; @SuppressWarnings({ "null"}) @RequestMapping(value="/addadmins" , method = RequestMethod.POST) public void addadmins(ModelMap model, HttpServletRequest requ) { String username = requ.getParameter("username"); String password = requ.getParameter("password"); String nozv = requ.getParameter("nozv"); String namefamily = requ.getParameter("namefamily"); String codemely = requ.getParameter("codemely"); String father = requ.getParameter("father"); String adress = requ.getParameter("adress"); String telephone = requ.getParameter("telephone"); admins adm=new admins(); adm.setUsername(username); adm.setPassword(password); ad…
score: 0
has title: Request processing failed; nested exception is java.lang.NumberFormatException: null
has comment: http://stackoverflow.com/comment/41455197
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26403984
tagged with: spring
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/26356164
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41371689
score: 1
tagged with: java
has body: I'm writing my first project in java, and I could use some help and experienced view. I'm trying to write stopWatch class, or something more like kitchen timer, which can provide this functionality: - set hard start and end times, - pause and start time from same place - set if the time is decreasing or increasing - move in Time up and down - addTime (example: watch suppose to start at 00:00 end in 30:00 if we add 35 seconds stopWatch will end at 30:35); - display time every second I didn't find any good thread about this kind of stopWatch/kitchen timer here on stack overflow. My code is working, but I don't really have much of experience with OOD and java generally, so I'm expecting some flaws. It would be reasonable to use some pre-written classes instead? Or Date for time operation? My code: import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; // class for handle timer operation public class stopWatch implements ActionListener { public Timer timer; // timer object private int startTime; // start time in seconds private int endTime; // end time in seconds private int actualTime; // actual time in seconds private long memoryUnixTime; // actual time in Unix format private boolean decrease; // is Timer decrease or incerease Time? private int presize; // how often timer check for change of time // construct public stopWatch(int startTime, int endTime, boolean decrease, int presize){ this.startTime = startTime; this.endTime = endTime; this.decrease = decrease; this.presize = presize; this.actualTime = startTime; } // moving in Time UP public void moveTimeUp (int seconds){ if(inScope("up",seconds)) actualTime += seconds; } // moving in Time DOWN public void moveTimeDown (int seconds){ if(inScope("down",seconds)) actualTime -= seconds; } // is added time still inScope private boolean inScope(String direction,int seconds){ boolean inScopeP; switch(direction){ case "up": inScopeP = ((this.actualTime + seconds) &lt;= this.endTim…
type: Question
has comment: http://stackoverflow.com/comment/41372519
upvote count: 1
tagged with: stopwatch
has title: multifunction stopWatch class in Java
favorite count: 0
tagged with: timer
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/41564923
has text: I reseted my device *4* times, and got to noware. It didn't help me. And I got no useful information from LogCat.
type: Comment
comment on: http://stackoverflow.com/a/26452644
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41549960
type: AnswerComment
has text: @Michiel just to add to the great explanation by Ted Hopp, you can take as example [`java.util.Random#nextXyz`](http://docs.oracle.com/javase/8/docs/api/java/util/Random.html) methods.
comment on: http://stackoverflow.com/a/26454489
type: Comment
score: 1

http://stackoverflow.com/q/26400323
accepted answer: http://stackoverflow.com/a/26401150
upvote count: 3
linked to: http://stackoverflow.com/q/3449827
tagged with: sql
has comment: http://stackoverflow.com/comment/41482654
answer count: 1
has comment: http://stackoverflow.com/comment/41522198
has comment: http://stackoverflow.com/comment/41451114
has comment: http://stackoverflow.com/comment/41450887
has answer: http://stackoverflow.com/a/26401150
favorite count: 0
has title: how to export war file with sql database table in eclipse
has body: I have created a Java EE Technologies dynamic web project in Eclipse. The project creates a database within it. Testing it on a local machine having Tomcat server works fine. I want to deploy this project with the database to another system running Tomcat.Because I need to deliver my project to Customer place. How to accomplish this task? And Is there any possibilities to build war file with sql table.
has comment: http://stackoverflow.com/comment/41451281
has comment: http://stackoverflow.com/comment/41459302
linked to: http://stackoverflow.com/q/20621309
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41451057
downvote count: 0
linked to: http://stackoverflow.com/q/4443192
tagged with: java
has comment: http://stackoverflow.com/comment/41459234
type: Question
score: 3
has comment: http://stackoverflow.com/comment/41459028
has comment: http://stackoverflow.com/comment/41451426
has comment: http://stackoverflow.com/comment/41451561
has comment: http://stackoverflow.com/comment/41458352
tagged with: eclipse

http://stackoverflow.com/comment/41461885
type: QuestionComment
has text: I would do it that way, but project leaders want it this way if we could have more control over it. However, I don't know (yet) how to do it via java. :)
comment on: http://stackoverflow.com/q/26405386
score: 0
type: Comment

http://stackoverflow.com/comment/41467763
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26406701
has text: @Pshemo I just have the "ite" object, I want to get the value of "this$0" field, so the "{Version=0, name="RODRIGO RODRIGUES"" etc... that's it

http://stackoverflow.com/q/26501677
has comment: http://stackoverflow.com/comment/41717627
tagged with: java
has body: I try to run shell scripts on Android using an application written in Java. I want to be able to run Android commands as root such as am or pm which need an export LD_LIBRARY_PATH=/system/lib command before. Unfortunately, the export command doesn't work. Here is the Java code I wrote : private String readScript(String scriptPath) { String line = null; StringBuffer content = new StringBuffer(); try { // Read the script line by line BufferedReader reader = new BufferedReader(new FileReader(scriptPath)); while ((line = reader.readLine()) != null) { content.append(line).append('\n'); } content.append("exit").append('\n'); reader.close(); } catch (IOException e) { Log.d(UpdateService.LOG_NAME, "Impossible to read script : " + e.getMessage()); } return content.toString(); } public StringBuffer runScript(String scriptPath) { String line = null; StringBuffer output = new StringBuffer(); try { // Start the shell process ProcessBuilder pb = new ProcessBuilder("su"); pb.redirectErrorStream(true); pb.directory(new File(context.getApplicationInfo().dataDir)); pb.environment().put("LD_LIBRARY_PATH", "/system/lib"); Process process = pb.start(); // Execute the script OutputStreamWriter os = new OutputStreamWriter(process.getOutputStream()); os.write(readScript(scriptPath)); os.flush(); os.close(); // Get the output of the commands BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((line = in.readLine()) != null) { output.append(line).append('\n'); } in.close(); } catch (Exception e) { Log.d(UpdateService.LOG_NAME, "Error while executing " + scriptPath + " : " + e.getMessage()); } return output; } I simply call it like : Shell = new Shell(); StringBuffer output = shell.runScript("script.sh"); The script I try to run : export LD_LIBRARY_PATH=/system/lib printenv am start -W -n com.android.settings/.Settings\$InputMethodAndLanguageSettingsActivity Gives me the output : _=/system/bin/printenv ANDROID_BOOTLOGO=1 ANDROID_PROPERTY_WORKSPACE=9…
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/11758267
downvote count: 0
score: 4
favorite count: 0
tagged with: processbuilder
tagged with: android
has title: How can I run "export" command inside a java Process on Android?
tagged with: shell
has comment: http://stackoverflow.com/comment/41635822
has comment: http://stackoverflow.com/comment/41722964
has comment: http://stackoverflow.com/comment/41717727
has comment: http://stackoverflow.com/comment/41717808
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/41418191
comment on: http://stackoverflow.com/q/26381643
has text: There is not create vars,this is specific to Jmeter,where I can store a variable like vars.put("key",value).And then I can access it like "${key}" in any Jmeter script.The issue is where I want to put a object type such as ArrayList which cannot be done,and anyone can suggest alternatives to this
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26408615
type: Answer
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/26404343
upvote count: 0
has body: String version = project.getProperties().getProperty("getdownload-webapp.version"); Where project is of type MavenProject

http://stackoverflow.com/comment/41403949
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26373376
has text: Sounds like a Windows bug. In any case, both your JDK and STS are extremely out of date; I suggest upgrading both as a first step.

http://stackoverflow.com/comment/41508596
has text: @CalebBrinkman No, he wants to count the elements, not only access them
type: QuestionComment
comment on: http://stackoverflow.com/q/26431909
type: Comment
score: 1

http://stackoverflow.com/q/26408143
tagged with: return
linked to: http://stackoverflow.com/q/7961788
downvote count: 2
has comment: http://stackoverflow.com/comment/41465164
tagged with: parameters
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26408292
tagged with: methods
has answer: http://stackoverflow.com/a/26409502
type: Question
answer count: 2
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26408292
possible better answer: http://stackoverflow.com/a/26409502
has title: Sending multiple parameters to a method, and returning a value, Java
has body: I am new to programming. I came across this question: "Write a program which will fill three arrays a,b and c, all lengths is 8,with pseudo random integers between 2 and 10,including 2 but not including 10, and set the array elements of a fourth array, d, of length 8,to the sum of corresponding elements of a,b, and c, and output all four arrays as indicated below.get the three arrays (a,b,and c) generated in the main and pass to an non-main method to add the corresponding elements to determine the sum array(d) and return the sum array (d) to the main.with all four arrays outputting from the main." So far I have no problem creating the arrays a,b and c with random elements. But I do not know how to create d outside the main (how to send multiple parameters, how to return values to main). Please help! I tried something like this: What's wrong with this?: public static void main(String args[]){ //generated arrays a, b, c d[] = assemble (a, b, c); } public assemble (int a, int b, int c){ int d = a + b + c; return; } }
favorite count: 0

http://stackoverflow.com/comment/41681904
type: QuestionComment
has text: In the linked question the loop will terminate if the user enters "bye". It will then move onto the next connection. It's not broadcasting, it's connecting to each host, running an interactive session, closing the channel when the user enters "byte" and moving onto the next host. Sorry I can't answer your question directly as I don't know the answer. I think shutting down the worker group at the end of connect is wrong because, if you do break out of the loop and try to connect to the next host, you'll have destroyed the threads Netty was using.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26504972

http://stackoverflow.com/q/26434005
tagged with: java
has comment: http://stackoverflow.com/comment/41517624
type: Question
has comment: http://stackoverflow.com/comment/41530526
has title: Spring task scheduler runs a single task multiple times
has comment: http://stackoverflow.com/comment/41528750
score: 0
has answer: http://stackoverflow.com/a/26541379
accepted answer: http://stackoverflow.com/a/26541379
has comment: http://stackoverflow.com/comment/41519642
answer count: 1
has body: I have a scheduler that runs every minute using Spring's task namespace. As per the documentation it should run once using one of the threads in the cached pool with a delay of 1 minute. But it runs another time after a random amount of time, say 5 seconds on a different thread than the one it ran previously. Not to mention, after 1 minute it will run the one which is supposed to run. But the 5 seconds one is not supposed to run. I've seen similar questions in SO but there was no reported solution. In my case it works fine in my local environment and this issue only happens on Development Environment. Is there anything wrong with this Spring feature? &lt;task:annotation-driven scheduler="myScheduler" /&gt; &lt;task:scheduler id="myScheduler" pool-size="10"/&gt; &lt;task:scheduled-tasks scheduler="myScheduler"&gt; &lt;task:scheduled ref="mySchedulerBean" method="doSomething" fixed-delay="60000" /&gt; &lt;/task:scheduled-tasks&gt; &lt;bean id="mySchedulerBean" class="com.mycompany.app.tasks.SchedulerBean"/&gt;
has comment: http://stackoverflow.com/comment/41531537
tagged with: scheduled-tasks
tagged with: multithreading
tagged with: spring
has comment: http://stackoverflow.com/comment/41513360
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/41615369
type: QuestionComment
comment on: http://stackoverflow.com/q/26490567
has text: ok, now i understood.
score: 0
type: Comment

http://stackoverflow.com/comment/41401043
score: 0
has text: Now I am getting an error "syntax error complete the while statement..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26370088

http://stackoverflow.com/comment/41406651
type: QuestionComment
has text: javac: not a directory: /path/filename.java Usage: javac <options> use -help for a list of possible options
comment on: http://stackoverflow.com/q/26375108
score: 0
type: Comment

http://stackoverflow.com/a/26478843
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26478743
score: 4
has body: Try This: public static void main(String[] args) { int s = 0; int t = 1; int i=0; //first for-loop i'm trying to make a while-loop while(i&lt;5) { s = s + i; int j=i; //second for-loop i'm trying to make a while-loop while(j&gt;0) { t = t + (j-1); j--; } s = s + t; System.out.println("T is " + t); i++; } System.out.println("S is " + s); }

netbeans
tags question: http://stackoverflow.com/q/26453514
tags question: http://stackoverflow.com/q/26510122
tags question: http://stackoverflow.com/q/26400433
tags question: http://stackoverflow.com/q/26365794
tags question: http://stackoverflow.com/q/26409143
tags question: http://stackoverflow.com/q/26405667
tags question: http://stackoverflow.com/q/26437834
tags question: http://stackoverflow.com/q/26490079
tags question: http://stackoverflow.com/q/26447519
type: Tag
tags question: http://stackoverflow.com/q/26391282
tags question: http://stackoverflow.com/q/26405333
tags question: http://stackoverflow.com/q/26480766
tags question: http://stackoverflow.com/q/26414203
tags question: http://stackoverflow.com/q/26414879
tags question: http://stackoverflow.com/q/26479072
tags question: http://stackoverflow.com/q/26403719
tags question: http://stackoverflow.com/q/26428487
tags question: http://stackoverflow.com/q/26438248
tags question: http://stackoverflow.com/q/26442382
tags question: http://stackoverflow.com/q/26473479
tags question: http://stackoverflow.com/q/26427068
tags question: http://stackoverflow.com/q/26383897
tags question: http://stackoverflow.com/q/26499897
tags question: http://stackoverflow.com/q/26500619
tags question: http://stackoverflow.com/q/26355624
tags question: http://stackoverflow.com/q/26376992
tags question: http://stackoverflow.com/q/26490156
tag name: netbeans
tags question: http://stackoverflow.com/q/26400923
tags question: http://stackoverflow.com/q/26444175

http://stackoverflow.com/a/26368089
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41393469
answers question: http://stackoverflow.com/q/26367976
has comment: http://stackoverflow.com/comment/41394072
type: Answer
has body: You don't have to access ServletRequest at Dao layer. In Servlet you can get ServletRequest object and you can pass the value to Dao layer. If you really want to access then pass ServletRequest object to Dao layer by reference. Security API com.packagename.MyServlet public MyServlet extends com.sun.jersey.spi.container.servlet.ServletContainer{} You can extend jersey servlet and you can initialize Servlet with Application Class by programatically. In MyServlet you can reach the request object. Servlet Information : https://jersey.java.net/apidocs/1.17/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html
downvote count: 0
has comment: http://stackoverflow.com/comment/41393945
score: 1
has comment: http://stackoverflow.com/comment/41393977
has comment: http://stackoverflow.com/comment/41393404
accepted answer of: http://stackoverflow.com/q/26367976
has comment: http://stackoverflow.com/comment/41393658
upvote count: 1

http://stackoverflow.com/a/26445290
has body: You want to sort the current collection - so just pass this to Collections.sort: public class SortedVector extends Vector { public void addElement(Object o){ super.add(o); Collections.sort(this); // Note the usage of this } }
score: 1
accepted answer of: http://stackoverflow.com/q/26445264
upvote count: 1
answers question: http://stackoverflow.com/q/26445264
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/26411710
has body: I have recieved the below error while trying to run my application: FATAL EXCEPTION, and OutOfMemoryError error, and have included the log cat message below: 10-16 11:40:09.819: E/AndroidRuntime(668): FATAL EXCEPTION: Task.BACKGROUND_EXECUTOR-thread-13 10-16 11:40:09.819: E/AndroidRuntime(668): java.lang.OutOfMemoryError 10-16 11:40:09.819: E/AndroidRuntime(668): at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:91) 10-16 11:40:09.819: E/AndroidRuntime(668): at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseIOUtils.copyLarge(ParseIOUtils.java:130) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseIOUtils.copyLarge(ParseIOUtils.java:106) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseIOUtils.copy(ParseIOUtils.java:81) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseIOUtils.toByteArray(ParseIOUtils.java:55) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseFileUtils.readFileToByteArray(ParseFileUtils.java:47) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseFile.getCachedData(ParseFile.java:188) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseFile.access$500(ParseFile.java:24) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseFile$6.then(ParseFile.java:507) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.ParseFile$6.then(ParseFile.java:504) 10-16 11:40:09.819: E/AndroidRuntime(668): at com.parse.Task$10.run(Task.java:448) 10-16 11:40:09.819: E/AndroidRuntime(668): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 10-16 11:40:09.819: E/AndroidRuntime(668): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 10-16 11:40:09.819: E/AndroidRuntime(668): at java.lang.Thread.run(Thread.java:856) This occured when the below activity opened: public class matchOptionActivity1 extends Activity{ protected TextView mUserRetrieved…
tagged with: java
type: Question
tagged with: android-layout
score: 0
has title: FATAL EXCEPTION - OutOfMemoryError
has comment: http://stackoverflow.com/comment/41471480
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/41471632
has answer: http://stackoverflow.com/a/26412882
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/41478589
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41471375
tagged with: android

http://stackoverflow.com/q/26411791
has comment: http://stackoverflow.com/comment/41473755
tagged with: input
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26411979
tagged with: output
has answer: http://stackoverflow.com/a/26413150
has comment: http://stackoverflow.com/comment/41471578
type: Question
accepted answer: http://stackoverflow.com/a/26411979
tagged with: java
linked to: http://stackoverflow.com/q/1464291
score: 0
has comment: http://stackoverflow.com/comment/41471624
has title: Reading in txt file
has body: I've been looking for hours, looking through previous questions on all kind of forums, but i still didn't get it to work. I have a tetris sort of game (it used pentominoes instead of tetrominoes). I want to save a highscore list. I have a text file in the same folder as my jar file (my exported project from eclipse), and i want to be able to read a few lines (Strings and integers) from this file, and i want to override the data in the file at the end of the program. I'm having huge problems with the paths to the file and making it work in diffrent directories... I would appreciate any help! thanks in advance
possible better answer: http://stackoverflow.com/a/26412049
linked to: http://stackoverflow.com/q/6561172
answer count: 3
has answer: http://stackoverflow.com/a/26412049

http://stackoverflow.com/comment/41576309
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26466215
has text: This seems to answer Q1: "The Firebase Java SDK supports both Android and plain Java, however the Firebase Simple Login library currently only supports Android" See: http://stackoverflow.com/questions/25195190/get-firebase-to-work-with-java-not-android
score: 0

http://stackoverflow.com/a/26471106
answers question: http://stackoverflow.com/q/26470914
type: Answer
score: 0
has body: Something like: public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\.\\d+)?"); //match a number with optional '-' and decimal. } or: public static boolean isNumeric(String str) { try { double d = Double.parseDouble(str); } catch(NumberFormatException nfe) { return false; } return true; } Check out: How to check if a String is numeric in Java

http://stackoverflow.com/q/26396752
has body: Currently I am importing an image into an ImageView and displaying it at full device width and wrapContent for height. When I tap the image, I am using a ScaleAnimation to zoom in on it, and it all works great. The problem is that I'm scaling the cached bitmap that was scaled down to fit the device width. For example a 1080p image when added onto my 720p device is definitely getting down-ressed (layout_width=match_parent) since when I click to zoom in, the device is zooming into the cached 720p bitmap version of my 1080p image. I'm purposely downloading a higher-resolution image so that it'll hold up to zooming, but I don't know how to force it to use the original image instead of the cached version. Here's where I'm handling the zoom: private void zoomIn(View v, int time){ // initialize animations Animation scaleAnimation; imageCenter = new Point(imageView.getWidth() / 2, imageView.getHeight() / 2); // build animations scaleAnimation = new ScaleAnimation(scaleMin,scaleMax,scaleMin,scaleMax, imageCenter.x, imageCenter.y); scaleAnimation.setRepeatCount(0); // build animation set AnimationSet s = new AnimationSet(true); s.addAnimation(scaleAnimation); s.setDuration(time); s.setFillAfter(true); s.setInterpolator(interpolator); v.startAnimation(s); } I am considering using a ObjectAnimator instead, but it seems a bit unecessary. Surely there's a way to just tell it to redraw using the full-resolution image when I animate? Thanks in advance!
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41445927
has answer: http://stackoverflow.com/a/26548685
accepted answer: http://stackoverflow.com/a/26548685
has title: How can I animate the full-resolution image in an ImageView when using a ViewAnimator like ScaleAnimation?
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41445782
tagged with: java
type: Question
tagged with: imageview

http://stackoverflow.com/comment/41378358
type: AnswerComment
score: 0
type: Comment
has text: Not out of date. But the Java 8 spec refers specifically to this very situation.
comment on: http://stackoverflow.com/a/26360085

http://stackoverflow.com/comment/41489264
type: QuestionComment
has text: @gstackoverflow you have forgot to add servlet mapping for your css files default *.css This will work i guess cause i also had same issues
comment on: http://stackoverflow.com/q/26421390
score: 0
type: Comment

http://stackoverflow.com/comment/41439493
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26383821
type: Comment
has text: Please see my update. Sorry for the extension and I hope it be helpful. @Gioce90

http://stackoverflow.com/comment/41567267
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/26464614
has text: use `a.equals("no")` and `a.equals("yes")`

http://stackoverflow.com/q/26431570
score: -1
has answer: http://stackoverflow.com/a/26431724
has body: i am reading from a csv file that reads a country name and takes a subscription data for a particular country at a certain year. Below is a csv sample file: CountryName,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 Aruba,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.029310471,0,0,2.138784453,3.605985937,3.98141538,6.16435217,13.48254011,16.50927821,57.05427692,65.05605558,72.10431377,99.64250268,103.3849507,108.1325002,112.2180618,119.2038996,126.2103374,129.72824,0,131.8565401 Andorra,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1.307211734,1.278625641,1.250259142,4.424155104,8.538444783,13.44671556,22.12730607,32.14530928,35.99902139,43.27794118,45.77115817,68.60251444,73.82494308,79.48487497,84.27763597,78.1171579,80.2836099,82.06181111,84.06818386,83.53432222,81.50204186 Afghanistan,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.112598381,0.865196277,2.498055472,4.826865367,9.833164022,17.71624331,29.22037376,37.89493697,45.77817474,60.32631999,60.35299258 I am able to read the file fine. I created 2 classes. 1 class called class subscriptionYear that reads the year that i called int year, and variable double subscription that reads each stats data. 2nd class called Class Country. It reads the country called String countryNames and a 1d array called SubscriptionYear[] subscriptions which holds all the subscription data for that country. I have 2 methods in class country called addSubscriptionYear(int year, double countryData) which reads the data I am to follow the guideline of the test class called class TestCountry. My program reads the file but outputting the wrong sum. Basically it reads only 2012 and not the entire period between 1960 and 2012. so when i do the sum …
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41508190
favorite count: 0
accepted answer: http://stackoverflow.com/a/26431724
type: AnsweredQuestion
tagged with: java
has title: trouble reading variables in an array of reference java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41508542

http://stackoverflow.com/q/26409737
has title: Java SQL database class representation
score: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41468933
upvote count: 1
tagged with: many-to-many
tagged with: java
has answer: http://stackoverflow.com/a/26411081
type: Question
downvote count: 0
answer count: 1
tagged with: persistence
favorite count: 0
has body: Tables: Car Long :: Car_id String :: Type Owner Long :: Owner_id String :: name int :: age Car_Owner Long :: Car_Id Long :: Owner_Id Date :: Bought_Date Question: So i understand the best way to transfer data between java and a SQL DB is by using the java persistence API. Each table is represented as a java class with the @Entity annotation. But how is the mid-table "Car_Owner" represented as a java class?
linked to: http://stackoverflow.com/q/5127129
tagged with: sql

http://stackoverflow.com/comment/41646448
type: Comment
has text: Right. You must then create new SortedSet and iterate over it. I edited my answer.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26507408

http://stackoverflow.com/comment/41506682
comment on: http://stackoverflow.com/q/26430955
has text: did you update the manifest file to show your using a custom application ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41500558
type: Comment
has text: and my last questions is 1) why for others use call by ref? 2)in pass by value result value of x changed after the thread is completed? thanks from your time. thanks. thanks again.
comment on: http://stackoverflow.com/a/26427203
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41435718
type: Comment
comment on: http://stackoverflow.com/a/26390798
type: AnswerComment
has text: @RealSkeptic you can do it by wrapping text with ` character: `System.out.println("this is an example");`
score: 0

http://stackoverflow.com/a/26490562
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41614949
answers question: http://stackoverflow.com/q/26490315
has comment: http://stackoverflow.com/comment/85549925
downvote count: 0
has comment: http://stackoverflow.com/comment/41615041
has body: I think you may have the following snippet useful. It will allow you to set the log behaviour at package level: Logger logger = Logger.getLogger("org.apache.axiom"); logger.setLevel(Level.WARN);
type: Answer

http://stackoverflow.com/a/26434582
type: Answer
score: 0
has body: The first in.nextInt(); did not consume the carriage return. Do like this : amount = in.nextInt(); in.nextLine(); if (amount &lt; 0 ) { System.out.println("sorry you cant do that please only input positive amounts"); } else { System.out.println(amount); } System.out.println("which account will you be useing checking or savings? : " ); String account = in.next();
answers question: http://stackoverflow.com/q/26434526

http://stackoverflow.com/q/26459978
possible better answer: http://stackoverflow.com/a/26460023
score: 0
answer count: 2
favorite count: 0
tagged with: return
has answer: http://stackoverflow.com/a/26460011
has body: i have a question. i have to create 3 methods testUreaRisk, testProteinRisk and printResults. and the below is 2 out of the 3. public class Lab { public static String testUreaRisk(double ureaLevel) { if ((ureaLevel &lt; 0) || (ureaLevel &gt; 10)) return "0"; else if (ureaLevel &lt;= 4.0) return "-1"; else return "1"; } public static String testProteinRisk(double proLevel) { if ((proLevel &lt; 0) || (proLevel &gt;150)) return "0"; else if (proLevel &gt;= 67.0) return "1"; else return "-1"; } so my problem is can i put a value into the return number 1, 0,-1 as -1 = low risk, 0 = cannot be defined and 1 = high risk? if can,how? because the 3rd method could only allow me to return a string that show the result (low risk,cannot be defined and high risk) instead of the number(-1,0,1).thanks
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41559505
tagged with: java
upvote count: 1
tagged with: methods
has answer: http://stackoverflow.com/a/26460023
accepted answer: http://stackoverflow.com/a/26460011
downvote count: 1
type: Question
has title: new in java method and return

modulo
tags question: http://stackoverflow.com/q/26366046
tags question: http://stackoverflow.com/q/26434543
tag name: modulo
tags question: http://stackoverflow.com/q/26457192
tags question: http://stackoverflow.com/q/26396942
type: Tag

http://stackoverflow.com/q/26466512
answer count: 1
has body: We have a case where in our spring integration splitter logic where it could return an empty ArrayList thus providing no data to be routed. How should we handle this scenario and reroute it to a different channel when there is an empty ArrayList returned from the splitter. UPDATE : As shown by Artem I have created a custom advice and have got the rerouting to be done successfully however there are still two issues, where the second one describe is the blocker issue listed The current class that I have is as follows public class EmptyListRequestHandlerAdvice extends AbstractRequestHandlerAdvice { private final MessagingTemplate messagingTemplate = new MessagingTemplate(); public EmptyListRequestHandlerAdvice(MessageChannel emptyListChannel) { this.messagingTemplate.setDefaultChannel(emptyListChannel); } @Override protected Object doInvoke(ExecutionCallback callback, Object target, Message&lt;?&gt; message) throws Exception { Object result = callback.execute(); if (result==null) { this.messagingTemplate.convertAndSend(new ArrayList&lt;InventoryHotel&gt;()); } return result; } Whenever the splitter returns a new empty array list the result of "callback.execute() is null. However whenever the returned array list from the splitter is not empty the returned result is of type org.springframework.integration.util.FunctionIterator and not a collection type. Any idea on if it is possible to get a collection returned in both cases instead of null or function iterator? Atleast avoid getting a function iterator and get an array list. Additionally when a valid channel name is set to the constructor and a message is sent through that channel to the transformer method the transformer method is successfully executed however when it returned a value the following error occurs org.springframework.messaging.MessagingException: org.springframework.messaging.core.DestinationResolutionException: no output-channel or replyChannel header available at org.springframework.integration.dispatch…
tagged with: spring-integration
tagged with: java
has title: Splitter returning empty array list spring integration
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26466807
favorite count: 0
tagged with: arraylist
type: Question
tagged with: spring
score: 4
accepted answer: http://stackoverflow.com/a/26466807
tagged with: enterprise-integration

http://stackoverflow.com/comment/47710597
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26503694
has text: @MichelJung What exactly did you mean?
score: 0

http://stackoverflow.com/q/26479380
has answer: http://stackoverflow.com/a/26479552
upvote count: 2
tagged with: java
type: Question
has body: I want to print a string in java to printer . After searching to the internet , I have found many tutorials . For this question , I have the following code found from the answer of this question : public class PrintText { public static void main(String[] args) throws PrintException, IOException { String defaultPrinter = PrintServiceLookup.lookupDefaultPrintService().getName(); System.out.println("Default printer: " + defaultPrinter); PrintService service = PrintServiceLookup.lookupDefaultPrintService(); // prints the famous hello world! plus a form feed InputStream is = new ByteArrayInputStream("hello world!\f".getBytes("UTF8")); PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); pras.add(new Copies(1)); DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE; Doc doc = new SimpleDoc(is, flavor, null); DocPrintJob job = service.createPrintJob(); PrintJobWatcher pjw = new PrintJobWatcher(job); job.print(doc, pras); pjw.waitForDone(); is.close(); } } class PrintJobWatcher { boolean done = false; PrintJobWatcher(DocPrintJob job) { job.addPrintJobListener(new PrintJobAdapter() { public void printJobCanceled(PrintJobEvent pje) { allDone(); } public void printJobCompleted(PrintJobEvent pje) { allDone(); } public void printJobFailed(PrintJobEvent pje) { allDone(); } public void printJobNoMoreEvents(PrintJobEvent pje) { allDone(); } void allDone() { synchronized (PrintJobWatcher.this) { done = true; System.out.println("Printing done ..."); PrintJobWatcher.this.notify(); } } }); } public synchronized void waitForDone() { try { while (!done) { wait(); } } catch (InterruptedException e) { } } } After running this cdoe , I have the following output . Default printer: EPSON TM-T81 Receipt Printing done ... But the printer is not printing anything . Power of printing is ok . I cant detect the problem . I just want to print a string to printer . What is the solution ?
has title: Printing text from a java program to Printer
tagged with: printing
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41595168
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/7198855
has comment: http://stackoverflow.com/comment/41595489
score: 2

tripledes
tags question: http://stackoverflow.com/q/26417778
type: Tag
tag name: tripledes

http://stackoverflow.com/comment/41606787
type: QuestionComment
comment on: http://stackoverflow.com/q/26483734
has text: in the end statement is executing by a string, make a separate method for executing query, and set a flag for valid line
score: 0
type: Comment

http://stackoverflow.com/a/26451149
has comment: http://stackoverflow.com/comment/41543806
score: -1
has comment: http://stackoverflow.com/comment/41543794
has comment: http://stackoverflow.com/comment/41543896
has body: In your main activity simply override onKeyDown. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getKeyCode() == KeyEvent.KEYCODE_BACK) finish(); }
downvote count: 1
has comment: http://stackoverflow.com/comment/41543963
type: Answer
answers question: http://stackoverflow.com/q/26451027
has comment: http://stackoverflow.com/comment/41543596
upvote count: 0

http://stackoverflow.com/q/26468562
upvote count: 1
favorite count: 0
has title: Getting ClassNotFoundException: org.apache.juli.ClassLoaderLogManager/1catalina.org.apache.juli.FileHandler while connecting to ORACLE DB
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
downvote count: 0
score: 1
type: Question
tagged with: java
has body: When I use Eclipse java version:1.7.0_07 on Windows, my code works fine. When I use HP Unix java version:1.7.0.06 I get the below exceptions. In both cases I use ojdbc6.jar. Even though I got this exception, I am able to connect and perform DB operations successfully. What is wrong, and how do I fix it? The stack trace: Could not load Logmanager "org.apache.juli.ClassLoaderLogManager" java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.util.logging.LogManager$1.run(LogManager.java:186) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.&lt;clinit&gt;(LogManager.java:176) at java.util.logging.Logger.demandLogger(Logger.java:307) at java.util.logging.Logger.getLogger(Logger.java:361) at com.sun.jmx.remote.util.ClassLogger.&lt;init&gt;(ClassLogger.java:55) at javax.management.NotificationBroadcasterSupport.&lt;clinit&gt;(NotificationBroadcasterSupport.java:352) at javax.management.MBeanServerDelegate.&lt;init&gt;(MBeanServerDelegate.java:72) at com.sun.jmx.mbeanserver.MBeanServerDelegateImpl.&lt;init&gt;(MBeanServerDelegateImpl.java:100) at com.sun.jmx.mbeanserver.JmxMBeanServer.newMBeanServerDelegate(JmxMBeanServer.java:1359) at javax.management.MBeanServerBuilder.newMBeanServerDelegate(MBeanServerBuilder.java:66) at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:319) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:230) at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:191) at java.lang.management…

http://stackoverflow.com/q/26492301
answer count: 4
type: AnsweredQuestion
has body: There is an error launching activity, unfortunately I assume it is not connected strictly with the project due to the fact the app launches on genymotion emulator, but does not on physical device. When I run adb devices with the real one connected i get: List of devices attached 0009215b1eef4f device AndroidManifest.xml has not any permissions required set and device has sufficient api version. Regards
has answer: http://stackoverflow.com/a/78934635
has answer: http://stackoverflow.com/a/29782710
tagged with: java
has title: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
has comment: http://stackoverflow.com/comment/121895611
upvote count: 8
type: Question
accepted answer: http://stackoverflow.com/a/26492415
downvote count: 0
tagged with: security
possible better answer: http://stackoverflow.com/a/29782710
has answer: http://stackoverflow.com/a/26492415
has answer: http://stackoverflow.com/a/74917067
favorite count: 0
score: 8
tagged with: linux
tagged with: android
tagged with: adb

http://stackoverflow.com/comment/41574859
has text: That's not solve my problem but it's an interesting answer +1.
score: 0
comment on: http://stackoverflow.com/a/26468147
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26447726
accepted answer of: http://stackoverflow.com/q/26447668
has body: Well, to answer, public class Mapping { enum Type { type1, type2; } Map&lt;String, Type&gt; map = new HashMap&lt;&gt;(); public void Map(String str, Type someType){ map.put(str, someType); } public static void main(String args[]) { Mapping mapping = new Mapping(); mapping.Map("johnny", Type.type1); System.out.println(mapping.map); } } but notice that you don't need a function as it is a one-liner anyway
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26447668
type: Answer
score: 0

http://stackoverflow.com/comment/134186672
type: AnswerComment
comment on: http://stackoverflow.com/a/26410916
score: 0
type: Comment
has text: This is actually a good answer. Just move `arguments` into `onCreateView` and do not use `requireArguments()` in kotlin for this, as it throws a `IllegalStateException` due to no arguments present.

http://stackoverflow.com/comment/41429079
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26387104
has text: @fish748: And what happened?

http://stackoverflow.com/comment/41613033
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26480923
type: Comment
has text: If there are many pieces of mail all using this class and 'private final Object lock = new Object();', will they block each other or will each lock somehow be unique?

http://stackoverflow.com/q/26434543
linked to: http://stackoverflow.com/q/3389264
tagged with: modulus
tagged with: java
has body: I'm hoping to find a way to use a while loop (not a for loop) to get the individual digits of an integer put in through command line. Right now, I have it hard coded for how to get individual digits if a four digit integer is entered, but if I enter a five digit number it obviously won't work. I'm thinking a while loop should be able to fix that but I'm not sure how... Here is the code I have so far
type: Question
answer count: 2
tagged with: modulo
has title: How do I use modulus in a while loop to get individual digits of an integer?
tagged with: integer-division
has answer: http://stackoverflow.com/a/26435270
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/26434577
has comment: http://stackoverflow.com/comment/41513819
has comment: http://stackoverflow.com/comment/41513787
type: UnansweredQuestion

http://stackoverflow.com/comment/41432953
type: QuestionComment
comment on: http://stackoverflow.com/q/26389413
score: 0
has text: Not a single correct answer below. Short Answer: By default, using multiple AsyncTasks will not make your app run faster. That is because AsyncTasks are executed serially. You will need to change the default behavior using `executeOnExecutor` to see a benefit... and then yes, if you're pulling data from REST services, executing parallel requests will result in faster retrieval overall.
type: Comment

http://stackoverflow.com/q/26507231
tagged with: dll
tagged with: java
has comment: http://stackoverflow.com/comment/41645749
has answer: http://stackoverflow.com/a/26508018
answer count: 1
has body: I am having a problem loading a c++ dll in Java. When I use the Java code below (loadLibrary), I get this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: TestJNI.Add(II)V How can I solve this problem? public class TestJNI { public native void Add(int a,int b); static { System.loadLibrary("dllclass"); } public static void main(String args[]) { new TestJNI().Add(1,2); } } I do not have source code in c except header file, it use this code int APIENTRY(dllexport) add(int a, int b); if you have any suggestion in C or changing in java or sample code, please introduce.
has title: calling a c++ dll in java with loadLibrary()
score: 0
tagged with: c++
has comment: http://stackoverflow.com/comment/41645565
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41646274
has comment: http://stackoverflow.com/comment/41645229
has comment: http://stackoverflow.com/comment/41645955
type: Question

communication
tag name: communication
tags question: http://stackoverflow.com/q/26427144
type: Tag

http://stackoverflow.com/comment/41574324
score: 0
has text: I am trying to fix code I'm not sure as to why the code is not compiling I'm working on trying to fix it and I'll post it as soon as I find the issue.
comment on: http://stackoverflow.com/q/26467948
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41401098
type: QuestionComment
comment on: http://stackoverflow.com/q/26372114
score: 1
has text: Missing a lot of code here. Please show where counter2 is defined etc...
type: Comment

http://stackoverflow.com/a/26412105
answers question: http://stackoverflow.com/q/26412052
has body: You could change this for (int i = 0; i &lt;= 4; i++) { num = reader.nextInt(); List.add(num); } to use Scanner.hasNextInt() with something like while (reader.hasNextInt()) { num = reader.nextInt(); List.add(num); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41472414
downvote count: 0
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/41478077
accepted answer of: http://stackoverflow.com/q/26412052

http://stackoverflow.com/comment/41645458
comment on: http://stackoverflow.com/q/26490986
score: 0
has text: @Dave Newton: what's wrong with selectedAccount? It has always worked fine (which is what I expected). Perhaps the reason the equals test returns true in java but the "true" doesn't get through to the jsp page is because it the first thing is evaluated in some sort of "jsp context" and the other in "a java context"?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26366866
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26367022
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41391125
tagged with: android
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/26367022
has body: I'm using a SQLite database to store some data. When retrieving I get an exception. I have no clue what i'm doing wrong. That's why i'm asking this question. Database code: //Creating the database @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE "+garbageTable+" (" +colID+ " INTEGER PRIMARY KEY AUTOINCREMENT , " +colName+ " TEXT, "+colInterval+ " INTEGER, " +colDate+ " INTEGER, " +colImage+ " INTEGER)"); } //Insert some data public void insertGarbageObject(GarbageObject g){ SQLiteDatabase db=this.getWritableDatabase(); ContentValues cv=new ContentValues(); cv.put(colName, g.name); cv.put(colInterval, g.dayInterval); cv.put(colDate, g.date.getTimeInMillis()); cv.put(colImage, g.image); db.insert(garbageTable, colID, cv); db.close(); } //Read all inserted data public ArrayList&lt;GarbageObject&gt; getGarbageObjects(){ ArrayList&lt;GarbageObject&gt; garbageObjects = new ArrayList&lt;GarbageObject&gt;(); SQLiteDatabase db=this.getReadableDatabase(); Cursor cur=db.rawQuery("SELECT * FROM "+garbageTable,new String [] {}); for(int i = 0; i&lt;cur.getCount(); i++){ GarbageObject g = new GarbageObject(c.getString(R.string.naam)); g.ID = cur.getInt(cur.getColumnIndexOrThrow(colID));//Exception occurs! g.name = cur.getString(cur.getColumnIndexOrThrow(colName));//Exception occurs! g.dayInterval = cur.getInt(cur.getColumnIndexOrThrow(colInterval));//Exception occurs! g.date.setTimeInMillis(cur.getLong(cur.getColumnIndexOrThrow(colDate)));//Exception occurs! g.image = cur.getInt(cur.getColumnIndexOrThrow(colImage));//Exception occurs! garbageObjects.add(g); } cur.close(); db.close(); return garbageObjects; } My logcat: 10-14 17:35:58.356: W/dalvikvm(18570): threadid=1: thread exiting with uncaught exception (group=0x40f27680) 10-14 17:35:58.356: E/AndroidRuntime(18570): FATAL EXCEPTION: main 10-14 17:35:58.356: E/AndroidRuntime(18570): java.lang.RuntimeException: Unable to start activity ComponentInfo{robin.garbagereminder/robin.activities.MainActivity…
type: AnsweredQuestion
has title: Android SQLite Exception

sungridengine
tags question: http://stackoverflow.com/q/26493969
tag name: sungridengine
type: Tag

http://stackoverflow.com/q/26422665
possible better answer: http://stackoverflow.com/a/26422975
answer count: 6
has title: Is it possible to serialize anonymous class without outer class?
tagged with: anonymous-class
has answer: http://stackoverflow.com/a/26685045
has answer: http://stackoverflow.com/a/26422975
downvote count: 0
has answer: http://stackoverflow.com/a/26422824
has answer: http://stackoverflow.com/a/26676958
has body: I made a small research on web and reviewed related topics on this site, but the answers were contradictory: some people said it is not possible, others said it is possible, but dangerous. The goal is to pass an object of the anonymous class as a parameter of the RMI method. Due to RMI requirements, this class must be serializable. Here's no problem, it is easy to make class Serializable. But we know that instances of inner classes hold a reference to an outer class (and anonymous classes are inner classes). Because of this, when we serialize instance of inner class, instance of outer class is serialized as well as a field. Here's the place where problems come: outer class is not serializable, and what's more important - I do not want to serialize it. What I want to do is just to send instance of the anonymous class. Easy example - this is an RMI service with a method that accepts Runnable: public interface RPCService { Object call(SerializableRunnable runnable); } And here is how I'd like to call the method void call() { myRpcService.call(new SerializableRunnable() { @Override public Object run { System.out.println("It worked!"); } } } As you can see, what I want to do is to send an "action" to the other side - system A describes the code, that should be run on system B. It is like sending a script in Java. I can easily see some dangerous consequences, if this was possible: for example if we access a field or captured final variable of outer class from Runnable - we'll get into a trouble, because caller instance is not present. On the other hand, if I use safe code in my Runnable (compiler can check it), then I don't see reasons to forbid this action. So if someone knows, how writeObject() and readObject() methods should be properly overriden in anonymous class OR how to make reference to outer class transient OR explain why it is impossible in java, it will be very helpful. UPD Yet another important thing to consider: outer class is not present in the environment …
favorite count: 0
upvote count: 9
tagged with: serialization
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26423594
accepted answer: http://stackoverflow.com/a/26423594
tagged with: rmi
tagged with: java
has comment: http://stackoverflow.com/comment/41491571
score: 9
type: Question
has answer: http://stackoverflow.com/a/65031368

http://stackoverflow.com/q/26440386
has body: Sorry in advance for my not-perfect english. I'm trying to capture the http/https traffic in real-time from a Java program. Thanks to Jnetpcap library, I managed to do it quite easily but, for the https traffic, I don't manage to get just the headers of the packets, even if I ask to capture all the tcp packets without port filter. I don't understand how sofwares like Fiddler manage to do it, e.g. to have the domain name like facebook.com or google.com. Is there a way to do it in Java ? Thanks!
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41524339
tagged with: https
type: Question
answer count: 1
downvote count: 0
has title: Capture https header from Java
favorite count: 0
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26440437

http://stackoverflow.com/q/26372340
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26372595
type: Question
has answer: http://stackoverflow.com/a/26374933
tagged with: jpa
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26374933
has title: Cannot update entity using Hibernate
has answer: http://stackoverflow.com/a/26372510
has body: I am using Hibernate with JPA annotated entities and the next code which I expect to update "raw_text" field of an entity doesn't change it. How to achieve the expected behavior? @Override public void updatePageWithText(String pageName, String rawText) { Session session = HibernateUtils.getInstance().openSession(); String hql = "FROM WikiPage M WHERE M.name = :name"; Query query = session.createQuery(hql); query.setParameter("name",pageName); WikiPage res = null; try { res = (WikiPage) query.list().get(0); res.setRawText(rawText); session.update(res); session.flush(); } catch (IndexOutOfBoundsException e) {} finally { session.close(); } }
tagged with: spring
has comment: http://stackoverflow.com/comment/41401656
possible better answer: http://stackoverflow.com/a/26372510
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41401562

http://stackoverflow.com/comment/41660267
type: Comment
type: QuestionComment
has text: I think, now i made my query clear
comment on: http://stackoverflow.com/q/26513593
score: 0

http://stackoverflow.com/comment/41554003
comment on: http://stackoverflow.com/q/26456700
score: 0
type: Comment
has text: Why are you mixing AWT (Canvas) with Swing (JFrame and everything else)?
type: QuestionComment

http://stackoverflow.com/a/26382509
answers question: http://stackoverflow.com/q/26382104
has body: You may use a SortedMap to store the frequency as Key and number as the Value. Then just iterate over the map in the order you want.
score: 0
type: Answer

http://stackoverflow.com/comment/41656670
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26513365
has text: Why don't you test it?

http://stackoverflow.com/a/26457237
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26456623
score: 1
accepted answer of: http://stackoverflow.com/q/26456623
has body: Because you are creating a custom view, you must implement three different constructors: View(Context context) View(Context context, AttributeSet attrs) View(Context context, AttributeSet attrs, int defStyleAttr) Then you simply delegate to super() for each of these. All of these constructors are necessary in order to inflate your view from an XML file. A simpler solution would be to use a regular ListView and create a subclass of View.OnTouchListener. Then you just call setOnTouchListener() on the ListView from within your onCreate() method (or in onCreateView() if you are using fragments).
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26502251
score: 0
answers question: http://stackoverflow.com/q/26501684
type: AcceptedAnswer
has body: There are multiple problems there. Firstly one of the genders should be pre-selected. You get an NullPointerException if none is. And for the ArrayIndexOutOfBoundsException I propose using a list: LinkedList&lt;String&gt; hobbies = new LinkedList&lt;String&gt;(); //... hobbies.clear(); if (cb_cricket.isSelected()) { hobbies.add("Cricket"); } if (cb_football.isSelected()) { hobbies.add("Football"); } if (cb_tennis.isSelected()) { hobbies.add("Tennis"); } if (hobbies.size() == 0) { b = " nothing"; } else { for (int j = 0; j &lt; hobbies.size(); j++) { if( j &gt; 0) { if(j == hobbies.size()-1) { b += " and "; } else { b += ", "; } } b+= hobbies.get(j); } if (hobbies.size() == 1) { b += " only"; } b += "."; } Using a LinkedList you get a better scaleable result. Bonus Points for replacing b with a StringBuilder.
type: Answer
has comment: http://stackoverflow.com/comment/41637334
accepted answer of: http://stackoverflow.com/q/26501684
has comment: http://stackoverflow.com/comment/41638584

http://stackoverflow.com/q/26512753
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: depth-first-search
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41655803
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/26512862
has title: Non-recursive DFS in Java with Iterators
has body: I want to DFS a graph (non-recursive) using ArrayList and an adjacency list. I have the following adjacency list 2 3 4 1 3 4 1 2 4 1 2 3 So node 1 -> 2,3,4 node 2 -> 1,3,4 ... I already have the adjacency list implemented in arrays like this: (L are the lines, and l is the elements on the line) ArrayList&lt;List&lt;Integer&gt;&gt;L=new ArrayList&lt;List&lt;Integer&gt;&gt;(); ArrayList&lt;Integer&gt;l=new ArrayList&lt;Integer&gt;(); I've written on paper the following algorithm to print the DFS of a graph using 2 Stacks. The first node can be any node possible. //all viz[i] = 0; stack.push(root); while (!stack.isEmpty()) { node = stack.pop(); print node; viz[node]=1; for (each node.childnodes) { if(viz[i]==0) {stack.push(childnode)} } } I don't understand how to implement the Iterators so I could use the arraylists with my algorithm. I'm really grateful for any help!
tagged with: iterator
has comment: http://stackoverflow.com/comment/41655575
upvote count: 1

tcp
type: Tag
tags question: http://stackoverflow.com/q/26464074
tags question: http://stackoverflow.com/q/26442284
tags question: http://stackoverflow.com/q/26452212
tags question: http://stackoverflow.com/q/26445243
tags question: http://stackoverflow.com/q/26498365
tag name: tcp
tags question: http://stackoverflow.com/q/26454348

http://stackoverflow.com/a/31054806
answers question: http://stackoverflow.com/q/26407397
has body: You might want to change the receiveTimeout setting from Apache CXF src and replace the existing cxf-rt-transports-http-version.jar in your server. See the instructions from Wildfly 8.2/undertow read time out
type: Answer
score: 0

http://stackoverflow.com/comment/41584644
type: QuestionComment
has text: val!=0 - What does that do?
score: 1
comment on: http://stackoverflow.com/q/26473548
type: Comment

http://stackoverflow.com/comment/41472057
type: Comment
comment on: http://stackoverflow.com/a/26412028
score: 1
type: AnswerComment
has text: It's worth pointing out: even if the code compiles, the JVM is not *required* to allocate memory. If a primitive variable is always local and there is a free register, an efficient JVM won't allocate anything at all.

http://stackoverflow.com/comment/41632849
comment on: http://stackoverflow.com/a/26500340
type: AnswerComment
score: 0
type: Comment
has text: Thank you - I was primarily asking about why java is able to store that as an integer. I understand how the hex thing works inside that function but was confused on the semantics of the hex to int thing.

http://stackoverflow.com/comment/41612570
has text: What happens when the user is done typing text? [This code example](http://ideone.com/vcAXXr) proves the loop does terminate. There's no code that signifies for the loop to wait for more text to be entered.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26488914

http://stackoverflow.com/comment/41404544
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26374091
has text: @Summer Why do you ask that? Do you think `write(int)` does that?
type: AnswerComment

http://stackoverflow.com/q/26492401
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26492787
has title: Getting Forum Post Contents
has body: When getting the post contents on a forum I'm having troubles receiving the text that is rendered by the HTML. By using org.jsoup.nodes.Document and getElementsByClass I can retrieve the following snippet: Some text... continued in 2nd line and third line. This is bold. Also, here's a link: http://www.google.com/ Pasting this into a HTML online compiler I'll receive the following: If I copy the rendered form I'll get: Some text... continued in 2nd line and third line. This is bold. Also, here's a link: http://www.google.com/ That's exactly what I need. I tried using JEditorPane's renderer but it removes the br line breaks messing things up. Also, it adds 1 or 2 unnecessary empty lines at the bottom. So how do I get the properly rendered text from this HTML snippet in regular text editor format or which query using jsoup would return that? Edit: The Java code String htmlPageSource = "..."; Document document = Jsoup.parse(htmlPageSource); String firstPostHtmlCode = getFirstPostHtmlCode(); System.out.println(firstPostHtmlCode); public String getFirstPostHtmlCode() { Elements userPosts = document.getElementsByClass("entry-content"); Element firstPost = userPosts.get(0); return firstPost.toString(); }
tagged with: java
type: Question
tagged with: jsoup

http://stackoverflow.com/q/26493969
tagged with: sungridengine
upvote count: 1
tagged with: drmaa
answer count: 1
has answer: http://stackoverflow.com/a/26494175
has body: I want to wait for a job to finish which has been submitted externally. My first idea was to get the jobID by calling qstat and then executing session.wait(jobID, Session.TIMEOUT_WAIT_FOREVER);. But this doesn't work. Are there any other ideas except calling qstat until the job isn't listed anymore?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
favorite count: 0
has title: How can I wait for an external started job with DRMAA?
type: Question

http://stackoverflow.com/comment/41500366
score: 0
has text: @mitchj -- what about the state and the status? (My bet: status is 500.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26414295

http://stackoverflow.com/comment/41479924
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26416139
type: Comment
has text: No, because the user input gets read before the if-elseif-else enters. Therefore the input always goes through it during the same iteration, which ends afterwards.

http://stackoverflow.com/a/26499438
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: If Java interprets bytecode all the time, why not translate bytecode to machine code after the first run? There are pros and cons to both ahead of time (AOT) and just in time (JIT) compilation. The main advantage of AOT is that the compiler is generally allowed to take longer, so it can perform more sophisticated analysis and optimization. Another advantage is that the compiler doesn't have to be present at runtime on the target machine. The disadvantages are everything else. The main advantage of JIT is that the compiler is able to make optimizations based on information known only at runtime. In fact, it is even possible to unoptimize and reoptimize code when conditions change. Furthermore, the JIT doesn't have to waste time optimizing code that is never or rarely run, unlike the AOT compiler. Some languages are designed to favor one approach over the other. For example, C/C++ are designed for AOT, while Java is designed for JIT (though it can be compiled AOT with some restrictions). For example, Java has a heavy emphasis on virtual getters and setters, possibly for classes not loaded until runtime. But the JIT can see and inline these functions at runtime. By contrast, if you used virtual methods for every field access in C++, you'd pay a huge performance penalty.
answers question: http://stackoverflow.com/q/26491727

http://stackoverflow.com/comment/41428487
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26369824
has text: @RoddyoftheFrozenPeas how can I convert the system.out to a text file?
score: 0

http://stackoverflow.com/a/26454731
downvote count: 0
has body: Your main does not wait until the user has specified a text in the textArea. You could prevent this behaviour by looping until the text in the textArea is set or you could place the logic of the main function into the ActionListener to handle the event. Following the second way the main function only creates a new FileBrowser object.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26454539
upvote count: 1

http://stackoverflow.com/q/26445462
has comment: http://stackoverflow.com/comment/41533568
has comment: http://stackoverflow.com/comment/41533723
has answer: http://stackoverflow.com/a/26445659
tagged with: operators
has comment: http://stackoverflow.com/comment/41533788
downvote count: 2
has title: Java modulus if number on left is smaller than number on right?
type: AnsweredQuestion
score: -2
tagged with: math
tagged with: java
accepted answer: http://stackoverflow.com/a/26445659
has body: What would (0 + 1) % 10? return? How do you deal with numbers on the left being smaller than numbers on the right? How is this even possible?
type: Question
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/26445492
has answer: http://stackoverflow.com/a/26445492
favorite count: 0
has comment: http://stackoverflow.com/comment/41533675

http://stackoverflow.com/comment/41561072
type: AnswerComment
score: 0
type: Comment
has text: This is another question. Please ask it separately.
comment on: http://stackoverflow.com/a/26460684

http://stackoverflow.com/comment/41490686
score: 0
comment on: http://stackoverflow.com/q/26418730
type: Comment
type: QuestionComment
has text: I wonder how you resolve the code. Or do you just return it as is?

http://stackoverflow.com/q/26442746
tagged with: java
has title: JScrollPane doesn't work/show scroll Bars
type: Question
answer count: 2
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/26442783
score: 0
has comment: http://stackoverflow.com/comment/41539460
tagged with: preferredsize
has body: I have a JFrame, that contains a JPanel, which contains a JScrollPane, that contains another JPanel, with two components (JPanels). For some reason, when I use WindowBuilder's preview option to see the frame, the JScrollPane shows the horizontal scroll bar, but when I compile and run the app, it doesn't. Here is what it looks like: from preview option: When it's compiled: Here is my code: package home; import java.awt.EventQueue; import javax.swing.JFrame; import java.awt.SystemColor; import javax.swing.JPanel; import javax.swing.SpringLayout; import javax.swing.UIManager; import net.miginfocom.swing.MigLayout; import javax.swing.JLabel; import javax.swing.SwingConstants; import java.awt.Component; import java.awt.BorderLayout; import java.awt.Frame; import com.jgoodies.forms.layout.FormLayout; import com.jgoodies.forms.layout.ColumnSpec; import com.jgoodies.forms.layout.RowSpec; import com.jgoodies.forms.factories.FormFactory; import javax.swing.GroupLayout; import javax.swing.GroupLayout.Alignment; import javax.swing.JButton; import javax.swing.LayoutStyle.ComponentPlacement; import javax.swing.UnsupportedLookAndFeelException; import java.awt.Font; import javax.swing.BoxLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.Color; import java.awt.Dimension; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Random; import javax.swing.ImageIcon; import javax.swing.JScrollPane; import javax.swing.border.EtchedBorder; import javax.swing.border.LineBorder; import javax.swing.ScrollPaneConstants; public class AtmManeger implements Serializable { private JFrame frmAtmManeger; public int NumOfOpenAtmMachines = 0; private final AtmManeger frame = this; private ArrayList&lt;ATMmachine&gt; ATMs = new ArrayList&lt;ATMmachine&gt;();//Array list of all the ATM machines that were opened private AtmAccountDataBase atmData…
has answer: http://stackoverflow.com/a/26443364
type: UnansweredQuestion
tagged with: swing
tagged with: miglayout

http://stackoverflow.com/a/26472026
has body: Read up on this: http://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html This tells you how to take arguments form the command line and use those as variables in your program. public static void main (String[] args) { int a = Integer.parseInt(args[0]); int b = Integer.parseInt(args[1]); System.out.print(makes10(a,b)); } If you want input at runtime, you can use the Scanner class or the Console class Scanner s = new Scanner(System.in); System.out.print(makes10(s.nextInt(),s.nextInt()));
answers question: http://stackoverflow.com/q/26471996
downvote count: 0
has comment: http://stackoverflow.com/comment/41582584
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/26440628
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: You can do it like that: Fix the start vertex of the cycle(let's call it v). Run Ford-Bellman algorithm assuming that dist[i] = 0 if i = v and INF otherwise. If there is a negative cycle that contains v, after k iterations of the outer loop in Ford-Bellman algorithm dist[v] will become negative. So you can easily find such smallest k by simply checking if dist[v] is still non-negative or not after each iteration. The smallest k among all v is the answer.
answers question: http://stackoverflow.com/q/26439187
score: 1
accepted answer of: http://stackoverflow.com/q/26439187

http://stackoverflow.com/comment/45062998
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26438963
type: AnswerComment
has text: Sure Let me Edit the answer.

http://stackoverflow.com/comment/41475039
type: AnswerComment
comment on: http://stackoverflow.com/a/26413373
has text: Thank you. It seems to have stopped the error. Would you mind explaining to me why making `temp` a double stops the error from occurring?
type: Comment
score: 0

http://stackoverflow.com/a/26422928
type: Answer
upvote count: 1
score: 1
has body: You can make your own ComboBoxModel. private static class Fruit { public final String id; public final String name; public Fruit(String id, String name) { this.id = id; this.name = name; } @Override public String toString() { return name; } } private final List&lt;Fruit&gt; fruits = Arrays.asList( new Fruit("ap", "apple"), new Fruit("og", "orange"), new Fruit("gp", "grape") ); DefaultComboBoxModel&lt;Fruit&gt; model = new DefaultComboBoxModel&lt;&gt;(); for (Fruit fruit : fruits) { model.addElement(fruit); } jComboBox1.setModel(model); Here I just let the ComboBox return the Fruit on getSelectedItem. Using a Map one could easily let return the short ID. by overriding methods.
downvote count: 0
answers question: http://stackoverflow.com/q/26422366

pointers
tags question: http://stackoverflow.com/q/26440752
tags question: http://stackoverflow.com/q/26488398
tags question: http://stackoverflow.com/q/26464984
tags question: http://stackoverflow.com/q/26448288
tags question: http://stackoverflow.com/q/26372725
tags question: http://stackoverflow.com/q/26454651
type: Tag
tag name: pointers

http://stackoverflow.com/comment/45063103
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26438963
has text: np man .. bt i guess nw ur answer should b comment... anyways np cheers

http://stackoverflow.com/a/26468996
upvote count: 18
type: Answer
has comment: http://stackoverflow.com/comment/41576038
has comment: http://stackoverflow.com/comment/85084286
has body: Persistence.xml is not in resources directory and therefore not in classpath. Move META-INF directory to src/main/resources.
type: AcceptedAnswer
score: 18
downvote count: 0
answers question: http://stackoverflow.com/q/26468910
accepted answer of: http://stackoverflow.com/q/26468910

http://stackoverflow.com/a/26382473
downvote count: 0
has body: The best solution, as usual, depends on your task: either you work with text or with binary data. In the first case you should prefer writers, in the second - streams. You ask for comparison of approaches to write TEXT into files. The last case in your question is the best one for writing/creation new text files. It is suitable for 99% of practical tasks. PrintWritter pw = new PrintWriter("example.html", "UTF-8"); pw.write("Something"); It is short and readable. It supports explicit encoding and buffering. It does not require unnecessary wrappers. Other old-fashion approaches can and should be used in those cases, where this solution is not applicable. E.g. you want to append any text to file. In this case you have no choice except to use writers based on stream wrappers (unfortunately, FileWriter doesn't support explicit encoding).
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/26380744

http://stackoverflow.com/comment/41638559
type: Comment
type: QuestionComment
has text: You can fix it by editing the question. Make it as clear as you can. I'll certainly upvote it.
comment on: http://stackoverflow.com/q/26501911
score: 0

keyboardinterrupt
tag name: keyboardinterrupt
type: Tag
tags question: http://stackoverflow.com/q/26360541

http://stackoverflow.com/q/26468024
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41644848
type: Question
has body: i built an ear using ant and the its compiling fine. however when i deploy i get the noclassdeffound error in the weblogic server logs. so i added the libraries(jars) in server startup script i.e the server java classpath it works fine. Please help me how to resolve this runtime classpath issue using ant build. i assume adding classpath in manifest.mf file will help. so far my build.xml is: Please advice <?xml version="1.0"?> <property name="software.version" value="1.0"/> <property name="user.name" value="usrnme"/> <property name="dirs.base" value="${basedir}"/> <property name="classdir" value="${dirs.base}/build/src"/> <property name="src" value="${dirs.base}/src"/> <property name="mf" value="${dirs.base}/src/META-INF"/> <property name="jar" value="${dirs.base}/build/jar"/> <property name="web" value="${dirs.base}/web"/> <property name="deploymentdescription" value="${dirs.base}/build/deploymentdescriptors"/> <property name="warFile" value="xxxappchk.war"/> <property name="earFile" value="xxxxappchk.ear"/> <property name="earDir" value="${dirs.base}/build/ear"/> <property name="warDir" value="${dirs.base}/build/war"/> <property name="srcDir" value="${dirs.base}/build/src"/> <mkdir dir="${warDir}/WEB-INF"/> <mkdir dir="${warDir}/WEB-INF/classes"/> <mkdir dir="${warDir}/WEB-INF"/> <mkdir dir="${warDir}/WEB-INF/lib"/> <mkdir dir="${warDir}/WEB-INF/classes"/> <mkdir dir="${warDir}/META-INF"/> <mkdir dir="${earDir}/META-INF"/> <include name="*.jar" /> <jar destfile="${warDir}/WEB-INF/lib/xxxx-appcheck.jar" basedir="${warDir}/WEB-INF/classes" /> <echo message="Hyperion appcheck jar created."/> <jar jarfile="${earDir}/${warFile}" basedir="${warDir}" /> <jar jarfile="${dirs.base}/${earFile}" basedir="${earDir}" /> <delete dir="${srcDir}" failonerror="false"/> <delete dir="${earDir}" failonerror="false"/> <delete dir="${warDir}" failonerror="false"/> <echo message="Deleted the temp directories src, war, ear"/> <mkdir dir="${earDir}"/> <mkdir dir="${warDir}"/> <mkdir dir="$…
has title: runtime classpath using manifest.mf classpath
score: 0
answer count: 1
tagged with: build
tagged with: ant
tagged with: java
has answer: http://stackoverflow.com/a/34283679
tagged with: manifest.mf
has comment: http://stackoverflow.com/comment/41586918

http://stackoverflow.com/a/26470626
upvote count: 10
type: Answer
score: 9
downvote count: 1
answers question: http://stackoverflow.com/q/26470117
has body: It is possible to do it but not recommended. I have done it before as I was in the same boat as you so I will share some code. I used this jdbc jar specifically: https://www.dropbox.com/s/wr06rtjqv0q1vgs/mysql-connector-java-3.0.17-ga-bin.jar?dl=0 now for the code: package com.example.test.databaseapp; import java.sql.DriverManager; import java.sql.SQLException; import android.app.Activity; import android.content.Context; import android.os.AsyncTask; public class MainActivity extends Activity { static final String url = "jdbc:mysql://x.x.x.x:xxxx/DBNAME"; static final String user = "client"; static final String pass = "password"; public static List&lt;objClass&gt; objList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new Download(MainActivity.this, internalUrl).execute(); //async task for getting data from db } } Now for my async task: public class Download extends AsyncTask&lt;Void, Void, String&gt; { ProgressDialog mProgressDialog; Context context; private String url; public Download(Context context, String url) { this.context = context; this.url = url; } protected void onPreExecute() { mProgressDialog = ProgressDialog.show(context, "", "Please wait, getting database..."); } protected String doInBackground(Void... params) { try { Class.forName("com.mysql.jdbc.Driver"); java.sql.Connection con = DriverManager.getConnection(url, user, pass); java.sql.Statement st = con.createStatement(); java.sql.ResultSet rs = st.executeQuery("select * from table"); list = new ArrayList&lt;objClass&gt;(); while (rs.next()) { String field= rs.getString("field"); MainActivity.playerList.add(new objectClass(field)); } } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return "Complete"; } protected void onPostExecute(String result) { if (result.equals("Complete")) { mProgressDialog.dismiss(); } } } Make sure to include internet permissi…

http://stackoverflow.com/comment/41595380
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26479342
type: Comment
has text: I believe that "one" must also be, or contain, an actual uuid, but OP can clarify.

http://stackoverflow.com/comment/41432660
comment on: http://stackoverflow.com/q/26389566
has text: Are you asking if `fakeMethodRollback2` failed then could you roll back `fakeMethodRollback1`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41424601
type: Comment
has text: yes you're right, but OP thinks it is what' happening, so giving an explanation to what it actualy is would be helpfull. I've removen my answer since it was really confusing.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26385065

http://stackoverflow.com/q/26500578
tagged with: string
accepted answer: http://stackoverflow.com/a/26500605
has answer: http://stackoverflow.com/a/26500693
tagged with: input
possible better answer: http://stackoverflow.com/a/26500693
has body: Any help would be appreciated. I am not trying to list the operators, ( I know that it would work that way) i want to know if i can put them in a bundle as i attempted in my code below (it did not work, anyone knows why? how to fix it?): } double num1 = Double.parseDouble(token[0]); double num2 = Double.parseDouble(token[2]); double answer; String function = "[+\\-*/]+"; //this String[] token = input.split(function);//and this String operator = token[1];//this is the operator if (operator.equals(function)){ for (int i = 0; i&lt;length; i++) { } System.out.println("Operation is " + token[1] + ", numbers are " + token[0] + " and " + token[2]); } else { System.out.println("Your entry of "+ input + " is invalid"); } }
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41633332
has answer: http://stackoverflow.com/a/26500605
has title: Java Program Using Split to Validate Input. Simplifying, But Keeping Things Fuctional
tagged with: java
tagged with: split
score: 0
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/26500718

http://stackoverflow.com/a/26407186
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26407057
has body: There are two approaches to this: Make Car double as a "factory" of Car objects, changing getCars to static, or Recognize that getCars does not belong in Car, and should be moved to another class, say, CarFactory, instead. Making a separate "factory" class is often a better choice: public class CarFactory { public CarFactory() { // Do factory-specific initialization } public Car[] getCars() { ... // Make an array of Car objects } } Now in Main class you do this: class Main { private static final CarFactory factory = new CarFactory(); private final Car cars[] = factory.getCars(); ... }
has comment: http://stackoverflow.com/comment/41463646
score: 1
has comment: http://stackoverflow.com/comment/41463086

http://stackoverflow.com/comment/41421717
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26383580
type: Comment
has text: Scratching my head. Your answer is completely different from the accepted answer. You answer assumes the OP wants the label to be a background, which is what I assumed (The code kind of sugggests that). The accepted answer suggests something totally different. Who knows :/

http://stackoverflow.com/a/26560191
score: 0
answers question: http://stackoverflow.com/q/26507352
type: Answer
has body: If your concern is a deep-copy on the objects passed to the TreeSet#addAll method, you shouldn't be. The javadoc does not indicate it's a deep-copy (and it certainly would say so if it was)...and the OpenJDK implementation doesn't show this either. No copies - simply additional references to the existing object. Since the deep-copy isn't an issue, I think worrying about this, unless you've identified this as a specific performance problem, falls into the premature optimization category.
has comment: http://stackoverflow.com/comment/41800987

http://stackoverflow.com/a/26416544
score: 1
has comment: http://stackoverflow.com/comment/41480489
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26416455
answers question: http://stackoverflow.com/q/26416455
type: Answer
has body: There is no difference between test and test2. They are both String literals referring to the same String. This String literal is made up of a unicode escape. A compiler for the Java programming language ("Java compiler") first recognizes Unicode escapes in its input, translating the ASCII characters \u followed by four hexadecimal digits to the UTF-16 code unit (§3.1) for the indicated hexadecimal value, and passing all other characters unchanged. So the compiler will translate this unicode escape and convert it to the corresponding UTF-16 code unit. That is, the unicode escape \u0063 translates to the character c. In this String unicodeOfC = ("\\u" + Integer.toHexString('b'+('b'-'a') | 0x10000).substring(1)); the String literal "\\u" (which uses a \ character to escape a \ character) has a runtime value of \u, ie. the two character \ and u. That String is concatenated with the result of invoking toHexString(..). You then invoke substring on the resulting String and assign its result to unicodeOfC. So the String value is \u0063, ie. the 6 characters \, u, 0, 0, 6, and 3. Also is there any way I could get the string unicodeOfC to print "c"? Similarly to how you created it, you need to get the numerical part of the unicode escape, String numerical = unicodeOfC.replace("\\u", ""); int val = Integer.parseInt(numerical, 16); System.out.println((char) val); You can then print it out.
downvote count: 0

http://stackoverflow.com/comment/41759134
comment on: http://stackoverflow.com/q/26497773
has text: @Flow - Thanks for that. I will surely post the udpate. Even after implementing Thread feature rather than a Runnable, I am getting the exception. But the stacktrace is very clear this time. Will keep you posted. Please look into my edited question
score: 0
type: Comment
type: QuestionComment

android-intentservice
type: Tag
tags question: http://stackoverflow.com/q/26383789
tag name: android-intentservice

http://stackoverflow.com/q/26484004
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26484038
has answer: http://stackoverflow.com/a/26484054
has title: layout_toRightOf: String types not allowed
tagged with: layout
has body: I have the following controls: ListView and Two TextView's inside a row. I'm trying to make the 'rowTextView' stand on the left and 'rowTextCount' right next to it on the right. Here's my xml for the row: <com.k.l.MyTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rowTextView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" android:textColor="#888" android:textSize="28sp" > </com.k.l.MyTextView> <com.k.l.MyTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rowTextCount" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dp" android:textColor="#888" android:layout_toRightOf="rowTextView" android:text="666" android:textSize="28sp" > </com.k.l.MyTextView> Error: String types not allowed (at 'layout_toRightOf' with value 'rowTextView') Thanks!
possible better answer: http://stackoverflow.com/a/26484054
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26484038
type: Question
answer count: 2
tagged with: android

http://stackoverflow.com/q/26505334
has answer: http://stackoverflow.com/a/26507781
answer count: 1
type: UnansweredQuestion
tagged with: spring
has title: localizing xsl for different languages
tagged with: http://stackoverflow.com/tag/xml
tagged with: xslt
type: Question
tagged with: java
has body: I have some static xsl to translate dynamic xml into html to response to browser. The rest of the web pages use Spring MVC for view. So they can be localized by using Spring's messages.properties file written in my language. But I don't know how to localize the text nodes in the static xsl using the same method. More specific below. In Spring's web page, I can <spring:message code="title.MyTitle"/> In my static xsl, I have <xsl:stylesheet ........ <xsl:output method="html"/> <xsl:template match="/"> ..... My Title and I want something like this <xsl:stylesheet ........ <xsl:output method="html"/> <xsl:template match="/"> ..... <spring:message code="title.MyTitle"/> Of course the above doesn't work. But I hope I can keep all titles and labels in messages.properties for easy changes between languages. How can I do this? Please help.
score: 0

http://stackoverflow.com/a/26388404
has body: The Open Mobile API may be what you are looking for. An Android implementation exists with the SEEK-for-Android project. However, SEEK is currently not integrated into main-line Android (AOSP) and consequently is not available on all devices. Note that both the hardware and vendor-specific software components need to support communication with a phone's UICC, so you can't just add support by packaging SEEK with your own app.
has comment: http://stackoverflow.com/comment/92916040
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26384763
type: Answer
downvote count: 0

http://stackoverflow.com/a/26369949
has comment: http://stackoverflow.com/comment/41397134
downvote count: 0
has comment: http://stackoverflow.com/comment/41397405
type: Answer
score: 1
upvote count: 1
has body: Change To: System.out.print("Enter a character: "); String userInput= keyb.next(); char i = userInput.charAt(0);//getting the character by itself int counter=0; for(int index= 0; index&lt; userInput.length(); index++) { char ch = userInput.charAt(index); if (ch==i)//comparing the chosen character to each character in the string counter++;//keeping track of how many times you find a match you get the out of range because you are not iterating over the user input.
answers question: http://stackoverflow.com/q/26369907

http://stackoverflow.com/q/26462136
has title: Does GC collects garbage from Metaspace?
tagged with: java-8
tagged with: java
tagged with: dispose
score: 12
type: Question
linked to: http://stackoverflow.com/q/24074164
upvote count: 12
has answer: http://stackoverflow.com/a/26484392
downvote count: 0
has comment: http://stackoverflow.com/comment/41573493
answer count: 1
favorite count: 0
has body: Always I thought that garbage collector clear only heap and now I think so. In java 8 permGen was deleted and it was replaced by Metaspace. And As I understood Metaspace is garbage collected(https://stackoverflow.com/a/24075360/2674303) Who collects garbage from Metaspace?
type: UnansweredQuestion
tagged with: garbage-collection

http://stackoverflow.com/comment/41597780
has text: @u2gilles Additionally, there's no such thing as `BiFunction` in Guava - see [IdeaGraveyard](https://code.google.com/p/guava-libraries/wiki/IdeaGraveyard#Functions/Predicates_for_n_>=_2_inputs) and [this issue](https://code.google.com/p/guava-libraries/issues/detail?id=218).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26476478
type: Comment

http://stackoverflow.com/comment/41558747
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26458964
type: AnswerComment
has text: So should I change these to `equals()` or is it okay to keep it this way

http://stackoverflow.com/q/26508166
favorite count: 0
score: 38
has answer: http://stackoverflow.com/a/43163334
has comment: http://stackoverflow.com/comment/41729906
has comment: http://stackoverflow.com/comment/88319614
possible better answer: http://stackoverflow.com/a/48295035
has answer: http://stackoverflow.com/a/50143525
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/66509563
tagged with: java
tagged with: maven
accepted answer: http://stackoverflow.com/a/43163334
type: Question
has title: maven error: element dependency can not have character children
has comment: http://stackoverflow.com/comment/70598919
has comment: http://stackoverflow.com/comment/41649264
answer count: 6
has answer: http://stackoverflow.com/a/62451535
has body: I'm not sure what happened, but the POM for my project no longer works. Its complaining about the dependency element. Is it that the dependency no longer exists? What does this error mean? To be clear I haven't change the POM, it just does not work now. The exact error message is cvc-complex-type.2.3: Element 'dependency' cannot have character (children), because this type's content type is element-only. 4.0.0 com.medfusion Estatements-core 14.6.0-SNAPSHOT jar Estatements-core http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.apache.maven.plugins maven-shade-plugin 1.6 package shade com.group.id.Launcher1 org.apache.maven.plugins maven-release-plugin 2.3.2 nexus-qhg-dev Medfusion repo http://maven.qhg.local/nexus/content/groups/qhg-dev com.intuit.health 14.6.0-SNAPSHOT notification-reference junit junit 3.8.1 test com.intuit.health ihg-depot-trunk-SNAPSHOT attachment-reference com.intuit.health ihg-depot-trunk-SNAPSHOT eCommunication-core
tagged with: eclipse
has answer: http://stackoverflow.com/a/56255517
linked to: http://stackoverflow.com/q/7835389
has comment: http://stackoverflow.com/comment/41688544
upvote count: 38
downvote count: 0
has answer: http://stackoverflow.com/a/48295035
has comment: http://stackoverflow.com/comment/103630847

http://stackoverflow.com/a/26489779
answers question: http://stackoverflow.com/q/26471499
has body: I figured out the issue. It seems that my query set tables was not set up quite right. I had to add queryBuilder.setTables(NoteTable.TABLE_TODO); to all of the cases in the query. I had previously not added that statement to the _ID cases. @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { // Uisng SQLiteQueryBuilder instead of query() method SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); // check if the caller has requested a column which does not exists checkColumns(projection); // Set the table int uriType = sURIMatcher.match(uri); switch (uriType) { case TODOS: queryBuilder.setTables(NoteTable.TABLE_TODO); break; case TODO_ID: queryBuilder.setTables(NoteTable.TABLE_TODO); // adding the ID to the original query queryBuilder.appendWhere(NoteTable.COLUMN_ID + "=" + uri.getLastPathSegment()); break; case DEVICES: queryBuilder.setTables(DeviceTable.TABLE_DEVICE); break; case DEVICE_ID: queryBuilder.setTables(DeviceTable.TABLE_DEVICE); // adding the ID to the original query queryBuilder.appendWhere(DeviceTable.COLUMN_ID + "=" + uri.getLastPathSegment()); break; default: throw new IllegalArgumentException("Unknown URI: " + uri); } SQLiteDatabase db = database.getWritableDatabase(); Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder); // make sure that potential listeners are getting notified cursor.setNotificationUri(getContext().getContentResolver(), uri); return cursor; }
type: Answer
score: 0

http://stackoverflow.com/comment/66761681
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27777456
has text: I am not sure this method will always work, e.g. for 00110 00110 it should detect a repeating pattern of size 5.

http://stackoverflow.com/comment/41654546
has text: Can you share the entire source of `records`?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26512193

http://stackoverflow.com/comment/41625052
has text: or as a single loop `for(int i=0; i<myNums.length(); i++)` with `my_array[i%4][i/4] = Integer.parseInt(myNums[i]);`
comment on: http://stackoverflow.com/a/26495870
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41730892
type: AnswerComment
type: Comment
has text: Without the loop it is very fast. With `statement.execute("SET ARITHABORT ON")` (returns `false`, BTW) inserted immediately after creating the connection and before the loop, it is still very (minutes) slow.
comment on: http://stackoverflow.com/a/26553900
score: 0

http://stackoverflow.com/comment/41432615
type: Comment
score: 0
has text: This is because you are missing getters and setters for the beans.
comment on: http://stackoverflow.com/a/26383270
type: AnswerComment

http://stackoverflow.com/q/26430688
has comment: http://stackoverflow.com/comment/41506207
has title: How to display elements of an array?
type: Question
has comment: http://stackoverflow.com/comment/41506193
accepted answer: http://stackoverflow.com/a/26431008
has comment: http://stackoverflow.com/comment/41506307
has comment: http://stackoverflow.com/comment/41506347
score: 0
has comment: http://stackoverflow.com/comment/41506214
has comment: http://stackoverflow.com/comment/41506212
answer count: 1
has comment: http://stackoverflow.com/comment/41506384
tagged with: java
has comment: http://stackoverflow.com/comment/41506567
has answer: http://stackoverflow.com/a/26431008
type: AnsweredQuestion
has body: I'm still learning Java and I was wondering how can I access an element of an array? For example, I have this array: private int[] employeeNum={5658845, 4520125, 7895122, 8777541, 1302850, 7580489}; And I want to display the number "450125" while using a for loop. What should I do? Also, if you have a better method rather than a for loop, please feel free to put it; it would be much appreciated. I'll put in the for loop I'm using just in case : for(int i=0; i&lt;6; i++) { System.out.println("Enter the hours worked by employee number " + employeeNum[i] + ":"); }
tagged with: arrays

http://stackoverflow.com/q/26490057
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/62768133
has body: I am trying to set up a project for the GAE using Push-to-deploy with CI (build, test, deploy) and are not able to get my tests running. On my local Computer everything is fine. From Googles log files: integrationTest(my.package.theTest): Cannot load JDBC driver class 'com.mysql.jdbc.GoogleDriver' integrationTest(my.package.theTest): Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection My configuration to run the project on GAE is: appengine-web.xml my-app-id ${appengine.app.version} true <use-google-connector-j>true</use-google-connector-j> dataSource.properties jdbc.driverClassName=com.mysql.jdbc.GoogleDriver jdbc.url=jdbc:google:mysql://my-app-id:my-instance/my_table?user=user jdbc.username=user jdbc.password=user dataSource.xml classpath:db/dataSource.properties hibernate.xml <import resource="dataSource.xml" /> org.hibernate.dialect.MySQL5Dialect false <tx:annotation-driven transaction-manager="transactionManager" /> applicationContext.xml <import resource="db/hibernate.xml" /> AbstractDao.java @Transactional @Component public class AbstractDao<T> implements Dao<T> { @Autowired SessionFactory sessionFactory; @Override public void save(T entity) { getSession().save(entity); } // other dao code private Session getSession() { return sessionFactory.getCurrentSession(); } } root/pom.xml pom <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <appengine.target.version>1.9.10</appengine.target.version> com.google.appengine appengine-maven-plugin ${appengine.target.version} project-war project-ear root/project-ear/pom.xml war ../target ... ${buildDirectory} org.apache.maven.plugins maven-ear-plugin 2.8 5 lib war com.google.appengine appengine-maven-plugin my.groupId project-war 1.0-SNAPSHOT war strong text 4.0.0 war project-war my.groupId root 1.0-SNAPSHOT com.google.appengine appengine-api-1.0-sdk ${appengine.target.version} mysql mysql-connector-java 5.1.30 org.hib…
has comment: http://stackoverflow.com/comment/41622328
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: spring
linked to: http://stackoverflow.com/q/37644148
has title: Cannot load JDBC driver class 'com.mysql.jdbc.GoogleDriver' - GAE + Java + Hibernate + Spring
has comment: http://stackoverflow.com/comment/41634619
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql

http://stackoverflow.com/comment/41586886
comment on: http://stackoverflow.com/q/26474562
type: Comment
type: QuestionComment
score: 2
has text: There is no problem. But if you need to maintain a large legacy system, start with adding generics. Update APIs using deprecated marks. Use FindBugs. Because any Exception must be due to some error.

http://stackoverflow.com/a/26376189
answers question: http://stackoverflow.com/q/26375914
downvote count: 0
type: Answer
has body: From compare javadoc: Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. But from this line of your code: if (o1.getUseDate() == null || o2.getUseDate() == null) { return 0; we can see that you're practically telling the comparator to consider useDates as being equal when at least one of them is null, and this is not what you want. Since null means "nothing", it's quite weird to compare the concept of nothing with a date, but if you want to allow null values, then you have to handle this situation properly, resulting into a more vorbose code: if(o1.getUseDate() == null){ return o2.getUseDate() == null ? 0 : -1; //or +1 if you want null values at the bottom of your list } if(o2.getUseDate() == null){ return o1.getUseDate() == null ? 0 : -1; // or +1 ... } return o1.getUseDate().compare(o2.getUseDate()); // 2 non null dates, do a real comparison
upvote count: 1
score: 1

http://stackoverflow.com/comment/41541235
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26447302
has text: *" I can't just run the debugger in Eclipse"* Why not? There is nothing out of the ordinary in this code.
score: 0

http://stackoverflow.com/comment/41574240
has text: A solution would be first splitting it using double slash: `x.split("//"):`, and then splitting each of the the results using one slash: `s[0].split("/");`. The final array of results would be: 10, 20 and 30
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26468238

http://stackoverflow.com/a/26461909
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41575686
answers question: http://stackoverflow.com/q/26461607
type: Answer
accepted answer of: http://stackoverflow.com/q/26461607
has body: It's difficult to know what tools you already have installed on your system. I'd recommend either bmon, ifstat, or ifstat -S if you want the information printed on the same time. The above should be in your distro's central repository (aptitude, yum etc) so should be easy to install if they're not aready there.
score: 0

http://stackoverflow.com/q/26505699
has title: Constructor args in Spring?
has comment: http://stackoverflow.com/comment/41642355
has comment: http://stackoverflow.com/comment/41642251
has comment: http://stackoverflow.com/comment/41642353
has comment: http://stackoverflow.com/comment/41642314
score: 0
tagged with: constructor-injection
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/41642538
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/41642657
tagged with: java
has comment: http://stackoverflow.com/comment/41642442
upvote count: 1
has answer: http://stackoverflow.com/a/26505849
downvote count: 1
type: Question
has body: How will I instantiate a named constructor. The constructor is like this public MachineInPitImpl(MachineInPitImpl mip){ //here are the attributes initialised } How will I give this constructor as constructor-args in spring. I have tried this, but not working, it still initializes the default constructor. I dont want to initialize the default cons. I want the spring to initialize the above constructor &lt;bean id="machineInPitImpl" class="minestar.pitlink.domain.pitmodel.MachineInPitImpl" abstract="true"&gt; &lt;constructor-arg ref="machineInPitImpl"/&gt; &lt;/bean&gt;
has comment: http://stackoverflow.com/comment/41642801
has answer: http://stackoverflow.com/a/26505816

http://stackoverflow.com/q/26511208
has comment: http://stackoverflow.com/comment/41652636
has comment: http://stackoverflow.com/comment/41652757
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
has title: Will I need to rebuild my application if I am to include a graphical user interface?
has answer: http://stackoverflow.com/a/26511440
has comment: http://stackoverflow.com/comment/41653110
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: I have an existing java application, I am a novice at GUIs, I'm okay at concurrency and networking in java. I am at the stage where logically, the server and client based programs are complete and working. I have had no experience with user interfaces in java or with swing or any of that. Will I need to rebuild my application if I am to include a graphical user interface for the client? Can I just create a new class or classes which are dedicated to the GUI element of the client side program? Anyone know a good set of tutorials for java swing or another appropriate library for this situation?
tagged with: swing
has comment: http://stackoverflow.com/comment/41653164
type: Question

http://stackoverflow.com/comment/41539634
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26448973
has text: Summing up the data transferred divided by the time needed for this? Windowing and computing moving averages might be useful, too.
score: 0

http://stackoverflow.com/comment/42440628
comment on: http://stackoverflow.com/a/26438706
has text: Per @Deoxyseia 's statement, yes it works with 1.8 as well but you must use ` 1.8* `.
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41569660
type: Comment
has text: Can you give what's those cammand prints in your console : `java -version`and `javac -version`? The error `Unsupported major.minor version 51.0`is for sure a java version problem...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26386853

http://stackoverflow.com/comment/41500931
comment on: http://stackoverflow.com/a/26427915
has text: Dear @Luk, call by value return is call by value result?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/60547345
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26471404
has text: @Tunaki I think the underlaying issue here is that I cant add`<packaging>jar</packaging` on the `connectors` module, since only `pom` is allowed. Meaning I can't add a dependency on `connectors` from another module and get all sub-modules automagically.
type: QuestionComment

http://stackoverflow.com/comment/41551994
has text: Go to a post office or a supermarket, and suggest the postman or the cashier to serve the last people in the queue first. You'll understand why fairness can be important.
comment on: http://stackoverflow.com/q/26455578
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/41527541
type: Comment
comment on: http://stackoverflow.com/a/26442205
score: 1
type: AnswerComment
has text: Thank you! The info on break and continue was really helpful! That was really the answer I was looking for :3

http://stackoverflow.com/comment/41636002
type: AnswerComment
comment on: http://stackoverflow.com/a/26502053
has text: Because I don't know at which line it will become true (amongst many files/methods)
type: Comment
score: 0

http://stackoverflow.com/a/26421263
downvote count: 2
has comment: http://stackoverflow.com/comment/41490839
has comment: http://stackoverflow.com/comment/41488487
has comment: http://stackoverflow.com/comment/41489388
answers question: http://stackoverflow.com/q/26421113
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/41489190
has comment: http://stackoverflow.com/comment/41488314
has body: You can simply divide by 10, since u only want two decimal point. then * 100 , round it then divide it :) double d=123.23; d=d/10; double out= (double) Math.round(d*100) / 100; System.out.println(out);
type: Answer
has comment: http://stackoverflow.com/comment/41489502

http://stackoverflow.com/a/26441084
answers question: http://stackoverflow.com/q/26440356
upvote count: 2
has comment: http://stackoverflow.com/comment/41526791
has comment: http://stackoverflow.com/comment/41525718
has comment: http://stackoverflow.com/comment/41525528
has comment: http://stackoverflow.com/comment/41526289
has comment: http://stackoverflow.com/comment/41525480
downvote count: 0
has body: ALTER SESSION SET NLS_COMP=LINGUISTIC; ALTER SESSION SET NLS_SORT=BINARY_CI; That statement will only affect your current session, when you open you a new session, the previous alter session in previous session won't affect the new session. If you want to make all the sessions to be case-insensitive, then use a AFTER LOGON TRIGGER and issue the same statements using dynamic sql. For example, CREATE OR REPLACE TRIGGER case_insensitive_trg AFTER LOGON ON SCHEMA BEGIN execute immediate 'alter session set NLS_SORT=BINARY_CI'; execute immediate 'alter session set NLS_COMP=LINGUISTIC'; END; / For detailed information on case-insensitive sorts and compares, please read Oracle – Case Insensitive Sorts &amp; Compares Regarding, system level, ALTER SYSTEM SET NLS_COMP=LINGUISTIC SCOPE SPFILE; ALTER SYSTEM SET NLS_SORT=BINARY_AI SCOPE SPFILE; You can certainly do whatever you want, of course it is your database. But, I won't recommend to do such a thing at system level. It is an overkill at system level, and unnecessary welcome to performance issues. Update : The confusion between a session and a connection A connection is actual connection (typically a socket over TCP/IP) between the client and the server. It is used by the client to communicate with the server, and by the server to respond to the client's requests. A session is the process (or thread) on the server that has been created for that connection, to service the client. This reads the client's request from the connection, executes/services the request, and then respond to the request to the client via the connection. So, a session reads and respond back the client's request via the connection.
type: Answer
score: 2

http://stackoverflow.com/comment/41541693
type: QuestionComment
comment on: http://stackoverflow.com/q/26450095
score: 1
has text: What makes you say it is possible. If I open a full screen application and give it focus, I will never be able to drag-and-drop something onto that `JFrame`, transparent or not.
type: Comment

http://stackoverflow.com/q/26376392
tagged with: java
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/41410197
has body: I am trying to create a Spring MVC app, I have multiple dispatcher servlets in my web.xml like this: one-servlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:appServlet/one-context.xml 1 one-servlet /one/* two-servlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:appServlet/two-context.xml 1 webapp-servlet /two/* And everything works fine, except one thing urls that i use in my jsp files like this: <c:url value="/user" /> doesnt return the mapping of dispatcher servlet, i mean that i need a url like this myapp/one/user to use a controller from one-servlet, but the url i get is myapp/user Any possibility to append the dispatsher servlet mapping to my urls without hardcoding them in jsp files ?
answer count: 1
has comment: http://stackoverflow.com/comment/41410698
tagged with: spring
has answer: http://stackoverflow.com/a/26377683
accepted answer: http://stackoverflow.com/a/26377683
has comment: http://stackoverflow.com/comment/41408504
tagged with: spring-mvc
type: AnsweredQuestion
type: Question
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/41410399
has title: append dispatsher servlet mapping to url

eclipse-plugin
tags question: http://stackoverflow.com/q/26513040
tags question: http://stackoverflow.com/q/26481306
tags question: http://stackoverflow.com/q/26408534
tags question: http://stackoverflow.com/q/26408690
tags question: http://stackoverflow.com/q/26499120
tags question: http://stackoverflow.com/q/26363682
type: Tag
tags question: http://stackoverflow.com/q/26366666
tags question: http://stackoverflow.com/q/26474944
tags question: http://stackoverflow.com/q/26358068
tags question: http://stackoverflow.com/q/26387602
tags question: http://stackoverflow.com/q/26381466
tags question: http://stackoverflow.com/q/26492523
tags question: http://stackoverflow.com/q/26399308
tags question: http://stackoverflow.com/q/26448517
tags question: http://stackoverflow.com/q/26378804
tags question: http://stackoverflow.com/q/26366615
tags question: http://stackoverflow.com/q/26387225
tag name: eclipse-plugin

http://stackoverflow.com/comment/41423260
score: 0
type: Comment
has text: But that's the display, not the string. What are you doing with this extracted description?
comment on: http://stackoverflow.com/q/26382271
type: QuestionComment

http://stackoverflow.com/comment/41487126
comment on: http://stackoverflow.com/q/26416090
type: Comment
type: QuestionComment
has text: Are you saying that you click a link and it opens a new window? The "from remote driver to web driver" line is confusing me, RemoteDriver is a WebDriver.
score: 0

http://stackoverflow.com/q/26479014
answer count: 1
has answer: http://stackoverflow.com/a/26502661
tagged with: java
has title: Full Text Search with Google App Engine
accepted answer: http://stackoverflow.com/a/26502661
type: AnsweredQuestion
type: Question
tagged with: google-app-engine
has body: I saw this video about Full Text Search in GAE, however I cannot find a way to see sample codes that will show Full Text Search using Datastore Entities as described in the video. Was the feature of Full Text Search for Datastore Entities actually did exist?
score: 0

http://stackoverflow.com/comment/41418809
type: QuestionComment
has text: Yes I do agree, I just wanted to underline that the client needs to "have" the CA certificate by its side to be able to validate the server certificate. So it "uses" it in the way he has to load it.
comment on: http://stackoverflow.com/q/26355442
score: 0
type: Comment

http://stackoverflow.com/q/26404047
has answer: http://stackoverflow.com/a/26406395
tagged with: android-contentresolver
accepted answer: http://stackoverflow.com/a/26406395
answer count: 1
has comment: http://stackoverflow.com/comment/41459049
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/41458483
favorite count: 0
has comment: http://stackoverflow.com/comment/41458753
has comment: http://stackoverflow.com/comment/41461107
downvote count: 0
has body: I've implemented my custom ContentProvider and it has several URIs: The main one: //Return all items, uriType = ALLITEMS String BASEURI = "content://authority/items" and //Return all items in category #, uriType = ITEMS "content://authority/items/cat/#" //Return all items in category # starting with *, uriType = ITEMS_INITIAL "content://authority/items/cat/#/*" My Activity implements these Loader callbacks: @Override public Loader&lt;Cursor&gt; onCreateLoader(int id, Bundle arg1) { CursorLoader mCursorLoader = null; switch (id) { case 0: mCursorLoader = new CursorLoader( mActivity, Uri.parse("content://authority/items/cat/" +mCurrentID), mColumns, null, null, null); break; } return mCursorLoader; } @Override public void onLoadFinished(Loader&lt;Cursor&gt; loader, Cursor cursor) { switch (loader.getId()) { case 0: cursor.setNotificationUri(getContentResolver(),MyContentProvider.BASEURI); if (null == mAdapter) mAdapter = new GridViewCursorAdapter(this, cursor,0); //gv is a GridView if (gv.getAdapter() != mAdapter) gv.setAdapter(mAdapter); if (mAdapter.getCursor() != cursor) mAdapter.swapCursor(cursor); break; } } @Override public void onLoaderReset(Loader&lt;Cursor&gt; arg0) { mAdapter.swapCursor(null); } When I want to insert data I use: for (ItemClass item : itemsToInsert) { getContentResolver().insert(MyContentProvider.BASEURI, itemToContentValues(item)); } And finally insert method in MyContentProvider is so defined: @Override public Uri insert(Uri uri, ContentValues values) { SQLiteDatabase database = db.getWritableDatabase(); int turiType = sURIMatcher.match(uri); long id = 0; switch (uriType) { case ALLITEMS: id = database.insert(MySQLiteHelper.TABLE_ITEMS, null, values); break; default: throw new IllegalArgumentException("Unknown URI (" + uri + ")"); } getContext().getContentResolver().notifyChange(uri, null); return null;//I will implement uri path to single item later } As you can see, the default URI used to initialize the Loader is the filter by category i…
tagged with: android-contentprovider
type: AnsweredQuestion
has title: CursorLoader notify data change
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41460004
type: Question

http://stackoverflow.com/comment/41627536
comment on: http://stackoverflow.com/a/26497092
has text: @user10678 please also see the comment on Titus Answer... The IOConsole is kind of special - but I think eclipse should handle it as well...
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/44120687
score: 0
has text: Yes, please take a look to my answer. Thanks to remind me that I had to write these stuff (I had completely forgot to do it). @Mike
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26408440

http://stackoverflow.com/q/26405326
tagged with: swing
tagged with: miglayout
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26405818
has title: How to middle align through MigLayout
tagged with: java
has comment: http://stackoverflow.com/comment/41462564
tagged with: jpanel
has body: I am creating a desktop application using swing and miglayout. How would I get the below gui? C1 being component 1. +-----+ +-----+ | C1 | | C2 | +-----+ +-----+ +----+ +-----+ +-----+ | C4 | | C3 | | C4 | +----+ +-----+ +-----+ Thank you. Update with regards to the below answer. Code is: panel = new JPanel(); MigLayout layout = new MigLayout("debug", "[][][]"); panel.setLayout(layout); JCheckBox reptJCheckBox = new JCheckBox("REPT"); JCheckBox tstcJCheckBox = new JCheckBox("TSTC"); JCheckBox devJCheckBox = new JCheckBox("DEV"); JCheckBox tstyCheckBox = new JCheckBox("TSTY"); JButton openButton = new JButton("Open"); panel.add(reptJCheckBox); panel.add(tstcJCheckBox, "wrap"); panel.add(tstyCheckBox); panel.add(devJCheckBox); panel.add(openButton, "spany 2, wrap");
type: Question
answer count: 1
downvote count: 0
tagged with: layout-manager
favorite count: 0
has answer: http://stackoverflow.com/a/26405818
has comment: http://stackoverflow.com/comment/41461862
has comment: http://stackoverflow.com/comment/41463018
upvote count: 2

http://stackoverflow.com/q/26500807
answer count: 0
type: UnansweredQuestion
has title: Apache HttpAsyncClient not mapping http response to the right servlet request
tagged with: apache-httpcomponents
has comment: http://stackoverflow.com/comment/41644709
has body: I've this code called from servlet service method. The response from the asyncClient is not rightly mapped to the right servlet request. Is there anything I'm missing? import org.apache.http.impl.nio.client.HttpAsyncClients; final AsyncContext asyncContext = request.startAsync(request, response); CloseableHttpAsyncClient asyncClient = HttpAsyncClients.createDefault(); asyncClient.start(); asyncClient.execute(httpRequestBase, new FutureCallback&lt;HttpResponse&gt;() { @Override public void completed(HttpResponse result) { try { HttpServletResponse response = (HttpServletResponse)asyncContext.getResponse(); // and then, copied result values to response object. result.getEntity().writeTo(response.getOutputStream()); response.getOutputStream().flush(); } catch (IOException e) { } asyncContext.complete(); } }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41634756
type: Question
upvote count: 1
downvote count: 0
tagged with: servlet-3.0
favorite count: 0
has comment: http://stackoverflow.com/comment/41634657
tagged with: apache-httpclient-4.x

http://stackoverflow.com/comment/41591318
comment on: http://stackoverflow.com/a/26477092
has text: the challenge is not to use any to methods.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41658530
score: 0
type: Comment
type: QuestionComment
has text: I'm using JpaRepository interfaces, I've got not saveOrUpdate...
comment on: http://stackoverflow.com/q/26511552

http://stackoverflow.com/a/26430238
score: 2
has comment: http://stackoverflow.com/comment/41505376
downvote count: 0
has comment: http://stackoverflow.com/comment/41505279
has comment: http://stackoverflow.com/comment/41505318
upvote count: 2
has comment: http://stackoverflow.com/comment/41505759
has comment: http://stackoverflow.com/comment/41505794
has body: From groovy point of view this statement: compile group: 'commons-collections', name : 'commons-collections', version: '3.2' is just a normal Map. It works exactly the same as in: apply plugin: 'java' - see here for details.
has comment: http://stackoverflow.com/comment/41505638
has comment: http://stackoverflow.com/comment/41505811
accepted answer of: http://stackoverflow.com/q/26430073
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41505607
answers question: http://stackoverflow.com/q/26430073
has comment: http://stackoverflow.com/comment/41505888
has comment: http://stackoverflow.com/comment/41505554
has comment: http://stackoverflow.com/comment/41505381
type: Answer
has comment: http://stackoverflow.com/comment/41505540

http://stackoverflow.com/comment/41657208
has text: In theory, Hibernate exceptions should include all the information you need to figure out the precise cause. In practice, I have had a lot of luck by turning on "break on exception" in Eclipse, then I just wiggle around from there.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26513674

http://stackoverflow.com/a/62684763
has comment: http://stackoverflow.com/comment/110855542
has comment: http://stackoverflow.com/comment/110854101
answers question: http://stackoverflow.com/q/26431882
type: Answer
has comment: http://stackoverflow.com/comment/110855286
score: 2
downvote count: 0
has body: What Y suggests is that we want to format a given date according to ISO 8601 week-numbering year. According to wikipedia, the definition of week 01 is the week with the year's first Thursday in it (the formal ISO definition) and thus, The first ISO week of a year may have up to three days that are actually in the Gregorian calendar year that is ending Let's consider "2019-12-30" date, which is a Monday. If we take a look at that week, we have December 30 & 31 of 2019 are Monday and Tuesday; January 1-4 of 2020 are Wednesday, Thursday, Friday, and Saturday. As you can see, this week spans Gregorian calendar year (a calendar system we use) 2019 and Gregorian calendar year 2020. If we apply definition of week01 of week-based year above, we can see that the week between 12/30/2019 and 01/05/2020 is week01 of week-based year 2020 (ISO standard specifies that the beginning of a week is Monday). Thus, if we want to parse "2019-12-30" with dateTimeFormatter 'YYYY-MM-dd', the correct result is '2020-12-30'. However, with 'yyyy-MM-dd', the end result will be '2019-12-30'. System.out.println(LocalDate.parse("2019-12-30").format(DateTimeFormatter.ofPattern("YYYY-MM-dd"))); // output "2020-12-30" System.out.println(LocalDate.parse("2019-12-30").format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); // output "2019-12-30" I think there might be a potential problem with Java implementation. If we consider example given by Sam Berry above, the output of "2019-12-29" doesn't consistent with how week-based year is defined. The reason is that "2019-12-29" is a Sunday. If we apply definition from Wikipedia above, "2019-12-29" should be parsed as "2019-12-29" even given 'YYYY-MM-dd'. This is because beginning of week01 is Monday rather than Sunday by ISO standard. If we look up week numbers for 2020, we can see week 01 of 2020 starts at "2019-12-30". I suspect this is possibly due to the implementer of API consider the beginning of a week is Sunday, which is not true according to ISO stand…
has comment: http://stackoverflow.com/comment/110855350
upvote count: 2
has comment: http://stackoverflow.com/comment/110854253

http://stackoverflow.com/comment/41434458
type: Comment
comment on: http://stackoverflow.com/a/26390507
type: AnswerComment
score: 0
has text: "i is a byte is 22" - my ignorance is precluding me from understanding exactly why 22.

http://stackoverflow.com/comment/41634240
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26500790
has text: if the sc.haxNextInt() and sc.nextInt() works properly, then selection1 will always be an int. In anycase if either of those returns the wrong type, you'll get a compile error.

http://stackoverflow.com/comment/41378157
has text: I think I found the right solution. _ assertTrue((side1 + side2 > side3) && (side2 + side3 > side1) && (side3 + side1 > side2));_
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26359358

http://stackoverflow.com/a/37596657
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26437112
score: 6
has body: It's a system property, so you'd have to do it at a system level, i.e. by adding -Dcom.sun.media.jai.disableMediaLib=true in your VM Options.
downvote count: 0

http://stackoverflow.com/a/26414769
has comment: http://stackoverflow.com/comment/41477399
has body: Well, there are two shortcomings: Calling Collections.sort after every modification is rather inefficient, as it requires a couple hundred comparisions. Only one thread can interact with a vector at any time. This imposes a limit on the scalability of the system. Whether these shortcomings actually matter your application is something we can not assess, as you have not given any performance goals. For the first item, I'd switch to a java.util.PriorityQueue, which supports efficient removal of the lowest element. For the second problem, I'd give each thread it's own PriorityQueue, and merge the Queues once all results have been collected. This has the advantage that threads are completely independent in the cpu time intensive phase.
has comment: http://stackoverflow.com/comment/41477600
downvote count: 0
answers question: http://stackoverflow.com/q/26414660
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/41499748
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26379889
has text: you can create a servlet-filter/interceptor/logging-filter depending on what you are using to intercept and log everything that goes in and out.

http://stackoverflow.com/q/26354737
has body: Does something like c# .convertall in Java exist? Like ArrayList&lt;MyCalss&gt; list = new ArrayList&lt;MyClass&gt;(); list.convertall(new Converter(...));
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26354850
tagged with: arraylist
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/41368732
downvote count: 0
has answer: http://stackoverflow.com/a/26354999
favorite count: 0
type: UnansweredQuestion
has title: Java ArrayList<T> .convertall
score: 3

http://stackoverflow.com/comment/41647302
has text: The stack trace indicates a problem not in `Joiner.appendTo` but in 'Joiner$MapJoiner.appendTo`, that is a `MapJoiner` nested class of `Joiner`. Have you verified that one?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26508244

http://stackoverflow.com/a/34766008
has comment: http://stackoverflow.com/comment/57277715
answers question: http://stackoverflow.com/q/26487574
score: 0
has body: If you go to file --> C:\Users\yourusername\wildfly-10.0.0.CR4\standalone\deployments and delete your projectname.war file, server should be able to restart.
type: Answer

http://stackoverflow.com/q/26496753
favorite count: 0
tagged with: javac
has body: Suppose I have a method that declares an array of primitives, but doesn't use it: public void frobnicate() { int[] pointless = new int[1000]; System.out.println("bored"); } What will happen to my pointless array? I think that javac will keep it in (though I'm uncertain). If so, what will the JIT compiler do? Will it get rid of it completely? Will it create the array but not a reference to it? There are murky waters here. It's not quite the same as an unused int pointless = 23; which could be easily removed. With an array, there's an object instance being created, and it's then being zeroed out too. Can the JIT compiler elide all of this? Or will all the work still be done? The motivation for this, by the way, is that I'm writing a benchmark that looks at the effect of different buffer sizes. I would like to remove the effect of the allocation of space for different sizes of buffer. Internally, the buffer is just a byte[]; so the easiest way to remove the effect of the memory allocation would be to start the method by creating an unused array, so that the total amount allocated is the same in each case. In other words, if the maximum buffer size I'll test is 4MB, then when I test with a 1MB buffer, I start by creating an unused byte[3*1024*1024], so that the total allocated is still 4MB. (I'm prepared to ignore the few bytes of extra overhead, which should be insignificant.) But obviously there's no point trying to allocate the unused array if it's never going to make it past the JIT compiler...
has answer: http://stackoverflow.com/a/26497778
accepted answer: http://stackoverflow.com/a/26497778
possible better answer: http://stackoverflow.com/a/26497309
upvote count: 5
type: AnsweredQuestion
tagged with: performance
has title: Unused array of primitives: what do javac and the JIT compiler do with it?
tagged with: java
has comment: http://stackoverflow.com/comment/41628139
score: 4
has answer: http://stackoverflow.com/a/26497309
has comment: http://stackoverflow.com/comment/41626572
has comment: http://stackoverflow.com/comment/41627654
type: Question
tagged with: jit
answer count: 2
tagged with: arrays
downvote count: 1

http://stackoverflow.com/comment/41492537
comment on: http://stackoverflow.com/a/26420716
type: Comment
score: 0
type: AnswerComment
has text: the one you are using is the default one.. derby. you cannot let multiple users use your server in that case.

http://stackoverflow.com/comment/41558021
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26458424
has text: Your code does not compile. Can you publish correct one
score: 0

http://stackoverflow.com/comment/41647406
comment on: http://stackoverflow.com/a/26507758
has text: @feuerball, what do you mean by `to associate a session with the current thread`? Internally hibernate uses the session object to get the database connection and once the transaction is completed then the session is also closed along with the DB connection. So even if you try to hold the session outside the transaction context then it is of no use.
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/q/26356576
linked to: http://stackoverflow.com/q/12751783
tagged with: eclipse
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41372209
has comment: http://stackoverflow.com/comment/41372493
has answer: http://stackoverflow.com/a/26381979
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26357055
has title: How to create a library and use it in GWT project?
has answer: http://stackoverflow.com/a/26357055
tagged with: java
accepted answer: http://stackoverflow.com/a/26381979
type: Question
tagged with: gwt
has body: I'm trying to create a UI library to use it in a GWT project named Test. This is what I did : Create a new GWT Web Application named com.example.gwtui.GWTUI. Create 2 packages : ui and tools. My UI elements extend GWT elements and are in package ui. Export the project as a jar file named gwtui.jar. Configure build path in Test and add gtwui.jar. Import the package com.example.gwtui.*. Nothing is underlined in red. Debug Test as a web application. It doesn't work. I obtain an error : The import com.example cannot be resolved in devmode console. What did I do wrong ? Thank you.

http://stackoverflow.com/comment/41438576
type: Comment
comment on: http://stackoverflow.com/a/26370930
score: 0
type: AnswerComment
has text: @CodeMed Ok, then it's good. Just update the `pom.xml` then. I think you mean the `jpaconfiguration` line in `hbm2ddl`, right? The `persistenceunit` there should have the same name as everywhere else. For `bindings.xjb` check `src\main\resources`. It is not generated, it is manually written. Maybe you don't have that in your sample. I think I use this one: https://github.com/highsource/hyperjaxb3/blob/master/ejb/tests/po-customized/src/main/resources/bindings.xjb This file basically customizes the generation.

big-o
tags question: http://stackoverflow.com/q/26354571
type: Tag
tag name: big-o
tags question: http://stackoverflow.com/q/26365457

http://stackoverflow.com/q/26393034
type: Question
has comment: http://stackoverflow.com/comment/41438808
has comment: http://stackoverflow.com/comment/41438804
has comment: http://stackoverflow.com/comment/41438859
score: 0
tagged with: for-loop
has comment: http://stackoverflow.com/comment/41439152
has comment: http://stackoverflow.com/comment/41438871
answer count: 1
has comment: http://stackoverflow.com/comment/41438962
has answer: http://stackoverflow.com/a/26393179
has body: What I am trying to do is have all those buttons do the same thing when I click them individually. I am just transferring over from C#.net so I am not sure how exatly to do it. I have all the buttons android:onClick set to "UserPush" but I don't know what to do from there. I am also trying to have them disable when pushed. public class GameScreen extends Activity { Button A1,A2,A3,B1,B2,B3,C1,C2,C3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game_screen); A1 = (Button) findViewById(R.id.A1); A2 = (Button) findViewById(R.id.A2); A3 = (Button) findViewById(R.id.A3); B1 = (Button) findViewById(R.id.B1); B2 = (Button) findViewById(R.id.B2); B3 = (Button) findViewById(R.id.B3); C1 = (Button) findViewById(R.id.C1); C2 = (Button) findViewById(R.id.C2); C3 = (Button) findViewById(R.id.C3); } public void UserPush() { for(Button c : GameScreen.class) { c.Disable } } }
tagged with: android
type: AnsweredQuestion
has title: How to reference multiple buttons to do the same thing in Android
tagged with: java
accepted answer: http://stackoverflow.com/a/26393179

http://stackoverflow.com/comment/41612788
type: Comment
has text: But , this does not address the case when the String contains punctuation character as a separate word like "This - That"
comment on: http://stackoverflow.com/a/26489033
score: 0
type: AnswerComment

generics
tags question: http://stackoverflow.com/q/26354388
tags question: http://stackoverflow.com/q/26408976
tags question: http://stackoverflow.com/q/26389860
tags question: http://stackoverflow.com/q/26487976
tags question: http://stackoverflow.com/q/26370145
tags question: http://stackoverflow.com/q/26370586
tags question: http://stackoverflow.com/q/26355958
tags question: http://stackoverflow.com/q/26432458
tags question: http://stackoverflow.com/q/26481029
tags question: http://stackoverflow.com/q/26472071
tags question: http://stackoverflow.com/q/26376638
tags question: http://stackoverflow.com/q/26456340
tags question: http://stackoverflow.com/q/26391600
tags question: http://stackoverflow.com/q/26456364
tags question: http://stackoverflow.com/q/26360518
type: Tag
tags question: http://stackoverflow.com/q/26413494
tags question: http://stackoverflow.com/q/26354341
tags question: http://stackoverflow.com/q/26416888
tags question: http://stackoverflow.com/q/26400049
tags question: http://stackoverflow.com/q/26507212
tags question: http://stackoverflow.com/q/26400421
tags question: http://stackoverflow.com/q/26362135
tags question: http://stackoverflow.com/q/26497024
tags question: http://stackoverflow.com/q/26354810
tags question: http://stackoverflow.com/q/26369002
tags question: http://stackoverflow.com/q/26433334
tags question: http://stackoverflow.com/q/26398502
tags question: http://stackoverflow.com/q/26451400
tags question: http://stackoverflow.com/q/26359200
tags question: http://stackoverflow.com/q/26414189
tags question: http://stackoverflow.com/q/26411541
tags question: http://stackoverflow.com/q/26441357
tags question: http://stackoverflow.com/q/26451293
tags question: http://stackoverflow.com/q/26417106
tags question: http://stackoverflow.com/q/26475359
tags question: http://stackoverflow.com/q/26424687
tags question: http://stackoverflow.com/q/26456873
tags question: http://stackoverflow.com/q/26392671
tags question: http://stackoverflow.com/q/26488639
tags question: http://stackoverflow.com/q/26508133
tags question: http://stackoverflow.com/q/26508128
tags question: http://stackoverflow.com/q/26358590
tags question: http://stackoverflow.com/q/26491569
tags question: http://stackoverflow.com/q/26371907
tags question: http://stackoverflow.com/q/26371418
tags question: http://stackoverflow.com/q/26377596
tags question: http://stackoverflow.com/q/26427010
tags question: http://stackoverflow.com/q/26391772
tags question: http://stackoverflow.com/q/26449111
tags question: http://stackoverflow.com/q/26441409
tags question: http://stackoverflow.com/q/26463009
tag name: generics
tags question: http://stackoverflow.com/q/26412246
tags question: http://stackoverflow.com/q/26436790
tags question: http://stackoverflow.com/q/26427224
tags question: http://stackoverflow.com/q/26425807
tags question: http://stackoverflow.com/q/26496348
tags question: http://stackoverflow.com/q/26440739
tags question: http://stackoverflow.com/q/26447035

http://stackoverflow.com/comment/41593209
type: Comment
type: QuestionComment
has text: could you please give examples for both with explanation?
comment on: http://stackoverflow.com/q/26464324
score: 0

http://stackoverflow.com/q/26417850
type: Question
tagged with: android-layout
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26418519
tagged with: android-activity
has body: I have managed to have the user upload their picture from their device gallery to an imageview. However, I am trying to provide the user the ability to upload their profile picture from their facebook to an imageview. Below is how I got to upload a picture from device gallery to imageview, Button buttonLoadImage = (Button) findViewById(R.id.btnPictureSelect); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); ImageView imageView = (ImageView) findViewById(R.id.profilePicturePreview); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } } I am trying to figure out ways so that when a user press the button "btnFacebookUpload" they are able to chose a picture from their facebook gallery which would be cast to the imageview "profilePicturePreview" Update: Button buttonFacebookLoadImage = (Button) findViewById(R.id.btnFacebookUpload); buttonFacebookLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { ProfilePictureView profilePictureView; profilePictureView = (ProfilePictureView) findViewById(R.id.profilePicturePreview); buttonFacebookLoadImage.setSessionStatusCallback(new Session.StatusCallback() { @SuppressWarnings("depreca…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41483406
tagged with: android
tagged with: facebook
linked to: http://stackoverflow.com/q/6706977
tagged with: java
has title: Upload facebook image into imageview

http://stackoverflow.com/q/26370743
upvote count: 5
has title: How to use SpringApplicationConfiguration or ContextConfiguration to load smaller app portions
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-boot
downvote count: 0
has answer: http://stackoverflow.com/a/26375451
has body: I am working on a spring-boot based project, which is fairly new to me. At present, I am using the @WebApplicationContext annotation to get any of my Junit test to run, as I cannot seem to get the application to boot any other way. My goal in asking this question is to either get a distinct answer to how to avoid it's use, or links to projects use an applicable concept. My exact goal is: I would like to have a testing configuration which will not load up the entire web application in order to test smaller services and sub sets of classes. Example: I currently have a series of 3 assemblers. One is for a parent object, and the other two for child related objects @Component public class ReportResponseAssembler { @Autowired private ParameterResponseAssembler parameterResponseAssembler; @Autowired private TimeRangeResponseAssembler timeRangeResponseAssembler; public ReportResponseAssembler makeResponse() { return new ReportResponseAssembler(); } } For testing purposes, I would like to load up just these 3 classes and have them appropriately inject the dependencies into the parent. Something like: public class ReportResponseAssemblerTest { @Autowired ReportInstanceResponseAssembler reportResponseAssembler; @Test public void testPlaceHolder() { Assert.assertNotNull(reportResponseAssembler); } } I have attempted something along the lines of: @EnableAutoConfiguration @ComponentScan(basePackages = { "com.blahpackage.service.assembler" }) @Configuration public class TestContextConfiguration {} Then feeding this to SpringApplicationConfiguration, but even with the scan it does not detect the applicable beans for auto injection. Perhaps I need to denote them as @Beans directly in the configuration and return new instances? Are there other good ways? Any links to example projects or explanations you have would be excellent. Thank you, any who respond, so much for your time.
tagged with: java
has answer: http://stackoverflow.com/a/26375581
type: Question
accepted answer: http://stackoverflow.com/a/26375581
score: 5
has comment: http://stackoverflow.com/comment/41424576
answer count: 2
possible better answer: http://stackoverflow.com/a/26375451
favorite count: 0

http://stackoverflow.com/comment/41507010
type: AnswerComment
score: 0
type: Comment
has text: Thats the one!! Thank you very much!
comment on: http://stackoverflow.com/a/26430538

http://stackoverflow.com/comment/41475320
score: 0
type: QuestionComment
type: Comment
has text: What command do I have to put? Just writing netstat in the command console? Or with some arguments?
comment on: http://stackoverflow.com/q/26409766

http://stackoverflow.com/comment/41407648
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26375911
score: 0
has text: You have a lot of indexes and not even one bound checking, this is a disaster factory, specially when using random indexes for arrays.

http://stackoverflow.com/q/26494377
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3940418
tagged with: java
has answer: http://stackoverflow.com/a/42020349
has answer: http://stackoverflow.com/a/26495524
type: Question
possible better answer: http://stackoverflow.com/a/26494799
score: 5
has answer: http://stackoverflow.com/a/26494799
has answer: http://stackoverflow.com/a/26494726
upvote count: 5
answer count: 6
tagged with: servlets
has comment: http://stackoverflow.com/comment/41622118
has title: How to remove a parameter from HttpServletRequest request?
has answer: http://stackoverflow.com/a/54114473
downvote count: 0
has comment: http://stackoverflow.com/comment/41622372
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26495524
favorite count: 0
has answer: http://stackoverflow.com/a/61279190
has comment: http://stackoverflow.com/comment/41622286
has body: In my web application I am sending two parameters: action and productCode from JSP to Servlet. Based on that action some processing will happen. Now after action is performed I am forwarding control to a JSP. The problem is that when the new JSP is opened the URL still contains the name of Servlet and the Parameters. So in case if someone refreshes the page, the same action will be performed again and again. If somehow I am able to remove the parameters from URL then I handled a no parameter situation in servlet. Can anyone please tell me how can I remove the parameter from request object?
linked to: http://stackoverflow.com/q/190833

http://stackoverflow.com/comment/113995965
score: 0
type: AnswerComment
type: Comment
has text: Same issue here. But I could not do apt install for vnc4server on Ubuntu 20.04 so I decided to go with tiger vnc server. All keyboard problems solved now.
comment on: http://stackoverflow.com/a/30987048

http://stackoverflow.com/comment/41551829
has text: I added `dispose()` now the frame wont close when I click the button.
type: Comment
comment on: http://stackoverflow.com/a/26454683
type: AnswerComment
score: 0

http://stackoverflow.com/a/63840185
answers question: http://stackoverflow.com/q/26485964
score: 0
type: Answer
has body: Should Use this way to convert into map : String student[] = students.split(&quot;\\{|}&quot;); String id_name[] = student[1].split(&quot;,&quot;); Map&lt;String,String&gt; studentIdName = new HashMap&lt;&gt;(); for (String std: id_name) { String str[] = std.split(&quot;=&quot;); studentIdName.put(str[0],str[1]); }

http://stackoverflow.com/a/26589094
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26391048
upvote count: 2
type: Answer
score: 2
has body: I had a much nicer answer from a colleague. I post it here for the documentation. The solution is to use a ClientResource, a Filter and a Client. The Filter becomes the next() of the ClientResource and the Client the next() of the Filter. public class ETagFilter extends Filter { @Override protected int beforeHandle(Request request, Response response) { addEtag(request); return super.beforeHandle(request, response); } @Override protected void afterHandle(Request request, Response response) { saveEtag(request, reponse); super.afterHandle(request, response); } } public class RestLetClient extends Application { public Representation get(final String uri) throws Exception { Client client = new Client(Protocol.HTTP); ETagFilter eTagFilter = new ETagFilter(); clientResource = new ClientResource(uri); clientResource.setNext(eTagFilter); eTagFilter.setNext(client); return clientResource.get(halMediaType); } } For info. In my OP I was trying to transform code meant for server side into client side. That approach was wrong. My colleague pointed that the approach is much more like the use Apache HttpClient for similar needs
has comment: http://stackoverflow.com/comment/79432458
accepted answer of: http://stackoverflow.com/q/26391048

http://stackoverflow.com/q/26459002
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/26459795
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Accept and Bind in ServerSocket and ServerSocketChannel
favorite count: 0
type: Question
tagged with: sockets
tagged with: java
has answer: http://stackoverflow.com/a/26459795
has body: So I've been going through Sam's Teach Yourself Java in 21 day on the topic of "Communicating Across the Internet". Within this dense chapter, one thing it lacks is the relationship between ServerSocketChannel and ServerSocket. It's especially perplexing when I read this: ServerSocketChannel sockChannel = ServerSocketChannel.open(); sockChannel.configureBlocking(false); InetSocketAddress server = new InetSocketAddress("localhost", 79); ServerSocket socket = sockChannel.socket(); socket.bind(server); ... That ServerSocket object is never used in the rest of the code. Reading through Java's Documentation, I get that ServerSocketChannel is used for non-blocking purposes when listening for connections while ServerSocket does block. So the question is why is the code creating a ServerSocketChannel object (non-blocking) when it's using that to create a ServerSocket object (blocking) to bind to the address? What would have been the difference if I just used ServerSocketChannel's bind() instead of ServerSocket's? The same question applies for the accept() method as well for both classes.

http://stackoverflow.com/comment/41940707
has text: @Pavan- I cannot test the solution now but my temporary workaround is to set the collectione EAGER (there are a few object in that collection)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26483230

http://stackoverflow.com/a/26458635
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26458476
answers question: http://stackoverflow.com/q/26458476
has body: You're on the right track. You can run out of heap memory but it's not called HeapOverflow. It's called OutOfMemoryError. Although HeapOverflow sounds catchy it's not called that because the heap often has free and allocated areas scattered through out. The stack on the other hand has just two areas, free and allocated. The allocated area grows into the free area as you make more allocations on the stack. Hence you eventually overflow the stack. More on stack vs heap here. Here is an example of running out of heap memory: public class RunOutOfMemory { public static void main(String[] args){ System.out.println("Haven't tried to allocate lots of heap memory."); int[][] matrix = new int[100000][100000000]; System.out.println("A miracle occured."); } } Spoiler alert: you need about 4 terabytes of memory for the miracle to occur
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/41517074
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26436199
has text: Haha right, but thats not what I want. That's the code I have above that I am trying to fix. I want to do an array of objects like you gave me and each time one is called, to get new values for params by calling a function. Is the only way I can do that by doing what you said in your previous comment? Edit: Like you said, it isn't letting me pass the function in for paramaters in the object list. ugh.. Edit2: Actually it worked, i didnt have the new keyword infront of the object, but i dont think it will get new random values each time it is called.. ill try and let you know
score: 0

http://stackoverflow.com/comment/41679533
score: 0
comment on: http://stackoverflow.com/q/26504993
has text: @ink.robot does my answer help you out . comment below my answer if you have any issues still
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26376329
accepted answer: http://stackoverflow.com/a/26376727
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/41494645
has answer: http://stackoverflow.com/a/26376727
has title: Adding radio buttons onto a graph drawn in java using jfreechart or swing
has body: I need to add a radio button onto a graph that performs a specific action when it is selected. I have drawn the graph using jfreeChart in java. But I am unable to figure out a way to add a radio button onto that graph. Is it possible to do so? If not, is it possible to draw a line graph in swing and add radio buttons on top of it? Thanks in advance.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41408405
score: 0
tagged with: swing
tagged with: jfreechart
type: Question

http://stackoverflow.com/q/26452633
type: Question
tagged with: arrays
has body: I created this snippet: public static String[] get_data() { conn = getInstance(); String[] data_array = null; if(conn != null) { Statement query; try { query = conn.createStatement(); String sql = "SELECT data_x FROM table_x"; ResultSet result = query.executeQuery(sql); result.next(); int count = result.getInt("data_x"); result.close(); data_x_array = new String[count]; for (int x = 1; x &lt;= count; x++) { String data_x = result.getString(x); data_x_array[x] = data_x; } } catch (SQLException e) { e.printStackTrace(); } } return data_x_array; } I just created a class, where data from the database is collected in an array. Now i just want to return the array from this method. But what i get is: data_array cannot be resolved to a variable Anybody could help me ? Greetings! UPDATE: i changed snippet to: public static String[] get_data() { conn = getInstance(); String[] data_array = null; if(conn != null) { Statement query; try { query = conn.createStatement(); String sql = "SELECT data_x FROM table_x"; ResultSet result = query.executeQuery(sql); result.next(); int count = result.getInt("data_x"); result.close(); data_array = new String[count]; for (int x = 1; x &lt;= count; x++) { String data_x = result.getString(x); data_x_array[x] = data_x; } } catch (SQLException e) { e.printStackTrace(); } } return data_x_array; } When i compile just: Invalid value for getInt() - 'value_in_table' Anybody know this? Greetings!
has answer: http://stackoverflow.com/a/26452803
has answer: http://stackoverflow.com/a/26452675
has answer: http://stackoverflow.com/a/26452650
has comment: http://stackoverflow.com/comment/41546303
downvote count: 0
favorite count: 0
tagged with: return
answer count: 5
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/26452647
upvote count: 6
has title: java - return array from method
tagged with: java
has answer: http://stackoverflow.com/a/26452662
has comment: http://stackoverflow.com/comment/41547236
tagged with: methods

http://stackoverflow.com/comment/41371689
type: QuestionComment
comment on: http://stackoverflow.com/q/26356164
has text: Not an answer, just advice, Learn the difference between `Boolean` and `boolean`. You almost definitely mean to use `boolean`.
score: 0
type: Comment

http://stackoverflow.com/comment/41426408
score: 0
has text: You're welcome! I suggest you post your edit as an answer (you can answer your own questions) and then mark it as accepetd, it will be clearer for future users with the same pb. Thanks!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26367540

http://stackoverflow.com/comment/41472967
has text: @John Skeet, I just clarified the question so people are not confused with final classes, because it does not really matter which class/interface is used String/Enum/MyInterface. The use case: I have an enum that implements an interface and I want to make sure that the correct class is used.
comment on: http://stackoverflow.com/q/26412246
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26500444
score: 12
has body: You are getting confused between final and immutable Objects. final --> You cannot change the reference to the collection (Object). You can modify the collection / Object the reference points to. You can still add elements to the collection immutable --> You cannot modify the contents of the Collection / Object the reference points to. You cannot add elements to the collection.
answers question: http://stackoverflow.com/q/26500423
type: Answer
upvote count: 12
downvote count: 0

http://stackoverflow.com/a/26501421
answers question: http://stackoverflow.com/q/26501414
type: Answer
has body: It should be : if (pointer.next() % 2 == 1){ pointer.remove(); } pointer is the Iterator, and you can't perform % on it. You have to get the integer at the current location of the Ierator by calling pointer.next().
score: 0

http://stackoverflow.com/q/26381922
score: 2
downvote count: 0
tagged with: java
has body: In this amazing book the author Josh Bloch mentions: "Oh, and one more thing: there is a severe performance penalty for using finalizers. On my machine, the time to create and destroy a simple object is about 5.6 ns. Adding a finalizer increases the time to 2,400 ns. In other words, it is about 430 times slower to create and destroy objects with finalizers." Is there a way we can delete and object in java? I thought we can simply let the objects fall out of scope or reset them to null. I intend to experiment this on my machine, seems like a fun idea but I am not sure how to delete and object.
tagged with: effective-java
type: Question
upvote count: 2
answer count: 2
linked to: http://stackoverflow.com/q/158174
has title: Effective Java Item 7: Avoid Finalizers
has comment: http://stackoverflow.com/comment/41418908
has answer: http://stackoverflow.com/a/26391392
favorite count: 0
has comment: http://stackoverflow.com/comment/41418861
tagged with: finalizer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41418704
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/26381963

http://stackoverflow.com/comment/41496245
has text: @Marko, **After** `join()`, I added the code `workingThread.isInterrupted()` it returns false. Does it mean isInterrupted() clear the interrupt status of working thread?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26425448

http://stackoverflow.com/q/26473339
answer count: 2
has body: I've created a Web Application (with JSP) that uses a SOAP server endpoint to do some operations. I run both servers (WebApp and SOAP server) with gradle jettyEclipseRun, SOAP server on 8081 port and WebApp on 8080 port. First I run SOAP server, and when I run WebApp it throws the next exception (saying "the address is already in use"): * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jettyEclipseRun'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) at org.gradle.execution.taskgraph.DefaultT…
has comment: http://stackoverflow.com/comment/41584694
score: 0
has answer: http://stackoverflow.com/a/26473803
tagged with: jetty
tagged with: soap
tagged with: web-services
has title: Running two Jetty servers on the same machine
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26475902
accepted answer: http://stackoverflow.com/a/26475902
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/41586585
type: Question
possible better answer: http://stackoverflow.com/a/26473803

http://stackoverflow.com/q/26490986
tagged with: struts2
has comment: http://stackoverflow.com/comment/41647917
downvote count: 0
has comment: http://stackoverflow.com/comment/41619942
has body: Consider the following snippet on my jspPage: <s:set var="selectedAccount" value="userSelectedAccount"/> <s:set var="rootAccount" value="userRootAccount"/> name:<s:property value="%{#rootAccount.getName()}"/> equals: <s:if test='%{#selectedAccount.equals(#rootAccount)}'>true</s:if> I expected to the see the following output in my browser: name: account5 equals: true For some reason it doesn't seem to work and I see only the hardcoded text: name: equals: Inside my IDE (Eclipse) I see that the equals method is actually being executed and it returns true! What sorcery is this? So I got desperate and tried fiddling with everything. In the end I found it works if I change the var="..." to something else: <s:set var="randomstring" value="userRootAccount"/> <s:set var="notroottest" value="userRootAccount"/> However it doesn't work with the following names: <s:set var="root" value="userRootAccount"/> <s:set var="roottest" value="userRootAccount"/> <s:set var="rootAccount" value="userRootAccount"/> This randomness makes no sense. I have no other variables or properties called "root" or "roottest" or rootAccount" anywhere, and also no getRoot() or getRootAccount() methods. The only thing I do have is a method getUserRootAccount() which returns an account object. What mistake did I make?
favorite count: 0
has title: Struts2 s:set tag doesn't work for some variable names
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41616639
has comment: http://stackoverflow.com/comment/41645535
score: 2
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41616991
has comment: http://stackoverflow.com/comment/41618057
has comment: http://stackoverflow.com/comment/41645430
type: Question
has comment: http://stackoverflow.com/comment/41645458
tagged with: java

http://stackoverflow.com/q/26379452
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: bad-request
has comment: http://stackoverflow.com/comment/48463901
upvote count: 5
tagged with: java
type: Question
has body: I am writing the the Java code for HTTP Proxy application. In that browser request is not send properly, so server is giving response as Bad Request Your browser sent a request that this server could not understand.Request header field is missing ':' separator. I don't understand why the error is occurring. I am new to java so can know the solution of this question. Request Message: GET / HTTP/1.1&lt;br&gt;Host: www.google.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive I thing I have error in my request but I can't determine it. SO anyone can help me solve my problem.
score: 5
has title: Bad Request. Your browser sent a request that this server could not understand.Request header field is missing ':' separator
downvote count: 0
tagged with: proxy
tagged with: http-error
has comment: http://stackoverflow.com/comment/58495000

http://stackoverflow.com/comment/41566553
comment on: http://stackoverflow.com/a/26463531
has text: So use `quoteReplacement` ... as the javadoc recommends!
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26386098
tagged with: touch
score: 0
has title: Android - Tracking Real-Time Touch Events to Draw
accepted answer: http://stackoverflow.com/a/26389568
answer count: 1
tagged with: real-time
tagged with: android
has body: I need your help. I am trying to implement a paint system with live-tracking, you may think: “Live-tracking? What do you mean?” So I am implementing a solution to track each touch movement on the display, so I can decide, if I want to paint on a specific spot or not, this decision must be in real-time, right when the user touches the display. There will be some images where the user should paint the inner white space inside of the respective shape; figure 1 shows an example of this shape. The user should paint the inside of the shape in a specific direction/order; I still don’t know how I can configure this order/direction in the image. An example of a specific order would be like the one showing on figure 2. So I want the user to paint starting from the zone 1 to the zone 6, do you understand? I don’t want the user to be able to paint the zone 1 and then zone 3, without painting the zone 2 first… In the end, I would have the shape filled, like the figure 3 shows. The arrows are there just to show the right direction of drawing. It’s not just about direction, the specific spots on the image matter, there will be different types of images, and I can’t use only the direction. How can I determine the specific spots in an image with a specific order to be painted? The only idea that came to my mind, would be some kind of training mode, where I (the developer) would draw the image with the order I want, and the system behind would create virtual points on the code, with a small distance between each of them. Then I would have an array with all the “spots” saved with the order I draw them, do you understand? I don’t know if this will work, and if it will be fast enough to travel my array of “spots” when the user is trying to draw on the image? Because I want this to work on real-time, the system should check if it’s a valid spot to draw right when the user touches the display… Do you think it will work? Do you have some recommendations about this? What are the best struct…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26389568
type: Question
tagged with: android-drawable
tagged with: java

http://stackoverflow.com/comment/41442387
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26387104
has text: @fish748 I've updated my answer. Callbacks can be run in parallel. They will, however, block any unexecuted listeners.
type: AnswerComment

http://stackoverflow.com/comment/41556454
comment on: http://stackoverflow.com/q/26457891
type: Comment
type: QuestionComment
has text: @JamesMassey Ok, i will take a look at the guide and ill try again to see if it will work. thank you
score: 0

http://stackoverflow.com/comment/41663656
score: 0
type: Comment
type: QuestionComment
has text: @StriplingWarrior Reusing. But you should realize that iterating over an array involves very little branching and is a highly local operation (meaning it is likely to take a lot of advantage of the CPUs cache). The type of branching is also highly predictable and optimized for in most modern CPUs. It is really quite hard to beat a linear search for small (less than 50) values. That being said, I did see differences once I started using all of the values in the enum in the `in` statement. That just doesn't happen often in the code.
comment on: http://stackoverflow.com/q/26513492

http://stackoverflow.com/comment/41596111
score: 0
type: Comment
has text: Ok, I think I made a good adaption and just posted it for review. Thank you for putting me on the right track!
comment on: http://stackoverflow.com/a/26479099
type: AnswerComment

http://stackoverflow.com/a/26489588
has body: Object.clone() has protected access (which is why you're getting your error), and thus cannot be called directly like this. You have to override clone() in your own class and make the class implement the Cloneable interface. From the link below: The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time. See here for more details.
has comment: http://stackoverflow.com/comment/41613174
downvote count: 0
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26489367
has comment: http://stackoverflow.com/comment/41613299

http://stackoverflow.com/comment/80352463
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26470179
has text: Name of the file.

http://stackoverflow.com/a/26558898
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41835331
has comment: http://stackoverflow.com/comment/41885505
has comment: http://stackoverflow.com/comment/41853548
has comment: http://stackoverflow.com/comment/41918820
has comment: http://stackoverflow.com/comment/41831025
type: Answer
accepted answer of: http://stackoverflow.com/q/26508163
score: 2
answers question: http://stackoverflow.com/q/26508163
has comment: http://stackoverflow.com/comment/41830815
upvote count: 2
has comment: http://stackoverflow.com/comment/41824487
has comment: http://stackoverflow.com/comment/41862354
has body: You need to tell maven to use your maven repository. To do this, modify $HOME/.m2/settings.xml as follows: <?xml version="1.0" encoding="UTF-8"?> nexus * http://xxxx:8083/nexus/content/groups/public nexus central http://central true true central http://central true true nexus The nexus profile is configured to download from the central repository with a bogus URL of http://central. This URL is overridden by the mirror setting in the same settings.xml file to point to the URL of your single Nexus group. The nexus group is then listed as an active profile in the activeProfiles element. Suppose you have repository Central that has repository path http://xxxx:8083/nexus/content/repositories/central and also point Remote Storage Location to http://repo1.maven.org/maven2/ you can change http://central to http://xxxx:8083/nexus/content/repositories/central or http://repo1.maven.org/maven2/. in your pom.xml, use below dependency to getting mysql-connector. mysql mysql-connector-java 5.1.33 See also: Getting started with Nexus maven repository manager Hope this help.

http://stackoverflow.com/comment/41592349
score: 0
type: Comment
type: QuestionComment
has text: If `p1` or `p2` is null then the problem is with the calling code.
comment on: http://stackoverflow.com/q/26477445

http://stackoverflow.com/comment/41624134
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26493846
has text: I did but I'm still getting a null pointer error. I'm guessing at this section:
score: 0

http://stackoverflow.com/a/26406924
has comment: http://stackoverflow.com/comment/41463010
type: Answer
has comment: http://stackoverflow.com/comment/41463266
has comment: http://stackoverflow.com/comment/41464238
score: 0
has comment: http://stackoverflow.com/comment/41462651
has comment: http://stackoverflow.com/comment/41463356
answers question: http://stackoverflow.com/q/26406672
has body: The error message : Caused by: java.lang.NullPointerException at info.androidhive.tabsswipe.MainActivity.onCreate(MainActivity.java:29) means that you have a NullPointerException Exception at this line: viewPager.setAdapter(mAdapter); I see you have correctly defined the ViewPager into the activity_main.xml, so the problem are your imports to reference the resources, thats the reason for what you have a NullPointerException according to your AndroidManifest.xml your package is (and where you must have referenced the resources) : package="com.androidengineer.themes" To fix just add the correct imports: 1) add into the MainActivity.java import com.androidengineer.themes.R; 2) GamesFragment.java change the import import info.androidhive.tabsswipe.R; to import com.androidengineer.themes.R; 3) MoviesFragment.java import info.androidhive.tabsswipe.R; to import com.androidengineer.themes.R; 4) TopRatedFragment.java import info.androidhive.tabsswipe.R; to import com.androidengineer.themes.R; very important, clean your code and build again to create a new R.java file And now your ViewPager must have a correct value.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26406672

http://stackoverflow.com/q/26384257
tagged with: opencsv
has body: I'm using open csv to read a CSV that has only 2 columns, example: "valueA1","valueB of A1" ,"valueB of A1" ,"valueB of A1" ,"valueB of A1" "valueA2","valueB of A2" ,"valueB of A2" ,"valueB of A2" ,"valueB of A2" And it keeps going, so far so good. I'm having trouble when some of the values on column B are coming with some characters Example: "valueA1","va"lueB" of A1" ,"valueB of A1" ,"valueB of A1" ,"valueB of A1" "valueA2","valueB of A2" ,"valueB of A2" ,"valueB of A2" ,"valueB of A2" When my column B has something like a " or even in some cases a : my open csv loses all the format and instead of saying my next line contains 2 values it shows me crazy things like 36, 48, and it loses a huge amount of content due to that. How can I specify that these values are inside the colum B and h'es not suposed to assume that he needs to create a new column? I'm using the simple constructor reader = new CSVReader(new FileReader(arquivo)); By doing research I saw some of the people saying to use a different constructor, I tried to do reader = new CSVReader(new FileReader(arquivo), ',','"'); But the result was the same, since the constructor accepts only char I can't do ","
has comment: http://stackoverflow.com/comment/41423542
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26385728
accepted answer: http://stackoverflow.com/a/26385728
has comment: http://stackoverflow.com/comment/41423275
has comment: http://stackoverflow.com/comment/41422764
possible better answer: http://stackoverflow.com/a/26385130
type: Question
has answer: http://stackoverflow.com/a/26385130
has comment: http://stackoverflow.com/comment/41423351
has comment: http://stackoverflow.com/comment/41423635
tagged with: java
has comment: http://stackoverflow.com/comment/41423221
has title: opencsv, can't use values with"
has comment: http://stackoverflow.com/comment/41423019
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/41424695
has comment: http://stackoverflow.com/comment/41422826
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/41423065

http://stackoverflow.com/comment/41593053
has text: I notice that you only provide two parameters to the strcpy_s function, not three. Could this be the cause? When using the templated version you need to specify strcpy_s(input[10], line.c_str()). Running the program in a debugger will put you right on the failure line would be a valuable tool. P.S. This is a different 'chris'.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26477300

http://stackoverflow.com/comment/41477630
comment on: http://stackoverflow.com/q/26411305
has text: @khmarbaise, the profile doesn't has only dependencyManagement. it contains common dependencies and also some common plugins used only for our plugins. I'm mention only it because the issue seems to be related to it and profiles.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41492051
type: Comment
type: QuestionComment
has text: Could u please edit the code and post what you have run?
comment on: http://stackoverflow.com/q/26410094
score: 0

http://stackoverflow.com/a/26494025
has comment: http://stackoverflow.com/comment/41624153
score: 1
has body: You have two threads: the main thread, and thread 'a'. You have another object b, which inherits from Thread, but which you treat as an int. You run thread a, which performs the summation, and prints the result. Then you print the value in stored b. There is no issue in synchronization because none of your threads share the same variables. The int total is distinct between a and b. If you want to create an issue, make the int a member of Testing.
has comment: http://stackoverflow.com/comment/41623858
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26493854
upvote count: 1

http://stackoverflow.com/a/26359574
type: AcceptedAnswer
has body: Defining the list to be an AbstractList would tie your implementation to sub-classes of AbstractList, while using the List interface allows you to assign to the list variable arbitrary implementations of that interface. Defining the list as AbstractList will also give you access (with no need for casting) to the methods of AbstractList which are not part of the List interface, but using them would make your code less flexible. If you don't have a very good reason to do it, don't do it.
upvote count: 5
accepted answer of: http://stackoverflow.com/q/26359370
type: Answer
answers question: http://stackoverflow.com/q/26359370
downvote count: 0
score: 5

http://stackoverflow.com/comment/133952292
score: 0
type: AnswerComment
has text: great answer. but if anyone facing compilation issue for above code , then just fix line Reporter.log(event.getMessage().getFormattedMessage(); } to correct one as Reporter.log(event.getMessage().getFormattedMessage());}} // method cosing
type: Comment
comment on: http://stackoverflow.com/a/36925435

http://stackoverflow.com/a/49152355
score: 0
answers question: http://stackoverflow.com/q/26413063
has body: codePG's answer won't align the items on the right. This will: <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="end"/>
type: Answer

http://stackoverflow.com/q/26430087
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: google-compute-engine
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26431414
has title: Successful Oryx Install on Google Compute Engine?
linked to: http://stackoverflow.com/q/25436908
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26640225
has body: I am trying to get Oryx up and running on Google Compute Engine. I created a new instance and installed Oryx via: git clone https://github.com/cloudera/oryx.git cd oryx mvn -DskipTests install and saved this install as an image on Google Compute Engine ("oryx-image"). Finding issues with Oryx and the Google File System (Hadoop 2.4.1 and Google Cloud Storage connector for Hadoop) I have been using hdfs:// as the default file system. Finding issues with the default Hadoop package launched on Google Compute Engine (e.g., no Snappy libraries, which are needed for the default Oryx configuration), I have also tried creating my own Hadoop 2.4.1 tarball with Snappy included following these instructions: How to enable Snappy/Snappy Codec over hadoop cluster for Google Compute Engine (side note: is the jdk version described here sufficient for oryx?). I have then used my saved image with oryx installed ("oryx-image"): ./bdutil --bucket &lt;some-bucket&gt; --image oryx-image -n $number \ --env_var_files hadoop2_env.sh --default_fs hdfs and my saved Hadoop tarball: # File: hadoop2_env.sh HADOOP_TARBALL_URI="gs://&lt;some-bucket&gt;/hadoop-2.4.1.tar.gz" to deploy a Hadoop 2.4.1 (with Snappy) cluster (with default file system = hdfs://) on Google Compute Engine. Still no luck. I can successfully run test Hadoop jobs on GCE, test Snappy implementations on GCE (see second link), and test Oryx jobs on GCE locally from the master node: # File: oryx.conf model.local-data = true model.local-computation = true The only issue is getting Oryx to successfully run on Google Compute Engine with data in either hdfs:// or gs://. I have found many varying instructions for environmental variable changes, etc., and I don't know which ones are necessary, and which ones may be leading to more problems. I was wondering if there is documentation on installing/running oryx on GCE. Perhaps someone has gone through the same process already and can offer instruction and/or at least confirm a successful i…
tagged with: oryx
tagged with: hadoop
answer count: 2
linked to: http://stackoverflow.com/q/26150155

http://stackoverflow.com/comment/41534146
type: QuestionComment
comment on: http://stackoverflow.com/q/26445775
has text: Just get the first line, and then ignore it. Do that outside of your loop, and it should work.
score: 2
type: Comment

http://stackoverflow.com/q/26465187
tagged with: textarea
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26468114
type: UnansweredQuestion
upvote count: 0
tagged with: java
has body: I want to print in the text area named arena. I am calling the append method from the same class with no luck so far. How to print a string in a text area?? public class Chat_window extends javax.swing.JFrame implements Runnable { public static DataInputStream in = null; public static PrintStream out = null; private static Socket cs = null; private static BufferedReader zz; private static boolean alive = true; public Chat_window() { initComponents(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { Chat_window w=new Chat_window(); w.setVisible(true); } }); try { cs = new Socket("localhost", 3333); out = new PrintStream(cs.getOutputStream()); zz = new BufferedReader(new InputStreamReader(System.in)); in = new DataInputStream(cs.getInputStream()); } catch (Exception ex) { System.out.println(ex); } if (cs != null &amp;&amp; out != null &amp;&amp; in != null) { try { new Thread(new Chat_window()).start(); while (alive) { out.println(zz.readLine().trim()); } out.close(); in.close(); cs.close(); } catch (Exception error) { System.out.println(error); } } } @Override public void run() { try { while ((m = in.readLine()) != null) { **arena.append(m);** //This line doesnt work System.out.println(m); } } catch (Exception e) { System.out.println(e); } } // Variables declaration private java.awt.TextArea arena; private java.awt.TextArea textArea2; private java.awt.TextArea usrchat; // End of variables declaration }
has comment: http://stackoverflow.com/comment/41865404
type: Question
has comment: http://stackoverflow.com/comment/41568503
has title: Can not print in Text area from same class?
has comment: http://stackoverflow.com/comment/41568430
score: -1

http://stackoverflow.com/comment/41553328
has text: wow! much case-sensitive
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26456382

http://stackoverflow.com/a/26506043
has body: You need to assign returning String to variable or you can just return it. toString() return the String value of Integer you need to take it. Here you didn't take that returning String. String str=Integer.toString(age); // str is the returning String return str; Or return Integer.toString(age); // returning result of toString()
answers question: http://stackoverflow.com/q/26505997
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/26356505
answer count: 1
tagged with: javac
tagged with: android
accepted answer: http://stackoverflow.com/a/26421007
has title: build ant error Compile failed; at line fork="${need.javac.fork}"
tagged with: build
type: AnsweredQuestion
score: 0
type: Question
tagged with: ant
tagged with: java
has answer: http://stackoverflow.com/a/26421007
has body: When i try to build my project i got error line custom_rules.xml:63 is: line 78 is : fork="${need.javac.fork}"> Parameters of build are -Dsdk.dir=C:\Users\bou\sdk -Ddeploy.env=preprod_artiste1 -verbose after build i want replace folder res by another res in res-xxxxxx\res-artiste1\res BUILD FAILED C:\Users\bou\native-android\custom_rules.xml:63: The following error occurred while executing this line: C:\Users\bou\native-android\custom_rules.xml:78: Compile failed; see the compiler error output for details. at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:401) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:392) at org.apache.tools.ant.Target.performTasks(Target.java:413) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399) at org.apache.tools.ant.Project.executeTarget(Project.java:1368) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.apache.tools.ant.Project.executeTargets(Project.java:1251) at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424) at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138) Caused by: C:\Users\bou\native-android\custom_rules.xml:78: Compile failed; see the compiler error output for details. at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1174) at org.apache.tools.ant.taskdefs.Javac.…

http://stackoverflow.com/comment/41506596
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26430952
has text: Why create a whole new variable to accomplish this? It's pointless. Look at using return statements.
type: Comment

http://stackoverflow.com/comment/41533638
type: Comment
comment on: http://stackoverflow.com/a/26445492
type: AnswerComment
score: 0
has text: @SamTebbs33 I know how it works for values on the right side that are bigger than the values on the left... I'm asking how does 1 % 10 (The division of which equals 0.10) equal to a remainder of 1? The math isn't making any sense.

http://stackoverflow.com/comment/99949820
type: Comment
has text: That was just a sample configuration with Values :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/50905729

http://stackoverflow.com/a/26468407
downvote count: 0
has body: What you could do is start the PreferenceActivity with Activity.startActivityForResult() and when you need to recreate your activity, just finish with using the Activity.RESULT_FAILED constant to indicate that the activity wishes to be recreated. This way, you will maintain your state going in, and if you need to pass data back, just set your result intent.
accepted answer of: http://stackoverflow.com/q/26468271
answers question: http://stackoverflow.com/q/26468271
score: 1
has comment: http://stackoverflow.com/comment/41575463
has comment: http://stackoverflow.com/comment/41576164
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41575055
has comment: http://stackoverflow.com/comment/41574894
type: Answer

http://stackoverflow.com/comment/41604003
type: Comment
comment on: http://stackoverflow.com/a/26482702
has text: Thanks @parth6 it works realy awesome, i struck in this concept for a very long time and now you relieved me thanks a lot.God Bless You
score: 0
type: AnswerComment

http://stackoverflow.com/q/26433864
tagged with: regex
upvote count: 6
tagged with: unique
type: AnsweredQuestion
score: 6
has answer: http://stackoverflow.com/a/26433983
type: Question
has answer: http://stackoverflow.com/a/26433980
tagged with: java
possible better answer: http://stackoverflow.com/a/26433979
has answer: http://stackoverflow.com/a/26433979
has body: Here is my regular expression: ((GO)( [A-Z])+) I want every letter to appear at most once, unfortunately it isn't working properly, because this input: GO A B C C return true, but should return false.
accepted answer: http://stackoverflow.com/a/26433983
downvote count: 0
has title: Regex to match string of unique characters
favorite count: 0
has comment: http://stackoverflow.com/comment/41512989
answer count: 3

http://stackoverflow.com/q/26429628
has answer: http://stackoverflow.com/a/26429685
answer count: 2
has answer: http://stackoverflow.com/a/26429818
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41507747
tagged with: java
linked to: http://stackoverflow.com/q/4945178
upvote count: 1
has title: Eclipse is not working in windows 8
type: Question
duplicate of: http://stackoverflow.com/q/4945178
has body: Yesterday I was using eclipse on my sytem. Today, when I am trying to run eclipse on my system, I get the following error I do not know how did it happen? Please help me to solve it.
tagged with: eclipse

http://stackoverflow.com/q/26360161
type: Question
has answer: http://stackoverflow.com/a/26360214
has answer: http://stackoverflow.com/a/78075835
tagged with: java
has body: I have implemented the jersey webservice and trying to authenticate the webservice by asking for username and password when some one calls the webservice from the browser. I am not sure what i am missing from below code, when some one calls the webservice URL, it is not asking for credentials, it is directly comming to AuthFilter class below. Please help to find the issue. Here is the code below. I have also added the CXF authentication which i used earlier, i am trying to implement now with jersey. AuthFilter class package com.myProj.inventory.ws.rest.v1.security; import java.util.Set; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response.Status; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.AuthenticationException; import org.springframework.stereotype.Component; import com.myProj.commons.user.model.DetailedUser; import com.myProj.commons.user.service.UserInfoService; import com.sun.jersey.spi.container.ContainerRequest; import com.sun.jersey.spi.container.ContainerRequestFilter; @Component public class AuthFilter implements ContainerRequestFilter { private static Logger logger = Logger.getLogger(AuthenticationFilter.class); private static final String RIGHT_INVOKE_WEBSERVICE = "INVOKE_WEBSERVICE"; @Autowired private UserInfoService userInfoService; @Override public ContainerRequest filter(ContainerRequest containerRequest) throws WebApplicationException { // Get the authentification passed in HTTP headers parameters String auth = containerRequest.getHeaderValue("authorization"); // If the user does not have the right (does not provide any HTTP Basic // Auth) if (auth == null) { throw new WebApplicationException(Status.UNAUTHORIZED); } // lap : loginAndPassword String[] lap = BasicAuth.decode(auth); // If login or password fail if (lap == null || lap.length != 2) { throw new WebApplicationException(Status.UNAUTHORIZED); } try { boolean isRightExists = f…
answer count: 2
tagged with: jersey
downvote count: 0
score: 1
favorite count: 0
tagged with: rest
has title: Jersey webservice basic authetication is not asking for username and password
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
tagged with: jersey-client

http://stackoverflow.com/q/26477300
has comment: http://stackoverflow.com/comment/41591637
has comment: http://stackoverflow.com/comment/41591847
has comment: http://stackoverflow.com/comment/41591733
accepted answer: http://stackoverflow.com/a/26478340
tagged with: c++
downvote count: 0
has comment: http://stackoverflow.com/comment/41591688
has comment: http://stackoverflow.com/comment/41591801
has comment: http://stackoverflow.com/comment/41591710
has comment: http://stackoverflow.com/comment/41591628
has answer: http://stackoverflow.com/a/26478340
has comment: http://stackoverflow.com/comment/41591865
has comment: http://stackoverflow.com/comment/41591843
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41591674
has comment: http://stackoverflow.com/comment/41591672
has title: error translating a simple program to c++
type: Question
has comment: http://stackoverflow.com/comment/41591652
has comment: http://stackoverflow.com/comment/41593053
upvote count: 1
has body: I am very new to C++ and Java. I succeeded in writing a simple calculator in Java, but my C++-translation crashes with an Access violation on writing to 0. I know that indicates a problem with a NULL-pointer, but I do not see where. Also it sometimes runs but sometimes crashes so I have no idea how to trace and debug it. C++ int main() { bool success = false; double total = 0.0; string line = "text"; int in = 1; do{ cout &lt;&lt; "\nPlease enter simple equation\n"; double operands[2]; getline(cin, line); char input [10]; strcpy_s(input, line.c_str()); int j = 0; int i = 0; while(i &lt; sizeof(operands)){ string str = ""; if(input[j] &lt;= 57 &amp;&amp; input[j] &gt;= 48 || input[j] == 46){ while(input[j] &lt;= 57 &amp;&amp; input[j] &gt;= 48 || input[j] == 46){ str += (input[j]); if(j+1 &lt; sizeof(input)) j++; else break; } operands[i] = stod(str); i++; }else j++; } for (int o = 0; o &lt; sizeof(input); o++){ switch (input[o]){ case 43: total = operands[0] + operands[1]; break; case 45: total = operands[0] - operands[1]; break; case 42: total = operands[0] * operands[1]; break; case 47: total = operands[0] / operands[1]; } } if(total){ cout &lt;&lt; total; }else{ cout &lt;&lt;"Your input is incorrect! Please enter a valid equation"; cout&lt;&lt; "Ex. 1 + 1"; } }while(!success); } Java Scanner in = new Scanner(System.in); boolean success = false; Double total = null; while (!success) { System.out.println("\nPlease enter simple equation: "); try { double[] operands = new double[2]; String line = in.nextLine(); char[] input = line.toCharArray(); StringBuilder str; int j = 0; int i = 0; while (i &lt; operands.length) { str = new StringBuilder(); if (input[j] &lt;= 57 &amp;&amp; input[j] &gt;= 48 || input[j] == 46) { while (input[j] &lt;= 57 &amp;&amp; input[j] &gt;= 48 || input[j] == 46) { str.append(String.valueOf(input[j])); if (j + 1 &lt; input.length) { j++; } else break; } operands[i] = Double.parseDouble(str.toString()); i++; } else j++; } for (int o = 0; o &lt; …
has comment: http://stackoverflow.com/comment/41591505
answer count: 1
has comment: http://stackoverflow.com/comment/41592468
has comment: http://stackoverflow.com/comment/41591948
has comment: http://stackoverflow.com/comment/41591520
favorite count: 0
has comment: http://stackoverflow.com/comment/41592228

http://stackoverflow.com/a/26442410
accepted answer of: http://stackoverflow.com/q/26438598
type: Answer
answers question: http://stackoverflow.com/q/26438598
score: 0
has body: You have configured action with name RegsiterJson but in URL you entered RegisterJson, so it looks like a typo or you can redirect to the action RegsiterJson
type: AcceptedAnswer

http://stackoverflow.com/q/26459059
has answer: http://stackoverflow.com/a/26459359
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41557942
type: UnansweredQuestion
upvote count: 1
has title: How can I secure a Javascript call to a Java Servlet via XMLHttpRequest such that it cannot be used if the url is manually entered into a browser?
tagged with: xmlhttprequest
has body: I currently have a webpage that uses a javascript that does the following: function callSomething(parm) { req = false; if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } if (req) { var url_str = "/Servlet?parm=" + parm; req.open("GET", url_str, false); req.onreadystatechange = processReqChange; req.send(null); // process the response } return something; } My concern is that if someone enters the full URL manually (e.g. "http://somesampleserver.com/Servlet?parm=something") in an browser window, the response is also displayed. How do I prevent that from happening? I only want the code to be able to get the response.
has comment: http://stackoverflow.com/comment/41557971
tagged with: java
has answer: http://stackoverflow.com/a/26461467
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41557975
has comment: http://stackoverflow.com/comment/41557911
has comment: http://stackoverflow.com/comment/41557993
tagged with: javascript
has comment: http://stackoverflow.com/comment/41557893
tagged with: servlets
tagged with: security

http://stackoverflow.com/comment/41447387
has text: Why can't you use [getElementById("result_48")](http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#getElementById%28java.lang.String%29) as id are unique in html?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26398197
score: 0

http://stackoverflow.com/comment/42321266
has text: Could you write out what this would look like (ie. What exactly to plug into the glBindAttribLocation function and how it would look)? This was requestested by a user in an edit who could not yet comment.
comment on: http://stackoverflow.com/a/26511885
score: 0
type: AnswerComment
type: Comment

min
tags question: http://stackoverflow.com/q/26416955
tags question: http://stackoverflow.com/q/26373141
tag name: min
type: Tag

http://stackoverflow.com/a/26381445
has body: if restricted to only arrays, consider trying this: Lets Take a temporary array of the same size of orignal array, where we store each unique letter and suppose a is your orignal array, int[] tempArray= new int[a.length]; int tempArraycounter = 0; bool isUnique = true; for (int i = 0; i &lt; a.length; i++) { isUnique = true; for (int j = 0; j &lt; tempArray.length; j++) { if(tempArray[j] == a[i]) isUnique = false; } if(isUnique) { tempArray[tempArraycounter] = a[i]; tempArraycounter++; isUnique = false; } } now tempArraycounter will be your answer ;)
has comment: http://stackoverflow.com/comment/41417686
has comment: http://stackoverflow.com/comment/41444348
has comment: http://stackoverflow.com/comment/41418129
downvote count: 0
answers question: http://stackoverflow.com/q/26380983
type: Answer
has comment: http://stackoverflow.com/comment/41417645
score: 1
upvote count: 1

http://stackoverflow.com/comment/41568125
type: QuestionComment
type: Comment
has text: are you able to compile your code? Whats the definition of Cell/Position class?
score: 0
comment on: http://stackoverflow.com/q/26464984

http://stackoverflow.com/comment/41546242
comment on: http://stackoverflow.com/q/26436096
score: 0
type: Comment
type: QuestionComment
has text: @Jayan, have a look at this pastebin. How do I connect the $1 to the function doSomething? In the comment section is the result of printing 3 levels of the jdpends outbound links http://pastebin.com/b9E4zEdg

http://stackoverflow.com/comment/41504297
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26428468
has text: Android NDK comes with a utility `nm` that takes a parameter `-D`. Then you can see the list of exported functions of your `.so`, and check of their name s are not mangled the way you did not expect.
type: QuestionComment

http://stackoverflow.com/comment/48463901
type: Comment
type: QuestionComment
has text: Im having the same issue posting from arduino/tinysine wifly. I read a post about it being related to SSL on the server but Im still searching for the answer. Did you come up with anything?
score: 0
comment on: http://stackoverflow.com/q/26379452

http://stackoverflow.com/comment/41451976
type: Comment
has text: literally was writting that @Karthikeyan - after all, they're **designed to store data securely**
type: QuestionComment
comment on: http://stackoverflow.com/q/26401050
score: 0

http://stackoverflow.com/a/26410168
has body: Apparently, I can use BitmapFactory.decodeResource(getResources(), R.drawable.sometexture); and that will load an image from the best available option of the drawable-??dpi folder under /res/.
accepted answer of: http://stackoverflow.com/q/26409184
answers question: http://stackoverflow.com/q/26409184
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/41546146
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26452484
has text: sure editing to include the prefix method from the Dictionary class that this code calls
score: 0

http://stackoverflow.com/comment/41483095
type: AnswerComment
score: 0
type: Comment
has text: I'll be needing it via java code. And I need to not the whole database, I just want the create statements for the result of my query.
comment on: http://stackoverflow.com/a/26418092

http://stackoverflow.com/q/26419538
downvote count: 0
possible better answer: http://stackoverflow.com/a/26419844
favorite count: 0
has comment: http://stackoverflow.com/comment/41485708
accepted answer: http://stackoverflow.com/a/26419616
has body: I am writing a code to read Input from user by using BufferedInputStream, But as BufferedInputStream reads the bytes my program only read first byte and prints it. Is there any way I can read/store/print the whole input ( which will Integer ) besides just only reading first byte ? import java.util.*; import java.io.*; class EnormousInputTest{ public static void main(String[] args)throws IOException { BufferedInputStream bf = new BufferedInputStream(System.in) ; try{ char c = (char)bf.read(); System.out.println(c); } finally{ bf.close(); } } } OutPut: [shadow@localhost codechef]$ java EnormousInputTest 5452 5
tagged with: user-input
has title: How to read a line in BufferedInputStream?
tagged with: input
upvote count: 24
type: AnsweredQuestion
tagged with: java
tagged with: bufferedinputstream
score: 24
has answer: http://stackoverflow.com/a/26419844
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41485574
has answer: http://stackoverflow.com/a/26419616

http://stackoverflow.com/comment/41387094
comment on: http://stackoverflow.com/a/26364405
has text: @Mikkel `totalSeats` and `seatsReserved` variables are final, hence their values don't change after initialization. `totalSeats - seatsReserved` logic is used initially to set the actual number of seats available in the compartment as some seats are reserved. After that `seatsAvailable` variable is being used to decrement or increment the number of seats that are available. So it's not redundant I guess ?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26433681
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has body: Disclaimer: I am a newbie using Ant + Ivy I have the following eclipse configuration : ProjectA depends on ProjectB and ProjectC ProjectB depends on ProjectC Each project has its owns ivy.xml file. ProjectA has a build.xml file like this: (...) &lt;ivy:resolve file="../ProjectC/ivy.xml" /&gt; &lt;ivy:cachepath pathid="ivy.deps.default" conf="default" /&gt; &lt;ivy:cachefileset setid="ivy.deps.default.fileset" conf="default"/&gt; &lt;ivy:resolve file="../ProjectB/ivy.xml" /&gt; &lt;ivy:cachepath pathid="ivy.deps.default" conf="default" /&gt; &lt;ivy:cachefileset setid="ivy.deps.default.fileset" conf="default"/&gt; &lt;ivy:resolve file="ivy.xml" /&gt; &lt;ivy:cachepath pathid="ivy.deps.default" conf="default" /&gt; &lt;ivy:cachefileset setid="ivy.deps.default.fileset" conf="default"/&gt; &lt;path id="classpath"&gt; &lt;fileset dir="${webroot}/WEB-INF/lib" erroronmissingdir="no"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;fileset dir="${libraries}" erroronmissingdir="no"&gt; &lt;include name="*.jar"/&gt; &lt;/fileset&gt; &lt;path refid="ivy.deps.default"/&gt; &lt;/path&gt; (...) &lt;javac destdir="c:/abc" includeantruntime="yes" classpathref="ivy.deps.default"&gt; &lt;src path="../ProjectC/src"/&gt; &lt;classpath refid="classpath"/&gt; &lt;/javac&gt; (... Compile ProjectB ...) (... Compile ProjectA ...) So, running this build.xml results in error, saying that ProjectC could not compile because it was missing a *.jar file that should have been resolved by ivy:resolve command. My question is: How do I make a build.xml that automatically retrieve the dependencies from child projects and also compile all child projects?
has answer: http://stackoverflow.com/a/26659679
tagged with: java
tagged with: ivy
upvote count: 1
linked to: http://stackoverflow.com/q/4106143
type: Question
has comment: http://stackoverflow.com/comment/41587135
has title: Resolve ivy dependencies from another project in build.xml
tagged with: ant
has comment: http://stackoverflow.com/comment/41587229

http://stackoverflow.com/comment/41490080
type: AnswerComment
score: 0
type: Comment
has text: could you also guide me any documentation I can refer for this. I am trying to google a lot about this but I am not getting much /accurate details about it.
comment on: http://stackoverflow.com/a/26406012

http://stackoverflow.com/a/26454003
type: Answer
has body: There are two things you can try. First off, you could read the spawned process's output from a separate thread. If you do this, make sure you set the bufferedReader as final: Thread t = new Thread(new Runnable(){ public void run(){ // might need to try/catch round this while((line = bufferedReader.readLine()) != null){ System.out.println(line); } } }).start(); and then just before the end of your program: t.join(); to make sure that thread finishes its work. The other option is to redirect the output of that process to the output of the Java program, using ProcessBuilder.inheritIO(): Process proc = new ProcessBuilder().inheritIO().command("powershell.exe", "-Command", Command).start();
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/41549578
answers question: http://stackoverflow.com/q/26453848
has comment: http://stackoverflow.com/comment/41549411
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26453848
has comment: http://stackoverflow.com/comment/41549331

http://stackoverflow.com/q/26468861
tagged with: ejb-3.0
has title: EJB client from interfaces
tagged with: maven
has comment: http://stackoverflow.com/comment/41575799
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26486852
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/16685338
tagged with: ejb
answer count: 1
has comment: http://stackoverflow.com/comment/41575952
has body: I read this, but cannot fix my issue. I have java module where all files are java interfaces (screenshot). tsm-mno-external-services org.apache.maven.plugins maven-ejb-plugin true com/test/ExternalCustomerCareServicesRemote.java When Im run maven goal, ejb *-client.jar is not generated (In other modules with contains classed ejb *-client.jar generated without problems). So question is next: can i generate ejb client from interfaces?
score: 0
has answer: http://stackoverflow.com/a/26486852

http://stackoverflow.com/q/26391445
has answer: http://stackoverflow.com/a/26391526
downvote count: 1
has answer: http://stackoverflow.com/a/26391528
type: Question
has body: public class HurdalQuentonA2Q1 { public static void main(String[] args) { double kgs ; double lbs ; double convertLBtoKG = convertLBtoKG(kgs, lbs) ; } static double convertLBtoKG(double lbs) { return lbs * 0.454 ; } static double readWeight() { Scanner input = new Scanner(System.in) ; System.out.println("Enter your preferred system of weight measurement, k(for kg) or, p(for lb)") ; String userinput = input.nextLine() ; if(userinput == "p") { Scanner keyboard = new Scanner(System.in) ; System.out.println("Enter your dog's weight in lbs") ; double lbs = keyboard.nextDouble() ; double kgs = convertLBtoKG ; upon compilation an error pops up stating method convertLBtoKG in class HurdalQuentonA2Q1 cannot be applied to given types required: double found: double,double I have no clue whats causing this
tagged with: java
answer count: 6
score: -1
has title: Method cannot be applied to given type
has answer: http://stackoverflow.com/a/26391470
has answer: http://stackoverflow.com/a/26391476
upvote count: 0
has answer: http://stackoverflow.com/a/26391480
accepted answer: http://stackoverflow.com/a/26391528
favorite count: 0
has comment: http://stackoverflow.com/comment/41435978
has comment: http://stackoverflow.com/comment/41435998
possible better answer: http://stackoverflow.com/a/26391480
has answer: http://stackoverflow.com/a/26391471
type: AnsweredQuestion

http://stackoverflow.com/comment/41515729
has text: @dnault Alright, will take a look when I have the time later.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26435426
type: QuestionComment

http://stackoverflow.com/q/26491553
tagged with: byte
has comment: http://stackoverflow.com/comment/41618045
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41617125
has answer: http://stackoverflow.com/a/26491989
score: 1
linked to: http://stackoverflow.com/q/4211705
linked to: http://stackoverflow.com/q/17727310
tagged with: java
type: Question
has title: Export string with bytes to file without encoding
has comment: http://stackoverflow.com/comment/41617719
answer count: 1
downvote count: 0
has body: I stored bytes within a string in Java String header ="00110011000000011001000000000001001011000000000100000010000000000000000000000000000000000000000000000000000000000000000000000000"; Now i want to write that String to a file, but export that as a series of bits and not encoded as a text. Writing to the file looks like this: BufferedWriter writer = new BufferedWriter (new FileWriter("test.epd")); writer.write(header); How can I do this(The string in this prog will be longer --> around 8kB)
has comment: http://stackoverflow.com/comment/41616883
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/41414546
type: Comment
comment on: http://stackoverflow.com/a/26379698
type: AnswerComment
score: 0
has text: actually it looks like this: something somethings daijf 20310 if this make any difference? so more then 1 space appart? as i said i am new to this

http://stackoverflow.com/q/26425033
tagged with: java
has answer: http://stackoverflow.com/a/26425111
type: Question
tagged with: android-fragmentactivity
answer count: 2
has answer: http://stackoverflow.com/a/26425257
has comment: http://stackoverflow.com/comment/41495317
score: 0
tagged with: android
tagged with: android-activity
tagged with: downcast
has title: Activity Class Downcasting
has comment: http://stackoverflow.com/comment/41495205
has body: I have 2 different activities that can "instantiate" the same fragment. Inside the fragment I need to save a reference to the container activity. MyActivity1 extends FragmentActivity MyActivity2 extends FragmentActivity The reference is stored inside a Fragment class field. I cannot be generic: private Activity activity; and then: activity = getActivity(); This way I cannot use methods implemented for custom MyActivity1/MyActivity2. Downcasting doesn't seem to help as well: if (getActivity() instanceof MyActivity1) { activity = (MyActivity1) getActivity(); activity.mMethod1(); // NOPE } else { activity = (MyActivity2) getActivity(); activity.mMethod2(); // NOPE } Should I use two field (one per activity type) and leave one blank? Any java smarter way to do this? Hope my question is clear.
type: UnansweredQuestion

http://stackoverflow.com/comment/41604454
score: 0
type: Comment
type: QuestionComment
has text: means i can create whole UI of editor in XTEXT no need to use swing?
comment on: http://stackoverflow.com/q/26484557

http://stackoverflow.com/comment/41375250
type: AnswerComment
has text: well based on the `valueOf` signature, `public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name)`, you would need `private static <E extends Enum<E>> E getEnum(Class<E> clazz, String name)`
type: Comment
comment on: http://stackoverflow.com/a/26357618
score: 0

http://stackoverflow.com/a/26437116
answers question: http://stackoverflow.com/q/26433278
accepted answer of: http://stackoverflow.com/q/26433278
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
has body: You can use Font method public Font deriveFont(float size) to obtain desired font size font. Guess the 0.02 shoud be fine.
score: 2

http://stackoverflow.com/comment/41560645
score: 2
comment on: http://stackoverflow.com/q/26460610
type: Comment
type: QuestionComment
has text: You have a serious design flaw. Why you are creating instance of BaseClass in child?

http://stackoverflow.com/q/26356327
has comment: http://stackoverflow.com/comment/41372084
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/41411360
has comment: http://stackoverflow.com/comment/41372026
type: Question
has comment: http://stackoverflow.com/comment/41371956
tagged with: java-native-interface
tagged with: arrays
has title: How to replace the values of string array from java in c using jni?
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/41407641
has body: This is my jni function in which I have to replace the values inside the array passed from java. Please tell me how to do it. JNIEXPORT void JNICALL Java_com_example_finals_Strpass_intake (JNIEnv *env, jobject obj, jobjectArray dev){ jfieldID myNamesID; /* store the field ID */ int i=0; jstring myStr; char* myStr2; char* myNames[] = {"Hello "}; LOGI("before class call "); // Get a reference to obj’s class jclass cls = (*env)-&gt;GetObjectClass(env,obj); LOGI("before id call "); myNamesID = (*env)-&gt;GetStaticFieldID(env,cls, "myDevNames", "[Ljava/lang/String;"); // Get the object field LOGI("before dev call "); dev =(*env)-&gt;GetStaticObjectField(env,cls,myNamesID); LOGI("before for loop call "); for (i=0; i&lt;1; i++) { LOGI("before myStr "); myStr = (*env)-&gt;NewStringUTF(env,"gk"); (*env)-&gt;SetObjectArrayElement(env,dev,i,myStr); } (*env)-&gt;ReleaseCharArrayElements(env, dev, myStr, 0); LOGI("after release"); }
has comment: http://stackoverflow.com/comment/41401501
has comment: http://stackoverflow.com/comment/41407323
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26399116
accepted answer: http://stackoverflow.com/a/26399116

http://stackoverflow.com/q/26412295
upvote count: 5
has title: Difference between these 2 codes?
tagged with: c++
has comment: http://stackoverflow.com/comment/41472726
has comment: http://stackoverflow.com/comment/41472853
has comment: http://stackoverflow.com/comment/41472676
type: Question
possible better answer: http://stackoverflow.com/a/26412403
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/41472920
has answer: http://stackoverflow.com/a/26412403
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/26412469
has comment: http://stackoverflow.com/comment/41472546
accepted answer: http://stackoverflow.com/a/26412469
downvote count: 0
tagged with: inheritance
favorite count: 0
has body: I was wondering why this piece of JAVA code produces a different output than the same code in C++. #include "stdafx.h" #include &lt;iostream&gt; using namespace std; class A { public: A(){ this-&gt;Foo(); } virtual void Foo() { cout &lt;&lt; "A::Foo()" &lt;&lt; endl; } }; class B : public A { public: B() { this-&gt;Foo(); } virtual void Foo() { cout &lt;&lt; "B::Foo()" &lt;&lt; endl; } }; int main(int, char**) { B objB; system("pause"); return 0; } This produces the output: A::Foo() B::Foo() The JAVA code is: public class Testa { public Testa() { this.Foo(); } public static void main(String[] args) { Testb b = new Testb(); } void Foo() { System.out.println("A"); } } class Testb extends Testa { public Testb() { this.Foo(); } @Override void Foo() { System.out.println("B"); } } This code produces only B B Why is this output different in this case?

http://stackoverflow.com/comment/41528073
type: Comment
has text: @Iggy: Binding textures in display lists works just fine. I think the people who struggled doing it were by accident putting the glBindTexture call within a glBegin/glEnd block which never was legal. Texture binding is a feature that got introduced only with OpenGL-1.1. Before that there was no texture binding at all, and instead you'd call glTexImage within a display list to somehow get the same effect (the `wglShareLists` function is named due to that).
type: AnswerComment
comment on: http://stackoverflow.com/a/26435936
score: 0

http://stackoverflow.com/comment/41436890
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26391899
has text: You need to cast the element when you use iterator.next(). Eg: Product m = (Product) productIterator.next()
score: 0

http://stackoverflow.com/comment/42125394
comment on: http://stackoverflow.com/q/26396015
score: 0
type: Comment
type: QuestionComment
has text: Stand alone mode means that its a software that runs on local PC and doe's not require other external computers, although i don't have a lot of experience in Rserve, it seems like you need some external server to use it, while when you use Rengine, you can build a java software that runs on a local machine (iv'e don that, works great)

http://stackoverflow.com/q/26474582
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/41586736
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41586738
has comment: http://stackoverflow.com/comment/41586678
score: -1
has comment: http://stackoverflow.com/comment/41586634
has body: Like in the topic. I have no idea what I'm doing wrong honestly. After charAt it's obviously a char, but I need to get that char from second word... and add a '_' inbetween the two. Help anyone? String[] splited = im_naz.split(" "); char s; String str; c1 = splited[0].charAt(0); c2 = splited[1].charAt(0); str = c1 + '_' + c2; I know I'm doing this wrong, but I honestly have no idea how to do this...
has answer: http://stackoverflow.com/a/26474657
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/26474705
upvote count: 1
has answer: http://stackoverflow.com/a/26474705
has title: I need to extract first char from each word and use a "_"in between after using split()
accepted answer: http://stackoverflow.com/a/26474657
tagged with: char
type: AnsweredQuestion

http://stackoverflow.com/comment/41491916
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26422832
type: Comment
has text: @IanRoberts Interesting. I wonder why it works then. And this may be also the cause of another problem I was facing: http://stackoverflow.com/questions/26393332/getting-the-pom-for-name-is-invalid-transitive-dependencies-if-any-will-no I'll ask them.

http://stackoverflow.com/comment/41790489
type: Comment
comment on: http://stackoverflow.com/q/26501791
has text: @BogdanSahlean I've added the SQL that is sent to the server to this question. Could you please provide an alternative description of how to extract the actual execution plan (without keyboard shortcuts).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/41401755
comment on: http://stackoverflow.com/a/26372436
has text: @KickButtowski: sorry - been working with C++ for too long. Corrected.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41516201
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26435621
type: Comment
has text: @Makoto - With the optimization, the number of links traversed on average in `get(i)` goes from 0.5 N to 0.25 N ... but that is still `O(N)`

http://stackoverflow.com/comment/41469388
comment on: http://stackoverflow.com/q/26410554
type: Comment
has text: Why don't you have control over the chunk of the array each thread works on? This is a common Data Parallelism (fork/join for one) problem which has been addressed by many software products.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/41423569
score: 0
comment on: http://stackoverflow.com/a/26383821
type: Comment
has text: Sorry, I've got lost and overlooked a reference to shipperAgent in your first class. Just removed 4th point in my answer. @Gioce90
type: AnswerComment

http://stackoverflow.com/comment/41446024
score: 0
has text: I am not doing authentication, fetching only request parameters.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26397064

http://stackoverflow.com/q/26415352
type: Question
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/30381753
type: UnansweredQuestion
tagged with: maven
has title: I need help using doxia sink.link() to generate html in mvn custom report
tagged with: java
has body: I am attempting to generate links on my mvn report page using the sink.link(String text) method. My code looks like this: sink.link("json-schema/ClusterStatusMessage.schema.json"); sink.link_(); This is resulting in an html snippet that looks like this: I want the html snippet to look like this Link Display Text Here So that the link will actually be displayed. Unfortunately I have been unable to make the call to .link(...) do what I want. I suspect I need to pass in a SinkEventAttributes, but am unsure which fields to set. Any help is appreciated.

http://stackoverflow.com/comment/41379189
comment on: http://stackoverflow.com/q/26360602
score: 1
type: Comment
type: QuestionComment
has text: Whats the issue with adding the data one after each other (reading from each csv file and adding to the table)? If you need to sort it, you can add data from the files to an arraylist and use the Collections.sort method, then display it in the JTable.

http://stackoverflow.com/a/26523603
has body: Ok, firstly, you are creating Outlook.Application in a way I've never seen before - I've only ever seen the Active X Component way: e.g. ActiveXComponent xl = new ActiveXComponent("Outlook.Application"); Dispatch explorer = Dispatch.get(xl,"ActiveExplorer").toDispatch(); Dispatch selection = Dispatch.get(explorer, "Selection").toDispatch(); Variant count = Dispatch.get(selection, "Count"); // loop over selected mail items. for (int mailIndex = 1; mailIndex &lt;= count.getInt(); mailIndex++ ) { Dispatch mailItem = Dispatch.call(selection, "Item", new Variant(mailIndex)).toDispatch(); Variant subject = Dispatch.get(mailItem, "Subject"); // .... and so on } Secondly, your code is not saving the mail, its pulling out all the fields and attachments and trying to recreate the mail, which seems inaccurate at best and will only be an approximation of what the message was. Why don't you just use the COM objects to SaveAs the whole .msg file to disk? Then if you need to access it again you can use something like JDIC to launch Outlook and pop up the message in its original glory, including all attachments?
has comment: http://stackoverflow.com/comment/41693533
type: Answer
has comment: http://stackoverflow.com/comment/41694048
answers question: http://stackoverflow.com/q/26470999
has comment: http://stackoverflow.com/comment/41728429
has comment: http://stackoverflow.com/comment/41694956
has comment: http://stackoverflow.com/comment/41693910
has comment: http://stackoverflow.com/comment/41685646
has comment: http://stackoverflow.com/comment/41701952
score: 0

http://stackoverflow.com/q/26501593
type: Question
answer count: 2
tagged with: android-layout
has comment: http://stackoverflow.com/comment/41644086
has title: Scrollview not start from top
upvote count: 2
tagged with: android
has body: I have an activity that has a ScrollView, and for some reason when the activity loads, it does not start from the top but somewhere in the middle. I tried to work this out in the code but that was unsuccessful. I even tried in the XML by adding android:windowSoftInputMode="stateHidden" Since I have quite a few EditText in that Acitivity, but all attempts have been unsuccessful. Below is the layout code: Any help would be greatly appreciated Update: &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollProfile" android:layout_width="match_parent" android:layout_height="match_parent" android:alpha="0.9" android:background="#ffffff" &gt; &lt;RelativeLayout android:id="@+id/main" android:layout_width="match_parent" android:layout_height="797dp" android:descendantFocusability="beforeDescendants" &gt; &lt;TextView android:id="@+id/tASearchDistance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="39dp" android:gravity="left" android:text="Profile Creation" android:textColor="#ffffff" android:textSize="28sp" android:textStyle="bold" android:typeface="sans" /&gt; &lt;TextView android:id="@+id/tSex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/etxtname" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" android:text="Upload your Profile Picture" android:textColor="#f2f2f2" android:textSize="18sp" android:textStyle="bold" android:typeface="sans" /&gt; &lt;RadioGroup android:id="@+id/radioGroup1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/etxtheadline" android:layout_below="@+id/texperience" &gt; &lt;RadioButton android:id="@+id/rimale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="Male" android:textColor="#000" /&gt; &lt;RadioButton android:id="@+id/…
tagged with: android-activity
favorite count: 0
tagged with: scrollview
accepted answer: http://stackoverflow.com/a/26501942
has comment: http://stackoverflow.com/comment/41635788
has answer: http://stackoverflow.com/a/26501942
has comment: http://stackoverflow.com/comment/41635081
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/26501992
downvote count: 0
has comment: http://stackoverflow.com/comment/41635020
tagged with: java
has answer: http://stackoverflow.com/a/26501992

http://stackoverflow.com/comment/41415254
comment on: http://stackoverflow.com/q/26379653
has text: @Zhuinden who's talking of Android here? I guess your comment even adds more confusion than clarifying anything...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26369427
has body: There is no limitation that annotation values can't have static and/or wildcard imports. The error indicates that the value is of the type ExampleParam - The issue here is that the method's parameter has the same name as the imported constant: paramConstant In the example with the ExampleConstants.paramConstant the value is more specific and therefore isn't hidden any more. Rename the parameter, so it doesn't hide the imported value any more: public Object control(@Param(paramConstant) ExampleParam exampleParam)
score: 2
answers question: http://stackoverflow.com/q/26368813
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41396293
accepted answer of: http://stackoverflow.com/q/26368813
upvote count: 2
type: Answer

http://stackoverflow.com/comment/41643606
score: 0
type: Comment
has text: Take the image that you have posted in your question. A round layout is under the layout in which you have given background.I have reversed the process in the above example.
comment on: http://stackoverflow.com/a/26398176
type: AnswerComment

http://stackoverflow.com/comment/41423669
score: 0
type: Comment
type: QuestionComment
has text: [The documentation](http://junit.sourceforge.net/javadoc/org/junit/runner/Description.html#createTestDescription%28java.lang.Class,%20java.lang.String,%20java.lang.annotation.Annotation...%29) certainly suggests annotations are for this purpose: "*annotations - meta-data about the test, for downstream interpreters*". I'm a little unclear about your actual question though - have you tried this and failed? Are you unsure if this is the right approach?
comment on: http://stackoverflow.com/q/26371441

http://stackoverflow.com/a/26500605
has comment: http://stackoverflow.com/comment/41633400
has comment: http://stackoverflow.com/comment/41633804
has comment: http://stackoverflow.com/comment/41633980
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26500578
has comment: http://stackoverflow.com/comment/41633419
score: 0
answers question: http://stackoverflow.com/q/26500578
type: Answer
has comment: http://stackoverflow.com/comment/41634124
has body: first you should split .you can't access token[0] before declare tokens String function = "[+\\-*/]+"; //this String[] token = input.split(function );//and this then use array[index] double num1 = Double.parseDouble(token[0]); double num2 = Double.parseDouble(token[2]); edit.... you should use .matches instead .equals because .equals looking for entire String not regular expression complete code Scanner scan = new Scanner(System.in); System.out.println("enter your operation"); String input = scan.next(); String function = "[+\\-*/]+"; //this String[] token = input.split(function);//and this double num1 = Double.parseDouble(token[0]); double num2 = Double.parseDouble(token[1]); double answer; String operator = input.toCharArray()[token[0].length()]+""; if (operator.matches(function) &amp;&amp; (token[0]+token[1]+operator).length()==input.length()) { System.out.println("Operation is " + operator+ ", numbers are " + token[0] + " and " + token[1]); } else { System.out.println("Your entry of " + input + " is invalid"); } output>> for input "2+3" &gt; Operation is +, numbers are 2 and 3 for input "24+45" &gt; Operation is +, numbers are 24 and 45 for input "2++4" &gt; Your entry of 2++4 is invalid
has comment: http://stackoverflow.com/comment/41633446
has comment: http://stackoverflow.com/comment/41633849
has comment: http://stackoverflow.com/comment/41633914
has comment: http://stackoverflow.com/comment/41633670

http://stackoverflow.com/comment/41396133
comment on: http://stackoverflow.com/a/26369317
score: 0
type: AnswerComment
has text: @DanielH Not bad practice at all!
type: Comment

http://stackoverflow.com/a/26478523
answers question: http://stackoverflow.com/q/26440776
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43022175
has comment: http://stackoverflow.com/comment/41618488
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41601896
has body: Timers are distinct, so if you create two, then the @Timeout method will be invoked for both timers regardless of whether the scheduling information is the same.
accepted answer of: http://stackoverflow.com/q/26440776
has comment: http://stackoverflow.com/comment/41610331
has comment: http://stackoverflow.com/comment/41602033
type: Answer

http://stackoverflow.com/q/26499215
tagged with: java
score: -1
type: Question
upvote count: 0
accepted answer: http://stackoverflow.com/a/26499422
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41630944
tagged with: jdbc
has title: JDBC with MySQL Connecting Very Slowly
has answer: http://stackoverflow.com/a/26499422
tagged with: mysql
downvote count: 1
type: AnsweredQuestion
has body: Currently I'm working in Java, and have been experimenting more with implementing a database into my project. Below is my current code to connect to the database (using one database, username, and password, hard-coded, as this is a personal): try { Class.forName("com.mysql.jdbc.Driver"); String connString = String.format("jdbc:mysql://%s:3306/%s?user=%s&amp;password=%s", HOST, DB, USERNAME, PASSWORD); long then = System.currentTimeMillis(); System.out.println("Connecting... "); this.conn = DriverManager.getConnection(connString); long now = System.currentTimeMillis(); System.out.println("\tTIME ELAPSED: " + (now - then) / 1000); } catch(SQLException e){ e.printStackTrace(); System.out.println("Couldn't get Connection"); this.conn = null; } catch (ClassNotFoundException e) { e.printStackTrace(); this.conn = null; } However, I've narrowed down that the DriverManager.getConnection() method is taking 23 seconds every single time to the database I'm connecting to (even the very first connection establishment). I can guarantee that all ResultSet objects and connections are being properly closed, and that all connection information is valid. I'm using my school's computer science provided MySQL account, and can verify that it is not slow to connect through any other means (MySQL Workbench, etc.). Is there anything that I'm missing that could be doing this? All querying of the database after the initial connection is super fast, it's just the connection itself that is terribly slow. Thanks! UPDATE: I started using connection pooling as mentioned in the comments (following Apache DBCP), and the problem still persists. Here's the code I'm using to set up the pooling: ds = new BasicDataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); String connString = String.format("jdbc:mysql://%s:3306/%s", HOST, db); ds.setUrl(connString); ds.setUsername(USERNAME); ds.setPassword(PASSWORD); ds.setMaxActive(1000); ds.setMaxWait(10000); ds.setMaxIdle(10); try { long then = System.cu…

http://stackoverflow.com/comment/41619002
type: Comment
comment on: http://stackoverflow.com/a/26492237
score: 0
type: AnswerComment
has text: @user1104028, and you didn't post a `SSCCE`, so how do you expect us to help based on 2 lines of code??? Does your component have focus? Maybe you are using the wrong `InputMap`. If you want help read the entire answer and provde the code we need to help solve the problem. We don't have time for 20 questions!!!

http://stackoverflow.com/comment/41408315
has text: @BoristheSpider can you please give me some more info about how to do it with web.xml and not using xml
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26375573

http://stackoverflow.com/comment/41384870
score: 0
comment on: http://stackoverflow.com/q/26363542
has text: That's how xml works - any standard xml parser should parse `&amp;` as `&`.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26474153
type: Question
has comment: http://stackoverflow.com/comment/41589473
upvote count: 0
accepted answer: http://stackoverflow.com/a/26478332
score: -1
has body: Hey guys I just got my first java job but if things go well I may never need to code again. What I need to do is connect to a database and apply interest to a large number of transactions. I am having trouble getting the math to work right on my local machine. This must be correct to within a fraction of a cent. Any ideas? Thanks in advance! public Connection getConnection() throws SQLException { Connection conn = null; Properties connectionProps = new Properties(); connectionProps.put("user", "MY_USER"); connectionProps.put("password", "MY_PASSWORD"); if (this.dbms.equals("mysql")) { conn = DriverManager.getConnection( "jdbc:" + this.dbms + "://" + "YR1F4K3QAS3RV3R" + ":" + this.portNumber + "/", connectionProps); } else if (this.dbms.equals("derby")) { conn = DriverManager.getConnection( "jdbc:" + this.dbms + ":" + this.dbName + ";create=true", connectionProps); } System.out.println("Connected to database"); return conn; } public static void ApplyInterestToHighVolumeAccounts(Connection con, String dbName, String InterestToApply) throws SQLException { Statement stmt = null; String query = "select * "from " + dbName + ".HighVolumeAccounts"; try { stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { String AccountName = rs.getString("AccountName"); int AccountNumber = rs.getInt("AccountNumber"); int Balance = rs.getInt("Balance"); int Interest = InterestToApply int newBalance = Balance + (Balance * Interest) - (Balance * 0.00000001%) int AddToRetirement = Balance * 0.000001% String GetRich = "UPDATE TBL_Accounts SET Balance=Balance" + AddToRetirement + " WHERE AccountName=PrivateAccountInTheCaymens"; ResultSet rs = stmt.executeQuery(GetRich); String AdjustBalance = "UPDATE TBL_Accounts SET Balance=Balance" + newBalance + " WHERE AccountName=AccountName"; ResultSet rs = stmt.executeQuery(AdjustBalance); } } catch (SQLException e ) { JDBCTutorialUtilities.printSQLException(e); } finally { if (stmt != null) { stmt.close(); } } }
has comment: http://stackoverflow.com/comment/41586061
has comment: http://stackoverflow.com/comment/41586847
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41585772
has title: Getting Fractions of a Cent
has comment: http://stackoverflow.com/comment/41585764
has comment: http://stackoverflow.com/comment/41585755
has answer: http://stackoverflow.com/a/26478332
has comment: http://stackoverflow.com/comment/41585844
type: AnsweredQuestion
tagged with: math
tagged with: java
has comment: http://stackoverflow.com/comment/41589848
has comment: http://stackoverflow.com/comment/41585758
downvote count: 1

http://stackoverflow.com/q/26387205
has title: Adding import after line is written?
tagged with: java
score: -1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26387555
accepted answer: http://stackoverflow.com/a/26387555
tagged with: android
downvote count: 1
tagged with: android-studio
upvote count: 0
type: Question
type: AnsweredQuestion
has body: Android Studio automatically adds imports when choosing the right one from a list. However I often find myself typing the whole line myself and get the Cannot resolve symbol... error. In Eclipse I would hover over the yet to be imported class and get the option to add this, is this somehow possible with Android Studio? One would think it would be listed add the error (red light bulb) but it just asks me if I want to create the class.

database
tags question: http://stackoverflow.com/q/26426944
tags question: http://stackoverflow.com/q/26369165
tags question: http://stackoverflow.com/q/26505645
tags question: http://stackoverflow.com/q/26457823
tags question: http://stackoverflow.com/q/26382368
tags question: http://stackoverflow.com/q/26379925
tags question: http://stackoverflow.com/q/26355615
type: Tag
tags question: http://stackoverflow.com/q/26389011
tags question: http://stackoverflow.com/q/26443952
tags question: http://stackoverflow.com/q/26482046
tags question: http://stackoverflow.com/q/26449946
tags question: http://stackoverflow.com/q/26373578
tags question: http://stackoverflow.com/q/26497409
tags question: http://stackoverflow.com/q/26396469
tags question: http://stackoverflow.com/q/26482648
tags question: http://stackoverflow.com/q/26411228
tags question: http://stackoverflow.com/q/26496408
tags question: http://stackoverflow.com/q/26385780
tags question: http://stackoverflow.com/q/26448300
tag name: database
tags question: http://stackoverflow.com/q/26415573
tags question: http://stackoverflow.com/q/26360602
tags question: http://stackoverflow.com/q/26444591
tags question: http://stackoverflow.com/q/26417089
tags question: http://stackoverflow.com/q/26465656
tags question: http://stackoverflow.com/q/26394533
tags question: http://stackoverflow.com/q/26486844
tags question: http://stackoverflow.com/q/26438761
tags question: http://stackoverflow.com/q/26464997
tags question: http://stackoverflow.com/q/26409951
tags question: http://stackoverflow.com/q/26491049
tags question: http://stackoverflow.com/q/26480665
tags question: http://stackoverflow.com/q/26465823
tags question: http://stackoverflow.com/q/26384468
tags question: http://stackoverflow.com/q/26381394
tags question: http://stackoverflow.com/q/26426245
tags question: http://stackoverflow.com/q/26489171
tags question: http://stackoverflow.com/q/26378324
tags question: http://stackoverflow.com/q/26452846

http://stackoverflow.com/comment/41508456
comment on: http://stackoverflow.com/a/26427865
has text: @TheRevguin, did you verify that the code is executing properly? If you have the reference to the table that is displayed in the GUI then the code will work. Maybe your table reference is wrong.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41753088
comment on: http://stackoverflow.com/a/26559889
type: Comment
has text: But it just still shows "The home directory does not exist", so I'm very confused. Sorry to ask again. But any more help is really appreciated!
score: 0
type: AnswerComment

http://stackoverflow.com/a/26421928
type: Answer
accepted answer of: http://stackoverflow.com/q/26421715
answers question: http://stackoverflow.com/q/26421715
has body: Are you aware of this notation? (.. System (getProperties) (get "os.name")) Notice the two dots. Which will expand to: (. (. System (getProperties)) (get "os.name")) Java Interop on Clojure.org.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/26481910
has answer: http://stackoverflow.com/a/26497613
upvote count: 11
tagged with: graphviz
has answer: http://stackoverflow.com/a/77170585
has comment: http://stackoverflow.com/comment/80459474
downvote count: 1
has title: How to call GraphViz from java
has answer: http://stackoverflow.com/a/26482170
accepted answer: http://stackoverflow.com/a/26482170
favorite count: 0
linked to: http://stackoverflow.com/q/3050056
answer count: 4
has answer: http://stackoverflow.com/a/61236008
type: AnsweredQuestion
type: Question
possible better answer: http://stackoverflow.com/a/26497613
has body: How to call GraphViz from java and how to call GraphViz functions using java? What are the necessary jar files that are to be included inorder to access the GraphViz library for building a dot graph? Is there any sample program for generating a dot graph
tagged with: java
score: 10

http://stackoverflow.com/q/26379036
has comment: http://stackoverflow.com/comment/41413860
downvote count: 0
has body: Is there a possibility to sort the folders in the Package Explorer alphabetically?
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/41413547
type: Question
tagged with: ide
has answer: http://stackoverflow.com/a/26379509
upvote count: 1
has comment: http://stackoverflow.com/comment/41413488
answer count: 1
has title: Eclipse sort folders alphabetically in Maven project
has comment: http://stackoverflow.com/comment/41914475
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/41413962

http://stackoverflow.com/a/26431718
answers question: http://stackoverflow.com/q/26431581
has body: Copied from this answer: Use the keys() iterator to iterate over all the properties, and call get() for each. Iterator&lt;String&gt; iter = json.keys(); while (iter.hasNext()) { String key = iter.next(); try { Object value = json.get(key); } catch (JSONException e) { // Something went wrong! } }
has comment: http://stackoverflow.com/comment/41509113
has comment: http://stackoverflow.com/comment/41512038
accepted answer of: http://stackoverflow.com/q/26431581
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/41511982
type: AcceptedAnswer

http://stackoverflow.com/a/26470838
type: AcceptedAnswer
type: Answer
has body: You'll need to fix the JRE System Library Dependency in you Build Path. Project -> Properties -> Build Path -> Library (Tab). Remove the (may) existing JRE System Library Use the Add Library button to add a Library. In the Dialog choose JRE System Library -> Next. On the next page you can either choose one or if you click on Installed JREs... you are able to define a new JRE which you can use afterwards.
answers question: http://stackoverflow.com/q/26470524
score: 0
accepted answer of: http://stackoverflow.com/q/26470524

http://stackoverflow.com/comment/41519243
type: Comment
comment on: http://stackoverflow.com/a/26436664
score: 0
type: AnswerComment
has text: try assembling the data in two list inside method one and two. One list for `id` and `type` and another one for `name`. Once you have these list, then read the data from these list in order to create `Kads` object and prepare `kads` arraylist.

http://stackoverflow.com/a/26600045
has comment: http://stackoverflow.com/comment/41814657
type: Answer
has body: It's also worth to be careful in deserialize() with return fmt.parseLocalDate(json.toString()); as it produces the likely unexpected quotation marks ""2014-10-28"". It may be better to use instead: return fmt.parseLocalDate(json.getAsString());
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26411379
upvote count: 3

http://stackoverflow.com/a/26492848
score: 1
upvote count: 1
has body: Group the values that cancel each other out. Try using the following: double erg = ((x1 * y1) + (x3 * y3)) + ((x2 * y2) +(x5 * y5)) + ((x4 * y4) + (x6 * y6));
has comment: http://stackoverflow.com/comment/41619573
has comment: http://stackoverflow.com/comment/41619951
has comment: http://stackoverflow.com/comment/41619387
has comment: http://stackoverflow.com/comment/41619598
accepted answer of: http://stackoverflow.com/q/26492620
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41619572
type: Answer
answers question: http://stackoverflow.com/q/26492620

http://stackoverflow.com/q/26392639
tagged with: linux
tagged with: java-6
has body: I was trying to find a download for jdk 1.6 specifically for OS X. But Oracle doesn't seem to offer one. This made me wonder if the jdk 1.6 meant for Linux would work fine on OS X. I could try running it to see if it works. But I thought I'd check here to see if there are any subtle or not-so-subtle issues that I've missed. I have an AMD-64 architecture on my mac system.
has comment: http://stackoverflow.com/comment/125918437
tagged with: macos
type: AnsweredQuestion
upvote count: 1
type: Question
has title: Installing jdk meant for linux on OS X
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26393228
accepted answer: http://stackoverflow.com/a/26393228
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/26465828
score: 1
upvote count: 1
has body: You have to add parentheses so the result of your XOR and not only the first argument will be converted to char. System.out.println((char) (244^128));
downvote count: 0
answers question: http://stackoverflow.com/q/26465692
type: Answer

http://stackoverflow.com/a/26383216
has comment: http://stackoverflow.com/comment/41421076
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/41421209
upvote count: 3
has body: You are mocking the wrong object. You are trying to test SampleDaoImpl.someMethod(), so you must create a concrete SampleDaoImpl instance, not a mocked one. Once you have a concrete instance, you can then call setJdbcTemplate() and pass in a mocked JdbcTemplate object. Finally, you can control the behaviour of that mock so that when query() is invoked by someMethod(), your preferred data is returned. For example: public class MockSampleDao { // parameterized stuff omitted for brevity @Test public void testSomeMethod() throws Exception { SampleDaoImpl impl = new SampleDaoImpl(); JdbcTemplate template = mock(JdbcTemplate.class); List&lt;String&gt; someList = // populate this list when(template.query(....)).thenReturn(someList); impl.setJdbcTemplate(template); impl.someMethod(param1, param2); // further testing etc. } }
has comment: http://stackoverflow.com/comment/41421040
answers question: http://stackoverflow.com/q/26382924
has comment: http://stackoverflow.com/comment/41421290
downvote count: 0

http://stackoverflow.com/q/26381696
has body: I have a question ... I have an implementation of a simple "Hello World" application on Java JAX-WS: I did not get access to the methods, specifically "getHelloWorldAsString". I tried jquery and plugin "jquery.soap". How can I call a method from JavaScript? Can you give me an example? Or what do I change in Java code? ITest.java File: package ru.ntcsiz.searcher.search.test; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; //Service Endpoint Interface @SOAPBinding(style = Style.RPC) public interface ITest { @WebMethod String getHelloWorldAsString(String name); } TestClass.java: package ru.ntcsiz.searcher.search.test; import javax.jws.WebService; //Service Implementation @WebService(endpointInterface = "ru.ntcsiz.searcher.search.test.ITest") public class TestClass implements ITest { @Override public String getHelloWorldAsString(String name) { return "Hello World! It's works! " + name; } } TestClassPublisher.java: package ru.ntcsiz.searcher.search.test; import javax.xml.ws.Endpoint; public class TestClassPublisher { public static void main(String[] args) { Endpoint.publish("http://localhost:9999/ws/test", new TestClass()); } }
tagged with: java
tagged with: javascript
has answer: http://stackoverflow.com/a/26390999
accepted answer: http://stackoverflow.com/a/26390999
score: 0
has title: "Hello World" application on Java JAX-WS
answer count: 1
tagged with: jquery
type: AnsweredQuestion
tagged with: jax-ws
tagged with: web-services
type: Question

http://stackoverflow.com/comment/41557621
score: 0
type: Comment
type: QuestionComment
has text: @chaim I Tried to place a smaller 200kb square PNG image, nothing changed
comment on: http://stackoverflow.com/q/26448943

http://stackoverflow.com/q/26450715
answer count: 1
favorite count: 0
tagged with: apache-httpclient-4.x
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26450834
linked to: http://stackoverflow.com/q/19201829
type: Question
has title: HttpClient Get images from response
has body: I'm using Apache HttpClient to perform GET/POST requests, I was wondering if you could save the images loaded/retrieved by a response, without having to download them again with their URLs. This question has been asked like one year ago, but no one answered: Can I get cached images using HttpClient? I tried: CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet(url); HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); FileOutputStream fos = new FileOutputStream(new File("img.png")); int inByte; while ((inByte = is.read()) != -1) { fos.write(inByte); } is.close(); fos.close(); but apparently it's downloading only text, can i make HttpClient download images of that particular URL or not? Is this doable or not?
downvote count: 0
accepted answer: http://stackoverflow.com/a/26450834

http://stackoverflow.com/q/26413844
tagged with: java
has comment: http://stackoverflow.com/comment/41476060
has comment: http://stackoverflow.com/comment/41475955
tagged with: beaver
type: Question
has answer: http://stackoverflow.com/a/26414221
tagged with: object
has comment: http://stackoverflow.com/comment/41475815
has comment: http://stackoverflow.com/comment/41475971
score: 0
has body: I am writing an Android application which gets string to parse using regex. Let's say it gets 'Tis an example image of a beaver {[beaver.jpg]} having an afternoon tea. And what I want to get is TextView with 'Tis an example image of a beaver, ImageView beaver.jpg and an another TextView having an afternoon tea.. How (if possible) is creating objects possible after reading such string and parsing with regex?
has comment: http://stackoverflow.com/comment/41475995
answer count: 1
has comment: http://stackoverflow.com/comment/41475776
type: UnansweredQuestion
tagged with: android
tagged with: regex
has title: Making objects in Android from regex

http://stackoverflow.com/a/26455611
answers question: http://stackoverflow.com/q/26429967
has body: I'm afraid there is no obvious way to get it. But all the examples in Spring-Security reference manual are coherent on that : you should not even want to get it : all show an explicit SessionAuthenticationStrategy injected in the UserNamePasswordAuthenticationFilter and if appropriate in the SessionManagementFilter. According to the javadocs of these 2 classes, the default SessionAuthenticationStrategy are : SessionFixationProtectionStrategy for Servlet &lt; 3.1 ChangeSessionIdAuthenticationStrategy for Servlet 3.1+ So the correct way is to create a bean implementing SessionAuthenticationStrategy either one of the above defaults, or another implementation if you have special needs and use it wherever you need to. Of course, it is always possible to use reflection to access private members of Spring security implementation classes, but you know it is bad and comes with high risk of getting broken on next release of Spring security.
score: 4
has comment: http://stackoverflow.com/comment/87822333
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/q/26384193
score: 1
tagged with: java
has title: Java Array Index Out of Bounds Exception Processing
has answer: http://stackoverflow.com/a/26384428
has comment: http://stackoverflow.com/comment/41422689
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/41422967
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/41422974
has answer: http://stackoverflow.com/a/26384275
has body: Given the following Java codes: int test = createIntData(Column[8]); private int createIntData (String realData) { if (realData == null) { return (int) (Math.random()*100); } else { return Integer.parseInt(realData); } } This throws exception like this： Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException This is because the argument only have an maximum index of 4. Then how to change the program to realize the function that: once the argument is out of index, return the value: Math.random() * 100
answer count: 3
accepted answer: http://stackoverflow.com/a/26384428
downvote count: 0
possible better answer: http://stackoverflow.com/a/26384275
favorite count: 0
has comment: http://stackoverflow.com/comment/41422756
has comment: http://stackoverflow.com/comment/41422562
has answer: http://stackoverflow.com/a/26384292
has comment: http://stackoverflow.com/comment/41422682
type: AnsweredQuestion

http://stackoverflow.com/q/26506418
favorite count: 0
has comment: http://stackoverflow.com/comment/41643522
tagged with: android
has title: JSON Parsing in Java Webservice of multiple JSONObjects in JSONObject
accepted answer: http://stackoverflow.com/a/26506985
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7304002
score: -4
has comment: http://stackoverflow.com/comment/41645019
type: Question
has body: This is my JSON string, { "listmain":{ "16":[{"brandid":"186"},{"brandid":"146"},{"brandid":"15"}], "17":[{"brandid":"1"}], "18":[{"brandid":"12"},{"brandid":"186"}], } } I need to get values in "16","17","18" tag and add values and ids("16","17","18") to two ArrayList. What i meant is, when we take "16", the following process should happen, List&lt;String&gt; lsubid = new ArrayList&lt;String&gt;(); List&lt;String&gt; lbrandid = new ArrayList&lt;String&gt;(); for(int i=0;i&lt;number of elements in "16";i++) { lsubid.add("16"); lbrandid.add("ith value in tag "16" "); } finally the values in lsubid will be---> [16,16,16] the values in lbrandid will be---> [186,146,15] Can anyone please help me to complete this.
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26506985
downvote count: 4
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/41526170
comment on: http://stackoverflow.com/q/26441409
has text: You're just referring to your generic type parameter by the name `Integer` instead of `T`. It has no relation to the class `Integer`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26488340
type: AnsweredQuestion
has body: I am using the following code from the internet to get data from a database: ResultSet rs = statement.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); System.out.println("querying SELECT * FROM XXX"); int columnsNumber = rsmd.getColumnCount(); while (rs.next()) { for (int i = 1; i &lt;= columnsNumber; i++) { if (i &gt; 1) System.out.print(", "); String columnValue = rs.getString(i); System.out.print(columnValue + " " + rsmd.getColumnName(i)); } System.out.println(""); //&lt;------------- } Inside the while loop there is the empty println (arrow ^) If I remove this empty println, the data doesnt show in my console, but if I leave it there it does (I have only one line in my database, so probably it just skips the last line if I have more data). Why doesnt it show my single line of data if i leave out the empty println??? Thx!
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41611078
has comment: http://stackoverflow.com/comment/41611023
type: Question
tagged with: for-loop
answer count: 1
downvote count: 1
tagged with: println
favorite count: 0
tagged with: while-loop
tagged with: sql
upvote count: 0
has title: Java sql doesnt show data without empty println
has answer: http://stackoverflow.com/a/26488479
has comment: http://stackoverflow.com/comment/41610813
accepted answer: http://stackoverflow.com/a/26488479

http://stackoverflow.com/a/26852187
has comment: http://stackoverflow.com/comment/52204642
type: Answer
has body: In the end it turned out that you actually have to replace more jars than Oracle suggests. Here's what my weblogic-application.xml looks like : <prefer-application-packages> com.sun.jersey.* org.glassfish.jersey.* org.glassfish.hk2.* org.jvnet.hk2.* jersey.repackaged.org.objectweb.asm.* com.sun.research.ws.wadl.* com.sun.ws.rs.ext.* org.codehaus.jackson.* com.fasterxml.jackson.* org.codehaus.jettison.* javax.ws.rs.* org.objectweb.asm.* antlr.* </prefer-application-packages> Hope it helps.
answers question: http://stackoverflow.com/q/26361136
downvote count: 0
score: 24
accepted answer of: http://stackoverflow.com/q/26361136
has comment: http://stackoverflow.com/comment/119060274
has comment: http://stackoverflow.com/comment/65811299
type: AcceptedAnswer
upvote count: 24
has comment: http://stackoverflow.com/comment/52183424

http://stackoverflow.com/q/26375239
has comment: http://stackoverflow.com/comment/41406845
has title: C# override function how to return null
score: 0
has comment: http://stackoverflow.com/comment/41407058
answer count: 2
has comment: http://stackoverflow.com/comment/41406739
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/41406676
has answer: http://stackoverflow.com/a/26375358
type: UnansweredQuestion
tagged with: inheritance
has body: So I am trying to implement some inheritance and I am running into an issue. I am coming from java so I am basically trying to convert code. So for example in java you might have this. public class galaxyFactory extends abstractFactory { @Override public galaxy setType() { return new Spiral(); } @Override SolarSystem setType() { return null; } } This will return a new Spiral object if your after a galaxy, and overrides the SolarSystem setType with a simple return null. However when trying to convert this into c# i come up with something like this. Which DOES NOT work, it errors out with "NullReferenceException was unhandled" class GalaxyFactory: AbstractFactory { public override Galaxy CreateProductA() { return new spiral(); } public override SolarSystem CreateProductB() { return null; } } What would I have to change my return null to get the same effect in c#?
has answer: http://stackoverflow.com/a/26375249
type: Question

http://stackoverflow.com/comment/76010460
has text: It is now possible to use getObject() and putObject() on vars.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26382379

http://stackoverflow.com/q/26478295
has body: I want to transform a field of a class to be effectively a constant. I'm using ASM 5.0.3. Here is the test class I have: public class BytecodeUtilsTest { @BeforeClass public static void beforeClass(){ String replaceFieldClassName = "com.mypackage.ClassWithFieldToReplaceWithConstant"; String replaceFieldClassNameAsPath = replaceFieldClassName.replace('.', '/') + ".class"; // standard code to redefine class (inspired by ASM FAQ http://asm.ow2.org/doc/faq.html, sec. 5) ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); InputStream stream = contextClassLoader.getResourceAsStream(replaceFieldClassNameAsPath); byte[] classBytes; try { classBytes = IOUtils.toByteArray(stream); // here is the interesting part byte[] patchedClassBytes = BytecodeUtils.patch(classBytes, "_fieldToReplace", true); Reflection.invoke(contextClassLoader, "defineClass", Class.class, new Class[]{String.class, byte[].class, int.class, int.class}, new Object[]{replaceFieldClassName, patchedClassBytes, 0, patchedClassBytes.length}); } catch (IOException e) { throw new RuntimeException(e); } } @Test public void testFieldReplace(){ Assert.assertTrue(new ClassWithFieldToReplaceWithConstant().getFieldToReplace()); Assert.assertTrue(new ClassWithFieldToReplaceWithConstant()._fieldToReplace); } } Here is the test class to update: public class ClassWithFieldToReplaceWithConstant { boolean _fieldToReplace; public boolean getFieldToReplace() { return _fieldToReplace; } } And here is the patcher: public class BytecodeUtils { public static byte[] patch(byte[] bytecode, final String fieldToReplace, final boolean value) { ClassReader classReader = new ClassReader(bytecode); final ClassWriter classWriter = new ClassWriter(classReader, 0); ClassVisitor classVisitor = new ClassVisitor(Opcodes.ASM4, classWriter) { @Override public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { return new MethodVisitor(Opcodes.ASM4, super.visitMethod(…
score: 0
answer count: 1
has title: How to replace boolean field with a constant value using ASM
has answer: http://stackoverflow.com/a/26478553
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41600453
tagged with: java
accepted answer: http://stackoverflow.com/a/26478553
has comment: http://stackoverflow.com/comment/41660028
type: Question

http://stackoverflow.com/comment/117340702
comment on: http://stackoverflow.com/a/58799822
type: AnswerComment
score: 0
type: Comment
has text: Other than this solution waste resources, I had a functional problem. When using ListAdapter and submitList() method with a List of data with one less item, and that one less item was the last one that displayed the footer, the footer never displayed. I think it is because itemCount (in combination with DiffUtil) remains the same. Beware. I think the best solution is this one https://medium.com/androiddevelopers/merge-adapters-sequentially-with-mergeadapter-294d2942127a

http://stackoverflow.com/q/26376312
score: 0
accepted answer: http://stackoverflow.com/a/26380005
answer count: 1
tagged with: java
tagged with: eclipse
has body: I created an Aspectj project and added .aj files and java files. While compiling(Load-time) it shows the error "Error: Could not find or load main class javaagent:path/aspectjweaver-1.8.2.jar" I compiled it in eclipse by creating Load time configuration file. Can any one tell me why
tagged with: aspectj
type: AnsweredQuestion
has title: Error while load-time compiling
type: Question
has answer: http://stackoverflow.com/a/26380005

http://stackoverflow.com/a/31737626
score: 5
downvote count: 0
type: Answer
has body: When using Spring Boot, just having a bean as below would also work. @Bean public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); converter.setJsonPrefix(")]}',\n"); return converter; } Here is an example from the Spring Lemon project.
upvote count: 5
answers question: http://stackoverflow.com/q/26384930

http://stackoverflow.com/comment/41419224
score: 0
comment on: http://stackoverflow.com/q/26382370
type: Comment
type: QuestionComment
has text: It's nothing but a PreferenceScreen... You need to read something about Preferences, uh? For reference: http://developer.android.com/guide/topics/ui/settings.html

http://stackoverflow.com/q/26481615
score: 0
linked to: http://stackoverflow.com/q/16142311
tagged with: android
has title: Save zip file android
has body: NODE.js : (zip the file) app.post('/api/db', function(req, res){ if(req.body.type == 'Control'){ var zip = new AdmZip(); console.log(req.body.type); zip.addLocalFolder(__dirname +'/XXX/Temp/1'); var willSendthis = zip.toBuffer(); zip.writeZip(__dirname +'/files.zip'); res.sendFile(zip); } }); JAVA : (send a request to want to zip file) public class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; { public ArrayList&lt;String&gt; aList= new ArrayList&lt;String&gt;(); protected void onPreExecute() { super.onPreExecute(); } protected String doInBackground(String... args) { List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(); params.add(new BasicNameValuePair("type", "Control")); JSONObject json = jsonParser.makeHttpRequest(url, type, params); Log.d("Create Response", json.toString()); return null; } protected void onPostExecute(String result) { } } JSON PARSER: public class JSONParser { static InputStream is = null; static JSONObject jObj = null; static String json = ""; // constructor public JSONParser() { } // function get json from url // by making HTTP POST or GET mehtod public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // check for request method if(method == "POST"){ // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); for (NameValuePair nvp : params){ Log.d("parameter", nvp.getName()); Log.d("parameter", nvp.getValue()); } HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); }else if(method == "GET"){ // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEnt…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41599026
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41599109
has comment: http://stackoverflow.com/comment/41599277

http://stackoverflow.com/comment/66831776
type: AnswerComment
type: Comment
has text: I tried to fix this naive logic and it made it handle more edge cases but there are still errors. The thing is that you can't just reset `count` to 0 on every mismatch. For example with your test case `00110 00110` we're going to find a mismatch on the fifth zero and we will reset `count` to 0. However, we should reset to 1 because `line[0] == line[4]`. In short, when a mismatch occurs at index `i` we should find the largest `j` such that `line[:j]` == `line[i - j: j]` and that's the index we should reset `count` to. I implemented this but it does not cover all cases
comment on: http://stackoverflow.com/a/27777456
score: 0

http://stackoverflow.com/comment/41599670
comment on: http://stackoverflow.com/q/26481934
score: 0
type: Comment
type: QuestionComment
has text: Why jodaTime when you could do simple arithmetic in java?

http://stackoverflow.com/comment/41578041
has text: @khagler: What a pity. :-( I thought 50 sitting ducks caught with a three-liner. :-) I fear a cron job replacing the original with the backup regularily isn't an option either then, is it?
type: AnswerComment
comment on: http://stackoverflow.com/a/26443906
score: 0
type: Comment

import
type: Tag
tags question: http://stackoverflow.com/q/26375515
tag name: import
tags question: http://stackoverflow.com/q/26509154
tags question: http://stackoverflow.com/q/26431030
tags question: http://stackoverflow.com/q/26487595
tags question: http://stackoverflow.com/q/26503382
tags question: http://stackoverflow.com/q/26373620
tags question: http://stackoverflow.com/q/26478188
tags question: http://stackoverflow.com/q/26431127
tags question: http://stackoverflow.com/q/26430015
tags question: http://stackoverflow.com/q/26455898
tags question: http://stackoverflow.com/q/26509219

http://stackoverflow.com/a/26409796
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/62567395
answers question: http://stackoverflow.com/q/26363573
type: Answer
score: 90
has comment: http://stackoverflow.com/comment/105854528
has comment: http://stackoverflow.com/comment/62723386
upvote count: 90
accepted answer of: http://stackoverflow.com/q/26363573
has body: Create a custom URLConnection implementation which performs the job in connect() method. public class CustomURLConnection extends URLConnection { protected CustomURLConnection(URL url) { super(url); } @Override public void connect() throws IOException { // Do your job here. As of now it merely prints "Connected!". System.out.println("Connected!"); } } Don't forget to override and implement other methods like getInputStream() accordingly. More detail on that cannot be given as this information is missing in the question. Create a custom URLStreamHandler implementation which returns it in openConnection(). public class CustomURLStreamHandler extends URLStreamHandler { @Override protected URLConnection openConnection(URL url) throws IOException { return new CustomURLConnection(url); } } Don't forget to override and implement other methods if necessary. Create a custom URLStreamHandlerFactory which creates and returns it based on the protocol. public class CustomURLStreamHandlerFactory implements URLStreamHandlerFactory { @Override public URLStreamHandler createURLStreamHandler(String protocol) { if ("customuri".equals(protocol)) { return new CustomURLStreamHandler(); } return null; } } Note that protocols are always lowercase. Finally register it during application's startup via URL#setURLStreamHandlerFactory() URL.setURLStreamHandlerFactory(new CustomURLStreamHandlerFactory()); Note that the Javadoc explicitly says that you can set it at most once. So if you intend to support multiple custom protocols in the same application, you'd need to generify the custom URLStreamHandlerFactory implementation to cover them all inside the createURLStreamHandler() method. Alternatively, if you dislike the Law of Demeter, throw it all together in anonymous classes for code minification: URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() { public URLStreamHandler createURLStreamHandler(String protocol) { return "customuri".equals(protocol) ? new URLStreamHandler() { protect…
has comment: http://stackoverflow.com/comment/83492459
has comment: http://stackoverflow.com/comment/123413032

http://stackoverflow.com/comment/41435888
has text: Hang on, if you're checking messages in the `listener()` method, which is called from the constructor of `ThreadedClass`, that's still running in the caller thread.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26391181

http://stackoverflow.com/comment/41642674
has text: you had one of the highest votes, so thought you might have a clue.I don't have any other way to contact people on this site
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26467413

http://stackoverflow.com/q/26408813
answer count: 2
has answer: http://stackoverflow.com/a/26408927
possible better answer: http://stackoverflow.com/a/26410203
tagged with: casting
upvote count: 0
has comment: http://stackoverflow.com/comment/41466059
has body: I have an empty interface called Data which is implemented by classes DataOne and DataTwo. I then have a class called DataHolder which contains a Data object. It looks something like this: public class DataHolder() { public Data data; } public class DataOne() { public int importantData; public int getImportantData() { return importantData; } public int setImportantData(int importantData) { this.importantData = importantData; } } public class DataTwo() { public int notSoImportantData; } Let's say theres a function which takes a DataHolder object and does some operation on the importantData integer. public void calculateImportantData(DataHolder dh) { int importantData = 1234567890; dh.data.setImportantData(importantData); } How can I be sure that the DataHolder contains a DataOne object, without typecasting?
has comment: http://stackoverflow.com/comment/41466256
has comment: http://stackoverflow.com/comment/41466058
has comment: http://stackoverflow.com/comment/41466241
favorite count: 0
accepted answer: http://stackoverflow.com/a/26408927
has title: Avoid type casting
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26410203
score: -1
downvote count: 1
type: Question

http://stackoverflow.com/comment/41603988
comment on: http://stackoverflow.com/q/26484675
has text: This question appears to be better suited for [code review](http://codereview.stackexchange.com/), once additional explanations are added on what OP wants to review/improve specifically.
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41520325
type: QuestionComment
score: 0
has text: Thanks. I'm aware that I'm not up to code here. And your input is greatly appreciated. I'll read up!
comment on: http://stackoverflow.com/q/26433174
type: Comment

http://stackoverflow.com/comment/41574038
has text: Can you post a compilable code?
comment on: http://stackoverflow.com/q/26467948
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26371920
has body: I have a server sending unicast UDP packets to 192.168.1.101, port 55555. My Android device has IP 192.168.1.101. My Android device has a multicast socket bound on port 55555 joined on multicast group 230.1.1.111. I am receiving datagrams on my Android's multicast socket from the server. Does this make sense? Can a multicast socket receive datagrams which are not addressed to the multicast group it's joined?
tagged with: java
upvote count: 2
tagged with: udp
answer count: 2
accepted answer: http://stackoverflow.com/a/26372041
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26372041
score: 2
type: AnsweredQuestion
has title: Receiving Unicast on Multicast socket
downvote count: 0
tagged with: multicast
has answer: http://stackoverflow.com/a/36946215
type: Question
possible better answer: http://stackoverflow.com/a/36946215
tagged with: network-programming

http://stackoverflow.com/a/26410309
has body: I wish to know what are the optimizations that the Java run time can make knowing that String objects are immutable? For starters, there's the string pool -- any string literals in your program will be interned; different classes that both refer to string literals with the same contents will just refer to the same object in memory. In crazier news, there's an option in recent versions of the Java garbage collector where, under certain conditions, the garbage collector will detect multiple String objects with the same contents and edit them to point to the same backing char[]. This is only possible because Strings are immutable, and allows the garbage collector to silently (and semantics-preservingly) reduce memory consumption.
accepted answer of: http://stackoverflow.com/q/26409461
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26409461
score: 2
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26462055
answers question: http://stackoverflow.com/q/26400359
has body: So the issue I had was to do with the CPU of my emulator. I ended up using an emulator with an ARM cpu instead of an Intel Atom (x86) and it worked. Although this solves the immediate problem I am confused about why this is an issue in the first place. I have the .so file in the x86 libs folder. Any reasoning to why it doesn't work would be greatly appreciated.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26400359
score: 0

http://stackoverflow.com/a/26494364
upvote count: 1
has body: Compile source file using target &lt;release&gt; to make sure it's the same version as the old jar was compiled to. Rename filename.jar to filename.zip Unzip .zip file Replace .class file with new file Rezip archive. It is okay to use compression. Make sure directory structure is the same as it was, and that you include the META-INF directory. Rename file to filename.jar again. Note: The checksum will be different. Some executable jars check for this, others don't. YMMV
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26494283

http://stackoverflow.com/comment/41576957
type: Comment
has text: Actually, it does not state that both methods are in the same class. Put method1 & method2 in 2 different DAO's, inject the second DAO in the first and see if it works then.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26467231

http://stackoverflow.com/q/26378850
tagged with: hashmap
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/26379131
answer count: 1
has comment: http://stackoverflow.com/comment/41412858
has comment: http://stackoverflow.com/comment/41723067
has comment: http://stackoverflow.com/comment/41412951
tagged with: tuples
has comment: http://stackoverflow.com/comment/77582474
score: 0
has comment: http://stackoverflow.com/comment/41413117
has comment: http://stackoverflow.com/comment/41412977
has title: HashMap - operations
type: UnansweredQuestion
has body: I have this situation where I have 5 people: P1, P2, P3, P4, P5. Every person has 3 criterias to compare: A, B, C (formed from float numbers like 5.x, so A can be 5.3 or 1.2 etc, B can be 1.8 etc, C 8.9 etc, minimum is 0.0, maximum is 10.0). Every criteria has subcriterias (for example 6 subcriterias also formed from float numbers like 2.x): A1, A2, A3, A4, A5, A6 / B1, B2, B3,... You get the idea. How can I put this 5 people in a HashMap (or any other collection) with their respective criterias and sub criterias: HashMap&lt;String, List&lt;Float&gt;&gt; person = new HashMap&lt;String, List&lt;Float&gt;&gt;(); and do the following operations: Take the first criterion from every person (A) and take out the min/max from it, that means from P1-A, P2-A, P3-A, P4-A, P5-A will remain maybe P1-A, P2-A, P3-A, with their respective subcriterion numbers, P1-A-A1, P1-A-A2, P1-A-A3... / P2-A-A1, P2-A-A2, P2-A-A3, and so on. Because the min/max is out, the criterions remaining P1-A, P2-A, P3-A means that only P1, P2, P3 are still in the game, P4 and P5 are out. The next operation is to calculate the average between P1 criterion A subcriterion A1, P2 Criterion A subcriterion A1 and P3 criterion A subcriterion A1. This should be calculated for every subcriterion like this: result1 = (P1-A-A1 + P2-A-A1 + P3-A-A1)/3 result2 = (P1-A-A2 + P2-A-A2 + P3-A-A2)/3 6 in total for criterion A. For criterion B and C, is the same operation from point 1. and 2. I need to inject the numbers for criterions A, B, C and subcriterions A1...A6, B1...B6, C1...C6 for every person P1...P5, there is no link between the value of A and values of A1, A2...A6, B1...etc, just the operations count in the end. I think the best will be to create the persons hasmaps with criterion as the key and subcriterions as values.
tagged with: collections
type: Question

http://stackoverflow.com/a/26379280
downvote count: 0
has body: Here is a list of JavaFX supported audio and video formats. For anything unsupported by JavaFX, you have the option of either converting them to another format or finding a way to decode them inside your application. There are libraries available for decoding, such as JCodec or Jffmpeg You will need to do some further research to determine your exact requirements and which formats you will need to support. Some solutions are more difficult than others.
answers question: http://stackoverflow.com/q/26378999
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26458727
downvote count: 1
type: Question
has title: how to implement this scenario car class have 3 methods(m1,m2,m3) and engineer can access m1 and m2, and driver can access m1 and m3 mthod
score: -1
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26458811
favorite count: 0
has body: I have car class and three methods m1(),m2(),m3(). engineer can access m1() and m2()method ,driver can m1() and m3(),but for engineer restrict m3()(should not provide for accessing this method) and for driver restrict m2()(should not provide for accessing this method)method how to implement this scenario in JAVA class car{ }
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/41617225
type: Comment
has text: Where excatly does getFilesDir() lead? The File lies in the src folder
type: AnswerComment
comment on: http://stackoverflow.com/a/26491506
score: 0

http://stackoverflow.com/a/26475881
answers question: http://stackoverflow.com/q/26474741
type: Answer
has body: Declaring and defining a variable inside a method will limit its scope to the method only. public is a keyword that is used to make it visible to every class out there and static makes the variable shared for whole class. Therefore, public and static are not allowed for the method variables. Hence, only final keyword is permitted for such variables Check this out for more on scope, default values and lifetime of method, instance and class variables
score: 0

http://stackoverflow.com/q/26388527
has answer: http://stackoverflow.com/a/26388566
tagged with: project
has title: How do I make my system wait 5 seconds before continuing?
has body: I'm currently working on a Black Jack game in a school project. When the machine rolls, I want to make it wait 5 seconds each time it rolls to make it more exciting. How do I do this?
has comment: http://stackoverflow.com/comment/41430860
possible better answer: http://stackoverflow.com/a/26388588
accepted answer: http://stackoverflow.com/a/26388566
has answer: http://stackoverflow.com/a/26388588
has comment: http://stackoverflow.com/comment/41430743
score: 0
has comment: http://stackoverflow.com/comment/41430715
has answer: http://stackoverflow.com/a/26389073
has comment: http://stackoverflow.com/comment/41430705
has answer: http://stackoverflow.com/a/26388622
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: timestamp
type: Question

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/26401076
tags question: http://stackoverflow.com/q/26493202
tags question: http://stackoverflow.com/q/26512745
tags question: http://stackoverflow.com/q/26482147
tags question: http://stackoverflow.com/q/26412089

http://stackoverflow.com/q/26431909
upvote count: 0
linked to: http://stackoverflow.com/q/1022880
answer count: 1
has body: Ok guys, this may've been posted and asked before, but it's so hard to explain in just a few words, so it's hard as hell to search for it as well! What I want to do is this, this is my first class: public class Footballer { int goals; String surname= ""; String team=""; private static int counter=0; private int dres; } (this is just the header of the class, just to give you the idea of how it looks)... And this is my second class, which contains an ArrayList of the first class: public class FootballTeam{ String teamname=""; String league=""; ArrayList&lt;Footballer&gt; f; } And this is my third class which contains an ArrayList of the second clas: public class FootballLeague{ String leaguename=""; ArrayList&lt;FootballTeam&gt; ft; } What I want to do is, know how many of footballers are there in the league? Meaning how many of "f"s are in the "ft"... I remember from C++ it was easy, you just did it something like this: ft.f[i]; (where i is a position), then you'd go through each of them, if you wanted to do something with them, or just ask for it's length, if you needed to know how much footballers are there. I really hope I am clear enough, please ask me if you don't get what I'm asking..
linked to: http://stackoverflow.com/q/8689553
tagged with: arraylist
has title: Accessing an ArrayList of another class
has comment: http://stackoverflow.com/comment/41508596
favorite count: 0
has comment: http://stackoverflow.com/comment/41508617
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/26431952
duplicate of: http://stackoverflow.com/q/8689553
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/41481539
type: QuestionComment
has text: `BufferedReader` is the idiomatic way to read a file line by line. Advice to use `Scanner` is usually wrong if it isn't some quick and dirty example of reading from `System.in`. Advice to use `StringTokenizer` for anything should be ignored as well.
comment on: http://stackoverflow.com/q/26416966
score: 0
type: Comment

http://stackoverflow.com/comment/41532009
type: Comment
type: QuestionComment
score: 0
has text: Seems like GridLayout is a way to go, but when there is only 1 component (on start) it stretches my panel, how to avoid this?
comment on: http://stackoverflow.com/q/26444638

http://stackoverflow.com/q/26505936
has comment: http://stackoverflow.com/comment/41646027
has comment: http://stackoverflow.com/comment/41643329
has comment: http://stackoverflow.com/comment/41643829
has comment: http://stackoverflow.com/comment/41643477
has body: I have constructed a rather large JTree from XML data, literally thousands of nodes, most of which display correctly. However for some reason some node's userData Strings are not being fully displayed, rather thay are cut short or cut off completely with ... appended to the end of the name. The affected Nodes appear to be random, and are different each time the tree is refreshed or recreated from the XML. Things I've ruled out: Not enough space to display the full name. The JTree is inside a JScrollPane with plenty of horizontal space, the JScrollPane isn't even showing a horizontal scroll bar to indicate a lack of space. Even the shortest name can be affected. The cut off point isn't consistent for all shortened node names. Incomplete name loaded from XML If the affected node isn't a leaf and is then expanded or collapsed, the full name is displayed properly when it is re-rendered, the XML isn't consulted at all during this process. EDIT: As requested some explanation of the code behind the JTree: The creation of the TreeModel and the population of the tree: public XMLDialogTree(Document doc) { DefaultTreeModel treeModel = new DefaultTreeModel(buildTreeNode(doc.getElementsByTagName("Dialogs").item(0))); setModel(treeModel); } // A recursive function to build the tree private DefaultMutableTreeNode buildTreeNode(Node xmlNode) { // Make sure the node's name is a description of what it is, as opposed to a generic XML tag XMLDialogTreeNode = new XMLDialogTreeNode(xmlNode.getAttributes().getNamedItem("name").getNodeValue()); treeNode.controlName = xmlNode.getNodeName(); // Add children to the treeNode based on the xmlNode's children NodeList nodeList = xmlNode.getChildNodes(); for (int i = 0; i &lt; nodeList.getLength(); i++) { Node tempNode = nodeList.item(i); if (tempNode.getNodeType() == Node.ELEMENT_NODE) { // loop again if has child nodes treeNode.add(buildTreeNode(tempNode)); } } return treeNode; } Where doc is an org.w3c.dom.Document containing parsed XML and an …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41643697
tagged with: java
has title: What is causing arbitrary JTree Nodes to incorrectly display their names and how can I stop it from happening?
has comment: http://stackoverflow.com/comment/41646927
has comment: http://stackoverflow.com/comment/41646618
has comment: http://stackoverflow.com/comment/41642972
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26508293
tagged with: jtree
has comment: http://stackoverflow.com/comment/41642791
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/41646279
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/41644138
accepted answer: http://stackoverflow.com/a/26508293

bash
tags question: http://stackoverflow.com/q/26427333
tags question: http://stackoverflow.com/q/26438046
tags question: http://stackoverflow.com/q/26359806
tags question: http://stackoverflow.com/q/26475176
tags question: http://stackoverflow.com/q/26394737
tags question: http://stackoverflow.com/q/26434595
type: Tag
tags question: http://stackoverflow.com/q/26369543
tag name: bash
tags question: http://stackoverflow.com/q/26496791

http://stackoverflow.com/q/26474481
score: 0
tagged with: javafx-8
has body: Hello everyone I have this xml file: <?xml version='1.0' encoding='UTF-8'?> Java Bohdana Dumanska yes Brenden Walski yes Ty Flint yes Monday 6:00 - 8:00 yes 2 30 Physics Jack Nelson yes Nazariy Dumic yes Bren Awesome yes Tuesday 6:00 - 8:00 yes 2 30 With that NetBeans created these classes from the xsd file: package schedule.app.courses; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * Java class for anonymous complex type. * * The following schema fragment specifies the expected content contained within this class. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "course" }) @XmlRootElement(name = "courses") public class Courses { @XmlElement(required = true) protected List<Courses.Course> course; /** * Gets the value of the course property. * * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set method for the course property. * * * For example, to add a new item, do as follows: * * getCourse().add(newItem); * * * * * Objects of the following type(s) are allowed in the list * {@link Courses.Course } * * */ public List<Courses.Course> getCourse() { if (course == null) { course = new ArrayList<Courses.Course>(); } return this.course; } /** * Java class for anonymous complex type. * * The following schema fragment specifies the expected content contained within this class. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlT…
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26474539
accepted answer: http://stackoverflow.com/a/26474539
tagged with: xml-parsing
answer count: 1
has title: How to Set TableColumnValue JavaFX Table View

http://stackoverflow.com/comment/95163830
type: Comment
comment on: http://stackoverflow.com/a/26381114
score: 1
has text: Note that this is only true for Java 8 and above.
type: AnswerComment

http://stackoverflow.com/q/26382924
has answer: http://stackoverflow.com/a/26383216
downvote count: 0
has title: Mocking getJdbcTemplate method
favorite count: 0
has comment: http://stackoverflow.com/comment/41422736
has answer: http://stackoverflow.com/a/26383277
score: 1
type: UnansweredQuestion
upvote count: 1
has body: My scenario is as below: I have no setter methods in SampleDao interface and no direct field in SampleDaoImpl class reference: How to mock getJdbcTemplate().queryForObject()? public interface SampleDao { // some methods } public class SampleDaoImpl extends JdbcDaoSupport implements SampleDao { // implementation of some methods public String someMethod(String param1, String param2){ // .....// List&lt;String&gt; data = getJdbcTemplate().query(.....); // -&gt; getJdbcTemplate() is the method of JdbcDaoSupport to get JdbcTemplate } } I want to mock result of getJdbcTemplate().query(.....) where getJdbcTemplate() is of JdbcDaoSupport class which is extended by SampleDaoImpl, no where by SampleDao. My Test case is as below: Created object of SampleDaoImpl and assigned to SampleDao @RunWith(Parameterized.class) public class MockSampleDao { String param1 = "", param2 = ""; @Mock SampleDao sampleDao = new SampleDaoImpl(); public MockSampleDao(String param1, String param2) { super(); this.param1 = param1; this.param2 = param2; } @Parameterized.Parameters public static Collection primeNumbers() { return Arrays.asList(new Object[][] { { "test1", "test1" }, { "test2", "test2" } }); } @Test public void testSomeMethod(){ try { // HOW TO MOCK THE RESULT FROM getJdbcTemplate().query() HERE sampleDao.someMethod(param1, param2); } catch (Exception e) { e.printStackTrace(); } } }
tagged with: junit4
linked to: http://stackoverflow.com/q/8280774
tagged with: java
type: Question
answer count: 2
tagged with: mockito

http://stackoverflow.com/comment/41375697
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26358286
type: AnswerComment
has text: try to put `settings.properties` to `myjar.jar/java/config`.

http://stackoverflow.com/comment/41762671
comment on: http://stackoverflow.com/q/26501791
score: 0
type: Comment
type: QuestionComment
has text: @Drux: Please add to this question following information: (1) the source code of T-SQL batch sended to SQL Server from JDBC client app and (2) the actual execution plan from SSMS (use Ctrl + M and F5) as **XML**.

http://stackoverflow.com/comment/41491814
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26409235
has text: @CodesInChaos Really? What about 1/10?
type: Comment

http://stackoverflow.com/a/26432490
has comment: http://stackoverflow.com/comment/41510424
has body: Your get a ConcurrentModificationException because you remove an element from a collection while you are iterating over that collection, other than via the iterator. In this case, you have no explicit iterator for the outer iteration, so there is no way to safely modify the sprites collection inside the loop. The best you can do is probably to collect the elements to delete into a temporary collection, then remove them all after the loop, something like this: Set&lt;Sprite&gt; toRemove = new HashSet&lt;Sprite&gt;(); for (Sprite s1 : sprites) { if (toRemove.contains(s1)) { continue; } s1.move(); for (Sprite s : sprites) { if (toRemove.contains(s)) { continue; } if (s instanceof Attacker) { for (Sprite s2 : sprites) { if (toRemove.contains(s2)) { continue; } if(s.overlaps(s2)) { s2.hit(); } } } if (s.shouldRemove()) { toRemove.add(s); } } } sprites.removeAll(toRemove);
downvote count: 0
answers question: http://stackoverflow.com/q/26432191
has comment: http://stackoverflow.com/comment/41510240
has comment: http://stackoverflow.com/comment/41510415
has comment: http://stackoverflow.com/comment/41510061
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41509914
has comment: http://stackoverflow.com/comment/41510003
type: Answer
accepted answer of: http://stackoverflow.com/q/26432191
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/41509677

http://stackoverflow.com/comment/41542470
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26450556
score: 0
has text: yes i did, jfreechart-0.9.21.jar

http://stackoverflow.com/q/26454710
has answer: http://stackoverflow.com/a/26455550
tagged with: java
type: Question
has title: Recursive Triangle
has answer: http://stackoverflow.com/a/26461409
linked to: http://stackoverflow.com/q/19485710
linked to: http://stackoverflow.com/q/11409621
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26454763
has body: So, I've been assigned a problem where I have to have a user-inputted number (an int) generate a triangle of the given size. i.e. if the user types in "5" as the size, the program would generate the following: Where the peak of the triangle, or the largest row, would be the desired size. Here's the catch - we have to use a second method to do this, and that method can only accept two arguments. That method also has to be the only one used to make the triangle. To clarify- we can't separate the triangles into two halves, one for the first half, (increasing asterisks) and one for the second. We also can't use loops. (decreasing) My program, so far, has 3 methods (including main) a method like asked, used to identify what's being printed, ans a method to actually print the rows. However, I can't quite seem to get it right. Any help as to how?
downvote count: 4
upvote count: 0
linked to: http://stackoverflow.com/q/11542113
type: UnansweredQuestion
score: -4
tagged with: recursion

http://stackoverflow.com/q/26427010
type: Question
has body: What is the need of having two diamond brackets in a method and if T is not a return type why do we need this? OR is T is something related to casting? package generics; import java.util.ArrayList; import java.util.List; public class GenericMethodType { public &lt;T&gt; List&lt;T&gt; toList(T[] parameters){ //is T something related to casting. List&lt;T&gt; list=new ArrayList&lt;&gt;(); for(T t:parameters){ list.add(t); } return list; } public static void main(String[] args) { GenericMethodType gmt=new GenericMethodType(); System.out.println(gmt.toList(new Integer[] {1,2,34,4})); } }
has comment: http://stackoverflow.com/comment/41499033
has answer: http://stackoverflow.com/a/26428406
answer count: 3
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/41499364
has title: What is the meaning of method having two diamond brackets in generics?
has comment: http://stackoverflow.com/comment/41498969
accepted answer: http://stackoverflow.com/a/26428406
has comment: http://stackoverflow.com/comment/41501236
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26427056
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26427056
upvote count: 1
has answer: http://stackoverflow.com/a/26427079

http://stackoverflow.com/comment/41385924
type: Comment
has text: @Pshermo I tried that too, doesn't work :(
score: 0
comment on: http://stackoverflow.com/q/26364018
type: QuestionComment

http://stackoverflow.com/comment/41627446
type: Comment
type: QuestionComment
has text: You understand that a String has an array of characters inside, and characters are not the same thing as bytes, right?
comment on: http://stackoverflow.com/q/26497204
score: 1

http://stackoverflow.com/comment/41427819
type: AnswerComment
score: 1
has text: Yes. Node is a dumb class that doesn't need to be exposed anywhere else, so an nested class is a good choice. BTW, the standard java.util.LinkedList class does the exact same thing. A non-static inner class has access to all instance fields and metghods of its enclosing type. To do that, it has an additional field, cadded by the compiler, which references the linked list of which the node is part of. You don't need this reference, and it thus consumes memory for nothing. So the class should be static.
comment on: http://stackoverflow.com/a/26385705
type: Comment

spongycastle
type: Tag
tag name: spongycastle
tags question: http://stackoverflow.com/q/26356195

http://stackoverflow.com/a/26364767
answers question: http://stackoverflow.com/q/26364558
score: 2
has comment: http://stackoverflow.com/comment/41387766
downvote count: 0
has comment: http://stackoverflow.com/comment/41393345
has comment: http://stackoverflow.com/comment/41387791
type: Answer
has body: You're not using the HashMap correctly. You don't want to map id -&gt; 103 email -&gt; HSXB736GB etc. As you've discovered, if you do that, you'll only be able to have one user in there, because the key has to be unique, so when you add a new user, the id will be overwritten. What you want to do is to map IDs to user objects 103 -&gt; [user instance with ID 103] 105 -&gt; [user instance with ID 105] This means that rather than HashMap&lt;String,Utente&gt; you want HashMap&lt;Integer,Utente&gt;. Then you can do things like Utente someUser = ... map.put(someUser.getId(), someUser); and later you'll be able to retrieve the user from the map with Utente someUser = map.get(id); as long as you know the ID.
upvote count: 2

http://stackoverflow.com/a/26399648
score: 1
upvote count: 1
type: AcceptedAnswer
has body: non-US-ASCII (i.e. outside 0x0-0x7F) characters public static void main(String[] args) { String s = "Radial™"; s = s.replaceAll("[^\\x00-\\x7f]", ""); System.out.println(s); } Output Radial
answers question: http://stackoverflow.com/q/26399593
type: Answer
accepted answer of: http://stackoverflow.com/q/26399593
downvote count: 0

http://stackoverflow.com/a/26496847
downvote count: 0
has body: I can't even begin to correct your code. To achieve what you want to do try this: Scanner in = new Scanner(System.in); ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); String line; while (!(line = in.nextLine()).equals("stop")) { list.add(line); } in.close(); System.out.println(list);
score: 1
accepted answer of: http://stackoverflow.com/q/26496487
upvote count: 1
answers question: http://stackoverflow.com/q/26496487
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26400421
favorite count: 0
has answer: http://stackoverflow.com/a/26404175
accepted answer: http://stackoverflow.com/a/26404175
upvote count: 4
tagged with: generics
linked to: http://stackoverflow.com/q/16430355
downvote count: 0
tagged with: scala
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41456779
tagged with: java
has title: Convert Java `sort` signature with `? super T` to Scala (generics)
type: Question
answer count: 1
has body: The problem: Looking at this question about migrating the Java signature public &lt;A extends Comparable&lt;? super A&gt;&gt; void sort(List&lt;A&gt; list) { } to Scala, there doesn't seem to be a way to avoid a illegal cyclic reference involving type T error if you do a literal translation like this. def compilerFailure[T &lt;: Comparable[_ &gt;: T]](a: Array[T]): T = { } The workaround seems to be to do this instead def workaround[A &lt;: Comparable[U], U &gt;: A](list: List[A]) { } which if you round trip from byte code back to Java, you get this (which looses the super part) public &lt;T extends Comparable&lt;U&gt;, U&gt; void scalaToJava(List&lt;U&gt; a) { } My questions: Is the scalaToJava version equivalent to the following? public &lt;T extends Comparable&lt;?&gt;&gt; void sort(List&lt;T&gt; a) { I figured when U is unbounded, it might as well be ? or Object no? Then if that's the case, is the Scala workaround version equivalent to def sort[A &lt;: Comparable[_]](list: List[A]) { } They all seem to compile for my use case (which is about putting different sub-types in a collection and being able to sort them). NB. I'm curious about the mechanics and what causes the cyclic reference error and realize that Scala offers better alternatives in terms of covariance etc (ie Ordering).
score: 4

http://stackoverflow.com/a/26408841
type: Answer
has body: Use TableLayout to layout your table and use ColumnWeightData to specify the 'weight' of each column. For example, two columns with a 60 / 40 weighting: TableViewer viewer = .... TableLayout layout = new TableLayout(); TableViewerColumn col1 = new TableViewerColumn(viewer, SWT.LEAD); layout.setColumnData(col1.getColumn(), new ColumnWeightData(60)); TableViewerColumn col2 = new TableViewerColumn(viewer, SWT.LEAD); layout.setColumnData(col2.getColumn(), new ColumnWeightData(40)); viewer.getTable().setLayout(layout);
score: 2
has comment: http://stackoverflow.com/comment/41488270
accepted answer of: http://stackoverflow.com/q/26408690
upvote count: 2
answers question: http://stackoverflow.com/q/26408690
type: AcceptedAnswer
downvote count: 0

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/26479922
tag name: session-timeout

http://stackoverflow.com/comment/41605451
score: 0
comment on: http://stackoverflow.com/q/26485495
type: Comment
type: QuestionComment
has text: Tip: According to your code, `getTheLikers` can be `static` so you won't need dummy instance to call it.

http://stackoverflow.com/q/26385116
has comment: http://stackoverflow.com/comment/41424506
has comment: http://stackoverflow.com/comment/41424474
answer count: 0
downvote count: 0
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41424653
type: Question
has comment: http://stackoverflow.com/comment/41424702
has comment: http://stackoverflow.com/comment/41425197
score: 1
favorite count: 0
tagged with: el
has comment: http://stackoverflow.com/comment/41424937
has title: Spring MVC Attribute not recognized
upvote count: 1
has comment: http://stackoverflow.com/comment/41424713
tagged with: spring-mvc
has body: I got a problem with an attribute in Spring MVC. In jsp file I got this : &lt;form:form class="main-section" commandName="assistanceForm" name="assistanceForm" method="post" enctype="multipart/form-data" action="${enregistrerAssistanceUrl}"&gt; &lt;form:hidden path="popupAssistanceOuverte"/&gt; &lt;form:hidden path="codeAgence"/&gt; &lt;form:hidden path="idClient" value="${idClient}"/&gt; &lt;/form:form&gt; When I'm going to the webpage, I got this error : ......at line 18: This attribute is not recognized. &lt;%@include file="assistance.jsp"%&gt; Line 18 is this line : &lt;form:hidden path="idClient" value="${idClient}"/&gt; If I replace the line by this there's no error : &lt;form:hidden path="idClient"&gt; But I need the value. The value of idClient is in the ModelAndView object (named pModel), add in the controller like this : pModel.addAttribute("idClient", ""); I really can't figure out what's happening ! Any idees ? Here's the stacktrace : Here it is :####&lt;2014-10-15.15-55-14-232> &lt;[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'> &lt;> &lt;> &lt;24448466f5d9c1c6:76226577:14913e992e8:-7ffd-000000000000009b> &lt;1413381314232> &lt;[ServletContext@31289880[app:FOAGAN_DEV_C0C_2_foagan-ear module:foagan path:null spec-version:3.0]] Root cause of ServletException. org.apache.tiles.impl.CannotRenderException: JSPException including path '/WEB-INF/jsp/layout/headerFOA.jsp'. at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:692) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:628) at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:322) at org.springframework.web.servlet.view.tiles2.TilesView.renderMergedOutputModel(TilesView.java:125) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263) at org.springframework.web.servlet.DispatcherServlet.r…
has comment: http://stackoverflow.com/comment/41424828
tagged with: java
has comment: http://stackoverflow.com/comment/41424360

http://stackoverflow.com/q/26467057
has body: i want to download multiple file and save into different locations FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", "D:\\"); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/msword"); System.setProperty("webdriver.chrome.driver","C:/Program Files/Mozilla Firefox/firefox.exe"); f =new FirefoxDriver(profile); for(int i = 0; i&lt;10; i++){ //I want to change download dir name here with count** }
tagged with: java
tagged with: selenium
has title: How to dynamically change Firefox Driver preferences in selenium
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26894445
score: 0
has comment: http://stackoverflow.com/comment/41580081
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41573299
tagged with: selenium-webdriver

http://stackoverflow.com/comment/41553645
score: 0
type: Comment
has text: I was looking at defining the bounds but didn't quite get that. Could you able to give some hints.
type: QuestionComment
comment on: http://stackoverflow.com/q/26456364

http://stackoverflow.com/comment/41390280
score: 1
type: Comment
type: QuestionComment
has text: Well then, it would be better if you use a proper distribute cache library like ecache or infinispan instead of brewing your own. Or probably use another alternative like Hazelcast.
comment on: http://stackoverflow.com/q/26366256

http://stackoverflow.com/q/26476143
downvote count: 1
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/41590301
has comment: http://stackoverflow.com/comment/41616322
has comment: http://stackoverflow.com/comment/41635966
has answer: http://stackoverflow.com/a/26477181
upvote count: 4
has comment: http://stackoverflow.com/comment/41590843
has comment: http://stackoverflow.com/comment/41590192
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 3
has comment: http://stackoverflow.com/comment/41590110
tagged with: java
has body: We have many Controllers in our system, and many Spring Data repositories. I would like to write tests for my controllers that run through my MVC context. However, it seems pretty cumbersome, and just not right, to have to, by hand, mock every service and repository in my system, so that I can test the controllers e.g. FooControllerTest.java @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextHierarchy(value = { @ContextConfiguration(classes = { MockServices.class }), @ContextConfiguration({ "classpath:/META-INF/spring/mvc-servlet-context.xml" }), }) public class FooControllerTest { @Autowired private WebApplicationContext wac; private MockMvc mvc; @Autowired private FooRepository fooRepository; @Autowired private FooService fooService; @Before public void setUp() throws Exception { mvc = webAppContextSetup(wac).build(); } @Test public final void list() { when(fooRepository.findAll()).thenReturn(...); mvc.perform(get("/foo"))... } @Test public final void create() { Foo fixture = ... when(fooService.create(fixture)).thenReturn(...); mvc.perform(post("/foo"))... } } MockServices.java @Configuration public class MockServices { @Bean public FooRespository fooRepositiory() { return Mockito.mock(FooRespository.class); } @Bean public FooService fooService() { return Mockito.mock(FooService.class); } //even though we are "only" testing FooController, we still need to mock BarController's dependencies, because BarController is loaded by the web app context. @Bean public BarService barService() { return Mockito.mock(FooService.class); } //many more "mocks" } I do not really want to use standaloneSetup() (want to use the production configuration, eg conversion services, error handlers, etc) is this just the price I have to pay for writing controller tests so far down the line? Seems there should be something like mock every class annotated with @Service or mock every interface that extends JpaRepository
has title: Spring MVC Controller testing, and mocking many classes

http://stackoverflow.com/a/26360466
type: Answer
has comment: http://stackoverflow.com/comment/41379199
has comment: http://stackoverflow.com/comment/41378959
has body: try like this, @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_calendar, container, false); calendar=(CalendarView) rootView.findViewById(R.id.calendarView1); initializeCalendar(); return rootView; } remove onActivityCreated() method and also remove calendar = (CalendarView) getActivity().findViewById(R.id.calendarView1); from initializeCalendar() method
has comment: http://stackoverflow.com/comment/41381327
score: 0
has comment: http://stackoverflow.com/comment/41380223
answers question: http://stackoverflow.com/q/26360427

http://stackoverflow.com/comment/41488721
has text: for question updates, i can't create more object instance, i must work only with one object instance.
comment on: http://stackoverflow.com/a/26421456
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41476206
type: Comment
has text: Glad you figured it out. Good luck
type: AnswerComment
comment on: http://stackoverflow.com/a/26414097
score: 0

http://stackoverflow.com/a/26453001
has body: You can't catch any key inputs with JavaME in Forms. How the high level GUI is presented and edited, is device-dependent. Meaning, it'll look differently on different devices. The Enter key is not there on other devices, for example. Some might say you could implement your own field using Canvas or GameCanvas, but then you'd also have to implement your own key-input function. That's a lot of work. Another option is to look into LWUIT. I have no experience with LWUIT myself, but I know it's very popular, and offers a lot of UI stuff like Form does - but LWUIT is built on Canvas/GameCanvas, so there's a chance it offers what you're looking for. Check it out.
type: Answer
answers question: http://stackoverflow.com/q/26450306
has comment: http://stackoverflow.com/comment/41595773
score: 1
has comment: http://stackoverflow.com/comment/41558814
has comment: http://stackoverflow.com/comment/41560283
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/41482478
comment on: http://stackoverflow.com/q/26417713
score: 0
type: Comment
type: QuestionComment
has text: Do you have a Click Handler you can show us? It'll likely tie in there, instead of in tick.

gwt
tags question: http://stackoverflow.com/q/26446022
tags question: http://stackoverflow.com/q/26480214
tags question: http://stackoverflow.com/q/26507863
tag name: gwt
tags question: http://stackoverflow.com/q/26450472
tags question: http://stackoverflow.com/q/26354622
type: Tag
tags question: http://stackoverflow.com/q/26356576
tags question: http://stackoverflow.com/q/26491569
tags question: http://stackoverflow.com/q/26389566
tags question: http://stackoverflow.com/q/26398477
tags question: http://stackoverflow.com/q/26497159
tags question: http://stackoverflow.com/q/26501800
tags question: http://stackoverflow.com/q/26496348
tags question: http://stackoverflow.com/q/26414158
tags question: http://stackoverflow.com/q/26482756
tags question: http://stackoverflow.com/q/26425632
tags question: http://stackoverflow.com/q/26411231
tags question: http://stackoverflow.com/q/26404254
tags question: http://stackoverflow.com/q/26420475

http://stackoverflow.com/a/26363889
has comment: http://stackoverflow.com/comment/41385548
has comment: http://stackoverflow.com/comment/41385736
upvote count: 3
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41385877
has comment: http://stackoverflow.com/comment/41387018
score: 2
has body: ActionListener is in the java.awt.event package. If you import that package, it should work. The import java.awt.*; statement does not import the java.awt.event package, in which the ActionListener class resides. To import, you will need to separately `import java.awt.event.*;' Have a look here for more details, under 'Apparent Hierarchies of Packages'.
has comment: http://stackoverflow.com/comment/41387265
has comment: http://stackoverflow.com/comment/41385795
answers question: http://stackoverflow.com/q/26363834
has comment: http://stackoverflow.com/comment/41385367

http://stackoverflow.com/a/26447549
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26447534
has comment: http://stackoverflow.com/comment/41537270
has body: You need to initialize urlList before using it: urlList = new ArrayList&lt;&gt;();

http://stackoverflow.com/a/26464618
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/41567386
downvote count: 0
has body: You don't have to create a Runnable to perform custom code within a new Thread. It's also possible to create a subclass of thread directly. public class WorkerThread extends Thread{ @Override public void run() { // TODO Auto-generated method stub super.run(); // DO SOMETHING } } public class MainClass { public static void main(String[] args){ new WorkerThread().start(); MainClass mc = new MainClass(); mc.startThread(); } private void startThread(){ Thread t = new WorkerThread(); t.start(); } }
answers question: http://stackoverflow.com/q/26464499
has comment: http://stackoverflow.com/comment/41567321

http://stackoverflow.com/a/26470179
has comment: http://stackoverflow.com/comment/41596649
has body: You might want to add one header where you mention response is an attachment -> response.addHeader("Content-Disposition", "attachment; filename=" + pdfFileName);
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/80352463
downvote count: 0
answers question: http://stackoverflow.com/q/26468395
upvote count: 2

http://stackoverflow.com/comment/41440781
score: 0
type: Comment
type: QuestionComment
has text: If the strings you store are known to be unique you should really be using a `SortedSet` instead (which is an interface; consider using a `TreeSet` for instance). Also, you say "alphabetic order"; what do you make of uppercase vs lowercase etc? What about locale dependent collation order?
comment on: http://stackoverflow.com/q/26393995

http://stackoverflow.com/a/26509441
type: Answer
answers question: http://stackoverflow.com/q/26509324
has body: Before looking at the code, you have to understand the difference between a Interface and an Implementation. From Wikipedia: An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic sense of the term) that classes must implement. Interfaces are declared using the interface keyword, and may only contain method signature and constant declarations (variable declarations that are declared to be both static and final). All methods of an Interface do not contain implementation (method bodies) as of all versions below JAVA 8. Starting with Java 8 default and static methods may have implementation in the interface definition.1 Once you understand the difference between the implementation and the interface, the two declarations become easier to understand. Let's start with the second statement first - it is more straightforward: ArrayList&lt;Integer&gt;l=new ArrayList&lt;Integer&gt;(); Here you are declaring l as being an ArrayList that accepts Integer objects. So an eventual use would be something like: l.add( new Integer(1) ); If you follow that logic then you can see that the other line is the same construct: ArrayList&lt;List&lt;Integer&gt;&gt;L=new ArrayList&lt;List&lt;Integer&gt;&gt;(); Here you are defining L to be an ArrayList that accepts List&lt;Integer&gt; objects. A List is an interface in Java - there can be different types of implementations. Ex: LinkedList, ArrayList, etc. The actual implementation is irrelevant in the declaration. So given that an ArrayList is actually a List, you can see that L can contain instances of l since l is a List&lt;Integer&gt;. So an eventual use of the second list would be: L.add(l); In fact, if you wanted to take it even further, you can do: List&lt;Integer&gt; linkedList = new LinkedList&lt;Integer&gt;(); List&lt;Integer&gt; vector = new Vector&lt;Integer&gt;(); And add them all to the same L list since they all implement the List&lt;Integer&gt; interface: L.add(linke…
score: 0

http://stackoverflow.com/comment/41607539
type: Comment
has text: @HalilM then the input is already sorted. Assuming your sorting logic works properly.
type: AnswerComment
comment on: http://stackoverflow.com/a/26486539
score: 0

http://stackoverflow.com/q/26508058
has body: I have two different programs, one which contains a method "addGrade" designed to add a new grade to a 2D array (gradeTable). One array of the 2D array is the category each grade should be in, and the second element is the grades for each category. Here is that program: public class GradeBook { private String name; private char[] categoryCodes; private String[] categories; private double[] categoryWeights; private double[][] gradeTable; public GradeBook(String nameIn, char[] categoryCodesIn, String[] categoriesIn, double[] categoryWeightsIn) { name = nameIn; categoryCodes = categoryCodesIn; categories = categoriesIn; categoryWeights = categoryWeightsIn; gradeTable = new double[5][0]; } public boolean addGrade(String newGradeIn) { char row = newGradeIn.charAt(0); int grade = Integer.parseInt(newGradeIn.substring(1)); double[] oldArr = gradeTable[row]; double[] newArr = Arrays.copyOf(oldArr, oldArr.length + 1); newArr[newArr.length - 1] = grade; gradeTable[row] = newArr; return row != 0; } The second program reads in a file as a command argument. The bolded text represents the grades being read in. The letter stands for that category each grade should be in, and the number is the actual grade. The file is Student1 5 a Activities 0.05 q Quizzes 0.10 p Projects 0.25 e Exams 0.30 f Final 0.30 **a100 a95 a100 a100 a100 q90 q80 q100 q80 q80 r90 p100 p95 p100 p85 p100 e77.5 e88 f92** In the second program, I'm trying to loop through each grade in the file and call the addGrade method on it so it will be added to the 2D array. I'm unsure of how to call the method for each individual grade. Also, I'm pretty sure my addGrade method isn't right. Any help would be appreciated. This is the second program: public class GradeBookApp { String fileName = ""; String name = ""; char[] categoryCodes = new char[5]; String[] categories = new String[5]; double[] categoryWeights = new double[5]; double[][] gradeTable; if (args.length &gt; 0) { for (int i = 0; i &lt; args.length; i++) { Syst…
tagged with: arrays
score: 0
has title: Reading in from a file and adding to 2D array
has answer: http://stackoverflow.com/a/26508344
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26508286
answer count: 2

http://stackoverflow.com/a/26360671
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41416887
has comment: http://stackoverflow.com/comment/41417278
has comment: http://stackoverflow.com/comment/41429234
accepted answer of: http://stackoverflow.com/q/26358833
upvote count: 1
has comment: http://stackoverflow.com/comment/41539925
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26358833
has body: Just few tips based on your question: Then I create a user@ in mysql and granted all the privilegies on the created database to this user. MySQL authentication mechanism validates the combination of both user+host, so you need to be sure the host you are tryining to connect from is allowed to do so. For example, a very common mistake is to create the user like this: CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; If you try to connect to MySQL from other host then you won't succeed. See MySQL - Adding user account for further details. On the application tier I create the jdbc connection pool [...] It looks ok, but you should also make this pool available as a JDBC resource with a proper JNDI name (i.e.: jdbc/ConnectionPoolName, so then you can use a DataSource directly in your application by using injection. See Administering JDBC Resources. This is valid if you use both JPA and JDBC. Also my application has a particular feature. I handle some database entities using JPA 2.0 while some others directly using SQL. If you use JPA the resource must be set in persistence.xml: <?xml version="1.0" encoding="UTF-8"?> jdbc/ConnectionPoolName <properties /> If you use plain JDBC API then a DataSource can be injected by using @Resource in a bean like this: @Stateless public class MyJdbcBean { @Resource(lookup = "jdbc/ConnectionPoolName") private DataSource dataSource; public Connection getConnection() { if (dataSource != null) { return dataSource.getConnection(); } else { Exception ex = new ExceptionInInitializerError("Couldn't initialize data source!"); Logger.getLogger(MyJdbcBean.class.getName()).log(Level.SEVERE, ex.getMessage(), ex); throw ex; } } } I also tried to put the mysql JDBC connector in the glassfish4/glassfish/lib folder but doesn't work. Also putting it in the application classpath doesn't work. In my experience JDBC connector must be placed in domain's lib/ext folder, i.e.: glassfish-4.0/glassfish/domains/domain1/lib/ext.
has comment: http://stackoverflow.com/comment/41413211
type: Answer
has comment: http://stackoverflow.com/comment/41417911

http://stackoverflow.com/q/26356777
type: Question
linked to: http://stackoverflow.com/q/25497053
has comment: http://stackoverflow.com/comment/41372393
answer count: 2
has title: Why write Try-With-Resources without Catch or Finally?
has answer: http://stackoverflow.com/a/26366568
favorite count: 0
has comment: http://stackoverflow.com/comment/82536656
has comment: http://stackoverflow.com/comment/41372499
possible better answer: http://stackoverflow.com/a/26356958
has comment: http://stackoverflow.com/comment/41372526
has answer: http://stackoverflow.com/a/26356958
has body: Why write Try without a Catch or Finally as in the following example? protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { /* TODO output your page here. You may use following sample code. */ out.println(" "); out.println(" "); out.println(" "); out.println(" Servlet tryse "); out.println(" "); out.println(" "); out.println(" Servlet tryse at " + request.getContextPath() + " "); out.println(" "); out.println(" "); } }
downvote count: 2
accepted answer: http://stackoverflow.com/a/26366568
has comment: http://stackoverflow.com/comment/41372560
type: AnsweredQuestion
score: 74
has comment: http://stackoverflow.com/comment/41372489
has comment: http://stackoverflow.com/comment/41372342
tagged with: java
upvote count: 76
tagged with: try-with-resources

http://stackoverflow.com/comment/41644977
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26506083
has text: You could use the Javascript enginge. Have a look here http://stackoverflow.com/questions/19261329/math-string-with-no-spaces#23652514

http://stackoverflow.com/q/26379848
type: UnansweredQuestion
score: 0
tagged with: oop
tagged with: java
type: Question
has title: How to set flag for specified Object from another Object of Other Class?
answer count: 1
has comment: http://stackoverflow.com/comment/41416123
has body: Please help me with object-oriented programming. I have a class Main Class where I created a Client object (instance) of class Class Clients. After that, I created object Adress (instance) of Class Adresses in the Main Class . One Client has several Addresses, but only one address can be basic(main). Question: how to set for existing object Client that it has already the main address. I need to do it from Adress object because there is some logic for selecting main adress in Adress object. Thank you.
has comment: http://stackoverflow.com/comment/41414655
has answer: http://stackoverflow.com/a/26380368

http://stackoverflow.com/q/26481875
has answer: http://stackoverflow.com/a/26532971
has comment: http://stackoverflow.com/comment/41633996
type: UnansweredQuestion
tagged with: jacob
tagged with: java
has title: outlook unread mail folder integer value for jacob.jar in java
type: Question
tagged with: outlook
answer count: 1
score: 0
has body: I am using JACOB. jar to access outlook . I am getting the count of my Inbox mails. how can I get the count of unread mail folder in outlook with JACOB. jar Dispatch.call((Dispatch) myNamespace,"GetDefaultFolder", new Integer(6)).toDispatch(); with this code I am getting the count of the Inbox . I tried the values to 10 that is the integer value for contacts folder in outlook . can anyone help me to find the unread mail folder count in outlook.
tagged with: email
has comment: http://stackoverflow.com/comment/41673131
has comment: http://stackoverflow.com/comment/41675298

http://stackoverflow.com/comment/41471930
has text: Because ALL functions depend on it. They all have "driver" in them. They ALL will completely break if I don't make it global.
score: 0
comment on: http://stackoverflow.com/q/26411344
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41684734
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26475252
has text: I already had a working beans.xml configuration and just needed to execute this using spring-boot instead. The issue was that I needed to add <context:property-placeholder location="classpath:application.properties" order="1" ignore-unresolvable="true"/>
type: Comment

http://stackoverflow.com/comment/41639427
type: Comment
type: QuestionComment
has text: @rinuthomaz I am not getting an error, I am getting file named "logs/log-%d{yy/MM/dd HH:mm:ss}.log" (slashes make directories actually)
comment on: http://stackoverflow.com/q/26502096
score: 0

http://stackoverflow.com/a/26525826
accepted answer of: http://stackoverflow.com/q/26512817
answers question: http://stackoverflow.com/q/26512817
score: 0
type: AcceptedAnswer
has body: The below method of making all helper classes as inner classes was wrong and bad design. I was using netBeans, so used Jar file in the project dist folder and it worked just fine. Explanation: The classes were compiled, paths used by Netbeans so it had the right location of classes and lib. also the right Jar file in dist folder. I have put all helper classes in the Plugin class as inner classes. And it has worked just fine. No need to send information between classes. As Plugin is a relatively small class, this approach has worked just fine
type: Answer

http://stackoverflow.com/a/26403283
upvote count: 2
has body: your datosTotal reference is a collection, not an array. So you shouldn't use Arrays to sort it, but rather Collections.sort. For efficiency's sake, I'd also recommend that you use public int compareTo(AGRinformesActivos o) { return Double.compare(this.riesgoTotal,o.riesgoTotal); } Rather than creating two new Double objects for every comparison.
answers question: http://stackoverflow.com/q/26403105
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26481826
has body: I am working on a Minecraft network which has several servers manipulating 'user-objects', which is just a Mongo document. After a user object is modified it need to be written to the database immediately, otherwise it may be overwritten in other servers (which have an older version of the user object), but sometimes hundreds of objects need to be written away in a short amount of time.. (in a few seconds). My question is: How can I easily write objects to a MongoDB database without really overload the database.. I have been thinking up an idea but I have no idea if it is relevant: - Create some sort of queue in another thread, everytime an data object gets need to be saved into the database it gets in the queue and then in the 'queue thread' the objects will be saved one by one with some sort of interval.. Thanks in advance btw Im using Morphia as framework in Java
tagged with: morphia
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/26489444
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: mongodb
has title: Writing hundreds of data objects to a Mongo database

http://stackoverflow.com/a/26452644
type: Answer
answers question: http://stackoverflow.com/q/26399881
has body: This usually happens during development when some files don't get removed while installing the new apk over the existing one. If you check the LogCat, you would be able to find exactly which resource was left behind. This is mostly caused by using two different PCs to test on the same device, or also sometimes using a single PC and a BROKEN_PIPE_ERROR while trying to install over an existing version. Since, some files corresponding to your package stay behind, an application with the same package cannot be installed, until and unless those files are removed forcefully (for which you would need root access). Or, you could factory reset the device. If you can't factory reset or don't have root access, you would need to change the package name of the application. Because then, it tricks the OS to believe that it is a separate application, which is why it worked in your case.
has comment: http://stackoverflow.com/comment/41564923
score: 0
has comment: http://stackoverflow.com/comment/43486057

http://stackoverflow.com/comment/41655447
comment on: http://stackoverflow.com/a/26498489
score: 0
type: AnswerComment
has text: I'm using the same code in my original question with the modification you mentioned (if (min[j] <= numbers[i])). Five lower numbers are outputted, but not the five lowest (i'm using a text file with 5000 integers).
type: Comment

http://stackoverflow.com/comment/41600898
has text: @OliverWatkins Actually, there's plenty wrong. From a purely design perspective, you're not adding any functionality to base class, from a practical sense, you're locking you're self into a constrained container, as windows can't be added to other containers, restricting the reuseability of you component
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/26482182

http://stackoverflow.com/a/26451531
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26451503
has comment: http://stackoverflow.com/comment/41544320
has body: I'm not going to give you answer but you could easily use split function in java that you can learn about here. and at first split with space then split with /
has comment: http://stackoverflow.com/comment/41544304

http://stackoverflow.com/a/46907712
has body: Setting this attribute to ObjectMapper instance works, objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
answers question: http://stackoverflow.com/q/26497856
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/41535762
has text: I tried using a string instead of an int (i posted it as an edit) and it's skipping to y/n input any ideas to solving this?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26436257

http://stackoverflow.com/comment/41644181
comment on: http://stackoverflow.com/q/26505374
type: Comment
type: QuestionComment
has text: @JBNizet Seems like the original code was erroneous :-|
score: 0

http://stackoverflow.com/q/26363159
has answer: http://stackoverflow.com/a/26363465
has comment: http://stackoverflow.com/comment/41384046
has comment: http://stackoverflow.com/comment/41384121
has answer: http://stackoverflow.com/a/26363244
has title: Parsing this message
tagged with: regex
favorite count: 0
tagged with: parsing
has body: So I am stuck with message of the form { Envelope={ Category1={ "key1"="value1"} Category2={ "key2"="value2", "key3"="value3"} } } How do I even go about parsing this weird structure ? I am only interested in the key-value pairs. I want all of them and I don't care about Categories. Ideally like this: key1 = value1 key2 = value2 key3 = value3 (with or without quotes) Solution in any language is acceptable. Perl, Python, Java, C, C++, GNU tools (sed,awk...). The only solution I can think of right now is to write a Java/C++ program but want to avoid that if there are simpler methods out there.
possible better answer: http://stackoverflow.com/a/26363465
has comment: http://stackoverflow.com/comment/41384118
score: -4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41384119
accepted answer: http://stackoverflow.com/a/26363244
tagged with: java
has comment: http://stackoverflow.com/comment/41384914
upvote count: 1
has comment: http://stackoverflow.com/comment/41384132
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41384061
downvote count: 5
tagged with: programming-languages
has comment: http://stackoverflow.com/comment/41384036
tagged with: linux

http://stackoverflow.com/q/26488063
tagged with: connection
type: UnansweredQuestion
tagged with: sockets
tagged with: java
has title: Java ObjectInputStream(Socket socket) restarts the whole application?
has answer: http://stackoverflow.com/a/26497364
tagged with: objectinputstream
type: Question
answer count: 1
has body: So I'm making a java Server and Client. Currently my Client connects to the server and creates Object input and Output streams for both client and server side. Immediately when I try to receive data over that ObjectInputStream(Socket socket) of Server it restarts the whole program. It doesen't even mention about any errors or exceptions or others? Client says: "Server has closed the connection: java.net.SocketException: socket closed" &lt;- so Server also closes the socket and everything related to it. Here's my Server and Client (+ Bonus question: If there are different named objects in Server and Client but the way those objects are made are the same, can I send and read those over socket?) package com.server; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.net.ServerSocket; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import com.gui.Screen; import com.gui.TextArea; public class Server implements Runnable{ //Every connection got their own unique id private static int uniqueId; //List all the clients private static ArrayList&lt;ClientThread&gt; al; private static boolean running = false; @SuppressWarnings("unused") private SimpleDateFormat sdf; ServerSocket serverSocket; public Server(int port) { sdf = new SimpleDateFormat("HH:mm:ss"); al = new ArrayList&lt;ClientThread&gt;(); } public void run() { running = true; try { serverSocket = new ServerSocket(Screen.portnumber); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { //Server socket TextArea.AddLine("Server is running and waiting for Clients to connect."); while(running){ Socket socket = serverSocket.accept(); ClientThread t = new ClientThread(socket); al.add(t); //saving new client to our arraylist. t.run(); if(!running){ //this will make server running stop. TextArea.AddLine("Closing the server.."); break; } } for(int i = 0; i&lt; al.size(); i++){…
score: 0

http://stackoverflow.com/comment/41377906
score: 0
has text: @PiumiWandana try to understand the issue here, this is not the case `true||false||false`, but `true||true||true`. Both cases result is `true`. But second case is not a right angled triangle. You should figure out the issue here before jump into conclusions.
type: AnswerComment
comment on: http://stackoverflow.com/a/26359358
type: Comment

http://stackoverflow.com/a/43989180
score: 14
upvote count: 14
has comment: http://stackoverflow.com/comment/75058369
answers question: http://stackoverflow.com/q/26425045
downvote count: 0
has comment: http://stackoverflow.com/comment/75007962
type: Answer
has body: If you need to add more than one session parameter you can do it like this: jdbc:mysql://localhost/database?sessionVariables=FOREIGN_KEY_CHECKS=0&amp;sessionVariables=SQL_SAFE_UPDATES=0

http://stackoverflow.com/a/54637676
score: 0
has body: Here's some functions I wrote to both calculate the check digit for a given number and to verify a given number sequence and extract the number from it. To calculate the check digit for a given number: /** * Generates the check digit for a number using Luhn's algorithm described in detail at the following link: * https://en.wikipedia.org/wiki/Luhn_algorithm * * In short the digit is calculated like so: * 1. From the rightmost digit moving left, double the value of every second digit. If that value is greater than 9, * subtract 9 from it. * 2. Sum all of the digits together * 3. Multiply the sum by 9 and the check digit will be that value modulo 10. * * @param number the number to get the Luhn's check digit for * @return the check digit for the given number */ public static int calculateLuhnsCheckDigit(final long number) { int sum = 0; boolean alternate = false; String digits = Long.toString(number); for (int i = digits.length() - 1; i &gt;= 0; --i) { int digit = Character.getNumericValue(digits.charAt(i)); // get the digit at the given index digit = (alternate = !alternate) ? (digit * 2) : digit; // double every other digit digit = (digit &gt; 9) ? (digit - 9) : digit; // subtract 9 if the value is greater than 9 sum += digit; // add the digit to the sum } return (sum * 9) % 10; } To verify a sequence of digits using Luhn's algorithm and extract the number: /** * Verifies that a given number string is valid according to Luhn's algorithm, which is described in detail here: * https://en.wikipedia.org/wiki/Luhn_algorithm * * In short, validity of the number is determined like so: * 1. From the rightmost digit (the check digit) moving left, double the value of every second digit. The check * digit is not doubled; the first digit doubled is the one immediately to the left of the check digit. If that * value is greater than 9, subtract 9 from it. * 2. Sum all of the digits together * 3. If the sum modulo 10 is equal to 0, then the number is valid according to Luhn's algor…
type: Answer
answers question: http://stackoverflow.com/q/26383926

http://stackoverflow.com/q/26423951
has title: JSF SessionScoped Bean Fields become null primefaces
type: Question
has comment: http://stackoverflow.com/comment/41495519
tagged with: java
has comment: http://stackoverflow.com/comment/41495623
has body: I Have added the code for menuController my bean is of @SessionScoped and when one of my class extends menuController and in there if I set the value of id and navigate to other page then id value becomes null. import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name = "menuController") @SessionScoped public class MenuController extends BasePage implements Serializable { /** * */ private String id; public MenuController() { } public String getId() { System.out.println("MenuController id = "+id); return id; } public void setId(String id) { this.id = id; } } Here is the code of bean that is inheriting the menuController and setting its id value. THis bean is also @SessionScoped. The value of id which is set is been return null when we get from menuController import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name = "channelLeftPanel") @SessionScoped public class ChannelLeftPanel extends MenuController implements Serializable { public ChannelLeftPanel() { } public String channelEditPage(SelectEvent event) { this.setId(((GenericProduct) event.getObject()).getId()); setSessionParameter("currentView", "/includes/content/channel/editChannel.xhtml"); if (isDebugEnable) logger.debug("Channel ID = " + ((GenericProduct) event.getObject()).getId()); return "mainContentArea"; } } Below is the form from which we are making ajax call whose listner method set the ID in menuController and update the main content form which is basically the center area details &lt;h:form id="leftPanelform"&gt; &lt;p:dataTable var="channelDetail" value="#{channelLeftPanel.channelList}" widgetVar="cTable" emptyMessage="No Channels found with given criteria" selectionMode="single" selection="#{channelLeftPanel.selectedChannel}" rowKey="#{channelDetail.id}" filteredValue="#{channelLeftPanel.filteredChannels}" styleClass="datatableLeft" style="width:100%"&gt; &lt;f:facet name="header"&gt; &lt;p:outputPanel&gt; &lt;h:outputText valu…
has comment: http://stackoverflow.com/comment/41559797
has comment: http://stackoverflow.com/comment/41494705
downvote count: 0
has comment: http://stackoverflow.com/comment/41493122
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41495854
answer count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/41414284
score: 1
comment on: http://stackoverflow.com/q/26370945
has text: You're correct. The problem is when you get into something like maven m2e which goes off into a different place entirely to resolve its class path entry.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26496307
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/41645716
has body: Looking at your code, we see a few problems: XSSFWorkbook managedWorkbook = new XSSFWorkbook(); loadVendorsIntoFile(managedWorkbook,vendors,true); OutputStream outManaged = new FileOutputStream("C:\\Users\\User\\unmanaged_out.xlsx"); managedWorkbook.write(outManaged); outManaged.close(); This writes managedWorkbook into C:\\Users\\User\\unmanaged_out.xlsx XSSFWorkbook nonManagedWorkbook = new XSSFWorkbook(); loadVendorsIntoFile(nonManagedWorkbook,vendors,false); OutputStream outNonManaged = new FileOutputStream("C:\\Users\\User\\unmanaged_out.xlsx"); managedWorkbook.write(outNonManaged); outNonManaged.close(); This also writes managedWorkbook into C:\\Users\\User\\unmanaged_out.xlsx ! I suspect that you meant that last bit to instead be something like: OutputStream outNonManaged = new FileOutputStream("C:\\Users\\User\\unmanaged_out2.xlsx"); nonManagedWorkbook.write(outNonManaged); outNonManaged.close(); Note how the changed snippet both writes into a different file, and importantly, writes out the second workbook you created, rather than outputting the first one twice!
answers question: http://stackoverflow.com/q/26485792
upvote count: 1
has comment: http://stackoverflow.com/comment/41632780
type: Answer

http://stackoverflow.com/comment/41451492
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26383069
has text: Thanks divanov. That could be the problem. Do you know how to implement it in the OpenSSL way?

http://stackoverflow.com/comment/41467035
type: Comment
type: QuestionComment
has text: My results running the exact same code are slightly different:`0E-30 0.000000000000000000000000000000 0 0`
comment on: http://stackoverflow.com/q/26409243
score: 0

http://stackoverflow.com/comment/41498248
type: QuestionComment
type: Comment
has text: You don't need to clear the graphics every time, it is part of the double buffering process which is implemented in Swing by default.
score: 1
comment on: http://stackoverflow.com/q/26422424

http://stackoverflow.com/q/26394737
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/26396512
tagged with: bash
tagged with: shell
has comment: http://stackoverflow.com/comment/41441804
has body: I have a Java program that spawns a bash script that calls another script. In that second script, I'm finding that the $HOME variable is not set. Here's the gist of it: In Java: Process p = new ProcessBuilder("bash", "-l", "/foo/a.sh").start(); // code to actually execute p /foo/a.sh: #!/bin/bash /foo/b.sh /foo/b.sh: #!/bin/bash echo "HOME=$HOME" This echoes "HOME=". The eventual problem is that $HOME/bin is supposed to be added to my PATH in ~/.profile, but since that's not happening, a bunch of custom executables aren't being made accessible. I worked around it by doing: if [ -d ~/bin ] ; then PATH=~/bin:"$PATH" fi And that works fine. But I guess I just want to understand why $HOME wasn't being set. It seems like $HOME and ~ should be largely equivalent, no? There's probably something I'm fundamentally missing about how this environment is getting set up. I am running Ubuntu 12.04.5, if that makes a difference.
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/41444189
has title: HOME environment variable not set in bash script
score: 1
tagged with: java

http://stackoverflow.com/q/26463915
accepted answer: http://stackoverflow.com/a/26464176
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/26464180
has answer: http://stackoverflow.com/a/26464180
favorite count: 0
has answer: http://stackoverflow.com/a/26464176
has body: I have e.g. following Lists: List&lt;tst&gt; listx; // tst object has properties: year, A, B, C, D year A B C D ------------ 2013 5 0 0 0 // list1 2014 3 0 0 0 2013 0 8 0 0 // list2 2014 0 1 0 0 2013 0 0 2 0 // list3 2014 0 0 3 0 2013 0 0 0 1 // list4 2014 0 0 0 5 if I use addAll method, the listTotal will be: year A B C D ------------ 2013 5 0 0 0 // listTotal 2014 3 0 0 0 2013 0 8 0 0 2014 0 1 0 0 2013 0 0 2 0 2014 0 0 3 0 2013 0 0 0 1 2014 0 0 0 5 How to merge them to the listRequired which would be like this? year A B C D ------------ 2013 5 8 2 1 // listRequired 2014 3 1 3 5
has answer: http://stackoverflow.com/a/26464311
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: Merge Lists + update items

http://stackoverflow.com/comment/41564094
has text: http://grepcode.com/file/repo1.maven.org/maven2/commons-lang/commons-lang/2.3/org/apache/commons/lang/StringUtils.java#StringUtils.getLevenshteinDistance%28java.lang.String%2Cjava.lang.String%29
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26462370
type: Comment

http://stackoverflow.com/q/26471270
has body: I'm working with a JavaFX TreeTableView containing items of type BillingTableRow. I want the columns to be styled based on a value given by a method getType() in BillingTableRow, but I can't seem to access it from inside the callback that I'm trying to set up. Here is my code: Callback&lt;TreeTableColumn&lt;BillingTableRow, Double&gt;, TreeTableCell&lt;BillingTableRow, Double&gt;&gt; eveningCallback = 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 = (...)// Get attached BillingTableRow for current tree table row. if (row.getType() == 0) { setText(null); } } }; } }; eveningColumn.setCellFactory(eveningCallback); What should I replace (...) with in order to get it to work?
type: Question
accepted answer: http://stackoverflow.com/a/26471469
score: 0
tagged with: treetableview
has title: Get variable from inside JavaFX TreeTable CellFactory Callback
tagged with: javafx-8
answer count: 1
has answer: http://stackoverflow.com/a/26471469
type: AnsweredQuestion
tagged with: java
tagged with: javafx

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/26429280
type: Tag
tags question: http://stackoverflow.com/q/26437026

http://stackoverflow.com/comment/41585548
type: Comment
type: QuestionComment
has text: I would uninstall the version you installed, download a fresh copy, install a fresh eclipse and import the projects you want.
score: 1
comment on: http://stackoverflow.com/q/26473951

nexus
type: Tag
tags question: http://stackoverflow.com/q/26508163
tags question: http://stackoverflow.com/q/26489330
tag name: nexus

http://stackoverflow.com/comment/41436417
type: QuestionComment
comment on: http://stackoverflow.com/q/26391428
score: 0
type: Comment
has text: Seems like synchronized (terminateList) { // ... } works but you are saying that sharing a list between threads is the wrong way. Why?

http://stackoverflow.com/a/27777456
has comment: http://stackoverflow.com/comment/66831776
answers question: http://stackoverflow.com/q/26439403
has comment: http://stackoverflow.com/comment/66761681
has body: I recently came accross a similar problem again, the only difference being that this time the fact that the string was made of a repeated pattern was explicitly specified instead of just deducible from the specification. I implemented easily a Python function that finds the length of the smallest repeating pattern in the string. I add it here because if is far simpler that using KMP like suggested by Peter de Rivaz, however his answer also brings a proof that the existence of an isomorphic cyclic shift implies that the string is made of a repeated pattern and also the way to solve the problem once the smallest pattern was found. Even if it is written in Python, I believe this code is fairly easy to understand : def smallestPattern(s) (count,res) = (0,1) for i,ch in enumerate(s): if ch != line[count]: count = 0 res += 1 else: count += 1 return res
has comment: http://stackoverflow.com/comment/66822554
score: 0
has comment: http://stackoverflow.com/comment/66813323
has comment: http://stackoverflow.com/comment/66764785
has comment: http://stackoverflow.com/comment/66812473
has comment: http://stackoverflow.com/comment/66766221
type: Answer

http://stackoverflow.com/a/67218790
answers question: http://stackoverflow.com/q/26382936
has body: My use case was slightly different, but sharing because it sounds sufficiently similar so this might work for you. Add to krb5.conf: [domain_realm] .example.com = EXAMPLE.COM Then when you connect to *.example.com, it will use the EXAMPLE.COM realm instead of the default. More here: https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html#domain-realm
type: Answer
score: 0

http://stackoverflow.com/q/26485020
answer count: 1
has answer: http://stackoverflow.com/a/26485272
favorite count: 0
score: -2
has title: syncronized readers and writers in java
downvote count: 2
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/26485272
has comment: http://stackoverflow.com/comment/41604831
has comment: http://stackoverflow.com/comment/41605091
type: Question
type: AnsweredQuestion
tagged with: java
has body: i want to implement my own readWriteLock class, without using the readWriteLock provided by the API. i have this situation: public void read(){ if(!write){ read = true; //any thread can enter here and read; .... read = false; } } public syncrhonized void write(){ if(!read){ write = true; //only one thread at time can write. .... write = false; } } there are a lot of bad situations which can happen with this code, for example: if one thread enter inside if(!read){...} and immediately this become true so it can't write. if threads enter inside if(!write){...} and immediately this become true so they can't read. i manage to use atomicBoolean, but this is a mutex - exclusion for all threads that at the same time want to read and this doesn't resolve the ambiguity. can someone provide me an explanation? thanks in advance.
upvote count: 0

http://stackoverflow.com/comment/41506551
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26430729
has text: @resueman String array sharing has been gone at least since Java 7. It was indeed implemented this way, but thats a thing of the ancient past. Java7/8 use a private array, with exactly the length in chars.

http://stackoverflow.com/comment/41640219
score: 9
type: AnswerComment
has text: people over at jetbrain [do not recommend](https://intellij-support.jetbrains.com/entries/27854363-IDE-doesn-t-start-after-updating-to-Mac-OS-Yosemite-or-Mavericks) using version 1.7 for having several *critical issues*. In addition the discourage to modify Info.plist as it will prevent future updates. I'll better go for installing jdk 1.6
type: Comment
comment on: http://stackoverflow.com/a/26438706

http://stackoverflow.com/a/26405676
has body: Yes, it is possible. You would store the HTTP command as an xml clob. You would also need to have sys access in order to add the calling user to the network ACL.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26405386
has comment: http://stackoverflow.com/comment/41460280

http://stackoverflow.com/comment/41407896
type: Comment
comment on: http://stackoverflow.com/a/26375995
has text: I did but I think you should be more informative so other can learn too
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41553392
type: Comment
has text: This is simply not in any way how you write a compiler or even a lexical analyser. You write, or preferably generate, a single lexical analyser that tells *you* what the token was. Have a look at JavaCC, ANTLR, etc.
type: QuestionComment
comment on: http://stackoverflow.com/q/26455711
score: 0

http://stackoverflow.com/comment/41373337
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26357332
has text: and i guess your running the vm on your machine?...

http://stackoverflow.com/comment/41394136
has text: Just a note, it will exit if you enter anything `0` or below, while your prompt says only entering `-1` will exit.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26368464

http://stackoverflow.com/comment/41452234
has text: @Nabin well, I don't see why you need to catch NullPointerException, since you check for existence before getting the count from the map.
type: AnswerComment
comment on: http://stackoverflow.com/a/26400774
type: Comment
score: 1

http://stackoverflow.com/comment/41609457
type: Comment
has text: @Anarkie see the `MessageDialog` it is based on `IconAndMessageDialog` and gives a good enough example how it can be used..
comment on: http://stackoverflow.com/a/26429471
type: AnswerComment
score: 0

jfilechooser
tags question: http://stackoverflow.com/q/26421548
tag name: jfilechooser
tags question: http://stackoverflow.com/q/26461598
type: Tag

http://stackoverflow.com/comment/41533070
type: QuestionComment
comment on: http://stackoverflow.com/q/26445238
score: 0
has text: ((pickmeup == 1) is this ur real code
type: Comment

http://stackoverflow.com/a/26369597
type: Answer
answers question: http://stackoverflow.com/q/26369493
has body: You return a Void on your onPostExecute method. That shouldn't be any valid information you need more exactly that cannot be a String you can display.
score: 0

http://stackoverflow.com/comment/51770086
comment on: http://stackoverflow.com/a/26429998
has text: Ok, I'm trying to get a grip on threads and I found your answer to be very helpful. Particularly the part about `Thread.stop()` - always wondered about that myself; that explanation alone is a +1 from me.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/41538774
has text: If you can't access on cmd your are behind a proxy which is configured in your web browser...which needs to be configured correctly in Maven which mean in settings.xml.
comment on: http://stackoverflow.com/q/26442108
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41590684
type: Comment
type: QuestionComment
has text: @drewmoore i realized that i misunderstood him and updated the comment
score: 0
comment on: http://stackoverflow.com/q/26476798

http://stackoverflow.com/comment/41446311
comment on: http://stackoverflow.com/q/26387726
has text: I have made changes to the first point you had suggested. I tried changing the encoding to UTF-8 on both sides. But I didn't see any change in the results.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26416090
has comment: http://stackoverflow.com/comment/41491990
type: UnansweredQuestion
tagged with: selenium
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41491714
tagged with: java
has comment: http://stackoverflow.com/comment/41490862
type: Question
downvote count: 0
favorite count: 0
has title: Automation test In hybrid application
has body: I'm doing automation testing with appium, selenium and junit in android device. My native application has some hyperlink and I need to verify web content after clicking on each link. But selenium can't switch driver like this(from remote driver to web driver). Is there any way to do this ? Or any tool, framework instead of using selenium, appium can handle this task ? Any help would be great.
tagged with: android
has comment: http://stackoverflow.com/comment/41493288
has comment: http://stackoverflow.com/comment/41487126
answer count: 0

http://stackoverflow.com/q/26420773
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: javafx
answer count: 2
has answer: http://stackoverflow.com/a/26426702
score: 0
tagged with: javafx-8
has answer: http://stackoverflow.com/a/26424837
has body: Is it possible to use code which is not related to special javafx features in non JavaFX application? My application builds on top of JavaSE 8. That means than the javafx runtime and the apis are included in any way. Can i use the property framework of javafx from package javafx.beans located in the jfxrt.jar? Is it neccesarry to run this code in the special java fx runtime? Thanks in advance and best regards Sebastian
possible better answer: http://stackoverflow.com/a/26424837
accepted answer: http://stackoverflow.com/a/26426702
has title: Using JavaFX api from jfrt.jar in non JavaFX applications

http://stackoverflow.com/comment/41563887
score: 0
comment on: http://stackoverflow.com/q/26462429
type: Comment
type: QuestionComment
has text: You mean to say you want `student`, `150`, etc from JSON as `String`, `int`, etc. & set it in setter methods or use somewhere else in Java code ?

http://stackoverflow.com/comment/41499877
has text: could you please run it in your system and tell me the output
type: Comment
comment on: http://stackoverflow.com/a/26422766
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41482815
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26415922
score: 0
has text: So the correct sequence should be something like \u30BF\u30A\u30F2\u30A1\u30CC\u30AE\u30A\u30AB\u30A\u30D3\u30A7\u30F ?

http://stackoverflow.com/q/26456333
tagged with: matrix
downvote count: 0
favorite count: 0
has body: I am having problems modeling matrixes of a not defined number of places in StarUML... I've read in a previous question that, to add an array as an attribute, you have to write: array: int[*] After seeing that, I tried: matrix: int[][] matrix: int[ * ][ * ] matrix: int[ * ][ ] matrix: int[ ][ * ] But none worked. They all sent a wrong syntax error popup. Does anyone know what the correct syntax would be?
type: UnansweredQuestion
has title: StarUML class diagram: add attribute of the type int [][]
has comment: http://stackoverflow.com/comment/44443625
answer count: 0
tagged with: java
type: Question
tagged with: staruml
score: 5
upvote count: 5
linked to: http://stackoverflow.com/q/7949622

http://stackoverflow.com/a/26362277
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26361736
type: AcceptedAnswer
has body: If one tag is nested inside another, then it's a child element. In your case DefEnv is parent and Environment is its child. DefEnv is in fact the root element. You might be confused why DefEnv is not the child of Environment, but other way around here, but that's not your concern. That's the structure so you gotta parse it the way it is. You don't need to make logical sense of which element needs to be child of what other element. For example XHTML is based on xml. In that case, you have to care about things like html tag needs to be the root element and body tag needs to be the child element. In your case, you don't care because you just want to parse the id attribute of Environment. You can use XPath or Xslt to get the id. Research on them.
downvote count: 0
answers question: http://stackoverflow.com/q/26361736
type: Answer
score: 1

http://stackoverflow.com/comment/41367841
type: QuestionComment
comment on: http://stackoverflow.com/q/26353887
score: 0
has text: No that code is to create thread in normal way (like only one thread). I wrote that to show that to show that those are the parameters used inside that thread. I havent started that thread. That is my question. how to start that thread with those parameters. Ok ill modify the questions with the thread class.
type: Comment

http://stackoverflow.com/comment/41439968
comment on: http://stackoverflow.com/a/26393721
score: 0
type: AnswerComment
has text: btw you could write this a little better as well: you could loop through the secretNumber's characters instead of having 5 repeated if statements.
type: Comment

http://stackoverflow.com/a/26405327
has body: I suggest that you use a database. I am giving you a link which shows you how to use a MySQL database with Java. http://www.lionblogger.com/java-application-mysql-database/ I hope this solves your issue.
answers question: http://stackoverflow.com/q/26401050
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/46459959
upvote count: 1
has comment: http://stackoverflow.com/comment/41459504
downvote count: 1

http://stackoverflow.com/comment/41625641
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26485792
has text: Your code snipped shows you writing to the same file each time!
type: Comment

http://stackoverflow.com/q/26503627
linked to: http://stackoverflow.com/q/2405916
has title: EclipseLink generates duplicate primary keys on an Oracle DB
has body: I am using EclipseLink 2.4.2 (in combination with Spring, but I don't think it has anything to do with our issue here) and we had a few times the following exception: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001 : unique constraint (****.PK_*****) violated Our primary keys are generated by EclipseLink which uses an Oracle sequence to allocate them. I double checked, and the allocationSize matches exactly the increment by defined on the sequence. Here is an example of how this sequence is defined in our Java class: @Id @SequenceGenerator(name = "SOME_GENERATOR", sequenceName = "SOME_SEQ", allocationSize = 10000, initialValue = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SOME_GENERATOR") @Column(name = "ID") private Long id; Here is the sequence creation SQL-statement: CREATE SEQUENCE SOME_SEQ INCREMENT BY 10000 START WITH 10000; Of course, the problem is hardly reproduceable and only happens randomly. It seems to happen more often when the server is under heavy load. I don't know if this is relevant, but here are some extra infos: We have two servers accessing the same database The primary key definition is inherited by many classes My first thinking would be that this is related to concurrency, but it would seem like a rather severe issue for such a mature framework. Any other thing I should verify or that I could have overlooked? I have looked at related posts such as theses ones: use of EntityManagerFactory causing duplicate primary key exceptions Persistence errors using @GeneratedValue for primary key JPA throws no EntityExistsException but generates a duplicate row (auto generated PK) but they don't seem to help in m…
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26536099
has comment: http://stackoverflow.com/comment/41646585
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41698007
linked to: http://stackoverflow.com/q/23217972
tagged with: jpa
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41645985
tagged with: oracle-database
tagged with: eclipselink
has answer: http://stackoverflow.com/a/26536099
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/41658254

http://stackoverflow.com/comment/41550491
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26454845
has text: Your sample code works fine on OS X. Maybe try calling: `tree.setOpaque(true)`.

http://stackoverflow.com/comment/41402422
has text: Nevermind, I found it! The files were still in the app\build\intermediates\res\debug\drawable-hdpi-v4 folder, once I deleted them it built successfully.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26372461

http://stackoverflow.com/comment/41394839
has text: where is the image? and did you google your question? its all about nesting your views- i'd suggest vertical orientation linearlayout with vertical scrollayout with a textview as child view then a horizontal scrollview.. since the parent is a linearlayout with orientation vertical it will position the views to your preferred interest..
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26368227

http://stackoverflow.com/comment/41685189
has text: When I call `session.wait(jobId, Session.TIMEOUT_WAIT_FOREVER)` I get the following: `org.ggf.drmaa.InvalidJobException: The job specified by the 'jobid' does not exist.` I also tried `synchronize`, but it doesn't really wait until the job has finished.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26494175
type: Comment

http://stackoverflow.com/a/30038404
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I decompiled the driver and within the XLSResultSet of the net.pcal.sqlsheet added in the following hssf cell check: public static String getStrVal(Cell cell) { long ival = 0; Boolean bool = false; String cData = ""; switch(cell.getCellType()){ case Cell.CELL_TYPE_BLANK: cData = null; break; case Cell.CELL_TYPE_STRING: cData = cell.getStringCellValue(); break; case Cell.CELL_TYPE_FORMULA: switch(cell.getCachedFormulaResultType()) { case Cell.CELL_TYPE_NUMERIC: cData = String.valueOf(cell.getNumericCellValue()); break; case Cell.CELL_TYPE_STRING: cData = String.valueOf(cell.getRichStringCellValue()); break; } break; default: cData = "unsupported cell type"; break; } return cData; } Then to the existing string check modified it so it is as follows: public String getString(String jdbcColumn) throws SQLException { Cell cell = getCell(jdbcColumn); if (cell == null) { return cell == null ? null : formatter.formatCellValue(cell); }else{ String myCell = getStrVal(cell); return myCell; } } This resolved the issue for both formulas and for referenced cells.
answers question: http://stackoverflow.com/q/26377444

http://stackoverflow.com/q/26399885
answer count: 0
tagged with: java
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/41563802
type: Question
has body: I'm stacked in my project and I need some help, I'm added jtextfield to the jmenubar. But I couldn't get Keytyped event for the added jtxtfield. If anyone knows how can do that, Please help me. Here example code: in the jframe constructor: public NewJFrame1() { initComponents(); JTextField txt1=new JTextField(); jMenuBar1.add(txt1); }
has comment: http://stackoverflow.com/comment/41563858
has comment: http://stackoverflow.com/comment/41450722
score: 0
has comment: http://stackoverflow.com/comment/41563615
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41563432
has title: Get Keytyped event for JMenubar textfield
tagged with: swing

http://stackoverflow.com/q/26406764
tagged with: java
linked to: http://stackoverflow.com/q/920344
has title: How can I parse broken XML files in Java?
has answer: http://stackoverflow.com/a/26406941
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/41465069
has comment: http://stackoverflow.com/comment/41469319
has comment: http://stackoverflow.com/comment/41462575
favorite count: 0
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/26406919
duplicate of: http://stackoverflow.com/q/920344
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/41463297
type: UnansweredQuestion
has body: I'm receiving XML files from an external source over which I have no control. Some of the XML files are broken. Specifically, towards the end of the file, some closing tags are missing. It goes something like this: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;a&gt; &lt;b&gt; &lt;c/&gt; &lt;/b&gt; &lt;b&gt; &lt;c/&gt; &lt;/a&gt; I think our system will be fine if we simply ignore the elements that don't have a matching closing tag. What library can I use to parse what I can from such XML files?
has comment: http://stackoverflow.com/comment/41462748
score: 3
has answer: http://stackoverflow.com/a/26406956

http://stackoverflow.com/q/26430639
has comment: http://stackoverflow.com/comment/41521909
score: 2
type: AnsweredQuestion
downvote count: 0
has title: why does Java servlet gives ClientAbortException when file size larger than about 2 MB?
favorite count: 0
has comment: http://stackoverflow.com/comment/41506941
tagged with: mod-jk
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26441403
tagged with: ioexception
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/41508577
has answer: http://stackoverflow.com/a/26430718
has body: I'm trying to write a java servlet that is located on a Linux server, that may be used by a client to download a video file. It works when the file size is small (perhaps less than 2 MB), but larger file sizes return the error: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe. After searching Google, it appears this error occurs when the client breaks the connection. In my case, I'm using the client and can confirm that I'm not doing anything that would break the connection (at least not on purpose) -- the browser remains open, etc., when this error occurs. Any idea what might be causing this (and how to fix)? public class GetFile extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); } protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String filename ="init_java"; try { // get user parameters filename = req.getParameter("fileId"); // complete path to video file //res.setContentType("video/mp4"); //not working res.setContentType("application/x-download"); File file=new File(filename); if (file.exists()) { res.setHeader("Content-Disposition", "inline; filename=\""+filename+"\""); res.setHeader("Cache-Control", "cache, must-revalidate"); //res.setHeader("Pragma", "public"); // not sure when to use returnFile(filename, res.getOutputStream()); } else { //error handling goes here } } catch (Exception e) { ... } finally { ... } } private static void returnFile(String filename, OutputStream out) throws FileNotFoundException, IOException { InputStream in = null; try { in = new BufferedInputStream(new FileInputStream(filename)); byte[] buf = new byte[4 * 1024]; // 4K buffer int bytesRead; while ((bytesRead = in.read(buf)) != -1) { out.write(buf, 0, bytesRead); } } finally { if (in != null) in.close(); } } } UPDATE 1 I'm seeing the following error in the mod_jk.log file (which transfers the request from Apache web server…
has comment: http://stackoverflow.com/comment/41507931
accepted answer: http://stackoverflow.com/a/26441403
possible better answer: http://stackoverflow.com/a/26430718
tagged with: servlets
has comment: http://stackoverflow.com/comment/41510231

http://stackoverflow.com/a/26386078
type: Answer
downvote count: 0
score: 1
has body: Because MainClass is part of the package com.company.application, and must be ran as such (com.company.application.MainClass). You cannot run MainClass by itself, or just using .MainClass. To check yourself, try running each option in a command line!
answers question: http://stackoverflow.com/q/26385957
upvote count: 1

http://stackoverflow.com/a/26427572
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41502231
has comment: http://stackoverflow.com/comment/41513671
accepted answer of: http://stackoverflow.com/q/26425105
has comment: http://stackoverflow.com/comment/41501766
type: Answer
has body: You can do this with Regular Expression in Java assuming that you can't have Nested Parenthesis (this is a strict necessity) List&lt;String&gt; parts = new ArrayList&lt;String&gt;(); String input = "+2+ sqrt(25 )-41*3- abs(-4)-62 /2"; Pattern p = Pattern.compile("[\\+\\-/\\*][^\\+\\-\\*/\\(]+(\\([^\\(\\)]*\\))?"); Matcher m = p.matcher(input); while (m.find()) { parts.add(m.group()); } If you want an array you cant do : parts.toArray(new String[parts.size()]); This will give you a simple array of String. I am using Java Collections to handle the array creation because there is no way to know the size of the array before parsing the String Explanations about this regex : [\\+\\-/\\*] looks for an operator sign [^\\+\\-\\*/\\(]+ looks for everything except operators and left parenthesis (\\([^\\(\\)]*\\))?looks for a parenthesis content without nested parenthesis This code gives : +2 + sqrt(25 ) -41 *3 - abs(-4) -62 /2 If you need nested parenthesis, then you need to implement a Parser, and I let you google it.
answers question: http://stackoverflow.com/q/26425105

http://stackoverflow.com/a/26479882
answers question: http://stackoverflow.com/q/26479463
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: Before you can do this, you must add the following code: System.setProperty("jsse.enableSNIExtension", "false"); before the lines: // get the login page by connect to the URL final HtmlPage loginPage = (HtmlPage) wclient.getPage(loginUrl); If you don't do this, you will get an error: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name Then, depending on the version of WebClient class you are using, try one of the lines of code below: wclient.setUseInsecureSSL(true); wclient.getOptions().setUseInsecureSSL(true); Note - Disabling security is very dangerous. So don't do this in production code.
accepted answer of: http://stackoverflow.com/q/26479463

http://stackoverflow.com/q/26395919
tagged with: tree
type: AnsweredQuestion
tagged with: java
has title: Unable to add to Map
type: Question
has comment: http://stackoverflow.com/comment/41443525
has answer: http://stackoverflow.com/a/26395935
has body: It seems to be getting a NullPointerException in thread main, specifically on the line where I put the nodes and where I call the addEdge method. private TreeMap&lt;Node, Set&lt;Node&gt;&gt; nodeToNeighbours; In main Graph test1 = new Graph(); Node n1 = new Node(1); Node n2 = new Node(2); test1.addEdges(n1, n2); addEdges Class public void addEdge(Node node1, Node node2) { nodeToNeighbours.put(node2, new TreeSet&lt;Node&gt;()); nodeToNeighbours.put(node1, new TreeSet&lt;Node&gt;()); }
score: 0
answer count: 2
tagged with: adjacency-list
possible better answer: http://stackoverflow.com/a/26395978
has answer: http://stackoverflow.com/a/26395978
accepted answer: http://stackoverflow.com/a/26395935

http://stackoverflow.com/comment/41584304
type: QuestionComment
has text: I'd like to know an idea or the methon explained. :)
comment on: http://stackoverflow.com/q/26473400
score: 0
type: Comment

http://stackoverflow.com/q/26378017
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/41411282
type: Question
has title: Android string file to image
has body: from server side an image is being sent to me. The image i receive it as string, what server side is sending me is the entire file. How can I read it in android side? File tempFile = File.createTempFile("image", ".jpg", null); // tempFile.wr byte[] bytes = output.toString().getBytes(); FileOutputStream fos = new FileOutputStream(tempFile); fos.write(bytes); output is the result i receive, its string which is the entire file send from server side. Bitmap myBitmap = BitmapFactory.decodeFile(tempFile.getAbsolutePath()); m2.setImageBitmap(myBitmap); I am getting SkImageDecoder::Factory returned null this code running produces this log cat File tempFile = File.createTempFile("image", ".jpg", null); FileOutputStream fos = new FileOutputStream(tempFile); fos.write(output.toString().getBytes()); fos.close(); System.out.println(""+tempFile.getAbsolutePath()); BitmapFactory.Options myOptions = new BitmapFactory.Options(); myOptions.inDither = true; myOptions.inScaled = false; myOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;// important myOptions.inPurgeable = true; Bitmap bitmap = BitmapFactory.decodeFile(tempFile.getAbsolutePath()); m2.setImageBitmap(bitmap); http://www.speedyshare.com/8BdVs/log.txt
has comment: http://stackoverflow.com/comment/41411507
has comment: http://stackoverflow.com/comment/41412104
score: 0
has comment: http://stackoverflow.com/comment/41411756
has comment: http://stackoverflow.com/comment/41411253
answer count: 1
has comment: http://stackoverflow.com/comment/41411667
linked to: http://stackoverflow.com/q/22601603
has comment: http://stackoverflow.com/comment/41411325
has answer: http://stackoverflow.com/a/26378134
has comment: http://stackoverflow.com/comment/41411739
type: UnansweredQuestion

http://stackoverflow.com/comment/41629122
type: Comment
comment on: http://stackoverflow.com/a/26497243
has text: Using the synchronized block, he doesn't really need the concurrent data structures, unless there's more to the code.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26503887
type: UnansweredQuestion
has body: I have a pre-defined tuple class which cannot be modified as follows: public class Tuple { protected String name; public Tuple(int id, String name) { this.id = id; this.name = name; } } I have another class which defines an array of the above tuple: public class Stack { protected ArrayList&lt;Tuple&gt; tupleLst; public Stack(){ this.tupleLst=new ArrayList&lt;Tuple&gt;(10); } } Then I need to sort the array of tuple in another class: for instance: public class Algo { public static int Sort(Relation r){ } public static void main(String[] arg){ Algo.Sort(); } The Relation r is the input array of tuples. I have searched online, where I saw many people actually are using Comparators and Collections.sort() to do that. However, after I tried, I noticed that the Tuple class need to implement comparators in order to sort. How can I sort the tuple without changing the first two classes? Thank you in advance!
score: -1
has answer: http://stackoverflow.com/a/26503960
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26504035
tagged with: sorting
answer count: 2
has title: How to sort a array of tuple if the tuple is a pre-defined class without implement comparator in Java
upvote count: 0
has comment: http://stackoverflow.com/comment/41639233
tagged with: arrays
has comment: http://stackoverflow.com/comment/41639240
favorite count: 0
tagged with: tuples

http://stackoverflow.com/comment/41634669
type: Comment
type: QuestionComment
score: 0
has text: Are you sure you are posting anything? In your code you define a newUser, but you never attach it to the post request.
comment on: http://stackoverflow.com/q/26501070

http://stackoverflow.com/a/39779448
has body: tl;dr you are signing to the app with the wrong account. long story In my case I had 3 different accounts on my phone and I was trying to sign in (implicitly) from the wrong account. How can be a wrong account you might ask? So, basically the app is in the beginning in a "test mode" with only specific accounts that is listed in the Developer Console can access the api. So, what I did is I went to the Google Play Games app, and changed the settings that the account that can sign in is selected.
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/75828410
upvote count: 1
answers question: http://stackoverflow.com/q/26446591

http://stackoverflow.com/a/26481065
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: I guess that you have somewhere a @Cacheable method like this: @Cacheable(value = "assignedFeedbacks") public void getReceipt(Object receiptId) throws Exception { Since @Caching annotations can get deal only with single cache entry at once, there is no reason to take a look how SpEL can can work with arrays, because the key should be a single object. The only way I see is based on the direct Cache Abstraction usage: @Autowired private CacheManager cacheManager; public void addReceipt(ReceiptObject receiptObject) throws Exception { feedbackDao.insertReceipt(receiptObject); Cache cache = cacheManager.getCache("assignedFeedbacks"); for (Object receiptId: receiptObject.getResolverIds()) { cache.evict(receiptId); } }
score: 1
accepted answer of: http://stackoverflow.com/q/26480541
answers question: http://stackoverflow.com/q/26480541

http://stackoverflow.com/a/34853838
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26385618
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26385618
type: Answer
has body: Use node.js and execute your script using Runtime.exec(). you would run node on this or you can go for Rhino scripting engine to envoke methods in .js file from within a java class. Hope that helped.
score: 1

http://stackoverflow.com/comment/41477673
type: AnswerComment
has text: Thanks, but what I wanted to know was how to customize the listview to have a button and the distinctive colors, if not make a imageview or if there is a component in android.
comment on: http://stackoverflow.com/a/26414552
type: Comment
score: 0

http://stackoverflow.com/comment/41411667
has text: how do you download the file? which library do you use? could you show more code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26378017

http://stackoverflow.com/comment/41435587
score: 0
has text: That is something that I did notice and I altered the loop starting position for "i" to "0" in an attempt to counteract that. The VBscript is my "true" code that I am working off of so I think that testing altering the if (i % 2 !=0) to if (i % 2 == 0) in the Java would make sense.
type: AnswerComment
comment on: http://stackoverflow.com/a/26366126
type: Comment

http://stackoverflow.com/q/26473229
has answer: http://stackoverflow.com/a/26473498
has body: I am looking for some help with a project i am working on. I am relatively new to java and am working to make a function to generate a password. There is probably alot of error in this or this might be completely wrong so please be nice to a newbie >.&lt; import java.util.Random; public class StillTesting { public static void main(String[] args) { System.out.println("Your new password is: " + generateValidPassword()); } static private String generateValidPassword() { String numcase = ""; String lowcase = ""; String upcase = ""; String halfpass = numcase.concat(upcase); String returnString = halfpass.concat(lowcase); System.out.print(returnString); Random r = new Random(); String loweralphabet = "abcdefghijklmnopqrstuvwxyz"; int n = loweralphabet.length(); String upperalphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int N = upperalphabet.length(); int num = 0; for (int i = 0; i &lt; 3; i++) { num = r.nextInt(9); numcase = String.valueOf(num = r.nextInt(9)); return numcase; } for (int i = 0; i &lt; 3; i++) { lowcase = String.valueOf(loweralphabet.charAt(r.nextInt(n))); return lowcase; } for (int i = 0; i &lt; 3; i++) { upcase = String.valueOf(upperalphabet.charAt(r.nextInt(N))); return upcase; } return returnString; } }
possible better answer: http://stackoverflow.com/a/26473340
accepted answer: http://stackoverflow.com/a/26473341
answer count: 4
tagged with: generator
has answer: http://stackoverflow.com/a/26473340
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: passwords
has answer: http://stackoverflow.com/a/26473385
has comment: http://stackoverflow.com/comment/41583870
has comment: http://stackoverflow.com/comment/41583891
has comment: http://stackoverflow.com/comment/41583834
score: 0
has answer: http://stackoverflow.com/a/26473341
has comment: http://stackoverflow.com/comment/41584039
has comment: http://stackoverflow.com/comment/41583904
has comment: http://stackoverflow.com/comment/41583907
has comment: http://stackoverflow.com/comment/41583818
favorite count: 0
has title: Newbie looking for help on a password code

http://stackoverflow.com/q/26411343
has answer: http://stackoverflow.com/a/26414327
type: UnansweredQuestion
has title: Connect to MySQL with Java
has comment: http://stackoverflow.com/comment/41470898
has body: Okay im really new to java and i dont know how to really do it. if you guys could help me then i might understand alot more of it. I got my main class (Mysql.java) and a Connection class (Connection.java) Now i want it to Connect to the database using the Connection.java part. but i want to use it from Mysql.java. I got this right now: Mysql.java public class Mysql { public static void main(String[] args) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int w = screenSize.width; JFrame frame = new MainFrame(w/5, 100, 2*w/5, 0); frame.show(); new Connection(); } } class MainFrame extends JFrame { MainFrame(int width, int height, int x, int y) { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Todothelydoo - To do planner"); setSize(width, height); setLocation(x, y); JPanel mainPanel = new JPanel(); mainPanel.setBackground(Color.blue); } } Connection.java public class Connection { public static Connection getConnection() throws SQLException { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://h2318966.stratoserver.net/"; String user = "root"; String password = ""; conn = (Connection) DriverManager.getConnection(url, user, password); System.out.println("Connection established"); } catch(ClassNotFoundException e) { System.out.println(e.getMessage()); System.exit(0); } catch(SQLException e) { System.out.println(e.getMessage()); System.exit(0); } return conn; } } I tried using new Connection in the mysql.java but im probably being an utter idiot. If you guys could help me that would be great.
has comment: http://stackoverflow.com/comment/41471809
has answer: http://stackoverflow.com/a/26412534
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41470703
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/41470936
score: 0

http://stackoverflow.com/comment/41435532
type: Comment
type: QuestionComment
has text: I also wanted to know if I can implement an AVL tree without using a linked list or array list, but I figured that out.
score: 0
comment on: http://stackoverflow.com/q/26390911

http://stackoverflow.com/comment/41557253
has text: hey, I have noticed something, if there is an anchor tag in the html content, then the bold tag is not getting closed, otherwise everything is working fine, can you please take a look at it? italic bold underline Prashant Ghimire
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26403471

http://stackoverflow.com/comment/41473677
type: QuestionComment
comment on: http://stackoverflow.com/q/26412762
score: 0
has text: Look at my answer it is what you are looking for.
type: Comment

http://stackoverflow.com/comment/41495245
type: QuestionComment
comment on: http://stackoverflow.com/q/26425105
score: 1
has text: please refrain from asking logic related questions as this may have multiple solutions and is far off topic. always upload the code that you have tried and the error you are getting
type: Comment

http://stackoverflow.com/q/26364667
possible better answer: http://stackoverflow.com/a/26365081
tagged with: bigdecimal
has title: BigDecimal.ZERO vs. new BigDecimal(0). Which to use and why?
has answer: http://stackoverflow.com/a/26365081
favorite count: 0
has comment: http://stackoverflow.com/comment/41387613
has comment: http://stackoverflow.com/comment/41387474
downvote count: 1
has comment: http://stackoverflow.com/comment/41387327
has comment: http://stackoverflow.com/comment/41387212
has comment: http://stackoverflow.com/comment/41387357
score: 41
has comment: http://stackoverflow.com/comment/41386922
has comment: http://stackoverflow.com/comment/41387565
has comment: http://stackoverflow.com/comment/41387252
has body: I was wondering if these two are the same. Can anyone verify? (I am trying to replace the 1st with the 2nd) BigDecimal totalCurrentSales = new BigDecimal(0); and BigDecimal totalCurrentSales = BigDecimal.ZERO; The reason I ask is that it is improper to declare it the first way since you are not supposed to create instances of already existing BigInteger and BigDecimal (ZERO, ONE, TEN). So I was wondering if I could say it the second way and it still be considered creating an instance. Instead of me having to create a variable zero or something that is equal to BigDecimal.ZERO. Or are there any other ways? I tried BigDecimal totalCurrentSales = new BigDecimal(BigDecimal.ZERO); but eclipse wasn't too happy.
upvote count: 42
has answer: http://stackoverflow.com/a/26365086
accepted answer: http://stackoverflow.com/a/26365086
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41387247
tagged with: java
has comment: http://stackoverflow.com/comment/41386954
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/91338042

http://stackoverflow.com/a/26475178
downvote count: 0
has body: Instead of editing the question, I am adding as answer as to what worked in my case; Kudos to @mendieta (1) I tried marking driver as a dependency in MANIFEST.MF [Dependencies: com.oracle] ; and creating the module.xml inside /jboss/jboss-eap-6.2/modules/system/layers/base/com/oracle/main and placing both module.xml and the ojdbc6.jar inside the main directory. <?xml version="1.0" encoding="UTF-8"?> <resource-root path="ojdbc6-11.2.0.4.jar"/> This worked :) hence issue was with referring the correct jdbc driver. Tomcat could[probably tomcat has its version of jdbc(?)], jetty could, but jboss need this way of installing the jdbc driver. (2) Added the following entries in pom.xml to add the manifest entry while creating the war file, and also to exclude the ojdbc.jar from the manifest classpath(if you set classpath true, I did not) and to exclude from WEB-INF/lib org.apache.maven.plugins maven-war-plugin 2.5 com.oracle com.oracle ojdbc6 11.2.0.4 provided References for maven pom.xml : http://maven.apache.org/guides/mini/guide-archive-configuration.html note: Removing the ojdbc.jar from war file might prevent the application from running in tomcat server. It's removed from the war assuming its gonna run in jboss server, where we already installed the driver as a jboss module.
score: 1
accepted answer of: http://stackoverflow.com/q/26370270
answers question: http://stackoverflow.com/q/26370270
type: AcceptedAnswer
upvote count: 1
type: Answer

http://stackoverflow.com/comment/41566549
score: 1
type: Comment
has text: Please don't change the question once people start answering it, other than to add clarification. Changing the actual code from something that compiles but doesn't work, to something that doesn't compile, just invalidates people's answers.
type: QuestionComment
comment on: http://stackoverflow.com/q/26463899

http://stackoverflow.com/comment/41534311
type: Comment
comment on: http://stackoverflow.com/a/26445822
score: 1
type: AnswerComment
has text: Gradle projects from Android Studio don't work in Eclipse as is.

http://stackoverflow.com/comment/41611506
score: 0
type: Comment
has text: My phone is a oneplus one, it might be a hardware issue, maybe weather/clouds. The GPS Mode on the phone is set at High Accuracy. and the minimum distance is 5 meters and interval are at 5 seconds. I've added the code.
type: AnswerComment
comment on: http://stackoverflow.com/a/26488499

http://stackoverflow.com/q/26502051
has body: I know how to count most things when it comes to Java, but this has either stumped me a lot, or my brain is dying. Anyway, I have a class called "Jobs", and within that class is a String variable called "day". Multiple new Jobs have been created already (exact number is unknown), and now I need to query and find out how many Jobs are on x day. I assume it would be easy enough with a while loop, but I don't know how to create one that looks through Jobs as a whole rather than one specific one. The Job data was created by reading a file (the name of which is jobFile) via a Scanner. public class Job_16997761 { private int jobID; // unique job identification number private int customerID; // unique customer identification number private String registration; // registration number for vehicle for this job private String date; // when the job is carried out by mechanic private String day; // day of the week that job is booked for private double totalFee; // total price for the Job private int[] serviceCode; // the service codes to be carried out on the vehicle for the job //Constructor public Job_16997761(int jobID, int customerID, String registration, String date, String day, double totalFee, int[] serviceCode) { this.jobID = jobID; this.customerID = customerID; this.registration = registration; this.date = date; this.day = day; this.totalFee = totalFee; this.serviceCode = serviceCode; }
has comment: http://stackoverflow.com/comment/41635913
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26502287
has answer: http://stackoverflow.com/a/26502220
type: Question
has comment: http://stackoverflow.com/comment/41640282
tagged with: java
has comment: http://stackoverflow.com/comment/41636099
has title: Java: counting number of times data appears in a class
has comment: http://stackoverflow.com/comment/41635956
tagged with: class
has comment: http://stackoverflow.com/comment/41635797
has answer: http://stackoverflow.com/a/26502260
score: 0
has comment: http://stackoverflow.com/comment/41635800
has comment: http://stackoverflow.com/comment/41636059

http://stackoverflow.com/comment/41563579
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26462368
has text: Your question is pretty unclear. What is the relationship between JSON and latitutes/longitude? What are you referring to?
type: QuestionComment

http://stackoverflow.com/q/26408533
tagged with: android
score: -1
has body: ACTIVITY 1: SEND DATA(MA_NV) TO SWIPMENU_CONTROL public class public class MainActivity extends ActionBarActivity { public Button DangKy_Btn; public Button DangNhap_Btn; public EditText MaNV_Edit; public EditText Password_Edit; public CheckBox TrangThai_CB; public TextView MaNV_Info; DBAdapter db; String prefname="my_status"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db= new DBAdapter(MainActivity.this); DangKy_Btn=(Button) findViewById(R.id.DangKy_Btn); DangKy_Btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent= new Intent(MainActivity.this,dang_ky.class); startActivity(myIntent); } }); MaNV_Edit=(EditText) findViewById(R.id.MaNV_Edit); MaNV_Info=(TextView) findViewById(R.id.MaNV_Info); Password_Edit=(EditText) findViewById(R.id.Password_Edit); TrangThai_CB=(CheckBox) findViewById(R.id.TrangThai_CB); DangNhap_Btn=(Button) findViewById(R.id.DangNhap_Btn); DangNhap_Btn.setOnClickListener(new OnClickListener() { public void onClick(View v) { String Ma_NV=MaNV_Edit.getText().toString(); String Mat_Khau=Password_Edit.getText().toString(); db.open(); Cursor c=db.Check_Login(Ma_NV,Mat_Khau); if(c.moveToFirst()){ do_Login(Ma_NV); } else Toast.makeText(MainActivity.this,"Thất bại",Toast.LENGTH_SHORT).show(); db.close(); } }); } public void do_Login(String Ma_NV){ Toast.makeText(MainActivity.this, Ma_NV, Toast.LENGTH_SHORT).show(); finish(); Intent myIntent=new Intent(MainActivity.this,SwipMenu_Control.class); Bundle myBundle=new Bundle(); myBundle.putString("manv",Ma_NV); myIntent.putExtra("Ma_NV",myBundle); startActivity(myIntent); } protected void onPause(){ super.onPause(); //GOI HAM LUU TRANG THAI savingPreferences(); } protected void onResume(){ super.onResume(); //GOI HAM DOC TRANG THAI restoringPreferences(); } public void savingPreferences(){ SharedPreferences pre=getSharedPreferences(prefname,MODE_PRIVATE); SharedPreferences.Edit…
tagged with: java
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26419652
tagged with: android-fragments
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/26419652
has comment: http://stackoverflow.com/comment/41465578
has title: why can't i send data from Activity to Fragments
favorite count: 0
type: Question

http://stackoverflow.com/comment/81053589
type: Comment
comment on: http://stackoverflow.com/a/47044547
has text: Well, I prefer a solution that might be inefficient, depending on how Streams are implemented, over a solution that might break, depending on how Streams are implemented. Your solution relies on the current implementation’s inability to fuse a `skip` with the stream source. A future version might be able to truly skip all preceding steps that do not change the stream size, just like Java 9’s `count()` may not evaluate these functions…
score: 5
type: AnswerComment

http://stackoverflow.com/comment/41542649
type: Comment
type: QuestionComment
has text: @ameneh obaid presumably your jfreechart version and jcommon version doesn't match
comment on: http://stackoverflow.com/q/26450556
score: 0

http://stackoverflow.com/a/26472143
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41610313
type: Answer
has comment: http://stackoverflow.com/comment/41683897
has comment: http://stackoverflow.com/comment/41627541
answers question: http://stackoverflow.com/q/26381170
has comment: http://stackoverflow.com/comment/41636383
accepted answer of: http://stackoverflow.com/q/26381170
has body: Edit: Removing previous answer because it didn't solve your problem the way you wanted to do it. I dug into the environment startup code and realized the reason why registering a controller didn't make it available is because jetty had already been started. If you stop jetty, register your controller and start jetty back up again, your resource will be available and you can use it in your test. @BeforeClass public static void setUpBeforeClass() throws Exception { MyTest.RULE.environment.applicationContext.stop() MyTest.RULE.environment.jersey().register(new JustForTestingResource()) MyTest.RULE.environment.applicationContext.start() }
upvote count: 5
has comment: http://stackoverflow.com/comment/41712886
has comment: http://stackoverflow.com/comment/41738896

http://stackoverflow.com/a/26462943
has comment: http://stackoverflow.com/comment/41567581
has comment: http://stackoverflow.com/comment/41599245
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41566483
upvote count: 9
type: Answer
has body: I've always regarded the Old Generation and Tenured Generation as the same thing, and this diagram from http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html backs that up. if you Google Old generation versus Tenured you'll also find lots of people saying things like "Tenured (Old) Generation" -like http://www.javaspecialists.eu/archive/Issue092.html Occasionally, I've seen people regard Old Generation as the Tenured + Permanent Generation but I've never seen any official confirmation for that.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26461226
answers question: http://stackoverflow.com/q/26461226
score: 9

resin
type: Tag
tag name: resin
tags question: http://stackoverflow.com/q/26379984

http://stackoverflow.com/comment/41463215
comment on: http://stackoverflow.com/a/26401590
score: 0
has text: There are 2 fragments (a and b) added to a viewpager with a listview in each. If i select a cell in fragment(a) it pop a fragment(a1) on top of if. Lets say i do that in the two root fragements (a an b) with no internet connexion, it popup for each root fragment a fragment(a1 and b1) on top of them which contain the view "reload". Now i reconnect internet, and click reload in a1 it will call onclick() in b1 and update b1 with the data of a1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/41526595
has text: Hint: "reversing a number" doesn't mean anything. A number is not a thing that has a front or a back or a beginning or an end. The thing that you are trying to reverse is the _place value representation_ of a number. The place value representation is a sequence of _digits_ with a beginning and an end. The thing that you want to reverse is the sequence of digits.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26440594
type: QuestionComment

http://stackoverflow.com/q/26488897
type: Question
has body: Help needed on this: I tried to call getLocationOnScreen() on each component I placed inside a FlowLayout and getting the same position in the end. Is this by design or did I do something wrong? How should I get each components exact location then? There's the example I just created JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); frame.getContentPane().add(panel); for (int i = 0; i &lt; 4; i++) { JLabel label = new JLabel("Label " + i); panel.add(label); System.out.println("getLocationOnScreen-" + i + " x:" + label.getLocationOnScreen().x + " y:" + label.getLocationOnScreen().y); } It prints in the console as: getLocationOnScreen-0 x:0 y:44 getLocationOnScreen-1 x:0 y:44 getLocationOnScreen-2 x:0 y:44 getLocationOnScreen-3 x:0 y:44 Great appreciation if you can help on this! Thanks!
has comment: http://stackoverflow.com/comment/41614443
has comment: http://stackoverflow.com/comment/41613206
has comment: http://stackoverflow.com/comment/41612166
has title: Swing getLocationOnScreen method on component inside a layout
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/26490210
has comment: http://stackoverflow.com/comment/41612060
has comment: http://stackoverflow.com/comment/41613389
has comment: http://stackoverflow.com/comment/41612920
score: 0
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41612634
tagged with: layout
has comment: http://stackoverflow.com/comment/41612446
accepted answer: http://stackoverflow.com/a/26490210
tagged with: awt
has comment: http://stackoverflow.com/comment/41612547
has comment: http://stackoverflow.com/comment/41612258

http://stackoverflow.com/q/26444011
answer count: 1
has answer: http://stackoverflow.com/a/26444167
tagged with: android
tagged with: checkbox
favorite count: 0
score: -1
has body: So i created a custom listview adapter. Every Listview's item contains a checkbox. And i have a button to check or uncheck all checkboxes in ListViw. I try to do it so: // buttons' click listener's code for(int i = 0; i &lt; list.getCount(); i++) { // list is some ListView View item = adapter.getView(1, null, list); // adapter is list's adapter CheckBox ch = ((CheckBox)item.findViewById(R.id.myCheckbox)); ch.setChecked(true); } As you can see i try to set all checkboxes in ListView checked. This code is perfomed successfully, no exception. But checkboxes reman unchecked. Why?
type: UnansweredQuestion
downvote count: 1
type: Question
has title: How to set checkbox checked?
tagged with: java
upvote count: 0

http://stackoverflow.com/a/26417159
has comment: http://stackoverflow.com/comment/41481990
type: Answer
has comment: http://stackoverflow.com/comment/41482042
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/41482106
has body: If I understand the "question" correctly (such as it is &mdash; you say there's a "roadblock" but you fail to explain what exactly the "roadblock" is), you are trying to implement in C# the code to read and write text from the stream. If so, then (and I know if you're new to .NET this isn't immediately obvious) explicitly handling the text encoding yourself is insane. BinaryReader and BinaryWriter have methods to handle this. When you create the objects, you can pass an Encoding instance (e.g. System.Text.Encoding.UTF8, System.Text.Encoding.Unicode, etc.) which is used to interpret or create binary data for text. You can use BinaryReader.ReadChars(int) to read text, and BinaryWriter.Write(char[]) to write text. If for some reason that doesn't work, at the very least you can use an Encoding instance directly to interpret or create binary data for some text. Encoding.GetString(byte[]) will convert binary to text, and Encoding.GetBytes(string) will convert text to binary. Again, using a specific Encoding instance for the actual text encoding you're dealing with.
answers question: http://stackoverflow.com/q/26416779
downvote count: 0

http://stackoverflow.com/a/26375326
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26375311
has body: You never pass an array object at all. You pass an array reference, which is always going to be passed by value. If you want to create a copy of the array, then pass a reference to that copy to the method, the simplest approach is probably to call clone: mat(arr.clone()); Note that calling clone() on an array always makes a shallow clone - irrelevant here, but if you had a Person[] for example, it wouldn't create a copy of each Person referred to by the original array... so changes to the cloned array (e.g. clonedArray[0] = new Person()) wouldn't be seen by the calling code, but changes to the objects referred to by the array (e.g. clonedArray[1].setName("Fred")) would be seen via the original array, because the two arrays would refer to the same objects. As a side note, I'd strongly recommend keeping the type information in one place for variables, e.g. int[] arr rather than int arr[]. I'd also recommend using braces for if, for, and while statements even when the body is only a single statement.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26375311

http://stackoverflow.com/comment/41554666
comment on: http://stackoverflow.com/q/26457113
type: QuestionComment
has text: I copy pasted your source and its working fine for me. Are you passing file name properly like - `lexicon.txt` not `lixicon`?
score: 0
type: Comment

http://stackoverflow.com/q/26373578
tagged with: android
has body: I've for instance this simple constructor: public Car(String brand, String model, int price){ this.brand=brand; this.model=model; this.price=price; } So, I need create Objects to check a data base: new Car (null, null, 15000); new Car (Opel, null, null); I don't have problems in the firs case, but in the second case, the value null for an integer is not allowed. Any suggestion? Thank's!
score: 0
type: AnsweredQuestion
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/26373591
type: Question
answer count: 2
has title: Integer null in order to check a Data Base
possible better answer: http://stackoverflow.com/a/26373617
has comment: http://stackoverflow.com/comment/41403664
has answer: http://stackoverflow.com/a/26373617
accepted answer: http://stackoverflow.com/a/26373591

http://stackoverflow.com/q/26439907
type: UnansweredQuestion
has title: How to start a Java Jar file the right way from a website with parameters
has answer: http://stackoverflow.com/a/26440333
has comment: http://stackoverflow.com/comment/41524101
has body: I want to start a Java Jar file from a website with parameters like e.g. ID. There are two main questions. So the user goes on the website, clicks on a button and the Jar file starts. The first question is how to get the jar started after clicking a button. The second question is about the blocking of java jar files. If I go to www.quickscreenshare.com for example, chrome blocks the plugin. I have to give permission to the execution of the jar and sometimes I also have to restart the browser after that permission. Is there a way to start the jar directly without this annoying permission stuff? What is the best way to add a jar execution to a button?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41529154
has comment: http://stackoverflow.com/comment/41524031
score: 0
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/41524262

http://stackoverflow.com/comment/41505323
type: QuestionComment
has text: You would have to use a larger decimal to compare to if you wanted higher precision. Subtraction and addition aren't problems though. You should be more concerned with division if you are worrying about precision issues.
score: 0
comment on: http://stackoverflow.com/q/26430189
type: Comment

http://stackoverflow.com/q/26450420
answer count: 5
has answer: http://stackoverflow.com/a/31127429
tagged with: macos
type: UnansweredQuestion
has body: I have updated to Yosemite today and have much problems with java. Most java applications crashes on start but after reinstall of the old Mac-Java 1.6 that problem seems to be solved. But I have an other big problem. When I start Eclipse Luna and build my own Java application and start this application with the run button in Eclipse, it crashes with the following report: dyld: lazy symbol binding failed: Symbol not found: _CGContextSetAllowsAcceleration Referenced from: /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Libraries/libawt.jnilib Expected in: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices dyld: Symbol not found: _CGContextSetAllowsAcceleration Referenced from: /Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Libraries/libawt.jnilib Expected in: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices When I export the app as .jar file and start it from outside eclipse eveything works fine. Do you have any solution how I can fix this? Otherwise I must reinstall Mavericks to be productive tomorrow.
downvote count: 1
type: Question
score: 14
has answer: http://stackoverflow.com/a/26613873
has answer: http://stackoverflow.com/a/26475600
tagged with: java
has answer: http://stackoverflow.com/a/26495007
has answer: http://stackoverflow.com/a/27810074
tagged with: eclipse
upvote count: 15
has title: OSX 10.10 and Eclipse Luna. Own App crashes when started from inside Eclipse
favorite count: 0

http://stackoverflow.com/comment/41393198
type: QuestionComment
type: Comment
has text: On which line are you getting the `cannot find symbol error`?
comment on: http://stackoverflow.com/q/26367946
score: 0

http://stackoverflow.com/q/26416936
has comment: http://stackoverflow.com/comment/41481020
score: 0
has body: is there a way to know the class name of an object in javascript that is coming from java using websockets. the classes are sent as json. in javascript i parse the message as: var chatMessage = JSON.parse(frame.body); and in java i send the object as: //chatMessage is ChatMessage object; template.convertAndSend("/topic/chat", chatMessage); the constructor function in javascript returns "object" only. how can i get "ChatMessage" class in javascript? or should make a ChatMessage object in javascript then use the instanceof operator? the data comes from the server is json: [{"sender":"user","message":"test"},{"sender":"user","message":"asd"},{"sender":"user","message":"test2"}] console.log(chatMessage) output: [Object, Object, Object, Object, Object, Object]
has comment: http://stackoverflow.com/comment/41481094
has title: java object to javascript object websockets
has comment: http://stackoverflow.com/comment/41481073
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41481091
answer count: 0
tagged with: java
type: Question
tagged with: javascript

http://stackoverflow.com/q/26470783
has comment: http://stackoverflow.com/comment/41589539
has comment: http://stackoverflow.com/comment/41579380
has comment: http://stackoverflow.com/comment/41583467
type: Question
has comment: http://stackoverflow.com/comment/41588326
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26475006
tagged with: gson
has comment: http://stackoverflow.com/comment/41585145
score: 0
has body: For example my JSON file look like this; { "Test1": { "A": {}, "B": "1", "C": "2", "D": "3" }, "Test2": { "A": {}, "B": "4", "C": "5", "D": "6" }, "Test3": { "A": {}, "B": "7", "C": "8", "D": "9" }, "Test4": { "A": {}, "B": "10", "C": "11", "D": "12" } ... ... } This would have been simple if the file only contained a few records, but in my case I'm dealing with thousands of records. For simpler version I've used gson library but not sure how I could load this JSON file which has unique name for each record into Java. ***************UPDATE******************************* I now managed to read it raw and Map the data. However, still have a minor issue. This is the code I used to Map ObjectMapper mapper = new ObjectMapper(); File jsonFile = new File(jsonFilePath); Map&lt;String, Object&gt; mapObject = mapper.readValue(jsonFile, new TypeReference&lt;Map&lt;String, Object&gt;&gt;() { }); System.out.println(mapObject.get("Test1")); I'm getting below results, which is fine. However, not sure how I could obtain the data within "values" of the map. {A={}, B=1, C=2, D=3} I tried below to re-map but it's failing as expected, because the keys no longer are surrounded by double quotes (see above)! Map&lt;String, Object&gt; nestedObject = mapper.readValue( mapObject.get("Test1").toString(), new TypeReference&lt;Map&lt;String, Object&gt;&gt;() { });
answer count: 1
has comment: http://stackoverflow.com/comment/41583854
has comment: http://stackoverflow.com/comment/41584901
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41579639
has title: How to load a JSON file into java that has unique name for each record?

http://stackoverflow.com/comment/41576062
score: 0
has text: ISO-8859-1, though even when I try StandardCharsets.ISO_8859_1 it comes out the same as above
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26469049

http://stackoverflow.com/q/26373056
tagged with: servlets
has comment: http://stackoverflow.com/comment/41402896
has comment: http://stackoverflow.com/comment/41403098
has body: I've got a Java issue that has been baffling me. Below is my quick explanation of the flow of this web app. A user clicks a button on a jsp page which calls the server The server code "ManagerWebsiteFlow.java" performs some logic and puts some data in the request session attribute The control is then passed on to an "output.jsp" page The output.jsp page contains an html image tag The html image tag calls the server "ManagerStreamReport.java", this class creates a png &amp; returns it to the image tag. This all works fine in my local environment with the four major browsers. But when the code is online, it does not work in FF and Chrome. The session attribute is lost during step 5. Extra information. In both FF and Chrome, if I go back to step 1 and try again, it all works fine &amp; there are no session lost issues. And it continues working fine until I close the browser and start again. I'm using Tomcat 7, Java 7 and Spring MVC version 4. The major pieces of my code are below along with some log tracing where you can see how the session ID is lost in FF and Chrome and not in IE and Safari. Is it a timing issue? Why would FF and Chrome be the only ones that don't work? Any thing ideas as to what is causing this? Any suggestions on how to fix or what else I could check? ManagerWebsiteFlow { public String build(HttpServletRequest request) { request.getSession().setAttribute("MyObjectName", "MyContent"); log.error("MWF The Session ID Is : " + request.getSession().getId()); // More code here } } &lt;!-- output.jsp --&gt; &lt;html&gt; &lt;body&gt; &lt;img src="http://www.onlinewebsite.com/streamReport.do" id="mainImg" /&gt; &lt;/body&gt; &lt;/html&gt; ManagerStreamReport{ public boolean convertChart(HttpServletRequest request, HttpServletResponse response) { log.error("MCC The Session ID Is : " + request.getSession().getId()); // More code here } } *** LOG4J File ** -- Logging when using Chrome 10-14@20:56:13 ERROR (ManagerWebsiteFlow.java:51) - MWF The Session ID Is : 9…
score: 0
answer count: 1
has title: Java Session ID Not Found in Servlet
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41421528
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41403056
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41415925
has comment: http://stackoverflow.com/comment/41421624
tagged with: jsp
has answer: http://stackoverflow.com/a/26516247
accepted answer: http://stackoverflow.com/a/26516247

http://stackoverflow.com/comment/41607629
comment on: http://stackoverflow.com/a/26484503
type: AnswerComment
has text: Thank's again for your help!
score: 0
type: Comment

http://stackoverflow.com/a/26400527
has comment: http://stackoverflow.com/comment/41451491
has comment: http://stackoverflow.com/comment/41457111
answers question: http://stackoverflow.com/q/26400325
type: Answer
has comment: http://stackoverflow.com/comment/41451245
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41451227
has comment: http://stackoverflow.com/comment/41451832
has body: You could design your pritning method like follows: public class Main { private final static Predicate&lt;String&gt; notEmpty = s -&gt; s != null; private final static Predicate&lt;String&gt; notBlank = s -&gt; !s.equals(""); // ... private static void printName(final String firstName, final String lastName) { final boolean firstNameOk = notEmpty.and(notBlank).test(firstName); final boolean lastNameOk = notEmpty.and(notBlank).test(lastName); final StringBuilder result = new StringBuilder(); // Old version: //result // .append(lastNameOk ? lastName : "") // .append(lastNameOk &amp;&amp; firstNameOk ? ", " : "") // .append(firstNameOk ? firstName : ""); // End of old Version: // New version: if (lastNameOk) { result.append(lastName); } if (firstNameOk) { if (lastNameOk) { result.append(", "); } result.append(firstName); } // End of new version: System.out.println(result); } } Then some example calls: public static void main(String[] args) { printName("James", "Bond"); printName("James", null); printName(null, "Bond"); printName(null, null); } Will print: Bond, James James Bond
upvote count: 2
has comment: http://stackoverflow.com/comment/41453470
has comment: http://stackoverflow.com/comment/41451132

http://stackoverflow.com/comment/41644731
comment on: http://stackoverflow.com/a/26506898
type: AnswerComment
score: 0
type: Comment
has text: oh i accidentally gave you a vote up :), i want the opposite my friend i send the number and get the representation , but note that numbers like 25 has no representation if the number set used for representation was from (2 to 7)

http://stackoverflow.com/a/59412839
answers question: http://stackoverflow.com/q/26425045
score: 8
downvote count: 0
upvote count: 8
type: Answer
has body: The MySQL Connector/J Configuration Properties documentation has been updated since with a better description, especially when it comes to setting multiple system variables in the connection URL : sessionVariables A comma or semicolon separated list of name=value pairs to be sent as SET [SESSION] ... to the server when the driver connects. Since version: 3.1.8 Which results in URLs like this one : jdbc:mysql://xxxx.xx.xx.xx/dbName?sessionVariables=group_concat_max_len=204800,bulk_insert_buffer_size=42 Semicolons can be used instead of commas. A mix of the two can be used within the same URL. This will only work for system variables that have a SESSION scope (you can find out which ones can be set at SESSION-level by looking at the list of Server System Variables). The connection will fail if the variable doesn't exist, if it is not a server system variable or if its scope is GLOBAL-only.

http://stackoverflow.com/comment/41549894
type: QuestionComment
has text: Ok can you provide me the service detail..such as url..method type..content type...request format..response format...i ll like to do by myself to understand actual problem
comment on: http://stackoverflow.com/q/26439235
score: 0
type: Comment

http://stackoverflow.com/comment/41489559
score: 0
type: Comment
type: QuestionComment
has text: @Tom the country class reads the year, and subscriptions data for that year. Each country should have its own data for a specific year. When i placed a system.out.print(subscriptions[0].getYear()) outside the for loop, it read from 1960 to 2012 but did 253 times. As you mentioned i think it overwrites how will you go about each country having its own row of data
comment on: http://stackoverflow.com/q/26421232

http://stackoverflow.com/q/26495794
has body: I'm trying to insert a value in my database mySql using an android application. this is the method to insert value from android: private void insert() { // TODO Auto-generated method stub ArrayList&lt;NameValuePair&gt; namePairs = new ArrayList&lt;NameValuePair&gt;(); namePairs.add(new BasicNameValuePair("titolo", titoloTxt)); namePairs.add(new BasicNameValuePair("content", contentTxt)); try { // HttpClient per avviare la connessione HttpClient client = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://www.example.net/connect/insert.php"); httpPost.setEntity(new UrlEncodedFormEntity(namePairs)); HttpResponse response = client.execute(httpPost); HttpEntity entity = response.getEntity(); is = entity.getContent(); Log.i("Db connect", "Success"); } catch (Exception e) { e.printStackTrace(); Log.e("Errore connessione", e.toString()); Toast.makeText(getApplicationContext(), "IP non valido", Toast.LENGTH_SHORT).show(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); Log.i("Connection", "Connessione eseguita con successo"); } catch (Exception e) { e.printStackTrace(); } try { JSONObject jObj = new JSONObject(result); code = (jObj.getInt("code")); if(code==1){ Toast.makeText(getBaseContext(), "Insert ok", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getBaseContext(), "Non va na pippa", Toast.LENGTH_SHORT).show(); } } catch (JSONException e) { e.printStackTrace(); } } and here the insert.php EDITED &lt;?php include ('db_connection.php'); $id=$_POST['ID']; $title=$_POST['post_title']; $content=$_POST['post_content']; $flag['code']=0; $sql_insert_post="INSERT INTO wp_posts (ID, post_title, post_content) VALUES ('$id','$title','$content')"; if (!mysqli_query($db,$sql_insert_post)) { die('Error: ' . mysqli_error($db)); } $flag['code']=1; echo "Hi"; print(json_encode…
has comment: http://stackoverflow.com/comment/41625601
has comment: http://stackoverflow.com/comment/41625001
has comment: http://stackoverflow.com/comment/41624759
has comment: http://stackoverflow.com/comment/41625932
score: 0
has comment: http://stackoverflow.com/comment/41626142
tagged with: android
has comment: http://stackoverflow.com/comment/41625324
has comment: http://stackoverflow.com/comment/41626083
has comment: http://stackoverflow.com/comment/41625745
has title: Can't insert value to mysql from android app
answer count: 0
has comment: http://stackoverflow.com/comment/41625659
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/41625626
has comment: http://stackoverflow.com/comment/41624844
has comment: http://stackoverflow.com/comment/41625460
tagged with: java
has comment: http://stackoverflow.com/comment/41625380
tagged with: mysql
has comment: http://stackoverflow.com/comment/41624890
type: Question
has comment: http://stackoverflow.com/comment/41625754
has comment: http://stackoverflow.com/comment/41625121

http://stackoverflow.com/comment/41634384
score: 0
type: Comment
has text: He's using Tomcat. Write an answer about Tomcat. Surely you don't need a hint about that?
comment on: http://stackoverflow.com/a/26445458
type: AnswerComment

http://stackoverflow.com/a/54460918
score: 0
type: Answer
has body: As suggested by assylias, the 100% Java way to do this is with Files.readAllBytes(path). Heap space errors depend on the file size and the amount of free memory in the JVM heap; you need to verify that the first is lower than the second before reading it: File file = new File(path); bytes[] bytes; if (file.length &gt; Runtime.getRuntime().freeMemory()) { // warn about reading } else { bytes = Files.readAllBytes(path) // do stuff with 'bytes' }
answers question: http://stackoverflow.com/q/26403523

http://stackoverflow.com/comment/41704053
comment on: http://stackoverflow.com/q/26475176
score: 0
type: QuestionComment
has text: Can you paste the full contents of the testserver script (exec'd by the Upstart job)?
type: Comment

forecasting
tags question: http://stackoverflow.com/q/26437225
tag name: forecasting
type: Tag

http://stackoverflow.com/comment/41758673
type: QuestionComment
has text: no. I need check usage in network. Upload and download usages.
comment on: http://stackoverflow.com/q/26506711
score: 0
type: Comment

http://stackoverflow.com/a/26425743
has body: In execute command you can of asyc task you can pass as many paramters as you can. ParseURL task = new ParseURL(); task.execute(parameter1, parameter2, parameter3); @Override protected String doInBackground(String... strings) { if(strings[0]== your condition){ // do this } if(strings[1]== your condition){ // do this } if(strings[2]== your condition){ // do this } }
score: 0
has comment: http://stackoverflow.com/comment/41498228
answers question: http://stackoverflow.com/q/26425527
has comment: http://stackoverflow.com/comment/41497016
type: Answer

http://stackoverflow.com/a/26373172
has body: You could do something like this: public enum Color { BLUE, GREEN, RED, YELLOW; public Color next() { return Color.values()[ (this.ordinal() + 1) % Color.values().length ]; } } Using Color#next() would iterate through all your Colors and eventually go back to the beginning, when it would have reached the last one. For example: public static void main(String[] args) { Color currentColor = Color.BLUE; for(;;) { System.out.println(currentColor); currentColor = currentColor.next(); } } ... would output: BLUE GREEN RED YELLOW BLUE GREEN RED YELLOW BLUE GREEN RED ... If you want to interface it to actual java.awt.Colors, I'd suggest you to simply enhance it as follows: public enum ColourSet { BLUE(Color.BLUE), GREEN(Color.GREEN), RED(Color.RED), YELLOW(Color.YELLOW); private final java.awt.Color color; private ColourSet(java.awt.Color color) { this.color = color; } public ColourSet next() { return ColourSet.values()[ (this.ordinal() + 1) % ColourSet.values().length]; } public java.awt.Color getColor() { return color; } public static void main(String[] args) { ColourSet current = ColourSet.BLUE; for(;;) { System.out.println(current.getColor()); current = current.next(); } } } In the same way, that code would now ouput: java.awt.Color[r=0,g=0,b=255] java.awt.Color[r=0,g=255,b=0] java.awt.Color[r=255,g=0,b=0] java.awt.Color[r=255,g=255,b=0] java.awt.Color[r=0,g=0,b=255] java.awt.Color[r=0,g=255,b=0] java.awt.Color[r=255,g=0,b=0] java.awt.Color[r=255,g=255,b=0] java.awt.Color[r=0,g=0,b=255] java.awt.Color[r=0,g=255,b=0] java.awt.Color[r=255,g=0,b=0] ...
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26373007
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26373007

http://stackoverflow.com/comment/41497438
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26425628
type: QuestionComment
has text: So is there a way to exclude all devices from installing?

http://stackoverflow.com/comment/41621247
type: Comment
comment on: http://stackoverflow.com/q/26493896
score: 2
type: QuestionComment
has text: What kind of update? New data, new Java version or new application version? You'll may need a component that can send an HTTP-Request to the corresponding server that will deliver newest version number.

http://stackoverflow.com/q/26444274
has title: Creation method vs Factory Method
has body: "Kerievsky states that the Replace Constructors with Creation Methods refactoring does not generate an implementation that is fully compliant with the Gang of Four's concept of a Factory Method." I'm trying to wrap my head around this. As far as I know Factory methods are always Creation methods but Creation Methods are not always Factory methods? Could someone explain this to me?
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26444562
type: Question
upvote count: 2
answer count: 2
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/41531383
has answer: http://stackoverflow.com/a/53825025
tagged with: java
downvote count: 1
type: UnansweredQuestion
tagged with: factory-pattern

http://stackoverflow.com/a/26388066
has comment: http://stackoverflow.com/comment/41430142
has comment: http://stackoverflow.com/comment/41430647
has comment: http://stackoverflow.com/comment/41430144
has body: To get the byte[] representation of a file, I would look at the Apache FileUtils library, specifically the org.apache.commons.io.FileUtils.readFileToByteArray(java.io.File file) method. To get the String representation of the file, use org.apache.commons.io.FileUtils.readFileToString(java.io.File file) (You also need to know about java files.) Also, the java.sql.PreparedStatement object guards against SQL injection attacks.
has comment: http://stackoverflow.com/comment/41430260
has comment: http://stackoverflow.com/comment/41429985
has comment: http://stackoverflow.com/comment/41430298
answers question: http://stackoverflow.com/q/26387743
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/41430030
has comment: http://stackoverflow.com/comment/41430059

http://stackoverflow.com/comment/41632735
comment on: http://stackoverflow.com/q/26500223
has text: Removed GlassFish because the problem and solution is unrelated to the application server. Similar for *war* and *angularjs* tags.
score: 0
type: Comment
type: QuestionComment

2d
tags question: http://stackoverflow.com/q/26432426
tags question: http://stackoverflow.com/q/26415228
tags question: http://stackoverflow.com/q/26498792
tag name: 2d
tags question: http://stackoverflow.com/q/26430687
tags question: http://stackoverflow.com/q/26513513
type: Tag

http://stackoverflow.com/comment/41548080
score: 0
type: Comment
has text: Yes it works! But I'm going to have to go with the last answer to this question as it is a shorter solution which fits because I have lots of separators and operators. Thank you sir. +1
type: AnswerComment
comment on: http://stackoverflow.com/a/26453012

try-catch
tags question: http://stackoverflow.com/q/26454322
tags question: http://stackoverflow.com/q/26442037
tags question: http://stackoverflow.com/q/26399384
tags question: http://stackoverflow.com/q/26472862
tags question: http://stackoverflow.com/q/26471387
type: Tag
tags question: http://stackoverflow.com/q/26473914
tags question: http://stackoverflow.com/q/26467364
tags question: http://stackoverflow.com/q/26450211
tags question: http://stackoverflow.com/q/26431003
tags question: http://stackoverflow.com/q/26430448
tags question: http://stackoverflow.com/q/26473924
tags question: http://stackoverflow.com/q/26359882
tag name: try-catch
tags question: http://stackoverflow.com/q/26355336
tags question: http://stackoverflow.com/q/26498904

http://stackoverflow.com/a/26466869
has comment: http://stackoverflow.com/comment/41571560
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/41571720
answers question: http://stackoverflow.com/q/26466827
score: 1
has body: Your editAmount.getText().toString() value is NULL(empty). And you still trying to convert this value into DOUBLE so you got NumberFormatException . Check editText value before parsing like: if(!editAmount.getText().toString().equals("")) { //Do your job } Or another way is if (!TextUtils.isEmpty(editAmount.getText().toString())) { //Do your job }
downvote count: 0
has comment: http://stackoverflow.com/comment/41571911
has comment: http://stackoverflow.com/comment/41572610

http://stackoverflow.com/comment/41629636
type: Comment
comment on: http://stackoverflow.com/a/26498332
has text: I need to get List(WebElement> array of all links in , each tr (inside td) contains a link, once I have this list now loop through list and compare the String text and select accordingly
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41495285
type: Comment
type: QuestionComment
score: 0
has text: Will you application server fetch data from the server or the other way around? What time is it that you want to measure?
comment on: http://stackoverflow.com/q/26425092

http://stackoverflow.com/q/26379715
score: -1
tagged with: java
downvote count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/849813
type: Question
duplicate of: http://stackoverflow.com/q/849813
has answer: http://stackoverflow.com/a/26379907
has comment: http://stackoverflow.com/comment/41414517
answer count: 3
has answer: http://stackoverflow.com/a/26379783
favorite count: 0
has body: what data type is suitable for a given 20 digit numbers like 12111111111111111111 and could be converted to binary? I tried long but it's goes out of range.
has answer: http://stackoverflow.com/a/26379776
type: UnansweredQuestion
has title: suitable data type for 20 digit numbers

http://stackoverflow.com/q/26433334
has answer: http://stackoverflow.com/a/53863881
type: Question
has body: I am trying to make a method that takes an Enum value and returns an object that is casted to a class based on that Enum value. For example, I have an Enum called ComponentType: public enum ComponentType { HEALTH(HealthComponent.class), HUNGER(HungerComponent.class); private Class&lt;? extends Component&gt; componentClass; private ComponentType(Class&lt;? extends Component&gt; componentClass) { this.componentClass = componentClass; } public Class&lt;? extends Component&gt; getComponentClass() { return componentClass; } } "HealthComponent" and "HungerComponent" are two classes that both extend a class called "Component". What is inside them is not important for this question. An Entity would have a list of Components that they are assigned (For example, one entity may have hunger, while another may have health, and another may have both). My objective is to create a method inside the Entity that when a value from the ComponentType Enum is passed in, a Component object casted to the corresponding class type for that value is returned. So if you passed in ComponentType.HEALTH, the method would return an object casted to HealthComponent. Here is what I am trying, but it is not working: (Edit: see below) public &lt;T extends Component&gt; T getComponentByType(ComponentType type) { Class&lt;? extends Component&gt; componentClass = type.getComponentClass(); for(Component component : componentList) { if(component.getClass() == componentClass) { return (T) componentClass.cast(component); } } return null; } For the above method, when passing in a type of ComponentType.HEALTH: entity.getComponentByType(ComponentType.HEALTH); an object casted to "Component" rather than "HealthComponent" would be returned. I want it to return an object casted to HealthComponent, not Component. Is there any way to do this? I feel like this should be possible. My reason for trying to find a way to do this is because it seems like doing all this casting: HealthComponent component = (HealthComponent…
has title: Returning a casted object based on input Enum value
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/41511787
accepted answer: http://stackoverflow.com/a/26435501
has comment: http://stackoverflow.com/comment/41512236
tagged with: java
has comment: http://stackoverflow.com/comment/41511909
tagged with: enums
tagged with: casting
upvote count: 5
downvote count: 0
linked to: http://stackoverflow.com/q/4290878
has comment: http://stackoverflow.com/comment/41511926
has comment: http://stackoverflow.com/comment/41549091
has comment: http://stackoverflow.com/comment/41511428
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26435501
has comment: http://stackoverflow.com/comment/41511852
has comment: http://stackoverflow.com/comment/41512160
tagged with: generics
possible better answer: http://stackoverflow.com/a/53863881
favorite count: 0

http://stackoverflow.com/comment/41651371
comment on: http://stackoverflow.com/q/26510629
score: 0
type: Comment
type: QuestionComment
has text: Your methods calls one an other and it not able to complete execution so the heap keep growing till it runs out of memory !

http://stackoverflow.com/comment/41441863
type: QuestionComment
has text: Side note, read this: http://stackoverflow.com/questions/2770321/what-is-a-raw-type-and-why-shouldnt-we-use-it
comment on: http://stackoverflow.com/q/26394895
score: 0
type: Comment

http://stackoverflow.com/comment/41569533
comment on: http://stackoverflow.com/q/26465823
score: 0
type: QuestionComment
has text: looks like a problem with redeployment of the enhanced version of the file. can you build it once again, redeploy and check.
type: Comment

http://stackoverflow.com/comment/135018169
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26401758
type: Comment
has text: The first three lines can be simplified to Date ``dateFromLocalDT = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant());``.

http://stackoverflow.com/a/26465682
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41569473
score: 1
upvote count: 1
has body: From the comment , I can suggest you that check file exits on the path specified. Use File File f = new File("D:\\UpdateXLS.xls"); //check whether file exists or not to avoid any further exceptions if(f.exists()){ Workbook wb = WorkbookFactory.create(f); Sheet sheet = wb.getSheetAt(0); Row row = sheet.getRow(2); ...... ....... ........ } FileNotFoundException Signals that an attempt to open the file denoted by a specified pathname has failed. This exception will be thrown by the FileInputStream, FileOutputStream, and RandomAccessFile constructors when a file with the specified pathname does not exist. It will also be thrown by these constructors if the file does exist but for some reason is inaccessible, for example when an attempt is made to open a read-only file for writing. When you are writing a file check your path FileOutputStream fileOut = new FileOutputStream("UpdateXLS.xls"); Change to FileOutputStream fileOut = new FileOutputStream("D:\\UpdateXLS.xls");
has comment: http://stackoverflow.com/comment/41569560
answers question: http://stackoverflow.com/q/26465200

http://stackoverflow.com/a/26434463
downvote count: 0
answers question: http://stackoverflow.com/q/26434353
type: Answer
has body: In order to implement Runnable you need to override the run() method (unless your class is abstract, which opens another discussion). What you have in your game class is run(int time), which won't count. From the Runnable API: The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread. The class must define a method of no arguments called run. Bold added by me.
upvote count: 1
score: 1

http://stackoverflow.com/q/26430056
possible better answer: http://stackoverflow.com/a/26430126
tagged with: java
has answer: http://stackoverflow.com/a/26430126
type: Question
answer count: 2
tagged with: apache-commons-net
has body: I'm trying to upload a file via Secure FTP with org.apache.commons.net.ftp.FTPClient but I receive "java.net.NoRouteToHostException: No route to host" when connecting. The host is pingable and I can even read/write files with my FTP user via Filezilla SFTP connection to it. No firewall active in my router. What could be the problem? My specs: Mint 17 x64, Java 7, router Netgear DGND4000 (maybe this help) This is the code: package it.eproject.pdf; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.net.ftp.FTPClient; public class Test { public static void main(String[] args) { System.out.println("Start upload file"); String sourceFile = "pdf/d00001.pdf"; String pdfName = "d00001.pdf"; String pdfDestFolder = "/pdf"; String ftpHost = "itsa.pingable.host"; String ftpUsername = "username"; String ftpPassword = "password"; FTPClient ftp = new FTPClient(); try { ftp.setConnectTimeout(5000); ftp.connect(ftpHost); ftp.login(ftpUsername, ftpPassword); ftp.setFileType(FTPClient.BINARY_FILE_TYPE); ftp.enterLocalPassiveMode(); InputStream input = new FileInputStream(new File(pdfName)); ftp.storeFile(pdfDestFolder + pdfName, input); ftp.logout(); ftp.disconnect(); } catch (IOException e) { e.printStackTrace(); } System.out.println("Done"); } } and this the exception: java.net.NoRouteToHostException: No route to host at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at org.apache.commons.net.SocketClient.connect(SocketClient.java:182) at org.apache.commons.net.SocketClient.connect(SocketClient.java:203) at org.apache.commons.net.SocketClient.connec…
has answer: http://stackoverflow.com/a/26490021
accepted answer: http://stackoverflow.com/a/26490021
score: 0
tagged with: sftp
tagged with: ftp
linked to: http://stackoverflow.com/q/7181056
has title: NoRouteToHostException trying to connect to remote host via org.apache.commons.net.ftp.FTPClient in SFTP mode
type: AnsweredQuestion

http://stackoverflow.com/a/26421192
has body: String s = "Welcome!This is CS211 Course"; s = s.replace("CS211", "CS222"); Try to use google before asking questions.
downvote count: 0
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26421144

http://stackoverflow.com/comment/41424686
type: AnswerComment
has text: Doesnt that lose the reference to my actual CustomResultReciever?
type: Comment
comment on: http://stackoverflow.com/a/26384664
score: 0

http://stackoverflow.com/a/26384480
answers question: http://stackoverflow.com/q/26383131
score: 6
type: Answer
downvote count: 0
has body: You can use the BPMN Model API to determine the lane which references an activity: ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey("idOfProcess").singleResult(); BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(procDef.getId()); CallActivity callActivity = null; Collection&lt;Lane&gt; lanes = bpmnModelInstance.getModelElementsByType(Lane.class); // iterate the lanes for (Lane lane : lanes) { // iterate the flownodes referenced by the lane: for (FlowNode flowNode : lane.getFlowNodeRefs()) { if("idOfCallactivity".equals(flowNode.getId())) { callActivity = (CallActivity) flowNode; break; } } } if(callActivity != null) { // work with callactivity }
upvote count: 6
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41430026
accepted answer of: http://stackoverflow.com/q/26383131
has comment: http://stackoverflow.com/comment/41457546

http://stackoverflow.com/a/26357618
upvote count: 9
has body: Why implement your own, when you can use Java's own implementation for this? YourEnum yourEnum = Enum.valueOf(YourEnum.class, value); http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html#valueOf(java.lang.Class,%20java.lang.String) Your method then becomes: private static &lt;E extends Enum&lt;E&gt;&gt; E getEnum(Class&lt;E&gt; enumClass, String name){ try { return Enum.valueOf(enumClass, name); } catch(IllegalArgumentException e) { return null; } } and you can call it with: getEnum(Enum1.class, "A")
score: 9
has comment: http://stackoverflow.com/comment/41375250
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26357132
type: Answer
answers question: http://stackoverflow.com/q/26357132
has comment: http://stackoverflow.com/comment/41373955

http://stackoverflow.com/q/26372994
has answer: http://stackoverflow.com/a/26373147
score: 0
answer count: 1
has title: Can a Connection do multiple things at once?
accepted answer: http://stackoverflow.com/a/26373147
tagged with: jdbc
has body: I've been reading about JDBC a bit and I have a question; why is it better to have multiple connections (connection pool) instead of just having 1 connection? Can a connection only do 1 thing at a time? If so, what happens if you request that the connection does something while it's already doing something else?
has comment: http://stackoverflow.com/comment/41402720
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/41402851
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/41488270
comment on: http://stackoverflow.com/a/26408841
score: 0
type: AnswerComment
has text: thank you! I have never used ColumnWeightData in a tablelayout before, it is a shame that window builder doesn't give me an option to do it through its interface.
type: Comment

http://stackoverflow.com/comment/41431984
comment on: http://stackoverflow.com/q/26389263
score: 0
type: Comment
type: QuestionComment
has text: you want to declare the type(Exception /Integer) before call the runThis method

http://stackoverflow.com/comment/41371466
has text: Go ahead and try out what will happen if you run your code.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26355251
score: 0

boids
tags question: http://stackoverflow.com/q/26479383
tag name: boids
type: Tag

http://stackoverflow.com/q/26456879
type: UnansweredQuestion
tagged with: loops
has comment: http://stackoverflow.com/comment/41554197
tagged with: java
has comment: http://stackoverflow.com/comment/41554173
tagged with: eclipse
type: Question
has body: How the IDE like eclipse knows that there's an infinite loop and throws an exception for it?!...thank you in advance. while(true) { }
score: 0
tagged with: for-loop
has title: How the IDE like eclipse knows that the loop is infinite?
has comment: http://stackoverflow.com/comment/41559489
tagged with: ide
answer count: 0

http://stackoverflow.com/comment/41389991
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26366208
has text: Is there a way to make a .jar update itself?

inheritance
tags question: http://stackoverflow.com/q/26392671
tags question: http://stackoverflow.com/q/26445264
tags question: http://stackoverflow.com/q/26505624
tag name: inheritance
tags question: http://stackoverflow.com/q/26375239
tags question: http://stackoverflow.com/q/26481224
tags question: http://stackoverflow.com/q/26361285
tags question: http://stackoverflow.com/q/26481029
tags question: http://stackoverflow.com/q/26381424
tags question: http://stackoverflow.com/q/26364243
type: Tag
tags question: http://stackoverflow.com/q/26435685
tags question: http://stackoverflow.com/q/26467948
tags question: http://stackoverflow.com/q/26370145
tags question: http://stackoverflow.com/q/26371154
tags question: http://stackoverflow.com/q/26485992
tags question: http://stackoverflow.com/q/26457592
tags question: http://stackoverflow.com/q/26458756
tags question: http://stackoverflow.com/q/26403244
tags question: http://stackoverflow.com/q/26447049
tags question: http://stackoverflow.com/q/26488904
tags question: http://stackoverflow.com/q/26510341
tags question: http://stackoverflow.com/q/26412295
tags question: http://stackoverflow.com/q/26392161
tags question: http://stackoverflow.com/q/26405931
tags question: http://stackoverflow.com/q/26500552
tags question: http://stackoverflow.com/q/26366585
tags question: http://stackoverflow.com/q/26465974

http://stackoverflow.com/q/26447668
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26447726
has answer: http://stackoverflow.com/a/59355807
possible better answer: http://stackoverflow.com/a/26447725
has answer: http://stackoverflow.com/a/26447725
type: Question
has comment: http://stackoverflow.com/comment/41537495
has comment: http://stackoverflow.com/comment/41537492
has comment: http://stackoverflow.com/comment/41537570
score: 0
has answer: http://stackoverflow.com/a/26447809
has answer: http://stackoverflow.com/a/26447726
has comment: http://stackoverflow.com/comment/41537607
has body: I can't tell if the solution to my problem is really easy or more complicated than it looks. I've searched up some examples for how to use Enumerated types but I can't figure out how to map a string to an enum if the string value is can be arbitrary and was hoping to get more concrete examples from the community about a particular situation. Say, for example we had two classes Test and Type (Enum). Type looks like: public enum Type { TYPE1; TYPE2; } Within in the Test class, we had a method called Map, which would accept a string and Enum, and it's meant to map the string to a enum value. public void map(String str, Type someType){ //map Str to specified someType in the Enumerated type.. how? } So calling map would look like: map("johnny", Type.type1); where johnny should get mapped to type1. How would I do this? EDIT: I just wanted to say I ended up using a LinkedList with the enumerated type instead (which I know is probably slower) simply because this was for an homework assignment and I wanted to know if there was a way to use Enum type only instead of using a Hashmap (we haven't learned hashmaps yet).
answer count: 5
has title: How to exactly map a string to enum in java?
has answer: http://stackoverflow.com/a/26447743

http://stackoverflow.com/comment/41570871
comment on: http://stackoverflow.com/a/26453935
type: Comment
has text: @erik-vesteraas, er det godkjent med if (ordListe.toString().toLowerCase().contains(s.toLowerCase())) for å sjekke store å små bokstaver?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26473211
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26472992
type: Answer
downvote count: 0
has body: Adding a Session session parameter to any mapped controller method will make the session available inside a method. The session will be implicitely created and injected by the framework, so you use it inside a method just like you would inside a Servlet @RequestMapping(value = "/helloworld", method = RequestMethod.POST) @ResponseBody public JsonResponse sayHello(@RequestBody String reqestString ,HttpSession sessionObj) { sessionObj.setAttribute("message" , "It is simple to get access to HttpSession "); return jsonResponse; }
score: 3
answers question: http://stackoverflow.com/q/26472992
upvote count: 3

http://stackoverflow.com/q/26458737
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26458759
possible better answer: http://stackoverflow.com/a/26458936
tagged with: javabeans
accepted answer: http://stackoverflow.com/a/26458759
has comment: http://stackoverflow.com/comment/41559237
has body: Just curious to know how Eclipse creates setters and getters (not how to myself). I am sure it must be Java reflection but just wanted to seek some more information.
type: AnsweredQuestion
has title: How does Eclipse generate setters and getters?
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/26458936
type: Question
tagged with: eclipse

http://stackoverflow.com/a/26369250
score: 1
has body: Tomcat has an auto deploy feature. When you update JSP files it detects you have done so, compiles it, and replaces the old compiled JSP page with the new one that it compiles into a java class. http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html If you don't want that to happen, you can turn off the auto deploy feature for your web application. It is described in the link how you do that.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41397389
has comment: http://stackoverflow.com/comment/41397592
type: Answer
accepted answer of: http://stackoverflow.com/q/26369160
has comment: http://stackoverflow.com/comment/41397576
answers question: http://stackoverflow.com/q/26369160
downvote count: 0

http://stackoverflow.com/a/26371886
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26371678
type: Answer
upvote count: 1
score: 1
has body: Java's data structures are great, but you gotta remember the basics :) class Terrain { private byte[] terrainData; private int terrainSizeX; private int terrainSizeY; public void init() { terrainData = new byte[terrainSizeX * terrainSizeY]; } private int getIndex(int row, int column) { return terrainSizeX * column + row; } public byte getTerrainAtLocation(int row, int column) { return terrainData[getIndex(row, column)]; } public void setTerrainAtLocation(int row, int column, byte value) { terrainData[getIndex(row, column)] = value; } }
accepted answer of: http://stackoverflow.com/q/26371678
has comment: http://stackoverflow.com/comment/41400660
downvote count: 0

vigenere
tags question: http://stackoverflow.com/q/26450335
type: Tag
tag name: vigenere

http://stackoverflow.com/q/26475030
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26475092
score: 3
tagged with: performance
has body: I am using bits to represent events which occur on a day. For instance if I store 4 days of information I could use 1011 (staring from right to left) would indicate on days 1,2, and 4 events occurred (bit 1,2, and 4 are set). I am using the type of Long to store the bits (which would in this example store the number 11). Now with Long I could store 63 days of events (long max size is 2^64 -1). FYI: I later take one on my sets of events and then compare it with another set to see how many events occurred on the same day (I use Long's bitcount method to do this). For example, 1011 AND 1000 = 1 event occurred on the same day in these two sets. he problem I am facing is: I now need to store more than 63 days of data. I need about 180 days now. I am facing performance issues with my two solutions and was wondering if there is a more efficient way to essentially store a "180-bit" Integer. My first solution was to use BigInteger, but this is very slow when running. My other solution is to breakup the 180 bits into 3 Longs and later compare accordingly, but obviously this creates 3 times the work.
has comment: http://stackoverflow.com/comment/41587449
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41591304
type: Question
has answer: http://stackoverflow.com/a/26475186
downvote count: 0
has answer: http://stackoverflow.com/a/26475103
has comment: http://stackoverflow.com/comment/41587712
favorite count: 0
has comment: http://stackoverflow.com/comment/41587625
answer count: 3
has answer: http://stackoverflow.com/a/26475092
possible better answer: http://stackoverflow.com/a/26475103
has comment: http://stackoverflow.com/comment/41587526
has comment: http://stackoverflow.com/comment/41588459
tagged with: bit-manipulation
has title: Efficent way to store "180-bit" (more than 64-bit) integer
has comment: http://stackoverflow.com/comment/41590278

http://stackoverflow.com/comment/41524643
has text: many thanks i had to change the request method during troubleshooting, i will change back to POST however the error persisted. The error location is this Toast.makeText(getActivity(), **s.submitMessage()**.toString(), Toast.LENGTH_SHORT).show(); or Toast.makeText(getActivity(), **s.checkBalance()**.toString(), Toast.LENGTH_SHORT).show();
type: Comment
comment on: http://stackoverflow.com/a/26440536
score: 0
type: AnswerComment

request
tags question: http://stackoverflow.com/q/26359684
tags question: http://stackoverflow.com/q/26368336
tag name: request
tags question: http://stackoverflow.com/q/26452846
type: Tag
tags question: http://stackoverflow.com/q/26356788
tags question: http://stackoverflow.com/q/26450316

http://stackoverflow.com/comment/41386873
has text: @nEm No, i was hoping that play provide a mechanism for do that in a more simple way but i don't find out nothing on the web. The alternative could be WebTargets.
score: 0
comment on: http://stackoverflow.com/q/26364475
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26475905
answers question: http://stackoverflow.com/q/26475710
score: 0
has body: You can call the method menu by saying "menu()" just like you would with any other method. if(x ==2){ menu(); }
type: Answer

http://stackoverflow.com/comment/125881380
type: Comment
has text: if(curQ != null) { q = curQ; } this case never be executed.
comment on: http://stackoverflow.com/a/26499301
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41581362
score: 0
type: Comment
type: QuestionComment
has text: @CLearner yes, you can, that's the correct approach. Now what's your base case and your recursion step?
comment on: http://stackoverflow.com/q/26471600

http://stackoverflow.com/comment/41436599
has text: Can you post the code for Name class ?
comment on: http://stackoverflow.com/q/26391772
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41638049
has text: yep, it is still there, hence it is a must field
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26503007
type: AnswerComment

http://stackoverflow.com/comment/41617860
comment on: http://stackoverflow.com/a/26489981
type: AnswerComment
has text: @MichailMichailidis And My answer is _not_ any way like yours. You are using a JLabel and ImageIcon, while my answer is still using custom painting
type: Comment
score: 0

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/26498888
tags question: http://stackoverflow.com/q/26367540

http://stackoverflow.com/q/26426738
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26436047
has comment: http://stackoverflow.com/comment/41498467
has comment: http://stackoverflow.com/comment/41498423
tagged with: java
has comment: http://stackoverflow.com/comment/41498373
type: Question
has comment: http://stackoverflow.com/comment/41498666
has comment: http://stackoverflow.com/comment/41498533
answer count: 1
has comment: http://stackoverflow.com/comment/41498374
tagged with: jar
has comment: http://stackoverflow.com/comment/41498335
accepted answer: http://stackoverflow.com/a/26436047
has comment: http://stackoverflow.com/comment/41498421
has body: I have tried the example as the same as written as answer from this link'How to create a .jar file using the terminal' to create a jar file from command prompt. But I am getting an error 'no main manifest attribute , in Helloworld.jar'. What will be the problem? Please help.I done the same as explained in that method.
score: 0
linked to: http://stackoverflow.com/q/10125639
has comment: http://stackoverflow.com/comment/41498814
has comment: http://stackoverflow.com/comment/41500949
has comment: http://stackoverflow.com/comment/41498395
has title: Creating jar from command prompt giving error

http://stackoverflow.com/comment/41570119
comment on: http://stackoverflow.com/q/26466148
score: 0
type: QuestionComment
type: Comment
has text: where is `<context:component-scan base-package="app.bl.facade.*" />`

http://stackoverflow.com/comment/41621929
has text: Ah, I got excited for a minute but that is just a typo when I posted the question, not in my actual file.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26481263

http://stackoverflow.com/q/26454651
has comment: http://stackoverflow.com/comment/41550251
has body: Node class private class Node&lt;E&gt; { E data; Node&lt;E&gt; next; public Node(E obj) { data = obj; next = null; } } insert method (ascending order) public void insert(E obj) { Node&lt;E&gt; newNode = new Node&lt;E&gt;(obj); Node&lt;E&gt; prev = null, curr = head; while(curr != null &amp;&amp; ((Comparable&lt;E&gt;)obj).compareTo(curr.data) &gt;= 0) { prev = curr; curr = curr.next; } if(prev == null) head = newNode; else { prev.next = newNode; newNode.next = curr; } currentSize++; } remove method public E remove() { if(isEmpty()) return null; E tmp = head.data; head = head.next; currentSize--; return tmp; } I get Null Pointer Exception at the line E tmp = head.data; in the remove method The error is fixed if the change the else statement in my insert method to else prev.next = newNode; newNode.next = curr;
tagged with: list
score: 0
has title: Can someone explain this Linked List Null Pointer Exception?
tagged with: java
has comment: http://stackoverflow.com/comment/41550144
type: Question
tagged with: null
answer count: 1
has answer: http://stackoverflow.com/a/26454846
tagged with: pointers
has comment: http://stackoverflow.com/comment/41550190
has comment: http://stackoverflow.com/comment/41550424
type: UnansweredQuestion

http://stackoverflow.com/comment/41460712
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26389011
score: 0
has text: @JorgeCampos how to allow database so that it can be accessed... and how can I change value of HOST from localhost to %

http://stackoverflow.com/comment/41653079
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26511365
has text: I removed the event loop and it is working fine. Does the eclipse framework provide the event loop for menus too since this is an RCP app? I have been adding event loops to menus all these days.But this is not solving why the selection listener is not getting called when the menu item is selected :(
type: Comment

http://stackoverflow.com/a/26505456
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26505393
answers question: http://stackoverflow.com/q/26505393
type: AcceptedAnswer
has body: No, You can't. The way you tried with array is the something you can try similar to this. String[] elements=new String[4]; for (int x = 0; x &lt; get_elements.length; x++) { elements[x] = c.getString(get_elements[x]); }

http://stackoverflow.com/q/26356142
tagged with: maven-wagon-plugin
type: UnansweredQuestion
tagged with: maven
has title: Using git wagon plugin to store jars at github/gitlab
tagged with: git
has comment: http://stackoverflow.com/comment/47846458
answer count: 0
score: 1
tagged with: java
has body: I'm using git-wagon wagon-git plugin to store jars at github repository (this is just for test, my company have own gitlab repository). I've created project "wagon_test", and deployed it (https://github.com/Bresiu/wagon_test/tree/releases/com/bresiu). Than I've created second project: "wagon_test_dependience" and deployed it too to the same repository, under same "release" branch. I added to "wagon_test" dependency: com.bresiu wagon_test_dependience 1.0 And deleted wagon_test_dependience artifact from maven local repository. Now Maven can't download wagon_test_dependience.jar from github. My pom.xml from wagon_test: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.bresiu wagon_test 1.0 wagon_test <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> jar org.apache.maven.wagon wagon-provider-api 2.4 joda-time joda-time 2.4 com.bresiu wagon_test_dependience 1.0 wagon_test maven-compiler-plugin 3.1 true ${java.version} ${java.version} org.apache.maven.plugins maven-jar-plugin ${project.version} Main maven-assembly-plugin 2.4 Main jar-with-dependencies make-assembly package single ar.com.synergian wagon-git 0.2.3 synergian-repo https://raw.github.com/synergian/wagon-git/releases <distributionManagement> wagon_test wagon_test git:releases://git@github.com:Bresiu/wagon_test.git </distributionManagement> wagon_test wagon_test true false https://raw.github.com/Bresiu/wagon_test/releases How can I enable storing my private dependieces in Github/Gitlab? I know that storing binaries in Github has its pros and cons, but we have own gitlab repository only for jars and ruby gems, and we would like to keep all binaries in one place.
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/47949834
tagged with: jar
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/26510849
tagged with: java
has body: I want to create a Complete single Jar ball which include all of its dependencies, so it can be shipped to any one who use it from command line . the structure of my jar is : ├── META-INF │ ├── MANIFEST.MF │ └── maven │ └── com.cn.xing.jar │ └── CnJar │ ├── pom.properties │ └── pom.xml ├── com │ └── cn │ └── xing │ └── jar │ ├── HelloJava.class │ └── InjectEntry.class ├── lib │ ├── aopalliance-1.0.jar │ ├── commons-codec-1.6.jar │ ├── commons-logging-1.1.3.jar │ ├── gson-2.2.4.jar │ ├── httpclient-4.3.5.jar │ ├── httpcore-4.3.2.jar │ ├── spring-aop-3.2.2.RELEASE.jar │ ├── spring-beans-3.2.2.RELEASE.jar │ ├── spring-context-3.2.2.RELEASE.jar │ ├── spring-core-3.2.2.RELEASE.jar │ └── spring-expression-3.2.2.RELEASE.jar └── spring └── appCtx.xml and the manifest file content is : Manifest-Version: 1.0 Built-By: ChinaXing Build-Jdk: 1.7.0_65 Class-Path: lib/spring-context-3.2.2.RELEASE.jar lib/spring-aop-3.2.2. RELEASE.jar lib/aopalliance-1.0.jar lib/spring-beans-3.2.2.RELEASE.ja r lib/spring-core-3.2.2.RELEASE.jar lib/spring-expression-3.2.2.RELEA SE.jar lib/httpclient-4.3.5.jar lib/httpcore-4.3.2.jar lib/commons-lo gging-1.1.3.jar lib/commons-codec-1.6.jar lib/gson-2.2.4.jar Created-By: Apache Maven 3.2.2 Main-Class: com.cn.xing.jar.InjectEntry Archiver-Version: Plexus Archiver but when I execute it in command line as following : java -jar ../CnJar-1.0-SNAPSHOT.jar It show the exceptions : Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2688) at java.lang.Class.getMethod0(Class.java:2937) at java.lang.Class.getMethod(Class.java:1771) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext at java.net.URLClassLoader$1.run(UR…
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26511786
score: 0
has title: How to set Class-Path indict jar in the same jar
tagged with: classloader
accepted answer: http://stackoverflow.com/a/26511786
type: AnsweredQuestion

http://stackoverflow.com/comment/41413458
type: QuestionComment
comment on: http://stackoverflow.com/q/26378946
type: Comment
score: 3
has text: Again, please show a short but complete program demonstrating the problem. We should be able to copy, paste, compile, run and see the problem. Read http://tinyurl.com/stack-hints

saml-2.0
tags question: http://stackoverflow.com/q/26459489
tags question: http://stackoverflow.com/q/26421017
type: Tag
tag name: saml-2.0
tags question: http://stackoverflow.com/q/26482902

http://stackoverflow.com/q/26444876
type: UnansweredQuestion
has title: OpenGL Third Person Camera cant combine axes correctly
tagged with: opengl
tagged with: java
type: Question
tagged with: 3d
has comment: http://stackoverflow.com/comment/41541999
has body: I try to implement a Third person camera in OpenGL and seem to be almost done. I can rotate around the y axis and the x+z axis. But when I try both at once it doesn't looks good because he doesn't look at the object anymore. Can you figure out where the mistake is? Heres the code: glTranslatef(world.player.x-4.5f,world.player.y-4.5f,world.player.z-20f-4.5f); modelHandler.modelList.get("TEST").render(); double camerax = 20 * Math.cos((world.player.getYaw() + 270.0f) * Math.PI / 180) * Math.cos(Math.toRadians(world.player.getPitch())) + world.player.x; double cameray = 20 * Math.sin((world.player.getPitch()) * Math.PI / 180) + world.player.y; double cameraz = 20 * Math.sin((world.player.getYaw() - 270.0f) * Math.PI / 180) * Math.cos(Math.toRadians(world.player.getPitch())) + world.player.z-20; glRotatef(360.0f - world.player.getYaw(), 0.0f, 1.0f, 0.0f); glRotatef(world.player.getPitch() * (float)Math.cos(Math.toRadians(360.0f - world.player.getYaw())), 1.0f, 0.0f, 0.0f); glRotatef(world.player.getPitch() * (float)Math.sin(Math.toRadians(360.0f - world.player.getYaw())), 0.0f, 0.0f, 1.0f); glTranslated(-camerax, -cameray, -cameraz); // render world and stuff
has comment: http://stackoverflow.com/comment/41534690
score: 0
answer count: 0

http://stackoverflow.com/a/49869078
has body: Though Luggi Mendoza's answer is correct, java 8 allows to do it in more elegant way. List&lt;String&gt; strings = Files.lines(Paths.get("test.txt")) .filter(s -&gt; !s.startsWith("#")) .collect(Collectors.toList());
type: Answer
answers question: http://stackoverflow.com/q/26391109
score: 0

http://stackoverflow.com/comment/121895611
comment on: http://stackoverflow.com/q/26492301
type: Comment
has text: This can also happen if you have added `android:exported="false"` in Manifest
type: QuestionComment
score: 7

http://stackoverflow.com/q/26447793
accepted answer: http://stackoverflow.com/a/26447848
type: Question
has answer: http://stackoverflow.com/a/26447848
score: 0
has body: I'm doing a web based project using Maven,Spring and Hibernate.I just have faced a problem. The problem is whenever I'm using sessionFactory.getCurrentSession() it showing a error and the error is The method getCurrentSession() is undefined for the type SessionFactory Here is my pom.xml 4.0.0 org.mahin.webchatapp WebChatApp 1.0-SNAPSHOT war WebChatApp For Chatting <spring.version>4.1.1.RELEASE</spring.version> <hibernate.version>4.3.6.Final</hibernate.version> org.springframework spring-context ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-orm ${spring.version} org.hibernate hibernate-core ${hibernate.version} javax.servlet javax.servlet-api 3.0.1 provided jstl jstl 1.2 commons-dbcp commons-dbcp 1.4 mysql mysql-connector-java 5.1.32 org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 Here is my servlet-context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns: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"/> </beans> Here is the DAO class with problem: package com.mahin.daos; import java.…
answer count: 1
type: AnsweredQuestion
has title: The method getCurrentSession() is undefined for the type SessionFactory
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/26436463
upvote count: 37
accepted answer: http://stackoverflow.com/a/26946097
duplicate of: http://stackoverflow.com/q/31619324
tagged with: java
has answer: http://stackoverflow.com/a/30417331
has comment: http://stackoverflow.com/comment/42246358
answer count: 6
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42198986
tagged with: servlets
score: 37
has answer: http://stackoverflow.com/a/29296609
has body: I have imported a Java dynamic web project into the Eclipse IDE (which was implemented in Eclipse IDE and properly working). I'm getting a "getDispatcherType() is undefined for the type HttpServletRequest" error while running the project. I have copied every file into IDE as per the structure and the work is done. Now I just want to know why I am getting this error when I have imported the project. Did anyone faced the same issue? Please let me know what mistake I might have made.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41883393
has answer: http://stackoverflow.com/a/26946097
has title: getDispatcherType() is undefined for the type HttpServletRequest
possible better answer: http://stackoverflow.com/a/28543066
has answer: http://stackoverflow.com/a/28543066
has answer: http://stackoverflow.com/a/29004834
has answer: http://stackoverflow.com/a/29248177
linked to: http://stackoverflow.com/q/31619324
has comment: http://stackoverflow.com/comment/41546205
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/41553282
score: 0
type: QuestionComment
has text: awesome thank you, do you know if there is a way round this?
type: Comment
comment on: http://stackoverflow.com/q/26456340

http://stackoverflow.com/q/26486050
favorite count: 0
tagged with: osgi
type: UnansweredQuestion
tagged with: sessionfactory
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
has body: a while ago I finally managed to get an OSGi Service that uses Hibernate to work. My current task is changing this Service into a Managed Service. Basicly I'm supposed to change my Configuration at runtime to decide between 2 databases, but that I'm not really sure how. I get my SessionFactory like this: ServiceReference&lt;?&gt; ref = context.getServiceReference(SessionFactory.class.getName()); SessionFactory factory = (SessionFactory) context.getService(ref); To my knowlegde, that's the only viable way to get a SessionFactory in OSGi, but the entire Configuration is done in the org.hibernate.osgi.OsgiSessionFactoryService. My question is, is there any way to configure my SessionFactory manually, like changing the used hibernate.cfg.xml or using .setProperty("connection.url", "...") ? The only solution I can imagine is to use a heavily modified OsgiSessionFactoryService, but that seems slightly overkill... Does anyone have a more elegant approach to this problem?
upvote count: 1
has title: Manually configure a Hibernate SessionFactory in OSGi
type: Question
downvote count: 0

http://stackoverflow.com/q/26469169
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/26469252
has body: I have a binary search tree that stores in Strings, and I have been able to find the depths or heights of Strings that exist in the BST, but what I'm trying to do is find what the depth would be for a String that is not in the BST. Here is the algorithm that I'm using currently, which works perfectly to find the depth of a String that already exists in the BST: public int getDepth(String data) { return getDepth(root, data, 1); } public int getDepth(Node root, String data, int level) { if (root == null) return 0; if (root.getData().getName().equals(data)) return level; int ret = getDepth(root.leftChild, data, level + 1); if (ret != 0) return ret; ret = getDepth(root.rightChild, data, level + 1); return ret; } My BST has the elements that were inserted in this order: "cat", "bird", "dog", "tiger", "elephant", "panda". So the binary tree should look like this: cat / \ bird dog \ tiger / \ elephant panda When I call the method on "dog" the output is: dog is at depth 2 When I call the method on "hippo" the output is: hippo is at depth 0 But the expected output of "hippo" should be: hippo is at depth 5 Because hippo would be a child of elephant which is already in depth 4. Then for another case, what if I wanted to find the depth of "cow" that is not in the BST? It would have to be the left child of dog so the depth should be 3, however, I still get 0. So the question is without using a delete and/or restore method what case(s) do I need or what case(s) do I need to modify in the method above in order to determine the depth of a String not inside the BST?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26469507
type: Question
tagged with: depth
possible better answer: http://stackoverflow.com/a/26469252
has answer: http://stackoverflow.com/a/26469507
has title: Java: Find the Depth of a Node not Found in a BST
score: 0
answer count: 2

http://stackoverflow.com/a/26355069
has comment: http://stackoverflow.com/comment/41376037
has comment: http://stackoverflow.com/comment/41375379
upvote count: 3
has comment: http://stackoverflow.com/comment/41375282
has comment: http://stackoverflow.com/comment/41374673
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/41375324
downvote count: 0
has comment: http://stackoverflow.com/comment/41375841
answers question: http://stackoverflow.com/q/26354163
score: 3
accepted answer of: http://stackoverflow.com/q/26354163
has body: From logback documentation: 1. Logback tries to find a file called logback.groovy in the classpath. 2. If no such file is found, logback tries to find a file called logback-test.xml in the classpath. 3. If no such file is found, it checks for the file logback.xml in the classpath.. 4. If neither file is found, logback configures itself automatically using the BasicConfigurator which will cause logging output to be directed to the console. Where should the configuration files such as logback.groovy, logback-test.xml or logback.xml be located on the classpath? Configuration files such as logback.groovy, logback-test.xml or logback.xml can be located directly under any folder declared in the class path. For example, if the class path reads "c:/java/jdk15/lib/rt.jar;c:/mylibs/" then the logback.xml file should be located directly under "c:/mylibs/", that is as "c:/mylibs/logback.xml". Placing it under a sub-folder of c:/mylibs/, say, c:/mylibs/other/, will not work. For web-applications, configuration files can be placed directly under WEB-INF/classes/. So you need to put logback.xml in the classpath. On one project we had a similar problem although logback.xml was in the right place. Renaming it to logback-test.xml helped.

http://stackoverflow.com/a/26550877
has body: Change the link to https://dl-ssl.google.com/android/eclipse/ will do...
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26494486

functional-programming
tags question: http://stackoverflow.com/q/26500373
tag name: functional-programming
type: Tag

http://stackoverflow.com/comment/41631925
score: 0
comment on: http://stackoverflow.com/q/26499698
has text: Are you getting any error? If yes then post the same.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26498378
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26498423
has body: I wrote a unit test to help me understand Pattern.quote and for the life of me can't figure out why this test isn't passing. @Test public void testRegexEscape() throws Exception { String text = "Test"; String patternString = "es"; String quoted = Pattern.quote(patternString); Pattern pattern = Pattern.compile(quoted); Matcher matcher = pattern.matcher(text); assertTrue(matcher.matches()); }
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/4450045
score: 0
duplicate of: http://stackoverflow.com/q/4450045
has title: Pattern.quote not working as expected
tagged with: regex
has answer: http://stackoverflow.com/a/26498423

http://stackoverflow.com/comment/41585604
comment on: http://stackoverflow.com/q/26473916
has text: Are you sure you got response from servlet? Also notify is not a good solution because it notifies a thread randomly. For example you have 30 thread waiting and you call a notify then you choose a thread randomly
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41508707
type: Comment
comment on: http://stackoverflow.com/a/26431513
has text: @SecretService I'm saying that your runnable jar isn't dependent on Guava, but it would be very difficult to figure that out at compile time. The code that instantiates `Foo` never runs.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26439317
has answer: http://stackoverflow.com/a/28463730
type: UnansweredQuestion
tagged with: gradle
tagged with: java
has comment: http://stackoverflow.com/comment/41577977
has title: Creating Gradle project in eclipse is stuck
tagged with: eclipse
type: Question
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/35793603
has answer: http://stackoverflow.com/a/60346290
favorite count: 0
has body: I am new to gradle, and I have a problem that the eclipse got stuck when I create a gradle project This is what I install in my eclipse luna And I am trying to create a gradle project in eclipse The process got stuck! PS: I tried I create a new project and create a build.gradle myself and use gradle eclipse to configure the project , and this works fine and I can use this project in eclipse .But I have to type gradle eclipse again when I add some dependencies, or there are compile errors Please help! Thank you!
score: 11
upvote count: 11
tagged with: gradle-eclipse
has comment: http://stackoverflow.com/comment/65457924

http://stackoverflow.com/comment/41605568
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26485492
has text: Treat this as a generic windows application problem ... where the application is `java`.
type: Comment

http://stackoverflow.com/comment/41574644
has text: Yep, actually character class unnecessary here :)
type: Comment
comment on: http://stackoverflow.com/a/26468299
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41653318
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26511053
has text: Just kidding, I figured it all out. Thanks!

http://stackoverflow.com/comment/41440546
comment on: http://stackoverflow.com/q/26393803
score: 0
type: QuestionComment
type: Comment
has text: In your sample output, `A,B C` would create two columns, the first with the label "A" and the second with the label "B C". I think your input and output samples still aren't correct.

http://stackoverflow.com/comment/41522947
comment on: http://stackoverflow.com/a/26437823
has text: I added name attribute for the joinColumn annotation with the correct name id, now the name is getting constructed correctly listb_0.id, but still getting the error "Unknown column 'listb0_.id' in 'field list'"
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/48014375
type: QuestionComment
comment on: http://stackoverflow.com/q/26429751
score: 1
has text: Refer to my answer at [Disable SSLv3 in HttpsUrlConnection in Android][1] [1]: http://stackoverflow.com/a/29946540/934560
type: Comment

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/26371223
tags question: http://stackoverflow.com/q/26365015
tags question: http://stackoverflow.com/q/26481826
tags question: http://stackoverflow.com/q/26388294

http://stackoverflow.com/comment/41409215
score: 0
comment on: http://stackoverflow.com/q/26376860
type: Comment
type: QuestionComment
has text: Pahaha, forgive me, the re shouldn't be a newline before the speed - 5, apparently stackoverflow listens to my code, but not my actual application

http://stackoverflow.com/comment/41524665
type: Comment
comment on: http://stackoverflow.com/a/26440508
has text: Did you created file.txt?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41655451
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26512722
score: 1
has text: then set this as answer!

combinations
tags question: http://stackoverflow.com/q/26364233
tag name: combinations
tags question: http://stackoverflow.com/q/26462858
tags question: http://stackoverflow.com/q/26395215
tags question: http://stackoverflow.com/q/26441362
type: Tag

http://stackoverflow.com/a/26435087
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26422107
accepted answer of: http://stackoverflow.com/q/26422107
has body: You are totally confused. Connection pooling is implemented at the client: instead of calling new Socket() you look in a collection keyed by the target IP:port; instead of closing you return the connection to the pool; and you add a thread that closes sockets in the pool that have been there for too long, e.g. 15 seconds. All you need at the server is a thread per connection that loops reading requests until EOS, as we discussed in your other thread. None of this available()/LinkedBlockingQueue stuff.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/41458472
comment on: http://stackoverflow.com/a/26404470
has text: Check your last line : (26 * 2) + 2 = 54, this is less than 30, (should be greater than)
score: 0
type: AnswerComment
type: Comment

modal-dialog
tag name: modal-dialog
type: Tag
tags question: http://stackoverflow.com/q/26500554
tags question: http://stackoverflow.com/q/26414693

http://stackoverflow.com/comment/41528849
comment on: http://stackoverflow.com/q/26442901
score: 0
has text: Since `data` is static, it belongs to the class. It's recommended to access static variable directly from the class, rather than an instance (which is what you're doing when you call `this`; accessing the current instance). Plus, the method is static, cant use `this` in static methods
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26400459
answer count: 2
has body: I'm trying to code a unit test for a method defined in a controller. The method is like this: @RestController @RequestMapping("/products") public class RestProductController { @RequestMapping(value="/{product}/skus", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) public List&lt;SkuSummaryVO&gt; getSkuByProduct(@Valid @PathVariable Product product){ List&lt;SkuSummaryVO&gt; skusByProductVOs = skuService.getSkusByProduct(product); return skusByProductVOs; } } We use in our Configuration class the annotation @EnableSpringDataWebSupport to enable the DomainClassConverter feature. So we can use the JPA entity as a @PathVariable. So when a product id will be set in the URL, we will get the product (with a request behind the scene). We are developing unit test without enabling the Spring App Context and using Mockito. So we initialize the mockMvcBuilders like this: public class RestProductControllerTest { ... @Before public void setUp() { RestProductController restProductController = new RestProductController(); ... mockMvc = MockMvcBuilders.standaloneSetup(restProductController).build(); } } and the test method is like this: @Test public void testGetProductById() throws Exception { ... String jsonResult = ...; mockMvc.perform(get("/products/123/skus").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().string(jsonResult)); } And I get a 500 for the HttpCode (the status) And the unit tests work fine for the controller methods witch are not using the DomainClassConverter feature (for example if I use a Long productId instead of a Product product as a parameter of getSkuByProduct, it will work)
tagged with: junit
downvote count: 0
possible better answer: http://stackoverflow.com/a/58169734
favorite count: 0
has answer: http://stackoverflow.com/a/58169734
has answer: http://stackoverflow.com/a/26427142
has title: Unit Test using the DomainClassConverter feature of Spring
tagged with: spring-mvc
tagged with: spring-test
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/56763939
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26427142
score: 5
upvote count: 5
tagged with: spring-data-jpa

http://stackoverflow.com/q/26494486
has answer: http://stackoverflow.com/a/26494700
has comment: http://stackoverflow.com/comment/41622675
downvote count: 0
answer count: 7
favorite count: 0
possible better answer: http://stackoverflow.com/a/26495340
tagged with: sdk
has answer: http://stackoverflow.com/a/26817108
has answer: http://stackoverflow.com/a/26550877
tagged with: android
has title: Updating Eclipse Luna and Android SDK shows : "Updating Software" Has encountered a
has comment: http://stackoverflow.com/comment/41623704
has answer: http://stackoverflow.com/a/26516190
type: AnsweredQuestion
tagged with: eclipse-luna
upvote count: 3
tagged with: java
has body: I tried to update the Android SDK and it shows up the error: "Updating Software" Has encountered a problem" Same for " Check for Updates" and "Install New Softwares", I get the same problem, I've did some searchs and I found that I need to change the site to HTTP instead of HTTPS but I got the same error. Here it's in details: An error occurred while collecting items to be installed session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,com.android.ide.eclipse.adt,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.base,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.ddms,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.gldebugger,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.hierarchyviewer,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.ndk,23.0.4.1468518 No repository found containing: osgi.bundle,com.android.ide.eclipse.traceview,23.0.4.1468518 No repository found containing: osgi.bundle,org.eclipse.aether.maven,3.1.0.v20140706-2237 No repository found containing: osgi.bundle,org.eclipse.cdt,8.5.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.checkers,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.checkers.ui,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.core,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.core.cxx,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.ui,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.codan.ui.cxx,3.2.0.201409172108 No repository found containing: osgi.bundle,org.eclipse.cdt.core,5.8.0.201409172108 No repository found containing: osgi.bundl…
has answer: http://stackoverflow.com/a/27287115
has answer: http://stackoverflow.com/a/26512991
type: Question
has answer: http://stackoverflow.com/a/26495340
accepted answer: http://stackoverflow.com/a/26512991
score: 3
has comment: http://stackoverflow.com/comment/139660431
tagged with: eclipse

http://stackoverflow.com/q/26408994
tagged with: spring
answer count: 0
has comment: http://stackoverflow.com/comment/41468221
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I read in a forum that Weblogic comes with a version of Spring inside it, but I have been searching how to use that and I didn't find a way. Is it true? Is there a way to deploy a Spring application in Weblogic without put the jars related to Spring inside the application or in Weblogic's lib directory? Thanks.
tagged with: weblogic
tagged with: weblogic12c
has comment: http://stackoverflow.com/comment/41467912
has comment: http://stackoverflow.com/comment/41467872
score: 0
has comment: http://stackoverflow.com/comment/41468181
has title: Weblogic Embedded Spring
has comment: http://stackoverflow.com/comment/41469255
linked to: http://stackoverflow.com/q/11476874
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41467082

xpath
tags question: http://stackoverflow.com/q/26465399
tags question: http://stackoverflow.com/q/26496211
tag name: xpath
tags question: http://stackoverflow.com/q/26440929
tags question: http://stackoverflow.com/q/26404866
tags question: http://stackoverflow.com/q/26418355
tags question: http://stackoverflow.com/q/26402645
type: Tag
tags question: http://stackoverflow.com/q/26498299
tags question: http://stackoverflow.com/q/26413508

http://stackoverflow.com/comment/41525598
comment on: http://stackoverflow.com/a/26440151
score: 0
type: AnswerComment
type: Comment
has text: Maybe has something t do with you creating new panel. Instead just add a method to the `ImagePanel` class `setImage(Image img)`, then call that method to set the image of the panel. No need to create a new panel. Remember to `repaint()` inside the method

http://stackoverflow.com/comment/41639856
score: 0
comment on: http://stackoverflow.com/a/26493315
has text: I have modified `_getCabinetByUser(User user)` to check the size of listaFarmaco and it works. Thanks
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41584191
score: 0
type: Comment
has text: How does eclipse manage to do it? the same project exported using eclipse works when double clicked...
comment on: http://stackoverflow.com/a/26473373
type: AnswerComment

http://stackoverflow.com/a/26459717
answers question: http://stackoverflow.com/q/26459271
has body: Printing grid is not correct in your program. Change below to // Output data from the grid by rows for (int r = 0; r &lt; height - 1; r++) { for (int c = 0; c &lt; width; c++) { System.out.print(grid[r][c]); } } this code for(char[] arr : grid) { System.out.println(Arrays.toString(arr)); }
score: 0
type: Answer

http://stackoverflow.com/q/26375297
tagged with: programming-languages
favorite count: 0
tagged with: mathtype
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26420134
has body: Let's take an example of Java. A rich text IDE is never found for now, and plain-text IDE is the mainstream. I have read many times Latex formula in IDE with codes from github and it's hard to understand the symbols without the help of any TeX-like software. I just envision the birth of such an IDE which can integrate Word, OneNote, etc., where codes like class can be highlighted, copy paste like picture while editted like plain/rich html, multimedia objects can be used as explanations, just like the matlab helper not the plain javadoc, can be compared with 2 or more classes in multi-column in one file in one time, which is a great view of Java Class hierarchy, just like what OneNote can do, so that I can get rid of the limit that codes can only be written in one column in plain text editor. Frankly, OneNote is not an IDE but is a real rich text IDE prototype, which contains all the intuitiveness of writing/ordering something such as codes but to run codes, However, these features are just like a patent which can only be seen in OneNote, and can not be found in any famous or less programming environment. I can not help recalling, historically, the development of the width of rail tracks limits the size of imagination, which repeats in my brain each time I use OneNote. What's more, although many IDE contains highlight grammar, it is still a plain-text code, which can be generated very fast from rich text one by just removing explanation areas. The Mathtype-like formula is so much better than plan-text formula in plain text IDE, which I can feel in OneNote by pasting codes and formula together, especially when it is a fraction or rooting formula. What a pity, the formula can not run directly. Actually, they can be generated from the same format, namely xml-like rich text. I just found one interesting piece of such a code in a PDF file from the Unicode website, which is much better to capture the real function of the program function: void IHBMWM(void) { gammap = gamma…
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: rich-text-editor
downvote count: 0
answer count: 1
tagged with: ide
has title: Is there any Programming language that can directly execute MathType Formula?

http://stackoverflow.com/comment/41610755
type: QuestionComment
comment on: http://stackoverflow.com/q/26488335
type: Comment
score: 1
has text: Class variable is class-specific while member variable is instance-specific. Something like that. I think that is what they meant.

http://stackoverflow.com/comment/41611766
type: QuestionComment
has text: isn't java supposed to be machine-independent?
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26488700

http://stackoverflow.com/comment/41604442
has text: Thank you Mystic. I should of read your answer properly. It worked. If you don't mind me asking, the last thing I want to check is to see if user age (number) has been entered. I know how to work with string such as String name = mName.getText().toString(); name = name.trim(); if (name.isEmpty() || headline.isEmpty()) { but not quite with numbers
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26484328

http://stackoverflow.com/q/26445327
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/41533280
linked to: http://stackoverflow.com/q/214741
tagged with: java
has comment: http://stackoverflow.com/comment/41533725
type: Question
has title: Double number returns stackoverflow
has comment: http://stackoverflow.com/comment/41533293
has comment: http://stackoverflow.com/comment/41533278
score: 0
answer count: 2
tagged with: function
has answer: http://stackoverflow.com/a/26445364
has answer: http://stackoverflow.com/a/26445343
duplicate of: http://stackoverflow.com/q/214741
tagged with: stack-overflow
has body: The highest number that double can represent is extremely high, I thought. Though following code throws an exception. It's actually my full code. public class Summe { public static void main(String[] args) { System.out.println(summe(20000)); } public static double summe(double s) { return s == 0 ? s : s + summe(s-1); } } Thanks for the answers so far. My question is: How can I make my code work?

http://stackoverflow.com/q/26493846
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has title: Getting a nullpointer error on my TabHost LayoutInflater
answer count: 0
tagged with: android-fragments
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41621428
score: 0
tagged with: nullpointerexception
has body: I'm adding a TabHost to my ListActivity, but my app crashes due to a null pointer error. I added setup () but the null pointer switches to that line of code. I cannot see where I'm wrong. Here is my code: public TabHost tabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate (savedInstanceState); getListView ().setClickable (false); final TabHost tabHost = (TabHost) findViewById (android.R.id.tabhost); tabHost.setup (); tabHost.addTab (createTab(AdListActivity.class, "ad feed", "Ad Feed", R.drawable.news_icon )); tabHost.addTab (createTab (UserInput.class, "new ad", "New Ad", R.drawable.upload_ad)); tabHost.setCurrentTab (0); tabHost.getTabWidget ().getChildAt (0).getLayoutParams ().width = 140; tabHost.getTabWidget ().getChildAt (1).getLayoutParams ().width = 140; } private TabHost.TabSpec createTab(final Class&lt;?&gt; intentClass, final String tag, final String title, final int drawable) { final Intent intent = new Intent ().setClass (this, intentClass); final View tab = LayoutInflater.from (getTabHost ().getContext ()) .inflate (R.layout.tabs, null ); ((TextView)tab.findViewById (R.id.tab_text)).setText (title); ((ImageView)tab.findViewById (R.id.tab_icon)).setImageResource (drawable); return getTabHost ().newTabSpec (tag).setIndicator (tab).setContent (intent); } public TabHost getTabHost() { return tabHost; } } Here is my StackTrace: 10-21 13:33:37.300 15243-15243/ionictech.com.synchup E/ResourceType﹕ Style contains key with bad entry: 0x0101047910-21 13:33:37.400 15243-15243/ionictech.com.synchup W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40aae9d8)10-21 13:33:37.430 15243-15243/ionictech.com.synchup E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{ionictech.com.synchup/ionictech.com.synchup.AdListActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) at android.app.ActivityThread.ha…
has comment: http://stackoverflow.com/comment/41624134

http://stackoverflow.com/comment/41406621
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26374898
type: Comment
has text: @AnuragMishra Good, can you describe it better because I have no idea what you want...

http://stackoverflow.com/q/26378610
has comment: http://stackoverflow.com/comment/41412972
score: 2
has answer: http://stackoverflow.com/a/26378934
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26379101
has body: I have an Entity called ArtWork which has various fields. For some functionality, I query MySql for a list of artworks - List&lt;ArtWork&gt; artworks. I also have another List of type Long - List&lt;Long&gt; artworkIds. The 'artworks' list will have objects that belong to any of the ids in the 'artworksIds' list but not in the order as in the 'artworkIds'. Hence I want to sort the List 'artworks' by id with reference to the order of the ids present in the List 'artworkIds'. would like to use Comparator to achieve this Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26378707
accepted answer: http://stackoverflow.com/a/26379432
favorite count: 0
has comment: http://stackoverflow.com/comment/41412756
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/26378707
has title: How to use Java Comparator Interface to sort an Object list with reference to another list that has ids
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/26379432
has answer: http://stackoverflow.com/a/26378812
tagged with: comparator

http://stackoverflow.com/comment/41454992
comment on: http://stackoverflow.com/a/26394670
type: AnswerComment
has text: I've tried to change the endianness and got the same result for `72.5f`: `5.210868E-41`. So the second option in my answer **should** work.
type: Comment
score: 1

tabs
type: Tag
tag name: tabs
tags question: http://stackoverflow.com/q/26385738

http://stackoverflow.com/comment/41373459
score: 0
type: QuestionComment
type: Comment
has text: @laalto I am getting same error. may be problem is on layout or in custom adapter
comment on: http://stackoverflow.com/q/26357009

http://stackoverflow.com/q/26400973
tagged with: cordova
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: java
downvote count: 0
score: 1
favorite count: 0
has title: Androidstudio - gradle - cordova: import.org.apache.cordova.* fails
tagged with: android
has body: because of a high priority security fix in cordova for android we need to update our cordova version (from 2.7.0 to 3.6.3) in our app. So we thought it would be better to create a new project. I installed cordova and create a project with cordova cli api. Also I added the android platform added many cordova plugins. Then I copied our sencha touch stuff into the www folder. Then I called "cordova build android" (before I also called "cordova prepare android"). After that I imported this android project in Android Studio (0.8.11). I needed to configure the gradle files a bit (buildToolsVersion, etc.) For our app I needed to copy the following things from our old project AndroidManifest.xml All the stuff out of the res/ directory in the src/ directory I added some stuff we need in our app Then I recognized that the android-support android-support-v13.jar library was missing in the lib/ folder. So I copied it out of the sdk\extras\android\support\v13 directory. After that nearly all red stuff in the code disappeared, so I tried to run it. The app starts but I'm getting many errors like: "Cordova exec fail: Class not found". So I looked into our src/ directory and there in our java files. There is everything red because the impor of import org.apache.cordova.*; or import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; fails. The needed java files I found in /CordovaLib/ant-build/classes/com/org/apacke/cordova/ Is there anything which I still need to configure? My gradle file dependencies: dependencies { compile fileTree(dir: 'libs', include: '*.jar') for (subproject in getProjectList()) { compile project(subproject) } } Please help me/ Thanks ahead!! :-)
tagged with: android-studio

http://stackoverflow.com/comment/41653797
type: QuestionComment
has text: The first two code snippets are the ones I am using.. and I have edited the question accordingly
comment on: http://stackoverflow.com/q/26511185
score: 0
type: Comment

http://stackoverflow.com/a/26464559
has comment: http://stackoverflow.com/comment/41636892
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26464229
answers question: http://stackoverflow.com/q/26464229
type: Answer
has body: Don't unexport the registry, and don't create it when you bind. Create it first and leave it there for the life of the JVM. Otherwise there is nothing for Naming.lookup() to talk to.

http://stackoverflow.com/a/32390645
type: Answer
has body: mvn tomcat7:redeploy try this as documentation suggests: (Alias for the deploy goal with its update parameter set to true.)
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/83210863
answers question: http://stackoverflow.com/q/26356477
score: 3

http://stackoverflow.com/q/26461697
type: Question
has comment: http://stackoverflow.com/comment/41562494
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/41562326
accepted answer: http://stackoverflow.com/a/26461775
tagged with: java
score: 10
upvote count: 10
has answer: http://stackoverflow.com/a/26461780
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/41562389
favorite count: 0
possible better answer: http://stackoverflow.com/a/26461780
has body: I have several classes in a Spring Boot project, some work with @Autowired, some do not. Here my code follows: Application.java (@Autowired works): package com.example.myproject; @ComponentScan(basePackages = {"com.example.myproject"}) @Configuration @EnableAutoConfiguration @EnableJpaRepositories(basePackages = "com.example.myproject.repository") @PropertySource({"classpath:db.properties", "classpath:soap.properties"}) public class Application { @Autowired private Environment environment; public static void main(String[] args) { SpringApplication.run(Application.class); } @Bean public SOAPConfiguration soapConfiguration() { SOAPConfiguration SOAPConfiguration = new SOAPConfiguration(); SOAPConfiguration.setUsername(environment.getProperty("SOAP.username")); SOAPConfiguration.setPassword(environment.getProperty("SOAP.password")); SOAPConfiguration.setUrl(environment.getProperty("SOAP.root")); return SOAPConfiguration; } HomeController (@Autowired works): package com.example.myproject.controller; @Controller class HomeController { @Resource MyRepository myRepository; MyService (@Autowired does not work): package com.example.myproject.service; @Service public class MyServiceImpl implements MyService { @Autowired public SOAPConfiguration soapConfiguration; // is null private void init() { log = LogFactory.getLog(MyServiceImpl.class); log.info("starting init, soapConfiguration: " + soapConfiguration); url = soapConfiguration.getUrl(); // booom -&gt; NullPointerException I do not get the SOAPConfiguration but my application breaks with a null pointer exception when I try to access it. I have already read many Threads here and googled around, but did not find a solution yet. I tried to deliver all necessary information, please let me know if anything misses.
has comment: http://stackoverflow.com/comment/41562449
tagged with: spring
has answer: http://stackoverflow.com/a/26461775
has comment: http://stackoverflow.com/comment/41562589
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41562624
has title: Spring Boot Autowired null
tagged with: autowired

http://stackoverflow.com/a/26463386
answers question: http://stackoverflow.com/q/26463084
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: I don't think there is an easy way around this. You simply can't stop someone who wants to change the request values to do so, so you will have to validate it in your code. Maybe the best thing you can do is to implement the most generic validation layer you can, so you can easily apply it to all existing code without the need to make big changes. On the other hand, if, for example, you have a gender radio button, with values M and F, if someone submits J in there, it's perfectly fine to give them a well handled exception message.
has comment: http://stackoverflow.com/comment/41566430
has comment: http://stackoverflow.com/comment/41566132

http://stackoverflow.com/q/26464401
tagged with: exception
has body: In Java class String method charAt() there is an exception thrown at one case. The exception thrown is specified in documentation to be IndexOutOfBoundsException. The actual exception that is thrown is StringIndexOutOfBoundsException - a subclass of IndexOutOfBoundsException. /** * Returns the char value at the * specified index. An index ranges from 0 to * length() - 1. The first char value of the sequence * is at index 0, the next at index 1, * and so on, as for array indexing. * * If the char value specified by the index is a * surrogate, the surrogate * value is returned. * * @param index the index of the char value. * @return the char value at the specified index of this string. * The first char value is at index 0. * @exception IndexOutOfBoundsException if the index * argument is negative or not less than the length of this * string. */ public char charAt(int index) { if ((index < 0) || (index >= count)) { throw new StringIndexOutOfBoundsException(index); } return value[index + offset]; } What is the intent to write in documentation IndexOutOfBoundsException instead of StringIndexOutOfBoundsException ?
has answer: http://stackoverflow.com/a/26464534
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/41567029
accepted answer: http://stackoverflow.com/a/26464534
score: 0
answer count: 1
tagged with: string
tagged with: throw
has comment: http://stackoverflow.com/comment/41566918
has title: What's the intent behind this documentation?

http://stackoverflow.com/comment/41584566
comment on: http://stackoverflow.com/q/26473494
score: 0
type: Comment
type: QuestionComment
has text: I am not working any programming languages... And even I donot know what is a predefined class is. Is "String" an predefined class?

http://stackoverflow.com/comment/41645257
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26507212
has text: Accidentally posted this as an answer earlier - looks like others have answered the question, but anyway: Is there some fundamental difference in what 'adding a car to the garage' does, based on what particular type of car it is? If not, then I would suggest that you simply implement the 'addCarToGarage' method within the abstract class itself.
score: 1

http://stackoverflow.com/a/26449736
has body: In the second example textString = textString.replace ('j' , 'c'); happens in your main method, so the textString variable is assigned a new String, and you see the new String's value when printing your output. In the first example it doesn't happen, since the call to the stringReplace method can't change the String reference passed to it. Therefore, the output you see is as if you never called stringReplace(textString) at all. This all boils down to Java being a pass by value language. You can't change an Object reference passed to a method, since that reference is being passed by value. If String wasn't immutable, you could change the String instance passed to the method by calling String methods that change its state (if such methods existed), but you still wouldn't be able to assign a new String reference to the method's parameter and see it reflected in the caller of the method.
upvote count: 7
has comment: http://stackoverflow.com/comment/41547845
accepted answer of: http://stackoverflow.com/q/26449696
has comment: http://stackoverflow.com/comment/41546251
answers question: http://stackoverflow.com/q/26449696
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41546080
has comment: http://stackoverflow.com/comment/41541027
type: Answer
has comment: http://stackoverflow.com/comment/41541087
has comment: http://stackoverflow.com/comment/41548048
score: 7
has comment: http://stackoverflow.com/comment/41546270

http://stackoverflow.com/q/26355232
has body: JLS 14.21 gives a description for some Unreachable statements. In particular it says: A reachable break statement exits a statement if, within the break target, either there are no try statements whose try blocks contain the break statement, or there are try statements whose try blocks contain the break statement and all finally clauses of those try statements can complete normally. I'm trying to discover that rule by example. I've written the following simple test program: public static void main(String[] args) throws java.lang.Exception { while (true) { try { //Try statement which contains a break statement. break; } finally { //Finally always complete abruptly throw new Exception(); //because of throwing an exception. } try { //Compile-time error: Unreachable statement } finally { //That finally doesn't contain any instruction. //It always complete normally. } } } I don't find something strange in that behavior except for that exception is thrown in the following example: public static void main(String[] args) throws java.lang.Exception { while (true) { try { break; } finally { throw new Exception(); //Run-time error due to throwing an exception. } } } What is that rule actual about?
has comment: http://stackoverflow.com/comment/41369730
favorite count: 0
has comment: http://stackoverflow.com/comment/41369644
accepted answer: http://stackoverflow.com/a/26355369
has title: Reachable break statement within a try block
upvote count: 3
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/41370409
has answer: http://stackoverflow.com/a/26355369
answer count: 1
has comment: http://stackoverflow.com/comment/41369867
downvote count: 0
has comment: http://stackoverflow.com/comment/41370197

http://stackoverflow.com/a/26511199
has body: You don't. String.split only returns the parts of the String that were not matched. If you want to know the matched code, you need to use a more sophisticated regular expression, i.e. the Pattern and Matcher classes, or write your own String tokenization class yourself. In this example Token is a class you make yourself): public List&lt;Token&gt; generateTokenList(String input) { List&lt;Token&gt; = new LinkedList&lt;&gt;(); for(char c : input.toCharArray()) { if(Character.isDigit(c)) { // handle digit case } else if (c == '+') { // handle plus } else if (c == '-') { // handle minus } else { /* you get the idea */ } } } There are libraries that do this for you, such as ANTLR but this sounds like a school assignment so you probably have to do this the hard way.
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26510941

http://stackoverflow.com/q/26446183
answer count: 1
type: UnansweredQuestion
tagged with: fonts
tagged with: java
tagged with: itext
has body: I'm doing an application that will putting together a pdf with iText library and among other things the source (typography) is selected by jfontchooser (font selector). The problem is that jfontchooser returns the name of the source. If I select Times New Roman returns exactly "Times New Roman" But itext needs "Times- Roman" and I cannot find a way how to translate it. I would like to translate java.awt.font to com.itextpdf.text.fontfactory the next attempt so get saved in a txt source (of course I put static data to be understood. ) String fuenteNombre = "Times New Roman"; int fuenteSize = 14; int fuenteEstilo = 1; Color fuenteColor = new Color(0,0,0,255); this.fuenteTitulo = FontFactory.getFont(fuenteNombre, fuenteSize, fuenteEstilo, fuenteColor);
has title: java.awt.font to com.itextpdf.text.fontfactory
type: Question
has answer: http://stackoverflow.com/a/26550000
score: 0

http://stackoverflow.com/comment/74689096
type: Comment
has text: @Blaine Works fine for me
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26496755

http://stackoverflow.com/comment/41573441
has text: It works very fine, i have another Question about the Popup. At the moment it's possible that the PopUp can leave the main-Stage... Is it possible to bind the PopUp at the main-Stage. It should not be allowed to leave the window of the main stage... Is there a solution for it, i tried a lot, but i dont know how i can solve this problem
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26467245

http://stackoverflow.com/a/26505279
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/26505217
has body: 1413972425000 isn't a int value. It is too large for int. You can use it as a long value. 1413972425000L You can use Date date=new Date(1413972425000L); // accept long value. System.out.println(date);
answers question: http://stackoverflow.com/q/26505217
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/a/26421999
has body: I assume you have a SWT Java Application. Then you can use FileDialog to show a file chooser where the user selects a file. Without a GUI it wouldn't be easy to show a file choosing dialog to the user. This code snippet uses FileUtils from Apache Commons IO: FileDialog dlg = new FileDialog(frame, "Choose a file to copy", FileDialog.OPEN); dlg.setVisible(true); // blocks until user completes the action String fileToCopyString = dlg.getFile(); if (fileToCopyString != null) { File fileToCopy = new File(fileToCopyString); if (fileToCopy.isFile()) { FileUtils.copyFile(fileToCopy, new File(tmpDir, fileToCopy.getName()); } } References: FileDialog Javadoc FileUtils Javadoc How to use FileDialog?
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26421559
accepted answer of: http://stackoverflow.com/q/26421559
type: Answer

http://stackoverflow.com/comment/41648532
type: AnswerComment
type: Comment
has text: You should not create a new random number generation each time the function is called! In the best case, it is wasteful. In the worst case, the method is called many times in the same millisecond, resulting in all those numbers being the same, because all those random number generators are initialized with the same seed.
comment on: http://stackoverflow.com/a/26509010
score: 0

http://stackoverflow.com/a/26523832
upvote count: 3
has comment: http://stackoverflow.com/comment/43903754
type: Answer
score: 3
has body: As you said in your own answer, in your client JAR pom.xml you have defined dependencies on both the plain data objects library (without aspect code) and the aspect-enhanced data objects library after two stages of weaving (Java Beans and JSON inter-type declarations). But you only need the latter, so you should remove the former. That you use weaveDependencies in your aspect libraries is okay and necessary because otherwise they will not compile in your scenario: Aspect B needs the data objects library because otherwise it cannot find the classes it should add new methods to. Aspect B needs Aspect A because it wants to use an already aspect-enhanced library to add even more methods via ITD. I don't think that this is a particularly nice setup because Aspect B needs to know about Aspect A, which creates an unnecessary transitive dependency ClientJar -&gt; AspB -&gt; AspA -&gt; DataObj. Maybe it would be wiser to aspect-enhance the data objects library directly and shorten the chain to ClientJar -&gt; DataObj. This is only bad if you really need the plain library without any added ITD methods in other circumstances. Then you could still create a plain and a fully aspect-enhanced version (only one stage of aspect enhancement, not two transitively dependent ones). Update, 2015-01-02: I had some leftover time and have started looking into this again. What I have ended up with is a nice solution (see GitHub repo) with the following characteristics: There is a parent module aspectj-multi-module, child modules are: data-objects (application class, no aspects), no dependencies aspect-javabean (Java Bean-related ITD aspect), depends on data-objects aspect-json (JSON-related ITD aspect), depends on data-objects data-objects-aspectj (weave aspects into core classes), depends on data-objects, aspect-javabean, aspect-json client-jar (create JAR of JARs containing core + aspect code, sample class with main method using aspect-enhanced core class and AspectJ runtime), depends on d…
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26495125
has comment: http://stackoverflow.com/comment/41682993
has comment: http://stackoverflow.com/comment/43915848
accepted answer of: http://stackoverflow.com/q/26495125

http://stackoverflow.com/comment/41483358
score: 0
has text: hi, i have uploaded the files on google drive. please view them for more clarity
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26400641

http://stackoverflow.com/a/26383648
has comment: http://stackoverflow.com/comment/41436910
has comment: http://stackoverflow.com/comment/41426407
has comment: http://stackoverflow.com/comment/41436736
has comment: http://stackoverflow.com/comment/41436576
has comment: http://stackoverflow.com/comment/41436939
score: 0
has comment: http://stackoverflow.com/comment/41425079
answers question: http://stackoverflow.com/q/26383377
has comment: http://stackoverflow.com/comment/41422467
type: Answer
has comment: http://stackoverflow.com/comment/41437177
has comment: http://stackoverflow.com/comment/41436363
has comment: http://stackoverflow.com/comment/41435864
has body: Your approach is not correct you have to loop starting from head and return all values if the index in-between fromIndex and toIndex. Before you start you also need to verify that the indexes supplied are valid. Something on this line public List&lt;L&gt; subList(int fromIndex, int toIndex) throws IndexOutOfBoundsException { if(fromIndex&lt;0 || fromIndex&gt;size() || toIndex&lt;fromIndex || toIndex&gt;size()){ throw new IndexOutOfBoundsException(); } List&lt;L&gt; n=new List&lt;L&gt;(); Node&lt;L&gt; startNode = head; int counter=0; while(startNode!=null){ if(counter&gt;fromIndex &amp;&amp; counter&lt;toIndex){ n.add(startNode); } startNode=startNode.next; counter++; } return n; } In this we check for the fromIndex and toIndex being valid if not then it throws an exception. We loop through the entire list &amp; put in the elements which are only between the indexes supplied. As per the comment Yes your Add is also incorrect. What you want to do is set the head node first. public void add(Node&lt;L&gt; node) { if(head==null){ head=node; } else { getFinal().next = node; } }
has comment: http://stackoverflow.com/comment/41437025

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/26420500
tags question: http://stackoverflow.com/q/26420475
tags question: http://stackoverflow.com/q/26442873
tags question: http://stackoverflow.com/q/26444011
type: Tag
tags question: http://stackoverflow.com/q/26442938

http://stackoverflow.com/comment/41552454
type: AnswerComment
score: 0
type: Comment
has text: @Dici, http://pastebin.com/am6F7Bjx , there you have the writing algorithm, as well as everything involved with it! thx
comment on: http://stackoverflow.com/a/26452585

http://stackoverflow.com/a/79046470
type: Answer
has body: You can do so by using the Droidscript application, it is just Android studio's minimised version (initially) for androids itself, allows direct publishing of html, css and js (browser-js, nodejs), and even python DroidScript is an easy to use, portable coding tool which simplifies android app development. It dramatically improves productivity by speeding up development by as much as 10x compared with using the standard development tools. (FROM THEIR SITE) Yes, you can create an android application using only HTML and JS as the core language and access the device components as well! You can search for Droidscript application on Play store in case you wish to develop the app from android only (DroidScript: JS and Python IDE) or use their VS code extension. Site: https://droidscript.org, Sample apps: https://ds.justplayer.de, Docs: https://droidscript.github.io/Docs
answers question: http://stackoverflow.com/q/26381356
score: 0

http://stackoverflow.com/comment/41610788
has text: You won't be able to find that element using `src` as it is not a direct attribute.
comment on: http://stackoverflow.com/q/26482517
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26450424
has body: Using Guava: Iterable&lt;IntWritable&gt; iterable = ...; int first = Iterables.get(iterable, 0).get(); Or Java8: int value = StreamSupport.stream(iterable.spliterator(), false).findFirst().get().get();
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26448325
answers question: http://stackoverflow.com/q/26448325
score: 0

http://stackoverflow.com/q/26420678
score: 25
type: AnsweredQuestion
upvote count: 25
accepted answer: http://stackoverflow.com/a/26420752
has answer: http://stackoverflow.com/a/62934818
type: Question
tagged with: java
tagged with: character-encoding
has title: Ordering an array with special characters like accents
answer count: 3
tagged with: arrays
downvote count: 0
has body: Does somebody knows how to order an array with words with special characters like accents? Arrays.sort(anArray); returns 'Albacete' before 'Álava', and I want 'Álava' before 'Albacete'. Thanks a lot
has answer: http://stackoverflow.com/a/26420752
possible better answer: http://stackoverflow.com/a/26420706
linked to: http://stackoverflow.com/q/1453171
has comment: http://stackoverflow.com/comment/41487378
favorite count: 0
has answer: http://stackoverflow.com/a/26420706

http://stackoverflow.com/comment/41642372
type: Comment
score: 0
type: QuestionComment
has text: Can you add some code.
comment on: http://stackoverflow.com/q/26505831

http://stackoverflow.com/q/26449032
linked to: http://stackoverflow.com/q/9831019
has comment: http://stackoverflow.com/comment/41540547
type: UnansweredQuestion
tagged with: android
has title: Class "android.support.v4.view.ViewPager" could not be instantiated
has body: I'm having some troubles including the Android Support Library. I've already installed the support library and the support repository and I included the "compile" directive in the build.gradle file inside the app folder (as explained in https://developer.android.com/tools/support-library/setup.html). Although the Gradle builds without errors, I found that the Render Preview of the XML code gives me the following error: Rendering Problems The following classes could not be instantiated: - android.support.v4.view.ViewPager (Open Class, Show Exception) The exception stack: java.lang.ClassNotFoundException: android.support.v4.view.ViewConfigurationCompat$HoneycombViewConfigurationVersionImpl at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:53) at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.lang.ClassLoader.defineClass(ClassLoader.java:471) at com.android.tools.idea.rendering.RenderClassLoader.loadClassFromJar(RenderClassLoader.java:93) at org.jetbrains.android.uipreview.ProjectClassLoader.loadClassFromModuleOrDependency(ProjectClassLoader.java:108) at org.jetbrains.android.uipreview.ProjectClassLoader.load(ProjectClassLoader.java:89) at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:56) at org.jetbrains.android.uipreview.ProjectClassLoader.findClass(ProjectClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at android.support.v4.view.ViewConfigurationCompat.&lt;clinit&gt;(ViewConfigurationCompat.java:87) at android.support.v4.view.ViewPager.initViewPager(ViewPager.java:367) at an…
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/27253838
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/41369429
comment on: http://stackoverflow.com/q/26355115
type: QuestionComment
type: Comment
score: 0
has text: Note that your current code will open the URL in the user's preferred browser. *This is a good thing*, but I just wanted to point out it won't always be IE.

http://stackoverflow.com/q/26489942
has answer: http://stackoverflow.com/a/26524999
downvote count: 0
tagged with: graylog2
favorite count: 0
has answer: http://stackoverflow.com/a/26510879
type: UnansweredQuestion
has title: log4j2-gelf "ERROR StatusLogger appenders contains an invalid element or attribute "GELF" "
upvote count: 6
tagged with: logging
has body: just started to get into Graylog2 and wanted to log some Java-Applications via GELF Input. Therefore I used the library log4j2 and added the graylog2-gelfclient. All dependencies are satisfied and the programm is running. But the initialisation of my Logmanager is throwing the following error: ERROR StatusLogger appenders contains an invalid element or attribute "GELF" My code is just logging an error to the logger: static final Logger logger = LogManager.getLogger(Application.class); public static void main(String[] args) { logger.error("This is an error log entry"); } } and my log4j2.xml file is configured to use GELF and the GelfAppender: &lt;configuration status="OFF"&gt; &lt;appenders&gt; &lt;GELF name="gelfAppender" server="192.168.1.1" port="12201" hostName="myhost"/&gt; &lt;/appenders&gt; &lt;loggers&gt; &lt;root level="info"&gt; &lt;appender-ref ref="gelfAppender"/&gt; &lt;/root&gt; &lt;/loggers&gt; &lt;/configuration&gt; Is anyone familiar with this problem? Thanks for any help.
tagged with: java
tagged with: log4j2
type: Question
score: 6
answer count: 2
tagged with: gelf

http://stackoverflow.com/comment/41520689
comment on: http://stackoverflow.com/q/26437840
type: Comment
type: QuestionComment
has text: i dont know what im saying anymore.. what i really mean is when i put the codes in here [link](https://onedrive.live.com/redir?resid=2B8DAE7527F5D839!22084&authkey=!ALkp-lUv9kNFAYU&v=3&ithint=photo%2cPNG) it works
score: 0

http://stackoverflow.com/a/26365086
upvote count: 61
has comment: http://stackoverflow.com/comment/41387819
score: 60
accepted answer of: http://stackoverflow.com/q/26364667
has comment: http://stackoverflow.com/comment/41387826
answers question: http://stackoverflow.com/q/26364667
has comment: http://stackoverflow.com/comment/41387924
type: AcceptedAnswer
downvote count: 1
type: Answer
has body: Mathematically, they're the same. Plus, since BigDecimals are immutable, you don't need to worry about creating new instances to do new calculations. As soon as you perform some operation on your totalCurrentSales instance, you'll actually be creating a new BigDecimal and reassigning the totalCurrentSales reference to the new value. From a instantiation perspective, they're not necessarily exactly the same. In the OpenJDK 6b14 implementation, for example, BigDecimal.ZERO is created by invoking the private new BigDecimal(BigInteger, long, int) constructor with values BigInteger.ZERO, 0, and 0. From a code quality perspective, using BigDecimal.ZERO is preferable to new BigDecimal(0) as you avoid the extra instantiation and having a literal in your code.

http://stackoverflow.com/comment/41462431
has text: Hi Nathan,thanks for the response. Can you please elaborate this explanation.
type: Comment
comment on: http://stackoverflow.com/a/26406831
type: AnswerComment
score: 0

http://stackoverflow.com/comment/41563954
type: AnswerComment
type: Comment
has text: I have craeteed a jabva main program for each instance to represent it like node structure so there are three nodes in thsi cluster as you can see in config implementation it is defined for each map store so these three are on three different ports
score: 0
comment on: http://stackoverflow.com/a/26462179

http://stackoverflow.com/a/26503187
answers question: http://stackoverflow.com/q/26502872
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The first thing to remember is that when an app runs, it doesn't actually do computation for the whole time it's running: most of the time it's idle, waiting for data to arrive over the network, or while you're looking at it on the screen. Only very badly-written apps and games keep the CPU active the whole time they're running: this runs the battery down very quickly, and makes your phone rather warm. So even if Chrome has been on the screen for 30 minutes, it shouldn't have used 30 minutes of CPU time. If it's completely static in that time and you're not interacting with it, it might not have used any CPU time at all! But at the other extreme, even if it was continually scrolling a page, it wouldn't use 30 minutes of CPU time: the screen updates every 1/60th of a second, and each time it just has to run for long enough to work out what the next frame should be. CPU foreground Bearing this in mind, CPU foreground is how much time the app has been running on the CPU while an activity from the app was in the foreground. (It might also include when a service from the app was in the foreground: that is, displaying an "ongoing" notification.) It's not a very useful figure on its own. CPU total I'm sure you already know that apps can run services and broadcast receivers in the background, as well as activities in the foreground. (For more on this, see What's the difference between a service and a broadcast receiver? ) CPU total includes all of this CPU use. If it's a lot more than CPU foreground, you might suspect that the app is doing a lot of work in the background and therefore might be a battery hog. How much is "a lot" depends on the app. An app that keeps running to check some remote service will use more CPU in the background than a sudoku game. Keep awake When the screen of your phone is off, it starts to think about having a quick nap. It enters a low-power mode called sleep where the CPU is almost completely powered down until needed. Because this can interrup…
accepted answer of: http://stackoverflow.com/q/26502872
score: 3
has comment: http://stackoverflow.com/comment/41638372

http://stackoverflow.com/comment/41478235
score: 0
type: Comment
type: QuestionComment
has text: I'm not sure how to do that on Internet Explorer but in Firefox's advanced options you can limit the cache to 0MB to make it never use cache when loading pages.Chrome settings has a similar option to avoid saving cache from pages.
comment on: http://stackoverflow.com/q/26414767

http://stackoverflow.com/comment/61142698
type: QuestionComment
has text: @rinuthomaz log4j2 does not seem to be the question. Integration with testng does.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26482861

http://stackoverflow.com/comment/41632852
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26499708
type: Comment
has text: Note that if there was a way to do this, there would be no way to explicitly ask for default access because, well, there's no syntax for it. You'd be stuck with just public, protected and private.

http://stackoverflow.com/comment/41389317
comment on: http://stackoverflow.com/a/26365923
type: AnswerComment
score: 0
type: Comment
has text: This is not an answer. For additional information please use the edit function of your original post.

http://stackoverflow.com/a/26468500
score: 0
has body: The access modifier for that method is called the default access modifier. It will allow access within same class and package. See documentation here.
type: Answer
answers question: http://stackoverflow.com/q/26468468

http://stackoverflow.com/a/32501698
answers question: http://stackoverflow.com/q/26417610
has body: Please try next solution instead of using ProxyOutputStream in your writeTo method: @Override public void writeTo(OutputStream outstream) throws IOException { ByteArrayInputStream reader = new ByteArrayInputStream(mImageData); byte[] fileBuffer = new byte[2048]; int bytesRead; while ((bytesRead = reader.read(fileBuffer)) != -1) { outstream.write(fileBuffer, 0, bytesRead); int progress = bytesRead; } reader.close(); yourEntity.writeTo(outstream); }
has comment: http://stackoverflow.com/comment/52867382
type: Answer
has comment: http://stackoverflow.com/comment/52862876
score: 0

http://stackoverflow.com/q/26414258
has comment: http://stackoverflow.com/comment/41477003
has body: I have created a binary search tree class. I created my insertion method, height method, and print method. When I insert, everything looks fine. IF the root is null, I create a new root and set the item. But when I call my height method, it prints out 2 instead of 1. When I call my print method, it prints out all the elements including root twice. For example, I inserted the following elements in the following order: 9, 5, 4, 55, 555 When I call my PREorderPRINT method, it prints out: 9, 5, 4, 9, 55, 555 The values printed are correct except for the duplicate 9 in the middle which I never inserted. My insert method does NOT use recursion. But my height and print methods use recursion. My recursive preOrderPrint checks if root!=null, then it prints item, gets left, and gets right. When I call preorder in my public preorder method, I first check it tree is empty, if not, then I print it by passing in root to preOrderPRint(root) My recursive height method checks if root is null and returns zero. If not, it gets height of left and right subtrees of root, compares them, and returns either left+1 or right+1. When I call my public height method, i check if root is null and return zero, else call recursive height passing in root. When I insert one element, 9, into the tree, and call my height method, it prints out the height is 2. But my size method prints out the correct size, 1. There has to be something wrong with my recursive preorderPrint and height methods. I can't seem to figure out what I'm missing. Is there a special case I forgot to add? EDIT: I posted code and deleted it. Fixed the problem. All I had to do was change an else to an else-if and add a condition to compare root with item being inserted. A silly mistake by me.
answer count: 1
score: 0
has title: Why does Insertion into BST insert root twice?
tagged with: insert
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/26418100
has comment: http://stackoverflow.com/comment/41482070
tagged with: tree
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41482965
has answer: http://stackoverflow.com/a/26418100
tagged with: java
has comment: http://stackoverflow.com/comment/41477575
has comment: http://stackoverflow.com/comment/41476410
type: Question

http://stackoverflow.com/comment/41655496
has text: line 21 is parts [1] = "";
comment on: http://stackoverflow.com/q/26512543
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41626175
comment on: http://stackoverflow.com/q/26496487
score: 2
has text: In Java you can't compare strings by using the `==` and `!=` operators, you need to use the `equals(...)` method.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41592934
type: Comment
comment on: http://stackoverflow.com/q/26477999
score: 0
type: QuestionComment
has text: Does "MovingBoxes.class" exist on a directory in CLASSPATH? It seems that fails to find "MovingBoxes.class".

http://stackoverflow.com/a/40337788
has body: class Arrays { public static void main(String[] args) { double[] numbers = {6.0, 4.4, 1.9, 2.9, 3.4, 3.5}; java.util.Arrays.sort(numbers); System.out.print("Ascending order= "); for (int i = 0; i &lt; numbers.length; i++) System.out.print(numbers[i] + " "); System.out.println(); System.out.print("Decending order= "); for (int i = numbers.length -1; i &gt;= 0; i--) System.out.print(numbers[i] + " "); } } This solution only displays in reverse order, but it can be changed to reorder the array using the same loop.
answers question: http://stackoverflow.com/q/26360865
type: Answer
score: 0

http://stackoverflow.com/q/26465399
type: Question
has answer: http://stackoverflow.com/a/26465643
score: 0
answer count: 1
has body: &lt;input class="btn btn-danger confirm" value="Send this!" type="submit"&gt; This input is inside a modal div and is not displayed(display:none) and only displays (display:block) when I click the trigger for the modal. The problem is that the modal becomes visible but it can't find the input element. I tried this modal.click(); //triggers modal WebElement send1 = driver.findElement(By.xpath("//input[@value='Send this!']")); send1.click(); also modal.click(); //triggers modal WebElement send1 = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='confirm']")); send1.click(); Does not work. Yields unable to locate xpath.
type: UnansweredQuestion
has title: Xpath Unable to locate path
tagged with: xpath
tagged with: java

http://stackoverflow.com/a/26359900
has comment: http://stackoverflow.com/comment/41381264
has body: Probably your resources are not copied from 'main' dir to 'test'. Try to run tests and go to $PROJECT_HOME/target/$PROJECT_NAME - is WEB_INF folder with templates there (in case its maven project, im not sure if gradle uses the same structure)? If they are not there then maybve you have to define node in your pom.xml. Take a look at documentation: http://maven.apache.org/plugins/maven-resources-plugin/testResources-mojo.html
score: 0
answers question: http://stackoverflow.com/q/26359664
type: Answer

http://stackoverflow.com/comment/41622882
type: Comment
comment on: http://stackoverflow.com/a/26494412
score: 0
type: AnswerComment
has text: You are welcome! You can let wildfly inject the datasource by doing the following in a ejb: @Resource(name = "java:jboss/datasources/Test5JPA") private DataSource ds;

http://stackoverflow.com/q/26478022
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26478069
type: Question
tagged with: mutex
score: 0
answer count: 1
has body: I'm looking to create multiple asynchronous threads in Java and pass messages between them. I send data to a data structure in the destination node and they poll for it. But access to that data structure must be locked. I use this line to create the lock: private final Object lock = new Object(); And this function to access the structure: public int mailboxSize() { synchronized (lock) { return mailbox.size(); } } My concern is that if all the nodes use this class/cookie-cutter for their code, all locks will be the same and I will have only 1 lock instead of the n I'm hoping for. Is that true? If so, how can I create a unique lock for each node? Maybe some incrementing id? Does the lock have to be of type object or can I use int or Integer instead? Thanks in advance!
accepted answer: http://stackoverflow.com/a/26478069
has title: How to use a monitor (synchronized) in Java

http://stackoverflow.com/comment/105899769
comment on: http://stackoverflow.com/a/26366608
type: AnswerComment
has text: I encountered the same problem while implementing code from the book Spring in Action. I was able to get past the error by creating an interface SongPerformer that extends Performer and having Instrumentalist implement SongPerformer. SongPerformer declares setSong and getSong.
score: 0
type: Comment

http://stackoverflow.com/comment/41420831
score: 0
type: Comment
type: QuestionComment
has text: Do you still call sudo in front of it or is assumed by default then ?
comment on: http://stackoverflow.com/q/26380923

http://stackoverflow.com/q/26438993
favorite count: 0
has title: ERROR: make.exe:***No rule to make target
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/40670074
has body: I' m a beginner in Android Programmin and Eclipse. I' m using Eclipse Luna (4.4 version). I' m imported "OpenCV - face detection" project in Eclipse, but when I try to buil it, Eclipse give me this error: Description: make.exe: *** No rule to make target `../../sdk/native/jni/OpenCV.mk'. Stop. Resource: OpenCV Sample - face-detection Type: C/C++ Problem I think the file that causes this error is Android.mk, contained in jni directory and this is its code: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) #OPENCV_CAMERA_MODULES:=off #OPENCV_INSTALL_MODULES:=off #OPENCV_LIB_TYPE:=SHARED include ../../sdk/native/jni/OpenCV.mk LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp LOCAL_C_INCLUDES += $(LOCAL_PATH) LOCAL_LDLIBS += -llog -ldl LOCAL_MODULE := detection_based_tracker include $(BUILD_SHARED_LIBRARY) On the 8th row of previous file: include ../../sdk/native/jni/OpenCV.mk Eclipse report me this warning: Description: make: ../../sdk/native/jni/OpenCV.mk: No such file or directory Resource: Android.mk Path: /OpenCV Sample - face-detection/jni Location: line 8 Type: C/C++ Problem Can someone help me? I'm sorry for my English XD
score: 2
upvote count: 2
tagged with: java
type: Question
tagged with: opencv
has answer: http://stackoverflow.com/a/26446696
tagged with: eclipse
has answer: http://stackoverflow.com/a/46343310
answer count: 3
downvote count: 0

http://stackoverflow.com/a/26480050
type: AcceptedAnswer
type: Answer
has body: Call testing() at SurfaceHolder.Callback#onSurfaceCreated. :-)
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26462474
accepted answer of: http://stackoverflow.com/q/26462474
upvote count: 1

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

http://stackoverflow.com/q/26476169
tagged with: swing
has body: I need to display JList with custom JPanel components called Item. These components have unique identification name. They may be dynamically added to the JList, or just updated (if already exist). I try the following implementation, but it produces just an empty JList. Please advise. class Item extends JPanel { JLabel name = new JLabel(" "); JLabel col1 = new JLabel(" "); JLabel col2 = new JLabel(" "); Item(){ setMinimumSize(new Dimension(100, 20)); setLayout(new BorderLayout()); add(name, BorderLayout.WEST); add(col1, BorderLayout.CENTER); add(col2, BorderLayout.EAST); } } public class Test_List extends JFrame { private final JList list = new JList(new Item[0]); HashMap&lt;String, Item&gt; map = new HashMap&lt;String, Item&gt;(); Test_List(){ setTitle("Test JList"); setLayout(new BorderLayout()); add(new JScrollPane(list), BorderLayout.CENTER); pack(); } public void update_item(String name, String s1, String s2){ Item item = map.get(name); if (item == null){ // add new item = new Item(); item.name.setText(name); map.put(name, item); list.add(item); } item.col1.setText(s1); item.col2.setText(s2); } public static void main(String s[]) { final Test_List frame = new Test_List(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { frame.setVisible(true); } }); frame.update_item("A", "a", "aa"); // add new item frame.update_item("B", "b", "bb"); // add new item frame.update_item("A", "aa", "a"); // update existing item } }
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/41589636
has comment: http://stackoverflow.com/comment/41589619
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/26476427
downvote count: 0
tagged with: jlist
answer count: 1
favorite count: 0
has title: Using custom JPanel components in JList
has answer: http://stackoverflow.com/a/26476427
upvote count: 2

http://stackoverflow.com/comment/41386226
type: Comment
type: QuestionComment
has text: An adjacency matrix just describes the structure of a graph, and in one of its simpler forms, would just be a 2D array of booleans. Said array indicates an edge between vertices `i` and `j` by having a value of `true` at `adjacencyMatrix[i][j]`. How your code interacts with it is up to you -- it could be recursive or iterative.
score: 0
comment on: http://stackoverflow.com/q/26363485

http://stackoverflow.com/q/26427966
has comment: http://stackoverflow.com/comment/41501718
linked to: http://stackoverflow.com/q/14455018
has comment: http://stackoverflow.com/comment/41501579
has body: I have been following the instructions for the Android Bootcamp youtube series (3. Hello World) as closely as possible, but I have run into a whole slough of issues: Problem 1: AVD Manager Eclipse won't recognize my phone (Samsung Galaxy S5) for debugging/running apps. It doesn't show up in the AVD at all. I have downloaded the driver required for my comp to communicate with the phone I have enabled Developer's Mode on my phone I have enabled debugging over USB I have restarted Eclipse AND my phone The phone is new, undamaged and runs just fine My computer recognizes my phone and attributes the correct name, can extract files, etc Problem 2: Running Apps I attempted to circumvent the AVD Manager by clicking "Run" to simply select my phone. However, after electing to run as an "Android Application," I got an error: Errors occurred during the build. Errors running builder 'Android Pre Compiler' on project 'XXX' I resolved this error by installing new software from (Help &gt; Install new Software &gt; http://download.eclipse.org/releases/luna &gt; 'Collaboration' &gt; 'Subversive SVN JDT Ignore Extensions' and 'Subversive SVN Team Provider') via the recommendation made on this thread. This made the error disappear. Unfortunately, while the error no longer appears, the application still refuses to run. There are errors now in: HelloWorld1 (ERRORS) src (ERRORS) com.example.helloworld1 (ERRORS) HelloWorldActivity.java (ERRORS) and rec (ERRORS) values (ERRORS) values-v11 (ERRORS) values-vw820dp (ERRORS) Sadly, I don't know when the errors appeared, but I do know that they are preventing me from running anything. I have attempted cleaning the project, but it fails every time and does not return a warning or message. The only file I have touched since creating the project is the xml fragment. I click-and-dragged a couple elements in the Graphical Layout, then removed them. I have not touched any code, except the hex color code used to change the font color for "Hellow World"…
tagged with: http://stackoverflow.com/tag/xml
type: Question
has answer: http://stackoverflow.com/a/26428525
tagged with: android
tagged with: eclipse-luna
score: 0
tagged with: java
answer count: 1
has title: Eclipse ADK: Errors in Main Activity and Rec
tagged with: adk
type: UnansweredQuestion

http://stackoverflow.com/q/26502872
tagged with: cpu
has title: Ideal cpu percent for android app
type: Question
has answer: http://stackoverflow.com/a/26503187
has body: I used adb shell to get cpu used by my android app. and I recorded these values but I see in some cases cpu usage -for my app- 25%. my question is: is this value -25% from cpu- very high or what? and what ideal cpu % for android app? thanks in advance
has comment: http://stackoverflow.com/comment/41637636
score: -2
downvote count: 3
has comment: http://stackoverflow.com/comment/41638105
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26503187
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/41629146
has text: Does it always happens on the first invocation to http://venus:9090/USProjectServices/LingoAtTaskService?wsdl? Does the server produce log entries?
comment on: http://stackoverflow.com/q/26498189
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26407040
tagged with: java
has answer: http://stackoverflow.com/a/48993962
answer count: 5
has body: NOTE: This is NOT a question about case-insensitive matching. It is a question about regex anchors. I'm having a lot of trouble doing basic case insensitive matching in Java: import java.util.regex.Matcher; import java.util.regex.Pattern; public class match { public static void main(String[] args) { String prompt="das101.lo1&gt;"; String str="automate@DAS101.LO1&gt;"; Pattern ignore = Pattern.compile(prompt.toUpperCase(), Pattern.CASE_INSENSITIVE); Matcher mIgn = ignore.matcher(str); if(mIgn.matches()) System.out.println(str+" Matches " + prompt.toUpperCase()); else System.out.println(str+" Doesn't Match " + prompt.toUpperCase()); char[] cStr = str.toCharArray(); char[] cPrompt = prompt.toUpperCase().toCharArray(); /* Verify that strings match */ for(int i=cPrompt.length-1, j=cStr.length-1; i&gt;=0 &amp;&amp; j&gt;=0 ; --i,--j) { if (cPrompt[i]==cStr[j]) System.out.println("Same: "+ cPrompt[i]+":" + cStr[j]); else System.out.println("Different: "+ cPrompt[i]+":" + cStr[j]); } } } The output: samveen@javadev-tahr:/tmp$ javac match.java samveen@javadev-tahr:/tmp$ java match automate@DAS101.LO1&gt; Doesn't Match DAS101.LO1&gt; Same: &gt;:&gt; Same: 1:1 Same: O:O Same: L:L Same: .:. Same: 1:1 Same: 0:0 Same: 1:1 Same: S:S Same: A:A Same: D:D If I change if(mIgn.matches()) to if(mIgn.find()), I get this simple string pattern match working: samveen@javadev-tahr:/tmp$ javac match.java samveen@javadev-tahr:/tmp$ java match automate@DAS101.LO1&gt; Matches DAS101.LO1&gt; Same: &gt;:&gt; Same: 1:1 Same: O:O Same: L:L Same: .:. Same: 1:1 Same: 0:0 Same: 1:1 Same: S:S Same: A:A Same: D:D Where am I going wrong? I referred to Case-Insensitive Matching in Java RegEx and Methods of the Pattern Class
has answer: http://stackoverflow.com/a/26407676
has answer: http://stackoverflow.com/a/26407189
linked to: http://stackoverflow.com/q/4450045
possible better answer: http://stackoverflow.com/a/26407676
accepted answer: http://stackoverflow.com/a/26407189
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/52739063
score: 10
upvote count: 11
favorite count: 0
tagged with: pattern-matching
has answer: http://stackoverflow.com/a/26407170
type: Question
downvote count: 1
has title: Case-insensitive string matching in Java without anchors

http://stackoverflow.com/a/26387914
accepted answer of: http://stackoverflow.com/q/26387112
answers question: http://stackoverflow.com/q/26387112
type: Answer
has comment: http://stackoverflow.com/comment/41429517
has body: The first 3 print statements that output something ending with @938b4a only show that the object exists, and that the object does not implement toString(). Byte arrays should be printed out using hexadecimals. After that you get to generatePublic which fails. This means that your public key - which should be a DER encoded SubjectPublicKeyInfo structure - could not be parsed.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/41450722
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26399885
has text: You shouldn't be using a `KeyListener` on a text component, consider trying a `DocumentListener` instead...mind you, adding a `JTextField` to a `JMenuBar` seems a bit ... weird...
type: QuestionComment

http://stackoverflow.com/q/26477233
downvote count: 4
upvote count: 0
answer count: 1
has title: Recursive Method that returns the index of an element java
tagged with: iteration
favorite count: 0
has comment: http://stackoverflow.com/comment/41591497
has comment: http://stackoverflow.com/comment/41591614
has answer: http://stackoverflow.com/a/26478496
has comment: http://stackoverflow.com/comment/41591494
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41592007
has body: I am trying to search a sorted array for a number that i choose. if the array contains this number i want to return the indices of each occurrence. I need to write to methods to do this task. one Recursively and one iteratively. I have started the recursive method below. public int findRecursive(T anEntry) { return binarySearchRecursive(0, length - 1, anEntry); } private int binarySearchRecursive(int first, int last, T desiredItem) { int position = 0; int mid = (first + last) / 2; if (first &gt; last || (desiredItem.compareTo(list[position]) != 0)) position = -(position + 1); else if (desiredItem.equals(list[mid])) position = mid; else if (desiredItem.compareTo(list[mid]) &lt; 0) position = binarySearchRecursive(first, mid -1, desiredItem); else position = binarySearchRecursive(mid + 1, last, desiredItem); return position; } Here is the array/output that should be expected public static void main(String[] args) { AList&lt;Integer&gt; testList = new AList&lt;Integer&gt;(); testList.add(1); testList.add(3); testList.add(2); testList.add(5); testList.add(7); testList.add(2); testList.add(4); //* question 5 //* should output 1, -8, 4 // my out is returning -1, -1, -1 testList.sort(); System.out.println(testList.findRecursive(2)); System.out.println(testList.findRecursive(8)); System.out.println(testList.findRecursive(4)); System.out.println("");
has comment: http://stackoverflow.com/comment/41592477
score: -4
tagged with: methods
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/41592555
accepted answer: http://stackoverflow.com/a/26478496
has comment: http://stackoverflow.com/comment/41592537
tagged with: java

http://stackoverflow.com/comment/41633683
score: 0
type: AnswerComment
has text: rename the String[] token to new name, the string split function will not return the splitor string ,if you want to get the matcher, you had better use the java.util.regex.Matcher or Pattern.
comment on: http://stackoverflow.com/a/26500693
type: Comment

http://stackoverflow.com/comment/41396353
comment on: http://stackoverflow.com/q/26369405
score: 0
type: Comment
type: QuestionComment
has text: @teaLeef Post the *complete* code. An MVCE. We're not going to bother with guesswork.

http://stackoverflow.com/comment/41573963
comment on: http://stackoverflow.com/q/26370270
has text: another reference with no solution: https://community.oracle.com/message/10321718
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/41404938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26361186
score: 0
has text: Hello Buno, https://github.com/ymasory/iText-4.2.0 is the repo i am using. Its the final free version according to the readme.

http://stackoverflow.com/a/26492962
has comment: http://stackoverflow.com/comment/41619712
type: Answer
has comment: http://stackoverflow.com/comment/41619676
answers question: http://stackoverflow.com/q/26492783
has body: Try resizing the bitmap before displaying. If that's not what you want, Then do this In your manifest file, set android: LargeHeap = "true" If that still doesn't satisfy you, then you'd have to hold the bitmap outside java---->. https://github.com/AndroidDeveloperLB/AndroidJniBitmapOperations
has comment: http://stackoverflow.com/comment/41619528
has comment: http://stackoverflow.com/comment/41620567
score: 0
has comment: http://stackoverflow.com/comment/41620210

http://stackoverflow.com/comment/41599030
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26481164
has text: The company where I work needs to send codes to the central computer to monitor network traffic constantly. SheelZ is the name of the variable BufferedReader, that takes output of remote commands

http://stackoverflow.com/a/26452994
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26452894
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/41547203
has body: Yeah, that's kind of issue what you're experimenting. If I may, in a situation where you only have exponental numbers, you should cast them and then use your method. See what I suggest is this bit of code down there: long longValue = Double.valueOf("1761e+5").longValue(); BigDecimal value= new BigDecimal(longValue); Use it in a method which would convert those string into a new BigDecimal and return this BigDecimal value. Then you can use those returned values with divideBy1000.That should clear any issue you're having. If you have a lot of those, what you can do also in store those BigDecimal in a data structure like a list. Then use a foreach loop in which you apply divideBy1000 and each new value would be stored in a different list. Then you would just have to access this list to have your new set of values ! Hope it helps :)

http://stackoverflow.com/comment/41483440
score: 0
comment on: http://stackoverflow.com/a/26418332
type: AnswerComment
has text: Java Doc http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#startsWith(java.lang.String)
type: Comment

http://stackoverflow.com/comment/41617173
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26491569
has text: But calling `handler.getClass()` will give you the actual `<H>` class ;).
type: Comment

http://stackoverflow.com/comment/41480083
type: QuestionComment
type: Comment
has text: Have you posted the entire stack trace from your Logcat?
comment on: http://stackoverflow.com/q/26416379
score: 0

http://stackoverflow.com/comment/41894904
type: AnswerComment
has text: ha ha,I receive the autor reply, the `synchronized` is not necessary,They will fixed it.Anyhow, Thanks again.:)
type: Comment
comment on: http://stackoverflow.com/a/26502465
score: 0

http://stackoverflow.com/a/26418162
score: 1
upvote count: 1
type: AcceptedAnswer
has body: changed int to long, and it will work.
answers question: http://stackoverflow.com/q/26418078
accepted answer of: http://stackoverflow.com/q/26418078
type: Answer
downvote count: 0

http://stackoverflow.com/comment/61595661
score: 0
type: QuestionComment
type: Comment
has text: could you add your solution as an answer?
comment on: http://stackoverflow.com/q/26406205

http://stackoverflow.com/q/26379916
has title: Passing javascript variable to servlet
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/41415215
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26380440
linked to: http://stackoverflow.com/q/4112686
has comment: http://stackoverflow.com/comment/41415415
has comment: http://stackoverflow.com/comment/41418002
downvote count: 0
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/4112686
has body: How can I pass a var from javascript to a servlet. Yes I know you can use getParameter on the servlet side, but I first need to do some javascript stuff then from there it need to pass that new variable to servlet. See my Javascript example: function openBrWindowAndSubmit() { var textBodyValue = encodeURIComponent(document.getElementById("textBody").value); alert(textBodyValue); //returns empty document.forms[0].submit(); var textBodyValue = encodeURIComponent(document.getElementById("textBody").value); alert(textBodyValue); //works } As you can see in above example the first "alert" block returns empty, but the second one returns the correct encoded value because the document.forms[0].submit is already called. So is there a way I can get the second variable "textBodyValue" (which is outside of document.forms[0].submit) to the servlet? I'm calling this at the servlet side: String test = req.getParameter("textBody"); Here's the JSP inside a form tag which calls the function on click: &lt;textarea id="textBody" name="textBody"&gt;&lt;/textarea&gt; &lt;input type="button" onClick="openBrWindowAndSubmit();" value="Click Here to Preview Email"&gt; Is there any workaround to this problem? I've been trying to change the javascript function to: function openBrWindowAndSubmit() { //v2.0 document.forms[0].target = "_blank"; document.getElementById("action").value = "view_template"; var textBodyValue = encodeURIComponent(document.getElementById("textBody").value); alert(textBodyValue); document.forms[0].submit(); var textBodyValue = encodeURIComponent(document.getElementById("textBody").value); alert(textBodyValue); $.ajax({ url: 'http://localhost:8080/restricted/comm/Email', data: textBodyValue, // processData: false, // contentType: false, type: 'POST', success: function(data){ alert(data); } }); } Can this work? i'm getting an undefined error when reaching the $ajax tag?
has comment: http://stackoverflow.com/comment/41420937
type: Question
has comment: http://stackoverflow.com/comment/41418837
tagged with: jsp
tagged with: javascript
tagged with: struts
tagged with: servlets

http://stackoverflow.com/comment/41574405
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26467430
has text: Also, I wouldn't use the `toString` method of your entity to serialize the object. Use instead something like `DataSerializer.serialize` (you have to create `DataSerializer`)
score: 0

http://stackoverflow.com/a/26415340
type: Answer
has body: You can also use a line.seperator. System.getProperty("line.separator") will retrieve a correct line separator that is used by your OS. public class Tester { public static void main(String[] args) { Scanner k = new Scanner(System.in); String newLine = System.getProperty("line.separator"); k.useDelimiter("/|"+newLine); String day,month,year; day = k.next(); month = k.next(); year = k.next(); System.out.println(day + "/" + month + "/" + year); } }
score: 3
answers question: http://stackoverflow.com/q/26415101
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/41479235

http://stackoverflow.com/comment/41523145
has text: If you want to get a result set you would use `SELECT product.name,product.code,product.id FROM product`. The way you are using it would fill your out variables with a "random" row value, and not create a result set.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26437637

http://stackoverflow.com/q/26506364
has answer: http://stackoverflow.com/a/26506927
has answer: http://stackoverflow.com/a/70090303
has comment: http://stackoverflow.com/comment/41643716
possible better answer: http://stackoverflow.com/a/26506490
answer count: 8
has answer: http://stackoverflow.com/a/55656112
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/63168381
has comment: http://stackoverflow.com/comment/41643557
linked to: http://stackoverflow.com/q/2619598
accepted answer: http://stackoverflow.com/a/26506927
has answer: http://stackoverflow.com/a/67350353
type: AnsweredQuestion
has body: I need new third party jar for reading csv in maven based project. So, I did entry in pom.xml for same as below. net.sf.opencsv opencsv 2.0 But when I run mvn install or mvn package command, It does not download newly added dependency and just build project and generate war. I am trying to get the issue! Please share solution if anybody face this earlier! Regards
upvote count: 19
has title: maven- not downloading new added dependency in pom.xml file
tagged with: maven
has comment: http://stackoverflow.com/comment/41644414
has answer: http://stackoverflow.com/a/55256787
score: 19
type: Question
has answer: http://stackoverflow.com/a/26506490
has answer: http://stackoverflow.com/a/52942330
tagged with: java

http://stackoverflow.com/comment/41492954
has text: Do you have the S2 JSON plugin library deployed? It doesn't look like it.
comment on: http://stackoverflow.com/q/26422044
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/47257892
has comment: http://stackoverflow.com/comment/81470319
upvote count: 2
has body: I apologize for not answering questions seriously before. 1.Maybe it caused by special characters.You can get details from this url。https://bz.apache.org/bugzilla/show_bug.cgi?id=60594 solve it by： encodeURIComponent(JSON.stringify(data)) or change your tomcat version to 7.0.67 or lower. According to developers's opinion, tomcat developers in the following versions set the option to allow |，{，}. Get detail http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html#Other The new environment variable will be included in: - trunk for 9.0.0.M18 onwards 8.5.x for 8.5.12 onwards 8.0.x for 8.0.42 onwards 7.0.x for 7.0.76 onwards2. Another reason maybe that Request header is too large.You can solve this by modifying the server.xml. &lt;Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /&gt; Hope it works for you！
has comment: http://stackoverflow.com/comment/81466637
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26504212

http://stackoverflow.com/q/26483647
downvote count: 0
answer count: 1
favorite count: 0
tagged with: eclipse-rcp
has title: Eclipse EMF: Customize XML deserialization so old project can be loaded into modified model
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26588256
has body: Situation I have an Eclipse RCP application that manages application projects within an EMF model. These projects are saved by serializing them to the XMI format. Such files can then be loaded back into the model. I use the standard EMF tools (such as Resource) for this. Due to model refactoring, the following has changed: Old model EClass MyClass with an attribute Name (with capital letter). XMI: &lt;MyClass Name="My Class Name 1" ... /&gt; vs. New model EClass MyClass inherits from MyBaseClass, with attribute name (without capital letter). EClass MyClass no longer has Name attribute, since EMF does not allow both. This makes sense as it would collide on e.g. the getter method getName(). Problem How can I load an old XMI project file into my new model? Up until this problem I was able to either: avoid modifying the model grow the model to contain both the old and new structures and perform modification after loading the project file: moving information from old to new types, updating references,.... In this case, however, I cannot load the XMI file in the first place: the model misses attribute name on one hand and does not recognize (and thus ignores) attribute Name on the other. Question What is the correct place to implement this backwards compatibility support? I assume I should work on the deserialization process or the XML mapping. Constraints for the solution are: New projects (containing &lt;MyClass name="..." ... /&gt;) must be loaded correctly as well. Saving (i.e. serializing) a project model should always happen in the new format!
type: Question
tagged with: emf
upvote count: 5
tagged with: java
tagged with: eclipse-emf
accepted answer: http://stackoverflow.com/a/26588256
score: 5

http://stackoverflow.com/comment/41636602
type: Comment
type: QuestionComment
has text: Oh! My bad! Scrolled too much, sorry!
score: 0
comment on: http://stackoverflow.com/q/26502346

http://stackoverflow.com/comment/41367811
comment on: http://stackoverflow.com/q/26354170
type: Comment
type: QuestionComment
has text: `Caused by: java.lang.NullPointerException`
score: 0

http://stackoverflow.com/comment/41460648
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26405930
type: QuestionComment
has text: What's IType ? is it enum?

http://stackoverflow.com/a/26434013
has comment: http://stackoverflow.com/comment/41512879
answers question: http://stackoverflow.com/q/26433929
has comment: http://stackoverflow.com/comment/41512902
score: 2
has comment: http://stackoverflow.com/comment/41512979
downvote count: 0
has body: The error you getting is because you are trying to do parts[1] when it doesn't have it. Code you are looking for is: String guess = "1234"; int[] guessInteger = new int[guess.length()]; int i=0; for(Character ch : guess.toCharArray()){ if(Character.isDigit(ch)){ guessInteger[i++] = Character.getNumericValue(ch); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/41512853
type: Answer

http://stackoverflow.com/q/26402645
type: Question
has body: I want to get the text value of a certain element in xml. In the XML below i want to get the value of SUBCHILD when the value of CODE is 'Code1' irrespective of the position of the MP entity when there could be many MP elements. Also i want to be able to do this using JAXB and MOXy with the @XMLPath attribute The xml i have is this: <CODE>Code1 VALUE for Code1 <CODE>Code2 VALUE for Code2 I want 'VALUE for Code1' irrespecive of its position, the MP element containing Code1 could be anywhere. The XPath i would use for this would be: RQ/PQ/MP[INFO/CODE='Code1']/CHILD/SUBCHILD but i cant seem to get the value i want from MOXy, is this functionality not supported, I know that you can map based on attributes, but i need it depending on the value of another element Any help would be appreciated
upvote count: 1
answer count: 1
tagged with: moxy
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xpath
accepted answer: http://stackoverflow.com/a/26407024
has title: XPaths using EclipseLink MOXy and JAXB given a value of another element
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26407024
downvote count: 0
score: 1
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/41558535
has text: @Avacay You can put the next condition in an else if () {} statement that follows the original if.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26459388

http://stackoverflow.com/comment/41451869
has text: Gas i have @Stateless in my class that implements this method public Devices insertDevices(Devices device)
type: QuestionComment
comment on: http://stackoverflow.com/q/26393020
score: 0
type: Comment

http://stackoverflow.com/a/26446136
type: Answer
accepted answer of: http://stackoverflow.com/q/26446090
answers question: http://stackoverflow.com/q/26446090
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Try this: ... &lt;EditText android:id="@+id/username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/top_edittext_form_bg" android:hint="Email or Username" android:layout_gravity="center_horizontal" android:layout_marginTop="5pt" android:layout_marginLeft="5pt" android:layout_marginRight="5pt" /&gt; &lt;EditText android:id="@+id/password" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/bottom_edittext_form_bg" android:inputType="textPassword" android:hint="Password" android:layout_gravity="center_horizontal" android:layout_marginBottom="5pt" android:layout_marginLeft="5pt" android:layout_marginRight="5pt" /&gt; ... Tell me if it works. :)

http://stackoverflow.com/q/26411963
upvote count: 2
has title: Ternary operator issue in Guava: cannot convert from Ordering<Comparable> to Ordering<String>
accepted answer: http://stackoverflow.com/a/26412641
answer count: 1
has comment: http://stackoverflow.com/comment/41472081
tagged with: guava
has comment: http://stackoverflow.com/comment/41472046
has comment: http://stackoverflow.com/comment/41472327
tagged with: java
has comment: http://stackoverflow.com/comment/41472176
score: 2
type: AnsweredQuestion
tagged with: java-7
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26412641
has comment: http://stackoverflow.com/comment/41471935
type: Question
has comment: http://stackoverflow.com/comment/41472171
has comment: http://stackoverflow.com/comment/41472562
tagged with: ternary-operator
has body: I just met this weird condition with Guava's Ordering class. With this code using ternary operator: Ordering&lt;String&gt; ordering = flag ? Ordering.natural().nullsFirst() : Ordering.natural().nullsLast(); Note: flag is boolean variable. I got this error shown in Eclipse for that line: Type mismatch: cannot convert from Ordering&lt;Comparable&gt; to Ordering&lt;String&gt; But if I change it to if-else block, no error found. Ordering&lt;String&gt; ordering; if (flag) { ordering = Ordering.natural().nullsFirst(); } else { ordering = Ordering.natural().nullsLast(); } Anyone can explain what happened here? Note: I'm using java 7.

buildpath
type: Tag
tags question: http://stackoverflow.com/q/26426187
tags question: http://stackoverflow.com/q/26382080
tag name: buildpath

http://stackoverflow.com/comment/41519528
type: QuestionComment
score: 0
has text: @getlost if the login button has id it s easy to access via java...right??
type: Comment
comment on: http://stackoverflow.com/q/26387186

http://stackoverflow.com/comment/41515414
comment on: http://stackoverflow.com/q/26435282
score: 0
type: QuestionComment
has text: Some additional info is that I recorded it myself, using [Audacity](http://en.wikipedia.org/wiki/Audacity_(audio_editor)), and then exported it as a `wav` file.
type: Comment

http://stackoverflow.com/comment/41625601
type: QuestionComment
has text: Which line is MainActivity.java 110?
comment on: http://stackoverflow.com/q/26495794
score: 0
type: Comment

http://stackoverflow.com/comment/41643031
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26505086
has text: Is `uuid` really ambiguous here ?
score: 0

http://stackoverflow.com/a/26501992
answers question: http://stackoverflow.com/q/26501593
score: 0
has comment: http://stackoverflow.com/comment/41643904
has body: Remove these attributes because ScrollView is the top view in your xml file android:layout_gravity="top|center" android:layout_alignParentTop="true" Also remove &lt;requestFocus /&gt; In this TextView both padding and margin are provided check if you really need it. &lt;TextView android:id="@+id/tProfileTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="12dp" android:padding="10dp" android:text="Welcome to Dooba. We provide you with a date for everything you want to do. To begin, please fill out all of the information below." android:textSize="20sp" android:textStyle="normal|bold" android:typeface="sans" /&gt; Modify your RelativeLayout like this &lt;RelativeLayout android:id="@+id/main" android:layout_width="match_parent" android:layout_height="797dp" android:descendantFocusability="beforeDescendants"&gt;
type: Answer

http://stackoverflow.com/q/26441120
duplicate of: http://stackoverflow.com/q/7056749
has title: Can same Scanner object take inputs of different datatypes?
has body: Here's my code: package Random; import java.util.Scanner; public class SwitchMonth { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter Year: "); int year = in.nextInt(); System.out.println("Enter month: "); String month = in.nextLine(); //String month = "" switch (month) { case "january": case "march": case "may": case "july": case "august": case "october": case "december": System.out.println("No. of days: 31"); break; case "april": case "june": case "september": case "november": System.out.println("No. of days: 30"); break; case "february": if ((year % 4 == 0) &amp;&amp; !(year % 100 == 0) || (year % 400 == 0)) System.out.println("No. of days: 29"); else System.out.println("No. of days: 28"); break; default: System.out.println("Wrong month entered."); break; } in.close(); } } Output: Enter year: 2000 Enter month: Wrong month entered. The program terminates without taking the month input. If i hard code the month name then it's working fine but when i take the input from console it terminates with above output. I believe the problem lies with Scanner object. If i use another Scanner object for month then it's working fine. So my question is: Can i use same scanner object for taking int input then string input or not?? if not then why?? All the answers are appreciated. Thanks in advance.
score: 0
accepted answer: http://stackoverflow.com/a/26441156
answer count: 1
tagged with: java.util.scanner
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26441156
tagged with: java
linked to: http://stackoverflow.com/q/7056749
type: Question

http://stackoverflow.com/comment/41377618
type: QuestionComment
comment on: http://stackoverflow.com/q/26359779
score: 0
has text: Looks like you want to use `List<String>` instead of `List<Map<String, Object>>`
type: Comment

http://stackoverflow.com/comment/41609106
type: QuestionComment
comment on: http://stackoverflow.com/q/26487291
has text: You could use more math knowledge to shorten your function. E.g. you could simple write `getRange()` as `return Collections.max(Arrays.asList(test1, test2, test3)) - Collections.min(Arrays.asList(test1, test2, test3));`
score: 0
type: Comment

http://stackoverflow.com/comment/41456188
comment on: http://stackoverflow.com/a/26402708
score: 0
type: Comment
has text: @Tom oops! Fixed. Thanks for noticing.
type: AnswerComment

http://stackoverflow.com/comment/87600616
score: 0
comment on: http://stackoverflow.com/q/26393644
type: Comment
has text: Need some code. You should be able to reduce your problem to a small code footprint and either show it to us or solve the problem yourself. Start removing stuff until the problem goes away.
type: QuestionComment

http://stackoverflow.com/comment/41514445
comment on: http://stackoverflow.com/q/26434320
score: 0
has text: it's some sort of standard, actually, so it's not bad.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26464607
has answer: http://stackoverflow.com/a/27664447
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: mapreduce
type: Question
tagged with: hadoop
has body: I have an input text file as given below (partial): {"author":"Martti Paturi","book":"Aiotko oppikouluun"} {"author":"International Meeting of Neurobiologists Amsterdam 1959.","book":"Structure and function of the cerebral cortex"} {"author":"Paraná (Brazil : State). Comissão de Desenvolvimento Municipal.","book":"Plano diretor de desenvolvimento de Maringá"} I need to perform MapReduce on this file to get as output a JSON object which has all the books from the same author in a JSON array, in the form: {"author": "Ian Fleming", "books": [{"book": "Goldfinger"},{"book": "Moonraker"}]} My code is as follows: import java.io.IOException; import java.util.StringTokenizer; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; import org.json.*; public class CombineBooks { //TODO define variables and implement necessary components /*public static class MyTuple implements Writable{ private String author; private String book; public void readFields(DataInput in){ JSONObject obj = new JSONObject(in.readLine()); author = obj.getString("author"); book = obj.getString("book"); } public void write(DataOutput out){ out.writeBytes(author); out.writeBytes(book); } public static MyTuple read(DataInput in){ MyTuple tup = new MyTuple(); tup.readFields(in); return tup; } }*/ public static class Map extends Mapper&lt;LongWritable, Text, Text, Text&gt;{ public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException{ String author; String book; String line = value.t…
answer count: 2
has title: java.lang.ClassCastException: class org.json.JSONObject in MapReduce program
score: 0
has comment: http://stackoverflow.com/comment/41577526
has answer: http://stackoverflow.com/a/26468653

http://stackoverflow.com/comment/41579608
comment on: http://stackoverflow.com/q/26470980
has text: code for subtracting `month = (month % 12)+1;` are you sure its correct? , In case if you have month 0 even in this condition above formula will return you one only.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26396476
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/41445155
has comment: http://stackoverflow.com/comment/41444430
has comment: http://stackoverflow.com/comment/41444870
upvote count: 1
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
has body: hi i have a desktop java app which sends data to a php server. i have to set variable names while sending data to the server . i have done it before on android by using this code HttpClient httpClient = new DefaultHttpClient(); // post header HttpPost httpPost = new HttpPost(postReceiverUrl); List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;(2); params.add(new BasicNameValuePair("username", username)); params.add(new BasicNameValuePair("password", passwrd)); httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); // execute HTTP post request HttpResponse response = httpClient.execute(httpPost); HttpEntity resEntity = response.getEntity(); now this code is not valid for java desktop app. for java i am doing this url = new URL(targetURL); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); // connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); // connection.setRequestProperty("Content-Language", "en-US"); connection.setUseCaches (false); connection.setDoInput(true); connection.setDoOutput(true); //Send request DataOutputStream wr = new DataOutputStream ( connection.getOutputStream ()); String parameters = "username="+username+"&amp;password="+password; // wr.writeBytes (parameters); wr.writeChars(parameters); wr.flush (); how can i define variables as i was dong in android. if any one can help i will be thank full.
has comment: http://stackoverflow.com/comment/41444736
tagged with: android
accepted answer: http://stackoverflow.com/a/26858350
has comment: http://stackoverflow.com/comment/41444742
has title: setting variables names while sending data from java to php
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26858350
type: Question

http://stackoverflow.com/q/26415972
has answer: http://stackoverflow.com/a/26416043
score: -1
tagged with: arraylist
downvote count: 1
answer count: 1
has title: Editing a value in array list
favorite count: 0
tagged with: edit
type: AnsweredQuestion
upvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26416043
type: Question
has body: I'm trying to edit the values which are saved in an arraylist but i'm stuck up with the codes I can't proceed could u please help me with it.. The values in the array will be like Codes Title Prereq CS101 Computer CS210 CS102 Process CS211 Now I want to edit a particular course String code=request.getParameter("code"); String title=request.getParameter("title"); String preq=request.getParameter("preq"); @SuppressWarnings("unchecked") List&lt;prereqclass&gt; prereqcl = (List&lt;prereqclass&gt;)request.getServletContext().getAttribute("Preqattr"); for(prereqclass q:prereqcl){ if(q.getCode()==code){ } }

http://stackoverflow.com/a/26455277
has body: Yes, but you don't really need the Planet class because you can define all the same fields and methods inside PlanetEnum. The only difference is that an enum has a predefined set of instances and you can't create more.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26455226

http://stackoverflow.com/comment/42280767
type: Comment
comment on: http://stackoverflow.com/a/26856557
has text: Yeah, thanks you, but I already checked it out. It doesnt'do what I need it to do. It opens new activity, which I have to manually close, which is not acceptable.
score: 1
type: AnswerComment

http://stackoverflow.com/a/26474083
has body: It looks like the error is happening because you are passing two integers to a method that is expecting a Point. But without seeing your code that is actually referenced in the error, it's hard to know for sure. I'm going to guess that your line: pt3 = pt2.distance(3, -10); should probably look like this: pt3 = pt2.distance(new Point(3, -10)); or possibly like this: Point p4 = new Point(3,-10); pt3 = pt2.distance(pt4); Or maybe you should write a new method in Point: public double distance(int x, int y) { Point p = new Point(x,y); return this.distance(p); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26473999

http://stackoverflow.com/comment/41576500
comment on: http://stackoverflow.com/q/26463783
type: Comment
type: QuestionComment
has text: thanks for your help, I did as you suggested and again got: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
score: 0

http://stackoverflow.com/comment/41625484
comment on: http://stackoverflow.com/a/26485328
has text: I tried it, but I get the same result (no Google map displayed and no warning or error).
type: AnswerComment
type: Comment
score: 0

bad-request
tags question: http://stackoverflow.com/q/26448580
type: Tag
tags question: http://stackoverflow.com/q/26379452
tag name: bad-request

http://stackoverflow.com/comment/41557956
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26459021
has text: oh sorry posted the wrong part.

http://stackoverflow.com/comment/41567632
type: Comment
type: QuestionComment
score: 1
has text: set connection readTimeout and use retryHandler if your last call fails with read timeout
comment on: http://stackoverflow.com/q/26464757

http://stackoverflow.com/comment/41437155
comment on: http://stackoverflow.com/a/26392092
type: Comment
score: 0
type: AnswerComment
has text: **this is why you should always use an `ExecutorService`!**

http://stackoverflow.com/q/26508338
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/26508987
type: Question
has comment: http://stackoverflow.com/comment/41647403
tagged with: google-maps
has title: Setting custom info window for markers of google map with data from JSON android
downvote count: 0
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26508987
upvote count: 2
has body: I am working on a project where there are marker pins shown on google map with latitiude and longitude retrieved from server.But i want to customize the info window in such a way that it contains title as well as price(Both fields are present in the JSON response).One way to do it would be to iterate through the list containing the data and check against the corresponding latitude of the marker pin(using marker.getLatitude()) , and then getting the corresponding title and price and then setting it in the below methods: googleMap.setInfoWindowAdapter(new InfoWindowAdapter() { // Use default InfoWindow frame @Override public View getInfoWindow(Marker arg0) { return null; } EDIT:THIS IS THE CODE WHICH I HAVE USED for(int i=0;i&lt;job_list.size();i++) { Job_data j=job_list.get(i); googleMap.addMarker(new MarkerOptions().title(j.job_shop_name) .position(new LatLng(Double.parseDouble(j.job_shop_latitude),Double.parseDouble(j.job_shop_longitude)))); } How do i modify the above code to set details for the custom info window? // Defines the contents of the InfoWindow @Override public View getInfoContents(Marker arg0) { View v = getLayoutInflater().inflate(R.layout.info_window_layout, null); //possibly iterate through the list containing the json data and then set it here return v; } }); Is my approach right or is there a better way of doing this?
has comment: http://stackoverflow.com/comment/41647857
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/41591666
score: 0
type: Comment
type: QuestionComment
has text: @afzalex The angle bracketed expressions (`<...>`) were hidden by the way posts are formatted. The editor did not add them, they appeared once the code was spaced in.
comment on: http://stackoverflow.com/q/26477266

http://stackoverflow.com/comment/41554258
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26456700
has text: The MAIN cause of your problem is the two threads you are running. Get rid of the "loading" thread and do that ALL within the main thread.
score: 0

http://stackoverflow.com/q/26360865
has answer: http://stackoverflow.com/a/26360958
possible better answer: http://stackoverflow.com/a/26360978
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26360973
accepted answer: http://stackoverflow.com/a/26360973
tagged with: java
has answer: http://stackoverflow.com/a/26361077
score: 5
has comment: http://stackoverflow.com/comment/41380051
tagged with: arrays
answer count: 6
has answer: http://stackoverflow.com/a/40337788
has answer: http://stackoverflow.com/a/26360978
has comment: http://stackoverflow.com/comment/41380647
upvote count: 5
has title: How to use ArrayUtils for array of objects, it doesn't delete the content of an array
favorite count: 0
downvote count: 0
has body: How to delete the content of an array of objects. If there is other ways to delete a content of an array of objects , please do share. import java.util.Arrays; import java.util.Scanner; import org.apache.commons.lang3.ArrayUtils; public class Testing { public static void deleteItem(ItemTracker[] listItems) { System.out.println("Which item you want to delete? "); for(int i=0; i &lt; listItems.length; i++) { if(input.equalsIgnoreCase("Quantity")) { // Some Code } else if(input.equalsIgnoreCase("Something"){ ArrayUtils.remove(listItems, i); // This is the part where it should delete .. but it doesnt delete. } break; } } }
has answer: http://stackoverflow.com/a/26361147

http://stackoverflow.com/a/26433422
has comment: http://stackoverflow.com/comment/41572707
has comment: http://stackoverflow.com/comment/41516033
has comment: http://stackoverflow.com/comment/41515954
type: Answer
has body: Much depends on what it means to "find" a subtree. There is one rooted at each node, so simply identifying or counting them all just amounts to finding all the nodes. Your choice of depth-first or breadth-first traversal of the tree should suffice for that. If "finding" a subtree means doing something particular to or with it, then that could make one of those two traversal strategies more appropriate than the other.
answers question: http://stackoverflow.com/q/26433296
score: 0

http://stackoverflow.com/a/26369188
has body: Just use %, /, and a little math: int totalSeconds = 184; int minutes = totalSeconds/60; //will be 3 minutes int seconds = totalSeconds%60; // will be 4 seconds
score: 0
answers question: http://stackoverflow.com/q/26369111
has comment: http://stackoverflow.com/comment/41395582
type: Answer

http://stackoverflow.com/comment/41567485
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26454057
has text: @Uluik. Nevermind, I solved it. It turns out that it was actually pretty easy. The following code fetches the `BillingTableRow: BillingTableRow row = t.getTreeTablePosition().getTreeItem().getValue();` I guess that I was just too tired to realize it yesterday. Thank you for the help.
type: AnswerComment

http://stackoverflow.com/comment/41865795
has text: Thanks for your reply but It doesn't work. text area only displays if u select text area and press any key. Only last line is displayed. I want to print it same way as it does it on console.
comment on: http://stackoverflow.com/a/26468114
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/95877795
comment on: http://stackoverflow.com/a/28620110
score: 3
has text: Since the imports are missing here: I guess the invoke() method ist a static import of Deencapsulation.invoke(). In case anyone else wonders at first...
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/41434545
comment on: http://stackoverflow.com/a/26390591
score: 0
type: AnswerComment
type: Comment
has text: Not using this in the constructor doesn't cause any error message, even if the parameter has the same name as the object's property.

http://stackoverflow.com/q/26463826
tagged with: maven
has title: Do i need to mention default maven repo url?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26463876
tagged with: java
type: Question
has body: i have maven project.When i try to compile my project whether repo url or without repo url it compiles fine. Below is the default maven url i am mentioned in my pom http://repo1.maven.org/maven2/ My question is do we need to mention above repo url or not ? EDIT:- I believe most of the dependiencies exists at url repo1.maven.org/maven2. I need to mention different only if some of the dependency does not exist at this url. Is that correct ? –
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/41566121
accepted answer: http://stackoverflow.com/a/26463876

http://stackoverflow.com/comment/41393680
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26367946
has text: So how should i be calling it?

http://stackoverflow.com/q/26469578
tagged with: android-layout
tagged with: image
score: 0
answer count: 1
tagged with: android-activity
has answer: http://stackoverflow.com/a/26471075
type: UnansweredQuestion
tagged with: android
has body: I have created an activity that upon button click user are able to upload a picture from their device gallery, which would get cast to an imageview. The problem is that it is only able to retrieve image from device gallery, not from phone camera gallery, or from phone google drive folder. I would want that its able to upload any picture from their phone, regardless of the source. Below is the code: Button buttonLoadImage = (Button) findViewById(R.id.btnPictureSelect); buttonLoadImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); ImageView imageView = (ImageView) findViewById(R.id.profilePicturePreview); imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } } private byte[] readInFile(String path) throws IOException { // TODO Auto-generated method stub byte[] data = null; File file = new File(path); InputStream input_stream = new BufferedInputStream(new FileInputStream( file)); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); data = new byte[16384]; // 16K int bytes_read; while ((bytes_read = input_stream.read(data, 0, data.length)) != -1) { buffer.write(data, 0, bytes_read); } input_stream.close(); return buffer.toByteArray(); } Any help would be greatly appreciated. U…
has title: Upload image from entire phone
tagged with: java
type: Question

http://stackoverflow.com/q/26388913
tagged with: weblogic
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: security
has title: Weblogic admin console not starting
type: Question
has comment: http://stackoverflow.com/comment/41440395
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/26400434
tagged with: java
has body: I am seeing the following error starting my Weblogic admin server: 15, 2014 5:10:48 PM GMT+05:30&gt; &lt;Notice&gt; &lt;Security&gt; &lt;BEA-090082&gt; &lt;Security initializing using security realm myrealm.&gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Error&gt; &lt;Security&gt; &lt;BEA-000000&gt; &lt;[Security:090735]The DBMS connection was not usable&gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Critical&gt; &lt;Security&gt; &lt;BEA-090403&gt; &lt;Authentication for user denied&gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Critical&gt; &lt;WebLogicServer&gt; &lt;BEA-000386&gt; &lt;Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication for user denied weblogic.security.SecurityInitializationException: Authentication for user denied at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(Unknown Source) at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(Unknown Source) at weblogic.security.service.SecurityServiceManager.initialize(Unknown Source) at weblogic.security.SecurityService.start(SecurityService.java:141) at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64) Truncated. see log file for complete stacktrace &gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to FAILED&gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Error&gt; &lt;WebLogicServer&gt; &lt;BEA-000383&gt; &lt;A critical service failed. The server will shut itself down&gt; &lt;Oct 15, 2014 5:10:52 PM GMT+05:30&gt; &lt;Notice&gt; &lt;WebLogicServer&gt; &lt;BEA-000365&gt; &lt;Server state changed to FORCE_SHUTTING_DOWN&gt; Stopping PointBase server... PointBase server stopped. x86_64 is not a supported Linux hardware platform for Autonomy. I tried changing password in boot.properties but was not able to start portal admin console. I also tried by providing value from console by removing boot.…

http://stackoverflow.com/comment/41395186
type: Comment
has text: @Boann Thanks for the answer. I'm trying to create an array of n objects then to read each one separately. However I got a lot of errors and I don't know how to ignore "/". Your code looks very good but I'm having a hard time trying to figure how List<Rational> rationals = new ArrayList<>(); creates a list and some other instructions.
comment on: http://stackoverflow.com/a/26367898
score: 0
type: AnswerComment

http://stackoverflow.com/comment/41613277
type: Comment
type: QuestionComment
has text: @GregS @Zhuinden I implemented the whole Algorithm myself and are not using any openssl-librarys so I know I caused the bugs myself. ;) Is `NativeBN` also part of openssl?
comment on: http://stackoverflow.com/q/26489195
score: 0

http://stackoverflow.com/q/26447055
has body: String myName[] = {"Mouse","Laptop","Facebook","Logitech"}; // print the first character System.out.println(myName.charAt(0)); // print the second character System.out.println(myName.charAt(1)); // print the last character int lastPos = myName.length() - 1; System.out.println(myName.charAt( lastPos )); /*any one can explain to this noob? It's telling me to change to length, but that's not what I want. Basically what I want is to go through each character of string. */
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26447082
has comment: http://stackoverflow.com/comment/41536437
has answer: http://stackoverflow.com/a/26447526
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/41536429
has comment: http://stackoverflow.com/comment/41536784
downvote count: 3
score: -3
has answer: http://stackoverflow.com/a/26447156
has title: Java:Why is this not possible?
has comment: http://stackoverflow.com/comment/41536413
type: Question
tagged with: java

http://stackoverflow.com/comment/41509677
type: AnswerComment
comment on: http://stackoverflow.com/a/26432490
type: Comment
has text: holy cow, how did i miss that! i read that code 10 times and missed that outer loop.
score: 0

http://stackoverflow.com/q/26360993
has title: How to use variables in Pattern.compile on java in selenium RC
tagged with: http://stackoverflow.com/tag/html
score: 1
accepted answer: http://stackoverflow.com/a/26361269
favorite count: 0
upvote count: 1
answer count: 1
has body: I need to compare the date in the field corresponds to the current day. In selenium ide is solved very simply: storeExpression javascript{var date = new Date();date.getDate()+' '+date.getMonth();} t_date storeExpression javascript{var date = new Date();(date.getDate() -1)+' 'date.getMonth();} y_date assertText //div[@id='a-articles-container']/a[3]/span[2]/span[2]/span[2] regexp:(${t_date}*)|(${y_date}*) But when I export the html code in java, I get an illegal repetition: Pattern.compile("(${t_date}*)|(${y_date}*)") My java code looks like this: Calendar c = Calendar.getInstance(); String t_date = c.get(c.DAY_OF_MONTH) + " " + c.get(c.MONTH); String y_date = (c.get(c.DAY_OF_MONTH)-1) + " " + c.get(c.MONTH); assertTrue(Pattern.compile("(${t_date}*)|(${y_date}*)").matcher(driver.findElement(By.xpath("//div[@id='a-articles-container']/a[5]/span[2]/span[2]/span[2]")).getText()).find()); I can compare the text with variable y_date assertTrue(Pattern.compile(y_date).matcher(driver.findElement(By.xpath("//div[@id='a-articles-container']/a[5]/span[2]/span[2]/span[2]")).getText()).find()); or t_date assertTrue(Pattern.compile(t_date).matcher(driver.findElement(By.xpath("//div[@id='a-articles-container']/a[5]/span[2]/span[2]/span[2]")).getText()).find()); But not with both at once! How can I use "or" operator in a pattern to compare the explanatory variables is whether the text?
tagged with: selenium-webdriver
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/26361269
type: AnsweredQuestion
downvote count: 0
type: Question

http://stackoverflow.com/a/26584826
score: 0
answers question: http://stackoverflow.com/q/26416935
type: Answer
has body: Key could be with the DB_TABLE NAME_PrimaryKey-field. Where the PrimaryKey-field is provided with the "primary key" of the table. In the custom client class say CustomAppCache have inner class say CacheKeyGen this can be defined with the properties having database, tableName, primaryKeyField. Now the memcached will have the data with the key as DB_TABLE_NAME_PrimaryKey-field and the table data as the value. While using the setCache set the data to the memcached with all the data of the table. While using the getCache check for matching the pattern of the requisite and perform the intended operation like delete from the cache and reload it. This should solve the key generation problem. Let me know if this solves your key gen problem.

http://stackoverflow.com/comment/41399107
type: QuestionComment
has text: Thank you both. It runs now, but it does not display what I want. I guess I'm one step closer though.
comment on: http://stackoverflow.com/q/26370899
score: 0
type: Comment

http://stackoverflow.com/comment/41816315
score: 0
has text: i have downloaded it from above url http://www.aramex.com/content/uploads/109/232/42254/shipments-tracking-api-wsdl.zip and didnt change anything in that.i also want to request and response mechanism by using soap
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26462244

http://stackoverflow.com/comment/49762728
type: Comment
comment on: http://stackoverflow.com/a/26437044
has text: Do as the writer of this answer suggested, call `bw.newLine()`. This inserts your platform sequence of characters for a new line, which is `"\r\n"` on Windows. You're in all likelihood only writing a `"\n"` as part of your string, and when you open that in Notepad, you see one line, because haven't written the windows new line sequence in your file.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26414950
tagged with: loops
tagged with: methods
has comment: http://stackoverflow.com/comment/41477938
type: Question
score: -2
upvote count: 0
answer count: 1
has title: How can I edit my code to include a method
has answer: http://stackoverflow.com/a/26414989
favorite count: 0
has body: How can I edit my code to include a method, call it rollDice(), to return the generated random integer number between 1 and 6? Thanks. Here's my current code: public class CrapsGame { public static void main(String[] args) { int dice1 = (int)(Math.random()* 6) + 1; int dice2 = (int)(Math.random()* 6) + 1; int roll = dice1 + dice2; System.out.println(); System.out.print("You rolled "+roll+". "); if(roll == 2 || roll == 3 || roll == 12){ System.out.println("You lose"); } else if(roll == 7 || roll == 11){ System.out.println("You win"); } else{ System.out.println("point is "+roll+"\n"); dice1 = (int)(Math.random()* 6) + 1; dice2 = (int)(Math.random()* 6) + 1; int roll2 = dice1 + dice2; System.out.print("You rolled "+roll2+". "); while(roll2 != 7){ if(roll == roll2){ System.out.println("You win"); break; } else{ System.out.println("point is "+roll+"\n"); } dice1 = (int)(Math.random()* 6) + 1; dice2 = (int)(Math.random()* 6) + 1; roll2 = dice1 + dice2; System.out.print("You rolled "+roll2+". "); } if(roll2 == 7){ System.out.println("You lose"); } } } }
has comment: http://stackoverflow.com/comment/41477897
type: UnansweredQuestion
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/41433168
type: Comment
type: QuestionComment
has text: Yes. it is possible to access remote AD. But which mechanism do you want to use ?
score: 0
comment on: http://stackoverflow.com/q/26389358

http://stackoverflow.com/a/26359577
downvote count: 0
score: 1
has body: The main disadvantage is the general one: in Java, you can only inherit from one class at a time, while you can implement as many interfaces as you like. If list is a private or local variable, there's virtually no advantage initializing as an interface. You'd be better of with ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); However, if you have a public field or a method parameter, you'd be better off with the least specific declaration: the interface. The abstract class also implements the interface, so it can be used. But the consumer of your class can then use any class that implements the interface, while this class can inherit from any other class they might like.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26359370

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/26456228
type: Tag
tags question: http://stackoverflow.com/q/26366478

http://stackoverflow.com/comment/41452905
has text: possible duplicate of [Convert Java String to sql.Timestamp](http://stackoverflow.com/questions/7628103/convert-java-string-to-sql-timestamp)
score: 1
comment on: http://stackoverflow.com/q/26401568
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/41486105
comment on: http://stackoverflow.com/q/26419447
type: Comment
type: QuestionComment
has text: Don't want a pic, want a runnable example which demonstrates you problem, so we see and try your code
score: 0

http://stackoverflow.com/comment/41511245
comment on: http://stackoverflow.com/a/26419628
has text: first of all,thanks a lot for your help.However, I pasted your code (no errors) but when I try to launch your project on a virtual device, it crash? whats the problem? thanks
score: 0
type: AnswerComment
type: Comment

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/26405460

http://stackoverflow.com/comment/41643236
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26505708
has text: could you tell me what is the purpose of index
type: AnswerComment

tag-handler
type: Tag
tag name: tag-handler
tags question: http://stackoverflow.com/q/26363729

http://stackoverflow.com/a/26458975
has body: Can be done as shown below using java.util.Calendar // get calender for today's date Calendar date = new GregorianCalendar(); // reset hour, minutes, seconds and millis to midnight date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); date.set(Calendar.MILLISECOND, 0); Alternatively, you can also use joda-time API DateTime today = new DateTime().withTimeAtStartOfDay();
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26458847
type: Answer
has comment: http://stackoverflow.com/comment/41558141
has comment: http://stackoverflow.com/comment/41562880
score: 2

http://stackoverflow.com/comment/41505874
comment on: http://stackoverflow.com/a/26429998
has text: Thank you i'll try that later, but is there a way to do this, as it looks like, simple task "getting program started again with keyboard input after timer expires" with not playing with threads? I cant see a way around it. Without keyboard input 'y' it is simple,it just calls main again after _System.out.println("Time expired! "+yourResult);_ but with this input thing it is really a nuisance.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26466288
score: 0
has comment: http://stackoverflow.com/comment/41570442
answers question: http://stackoverflow.com/q/26466148
has body: Assuming your package is app.bl.facade you have to place this tag in your application-context.xml &lt;context:component-scan base-package="app.bl.facade" /&gt; Above XML tag will perform an auto scanning. Each class which should be created as a bean is annotated with a correct stereotype annotation like @Component (for general bean) or @Controller (for a servlet controllers) or @Repository (for DAO classes) or @Service and these classes should be placed under the same base package app.bl.facade. If above criteria is met, then spring will automatically find all of these and create a bean for each one.
type: Answer
has comment: http://stackoverflow.com/comment/41570512

http://stackoverflow.com/comment/41601828
type: QuestionComment
has text: Your posted code is not related to your logcat....so post the MainActivity all code...
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26483303